unione-form-vue 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,26 +1,26 @@
1
- (function(Z,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@hufe921/canvas-editor"),require("dayjs"),require("prismjs"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@hufe921/canvas-editor","dayjs","prismjs","@ant-design/icons-vue","uuid"],Y):(Z=typeof globalThis<"u"?globalThis:Z||self,Y(Z.index={},Z.UnioneBaseVue,Z.Vue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.canvasEditor,Z.dayjs,Z.prism,Z.iconsVue,Z.uuid))})(this,function(Z,Y,i,X,ha,jt,fa,re,ua,xl,Ke,pa){"use strict";const ma={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},nn=i.ref(ma);function Fe(a){return a&&(nn.value=Y.utils.obj.ext(nn.value,a)),nn.value}const ga={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ka={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},ba=i.ref([ga,ka]);function ya(a,e){return Y.locales.loadLanguage(a,()=>new Promise((t,n)=>{const l=ba.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};t(s)}else{const s={...l[0],...o};t(s)}});else if(l.length==0){const o={...e,localeName:a};t(o)}else{const o={...l[0],...e};t(o)}else l.length>0?t(l[0]):n("local language not defined ,lang:"+a)}))}const ln={...Y.locales};ln.loadLanguage=ya;class wa{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=i.ref(e),this.$pid=i.ref(""),this.$store=i.ref({}),this.$forms=i.ref({}),this.$params=i.ref({}),this.$refObj=i.ref({}),this.$refData=i.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,n){}use(e,t,n){let l=this.$store.value[e];return l||(l=new on(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),n&&(l.$form=n,this.$forms.value[e]=n),l}useForm(e,t,n){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{n&&n(o)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class on{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,n){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=i.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=Y.useDialog(),this.$model=n||i.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(n=>{e[n.name]==null&&e[n.name]==null&&(this.$params[n.name]!=null&&this.$params[n.name]!=null?e[n.alias||n.name]=this.$params[n.name]:n.value!=null&&n.value!=null&&(e[n.alias||n.name]=n.value))});else if(this.$params)for(const n in this.$params)e[n]==null&&e[n]==null&&this.$params[n]!=null&&this.$params[n]!=null&&(e[n]=this.$params[n]);return e}request(e){return new Promise((t,n)=>{const l=X.message.loading("数据请求中..."),o=this.$store.controller+e.url;Y.axios.form({method:"post",...e,url:o}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const t=this.$store.controller+(this.$store.findUrl||"/find");return!e&&this.$store.findParams&&(e={dsn:this.$dsn}),this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e&&(e.body=this.$processParams(e.body,this.$store.findParams)),new Promise((n,l)=>{const o=X.message.loading("数据加载中...");Y.axios.form({url:t,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:s})}).finally(()=>{o()})})}save(e){const t=this.$store.controller+(this.$store.saveUrl||"/save");return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((n,l)=>{const o=X.message.loading("数据提交中...");Y.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||X.message.success(s.message),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/detail";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body),t(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,n)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=X.message.loading("数据处理中..."),o=this.$store.controller+"/delete";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Aa{$event;$onces;$delayEmit;constructor(){this.$event=i.ref({}),this.$onces=i.ref({}),this.$delayEmit=i.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const n=this.$delayEmit.value[e];t(n)}}$emit(e,t){if(this.$onces.value[e]){const n=this.$onces.value[e];delete this.$onces.value[e],n(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class ut{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=i.ref("run"),this.type=i.ref(e.types||"setting"),this.define=i.ref(e),this.ebus=new Aa,this.$widgetList=i.ref([]),this.$widgetMap=i.ref({}),this.$dataManager=new wa(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=i.ref({}),this.$dialog=Y.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const n=sessionStorage.getItem("PAGE_DEFINE:"+e);if(n&&this.model.value=="run"){this.define.value=JSON.parse(n),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}Y.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const n={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(n),Y.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(X.message.success(o.message),this.define.value=o.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(o.body)):(this.$dialog.error({content:o.message}),t())}).catch(o=>{console.error("页面配置保存失败",o),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const n={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(n),n.configs?.widgets&&this.$processWidget(n.configs.widgets)),this.$widgetMap.value[e]=n}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+ha.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const xa={class:"widget-setting-dialog"},Ca=i.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{expose:e,emit:t}){const n=t,l=i.ref(),o=i.ref(),s=i.ref(!1);function r(){o.value&&(s.value=!0),n("setting")}function c(){n("saving"),s.value=!1}function h(){return l.value?.clientHeight}function f(){return l.value?.clientWidth}return e({getHeight:h,getWidth:f}),(d,p)=>{const m=i.resolveComponent("SettingOutlined"),b=i.resolveComponent("a-tooltip"),y=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[i.createVNode(b,{title:a.settingTitle},{default:i.withCtx(()=>[a.model=="edit"&&(d.$slots["widget-setting"]||a.custome)?(i.openBlock(),i.createBlock(m,{key:0,class:"widget-setting",onClick:r})):i.createCommentVNode("",!0)]),_:1},8,["title"]),i.renderSlot(d.$slots,"default",{},void 0,!0),a.model=="edit"&&d.$slots["widget-setting"]?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":p[0]||(p[0]=A=>s.value=A),centered:"",width:"80%",onOk:c},{default:i.withCtx(()=>[i.createElementVNode("div",xa,[i.renderSlot(d.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),te=(a,e)=>{const t=a.__vccOpts||a;for(const[n,l]of e)t[n]=l;return t},lt=te(Ca,[["__scopeId","data-v-17b517f5"]]),va={key:0},Sa=["onClick"],fi=te(i.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const t=a,n=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=i.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let u in k){const N=y.value.form.action.params[u];N&&s.value[u]&&Object.keys(s.value[u]).forEach(M=>{N[M]=s.value[u][M]})}s.value={}}function c(k,u,N){r();const M={};M[N]=u[N]||"",N=="showIndex"&&(M[N]=u.show?.query?.index),s.value[k]=M}function h(k,u,N){if(!u||!N){s.value={};return}const M=s.value[k][N];u[N]=M,s.value={}}function f(){y.value.form.action.params.push({title:"新建",name:"",value:""})}function d(){}const p=i.ref(""),m=i.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,u)=>p.value!=u&&t.preset.includes(u)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=i.ref([fa.javascript()]),y=i.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),A=i.ref();function x(k,u,N={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),p.value=k.name,y.value.form=k,y.value.helps=N,y.value.visible=!0,A.value=u}const w=i.ref(null);function V(){w.value&&w.value.validate().then(()=>{y.value.visible=!1,A.value(y.value.form)})}return e({open:x,close}),(k,u)=>{const N=i.resolveComponent("a-input"),M=i.resolveComponent("a-form-item"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-input-number"),B=i.resolveComponent("a-checkbox"),R=i.resolveComponent("a-tab-pane"),g=i.resolveComponent("a-switch"),S=i.resolveComponent("a-button"),T=i.resolveComponent("a-divider"),O=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-tooltip"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-tabs"),Q=i.resolveComponent("a-form"),U=i.resolveComponent("a-modal");return i.openBlock(),i.createBlock(U,{visible:y.value.visible,"onUpdate:visible":u[23]||(u[23]=E=>y.value.visible=E),title:y.value.title,centered:"",width:"50%",onOk:V},{default:i.withCtx(()=>[i.createVNode(Q,{name:"basic",ref_key:"form",ref:w,rules:m.value,model:y.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:i.withCtx(()=>[i.createVNode(D,null,{default:i.withCtx(()=>[i.createVNode(R,{key:"base",tab:"基本设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"操作标题",required:"",name:"title"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.title,"onUpdate:value":u[0]||(u[0]=E=>y.value.form.title=E)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"操作名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.name,"onUpdate:value":u[1]||(u[1]=E=>y.value.form.name=E),disabled:t.preset.includes(y.value.form.name)},null,8,["value","disabled"])]),_:1}),i.createVNode(M,{label:"操作图标"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.icon,"onUpdate:value":u[2]||(u[2]=E=>y.value.form.icon=E)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.type,"onUpdate:value":u[3]||(u[3]=E=>y.value.form.type=E),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.index,"onUpdate:value":u[4]||(u[4]=E=>y.value.form.index=E)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮大小"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.size,"onUpdate:value":u[5]||(u[5]=E=>y.value.form.size=E),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮特性"},{default:i.withCtx(()=>[i.createVNode(B,{checked:y.value.form.props.block,"onUpdate:checked":u[6]||(u[6]=E=>y.value.form.props.block=E)},{default:i.withCtx(()=>u[24]||(u[24]=[i.createTextVNode("自适应 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.danger,"onUpdate:checked":u[7]||(u[7]=E=>y.value.form.props.danger=E)},{default:i.withCtx(()=>u[25]||(u[25]=[i.createTextVNode("危险 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.ghost,"onUpdate:checked":u[8]||(u[8]=E=>y.value.form.props.ghost=E)},{default:i.withCtx(()=>u[26]||(u[26]=[i.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),i.createVNode(R,{key:"action",tab:"响应设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"响应方式",required:""},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.type,"onUpdate:value":u[9]||(u[9]=E=>y.value.form.action.type=E),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.psn,"onUpdate:value":u[10]||(u[10]=E=>y.value.form.action.psn=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.component,"onUpdate:value":u[11]||(u[11]=E=>y.value.form.action.component=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(M,{label:"连接地址"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.href,"onUpdate:value":u[12]||(u[12]=E=>y.value.form.action.href=E)},null,8,["value"])]),_:1}),["link","route"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:2,label:"连接方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.target,"onUpdate:value":u[13]||(u[13]=E=>y.value.form.action.target=E),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:3,label:"抽屉位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.position,"onUpdate:value":u[14]||(u[14]=E=>y.value.form.action.position=E),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:4,label:"显示标题",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.title,"onUpdate:value":u[15]||(u[15]=E=>y.value.form.action.title=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:5,label:"蒙层关闭"},{default:i.withCtx(()=>[i.createVNode(g,{checked:y.value.form.action.maskClosable,"onUpdate:checked":u[16]||(u[16]=E=>y.value.form.action.maskClosable=E),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:6,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.width,"onUpdate:value":u[17]||(u[17]=E=>y.value.form.action.width=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:7,label:"显示高度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.height,"onUpdate:value":u[18]||(u[18]=E=>y.value.form.action.height=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(T,{orientation:"left"},{default:i.withCtx(()=>[u[29]||(u[29]=i.createTextVNode("参数列表 ")),i.createVNode(S,{size:"small",class:"param-btn",onClick:f},{default:i.withCtx(()=>u[27]||(u[27]=[i.createTextVNode("添加")])),_:1}),i.createVNode(S,{size:"small",class:"param-btn",danger:"",onClick:d},{default:i.withCtx(()=>u[28]||(u[28]=[i.createTextVNode("删除")])),_:1})]),_:1}),i.createVNode($,{columns:n.value,"data-source":y.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:E})=>[["name","title"].includes(E.key)?(i.openBlock(),i.createElementBlock("span",va,[i.createVNode(O),i.createTextVNode(" "+i.toDisplayString(E.title),1)])):i.createCommentVNode("",!0),["value"].includes(E.key)?(i.openBlock(),i.createBlock(F,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:i.withCtx(()=>[i.createElementVNode("span",null,[i.createVNode(O),i.createTextVNode(" "+i.toDisplayString(E.title),1)])]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:E,text:P,record:I,index:_})=>[["name","title","value"].includes(E.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!s.value[_]||!Object.keys(s.value[_]).includes(E.dataIndex))&&!P&&"empty"]),onClick:z=>c(_,I,E.dataIndex)},[s.value[_]&&Object.keys(s.value[_]).includes(E.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(N,{key:0,value:s.value[_][E.dataIndex],"onUpdate:value":z=>s.value[_][E.dataIndex]=z,onBlur:z=>h(_,I,E.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(P),1)],64))],10,Sa)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),i.createVNode(R,{key:"event",tab:"事件设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"点击事件",help:y.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.clickScript,"onUpdate:modelValue":u[19]||(u[19]=E=>y.value.form.event.clickScript=E),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"禁用逻辑",help:y.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.disableScript,"onUpdate:modelValue":u[20]||(u[20]=E=>y.value.form.event.disableScript=E),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"显示逻辑",help:y.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.visibleScript,"onUpdate:modelValue":u[21]||(u[21]=E=>y.value.form.event.visibleScript=E),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"动态标题",help:y.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.titleScript,"onUpdate:modelValue":u[22]||(u[22]=E=>y.value.form.event.titleScript=E),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Ba=["src"],Na=["src"],Va=te(i.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const t=Fe(),n=a,l=Y.useSession();i.watch(()=>n.widget?.event,()=>{s()}),i.onMounted(()=>{s()});const o=i.ref({});function s(){n.widget?.event&&(n.widget.event.clickScript?o.value.click=new Function("ctx","btn","event",n.widget.event.clickScript):n.widget.event.click&&(o.value.click=n.widget.event.click),n.widget.event.disableScript?o.value.disable=new Function("ctx","btn",n.widget.event.disableScript):n.widget.event.disable&&(o.value.disable=n.widget.event.disable),n.widget.event.visibleScript?o.value.visible=new Function("ctx","btn",n.widget.event.visibleScript):n.widget.event.visible&&(o.value.visible=n.widget.event.visible),n.widget.event.titleScript?o.value.title=new Function("ctx","btn",n.widget.event.titleScript):n.widget.event.title&&(o.value.title=n.widget.event.title)),typeof n.widget.click=="function"&&(o.value.click=n.widget.click),typeof n.widget.title=="function"&&(o.value.title=n.widget.title),typeof n.widget.visible=="function"&&(o.value.visible=n.widget.visible),typeof n.widget.disabled=="function"&&(o.value.disable=n.widget.disabled)}const r=i.computed(()=>o.value.title?o.value.title(p.value,n.widget):n.widget.title),c=i.computed(()=>o.value.visible?o.value.visible(p.value,n.widget)!=!1:n.widget.visible!=!1),h=i.computed(()=>n.disabled==!0?!0:o.value.disable?o.value.disable(p.value,n.widget):n.widget.disable==!0),f=i.ref(null);function d(){f.value?.open(n.widget,k=>{console.log("btn props",k),Object.keys(k).forEach(u=>{n.widget[u]=k[u]}),console.log("props btn",n.widget)})}const p=i.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),m=i.ref({open:!1}),b=i.computed(()=>{if(n.widget.action?.href){let k=n.widget.action.href;const u=k.matchAll("{[a-zA-Z.]*}"),N=[];let M=null;for(;M=u.next();){if(M&&M.value&&M.value[0]){let v=M.value[0].substring(1,M.value[0].length-1);N.includes(v)||N.push(v)}if(M.done)break}if(N.length>0)for(let v=0;v<N.length;v++){let C=N[v],B=Y.utils.obj.getValue(p.value,C);B?B instanceof Object?k=k.replaceAll("{"+C+"}",JSON.stringify(B)):Array.isArray(B)?k=k.replaceAll("{"+C+"}",B.join(",")):k=k.replaceAll("{"+C+"}",B):k=k.replaceAll("{"+C+"}","")}return k}return""}),y=i.computed(()=>{const k={};let u=n.widget.action?.href||n.widget.action?.link;if(u){const N=u.matchAll("{[a-zA-Z0-9.]*}"),M=[];let v=null;for(;v=N.next();){if(v&&v.value&&v.value[0]){let B=v.value[0].substring(1,v.value[0].length-1);M.includes(B)||M.push(B)}if(v.done)break}if(M.length>0)for(let B=0;B<M.length;B++){let R=M[B],g=Y.utils.obj.getValue(p.value,R);g?g instanceof Object?u=u.replaceAll("{"+R+"}",JSON.stringify(g)):Array.isArray(g)?u=u.replaceAll("{"+R+"}",g.join(",")):u=u.replaceAll("{"+R+"}",g):u=u.replaceAll("{"+R+"}","")}const C=u.split("?")[1];C&&C.split("&").forEach(B=>{const R=B.split("=");R[0]&&R[1]&&(k[R[0]]=R[1])})}return n.widget.action?.params&&n.widget.action.params.filter(N=>N.value+"").forEach(N=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(N.value)){let v=Y.utils.obj.getValue(p.value,N.value);k[N.name]=v}else k[N.name]=N.value}),k}),A=e,x=i.inject("router");function w(k){if(t.isDebug&&console.log("unione btn click",n.widget,k),!(o.value.click&&o.value.click(p.value,n.widget,k)==!1)){if(n.widget.action?.type=="drawer"||n.widget.action?.type=="dialog")m.value.open=!0;else if(n.widget.action?.type=="route"&&(n.widget.action?.href||n.widget.action?.link)){if(n.widget.action.link&&n.editor?.type.value=="code")return;x.push({path:n.widget.action.href||n.widget.action?.link,query:y.value})}A("click",{btn:n.widget,event:k})}}function V(k){A("click",k)}return(k,u)=>{const N=i.resolveComponent("a-button"),M=i.resolveComponent("unione-btn"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-drawer"),B=i.resolveComponent("a-modal");return c.value?(i.openBlock(),i.createBlock(lt,{key:0,class:i.normalizeClass(["unione-btn",a.widget.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:d,custome:!0,"setting-title":"按钮设置"},{default:i.withCtx(()=>[!a.widget.widget||a.widget.widget=="button"?(i.openBlock(),i.createBlock(N,i.mergeProps({key:0,disabled:h.value,size:a.widget.size||"small",type:a.type||a.widget.type,shape:a.widget.shape,class:"unione-btn-"+a.widget.name,loading:a.widget.loading,target:a.widget.action?.target,title:a.widget.tooltip,onClick:w},a.widget.props),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value)+" ",1)]),_:2},[a.widget.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):i.createCommentVNode("",!0),a.widget.widget=="dropdown"?(i.openBlock(),i.createBlock(v,{key:1,trigger:[a.widget.trigger||"hover"],class:i.normalizeClass([a.widget.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["dropdown-overlay",a.widget.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.widget.items,R=>(i.openBlock(),i.createBlock(M,{key:R.name,class:"item",widget:R,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:V},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode(N,{size:a.widget.size||"small"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):i.createCommentVNode("",!0),a.widget.action?.type=="drawer"?(i.openBlock(),i.createBlock(C,{key:2,open:m.value.open,"onUpdate:open":u[0]||(u[0]=R=>m.value.open=R),title:a.widget.action?.title,placement:a.widget.action?.position,maskClosable:a.widget.action?.maskClosable,width:a.widget.action?.width,bodyStyle:{padding:0,overflow:!a.widget.action.component||a.widget.action.component=="iframe"?"hidden":"auto"}},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,Ba)):i.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):i.createCommentVNode("",!0),a.widget.action?.type=="dialog"?(i.openBlock(),i.createBlock(B,{key:3,open:m.value.open,"onUpdate:open":u[1]||(u[1]=R=>m.value.open=R),title:a.widget.action?.title,width:a.widget.action?.width,maskClosable:a.widget.action?.maskClosable,centered:"",footer:null},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:i.normalizeStyle({height:a.widget.action?.height?a.widget.action?.height+"px":""})},null,12,Na)):i.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):i.createCommentVNode("",!0),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):i.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b868da76"]]),Ra={key:0,class:"unione-widget-empty-tip"},Ea=te(i.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,t=i.ref(),n=i.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=i.resolveComponent("a-tab-pane"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:i.withCtx(()=>[n.value?(i.openBlock(),i.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":o[0]||(o[0]=c=>t.value=c)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.chidlren,(c,h)=>(i.openBlock(),i.createBlock(s,{key:h,class:"unione-layout-tab-pane"},{tab:i.withCtx(()=>[i.createElementVNode("span",null,[c.icon?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.icon),{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(c.title),1)])]),default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.chidlren,(f,d)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(f.widget),{key:d,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(i.openBlock(),i.createElementBlock("div",Ra,i.toDisplayString(c.emptyTips),1)):i.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):i.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Oa={class:"title"},Ma={class:"text"},Ta={key:0,class:"reactive"},Ia={key:1,class:"opts"},Fa={class:"warp"},Da=te(i.defineComponent({__name:"section",props:i.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=i.computed(()=>e.editor?.widget(e.wid)||e.widget),n=i.computed(()=>t.value?.title||e.title),l=i.computed(()=>t.value?.icon||e.icon),o=i.computed(()=>t.value?.type||e.type),s=i.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,h)=>(i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[i.createElementVNode("div",Oa,[o.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["type",o.value])},null,2)):i.createCommentVNode("",!0),l.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value),{key:1,class:"icon"})):i.createCommentVNode("",!0),i.createElementVNode("span",Ma,i.toDisplayString(n.value),1)]),a.reactive?(i.openBlock(),i.createElementBlock("div",Ta,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):i.createCommentVNode("",!0),a.location=="left"?(i.openBlock(),i.createElementBlock("div",Ia,[i.renderSlot(c.$slots,"opts",{},void 0,!0)])):i.createCommentVNode("",!0)],2),i.withDirectives(i.createElementVNode("div",Fa,[i.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[i.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),_a={class:"unione-props-setting unione-form-setting"},Pa={class:"unione-form-btns"},$a={key:0},La=["onClick"],Ua={class:"field-txt"},za=["onClick"],ja={key:1,class:"field-txt"},qa=["onClick"],Qa={key:0,class:"field-txt"},Wa={key:3,class:"edit-field"},Ya={key:0},Ha=["onClick"],Ka=te(i.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=i.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.settings||(v.configs.settings={}),v.configs.settings.btns||(v.configs.settings.btns=[]),v}),l=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{const v=n.value.configs.settings.btns,C=v.map(B=>B.name);if(!C.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};v.splice(B.index,0,B)}if(!C.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let R=B.index||1;v.splice(R,0,B)}if(!C.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};v.splice(B.index,0,B)}if(!C.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};v.splice(B.index,0,B)}return v}),s=i.ref(null);function r(v){s.value&&s.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.settings.btns.sort((B,R)=>{const g=B.index||1,S=R.index||1;return g-S}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const v=n.value.configs.settings.btns.length+1;let C={title:"新增",name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C.name="new_"+n.value.configs.settings.btns.length;const B=n.value.configs.settings.btns.filter(R=>R.name==C.name).length;B>0&&(C.name=C.name+B),n.value.configs.settings.btns.push(C),e.editor.widget(e.wid,n.value),s.value.open(C,R=>{Object.keys(R).forEach(g=>{C[g]=R[g]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(v){const C=()=>{if(["save","submit","reset","back"].includes(v.name))v.visible=!1,n.value.configs.settings.btns=[...n.value.configs.settings.btns];else{const B=[];n.value.configs.settings.btns.forEach(R=>{R.name!=v.name&&B.push(R)}),n.value.configs.settings.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{C()}})}const f=i.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:v=>{const C=f.value.widgets.filter(B=>B.value==v);return C[0]?C[0].label:v},toSetting:()=>{}}),d=i.ref({visible:!1,field:{},props:{},showInfo:v=>{let C="";return v.rules&&(C=v.rules.filter(B=>B.enable).length||""),C&&(C="("+C+")"),C},toSetting:()=>{const v=d.value.props,C={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(C.min=v.rangeMin,C.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(C.max=v.rangeMax,C.enable=!0);const B={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(B.pattern=v.regExpress,B.enable=!0),d.value.field.rules=[C,B],d.value.visible=!1,d.value.props={},console.log("rule",d.value.field.rules)}});function p(v){d.value.visible=!0,d.value.field=v;const C=v.rules||[],B={trigger:"change",whitespace:!0};C.forEach(R=>{R.name=="reg"&&(B.trigger=R.trigger,B.whitespace=R.whitespace,B.regExpress=R.pattern,B.regMessage=R.message),R.name=="range"&&(B.rangeMin=R.min,B.rangeMax=R.max,B.rangeMessage=R.message)}),d.value.props=B}const m=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(v,C){const B=w.value.filter(g=>g.name==v.name);B.forEach(g=>{C!="isSort"?g[C]=!0:g[C]=!g[C]});const R=B[0];if(!(!R||C=="isSort")){switch(m.value.prop=C,m.value.field=v,R.show||(R.show={}),C){case"isQuery":R.show.query||(R.show.query={}),m.value.show=R.show.query,m.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":R.show.form||(R.show.form={}),m.value.show=R.show.form,m.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":R.show.view||(R.show.view={}),m.value.show=R.show.view,m.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":R.show.list||(R.show.list={}),m.value.show=R.show.list,m.value.title=`列头设置/${v.title}(${v.name})`;break}m.value.visible=!0}}const y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(v,C)=>{y.value.convert.options.splice(v,1)},toSetting:()=>{y.value.visible=!1}});function A(v){y.value.visible=!0,y.value.field=v,y.value.convert=v.convert||{}}const x=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),w=i.computed(()=>x.value.fields?.length?x.value.fields:[]),V={mounted:v=>v.focus()},k=i.ref({});function u(v,C){const B={};C=="convertName"?B[C]=v.convert?.type:B[C]=v[C]||"",k.value={},k.value[v.name]=B}function N(v,C){{k.value={};return}}function M(v,C){w.value.filter(R=>R.name==v.name).forEach(R=>{R[C]=!R[C]})}return(v,C)=>{const B=i.resolveComponent("a-divider"),R=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),T=i.resolveComponent("a-select"),O=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-checkbox"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-select-option"),Q=i.resolveComponent("a-form-item"),U=i.resolveComponent("a-form"),E=i.resolveComponent("a-modal"),P=i.resolveComponent("a-checkbox-group"),I=i.resolveComponent("a-input-number"),_=i.resolveComponent("a-input"),z=i.resolveComponent("a-col"),K=i.resolveComponent("a-row");return i.openBlock(),i.createElementBlock("div",_a,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[23]||(C[23]=[i.createTextVNode("按钮设置")])),_:1}),i.createElementVNode("div",Pa,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,L=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:L.name,class:["btn",L.name,!L.visible&&"deleted"],type:L.visible?L.type:"default",size:L.size,ref_for:!0},L.props||{},{onClick:J=>r(L)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(L.title)+" ",1),L.visible?(i.openBlock(),i.createBlock(R,{key:0,class:"btn-del",onClick:i.withModifiers(J=>h(L),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),size:"small",onClick:C[0]||(C[0]=L=>c())},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[24]||(C[24]=[i.createTextVNode("表单设置")])),_:1}),C[36]||(C[36]=i.createTextVNode(" 数据模型:")),i.createVNode(T,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[1]||(C[1]=L=>n.value.dataModel=L)},null,8,["options","value"]),i.createVNode($,{columns:t.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(i.openBlock(),i.createElementBlock("span",$a,[i.createVNode(O),i.createTextVNode(" "+i.toDisplayString(L.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:L,text:J,record:ee})=>[["rules"].includes(L.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!d.value.showInfo(ee)&&"empty"]),onClick:ke=>p(ee)},[i.createElementVNode("span",Ua,i.toDisplayString(d.value.showInfo(ee)),1),d.value.showInfo(ee)?(i.openBlock(),i.createBlock(g,{key:0,type:"link"},{default:i.withCtx(()=>C[25]||(C[25]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,La)):["widget"].includes(L.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!k.value[ee.name]||!Object.keys(k.value[ee.name]).includes(L.dataIndex))&&!J&&"empty"]),onClick:ke=>u(ee,L.dataIndex)},[k.value[ee.name]&&Object.keys(k.value[ee.name]).includes(L.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(T,{key:0,value:ee[L.dataIndex],"onUpdate:value":ke=>ee[L.dataIndex]=ke,options:f.value.widgets,onBlur:C[2]||(C[2]=ke=>N())},null,8,["value","onUpdate:value","options"])),[[V]]):(i.openBlock(),i.createElementBlock("span",ja,i.toDisplayString(f.value.widgetName(J)),1))],10,za)):["convertName"].includes(L.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!k.value[ee.name]||!Object.keys(k.value[ee.name]).includes(L.dataIndex))&&!ee.convert?.type&&"empty"]),onClick:ke=>u(ee,L.dataIndex)},[k.value[ee.name]&&Object.keys(k.value[ee.name]).includes(L.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(T,{key:0,value:ee[L.dataIndex],"onUpdate:value":ke=>ee[L.dataIndex]=ke,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:C[3]||(C[3]=ke=>N())},null,8,["value","onUpdate:value"])),[[V]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[ee.convert?.type?(i.openBlock(),i.createElementBlock("span",Qa,i.toDisplayString(ee.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),ee.convert?.type?(i.openBlock(),i.createBlock(g,{key:1,type:"link",onClick:i.withModifiers(ke=>A(ee),["stop"])},{default:i.withCtx(()=>C[26]||(C[26]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,qa)):["isForm","isView"].includes(L.dataIndex)?(i.openBlock(),i.createElementBlock("div",Wa,[i.createVNode(F,{checked:ee[L.dataIndex],onClick:ke=>M(ee,L.dataIndex)},null,8,["checked","onClick"]),i.createVNode(g,{type:"link",onClick:ke=>b(ee,L.dataIndex)},{default:i.withCtx(()=>C[27]||(C[27]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(E,{visible:f.value.visible,"onUpdate:visible":C[5]||(C[5]=L=>f.value.visible=L),title:"控件设置",onOk:f.value.toSetting},{default:i.withCtx(()=>[i.createVNode(U,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[f.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(Q,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(T,{value:f.value.props.mode,"onUpdate:value":C[4]||(C[4]=L=>f.value.props.mode=L),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(D,{value:"multiple"},{default:i.withCtx(()=>C[28]||(C[28]=[i.createTextVNode("多选")])),_:1}),i.createVNode(D,{value:"tags"},{default:i.withCtx(()=>C[29]||(C[29]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(E,{visible:d.value.visible,"onUpdate:visible":C[13]||(C[13]=L=>d.value.visible=L),title:"规则设置",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(U,{model:d.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[30]||(C[30]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(Q,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(P,{value:d.value.props.trigger,"onUpdate:value":C[6]||(C[6]=L=>d.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),d.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(F,{value:d.value.props.whitespace,"onUpdate:value":C[7]||(C[7]=L=>d.value.props.whitespace=L),checked:d.value.props.whitespace},{default:i.withCtx(()=>C[31]||(C[31]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[32]||(C[32]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(Q,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(I,{value:d.value.props.rangeMin,"onUpdate:value":C[8]||(C[8]=L=>d.value.props.rangeMin=L)},null,8,["value"]),C[33]||(C[33]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(I,{value:d.value.props.rangeMax,"onUpdate:value":C[9]||(C[9]=L=>d.value.props.rangeMax=L)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.rangeMessage,"onUpdate:value":C[10]||(C[10]=L=>d.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[34]||(C[34]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(Q,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regExpress,"onUpdate:value":C[11]||(C[11]=L=>d.value.props.regExpress=L)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regMessage,"onUpdate:value":C[12]||(C[12]=L=>d.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(E,{visible:m.value.visible,"onUpdate:visible":C[20]||(C[20]=L=>m.value.visible=L),title:m.value.title,onOk:m.value.toSetting},{default:i.withCtx(()=>[i.createVNode(U,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(Q,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(I,{value:m.value.show.index,"onUpdate:value":C[14]||(C[14]=L=>m.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.width,"onUpdate:value":C[15]||(C[15]=L=>m.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.labelWidth,"onUpdate:value":C[16]||(C[16]=L=>m.value.show.labelWidth=L)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.valueWidth,"onUpdate:value":C[17]||(C[17]=L=>m.value.show.valueWidth=L)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(T,{value:m.value.show.fixed,"onUpdate:value":C[18]||(C[18]=L=>m.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(T,{value:m.value.show.align,"onUpdate:value":C[19]||(C[19]=L=>m.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(E,{visible:y.value.visible,"onUpdate:visible":C[22]||(C[22]=L=>y.value.visible=L),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",Ya,[i.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>C[35]||(C[35]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode($,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:L,record:J,index:ee})=>[L.dataIndex==="label"?(i.openBlock(),i.createBlock(_,{key:0,value:J.label,"onUpdate:value":ke=>J.label=ke,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),L.dataIndex==="value"?(i.openBlock(),i.createBlock(_,{key:1,value:J.value,"onUpdate:value":ke=>J.value=ke,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),L.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:ke=>y.value.toDelOption(ee,J)},"删除",8,Ha)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(U,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(K,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(z,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(Q,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(_,{value:y.value.convert.dict,"onUpdate:value":C[21]||(C[21]=L=>y.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Ga=te(i.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const t=a,n=i.ref(!1),l=i.ref(),o=i.ref({}),s=i.ref(null);i.onMounted(()=>{if(c.value.dsn){const w=r.value.dataManager();c.value.primary&&w.psn(c.value.dsn),s.value.setDisabled=x,s.value.getValue=p,s.value.setValue=m,s.value.reset=b,l.value=w.useForm(c.value.dsn,s.value,V=>{o.value=V.body||{}})}t.editor||r.value.loadConfig({widgets:h.value}),t.form?.model&&r.value.setModel(t.form.model),y()});const r=i.computed(()=>t.editor||new ut),c=i.computed(()=>t.widget||t.form||{}),h=i.computed(()=>{let w=c.value.widgets||[];return!w.length&&t.form?.fields&&(w=t.form.fields),w.forEach(V=>{V.widget||(V.widget="unione-form-item"),V.control||(V.control="a-input")}),w}),f=i.inject("pageSetting",{}),d=i.computed(()=>c.value.setting||f?.form||{});i.provide("formSetting",d.value);function p(){return o.value}function m(w){o.value=w,y()}function b(){o.value={},y()}function y(){const w=V=>{V.widget=="unione-form-item"&&V.name&&(V.value!=null&&V.value!=null&&V.value!=""||V.value==0)&&(o.value[V.name]==null||o.value[V.name]==null||o.value[V.name]=="")&&(o.value[V.name]=V.value),V.widgets?.forEach(k=>{w(k)})};h.value.forEach(V=>{w(V)})}function A(){return s.value.validate()}function x(w=!0){n.value=w}return e({validate:A,getValue:p,setValue:m,reset:b,setDisabled:x}),(w,V)=>{const k=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},i.createSlots({default:i.withCtx(()=>[i.createVNode(k,{ref_key:"formObj",ref:s,model:o.value,class:i.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(d.value.showColumn||3)])},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(u,N)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(u.widget),{key:N,widget:u,editor:r.value,value:o.value[u.name],"onUpdate:value":M=>o.value[u.name]=M,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[a.editor&&c.value.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Ka,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-cecc4588"]]);function Cl(a,e=!1){const t=Fe();if(!a)return Promise.reject("字典名称不能为空");const n=localStorage.getItem("UNIONE-DICT-"+a);return n&&e==!1?Promise.resolve(JSON.parse(n)):(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{Y.axios.admin({url:"/api/base/dict/load/"+a}).then(s=>{if(s.success){const r=s.body.filter(c=>c.dictName!=c.dictKey);r.forEach(c=>{c.value=c.dictKey,c.label=c.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):o("字典加载失败,dict:"+a+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function vl(a,e){const t=Fe();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Cl(a),l=n.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",n),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function Ja(a,e){const t=await vl(a,e);return Promise.resolve(t.dictValue)}const Sl={load:Cl,getLabel:Ja,getOption:vl};class Ge{convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.convertObj=e,this.options=e.options||[],this.config=Fe()}load(e,t=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(n=>n.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((n,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Sl.load(this.convertObj.dictName,t).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),n(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((n,l)=>{const o={body:this.convertObj.params||{}};this.convertObj.pidField&&(o.pid=-1);const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?n(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?n(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,Y.axios.admin({url:s,data:o,method:"POST"}).then(h=>{if(h.success){const f={};this.options.forEach(d=>{f[e]=!0}),h.body.forEach(d=>{f[d.value]||this.options.push(d)}),n(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?Sl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(n=>n.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(n=>n.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,n)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return t(o[0].label);n()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((n,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],n(s.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,s),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+s.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){if(this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option")return Promise.resolve(this.options.filter(n=>n.label.indexOf(e)>=0));const t={...this.convertObj.params||{}};return new Promise(n=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:l,data:{body:{...t,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),n(o.body)):n([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField||"id"],t.label=t[this.convertObj.labelField||"title"]}),e}}function pt(a,e=350){let t=null;return n=>{clearTimeout(t),t=setTimeout(()=>{a(n)},e)}}const Xa=["innerHTML"],Za={key:2,class:"text-view"},er=te(i.defineComponent({__name:"formItem",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.computed(()=>o.value.showFormat?o.value.showFormat.call(this,t.value,{label:A.value,form:e.formValue}):A.value||t.value),l=i.inject("formSetting");i.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const o=i.ref({}),s=i.computed(()=>{const x=e.editor?.widget(e.wid)||e.widget||{};return x.event&&Object.keys(x.event).forEach(w=>{const V=x.event[w];V&&(o.value[w]=null,typeof V=="function"?o.value[w]=V:V.enable&&V.scriptText&&(o.value[w]=new Function("value","ctx",V.scriptText)))}),x}),r=i.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=i.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),h=pt(()=>{if(o.value.change)return o.value.change(e.formValue[s.value.name],e.formValue)||s.value.change;s.value.change&&s.value.change(e.formValue[s.value.name],e.formValue)}),f=i.ref({}),d=i.computed(()=>{const x=[],w=s.value.rule||{};let V=s.value.props?.required||s.value.required;if(o.value.required&&(V=o.value.required(e.formValue[s.value.name],e.formValue)),V&&x.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||l.ruleTrigger||"change",validator:(k,u)=>(w?.whitespace&&u&&typeof u=="string"&&(u=u.trim()),u!=null&&u!=null&&(u+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),w.advance&&f.value[w.advance]){const k=f.value[w.advance];x.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"})}return w.regExpress&&x.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&x.push({validator:(k,u)=>u&&(u+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(u+"").length+"]"):Promise.resolve(),trigger:w?.trigger||l.ruleTrigger||"change"}),x}),p=i.computed(()=>{const x=s.value.props||{};if(s.value.control=="a-input-number"){const w=s.value.rule||{};w.rangeMin!=null&&w.rangeMin!=null&&(x.min=w.rangeMin),w.rangeMax!=null&&w.rangeMax!=null&&(x.max=w.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(x.format=s.value.view.dataFormat,x.valueFormat=s.value.view.dataFormat),s.value.required&&(x.required=s.value.required),x}),m=i.computed(()=>{const x=s.value.css||{},w=["form-item-"+s.value.name];return x.cssName&&w.push(x.cssName),l.platform=="app"?x.cssName?typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0&&w.push("all-line"):w.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!x.cssName||typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0)&&w.push("all-line"):s.value.view.width==2&&w.push("2in-line")),w}),b=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&x>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(w/x)}:s.value.view?.width>=3&&x>1?{span:Math.round(w/x)}:{span:w}}),y=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&x>1&&m.value.includes("all-line")?{}:{span:w}}),A=i.ref();return i.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ge(s.value.convert).convert(t.value.toString()).then(x=>{A.value=x})}),(x,w)=>{const V=i.resolveComponent("a-form-item");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-form-item",m.value]),style:i.normalizeStyle(s.value.css?.cssText)},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createBlock(V,{key:0,label:c.value,name:s.value.name,labelCol:b.value,wrapperCol:y.value,required:s.value.props?.required,rules:d.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:i.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value.control||"a-input"),i.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:i.unref(h),value:t.value,"onUpdate:value":w[0]||(w[0]=k=>t.value=k),formValue:a.formValue},p.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:n.value},null,8,Xa)):(i.openBlock(),i.createElementBlock("div",Za,i.toDisplayString(n.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):i.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),tr=te(i.defineComponent({__name:"selectBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Fe();const e=a,t=i.useModel(a,"value"),n=i.ref([]),l=i.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=i.computed(()=>{const m=d.value.convert||e.convert||{};if(m.refValue){const b={};return m.refValue.split(",").forEach(A=>{const x=A.split("=");x.length==1?b[x[0]]=Y.utils.obj.getValue(e.formValue,x[0]):b[x[0]]=Y.utils.obj.getValue(e.formValue,x[1])}),b}return{}}),s=i.computed(()=>(d.value.convert||e.convert||{}).search||!1),r=pt(m=>{const b=d.value.convert||e.convert||{};b.params={...h.value,...o.value},p.value.search(m).then(y=>{n.value=y})},500);function c(m,b){f.value.select&&f.value.select(m,{option:b,formValue:e.formValue})}const h=i.ref();i.onMounted(()=>{const m=d.value.convert||e.convert||{};h.value=m.params||{},m.params={...h.value,...o.value},p.value.load(t.value).then(b=>{n.value=b})});const f=i.ref({}),d=i.computed(()=>{const m=e.editor?.widget(e.wid)||e.widget||{};return m.event&&Object.keys(m.event).forEach(b=>{const y=m.event[b];y&&(f.value[b]=null,typeof y=="function"?f.value[b]=y:y.enable&&y.scriptText&&(f.value[b]=new Function("value","ctx",y.scriptText)))}),m}),p=i.computed(()=>{const m=d.value.convert||e.convert||{};return new Ge(m)});return i.watch(t,pt(()=>{t.value&&p.value.load(t.value).then(m=>{n.value=m})},200)),i.watch(()=>d.value.convert||e.convert||{},pt(()=>{p.value.load().then(m=>{n.value=m})})),i.watch(()=>o.value,pt(()=>{if(console.log(d.value.name+" ref value changed",o.value),o.value){const m=d.value.convert||e.convert||{};m.params={...h.value,...o.value},p.value.load(t.value,!0).then(b=>{n.value=b})}},200),{deep:!0}),(m,b)=>{const y=i.resolveComponent("a-select");return i.openBlock(),i.createBlock(y,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":b[0]||(b[0]=A=>t.value=A),onSearch:i.unref(r),onSelect:c},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-70aaf6fe"]]),ir=te(i.defineComponent({__name:"switchBox",props:i.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.ref({});i.onMounted(()=>{s.value?.load(t.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(n.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?n.value.checkedValue=!0:n.value.checkedValue=1):(n.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?n.value.unCheckedValue=!1:n.value.unCheckedValue=0)})})});const l=i.ref({}),o=i.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(c=>{const h=r.event[c];h&&(l.value[c]=null,typeof h=="function"?l.value[c]=h:h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText)))}),r}),s=i.computed(()=>{const r=o.value.convert||e.convert;return r?new Ge(r):null});return(r,c)=>{const h=i.resolveComponent("a-switch");return i.openBlock(),i.createBlock(h,i.mergeProps({class:"unione-form-switch"},n.value,{checked:t.value,"onUpdate:checked":c[0]||(c[0]=f=>t.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),nr=te(i.defineComponent({__name:"radioBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.ref([]),l=i.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=i.computed(()=>{const f=c.value.convert||e.convert||{};if(f.refValue){const d={};return f.refValue.split(",").forEach(m=>{const b=m.split("=");b.length==1?d[b[0]]=Y.utils.obj.getValue(e.formValue,b[0]):d[b[0]]=Y.utils.obj.getValue(e.formValue,b[1])}),console.log(c.value.name+" ref field:"+f.refValue+",ref value",d),d}return{}}),s=i.ref();i.onMounted(()=>{const f=c.value.convert||e.convert||{};s.value=f.params||{},f.params={...s.value,...o.value},h.value.load(t.value||c.value.value).then(d=>{n.value=d})});const r=i.ref({}),c=i.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(d=>{const p=f.event[d];p&&(r.value[d]=null,typeof p=="function"?r.value[d]=p:p.enable&&p.scriptText&&(r.value[d]=new Function("value","ctx",p.scriptText)))}),f}),h=i.computed(()=>{const f=c.value.convert||e.convert||{};return new Ge(f)});return i.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const f=c.value.convert||e.convert||{};f.params={...s.value,...o.value},h.value.load(void 0,!0).then(d=>{n.value=d})}},{deep:!0}),(f,d)=>{const p=i.resolveComponent("a-radio-group");return i.openBlock(),i.createBlock(p,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":d[0]||(d[0]=m=>t.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),lr=te(i.defineComponent({__name:"checkBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},returnType:{type:String,default:"string"},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:i.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const t=a,n=i.useModel(a,"value"),l=i.ref(),o=i.ref([]),s=i.computed(()=>o.value?.length?o.value:t.options?.length?t.options:[]),r=i.computed(()=>{const b=f.value.convert||t.convert||{};if(b.refValue){const y={};return b.refValue.split(",").forEach(x=>{const w=x.split("=");w.length==1?y[w[0]]=Y.utils.obj.getValue(t.formValue,w[0]):y[w[0]]=Y.utils.obj.getValue(t.formValue,w[1])}),console.log(f.value.name+" ref field:"+b.refValue+",ref value",y),y}return{}}),c=i.ref();i.onMounted(()=>{const b=n.value||f.value.value;t.returnType==="string"?l.value=b.split(","):l.value=b;const y=f.value.convert||t.convert||{};c.value=y.params||{},y.params={...c.value,...r.value},m.value.load().then(A=>{o.value=A})});const h=i.ref({}),f=i.computed(()=>{const b=t.editor?.widget(t.wid)||t.widget||{};return b.event&&Object.keys(b.event).forEach(y=>{const A=b.event[y];h.value[y]=null,A.enable&&A.scriptText&&(h.value[y]=new Function("value","ctx",A.scriptText))}),b}),d=e;function p(b){t.returnType==="string"?n.value=b.join(","):n.value=b,console.log("checkbox changed",n.value),d("change",n.value)}const m=i.computed(()=>{const b=f.value.convert||t.convert||{};return new Ge(b)});return i.watch(()=>n.value,()=>{l.value=Array.isArray(n.value)?n.value:[],n.value&&!Array.isArray(n.value)&&(l.value=n.value.split(","))}),i.watch(()=>r.value,()=>{if(console.log(f.value.name+" ref value changed",r.value),r.value){l.value=[],t.returnType==="string"?n.value="":n.value=[];const b=f.value.convert||t.convert||{};b.params={...c.value,...r.value},m.value.load(void 0,!0).then(y=>{o.value=y})}},{deep:!0}),(b,y)=>{const A=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createBlock(A,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":y[0]||(y[0]=x=>l.value=x),onChange:p},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),or=te(i.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=i.ref(),t=i.useModel(a,"value");return i.watch(()=>e.value,()=>{e.value?t.value=Y.utils.sm2Encrypt(e.value):t.value=""}),(n,l)=>{const o=i.resolveComponent("a-input-password");return i.openBlock(),i.createBlock(o,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=s=>e.value=s)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]);function sn(a){const e=a.toLowerCase().split("_"),t=[];t.push(e[0]);for(let n=1;n<e.length;n++){const l=e[n];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const Bl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Nl(a=10){const e=Date.now().toString(),t=new Uint32Array(a);crypto.getRandomValues(t);let n="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+t[l])%Bl.length;n+=Bl[o]}return n}const sr={toHump:sn,randomStr:Nl},ar=te(i.defineComponent({__name:"randomInput",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},len:{type:Number,default:10}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value");function n(){t.value=Nl(e.len)}return(l,o)=>{const s=i.resolveComponent("SyncOutlined"),r=i.resolveComponent("a-input");return i.openBlock(),i.createBlock(r,{class:"unione-form-random-input",value:t.value,"onUpdate:value":o[0]||(o[0]=c=>t.value=c)},{suffix:i.withCtx(()=>[i.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:n})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),rr={class:"unione-props-setting unione-query-setting"},cr={class:"unione-query-opts"},dr={key:0},hr=["onClick"],fr={key:1},ur={key:1,class:"edit-field"},pr=["onClick"],mr=te(i.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:V})=>V+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),n=i.computed(()=>{const V=e.editor.widget(e.wid)||{};return V.configs||(V.configs={}),V.configs.btns||(V.configs.btns=[]),V}),l=i.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=i.computed(()=>{const V=[],k=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(u=>{V.push(u),k.push(u.name)}),k.includes("query")||V.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||V.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),V.sort((u,N)=>{const M=u.index||1,v=N.index||1;return M-v}),V}),s=i.ref(null);function r(V){s.value&&s.value.open(V,k=>{k.visible=!0,Object.keys(k).forEach(u=>{V[u]=k[u]}),n.value.configs.btns.sort((u,N)=>{const M=u.index||1,v=N.index||1;return M-v}),n.value.configs.btns=[...n.value.configs.btns]})}function c(){const V=n.value.configs.btns.length+1;let k={title:"新增",name:"new_"+V,size:"default",index:V,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.btns.push(k),e.editor.widget(e.wid,n.value),s.value.open(k,u=>{Object.keys(u).forEach(N=>{k[N]=u[N]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(V){const k=()=>{if(["query","reset","advanced"].includes(V.name))V.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const u=[];n.value.configs.btns.forEach(N=>{N.name!=V.name&&u.push(N)}),n.value.configs.btns=u}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const f=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),d=i.computed(()=>f.value.fields?.length?f.value.fields:[]),p={mounted:V=>V.focus()},m=i.ref({});function b(){const V=Object.keys(m.value);if(V.length)for(let k in V){const u=d.value.filter(N=>N.name==k);if(u&&u[0]){let N=m.value[k];Object.keys(N).forEach(M=>{if(M=="showIndex"){const v=u[0].show?.query||{};u[0].show||(u[0].show={}),u[0].show.query={...v,index:N[M]}}else u[0][M]=N[M]})}}m.value={}}function y(V,k){b();const u={};u[k]=V[k]||"",k=="showIndex"&&(u[k]=V.show?.query?.index),m.value[V.name]=u}function A(V,k){if(!V||!k){m.value={};return}const u=m.value[V.name][k];if(k=="showIndex"){const N=V.show?.query||{};V.show||(V.show={}),V.show.query={...N,index:u}}else V[k]=u;m.value={}}function x(V,k){d.value.filter(N=>N.name==V.name).forEach(N=>{N[k]=!N[k]})}const w=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:V=>{const k=w.value.options.filter(u=>u.value==V);return k[0]?k[0].label:V}});return(V,k)=>{const u=i.resolveComponent("a-divider"),N=i.resolveComponent("CloseOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("PlusOutlined"),C=i.resolveComponent("a-select"),B=i.resolveComponent("ToolOutlined"),R=i.resolveComponent("a-checkbox"),g=i.resolveComponent("a-input-number"),S=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",rr,[i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[3]||(k[3]=[i.createTextVNode("查询按钮")])),_:1}),i.createElementVNode("div",cr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,T=>(i.openBlock(),i.createBlock(M,i.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"default",ref_for:!0},T.props||{},{onClick:O=>r(T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(N,{key:0,class:"btn-del",onClick:i.withModifiers(O=>h(T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(M,{class:i.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=T=>c()),size:"small"},{default:i.withCtx(()=>[i.createVNode(v)]),_:1})]),i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[4]||(k[4]=[i.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=i.createTextVNode(" 数据模型:")),i.createVNode(C,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":k[1]||(k[1]=T=>n.value.dataModel=T)},null,8,["options","value"]),i.createVNode(S,{columns:t.value,"data-source":d.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:T})=>[["showIndex","queryType"].includes(T.key)?(i.openBlock(),i.createElementBlock("span",dr,[i.createVNode(B),i.createTextVNode(" "+i.toDisplayString(T.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:T,text:O,record:F})=>[["queryType"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>y(F,T.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(C,{key:0,value:F[T.dataIndex],"onUpdate:value":$=>F[T.dataIndex]=$,allowClear:!0,options:w.value.options,onBlur:k[2]||(k[2]=$=>A())},null,8,["value","onUpdate:value","options"])),[[p]]):(i.openBlock(),i.createElementBlock("span",fr,i.toDisplayString(w.value.showLabel(O)),1))],10,hr)):["isQuery"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",ur,[i.createVNode(R,{checked:F[T.dataIndex],onClick:$=>x(F,T.dataIndex)},null,8,["checked","onClick"])])):T.dataIndex=="showIndex"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(T.dataIndex))&&!O&&"empty"]),onClick:$=>y(F,T.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(g,{key:0,value:m.value[F.name][T.dataIndex],"onUpdate:value":$=>m.value[F.name][T.dataIndex]=$,onBlur:$=>A(F,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(F.show?.query?.index||" "),1)],64))],10,pr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),gr={class:"query-btn"},kr={class:"btn-advanced-overlay"},Vl=te(i.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const t=a,n=i.computed(()=>{const A=t.editor?.widget(t.wid)||t.widget||{};return A.btns||(A.btns=[]),A}),l=i.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=i.computed(()=>{let A=[];return n.value.fields?.length&&(A=n.value.fields),A.length==0&&t.fields?.length&&(A=t.fields),A.sort((x,w)=>{const V=x.show?.query?.index||1,k=w.show?.query?.index||1;return V-k}),A.forEach(x=>{!x.widget&&!x.control&&x.convert&&(x.widget="unione-select-box"),x.widget=x.widget||x.control||"a-input",x.defaultValue!=null&&x.defaultValue!="undefined"&&typeof x.defaultValue<"u"&&(f.value[x.name]=x.defaultValue,x.value=x.defaultValue)}),A}),s=i.computed(()=>n.value.labelWidth||7),r=i.computed(()=>{const A=n.value.btns.filter(x=>x.name=="advanced")[0]||{};return A.event?.clickScript&&(A.event.click=new Function("ctx","btn","event",A.event.clickScript)),A.event?.disableScript&&(A.event.disable=new Function("ctx","btn",A.event.disableScript)),A.event?.visibleScript&&(A.event.visible=new Function("ctx","btn",A.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...A}}),c=["query","reset","advanced"],h=i.computed(()=>{const A=n.value.btns.filter(w=>w.name!="advanced"),x=[];return A.forEach(w=>{w.size||(w.size="default"),x.push(w.name)}),x.includes("query")||A.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||A.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),A.sort((w,V)=>{const k=w.index||1,u=V.index||1;return k-u}),A}),f=i.ref({}),d=i.computed(()=>{const A={};return n.value.params?Object.keys(n.value.params).forEach(x=>{A[x]=n.value.params[x]}):t.params&&Object.keys(t.params).forEach(x=>{A[x]=t.params[x]}),A});i.onMounted(()=>{t.editor?.ebus.$on("query-form-params",A=>{n.value.params=A}),b()});const p=e;function m({btn:A,event:x}){console.log("unione query form btn click",A,x),A.name=="query"&&b(),A.name=="reset"&&y(),p("btnClick",{btn:A,event:x})}function b(){const A=[];o.value.forEach(w=>{w.visible&&A.push(w.name)});const x={params:{...d.value},keywords:""};Object.keys(f.value).forEach(w=>{A.includes(w)&&(x.params[w]=f.value[w])}),l.value.visible&&f.value[l.value.name]&&(x.keywords=f.value[l.value.name]),p("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){f.value={},o.value.forEach(x=>{x.visible=!1});const A={params:{...d.value},keywords:""};p("reset",A),t.editor?.ebus.$emit("table-list-reset",A)}return(A,x)=>{const w=i.resolveComponent("a-input"),V=i.resolveComponent("a-form-item"),k=i.resolveComponent("unione-btn"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("DownOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},i.createSlots({default:i.withCtx(()=>[i.createVNode(C,{model:f.value,layout:"horizontal","label-col":{span:s.value}},{default:i.withCtx(()=>[l.value.visible?(i.openBlock(),i.createBlock(V,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:i.normalizeStyle({width:s.value})},{default:i.withCtx(()=>[i.createVNode(w,{placeholder:l.value.placeholder,value:f.value[l.value.name],"onUpdate:value":x[0]||(x[0]=B=>f.value[l.value.name]=B),allowClear:"",onKeyup:i.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible?(i.openBlock(),i.createBlock(V,{key:0,label:B.title,class:i.normalizeClass(["query-field",B.name]),style:i.normalizeStyle({width:s.value}),name:B.name},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(B.widget),i.mergeProps({placeholder:B.placeholder,value:f.value[B.name],"onUpdate:value":R=>f.value[B.name]=R,ref_for:!0},B.props||{},{allowClear:"",widget:B}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):i.createCommentVNode("",!0)],64))),128)),i.createElementVNode("div",gr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible!=!1?(i.openBlock(),i.createBlock(k,{key:0,widget:B,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(i.openBlock(),i.createBlock(v,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:i.withCtx(()=>[i.createElementVNode("div",kr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createBlock(u,{key:B.name,class:"item",checked:B.visible,onClick:R=>B.visible=!B.visible},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(B.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:i.withCtx(()=>[i.createVNode(M,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value.title)+" ",1),i.createVNode(N)]),_:1})]),_:1},8,["trigger"])):i.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(mr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),br={class:"unione-props-setting unione-table-setting"},yr={class:"unione-table-tools"},wr={key:1,class:"unione-table-opts"},Ar={key:0},xr=["onClick"],Cr={key:1,class:"edit-field"},vr=["onClick"],Sr={key:1},Br=te(i.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(v,C){let B=v.filter(R=>R.value==C);return B&&B[0]&&B[0].label||C}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(v,C){let B=v.filter(R=>R.value==C);return B&&B[0]&&B[0].label||C}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=i.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.leftBtns||(v.configs.leftBtns=[]),v.configs.rightBtns||(v.configs.rightBtns=[]),v.configs.operation||(v.configs.operation={}),v.configs.operation.btns||(v.configs.operation.btns=[]),v.configs.operation.more||(v.configs.operation.more={}),v}),l=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.leftBtns;if(C.forEach(B=>{v.push(B.name)}),!v.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};C.splice(0,0,B)}if(!v.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};C.splice(1,0,B)}return C}),s=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.rightBtns;if(C.forEach(B=>{v.push(B.name)}),!v.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};C.splice(0,0,B)}if(!v.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};C.splice(1,0,B)}if(!v.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};C.splice(2,0,B)}if(!v.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};C.splice(3,0,B)}return C});function r(v,C){v=="left"?f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(R=>{C[R]=B[R]}),n.value.configs.leftBtns.sort((R,g)=>{const S=R.index||1,T=g.index||1;return S-T}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(R=>{C[R]=B[R]}),n.value.configs.rightBtns.sort((R,g)=>{const S=R.index||1,T=g.index||1;return S-T}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(v){const C=v=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let B={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};v=="left"?n.value.configs.leftBtns.push(B):n.value.configs.rightBtns.push(B),e.editor.widget(e.wid,n.value),r(v,B)}function h(v,C){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(C.name))C.visible=!1,v=="left"?n.value.configs.leftBtns=[...n.value.configs.leftBtns]:n.value.configs.rightBtns=[...n.value.configs.rightBtns];else if(v=="left"){const R=[];n.value.configs.leftBtns.forEach(g=>{g.name!=C.name&&R.push(g)}),n.value.configs.leftBtns=R}else{const R=[];n.value.configs.rightBtns.forEach(g=>{g.name!=C.name&&R.push(g)}),n.value.configs.rightBtns=R}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const f=i.ref(null);function d(v){f.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.operation.btns.sort((B,R)=>{const g=B.index||1,S=R.index||1;return g-S}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function p(){const v=n.value.configs.operation.btns.length+1;let C={title:"新增"+v,name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.operation.btns.push(C),e.editor.widget(e.wid,n.value),f.value.open(C,B=>{Object.keys(B).forEach(R=>{C[R]=B[R]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(v){const C=()=>{if(["delete","view","edit"].includes(v.name))v.visible=!1,n.value.configs.operation.btns=[...n.value.configs.operation.btns];else{const B=[];n.value.configs.operation.btns.forEach(R=>{R.name!=v.name&&B.push(R)}),n.value.configs.operation.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{C()}})}const b=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),y=i.computed(()=>b.value.fields?.length?(b.value.fields.forEach(v=>{v.show||(v.show={}),v.show.list||(v.show.list={})}),b.value.fields):[]),A={mounted:v=>v.focus()},x=i.ref({});function w(){const v=Object.keys(x.value);if(v.length)for(let C in v){const B=y.value.filter(R=>R.name==C);if(B&&B[0]){let R=x.value[C];Object.keys(R).forEach(g=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),g=="showIndex"?B[0].show.list.index=R[g]:g=="showWidth"?B[0].show.list.width=R[g]:g=="fixed"?B[0].show.list.fixed=R[g]:g=="align"?B[0].show.list.align=R[g]:B[0][g]=R[g]})}}x.value={}}function V(v,C){w();const B={};C=="showIndex"?B[C]=v.show?.list?.index:C=="showWidth"?B[C]=v.show?.list?.width:C=="fixed"?B[C]=v.show?.list?.fixed:C=="align"?B[C]=v.show?.list?.align:B[C]=v[C]||"",x.value[v.name]=B}function k(v,C){if(!v||!C){x.value={};return}const B=x.value[v.name][C];v.show||(v.show={}),v.show.list||(v.show.list={}),C=="showIndex"?v.show.list.index=B:C=="showWidth"?v.show.list.width=B:C=="fixed"?v.show.list.fixed=B:C=="align"?v.show.list.align=B:v[C]=B,x.value={}}function u(v,C){return C=="showIndex"?v.show?.list?.index:C=="showWidth"?v.show?.list?.width:C=="fixed"?v.show?.list?.fixed:C=="align"?v.show?.list?.align:v[C]}function N(v,C){y.value.filter(R=>R.name==v.name).forEach(R=>{R[C]=!R[C]})}const M=i.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:v=>{const C=M.value.options.filter(B=>B.value==v);return C[0]?C[0].label:v}});return(v,C)=>{const B=i.resolveComponent("a-divider"),R=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),T=i.resolveComponent("a-input"),O=i.resolveComponent("a-form-item"),F=i.resolveComponent("a-col"),$=i.resolveComponent("a-input-number"),D=i.resolveComponent("a-checkbox"),Q=i.resolveComponent("a-row"),U=i.resolveComponent("a-select"),E=i.resolveComponent("ToolOutlined"),P=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",br,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[8]||(C[8]=[i.createTextVNode("工具设置")])),_:1}),i.createElementVNode("div",yr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,I=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:_=>r("left",I)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(I.title)+" ",1),I.visible?(i.openBlock(),i.createBlock(R,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("left",I),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add"]),size:"small",onClick:C[0]||(C[0]=I=>c("left"))},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add","right"]),onClick:C[1]||(C[1]=I=>c("right")),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,I=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:I.name,class:["btn","right",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size,ref_for:!0},I.props||{},{onClick:_=>r("right",I)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(I.title)+" ",1),I.visible?(i.openBlock(),i.createBlock(R,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("right",I),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[9]||(C[9]=[i.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createBlock(Q,{key:0},{default:i.withCtx(()=>[i.createVNode(F,{span:7},{default:i.withCtx(()=>[i.createVNode(O,{label:"操作标题"},{default:i.withCtx(()=>[i.createVNode(T,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(O,{label:"显示宽度",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":C[2]||(C[2]=I=>n.value.configs.operation.width=I)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:6},{default:i.withCtx(()=>[i.createVNode(O,{label:"显示按钮数量",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":C[3]||(C[3]=I=>n.value.configs.operation.count=I)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(O,{label:"是否显示"},{default:i.withCtx(()=>[i.createVNode(D,{checked:n.value.configs.operation.visible,"onUpdate:checked":C[4]||(C[4]=I=>n.value.configs.operation.visible=I)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[10]||(C[10]=[i.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createElementBlock("div",wr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.configs.operation.btns,I=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"small",ref_for:!0},I.props||{},{onClick:_=>d(I)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(I.title)+" ",1),I.visible?(i.openBlock(),i.createBlock(R,{key:0,class:"btn-del",onClick:i.withModifiers(_=>m(I),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),onClick:C[5]||(C[5]=I=>p()),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})])):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[11]||(C[11]=[i.createTextVNode("表头设置")])),_:1}),C[12]||(C[12]=i.createTextVNode(" 数据模型:")),i.createVNode(U,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[6]||(C[6]=I=>n.value.dataModel=I)},null,8,["options","value"]),i.createVNode(P,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:I})=>[["showIndex","showWidth","align","fixed"].includes(I.key)?(i.openBlock(),i.createElementBlock("span",Ar,[i.createVNode(E),i.createTextVNode(" "+i.toDisplayString(I.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:I,record:_})=>[["showIndex","showWidth"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(I.dataIndex))&&!u(_,I.dataIndex)&&"empty"]),onClick:z=>V(_,I.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock($,{key:0,value:x.value[_.name][I.dataIndex],"onUpdate:value":z=>x.value[_.name][I.dataIndex]=z,onBlur:z=>k(_,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[A]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u(_,I.dataIndex)),1)],64))],10,xr)):["isList","isQuery","isSort"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",Cr,[i.createVNode(D,{checked:_[I.dataIndex],onClick:z=>N(_,I.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(I.dataIndex))&&!u(_,I.dataIndex)&&"empty"]),onClick:z=>V(_,I.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(U,{key:0,value:_.show.list[I.dataIndex],"onUpdate:value":z=>_.show.list[I.dataIndex]=z,allowClear:!0,options:I.options,onBlur:C[7]||(C[7]=z=>k())},null,8,["value","onUpdate:value","options"])),[[A]]):(i.openBlock(),i.createElementBlock("span",Sr,i.toDisplayString(I.showLabel(I.options,u(_,I.dataIndex))),1))],10,vr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Nr={class:"unione-table-tools"},Vr={class:"unione-table-data"},Rr={key:0,class:"unione-table-opts"},Rl=te(i.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:t}){const n=Fe(),l=a,o=i.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=i.computed(()=>o.value.props||{}),r=i.computed(()=>o.value.rowKey||l.rowKey||"id"),c=i.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),h=i.computed(()=>{const S=l.dataList||[];return!S.length&&c.value?c.value.data().body||[]:S}),f=i.computed(()=>{if(o.value.operation==!1)return{visible:!1};const S=Y.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),T=[];let O=(o.value.operation?.btns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F));if(O.forEach(F=>{T.push(F.name)}),T.includes("edit")||O.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),T.includes("view")||O.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),T.includes("delete")||O.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const F=O.filter(D=>D.name=="edit")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",Q=l.editor.model.value;F.action.link=n.editPageUrl+"?psn="+D+"&model="+Q+"&id={row."+l.rowKey+"}"}const $=O.filter(D=>D.name=="view")[0];if($.visible&&($.action||($.action={}),$.action.type||($.action.type="route"),!$.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";$.action.link=n.viewPageUrl+"?psn="+D+"&model=view&id={row."+l.rowKey+"}"}}return O=O.filter(F=>F.visible!=!1).sort((F,$)=>{const D=F.index||1,Q=$.index||1;return D-Q}),S.count&&(O.length>S.count+1?(S.btns=O.slice(0,S.count),S.more.items=O.slice(S.count,O.length),S.more.visible=!0):(S.btns=O,S.more.visible=!1)),S}),d=i.computed(()=>{let S=[];o.value.columns?.length&&(S=[...o.value.columns]);const T=[];S.forEach((F,$)=>{F.dataIndex=F.name,F.convert&&(F.dataIndex=F.name+"Label",F.convertObj=new Ge(F.convert),F.customCell=(D,Q,U)=>{const E=D[U.name];F.convertObj&&(D[U.dataIndex]==null||D[U.dataIndex]==null)&&E!=null&&E!=null&&(E+"").length>0&&(D[U.dataIndex]=E,F.convertObj.convert(E).then(P=>{P&&(D[U.dataIndex]=P)}))}),F.sort?.enable&&(F.sorter=!0,F.sort.multiple&&(F.sorter={},F.sorter.multiple=F.sort.multiple),F.sort.defoult&&(F.defaultSortOrder=F.sort.asc?"ascend":"descend")),F.customRender=({text:D})=>D||"--",F.fkey?.enable&&(F.fkey.labelName&&(F.dataIndex=sn(F.fkey.labelName)),F.fkey.labelTitle&&(F.title=F.fkey.labelTitle),F.customRender=({record:D,column:Q})=>D&&D[Q.name+"FEntry"]&&D[Q.name+"FEntry"][Q.dataIndex]||"--",F.fkey.fields?.forEach((D,Q)=>{if(!D.name)return;const U=sn(D.name),E={fkName:F.name,title:D.title,name:U,dataIndex:D.name,width:D.width,index:D.index||$+Q+1,customRender:({record:P,column:I})=>{if(P&&P[I.fkName+"FEntry"]){const _=P[I.fkName+"FEntry"][I.name];if(_)return D.convertObj&&D.convertObj.convert(_)||_}return"--"}};D.convert&&(D.convertObj=new Ge(D.convert)),T.push(E)}))}),T.forEach(F=>{S.splice(F.index,0,F)});const O=Y.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return O&&O.visible!=!1&&(O.customRender=F=>V.value?(V.value.current-1)*V.value.pageSize+F.index+1:F.index,S=[O,...S]),f.value&&f.value.visible!=!1&&S.push({fixed:"right",align:"center",...f.value,name:"operation"}),S}),p=i.computed(()=>{if(o.value.leftBtns===!1)return[];const S=[],T=[];if((o.value.leftBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),T.push(F.name),F.name=="delBatch"&&!k.value&&(F.visible=!1)}),!T.includes("add")){const F={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};S.splice(0,0,F)}if(!T.includes("delBatch")&&k.value){const F={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};S.splice(1,0,F)}if(l.editor&&l.editor.type.value!="code"){const F=S.filter($=>$.name=="add")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",D=l.editor.model.value;F.action.link=n.addPageUrl+"?psn="+$+"&model="+D}}return S});function m({btn:S,event:T}){if(n.isDebug&&console.log("unione table left btn click",S,T),S.name=="delBatch"){if(!u.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(u.value.selectedRowKeys).then(()=>{R(),B(!0)});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+u.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const b=i.computed(()=>{if(o.value.rightBtns===!1)return[];const S=[],T=[];if((o.value.rightBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),T.push(F.name)}),!T.includes("impData")){const F={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};S.splice(1,0,F)}if(!T.includes("expData")){const F={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};S.splice(2,0,F)}if(!T.includes("downTmpl")){const F={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};S.splice(3,0,F)}return S});function y({btn:S,event:T}){n.isDebug&&console.log("unione table right btn click",S,T),M(S.name,{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("rightBtnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:T,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const A=i.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),x=i.ref({}),w=i.ref(null),V=i.computed(()=>Y.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:S=>"共"+S+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),k=i.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),u=i.ref({selectedRowKeys:[],selectedRowList:[],onChange:(S,T)=>{u.value.selectedRowKeys=S,u.value.selectedRowList=T},getCheckboxProps:S=>({disabled:S.checkable})}),N=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=t;function v({btn:S,event:T},O){if(n.isDebug&&console.log("unione table opt btn click",S,T),S.name=="delete"){if(c.value){c.value.deleteByIds([O[r.value]]).then(()=>{R(),u.value.selectedRowKeys=u.value.selectedRowKeys.filter(F=>F!=O[r.value]),u.value.selectedRowList=u.value.selectedRowList.filter(F=>F[r.value]!=O[r.value])});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(S.name,{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:T,row:O,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}function C(S,T,O,F){console.log("tableChanged",S,T,O,F),w.value={page:S.current,pageSize:S.pageSize},O&&(Array.isArray(O)?(w.value.sorts=[],O.forEach($=>{w.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):O.column&&(w.value.sorts=[{name:O.column.name,asc:O.order=="ascend"}])),R(),M("change",{pagination:S,filters:T,sorter:O,event:F})}function B(S=!1){S?(u.value.selectedRowKeys=[],u.value.selectedRowList=[]):X.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${u.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{u.value.selectedRowKeys=[],u.value.selectedRowList=[]}})}function R(){if(c.value){const S={page:V.value.current,pageSize:V.value.pageSize,keywords:x.value.keywords,body:x.value.params||{}};w.value?.page&&(S.page=w.value.page),w.value?.pageSize&&(S.pageSize=w.value.pageSize),w.value?.sorts&&(S.sorts=w.value.sorts),console.log("dataStorage find params",S),c.value.find(S)}}i.onMounted(()=>{d.value?.forEach(S=>{S.sort?.enable&&S.sort.defoult&&(w.value||(w.value={},w.value.sorts||(w.value.sorts=[]),w.value.sorts.push({name:S.name,asc:S.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",S=>{console.log("table-list-search",S),x.value=S||{},R()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),x.value={},R(),B(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),R()})});function g(){return{keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}}return e({getSelected:g,clearSelected:B}),(S,T)=>{const O=i.resolveComponent("unione-btn"),F=i.resolveComponent("DownOutlined"),$=i.resolveComponent("a-button"),D=i.resolveComponent("a-dropdown"),Q=i.resolveComponent("a-table");return i.openBlock(),i.createBlock(lt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",Nr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,U=>(i.openBlock(),i.createBlock(O,{key:U.name,class:"btn",widget:U,editor:a.editor,onClick:m,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),u.value.selectedRowKeys.length?(i.openBlock(),i.createElementBlock("span",{key:0,class:"selected-info",onClick:T[0]||(T[0]=U=>B())},"当前选中记录("+i.toDisplayString(u.value.selectedRowKeys.length)+")",1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.value,U=>(i.openBlock(),i.createBlock(O,{key:U.name,class:"btn right",widget:U,editor:a.editor,onClick:y,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),i.createElementVNode("div",Vr,[d.value&&d.value.length?(i.openBlock(),i.createBlock(Q,i.mergeProps({key:0,columns:d.value,rowKey:r.value,"data-source":h.value,"row-selection":k.value?u.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:V.value,onChange:C},A.value),{bodyCell:i.withCtx(({column:U,record:E})=>[U.name==="operation"?(i.openBlock(),i.createElementBlock("div",Rr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.btns,P=>(i.openBlock(),i.createBlock(O,{key:P.name,class:"opt",widget:P,editor:a.editor,onClick:I=>v(I,E),preset:N,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(i.openBlock(),i.createBlock(D,{key:0,trigger:[f.value.more.trigger||"hover"],class:i.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.more.items,P=>(i.openBlock(),i.createBlock(O,{key:P.name,class:"item",widget:P,editor:a.editor,onClick:I=>v(I,E),type:"text",preset:N,ctx:{row:E}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode($,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.value.more.title)+" ",1),i.createVNode(F)]),_:1})]),_:2},1032,["trigger","class"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):i.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Br,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a168b83b"]]);class De{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:t,onClose:n,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(re.EDITOR_COMPONENT,re.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(re.EDITOR_COMPONENT,re.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const h=document.createElement("div");h.classList.add("dialog-title");const f=document.createElement("span");f.append(document.createTextNode(e));const d=document.createElement("i");d.onclick=()=>{n&&n(),this._dispose()},h.append(f),h.append(d),c.append(h);const p=document.createElement("div");p.classList.add("dialog-option");for(let A=0;A<t.length;A++){const x=t[A],w=document.createElement("div");if(w.classList.add("dialog-option__item"),x.label){const k=document.createElement("span");k.append(document.createTextNode(x.label)),w.append(k),x.required&&k.classList.add("dialog-option__item--require")}let V;x.type==="select"?(V=document.createElement("select"),x.options?.forEach(k=>{const u=document.createElement("option");u.value=k.value,u.label=k.label,V.append(u)})):x.type==="textarea"?V=document.createElement("textarea"):(V=document.createElement("input"),V.type=x.type),x.width&&(V.style.width=`${x.width}px`),x.height&&(V.style.height=`${x.height}px`),V.name=x.name,V.value=x.value||"",V instanceof HTMLSelectElement||(V.placeholder=x.placeholder||""),w.append(V),p.append(w),this.inputList.push(V)}c.append(p);const m=document.createElement("div");m.classList.add("dialog-menu");const b=document.createElement("button");b.classList.add("dialog-menu__cancel"),b.append(document.createTextNode("取消")),b.type="button",b.onclick=()=>{l&&l(),this._dispose()},m.append(b);const y=document.createElement("button");y.append(document.createTextNode("确定")),y.type="submit",y.onclick=()=>{if(o){const A=this.inputList.map(x=>({name:x.name,value:x.value}));o(A)}this._dispose()},m.append(y),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Er(a){switch(a){case"comment":case"prolog":case"doctype":case"cdata":return{color:"#008000",italic:!0};case"namespace":return{opacity:.7};case"string":return{color:"#A31515"};case"punctuation":case"operator":return{color:"#393A34"};case"url":case"symbol":case"number":case"boolean":case"variable":case"constant":case"inserted":return{color:"#36acaa"};case"atrule":case"keyword":case"attr-value":return{color:"#0000ff"};case"function":return{color:"#b9a40a"};case"deleted":case"tag":return{color:"#9a050f"};case"selector":return{color:"#00009f"};case"important":return{color:"#e90",bold:!0};case"italic":return{italic:!0};case"class-name":case"property":return{color:"#2B91AF"};case"attr-name":case"regex":case"entity":return{color:"#ff0000"};default:return null}}function Or(a){const e=[];function t(n){for(let l=0;l<n.length;l++){const o=n[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))t(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...Er(s)})}}}return t(a),e}const Mr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Tr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Ir="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Fr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Dr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",_r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",Pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",$r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAnFBMVEUAAAAAAAAAgIBVVVVAQFU3SVs8S1o9R1w+Rlg6SlpASFg+RlU6SVc7RVg8Rlg+Rlg/R1g9SFY+SFg+SFc8SFc+Rlg8SFY8RlY+R1g+R1Y+Rlg8Rlc+SFg9R1c9SFc9R1c+R1c9R1Y9R1c8R1c9R1g9R1g9R1c9R1c8R1c9R1c9SFc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///96K4o3AAAAMnRSTlMAAQIDDA4RGR0fICEjNDc6PUdOUlVXWWJrc3R7gI2Sm6GxvMLDyc3R09vd3+309fr8/RCh/swAAAABYktHRDM31XxeAAAAZElEQVQY02NgIA4Iq+joqooh+KJ6Etw8UvricAElWRApowkXUFRAM0LQQI4DmW8EByjKmNlYUfUxSupzQZmsWvxgER0RmKQa2BZ2QwGYAJ+uPC+nkLoyE1w/l4K2noY0C3H+BAAncAfEJkWhEAAAAABJRU5ErkJggg==",zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",Wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAz1BMVEUAAAAAAAAAgIBAQFU7Tk43SVs8RFU6SlpASFg+RlU8RFo6SVdAR1U6RVU+SVg8RlU7RVg+RlY9SFg8R1c9R1c9R1Y8Rlg+SFc+R1g9R1c9Rlc8SFg9SFc9R1Y8R1g+Rlc+SFg9R1c9R1Y8Rlg+R1c8Rlc+SFc9R1g9R1c8Rlc+R1g9SFc8R1c9R1g9Rlc9R1Y+SFc9R1c9R1Y9SFc8R1Y9R1c9R1c+SFc9R1g9R1c9R1c9R1Y9R1c8R1c9R1Y9R1c9R1c9R1c9R1c9R1f////kTFPbAAAAQ3RSTlMAAQIMDQ4eHyAhIiMkMDEzNF9gYWRlZmdrbG1udXZ3eICBgoOEmJmam5ydpKWmp7Gys7S5uru8y8zN5ebn6Onq9/3+2KlzWgAAAAFiS0dERPm0mMEAAAD9SURBVBgZhcFte4FgGIDhK1aUDbMxM8VMsXdmtlj01P3//9N60nHQJ+fJWfVBsFwGgxpl7bXINgz/RNYtjirTdDe0yTjuPp0YFCofElQpVGfyZnAwFZcTrjySa6cBJfOkifazq1Jixt9k6jIk5/R6NjkvtYAHsdFulIjqoDXkHgi2aI6SjLLRIh/4+kW7k1wXLVwAyxCtJ7lbtM0nEGzRHCUZZaNFPjAQB62jRNQ12qX0gZq45Oxut05ulFpk1vsLSsx4hdZKZ5Q8J1fknsTjhCdjDirvMjcpmC/yalAwJknsNcg0RnEyNjhqrkSicBOJrJqUWX1/sfD7Fuf8A/JKIgzf/RoEAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",El="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Ml="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",xc=["title"],Cc=["title"],vc={class:"options"},Sc=["title"],Bc={class:"options"},Nc={class:"options"},Vc=["title"],Rc=["title"],Ec=["title"],Oc=["title"],Mc=["title"],Tc={class:"options"},Ic={class:"options"},Fc={class:"options"},Dc={class:"options"},_c={class:"options"},Pc={class:"menu-item__search__collapse__search"},$c={class:"arrow-left"},Lc={class:"arrow-right"},Uc=te(i.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const t=a,n=i.ref(),l=i.computed(()=>{let R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return t.items&&(t.items.length>1?R=t.items:t.items[0]=="simple"&&(R=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),R});function o(){return n.value?.clientHeight}function s(){return n.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(R,g){console.log("exec cmd "+R+",params:",g),R!="Separator"&&Array.isArray(g)?t.editor?.command["execute"+R](g[0],g[1]):t.editor?.command["execute"+R](g)}function h(R,g){const S=g.target.getBoundingClientRect(),T=n.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=S.height+S.top+"px"}let f=!0,d;function p(){f?(f=!1,d=window.setTimeout(()=>{f=!0,t.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(d)}function m(){f=!0,window.clearTimeout(d),t.editor?.command.executePainter({isDblclick:!0})}function b(){new De({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:R=>{const g=R.find(S=>S.name==="value")?.value;g&&t.editor?.command.executeInsertElementList([{type:re.ElementType.LATEX,value:g}])}})}function y(R){t.editor?.command.executeInsertElementList([{type:R,checkbox:{value:!1},value:""}])}function A(R,g){const S=g.target.getBoundingClientRect(),T=n.value.querySelector("."+R+" .options");T.classList.toggle("visible"),T.style.top=S.height+S.top+"px";const O=ua();T.firstChild.childNodes.forEach(F=>{const $=F.attributes.getNamedItem("label-format").value;F.innerText=O.format($),F.onclick=()=>{t.editor?.command.executeInsertElementList([{type:re.ElementType.DATE,dateFormat:F.attributes.getNamedItem("data-format").value,valueList:[{value:F.innerText.trim()}]}])}})}function x(){new De({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:R=>{const g=R.find(Q=>Q.name==="type")?.value;if(!g)return;const S=R.find(Q=>Q.name==="width")?.value,T=R.find(Q=>Q.name==="height")?.value;if(!T)return;const O=R.find(Q=>Q.name==="src")?.value,F=R.find(Q=>Q.name==="srcdoc")?.value,$={type:g};if($.type===re.BlockType.IFRAME){if(!O&&!F)return;$.iframeBlock={src:O,srcdoc:F}}else if($.type===re.BlockType.VIDEO){if(!O)return;$.videoBlock={src:O}}const D={type:re.ElementType.BLOCK,value:"",height:Number(T),block:$};S&&(D.width=Number(S)),t.editor?.command.executeInsertElementList([D])}})}function w(R){const g=R.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__table__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-270/2+"px";const T=n.value.querySelector(".menu-item__table__collapse .table-close"),O=n.value.querySelector(".menu-item__table__collapse .table-select"),F=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(U=>{$.push(U.childNodes)});let D=0,Q=0;F.onmousemove=U=>{const{offsetX:_,offsetY:z}=U;$.forEach(K=>{K.forEach(L=>{L.classList.remove("active")})}),D=Math.ceil(_/22)||1,Q=Math.ceil(z/26)||1,$.forEach((K,L)=>{K.forEach((J,ee)=>{ee<D&&L<Q&&J.classList.add("active")})}),O.innerText=`${Q}×${D}`},F.onclick=()=>{S.style.display="none",t.editor?.command.executeInsertTable(Q,D)},T.onclick=U=>{U.stopPropagation(),S.style.display="none"}}function V(){const R=n.value.querySelector(".menu-item__image .image");R.click(),R.onchange=function(){const g=R.files[0],S=new FileReader;S.readAsDataURL(g),S.onload=function(){const T=new Image,O=S.result;T.src=O,T.onload=function(){t.editor?.command.executeImage({value:O,width:T.width,height:T.height}),R.value=""}}}}function k(){new De({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:t.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:R=>{const g=R.find(T=>T.name==="name")?.value;if(!g)return;const S=R.find(T=>T.name==="url")?.value;S&&t.editor?.command.executeHyperlink({type:re.ElementType.HYPERLINK,value:"",url:S,valueList:re.splitText(g).map(T=>({value:T,size:16}))})}})}function u(R){R==="add"?new De({title:"水印",data:[{type:"text",label:"内容",name:"data",required:!0,placeholder:"请输入内容"},{type:"color",label:"颜色",name:"color",required:!0,value:"#AEB5C0"},{type:"number",label:"字体大小",name:"size",required:!0,value:"120"},{type:"number",label:"透明度",name:"opacity",required:!0,value:"0.3"},{type:"select",label:"重复",name:"repeat",value:"0",required:!1,options:[{label:"不重复",value:"0"},{label:"重复",value:"1"}]},{type:"number",label:"水平间隔",name:"horizontalGap",required:!1,value:"10"},{type:"number",label:"垂直间隔",name:"verticalGap",required:!1,value:"10"}],onConfirm:g=>{if(~g.findIndex(F=>!F.value))return;const T=g.reduce((F,$)=>(F[$.name]=$.value,F),{}),O=T.repeat==="1";t.editor?.command.executeAddWatermark({data:T.data,color:T.color,size:Number(T.size),opacity:Number(T.opacity),repeat:O,gap:O&&T.horizontalGap&&T.verticalGap?[Number(T.horizontalGap),Number(T.verticalGap)]:void 0})}}):t.editor?.command.executeDeleteWatermark()}function N(){new De({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:R=>{const g=R.find(F=>F.name==="codeblock")?.value;if(!g)return;const S=xl.tokenize(g,xl.languages.javascript),T=Or(S),O=[];for(let F=0;F<T.length;F++){const $=T[F],D=re.splitText($.content);for(let Q=0;Q<D.length;Q++){const E={value:D[Q]};$.color&&(E.color=$.color),$.bold&&(E.bold=!0),$.italic&&(E.italic=!0),O.push(E)}}O.unshift({value:`
2
- `}),t.editor?.command.executeInsertElementList(O)}})}function M(R){const g=R.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__search__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-260/2+"px";const T=n.value.querySelector(".menu-item__search__collapse__search input"),O=n.value.querySelector(".menu-item__search__collapse__replace input"),F=S.querySelector(".search-result");T.focus();const $=()=>{const D=t.editor?.command.getSearchNavigateInfo();if(D){const{index:Q,count:U}=D;F.innerText=`${Q}/${U}`}else F.innerText=""};S.querySelector("span").onclick=()=>{S.style.display="none",T.value="",O.value="",t.editor?.command.executeSearch(null),$()},T.oninput=()=>{t.editor?.command.executeSearch(T.value||null),$()},T.onkeydown=D=>{D.key==="Enter"&&(t.editor?.command.executeSearch(T.value||null),$())},S.querySelector("button").onclick=()=>{const D=T.value,Q=O.value;D&&Q&&D!==Q&&t.editor?.command.executeReplace(Q)},S.querySelector(".arrow-left").onclick=()=>{t.editor?.command.executeSearchNavigatePre(),$()},S.querySelector(".arrow-right").onclick=()=>{t.editor?.command.executeSearchNavigateNext(),$()}}function v(){const R=n.value.querySelector(".menu-item__color .input-color");R.oninput=function(){t.editor?.command.executeColor(R.value)},R.click()}function C(){const R=n.value.querySelector(".menu-item__highlight .input-highlight");R.oninput=function(){t.editor?.command.executeHighlight(R.value)},R.click()}function B(R){switch(R){case re.ControlType.TEXT:new De({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(O=>O.name==="placeholder")?.value;if(!S)return;const T=g.find(O=>O.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,value:T?[{value:T}]:null,placeholder:S}})}});break;case re.ControlType.SELECT:new De({title:"列举控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
1
+ (function(Z,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("unione-base-vue"),require("vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@hufe921/canvas-editor"),require("dayjs"),require("prismjs"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","unione-base-vue","vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@hufe921/canvas-editor","dayjs","prismjs","@ant-design/icons-vue","uuid"],Y):(Z=typeof globalThis<"u"?globalThis:Z||self,Y(Z.index={},Z.UnioneBaseVue,Z.Vue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.canvasEditor,Z.dayjs,Z.prism,Z.iconsVue,Z.uuid))})(this,function(Z,Y,i,X,ha,jt,fa,ae,ua,xl,Ke,pa){"use strict";const ma={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},nn=i.ref(ma);function Fe(a){return a&&(nn.value=Y.utils.obj.ext(nn.value,a)),nn.value}const ga={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},ka={...{submit:"Submit","submit.ok":"Submitted","submit.error":"Submit Failed","confirm.ok":"Yes","confirm.cancel":"No","global.setting.title":"Settings"},...{"pages.home":"Home"},...{"pages.layouts.userLayout.title":"user layout"}},ba=i.ref([ga,ka]);function ya(a,e){return Y.locales.loadLanguage(a,()=>new Promise((t,n)=>{const l=ba.value.filter(o=>o.localeName==a);if(e)if(typeof e=="function")e().then(o=>{if(l.length==0){const s={...o,localeName:a};t(s)}else{const s={...l[0],...o};t(s)}});else if(l.length==0){const o={...e,localeName:a};t(o)}else{const o={...l[0],...e};t(o)}else l.length>0?t(l[0]):n("local language not defined ,lang:"+a)}))}const ln={...Y.locales};ln.loadLanguage=ya;class wa{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=i.ref(e),this.$pid=i.ref(""),this.$store=i.ref({}),this.$forms=i.ref({}),this.$params=i.ref({}),this.$refObj=i.ref({}),this.$refData=i.ref({}),this.$model=t}params(e){if(e){this.$params.value=e,e.id&&(this.$pid.value=e.id,this.$psn.value&&this.use(this.$psn.value,"form").detail(this.$pid.value));for(const t in this.$store.value)this.$store.value[t].$params=e}return this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,n){}use(e,t,n){let l=this.$store.value[e];return l||(l=new on(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),n&&(l.$form=n,this.$forms.value[e]=n),l}useForm(e,t,n){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(o=>{n&&n(o)}),l}data(e){return this.$store.value[e]}form(e){return e?this.$forms.value[e]:this.$forms.value}primary(){return this.data(this.$psn.value)}dsnList(){return Object.keys(this.$store.value)}}class on{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,n){typeof e=="string"?(this.$dsn=e,this.$store={controller:"/api/data/storage/v1"}):(this.$store=e,this.$dsn=""),this.$type=t,this.$data=i.ref(t=="form"?{}:{body:[],total:0}),this.$dialog=Y.useDialog(),this.$model=n||i.ref("run")}$isStorage(){return this.$store.controller.indexOf("/api/data/storage")>=0}store(e){return e&&(this.$store=e),this.$store}data(){return this.$type=="form"?this.$data.value||{}:this.$data.value||[]}setValue(e){this.$data.value=e,this.$form?.setValue(e)}$processParams(e,t){if(t)t.forEach(n=>{e[n.name]==null&&e[n.name]==null&&(this.$params[n.name]!=null&&this.$params[n.name]!=null?e[n.alias||n.name]=this.$params[n.name]:n.value!=null&&n.value!=null&&(e[n.alias||n.name]=n.value))});else if(this.$params)for(const n in this.$params)e[n]==null&&e[n]==null&&this.$params[n]!=null&&this.$params[n]!=null&&(e[n]=this.$params[n]);return e}request(e){return new Promise((t,n)=>{const l=X.message.loading("数据请求中..."),o=this.$store.controller+e.url;Y.axios.form({method:"post",...e,url:o}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据请求失败,model sn:"+this.$dsn+",url:"+o,options:e,err:s})}).finally(()=>{l()})})}find(e){const t=this.$store.controller+(this.$store.findUrl||"/find");return!e&&this.$store.findParams&&(e={dsn:this.$dsn}),this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e&&(e.body=this.$processParams(e.body,this.$store.findParams)),new Promise((n,l)=>{const o=X.message.loading("数据加载中...");Y.axios.form({url:t,method:"post",data:e}).then(s=>{s.success?(this.$data.value=s,n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:s})}).finally(()=>{o()})})}save(e){const t=this.$store.controller+(this.$store.saveUrl||"/save");return this.$isStorage()?(e.dsn=this.$dsn+(this.$model!="run"?"@dev":""),e.params=this.$processParams(e.params,this.$store.saveParams)):e.data=this.$processParams(e.data,this.$store.saveParams),new Promise((n,l)=>{const o=X.message.loading("数据提交中...");Y.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body||{}),s.silence||X.message.success(s.message),n(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:s})}).finally(()=>{o()})})}loadByIds(e){return new Promise((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/loadByIds";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:s})}).finally(()=>{l()})})}detail(e){return new Promise((t,n)=>{const l=X.message.loading("数据加载中..."),o=this.$store.controller+"/detail";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?(this.$type=="form"&&(this.$data.value=s.body),t(s)):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"加载数据详情失败,model sn:"+this.$dsn,url:o,id:e,err:s})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,n)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=X.message.loading("数据处理中..."),o=this.$store.controller+"/delete";Y.axios.form({url:o,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(s=>{s.success?t(s):(s.silence||this.$dialog.error({content:s.message||"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,result:s}))}).catch(s=>{this.$dialog.error({content:"未知错误,请联系管理员"}),n({info:"数据删除失败,model sn:"+this.$dsn,url:o,ids:e,err:s})}).finally(()=>{l()})}})})}}class Aa{$event;$onces;$delayEmit;constructor(){this.$event=i.ref({}),this.$onces=i.ref({}),this.$delayEmit=i.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const n=this.$delayEmit.value[e];t(n)}}$emit(e,t){if(this.$onces.value[e]){const n=this.$onces.value[e];delete this.$onces.value[e],n(t)}this.$event.value[e]?this.$event.value[e](t):(this.$delayEmit.value[e]=t,setTimeout(()=>{delete this.$delayEmit.value[e]},1e3*10))}$once(e,t){this.$onces.value[e]=t}$off(e){delete this.$event.value[e]}}class ut{define;ebus;model;type;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=i.ref("run"),this.type=i.ref(e.types||"setting"),this.define=i.ref(e),this.ebus=new Aa,this.$widgetList=i.ref([]),this.$widgetMap=i.ref({}),this.$dataManager=new wa(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=i.ref({}),this.$dialog=Y.useDialog(),this.loadConfig(t)}sn(){return this.define.value.sn}load(e,t){if(!e)return;if(this.define.value.sn=e,e=="new_"){console.log("新建/本地页面sn:"+e+",define:",t),t&&t.configs&&(this.define.value=t,this.type.value=this.define.value.types||"setting",this.loadConfig(t.configs));return}const n=sessionStorage.getItem("PAGE_DEFINE:"+e);if(n&&this.model.value=="run"){this.define.value=JSON.parse(n),this.type.value=this.define.value.types||"setting",this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}Y.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,this.type.value=this.define.value.types||"setting",l.body.configs?this.define.value.configs=l.body.configs:this.define.value.configs={widgets:[],dsnList:[]},this.loadConfig(this.define.value.configs),sessionStorage.setItem("PAGE_DEFINE:"+e,JSON.stringify(this.define.value)),console.log("从远程服务加载页面sn:"+e+",define:",this.define.value)):t&&t.configs&&(this.define.value=t,this.loadConfig(t.configs))})}save(){return new Promise((e,t)=>{if(this.$axiosProccess.value.save){console.warn("unione form editor save process runing,sn:"+this.define.value.sn),t();return}this.$axiosProccess.value.save=!0;const n={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(n),Y.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(o=>{this.$axiosProccess.value.save=!1,o.success?(X.message.success(o.message),this.define.value=o.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(o.body)):(this.$dialog.error({content:o.message}),t())}).catch(o=>{console.error("页面配置保存失败",o),this.$dialog.error({content:"页面配置保存失败"})}).finally(()=>{this.$axiosProccess.value.save=!1})})}loadConfig(e){e.dsnList?.length&&this.$dataManager.psn(e.dsnList[0]),this.$widgetList.value=e.widgets||[],this.$widgetMap.value={},this.$processWidget(this.$widgetList.value)}setModel(e){this.model.value=e}widget(e,t){if(t){const n={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(n),n.configs?.widgets&&this.$processWidget(n.configs.widgets)),this.$widgetMap.value[e]=n}else return this.$widgetMap.value[e]}widgets(e){if(e)this.$widgetList.value=e,this.$widgetMap.value={},this.$processWidget(e);else return this.$widgetList.value}$processWidget(e){e.forEach(t=>{t.wid||(t.wid="w:"+ha.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const xa={class:"widget-setting-dialog"},Ca=i.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(a,{expose:e,emit:t}){const n=t,l=i.ref(),o=i.ref(),s=i.ref(!1);function r(){o.value&&(s.value=!0),n("setting")}function c(){n("saving"),s.value=!1}function h(){return l.value?.clientHeight}function f(){return l.value?.clientWidth}return e({getHeight:h,getWidth:f}),(d,p)=>{const m=i.resolveComponent("SettingOutlined"),b=i.resolveComponent("a-tooltip"),y=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-widget",a.model]),ref_key:"widgetDom",ref:l},[i.createVNode(b,{title:a.settingTitle},{default:i.withCtx(()=>[a.model=="edit"&&(d.$slots["widget-setting"]||a.custome)?(i.openBlock(),i.createBlock(m,{key:0,class:"widget-setting",onClick:r})):i.createCommentVNode("",!0)]),_:1},8,["title"]),i.renderSlot(d.$slots,"default",{},void 0,!0),a.model=="edit"&&d.$slots["widget-setting"]?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle,ref_key:"settingModal",ref:o,open:s.value,"onUpdate:open":p[0]||(p[0]=A=>s.value=A),centered:"",width:"80%",onOk:c},{default:i.withCtx(()=>[i.createElementVNode("div",xa,[i.renderSlot(d.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),ee=(a,e)=>{const t=a.__vccOpts||a;for(const[n,l]of e)t[n]=l;return t},lt=ee(Ca,[["__scopeId","data-v-17b517f5"]]),va={key:0},Sa=["onClick"],fi=ee(i.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(a,{expose:e}){const t=a,n=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"参数名称",dataIndex:"name",key:"name",width:"60px",align:"center"},{title:"参数标题",dataIndex:"title",key:"title",width:"80px",align:"center"},{title:"参数value",dataIndex:"value",key:"value",width:"100px",align:"center"}]),l=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:k=>{l.value.selectedRowKeys=k}}),o={mounted:k=>k.focus()},s=i.ref({});function r(){const k=Object.keys(s.value);if(k.length)for(let u in k){const N=y.value.form.action.params[u];N&&s.value[u]&&Object.keys(s.value[u]).forEach(M=>{N[M]=s.value[u][M]})}s.value={}}function c(k,u,N){r();const M={};M[N]=u[N]||"",N=="showIndex"&&(M[N]=u.show?.query?.index),s.value[k]=M}function h(k,u,N){if(!u||!N){s.value={};return}const M=s.value[k][N];u[N]=M,s.value={}}function f(){y.value.form.action.params.push({title:"新建",name:"",value:""})}function d(){}const p=i.ref(""),m=i.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(k,u)=>p.value!=u&&t.preset.includes(u)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),b=i.ref([fa.javascript()]),y=i.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),A=i.ref();function x(k,u,N={}){k=JSON.parse(JSON.stringify(k)),k.event||(k.event={}),k.props||(k.props={}),k.action||(k.action={}),Object.keys(k.action).includes("maskClosable")||(k.action.maskClosable=!0),k.action.params||(k.action.params=[]),p.value=k.name,y.value.form=k,y.value.helps=N,y.value.visible=!0,A.value=u}const w=i.ref(null);function R(){w.value&&w.value.validate().then(()=>{y.value.visible=!1,A.value(y.value.form)})}return e({open:x,close}),(k,u)=>{const N=i.resolveComponent("a-input"),M=i.resolveComponent("a-form-item"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-input-number"),B=i.resolveComponent("a-checkbox"),E=i.resolveComponent("a-tab-pane"),g=i.resolveComponent("a-switch"),S=i.resolveComponent("a-button"),I=i.resolveComponent("a-divider"),V=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-tooltip"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-tabs"),Q=i.resolveComponent("a-form"),L=i.resolveComponent("a-modal");return i.openBlock(),i.createBlock(L,{visible:y.value.visible,"onUpdate:visible":u[23]||(u[23]=O=>y.value.visible=O),title:y.value.title,centered:"",width:"50%",onOk:R},{default:i.withCtx(()=>[i.createVNode(Q,{name:"basic",ref_key:"form",ref:w,rules:m.value,model:y.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:i.withCtx(()=>[i.createVNode(D,null,{default:i.withCtx(()=>[i.createVNode(E,{key:"base",tab:"基本设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"操作标题",required:"",name:"title"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.title,"onUpdate:value":u[0]||(u[0]=O=>y.value.form.title=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"操作名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.name,"onUpdate:value":u[1]||(u[1]=O=>y.value.form.name=O),disabled:t.preset.includes(y.value.form.name)},null,8,["value","disabled"])]),_:1}),i.createVNode(M,{label:"操作图标"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.icon,"onUpdate:value":u[2]||(u[2]=O=>y.value.form.icon=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.type,"onUpdate:value":u[3]||(u[3]=O=>y.value.form.type=O),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.index,"onUpdate:value":u[4]||(u[4]=O=>y.value.form.index=O)},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮大小"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.size,"onUpdate:value":u[5]||(u[5]=O=>y.value.form.size=O),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),i.createVNode(M,{label:"按钮特性"},{default:i.withCtx(()=>[i.createVNode(B,{checked:y.value.form.props.block,"onUpdate:checked":u[6]||(u[6]=O=>y.value.form.props.block=O)},{default:i.withCtx(()=>u[24]||(u[24]=[i.createTextVNode("自适应 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.danger,"onUpdate:checked":u[7]||(u[7]=O=>y.value.form.props.danger=O)},{default:i.withCtx(()=>u[25]||(u[25]=[i.createTextVNode("危险 ")])),_:1},8,["checked"]),i.createVNode(B,{checked:y.value.form.props.ghost,"onUpdate:checked":u[8]||(u[8]=O=>y.value.form.props.ghost=O)},{default:i.withCtx(()=>u[26]||(u[26]=[i.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),i.createVNode(E,{key:"action",tab:"响应设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"响应方式",required:""},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.type,"onUpdate:value":u[9]||(u[9]=O=>y.value.form.action.type=O),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.psn,"onUpdate:value":u[10]||(u[10]=O=>y.value.form.action.psn=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.component,"onUpdate:value":u[11]||(u[11]=O=>y.value.form.action.component=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(M,{label:"连接地址"},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.href,"onUpdate:value":u[12]||(u[12]=O=>y.value.form.action.href=O)},null,8,["value"])]),_:1}),["link","route"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:2,label:"连接方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.target,"onUpdate:value":u[13]||(u[13]=O=>y.value.form.action.target=O),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:3,label:"抽屉位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:y.value.form.action.position,"onUpdate:value":u[14]||(u[14]=O=>y.value.form.action.position=O),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:4,label:"显示标题",required:""},{default:i.withCtx(()=>[i.createVNode(N,{value:y.value.form.action.title,"onUpdate:value":u[15]||(u[15]=O=>y.value.form.action.title=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:5,label:"蒙层关闭"},{default:i.withCtx(()=>[i.createVNode(g,{checked:y.value.form.action.maskClosable,"onUpdate:checked":u[16]||(u[16]=O=>y.value.form.action.maskClosable=O),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),["drawer","dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:6,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.width,"onUpdate:value":u[17]||(u[17]=O=>y.value.form.action.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["dialog"].includes(y.value.form.action.type)?(i.openBlock(),i.createBlock(M,{key:7,label:"显示高度"},{default:i.withCtx(()=>[i.createVNode(C,{value:y.value.form.action.height,"onUpdate:value":u[18]||(u[18]=O=>y.value.form.action.height=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(I,{orientation:"left"},{default:i.withCtx(()=>[u[29]||(u[29]=i.createTextVNode("参数列表 ")),i.createVNode(S,{size:"small",class:"param-btn",onClick:f},{default:i.withCtx(()=>u[27]||(u[27]=[i.createTextVNode("添加")])),_:1}),i.createVNode(S,{size:"small",class:"param-btn",danger:"",onClick:d},{default:i.withCtx(()=>u[28]||(u[28]=[i.createTextVNode("删除")])),_:1})]),_:1}),i.createVNode($,{columns:n.value,"data-source":y.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:O})=>[["name","title"].includes(O.key)?(i.openBlock(),i.createElementBlock("span",va,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(O.title),1)])):i.createCommentVNode("",!0),["value"].includes(O.key)?(i.openBlock(),i.createBlock(F,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:i.withCtx(()=>[i.createElementVNode("span",null,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(O.title),1)])]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:O,text:G,record:T,index:_})=>[["name","title","value"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!s.value[_]||!Object.keys(s.value[_]).includes(O.dataIndex))&&!G&&"empty"]),onClick:q=>c(_,T,O.dataIndex)},[s.value[_]&&Object.keys(s.value[_]).includes(O.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(N,{key:0,value:s.value[_][O.dataIndex],"onUpdate:value":q=>s.value[_][O.dataIndex]=q,onBlur:q=>h(_,T,O.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[o]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(G),1)],64))],10,Sa)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),i.createVNode(E,{key:"event",tab:"事件设置"},{default:i.withCtx(()=>[i.createVNode(M,{label:"点击事件",help:y.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.clickScript,"onUpdate:modelValue":u[19]||(u[19]=O=>y.value.form.event.clickScript=O),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"禁用逻辑",help:y.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.disableScript,"onUpdate:modelValue":u[20]||(u[20]=O=>y.value.form.event.disableScript=O),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"显示逻辑",help:y.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.visibleScript,"onUpdate:modelValue":u[21]||(u[21]=O=>y.value.form.event.visibleScript=O),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),i.createVNode(M,{label:"动态标题",help:y.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:y.value.form.event.titleScript,"onUpdate:modelValue":u[22]||(u[22]=O=>y.value.form.event.titleScript=O),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:b.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),Ba=["src"],Na=["src"],Va=ee(i.defineComponent({__name:"btn",props:{editor:{type:Object,required:!1},disabled:{type:Boolean,default:!1},type:{type:String},widget:{type:Object,required:!0,default(){return{}}},preset:{type:Array,default(){return[]}},ctx:{type:Object,default(){return{}}}},emits:["click"],setup(a,{emit:e}){const t=Fe(),n=a,l=Y.useSession();i.watch(()=>n.widget?.event,()=>{s()}),i.onMounted(()=>{s()});const o=i.ref({});function s(){n.widget?.event&&(n.widget.event.clickScript?o.value.click=new Function("ctx","btn","event",n.widget.event.clickScript):n.widget.event.click&&(o.value.click=n.widget.event.click),n.widget.event.disableScript?o.value.disable=new Function("ctx","btn",n.widget.event.disableScript):n.widget.event.disable&&(o.value.disable=n.widget.event.disable),n.widget.event.visibleScript?o.value.visible=new Function("ctx","btn",n.widget.event.visibleScript):n.widget.event.visible&&(o.value.visible=n.widget.event.visible),n.widget.event.titleScript?o.value.title=new Function("ctx","btn",n.widget.event.titleScript):n.widget.event.title&&(o.value.title=n.widget.event.title)),typeof n.widget.click=="function"&&(o.value.click=n.widget.click),typeof n.widget.title=="function"&&(o.value.title=n.widget.title),typeof n.widget.visible=="function"&&(o.value.visible=n.widget.visible),typeof n.widget.disabled=="function"&&(o.value.disable=n.widget.disabled)}const r=i.computed(()=>o.value.title?o.value.title(p.value,n.widget):n.widget.title),c=i.computed(()=>o.value.visible?o.value.visible(p.value,n.widget)!=!1:n.widget.visible!=!1),h=i.computed(()=>n.disabled==!0?!0:o.value.disable?o.value.disable(p.value,n.widget):n.widget.disable==!0),f=i.ref(null);function d(){f.value?.open(n.widget,k=>{console.log("btn props",k),Object.keys(k).forEach(u=>{n.widget[u]=k[u]}),console.log("props btn",n.widget)})}const p=i.computed(()=>({...n.ctx,user:l.getPrincipal(),token:l.getToken()})),m=i.ref({open:!1}),b=i.computed(()=>{if(n.widget.action?.href){let k=n.widget.action.href;const u=k.matchAll("{[a-zA-Z.]*}"),N=[];let M=null;for(;M=u.next();){if(M&&M.value&&M.value[0]){let v=M.value[0].substring(1,M.value[0].length-1);N.includes(v)||N.push(v)}if(M.done)break}if(N.length>0)for(let v=0;v<N.length;v++){let C=N[v],B=Y.utils.obj.getValue(p.value,C);B?B instanceof Object?k=k.replaceAll("{"+C+"}",JSON.stringify(B)):Array.isArray(B)?k=k.replaceAll("{"+C+"}",B.join(",")):k=k.replaceAll("{"+C+"}",B):k=k.replaceAll("{"+C+"}","")}return k}return""}),y=i.computed(()=>{const k={};let u=n.widget.action?.href||n.widget.action?.link;if(u){const N=u.matchAll("{[a-zA-Z0-9.]*}"),M=[];let v=null;for(;v=N.next();){if(v&&v.value&&v.value[0]){let B=v.value[0].substring(1,v.value[0].length-1);M.includes(B)||M.push(B)}if(v.done)break}if(M.length>0)for(let B=0;B<M.length;B++){let E=M[B],g=Y.utils.obj.getValue(p.value,E);g?g instanceof Object?u=u.replaceAll("{"+E+"}",JSON.stringify(g)):Array.isArray(g)?u=u.replaceAll("{"+E+"}",g.join(",")):u=u.replaceAll("{"+E+"}",g):u=u.replaceAll("{"+E+"}","")}const C=u.split("?")[1];C&&C.split("&").forEach(B=>{const E=B.split("=");E[0]&&E[1]&&(k[E[0]]=E[1])})}return n.widget.action?.params&&n.widget.action.params.filter(N=>N.value+"").forEach(N=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(N.value)){let v=Y.utils.obj.getValue(p.value,N.value);k[N.name]=v}else k[N.name]=N.value}),k}),A=e,x=i.inject("router");function w(k){if(t.isDebug&&console.log("unione btn click",n.widget,k),!(o.value.click&&o.value.click(p.value,n.widget,k)==!1)){if(n.widget.action?.type=="drawer"||n.widget.action?.type=="dialog")m.value.open=!0;else if(n.widget.action?.type=="route"&&(n.widget.action?.href||n.widget.action?.link)){if(n.widget.action.link&&n.editor?.type.value=="code")return;x.push({path:n.widget.action.href||n.widget.action?.link,query:y.value})}A("click",{btn:n.widget,event:k})}}function R(k){A("click",k)}return(k,u)=>{const N=i.resolveComponent("a-button"),M=i.resolveComponent("unione-btn"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-drawer"),B=i.resolveComponent("a-modal");return c.value?(i.openBlock(),i.createBlock(lt,{key:0,class:i.normalizeClass(["unione-btn",a.widget.props?.block&&"unione-btn-block"]),model:a.editor?.model.value,onSetting:d,custome:!0,"setting-title":"按钮设置"},{default:i.withCtx(()=>[!a.widget.widget||a.widget.widget=="button"?(i.openBlock(),i.createBlock(N,i.mergeProps({key:0,disabled:h.value,size:a.widget.size||"small",type:a.type||a.widget.type,shape:a.widget.shape,class:"unione-btn-"+a.widget.name,loading:a.widget.loading,target:a.widget.action?.target,title:a.widget.tooltip,onClick:w},a.widget.props),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value)+" ",1)]),_:2},[a.widget.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"])):i.createCommentVNode("",!0),a.widget.widget=="dropdown"?(i.openBlock(),i.createBlock(v,{key:1,trigger:[a.widget.trigger||"hover"],class:i.normalizeClass([a.widget.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["dropdown-overlay",a.widget.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.widget.items,E=>(i.openBlock(),i.createBlock(M,{key:E.name,class:"item",widget:E,editor:a.editor,preset:a.preset,ctx:a.ctx,onClick:R},null,8,["widget","editor","preset","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode(N,{size:a.widget.size||"small"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value),1)]),_:1},8,["size"])]),_:1},8,["trigger","class"])):i.createCommentVNode("",!0),a.widget.action?.type=="drawer"?(i.openBlock(),i.createBlock(C,{key:2,open:m.value.open,"onUpdate:open":u[0]||(u[0]=E=>m.value.open=E),title:a.widget.action?.title,placement:a.widget.action?.position,maskClosable:a.widget.action?.maskClosable,width:a.widget.action?.width,bodyStyle:{padding:0,overflow:!a.widget.action.component||a.widget.action.component=="iframe"?"hidden":"auto"}},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value},null,8,Ba)):i.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):i.createCommentVNode("",!0),a.widget.action?.type=="dialog"?(i.openBlock(),i.createBlock(B,{key:3,open:m.value.open,"onUpdate:open":u[1]||(u[1]=E=>m.value.open=E),title:a.widget.action?.title,width:a.widget.action?.width,maskClosable:a.widget.action?.maskClosable,centered:"",footer:null},{default:i.withCtx(()=>[!a.widget.action.component||a.widget.action.component=="iframe"?(i.openBlock(),i.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:b.value,style:i.normalizeStyle({height:a.widget.action?.height?a.widget.action?.height+"px":""})},null,12,Na)):i.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):i.createCommentVNode("",!0),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:n.preset},null,8,["preset"])]),_:1},8,["class","model"])):i.createCommentVNode("",!0)}}}),[["__scopeId","data-v-b868da76"]]),Ra={key:0,class:"unione-widget-empty-tip"},Ea=ee(i.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(a){const e=a,t=i.ref(),n=i.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,o)=>{const s=i.resolveComponent("a-tab-pane"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:i.withCtx(()=>[n.value?(i.openBlock(),i.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":o[0]||(o[0]=c=>t.value=c)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.chidlren,(c,h)=>(i.openBlock(),i.createBlock(s,{key:h,class:"unione-layout-tab-pane"},{tab:i.withCtx(()=>[i.createElementVNode("span",null,[c.icon?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.icon),{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(c.title),1)])]),default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.chidlren,(f,d)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(f.widget),{key:d,wid:f.wid,editor:e.editor,widget:f},null,8,["wid","editor","widget"]))),128)),!c.chidlren||!c.chidlren.length?(i.openBlock(),i.createElementBlock("div",Ra,i.toDisplayString(c.emptyTips),1)):i.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):i.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),Oa={class:"title"},Ma={class:"text"},Ta={key:0,class:"reactive"},Ia={key:1,class:"opts"},Fa={class:"warp"},Da=ee(i.defineComponent({__name:"section",props:i.mergeModels({title:{type:String,required:!1},icon:{type:String,required:!1},type:{type:String,required:!1},location:{type:String,default:"left"},reactive:{type:Boolean,default:!1},wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},{modelValue:{type:Boolean,default:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,t=i.computed(()=>e.editor?.widget(e.wid)||e.widget),n=i.computed(()=>t.value?.title||e.title),l=i.computed(()=>t.value?.icon||e.icon),o=i.computed(()=>t.value?.type||e.type),s=i.useModel(a,"modelValue");function r(){e.reactive&&(s.value=!s.value)}return(c,h)=>(i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-layout-section",s.value?"open":"close"]),model:e.editor?.model},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["head",a.location,a.reactive&&"reactive"]),onClick:r},[i.createElementVNode("div",Oa,[o.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["type",o.value])},null,2)):i.createCommentVNode("",!0),l.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value),{key:1,class:"icon"})):i.createCommentVNode("",!0),i.createElementVNode("span",Ma,i.toDisplayString(n.value),1)]),a.reactive?(i.openBlock(),i.createElementBlock("div",Ta,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value?"UpOutlined":"DownOutlined")))])):i.createCommentVNode("",!0),a.location=="left"?(i.openBlock(),i.createElementBlock("div",Ia,[i.renderSlot(c.$slots,"opts",{},void 0,!0)])):i.createCommentVNode("",!0)],2),i.withDirectives(i.createElementVNode("div",Fa,[i.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[i.vShow,s.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),_a={class:"unione-props-setting unione-form-setting"},Pa={class:"unione-form-btns"},$a={key:0},La=["onClick"],Ua={class:"field-txt"},za=["onClick"],ja={key:1,class:"field-txt"},qa=["onClick"],Qa={key:0,class:"field-txt"},Wa={key:3,class:"edit-field"},Ya={key:0},Ha=["onClick"],Ka=ee(i.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=i.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.settings||(v.configs.settings={}),v.configs.settings.btns||(v.configs.settings.btns=[]),v}),l=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{const v=n.value.configs.settings.btns,C=v.map(B=>B.name);if(!C.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};v.splice(B.index,0,B)}if(!C.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let E=B.index||1;v.splice(E,0,B)}if(!C.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};v.splice(B.index,0,B)}if(!C.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};v.splice(B.index,0,B)}return v}),s=i.ref(null);function r(v){s.value&&s.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.settings.btns.sort((B,E)=>{const g=B.index||1,S=E.index||1;return g-S}),n.value.configs.settings.btns=[...n.value.configs.btns]})}function c(){const v=n.value.configs.settings.btns.length+1;let C={title:"新增",name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C.name="new_"+n.value.configs.settings.btns.length;const B=n.value.configs.settings.btns.filter(E=>E.name==C.name).length;B>0&&(C.name=C.name+B),n.value.configs.settings.btns.push(C),e.editor.widget(e.wid,n.value),s.value.open(C,E=>{Object.keys(E).forEach(g=>{C[g]=E[g]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(v){const C=()=>{if(["save","submit","reset","back"].includes(v.name))v.visible=!1,n.value.configs.settings.btns=[...n.value.configs.settings.btns];else{const B=[];n.value.configs.settings.btns.forEach(E=>{E.name!=v.name&&B.push(E)}),n.value.configs.settings.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{C()}})}const f=i.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:v=>{const C=f.value.widgets.filter(B=>B.value==v);return C[0]?C[0].label:v},toSetting:()=>{}}),d=i.ref({visible:!1,field:{},props:{},showInfo:v=>{let C="";return v.rules&&(C=v.rules.filter(B=>B.enable).length||""),C&&(C="("+C+")"),C},toSetting:()=>{const v=d.value.props,C={name:"range",trigger:v.trigger,whitespace:v.whitespace,message:v.rangeMessage};v.rangeMin!=null&&v.rangeMin!=null&&(C.min=v.rangeMin,C.enable=!0),v.rangeMax!=null&&v.rangeMax!=null&&(C.max=v.rangeMax,C.enable=!0);const B={name:"reg",trigger:v.trigger,whitespace:v.whitespace,message:v.regMessage};v.regExpress&&(B.pattern=v.regExpress,B.enable=!0),d.value.field.rules=[C,B],d.value.visible=!1,d.value.props={},console.log("rule",d.value.field.rules)}});function p(v){d.value.visible=!0,d.value.field=v;const C=v.rules||[],B={trigger:"change",whitespace:!0};C.forEach(E=>{E.name=="reg"&&(B.trigger=E.trigger,B.whitespace=E.whitespace,B.regExpress=E.pattern,B.regMessage=E.message),E.name=="range"&&(B.rangeMin=E.min,B.rangeMax=E.max,B.rangeMessage=E.message)}),d.value.props=B}const m=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function b(v,C){const B=w.value.filter(g=>g.name==v.name);B.forEach(g=>{C!="isSort"?g[C]=!0:g[C]=!g[C]});const E=B[0];if(!(!E||C=="isSort")){switch(m.value.prop=C,m.value.field=v,E.show||(E.show={}),C){case"isQuery":E.show.query||(E.show.query={}),m.value.show=E.show.query,m.value.title=`查询设置/${v.title}(${v.name})`;break;case"isForm":E.show.form||(E.show.form={}),m.value.show=E.show.form,m.value.title=`表单设置/${v.title}(${v.name})`;break;case"isView":E.show.view||(E.show.view={}),m.value.show=E.show.view,m.value.title=`详情设置/${v.title}(${v.name})`;break;case"isList":E.show.list||(E.show.list={}),m.value.show=E.show.list,m.value.title=`列头设置/${v.title}(${v.name})`;break}m.value.visible=!0}}const y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(v,C)=>{y.value.convert.options.splice(v,1)},toSetting:()=>{y.value.visible=!1}});function A(v){y.value.visible=!0,y.value.field=v,y.value.convert=v.convert||{}}const x=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),w=i.computed(()=>x.value.fields?.length?x.value.fields:[]),R={mounted:v=>v.focus()},k=i.ref({});function u(v,C){const B={};C=="convertName"?B[C]=v.convert?.type:B[C]=v[C]||"",k.value={},k.value[v.name]=B}function N(v,C){{k.value={};return}}function M(v,C){w.value.filter(E=>E.name==v.name).forEach(E=>{E[C]=!E[C]})}return(v,C)=>{const B=i.resolveComponent("a-divider"),E=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),I=i.resolveComponent("a-select"),V=i.resolveComponent("ToolOutlined"),F=i.resolveComponent("a-checkbox"),$=i.resolveComponent("a-table"),D=i.resolveComponent("a-select-option"),Q=i.resolveComponent("a-form-item"),L=i.resolveComponent("a-form"),O=i.resolveComponent("a-modal"),G=i.resolveComponent("a-checkbox-group"),T=i.resolveComponent("a-input-number"),_=i.resolveComponent("a-input"),q=i.resolveComponent("a-col"),U=i.resolveComponent("a-row");return i.openBlock(),i.createElementBlock("div",_a,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[23]||(C[23]=[i.createTextVNode("按钮设置")])),_:1}),i.createElementVNode("div",Pa,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,P=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:P.name,class:["btn",P.name,!P.visible&&"deleted"],type:P.visible?P.type:"default",size:P.size,ref_for:!0},P.props||{},{onClick:re=>r(P)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(P.title)+" ",1),P.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"btn-del",onClick:i.withModifiers(re=>h(P),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[P.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(P.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),size:"small",onClick:C[0]||(C[0]=P=>c())},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[24]||(C[24]=[i.createTextVNode("表单设置")])),_:1}),C[36]||(C[36]=i.createTextVNode(" 数据模型:")),i.createVNode(I,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[1]||(C[1]=P=>n.value.dataModel=P)},null,8,["options","value"]),i.createVNode($,{columns:t.value,"data-source":w.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:P})=>[["widget","rules","convertName"].includes(P.key)?(i.openBlock(),i.createElementBlock("span",$a,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(P.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:P,text:re,record:H})=>[["rules"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!d.value.showInfo(H)&&"empty"]),onClick:pe=>p(H)},[i.createElementVNode("span",Ua,i.toDisplayString(d.value.showInfo(H)),1),d.value.showInfo(H)?(i.openBlock(),i.createBlock(g,{key:0,type:"link"},{default:i.withCtx(()=>C[25]||(C[25]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,La)):["widget"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!k.value[H.name]||!Object.keys(k.value[H.name]).includes(P.dataIndex))&&!re&&"empty"]),onClick:pe=>u(H,P.dataIndex)},[k.value[H.name]&&Object.keys(k.value[H.name]).includes(P.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(I,{key:0,value:H[P.dataIndex],"onUpdate:value":pe=>H[P.dataIndex]=pe,options:f.value.widgets,onBlur:C[2]||(C[2]=pe=>N())},null,8,["value","onUpdate:value","options"])),[[R]]):(i.openBlock(),i.createElementBlock("span",ja,i.toDisplayString(f.value.widgetName(re)),1))],10,za)):["convertName"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!k.value[H.name]||!Object.keys(k.value[H.name]).includes(P.dataIndex))&&!H.convert?.type&&"empty"]),onClick:pe=>u(H,P.dataIndex)},[k.value[H.name]&&Object.keys(k.value[H.name]).includes(P.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(I,{key:0,value:H[P.dataIndex],"onUpdate:value":pe=>H[P.dataIndex]=pe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:C[3]||(C[3]=pe=>N())},null,8,["value","onUpdate:value"])),[[R]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[H.convert?.type?(i.openBlock(),i.createElementBlock("span",Qa,i.toDisplayString(H.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),H.convert?.type?(i.openBlock(),i.createBlock(g,{key:1,type:"link",onClick:i.withModifiers(pe=>A(H),["stop"])},{default:i.withCtx(()=>C[26]||(C[26]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,qa)):["isForm","isView"].includes(P.dataIndex)?(i.openBlock(),i.createElementBlock("div",Wa,[i.createVNode(F,{checked:H[P.dataIndex],onClick:pe=>M(H,P.dataIndex)},null,8,["checked","onClick"]),i.createVNode(g,{type:"link",onClick:pe=>b(H,P.dataIndex)},{default:i.withCtx(()=>C[27]||(C[27]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(O,{visible:f.value.visible,"onUpdate:visible":C[5]||(C[5]=P=>f.value.visible=P),title:"控件设置",onOk:f.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[f.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(Q,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(I,{value:f.value.props.mode,"onUpdate:value":C[4]||(C[4]=P=>f.value.props.mode=P),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(D,{value:"multiple"},{default:i.withCtx(()=>C[28]||(C[28]=[i.createTextVNode("多选")])),_:1}),i.createVNode(D,{value:"tags"},{default:i.withCtx(()=>C[29]||(C[29]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(O,{visible:d.value.visible,"onUpdate:visible":C[13]||(C[13]=P=>d.value.visible=P),title:"规则设置",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:d.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[30]||(C[30]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(Q,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(G,{value:d.value.props.trigger,"onUpdate:value":C[6]||(C[6]=P=>d.value.props.trigger=P),options:["change","blur"]},null,8,["value"])]),_:1}),d.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(F,{value:d.value.props.whitespace,"onUpdate:value":C[7]||(C[7]=P=>d.value.props.whitespace=P),checked:d.value.props.whitespace},{default:i.withCtx(()=>C[31]||(C[31]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[32]||(C[32]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(Q,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(T,{value:d.value.props.rangeMin,"onUpdate:value":C[8]||(C[8]=P=>d.value.props.rangeMin=P)},null,8,["value"]),C[33]||(C[33]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(T,{value:d.value.props.rangeMax,"onUpdate:value":C[9]||(C[9]=P=>d.value.props.rangeMax=P)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.rangeMessage,"onUpdate:value":C[10]||(C[10]=P=>d.value.props.rangeMessage=P)},null,8,["value"])]),_:1}),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[34]||(C[34]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(Q,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regExpress,"onUpdate:value":C[11]||(C[11]=P=>d.value.props.regExpress=P)},null,8,["value"])]),_:1}),i.createVNode(Q,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(_,{value:d.value.props.regMessage,"onUpdate:value":C[12]||(C[12]=P=>d.value.props.regMessage=P)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(O,{visible:m.value.visible,"onUpdate:visible":C[20]||(C[20]=P=>m.value.visible=P),title:m.value.title,onOk:m.value.toSetting},{default:i.withCtx(()=>[i.createVNode(L,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(Q,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(T,{value:m.value.show.index,"onUpdate:value":C[14]||(C[14]=P=>m.value.show.index=P)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Q,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.width,"onUpdate:value":C[15]||(C[15]=P=>m.value.show.width=P)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.labelWidth,"onUpdate:value":C[16]||(C[16]=P=>m.value.show.labelWidth=P)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(_,{value:m.value.show.valueWidth,"onUpdate:value":C[17]||(C[17]=P=>m.value.show.valueWidth=P)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(I,{value:m.value.show.fixed,"onUpdate:value":C[18]||(C[18]=P=>m.value.show.fixed=P),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(i.openBlock(),i.createBlock(Q,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(I,{value:m.value.show.align,"onUpdate:value":C[19]||(C[19]=P=>m.value.show.align=P),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(O,{visible:y.value.visible,"onUpdate:visible":C[22]||(C[22]=P=>y.value.visible=P),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",Ya,[i.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>C[35]||(C[35]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode($,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:P,record:re,index:H})=>[P.dataIndex==="label"?(i.openBlock(),i.createBlock(_,{key:0,value:re.label,"onUpdate:value":pe=>re.label=pe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),P.dataIndex==="value"?(i.openBlock(),i.createBlock(_,{key:1,value:re.value,"onUpdate:value":pe=>re.value=pe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),P.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:pe=>y.value.toDelOption(H,re)},"删除",8,Ha)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(L,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(U,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(q,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(Q,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(_,{value:y.value.convert.dict,"onUpdate:value":C[21]||(C[21]=P=>y.value.convert.dict=P)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),Ga=ee(i.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(a,{expose:e}){const t=a,n=i.ref(!1),l=i.ref(),o=i.ref({}),s=i.ref(null);i.onMounted(()=>{if(c.value.dsn){const w=r.value.dataManager();c.value.primary&&w.psn(c.value.dsn),s.value.setDisabled=x,s.value.getValue=p,s.value.setValue=m,s.value.reset=b,l.value=w.useForm(c.value.dsn,s.value,R=>{o.value=R.body||{}})}t.editor||r.value.loadConfig({widgets:h.value}),t.form?.model&&r.value.setModel(t.form.model),y()});const r=i.computed(()=>t.editor||new ut),c=i.computed(()=>t.widget||t.form||{}),h=i.computed(()=>{let w=c.value.widgets||[];return!w.length&&t.form?.fields&&(w=t.form.fields),w.forEach(R=>{R.widget||(R.widget="unione-form-item"),R.control||(R.control="a-input")}),w}),f=i.inject("pageSetting",{}),d=i.computed(()=>c.value.setting||f?.form||{});i.provide("formSetting",d.value);function p(){return o.value}function m(w){o.value=w,y()}function b(){o.value={},y()}function y(){const w=R=>{R.widget=="unione-form-item"&&R.name&&(R.value!=null&&R.value!=null&&R.value!=""||R.value==0)&&(o.value[R.name]==null||o.value[R.name]==null||o.value[R.name]=="")&&(o.value[R.name]=R.value),R.widgets?.forEach(k=>{w(k)})};h.value.forEach(R=>{w(R)})}function A(){return s.value.validate()}function x(w=!0){n.value=w}return e({validate:A,getValue:p,setValue:m,reset:b,setDisabled:x}),(w,R)=>{const k=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-form-widget","setting-title":"表单设置",model:r.value.model.value},i.createSlots({default:i.withCtx(()=>[i.createVNode(k,{ref_key:"formObj",ref:s,model:o.value,class:i.normalizeClass(["unione-form",r.value.model.value,"form-layout-col-"+(d.value.showColumn||3)])},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(u,N)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(u.widget),{key:N,widget:u,editor:r.value,value:o.value[u.name],"onUpdate:value":M=>o.value[u.name]=M,disabled:n.value,formValue:o.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[a.editor&&c.value.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Ka,{wid:c.value.wid,editor:a.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-cecc4588"]]);function Cl(a,e=!1){const t=Fe();if(!a)return Promise.reject("字典名称不能为空");const n=localStorage.getItem("UNIONE-DICT-"+a);return n&&e==!1?Promise.resolve(JSON.parse(n)):(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+a+",force:"+e),new Promise((l,o)=>{Y.axios.admin({url:"/api/base/dict/load/"+a}).then(s=>{if(s.success){const r=s.body.filter(c=>c.dictName!=c.dictKey);r.forEach(c=>{c.value=c.dictKey,c.label=c.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+a,JSON.stringify(r)),l(r)):o("字典加载失败,dict:"+a+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+a,s),o("字典加载失败,dict:"+a+",error:"+s.message)})}))}async function vl(a,e){const t=Fe();if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const n=await Cl(a),l=n.filter(o=>o.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+a+",key:"+e+"options:",n),Promise.reject("字典项匹配失败,name:"+a+",key:"+e))}async function Ja(a,e){const t=await vl(a,e);return Promise.resolve(t.dictValue)}const Sl={load:Cl,getLabel:Ja,getOption:vl};class Ge{types;convertObj;config;options;constructor(e){(!e||!e.types)&&console.error("转换器定义不能为空,type不能为空",e),e.valueField||(e.valueField="id"),e.labelField||(e.labelField="title"),this.types=e.types,this.convertObj=e,this.options=e.options||[],this.config=Fe()}load(e,t=!1){return!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(n=>n.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((n,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}Sl.load(this.convertObj.dictName,t).then(o=>{this.options=o,typeof e=="number"&&this.options.forEach(s=>{s.value=parseInt(s.value)}),n(this.options)})}):this.convertObj.types=="option"?(this.options=this.convertObj.options||[],this.convertObj.options?.length?Promise.resolve(this.convertObj.options):(this.config.isDebug&&console.error("静态转换器选项为空,id:"+this.convertObj.id,this.convertObj),Promise.reject("静态转换器选项为空,id:"+this.convertObj.id))):!this.convertObj.id&&this.convertObj.types!="local"?Promise.reject("转换器id不能为空,type:"+this.convertObj.types):new Promise((n,l)=>{const o={body:this.convertObj.params||{}};this.convertObj.pidField&&(o.pid=-1);const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:s,data:o,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(c=>{c.value=parseInt(c.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?n(this.options):(this.config.isDebug&&console.error("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)):this.options.filter(h=>h.value==e).length?n(this.options):(o.body||(o.body={}),o.body[this.convertObj.valueField||"id"]=e,Y.axios.admin({url:s,data:o,method:"POST"}).then(h=>{if(h.success){const f={};this.options.forEach(d=>{f[e]=!0}),h.body.forEach(d=>{f[d.value]||this.options.push(d)}),n(this.options)}else l("数据选项为空,type:"+this.convertObj.types+",id:"+this.convertObj.id)}))):(this.config.isDebug&&console.error("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id,r),l("数据选项加载失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",error:"+r.message))})})}convert(e){if(e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?Sl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(n=>n.value==e);return t.length?Promise.resolve(t[0].label):(this.config.isDebug&&console.error("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e,this.convertObj),Promise.reject("静态转换器选项匹配失败,id:"+this.convertObj.id+",value:"+e))}return Promise.reject("静态转换器选项为空,id:"+this.convertObj.id)}if(this.options?.length){const t=this.options.filter(n=>n.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,n)=>{this.load(e).then(l=>{const o=l.filter(s=>s.value==e);if(o.length)return t(o[0].label);n()})})}children(e=-1){return this.config.isDebug&&console.log("进入:加载下级数据项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",pid:"+e),this.convertObj.pidField?this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.reject("字典/静态转换器不支持该方法,type:"+this.convertObj.types+",id:"+this.convertObj.id):new Promise((n,l)=>{const o=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:o,data:e,method:"POST"}).then(s=>{s.success?(this.$processOptions(s.body),this.options=[...this.options,...s.body],n(s.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,s),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+s.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){if(this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option")return Promise.resolve(this.options.filter(n=>n.label.indexOf(e)>=0));const t={...this.convertObj.params||{}};return new Promise(n=>{const l=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;Y.axios.admin({url:l,data:{body:{...t,keywords:e}},method:"POST"}).then(o=>{o.success?(this.$processOptions(o.body),n(o.body)):n([])})})}$processOptions(e){return this.convertObj.types=="local"&&e.forEach(t=>{this.convertObj.idField&&(t.id=t[this.convertObj.idField]),this.convertObj.pidField&&(t.pid=t[this.convertObj.pidField]),t.value=t[this.convertObj.valueField||"id"],t.label=t[this.convertObj.labelField||"title"]}),e}}function pt(a,e=350){let t=null;return n=>{clearTimeout(t),t=setTimeout(()=>{a(n)},e)}}const Xa=["innerHTML"],Za={key:2,class:"text-view"},er=ee(i.defineComponent({__name:"formItem",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object,required:!0},disabled:{type:Boolean,defualt:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.computed(()=>o.value.showFormat?o.value.showFormat.call(this,t.value,{label:A.value,form:e.formValue}):A.value||t.value),l=i.inject("formSetting");i.onMounted(()=>{s.value.value!=null&&typeof s.value.value<"u"&&(e.formValue[s.value.name]==null||e.formValue[s.value.name]==null||typeof e.formValue[s.value.name]>"u")&&(t.value=s.value.value,s.value.widget=="unione-check-box"&&(Array.isArray(s.value.value)||(typeof s.value.value=="string"?t.value=s.value.value.split(","):t.value=[s.value.value])))});const o=i.ref({}),s=i.computed(()=>{const x=e.editor?.widget(e.wid)||e.widget||{};return x.event&&Object.keys(x.event).forEach(w=>{const R=x.event[w];R&&(o.value[w]=null,typeof R=="function"?o.value[w]=R:R.enable&&R.scriptText&&(o.value[w]=new Function("value","ctx",R.scriptText)))}),x}),r=i.computed(()=>!(o.value.visible&&o.value.visible(e.formValue[s.value.name],e.formValue)==!1)),c=i.computed(()=>o.value.title&&o.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),h=pt(()=>{if(o.value.change)return o.value.change(e.formValue[s.value.name],e.formValue)||s.value.change;s.value.change&&s.value.change(e.formValue[s.value.name],e.formValue)}),f=i.ref({}),d=i.computed(()=>{const x=[],w=s.value.rule||{};let R=s.value.props?.required||s.value.required;if(o.value.required&&(R=o.value.required(e.formValue[s.value.name],e.formValue)),R&&x.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||l.ruleTrigger||"change",validator:(k,u)=>(w?.whitespace&&u&&typeof u=="string"&&(u=u.trim()),u!=null&&u!=null&&(u+"").replace(/\s+/g,"").length>0?Promise.resolve():Promise.reject(c.value+"不能为空!"))}),w.advance&&f.value[w.advance]){const k=f.value[w.advance];x.push({pattern:k.pattern,message:k.message||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"})}return w.regExpress&&x.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||l.ruleTrigger||"change"}),s.value.dataLen&&x.push({validator:(k,u)=>u&&(u+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(u+"").length+"]"):Promise.resolve(),trigger:w?.trigger||l.ruleTrigger||"change"}),x}),p=i.computed(()=>{const x=s.value.props||{};if(s.value.control=="a-input-number"){const w=s.value.rule||{};w.rangeMin!=null&&w.rangeMin!=null&&(x.min=w.rangeMin),w.rangeMax!=null&&w.rangeMax!=null&&(x.max=w.rangeMax)}return s.value.control=="a-date-picker"&&s.value.view?.dataFormat&&(x.format=s.value.view.dataFormat,x.valueFormat=s.value.view.dataFormat),s.value.required&&(x.required=s.value.required),x}),m=i.computed(()=>{const x=s.value.css||{},w=["form-item-"+s.value.name];return x.cssName&&w.push(x.cssName),l.platform=="app"?x.cssName?typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0&&w.push("all-line"):w.push("all-line"):s.value.view?.width&&(s.value.view.width>=3?(!x.cssName||typeof x.cssName=="string"&&x.cssName.indexOf("all-line")<0)&&w.push("all-line"):s.value.view.width==2&&w.push("2in-line")),w}),b=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.labelWidth||l.labelWidth||9;return s.value.css?.cssName&&x>1&&typeof s.value.css.cssName=="string"&&s.value.css.cssName.indexOf("all-line")>=0?{span:Math.round(w/x)}:s.value.view?.width>=3&&x>1?{span:Math.round(w/x)}:{span:w}}),y=i.computed(()=>{const x=l.showColumn||3;let w=s.value.view?.valueWidth||l.valueWidth||19;return s.value.css?.cssName&&x>1&&m.value.includes("all-line")?{}:{span:w}}),A=i.ref();return i.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new Ge(s.value.convert).convert(t.value.toString()).then(x=>{A.value=x})}),(x,w)=>{const R=i.resolveComponent("a-form-item");return i.openBlock(),i.createBlock(lt,{class:i.normalizeClass(["unione-form-item",m.value]),style:i.normalizeStyle(s.value.css?.cssText)},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createBlock(R,{key:0,label:c.value,name:s.value.name,labelCol:b.value,wrapperCol:y.value,required:s.value.props?.required,rules:d.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:i.withCtx(()=>[!e.editor||s.value.view=="self"||e.editor.model.value!="view"&&s.value.view!="html"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value.control||"a-input"),i.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:a.disabled,onChange:i.unref(h),value:t.value,"onUpdate:value":w[0]||(w[0]=k=>t.value=k),formValue:a.formValue},p.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","formValue","style"])):s.value.view=="html"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"text-view text-html",innerHTML:n.value},null,8,Xa)):(i.openBlock(),i.createElementBlock("div",Za,i.toDisplayString(n.value),1))]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):i.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-20adb860"]]),tr=ee(i.defineComponent({__name:"selectBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object},mode:{type:String,default:"combobox"},valueType:{type:String,default:"string"}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){Fe();const e=a,t=i.ref(),n=i.useModel(a,"value"),l=i.ref([]),o=i.computed(()=>l.value?.length?l.value:e.options?.length?e.options:[]),s=i.computed(()=>{const b=p.value.convert||e.convert||{};if(b.refValue){const y={};return b.refValue.split(",").forEach(x=>{const w=x.split("=");w.length==1?y[w[0]]=Y.utils.obj.getValue(e.formValue,w[0]):y[w[0]]=Y.utils.obj.getValue(e.formValue,w[1])}),y}return{}}),r=i.computed(()=>(p.value.convert||e.convert||{}).search||!1),c=pt(b=>{const y=p.value.convert||e.convert||{};y.params={...f.value,...s.value},m.value.search(b).then(A=>{l.value=A})},500);function h(b,y){d.value.select&&d.value.select(b,{option:y,formValue:e.formValue})}const f=i.ref();i.onMounted(()=>{const b=p.value.convert||e.convert||{};f.value=b.params||{},b.params={...f.value,...s.value},e.mode=="multiple"&&typeof n.value=="string"&&(t.value=n.value.split(",")),m.value.load(n.value).then(y=>{l.value=y})});const d=i.ref({}),p=i.computed(()=>{const b=e.editor?.widget(e.wid)||e.widget||{};return b.event&&Object.keys(b.event).forEach(y=>{const A=b.event[y];A&&(d.value[y]=null,typeof A=="function"?d.value[y]=A:A.enable&&A.scriptText&&(d.value[y]=new Function("value","ctx",A.scriptText)))}),b}),m=i.computed(()=>{const b=p.value.convert||e.convert||{};return new Ge(b)});return i.watch(n,pt(()=>{n.value&&(e.mode=="multiple"&&typeof n.value=="string"&&(t.value=n.value.split(",")),m.value.types!="dict"&&m.value.types!="option"&&m.value.load(n.value).then(b=>{l.value=b}))},200)),i.watch(()=>p.value.convert||e.convert||{},pt(()=>{m.value.load().then(b=>{l.value=b})})),i.watch(()=>s.value,pt(()=>{if(console.log(p.value.name+" ref value changed",s.value),s.value&&m.value.types!="dict"&&m.value.types!="option"){const b=p.value.convert||e.convert||{};b.params={...f.value,...s.value},m.value.load(n.value,!0).then(y=>{l.value=y})}},200),{deep:!0}),i.watch(t,()=>{Array.isArray(t.value)&&e.valueType=="string"?n.value=t.value.join(","):n.value=t.value}),(b,y)=>{const A=i.resolveComponent("a-select");return i.openBlock(),i.createBlock(A,{class:"unione-form-select",options:o.value,showSearch:r.value,mode:a.mode,value:t.value,"onUpdate:value":y[0]||(y[0]=x=>t.value=x),onSearch:i.unref(c),onSelect:h},null,8,["options","showSearch","mode","value","onSearch"])}}}),[["__scopeId","data-v-f4706b5f"]]),ir=ee(i.defineComponent({__name:"switchBox",props:i.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.ref({});i.onMounted(()=>{s.value?.load(t.value).then(r=>{r.forEach(c=>{c.value&&(c.value=="1"||c.value=="true"||c.value=="TRUE")?(n.value.checkedChildren=c.label,c.value=="true"||c.value=="TRUE"?n.value.checkedValue=!0:n.value.checkedValue=1):(n.value.unCheckedChildren=c.label,c.value=="false"||c.value=="FALSE"?n.value.unCheckedValue=!1:n.value.unCheckedValue=0)})})});const l=i.ref({}),o=i.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(c=>{const h=r.event[c];h&&(l.value[c]=null,typeof h=="function"?l.value[c]=h:h.enable&&h.scriptText&&(l.value[c]=new Function("value","ctx",h.scriptText)))}),r}),s=i.computed(()=>{const r=o.value.convert||e.convert;return r?new Ge(r):null});return(r,c)=>{const h=i.resolveComponent("a-switch");return i.openBlock(),i.createBlock(h,i.mergeProps({class:"unione-form-switch"},n.value,{checked:t.value,"onUpdate:checked":c[0]||(c[0]=f=>t.value=f)}),null,16,["checked"])}}}),[["__scopeId","data-v-32bff921"]]),nr=ee(i.defineComponent({__name:"radioBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value"),n=i.ref([]),l=i.computed(()=>n.value?.length?n.value:e.options?.length?e.options:[]),o=i.computed(()=>{const f=c.value.convert||e.convert||{};if(f.refValue){const d={};return f.refValue.split(",").forEach(m=>{const b=m.split("=");b.length==1?d[b[0]]=Y.utils.obj.getValue(e.formValue,b[0]):d[b[0]]=Y.utils.obj.getValue(e.formValue,b[1])}),console.log(c.value.name+" ref field:"+f.refValue+",ref value",d),d}return{}}),s=i.ref();i.onMounted(()=>{const f=c.value.convert||e.convert||{};s.value=f.params||{},f.params={...s.value,...o.value},h.value.load(t.value||c.value.value).then(d=>{n.value=d})});const r=i.ref({}),c=i.computed(()=>{const f=e.editor?.widget(e.wid)||e.widget||{};return f.event&&Object.keys(f.event).forEach(d=>{const p=f.event[d];p&&(r.value[d]=null,typeof p=="function"?r.value[d]=p:p.enable&&p.scriptText&&(r.value[d]=new Function("value","ctx",p.scriptText)))}),f}),h=i.computed(()=>{const f=c.value.convert||e.convert||{};return new Ge(f)});return i.watch(()=>o.value,()=>{if(console.log(c.value.name+" ref value changed",o.value),o.value){const f=c.value.convert||e.convert||{};f.params={...s.value,...o.value},h.value.load(void 0,!0).then(d=>{n.value=d})}},{deep:!0}),(f,d)=>{const p=i.resolveComponent("a-radio-group");return i.openBlock(),i.createBlock(p,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":d[0]||(d[0]=m=>t.value=m)},null,8,["options","value"])}}}),[["__scopeId","data-v-78969849"]]),lr=ee(i.defineComponent({__name:"checkBox",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},returnType:{type:String,default:"string"},widget:{type:Object,required:!1},convert:{type:Object,required:!1},options:{type:Array,required:!1},formValue:{type:Object}},{value:{},valueModifiers:{}}),emits:i.mergeModels(["change"],["update:value"]),setup(a,{emit:e}){const t=a,n=i.useModel(a,"value"),l=i.ref(),o=i.ref([]),s=i.computed(()=>o.value?.length?o.value:t.options?.length?t.options:[]),r=i.computed(()=>{const b=f.value.convert||t.convert||{};if(b.refValue){const y={};return b.refValue.split(",").forEach(x=>{const w=x.split("=");w.length==1?y[w[0]]=Y.utils.obj.getValue(t.formValue,w[0]):y[w[0]]=Y.utils.obj.getValue(t.formValue,w[1])}),console.log(f.value.name+" ref field:"+b.refValue+",ref value",y),y}return{}}),c=i.ref();i.onMounted(()=>{const b=n.value||f.value.value;t.returnType==="string"?l.value=b.split(","):l.value=b;const y=f.value.convert||t.convert||{};c.value=y.params||{},y.params={...c.value,...r.value},m.value.load().then(A=>{o.value=A})});const h=i.ref({}),f=i.computed(()=>{const b=t.editor?.widget(t.wid)||t.widget||{};return b.event&&Object.keys(b.event).forEach(y=>{const A=b.event[y];h.value[y]=null,A.enable&&A.scriptText&&(h.value[y]=new Function("value","ctx",A.scriptText))}),b}),d=e;function p(b){t.returnType==="string"?n.value=b.join(","):n.value=b,console.log("checkbox changed",n.value),d("change",n.value)}const m=i.computed(()=>{const b=f.value.convert||t.convert||{};return new Ge(b)});return i.watch(()=>n.value,()=>{l.value=Array.isArray(n.value)?n.value:[],n.value&&!Array.isArray(n.value)&&(l.value=n.value.split(","))}),i.watch(()=>r.value,()=>{if(console.log(f.value.name+" ref value changed",r.value),r.value){l.value=[],t.returnType==="string"?n.value="":n.value=[];const b=f.value.convert||t.convert||{};b.params={...c.value,...r.value},m.value.load(void 0,!0).then(y=>{o.value=y})}},{deep:!0}),(b,y)=>{const A=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createBlock(A,{class:"unione-form-checkbox",options:s.value,value:l.value,"onUpdate:value":y[0]||(y[0]=x=>l.value=x),onChange:p},null,8,["options","value"])}}}),[["__scopeId","data-v-1aa92231"]]),or=ee(i.defineComponent({__name:"pwdBox",props:{value:{},valueModifiers:{}},emits:["update:value"],setup(a){const e=i.ref(),t=i.useModel(a,"value");return i.watch(()=>e.value,()=>{e.value?t.value=Y.utils.sm2Encrypt(e.value):t.value=""}),(n,l)=>{const o=i.resolveComponent("a-input-password");return i.openBlock(),i.createBlock(o,{class:"unione-form-password",value:e.value,"onUpdate:value":l[0]||(l[0]=s=>e.value=s)},null,8,["value"])}}}),[["__scopeId","data-v-4515a2af"]]);function sn(a){const e=a.toLowerCase().split("_"),t=[];t.push(e[0]);for(let n=1;n<e.length;n++){const l=e[n];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const Bl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Nl(a=10){const e=Date.now().toString(),t=new Uint32Array(a);crypto.getRandomValues(t);let n="";for(let l=0;l<a;l++){const o=(parseInt(e[l%e.length],10)+t[l])%Bl.length;n+=Bl[o]}return n}const sr={toHump:sn,randomStr:Nl},ar=ee(i.defineComponent({__name:"randomInput",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},formValue:{type:Object},len:{type:Number,default:10}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a){const e=a,t=i.useModel(a,"value");function n(){t.value=Nl(e.len)}return(l,o)=>{const s=i.resolveComponent("SyncOutlined"),r=i.resolveComponent("a-input");return i.openBlock(),i.createBlock(r,{class:"unione-form-random-input",value:t.value,"onUpdate:value":o[0]||(o[0]=c=>t.value=c)},{suffix:i.withCtx(()=>[i.createVNode(s,{style:{color:"rgba(0, 0, 0, 0.45)"},onClick:n})]),_:1},8,["value"])}}}),[["__scopeId","data-v-8e6d89b8"]]),rr={class:"unione-props-setting unione-query-setting"},cr={class:"unione-query-opts"},dr={key:0},hr=["onClick"],fr={key:1},ur={key:1,class:"edit-field"},pr=["onClick"],mr=ee(i.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:R})=>R+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"30px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"55px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"}]),n=i.computed(()=>{const R=e.editor.widget(e.wid)||{};return R.configs||(R.configs={}),R.configs.btns||(R.configs.btns=[]),R}),l=i.computed(()=>(e.editor.dataModels()||[]).map(k=>({value:k.sn,label:k.title+"("+k.name+")"}))),o=i.computed(()=>{const R=[],k=[];return n.value.configs.btns||(n.value.configs.btns=[]),n.value.configs.btns.forEach(u=>{R.push(u),k.push(u.name)}),k.includes("query")||R.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),k.includes("reset")||R.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),k.includes("reset")||R.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),R.sort((u,N)=>{const M=u.index||1,v=N.index||1;return M-v}),R}),s=i.ref(null);function r(R){s.value&&s.value.open(R,k=>{k.visible=!0,Object.keys(k).forEach(u=>{R[u]=k[u]}),n.value.configs.btns.sort((u,N)=>{const M=u.index||1,v=N.index||1;return M-v}),n.value.configs.btns=[...n.value.configs.btns]})}function c(){const R=n.value.configs.btns.length+1;let k={title:"新增",name:"new_"+R,size:"default",index:R,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.btns.push(k),e.editor.widget(e.wid,n.value),s.value.open(k,u=>{Object.keys(u).forEach(N=>{k[N]=u[N]}),n.value.configs.btns=[...n.value.configs.btns]})}function h(R){const k=()=>{if(["query","reset","advanced"].includes(R.name))R.visible=!1,n.value.configs.btns=[...n.value.configs.btns];else{const u=[];n.value.configs.btns.forEach(N=>{N.name!=R.name&&u.push(N)}),n.value.configs.btns=u}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{k()}})}const f=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),d=i.computed(()=>f.value.fields?.length?f.value.fields:[]),p={mounted:R=>R.focus()},m=i.ref({});function b(){const R=Object.keys(m.value);if(R.length)for(let k in R){const u=d.value.filter(N=>N.name==k);if(u&&u[0]){let N=m.value[k];Object.keys(N).forEach(M=>{if(M=="showIndex"){const v=u[0].show?.query||{};u[0].show||(u[0].show={}),u[0].show.query={...v,index:N[M]}}else u[0][M]=N[M]})}}m.value={}}function y(R,k){b();const u={};u[k]=R[k]||"",k=="showIndex"&&(u[k]=R.show?.query?.index),m.value[R.name]=u}function A(R,k){if(!R||!k){m.value={};return}const u=m.value[R.name][k];if(k=="showIndex"){const N=R.show?.query||{};R.show||(R.show={}),R.show.query={...N,index:u}}else R[k]=u;m.value={}}function x(R,k){d.value.filter(N=>N.name==R.name).forEach(N=>{N[k]=!N[k]})}const w=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:R=>{const k=w.value.options.filter(u=>u.value==R);return k[0]?k[0].label:R}});return(R,k)=>{const u=i.resolveComponent("a-divider"),N=i.resolveComponent("CloseOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("PlusOutlined"),C=i.resolveComponent("a-select"),B=i.resolveComponent("ToolOutlined"),E=i.resolveComponent("a-checkbox"),g=i.resolveComponent("a-input-number"),S=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",rr,[i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[3]||(k[3]=[i.createTextVNode("查询按钮")])),_:1}),i.createElementVNode("div",cr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,I=>(i.openBlock(),i.createBlock(M,i.mergeProps({key:I.name,class:["btn",I.name,!I.visible&&"deleted"],type:I.visible?I.type:"default",size:I.size||"default",ref_for:!0},I.props||{},{onClick:V=>r(I)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(I.title)+" ",1),I.visible?(i.openBlock(),i.createBlock(N,{key:0,class:"btn-del",onClick:i.withModifiers(V=>h(I),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(M,{class:i.normalizeClass(["btn","btn-add"]),onClick:k[0]||(k[0]=I=>c()),size:"small"},{default:i.withCtx(()=>[i.createVNode(v)]),_:1})]),i.createVNode(u,{orientation:"left"},{default:i.withCtx(()=>k[4]||(k[4]=[i.createTextVNode("查询字段")])),_:1}),k[5]||(k[5]=i.createTextVNode(" 数据模型:")),i.createVNode(C,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":k[1]||(k[1]=I=>n.value.dataModel=I)},null,8,["options","value"]),i.createVNode(S,{columns:t.value,"data-source":d.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:I})=>[["showIndex","queryType"].includes(I.key)?(i.openBlock(),i.createElementBlock("span",dr,[i.createVNode(B),i.createTextVNode(" "+i.toDisplayString(I.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:I,text:V,record:F})=>[["queryType"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!V&&"empty"]),onClick:$=>y(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(C,{key:0,value:F[I.dataIndex],"onUpdate:value":$=>F[I.dataIndex]=$,allowClear:!0,options:w.value.options,onBlur:k[2]||(k[2]=$=>A())},null,8,["value","onUpdate:value","options"])),[[p]]):(i.openBlock(),i.createElementBlock("span",fr,i.toDisplayString(w.value.showLabel(V)),1))],10,hr)):["isQuery"].includes(I.dataIndex)?(i.openBlock(),i.createElementBlock("div",ur,[i.createVNode(E,{checked:F[I.dataIndex],onClick:$=>x(F,I.dataIndex)},null,8,["checked","onClick"])])):I.dataIndex=="showIndex"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!m.value[F.name]||!Object.keys(m.value[F.name]).includes(I.dataIndex))&&!V&&"empty"]),onClick:$=>y(F,I.dataIndex)},[m.value[F.name]&&Object.keys(m.value[F.name]).includes(I.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(g,{key:0,value:m.value[F.name][I.dataIndex],"onUpdate:value":$=>m.value[F.name][I.dataIndex]=$,onBlur:$=>A(F,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(F.show?.query?.index||" "),1)],64))],10,pr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:s},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),gr={class:"query-btn"},kr={class:"btn-advanced-overlay"},Vl=ee(i.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},fields:{type:Array},params:{type:Object,default(){return{}}}},emits:["query","reset","btnClick"],setup(a,{emit:e}){const t=a,n=i.computed(()=>{const A=t.editor?.widget(t.wid)||t.widget||{};return A.btns||(A.btns=[]),A}),l=i.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...n.value.keywords||{}})),o=i.computed(()=>{let A=[];return n.value.fields?.length&&(A=n.value.fields),A.length==0&&t.fields?.length&&(A=t.fields),A.sort((x,w)=>{const R=x.show?.query?.index||1,k=w.show?.query?.index||1;return R-k}),A.forEach(x=>{!x.widget&&!x.control&&x.convert&&(x.widget="unione-select-box"),x.widget=x.widget||x.control||"a-input",x.defaultValue!=null&&x.defaultValue!="undefined"&&typeof x.defaultValue<"u"&&(f.value[x.name]=x.defaultValue,x.value=x.defaultValue)}),A}),s=i.computed(()=>n.value.labelWidth||7),r=i.computed(()=>{const A=n.value.btns.filter(x=>x.name=="advanced")[0]||{};return A.event?.clickScript&&(A.event.click=new Function("ctx","btn","event",A.event.clickScript)),A.event?.disableScript&&(A.event.disable=new Function("ctx","btn",A.event.disableScript)),A.event?.visibleScript&&(A.event.visible=new Function("ctx","btn",A.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...A}}),c=["query","reset","advanced"],h=i.computed(()=>{const A=n.value.btns.filter(w=>w.name!="advanced"),x=[];return A.forEach(w=>{w.size||(w.size="default"),x.push(w.name)}),x.includes("query")||A.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||A.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),A.sort((w,R)=>{const k=w.index||1,u=R.index||1;return k-u}),A}),f=i.ref({}),d=i.computed(()=>{const A={};return n.value.params?Object.keys(n.value.params).forEach(x=>{A[x]=n.value.params[x]}):t.params&&Object.keys(t.params).forEach(x=>{A[x]=t.params[x]}),A});i.onMounted(()=>{t.editor?.ebus.$on("query-form-params",A=>{n.value.params=A}),b()});const p=e;function m({btn:A,event:x}){console.log("unione query form btn click",A,x),A.name=="query"&&b(),A.name=="reset"&&y(),p("btnClick",{btn:A,event:x})}function b(){const A=[];o.value.forEach(w=>{w.visible&&A.push(w.name)});const x={params:{...d.value},keywords:""};Object.keys(f.value).forEach(w=>{A.includes(w)&&(x.params[w]=f.value[w])}),l.value.visible&&f.value[l.value.name]&&(x.keywords=f.value[l.value.name]),p("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){f.value={},o.value.forEach(x=>{x.visible=!1});const A={params:{...d.value},keywords:""};p("reset",A),t.editor?.ebus.$emit("table-list-reset",A)}return(A,x)=>{const w=i.resolveComponent("a-input"),R=i.resolveComponent("a-form-item"),k=i.resolveComponent("unione-btn"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("DownOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-dropdown"),C=i.resolveComponent("a-form");return i.openBlock(),i.createBlock(lt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},i.createSlots({default:i.withCtx(()=>[i.createVNode(C,{model:f.value,layout:"horizontal","label-col":{span:s.value}},{default:i.withCtx(()=>[l.value.visible?(i.openBlock(),i.createBlock(R,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:i.normalizeStyle({width:s.value})},{default:i.withCtx(()=>[i.createVNode(w,{placeholder:l.value.placeholder,value:f.value[l.value.name],"onUpdate:value":x[0]||(x[0]=B=>f.value[l.value.name]=B),allowClear:"",onKeyup:i.withKeys(b,["enter"])},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible?(i.openBlock(),i.createBlock(R,{key:0,label:B.title,class:i.normalizeClass(["query-field",B.name]),style:i.normalizeStyle({width:s.value}),name:B.name},{default:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(B.widget),i.mergeProps({placeholder:B.placeholder,value:f.value[B.name],"onUpdate:value":E=>f.value[B.name]=E,ref_for:!0},B.props||{},{allowClear:"",widget:B}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):i.createCommentVNode("",!0)],64))),128)),i.createElementVNode("div",gr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,B=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:B.name},[B.visible!=!1?(i.openBlock(),i.createBlock(k,{key:0,widget:B,editor:a.editor,onClick:m,preset:c},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128)),r.value.visible&&o.value.length?(i.openBlock(),i.createBlock(v,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:i.withCtx(()=>[i.createElementVNode("div",kr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,B=>(i.openBlock(),i.createBlock(u,{key:B.name,class:"item",checked:B.visible,onClick:E=>B.visible=!B.visible},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(B.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:i.withCtx(()=>[i.createVNode(M,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(r.value.title)+" ",1),i.createVNode(N)]),_:1})]),_:1},8,["trigger"])):i.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(mr,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-05f95e36"]]),br={class:"unione-props-setting unione-table-setting"},yr={class:"unione-table-tools"},wr={key:1,class:"unione-table-opts"},Ar={key:0},xr=["onClick"],Cr={key:1,class:"edit-field"},vr=["onClick"],Sr={key:1},Br=ee(i.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:v})=>v+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"显示",dataIndex:"isList",key:"isList",width:"30px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"30px",align:"center"},{title:"显示顺序",dataIndex:"showIndex",key:"showIndex",width:"55px",align:"center"},{title:"对齐方式",dataIndex:"align",key:"align",width:"55px",align:"center",options:[{value:"left",label:"居左"},{value:"center",label:"居中"},{value:"right",label:"居右"}],showLabel(v,C){let B=v.filter(E=>E.value==C);return B&&B[0]&&B[0].label||C}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(v,C){let B=v.filter(E=>E.value==C);return B&&B[0]&&B[0].label||C}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),n=i.computed(()=>{const v=e.editor.widget(e.wid)||{};return v.configs||(v.configs={}),v.configs.leftBtns||(v.configs.leftBtns=[]),v.configs.rightBtns||(v.configs.rightBtns=[]),v.configs.operation||(v.configs.operation={}),v.configs.operation.btns||(v.configs.operation.btns=[]),v.configs.operation.more||(v.configs.operation.more={}),v}),l=i.computed(()=>(e.editor.dataModels()||[]).map(C=>({value:C.sn,label:C.title+"("+C.name+")"}))),o=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.leftBtns;if(C.forEach(B=>{v.push(B.name)}),!v.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};C.splice(0,0,B)}if(!v.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};C.splice(1,0,B)}return C}),s=i.computed(()=>{if(!n.value)return[];const v=[],C=n.value.configs.rightBtns;if(C.forEach(B=>{v.push(B.name)}),!v.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};C.splice(0,0,B)}if(!v.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};C.splice(1,0,B)}if(!v.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};C.splice(2,0,B)}if(!v.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};C.splice(3,0,B)}return C});function r(v,C){v=="left"?f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.leftBtns.sort((E,g)=>{const S=E.index||1,I=g.index||1;return S-I}),n.value.configs.leftBtns=[...n.value.configs.leftBtns]}):f.value.open(C,B=>{B.visible=!0,Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.rightBtns.sort((E,g)=>{const S=E.index||1,I=g.index||1;return S-I}),n.value.configs.rightBtns=[...n.value.configs.rightBtns]})}function c(v){const C=v=="left"?n.value.configs.leftBtns.length:n.value.configs.rightBtns.length;let B={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};v=="left"?n.value.configs.leftBtns.push(B):n.value.configs.rightBtns.push(B),e.editor.widget(e.wid,n.value),r(v,B)}function h(v,C){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(C.name))C.visible=!1,v=="left"?n.value.configs.leftBtns=[...n.value.configs.leftBtns]:n.value.configs.rightBtns=[...n.value.configs.rightBtns];else if(v=="left"){const E=[];n.value.configs.leftBtns.forEach(g=>{g.name!=C.name&&E.push(g)}),n.value.configs.leftBtns=E}else{const E=[];n.value.configs.rightBtns.forEach(g=>{g.name!=C.name&&E.push(g)}),n.value.configs.rightBtns=E}};X.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const f=i.ref(null);function d(v){f.value.open(v,C=>{C.visible=!0,Object.keys(C).forEach(B=>{v[B]=C[B]}),n.value.configs.operation.btns.sort((B,E)=>{const g=B.index||1,S=E.index||1;return g-S}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function p(){const v=n.value.configs.operation.btns.length+1;let C={title:"新增"+v,name:"new_"+v,index:v,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};n.value.configs.operation.btns.push(C),e.editor.widget(e.wid,n.value),f.value.open(C,B=>{Object.keys(B).forEach(E=>{C[E]=B[E]}),n.value.configs.operation.btns=[...n.value.configs.operation.btns]})}function m(v){const C=()=>{if(["delete","view","edit"].includes(v.name))v.visible=!1,n.value.configs.operation.btns=[...n.value.configs.operation.btns];else{const B=[];n.value.configs.operation.btns.forEach(E=>{E.name!=v.name&&B.push(E)}),n.value.configs.operation.btns=B}};X.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{C()}})}const b=i.computed(()=>e.editor?.dataModel(n.value.dataModel||"none")||{}),y=i.computed(()=>b.value.fields?.length?(b.value.fields.forEach(v=>{v.show||(v.show={}),v.show.list||(v.show.list={})}),b.value.fields):[]),A={mounted:v=>v.focus()},x=i.ref({});function w(){const v=Object.keys(x.value);if(v.length)for(let C in v){const B=y.value.filter(E=>E.name==C);if(B&&B[0]){let E=x.value[C];Object.keys(E).forEach(g=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),g=="showIndex"?B[0].show.list.index=E[g]:g=="showWidth"?B[0].show.list.width=E[g]:g=="fixed"?B[0].show.list.fixed=E[g]:g=="align"?B[0].show.list.align=E[g]:B[0][g]=E[g]})}}x.value={}}function R(v,C){w();const B={};C=="showIndex"?B[C]=v.show?.list?.index:C=="showWidth"?B[C]=v.show?.list?.width:C=="fixed"?B[C]=v.show?.list?.fixed:C=="align"?B[C]=v.show?.list?.align:B[C]=v[C]||"",x.value[v.name]=B}function k(v,C){if(!v||!C){x.value={};return}const B=x.value[v.name][C];v.show||(v.show={}),v.show.list||(v.show.list={}),C=="showIndex"?v.show.list.index=B:C=="showWidth"?v.show.list.width=B:C=="fixed"?v.show.list.fixed=B:C=="align"?v.show.list.align=B:v[C]=B,x.value={}}function u(v,C){return C=="showIndex"?v.show?.list?.index:C=="showWidth"?v.show?.list?.width:C=="fixed"?v.show?.list?.fixed:C=="align"?v.show?.list?.align:v[C]}function N(v,C){y.value.filter(E=>E.name==v.name).forEach(E=>{E[C]=!E[C]})}const M=i.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:v=>{const C=M.value.options.filter(B=>B.value==v);return C[0]?C[0].label:v}});return(v,C)=>{const B=i.resolveComponent("a-divider"),E=i.resolveComponent("CloseOutlined"),g=i.resolveComponent("a-button"),S=i.resolveComponent("PlusOutlined"),I=i.resolveComponent("a-input"),V=i.resolveComponent("a-form-item"),F=i.resolveComponent("a-col"),$=i.resolveComponent("a-input-number"),D=i.resolveComponent("a-checkbox"),Q=i.resolveComponent("a-row"),L=i.resolveComponent("a-select"),O=i.resolveComponent("ToolOutlined"),G=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",br,[i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[8]||(C[8]=[i.createTextVNode("工具设置")])),_:1}),i.createElementVNode("div",yr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:_=>r("left",T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("left",T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add"]),size:"small",onClick:C[0]||(C[0]=T=>c("left"))},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),i.createVNode(g,{class:i.normalizeClass(["btn","tool-add","right"]),onClick:C[1]||(C[1]=T=>c("right")),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1}),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn","right",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size,ref_for:!0},T.props||{},{onClick:_=>r("right",T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"bool-del",onClick:i.withModifiers(_=>h("right",T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[9]||(C[9]=[i.createTextVNode("操作设置")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createBlock(Q,{key:0},{default:i.withCtx(()=>[i.createVNode(F,{span:7},{default:i.withCtx(()=>[i.createVNode(V,{label:"操作标题"},{default:i.withCtx(()=>[i.createVNode(I,{value:n.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(V,{label:"显示宽度",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.width,"onUpdate:value":C[2]||(C[2]=T=>n.value.configs.operation.width=T)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:6},{default:i.withCtx(()=>[i.createVNode(V,{label:"显示按钮数量",labelCol:{span:9}},{default:i.withCtx(()=>[i.createVNode($,{value:n.value.configs.operation.count,"onUpdate:value":C[3]||(C[3]=T=>n.value.configs.operation.count=T)},null,8,["value"])]),_:1})]),_:1}),i.createVNode(F,{span:5},{default:i.withCtx(()=>[i.createVNode(V,{label:"是否显示"},{default:i.withCtx(()=>[i.createVNode(D,{checked:n.value.configs.operation.visible,"onUpdate:checked":C[4]||(C[4]=T=>n.value.configs.operation.visible=T)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[10]||(C[10]=[i.createTextVNode("操作按钮")])),_:1}),n.value?.configs?.operation?(i.openBlock(),i.createElementBlock("div",wr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value.configs.operation.btns,T=>(i.openBlock(),i.createBlock(g,i.mergeProps({key:T.name,class:["btn",T.name,!T.visible&&"deleted"],type:T.visible?T.type:"default",size:T.size||"small",ref_for:!0},T.props||{},{onClick:_=>d(T)}),i.createSlots({default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(T.title)+" ",1),T.visible?(i.openBlock(),i.createBlock(E,{key:0,class:"btn-del",onClick:i.withModifiers(_=>m(T),["stop"])},null,8,["onClick"])):i.createCommentVNode("",!0)]),_:2},[T.icon?{name:"icon",fn:i.withCtx(()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(T.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),i.createVNode(g,{class:i.normalizeClass(["btn","btn-add"]),onClick:C[5]||(C[5]=T=>p()),size:"small"},{default:i.withCtx(()=>[i.createVNode(S)]),_:1})])):i.createCommentVNode("",!0),i.createVNode(B,{orientation:"left"},{default:i.withCtx(()=>C[11]||(C[11]=[i.createTextVNode("表头设置")])),_:1}),C[12]||(C[12]=i.createTextVNode(" 数据模型:")),i.createVNode(L,{class:"data-model-list",options:l.value,value:n.value.dataModel,"onUpdate:value":C[6]||(C[6]=T=>n.value.dataModel=T)},null,8,["options","value"]),i.createVNode(G,{columns:t.value,"data-source":y.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:T})=>[["showIndex","showWidth","align","fixed"].includes(T.key)?(i.openBlock(),i.createElementBlock("span",Ar,[i.createVNode(O),i.createTextVNode(" "+i.toDisplayString(T.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:T,record:_})=>[["showIndex","showWidth"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(T.dataIndex))&&!u(_,T.dataIndex)&&"empty"]),onClick:q=>R(_,T.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock($,{key:0,value:x.value[_.name][T.dataIndex],"onUpdate:value":q=>x.value[_.name][T.dataIndex]=q,onBlur:q=>k(_,T.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[A]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u(_,T.dataIndex)),1)],64))],10,xr)):["isList","isQuery","isSort"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",Cr,[i.createVNode(D,{checked:_[T.dataIndex],onClick:q=>N(_,T.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(T.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!x.value[_.name]||!Object.keys(x.value[_.name]).includes(T.dataIndex))&&!u(_,T.dataIndex)&&"empty"]),onClick:q=>R(_,T.dataIndex)},[x.value[_.name]&&Object.keys(x.value[_.name]).includes(T.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(L,{key:0,value:_.show.list[T.dataIndex],"onUpdate:value":q=>_.show.list[T.dataIndex]=q,allowClear:!0,options:T.options,onBlur:C[7]||(C[7]=q=>k())},null,8,["value","onUpdate:value","options"])),[[A]]):(i.openBlock(),i.createElementBlock("span",Sr,i.toDisplayString(T.showLabel(T.options,u(_,T.dataIndex))),1))],10,vr)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(fi,{ref_key:"btnSetting",ref:f,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]),Nr={class:"unione-table-tools"},Vr={class:"unione-table-data"},Rr={key:0,class:"unione-table-opts"},Rl=ee(i.defineComponent({__name:"tableList",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},loading:{type:Boolean,default:!1},pagination:{type:Object,required:!1},dataList:{type:Array,default(){return[]}},rowKey:{type:String,default:"id"}},emits:["edit","view","add","delete","delBatch","expData","impData","downTmpl","leftBtnClick","rightBtnClick","optBtnClick","btnClick","change"],setup(a,{expose:e,emit:t}){const n=Fe(),l=a,o=i.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),s=i.computed(()=>o.value.props||{}),r=i.computed(()=>o.value.rowKey||l.rowKey||"id"),c=i.computed(()=>o.value.dsn?l.editor?.dataManager().use(o.value.dsn,"list"):null),h=i.computed(()=>{const S=l.dataList||[];return!S.length&&c.value?c.value.data().body||[]:S}),f=i.computed(()=>{if(o.value.operation==!1)return{visible:!1};const S=Y.utils.obj.ext(o.value.operation||{},{title:"操作",width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),I=[];let V=(o.value.operation?.btns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F));if(V.forEach(F=>{I.push(F.name)}),I.includes("edit")||V.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),I.includes("view")||V.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),I.includes("delete")||V.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor&&l.editor.type.value!="code"){const F=V.filter(D=>D.name=="edit")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",Q=l.editor.model.value;F.action.link=n.editPageUrl+"?psn="+D+"&model="+Q+"&id={row."+l.rowKey+"}"}const $=V.filter(D=>D.name=="view")[0];if($.visible&&($.action||($.action={}),$.action.type||($.action.type="route"),!$.action.href)){const D=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";$.action.link=n.viewPageUrl+"?psn="+D+"&model=view&id={row."+l.rowKey+"}"}}return V=V.filter(F=>F.visible!=!1).sort((F,$)=>{const D=F.index||1,Q=$.index||1;return D-Q}),S.count&&(V.length>S.count+1?(S.btns=V.slice(0,S.count),S.more.items=V.slice(S.count,V.length),S.more.visible=!0):(S.btns=V,S.more.visible=!1)),S}),d=i.computed(()=>{let S=[];o.value.columns?.length&&(S=[...o.value.columns]);const I=[];S.forEach((F,$)=>{F.dataIndex=F.name,F.convert&&(F.dataIndex=F.name+"Label",F.convertObj=new Ge(F.convert),F.customCell=(D,Q,L)=>{const O=D[L.name];F.convertObj&&(D[L.dataIndex]==null||D[L.dataIndex]==null)&&O!=null&&O!=null&&(O+"").length>0&&(D[L.dataIndex]=O,F.convertObj.convert(O).then(G=>{G&&(D[L.dataIndex]=G)}))}),F.sort?.enable&&(F.sorter=!0,F.sort.multiple&&(F.sorter={},F.sorter.multiple=F.sort.multiple),F.sort.defoult&&(F.defaultSortOrder=F.sort.asc?"ascend":"descend")),F.customRender=({text:D})=>D||"--",F.fkey?.enable&&(F.fkey.labelName&&(F.dataIndex=sn(F.fkey.labelName)),F.fkey.labelTitle&&(F.title=F.fkey.labelTitle),F.customRender=({record:D,column:Q})=>D&&D[Q.name+"FEntry"]&&D[Q.name+"FEntry"][Q.dataIndex]||"--",F.fkey.fields?.forEach((D,Q)=>{if(!D.name)return;const L=sn(D.name),O={fkName:F.name,title:D.title,name:L,dataIndex:D.name,width:D.width,index:D.index||$+Q+1,customRender:({record:G,column:T})=>{if(G&&G[T.fkName+"FEntry"]){const _=G[T.fkName+"FEntry"][T.name];if(_)return D.convertObj&&D.convertObj.convert(_)||_}return"--"}};D.convert&&(D.convertObj=new Ge(D.convert)),I.push(O)}))}),I.forEach(F=>{S.splice(F.index,0,F)});const V=Y.utils.obj.ext(o.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return V&&V.visible!=!1&&(V.customRender=F=>R.value?(R.value.current-1)*R.value.pageSize+F.index+1:F.index,S=[V,...S]),f.value&&f.value.visible!=!1&&S.push({fixed:"right",align:"center",...f.value,name:"operation"}),S}),p=i.computed(()=>{if(o.value.leftBtns===!1)return[];const S=[],I=[];if((o.value.leftBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name),F.name=="delBatch"&&!k.value&&(F.visible=!1)}),!I.includes("add")){const F={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};S.splice(0,0,F)}if(!I.includes("delBatch")&&k.value){const F={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};S.splice(1,0,F)}if(l.editor&&l.editor.type.value!="code"){const F=S.filter($=>$.name=="add")[0];if(F.visible&&(F.action||(F.action={}),F.action.type||(F.action.type="route"),!F.action.href)){const $=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",D=l.editor.model.value;F.action.link=n.addPageUrl+"?psn="+$+"&model="+D}}return S});function m({btn:S,event:I}){if(n.isDebug&&console.log("unione table left btn click",S,I),S.name=="delBatch"){if(!u.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(c.value){c.value.deleteByIds(u.value.selectedRowKeys).then(()=>{E(),B(!0)});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+u.value.selectedRowKeys.length+")数据",onOk:()=>{M("delBatch",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("leftBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const b=i.computed(()=>{if(o.value.rightBtns===!1)return[];const S=[],I=[];if((o.value.rightBtns||[]).map(F=>(typeof F=="string"&&(F={name:F,visible:!1}),F)).forEach(F=>{F.visible!=!1&&S.push(F),I.push(F.name)}),!I.includes("impData")){const F={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};S.splice(1,0,F)}if(!I.includes("expData")){const F={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};S.splice(2,0,F)}if(!I.includes("downTmpl")){const F={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};S.splice(3,0,F)}return S});function y({btn:S,event:I}){n.isDebug&&console.log("unione table right btn click",S,I),M(S.name,{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("rightBtnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}const A=i.computed(()=>({bordered:!0,size:"small",...o.value.attrs||{}})),x=i.ref({}),w=i.ref(null),R=i.computed(()=>Y.utils.obj.ext(l.pagination||o.value.pagination,{showTotal:S=>"共"+S+"记录",pageSize:l.pagination?.pageSize||c.value?.data()?.pageSize||10,current:l.pagination?.current||c.value?.data()?.page||1,total:l.pagination?.total||c.value?.data()?.total||0,position:["bottomCenter"]})),k=i.computed(()=>typeof o.value.selection<"u"?o.value.selection:!0),u=i.ref({selectedRowKeys:[],selectedRowList:[],onChange:(S,I)=>{u.value.selectedRowKeys=S,u.value.selectedRowList=I},getCheckboxProps:S=>({disabled:S.checkable})}),N=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],M=t;function v({btn:S,event:I},V){if(n.isDebug&&console.log("unione table opt btn click",S,I),S.name=="delete"){if(c.value){c.value.deleteByIds([V[r.value]]).then(()=>{E(),u.value.selectedRowKeys=u.value.selectedRowKeys.filter(F=>F!=V[r.value]),u.value.selectedRowList=u.value.selectedRowList.filter(F=>F[r.value]!=V[r.value])});return}X.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{M(S.name,{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}});return}M(S.name,{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("optBtnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}),M("btnClick",{btn:S,event:I,row:V,keys:u.value.selectedRowKeys,rows:u.value.selectedRowList})}function C(S,I,V,F){console.log("tableChanged",S,I,V,F),w.value={page:S.current,pageSize:S.pageSize},V&&(Array.isArray(V)?(w.value.sorts=[],V.forEach($=>{w.value.sorts.push({name:$.column.name,asc:$.order=="ascend"})})):V.column&&(w.value.sorts=[{name:V.column.name,asc:V.order=="ascend"}])),E(),M("change",{pagination:S,filters:I,sorter:V,event:F})}function B(S=!1){S?(u.value.selectedRowKeys=[],u.value.selectedRowList=[]):X.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${u.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{u.value.selectedRowKeys=[],u.value.selectedRowList=[]}})}function E(){if(c.value){const S={page:R.value.current,pageSize:R.value.pageSize,keywords:x.value.keywords,body:x.value.params||{}};w.value?.page&&(S.page=w.value.page),w.value?.pageSize&&(S.pageSize=w.value.pageSize),w.value?.sorts&&(S.sorts=w.value.sorts),console.log("dataStorage find params",S),c.value.find(S)}}i.onMounted(()=>{d.value?.forEach(S=>{S.sort?.enable&&S.sort.defoult&&(w.value||(w.value={},w.value.sorts||(w.value.sorts=[]),w.value.sorts.push({name:S.name,asc:S.sort.asc==!0})))}),l.editor?.ebus.$on("table-list-search",S=>{console.log("table-list-search",S),x.value=S||{},E()}),l.editor?.ebus.$on("table-list-reset",()=>{console.log("table-list-reset"),x.value={},E(),B(!0)}),l.editor?.ebus.$on("table-list-reload",()=>{console.log("table-list-reload"),E()})});function g(){return{keys:u.value.selectedRowKeys,rows:u.value.selectedRowList}}return e({getSelected:g,clearSelected:B}),(S,I)=>{const V=i.resolveComponent("unione-btn"),F=i.resolveComponent("DownOutlined"),$=i.resolveComponent("a-button"),D=i.resolveComponent("a-dropdown"),Q=i.resolveComponent("a-table");return i.openBlock(),i.createBlock(lt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",Nr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,L=>(i.openBlock(),i.createBlock(V,{key:L.name,class:"btn",widget:L,editor:a.editor,onClick:m,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),u.value.selectedRowKeys.length?(i.openBlock(),i.createElementBlock("span",{key:0,class:"selected-info",onClick:I[0]||(I[0]=L=>B())},"当前选中记录("+i.toDisplayString(u.value.selectedRowKeys.length)+")",1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.value,L=>(i.openBlock(),i.createBlock(V,{key:L.name,class:"btn right",widget:L,editor:a.editor,onClick:y,preset:N,ctx:{sltKeys:u.value.selectedRowKeys,sltRows:u.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),i.createElementVNode("div",Vr,[d.value&&d.value.length?(i.openBlock(),i.createBlock(Q,i.mergeProps({key:0,columns:d.value,rowKey:r.value,"data-source":h.value,"row-selection":k.value?u.value:null,scroll:{x:s.value.scrollX||"max-content",y:s.value.scrollY},pagination:R.value,onChange:C},A.value),{bodyCell:i.withCtx(({column:L,record:O})=>[L.name==="operation"?(i.openBlock(),i.createElementBlock("div",Rr,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.btns,G=>(i.openBlock(),i.createBlock(V,{key:G.name,class:"opt",widget:G,editor:a.editor,onClick:T=>v(T,O),preset:N,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128)),f.value.more?.visible!=!1&&f.value.more.items?.length?(i.openBlock(),i.createBlock(D,{key:0,trigger:[f.value.more.trigger||"hover"],class:i.normalizeClass(["opt-more",f.value.more.size||"small"])},{overlay:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["opt-more-overlay",f.value.more.layout])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value.more.items,G=>(i.openBlock(),i.createBlock(V,{key:G.name,class:"item",widget:G,editor:a.editor,onClick:T=>v(T,O),type:"text",preset:N,ctx:{row:O}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:i.withCtx(()=>[i.createVNode($,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.value.more.title)+" ",1),i.createVNode(F)]),_:1})]),_:2},1032,["trigger","class"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):i.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:i.withCtx(()=>[i.createVNode(Br,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a168b83b"]]);class De{options;mask;container;inputList;constructor(e){this.options=e,this.mask=null,this.container=null,this.inputList=[],this._render()}_render(){const{title:e,data:t,onClose:n,onCancel:l,onConfirm:o}=this.options,s=document.createElement("div");s.classList.add("dialog-mask"),s.setAttribute(ae.EDITOR_COMPONENT,ae.EditorComponent.COMPONENT),document.body.append(s);const r=document.createElement("div");r.classList.add("dialog-container"),r.setAttribute(ae.EDITOR_COMPONENT,ae.EditorComponent.COMPONENT);const c=document.createElement("div");c.classList.add("dialog"),r.append(c);const h=document.createElement("div");h.classList.add("dialog-title");const f=document.createElement("span");f.append(document.createTextNode(e));const d=document.createElement("i");d.onclick=()=>{n&&n(),this._dispose()},h.append(f),h.append(d),c.append(h);const p=document.createElement("div");p.classList.add("dialog-option");for(let A=0;A<t.length;A++){const x=t[A],w=document.createElement("div");if(w.classList.add("dialog-option__item"),x.label){const k=document.createElement("span");k.append(document.createTextNode(x.label)),w.append(k),x.required&&k.classList.add("dialog-option__item--require")}let R;x.type==="select"?(R=document.createElement("select"),x.options?.forEach(k=>{const u=document.createElement("option");u.value=k.value,u.label=k.label,R.append(u)})):x.type==="textarea"?R=document.createElement("textarea"):(R=document.createElement("input"),R.type=x.type),x.width&&(R.style.width=`${x.width}px`),x.height&&(R.style.height=`${x.height}px`),R.name=x.name,R.value=x.value||"",R instanceof HTMLSelectElement||(R.placeholder=x.placeholder||""),w.append(R),p.append(w),this.inputList.push(R)}c.append(p);const m=document.createElement("div");m.classList.add("dialog-menu");const b=document.createElement("button");b.classList.add("dialog-menu__cancel"),b.append(document.createTextNode("取消")),b.type="button",b.onclick=()=>{l&&l(),this._dispose()},m.append(b);const y=document.createElement("button");y.append(document.createTextNode("确定")),y.type="submit",y.onclick=()=>{if(o){const A=this.inputList.map(x=>({name:x.name,value:x.value}));o(A)}this._dispose()},m.append(y),c.append(m),document.body.append(r),this.container=r,this.mask=s}_dispose(){this.mask?.remove(),this.container?.remove()}}function Er(a){switch(a){case"comment":case"prolog":case"doctype":case"cdata":return{color:"#008000",italic:!0};case"namespace":return{opacity:.7};case"string":return{color:"#A31515"};case"punctuation":case"operator":return{color:"#393A34"};case"url":case"symbol":case"number":case"boolean":case"variable":case"constant":case"inserted":return{color:"#36acaa"};case"atrule":case"keyword":case"attr-value":return{color:"#0000ff"};case"function":return{color:"#b9a40a"};case"deleted":case"tag":return{color:"#9a050f"};case"selector":return{color:"#00009f"};case"important":return{color:"#e90",bold:!0};case"italic":return{italic:!0};case"class-name":case"property":return{color:"#2B91AF"};case"attr-name":case"regex":case"entity":return{color:"#ff0000"};default:return null}}function Or(a){const e=[];function t(n){for(let l=0;l<n.length;l++){const o=n[l];if(typeof o=="string")e.push({content:o});else if(Array.isArray(o.content))t(o.content);else{const{type:s,content:r}=o;typeof r=="string"&&e.push({type:s,content:r,...Er(s)})}}}return t(a),e}const Mr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAABAQGA7Tk43SVs8S1pDQ1E7RVhASVtARlc8R1c8R1k8Rlc8RlY9RlY8SFc9R1Y8R1c9R1c9R1c9R1c9R1c9R1c+Rlc9R1g9R1c9R1c9R1f///9drmTRAAAAGnRSTlMACA0OERMaHCwvSExNUFWFvr/B0dji5Ozy9AbGsiEAAAABYktHRBsCYNSkAAAAS0lEQVQYGY3BRxKAIAAEwVEw56z7/4daggfkZDc/JXzZmY98EaFykwhkh5xravHqUwLSbh3wql087NbgFQtOP/IyOOYkIiIiIn64AbuqAxNq8qL8AAAAAElFTkSuQmCC",Tr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAUVBMVEUAAAAzTU1GRl07Tk45R1U9SVVASlU5TFVARlk9SVU8SFU/R1Y9R1c9R1Y+R1Y9Rlg+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///+KO8ZgAAAAGXRSTlMACgsNEhUYGygqPEFPU4jAx87f4u3v8/T7caJ5nAAAAAFiS0dEGnVn5DIAAABMSURBVBgZlcFHEoAgFAXBMecs+t/9L2qBbmBnN3/kJLaGmO0tEdPZ8xqXW5JJrsKbj6kATG7AG48Sz/aOYJkI1prXVRBkfERCJMQ/D6VYAuykMtaLAAAAAElFTkSuQmCC",Ir="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABJSUk+Rlg8R1c9R1c9Rlc+R1c9R1Y9R1c9R1g9R1f///+2NgyDAAAACnRSTlMABx2MjbW2t+rsMOUdWQAAAAFiS0dECx/XxMAAAAA4SURBVAjXY2BAAmxLoQwuLlQG26pVXKtAkmAuFwpjFQhgl4IxNEAMTQYGpmIgzVQC1bTSkAETAAAWEQwPZulNYAAAAABJRU5ErkJggg==",Fr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAAABAQEAzM2YrVVVJSUlAQFU7Tk5AQFA+Rlg8RFU+RlU8Rlg+SFc+R1c8R1g9R1Y8R1c+Rlc8Rlc9R1c9SFY8R1c+RlY9RlY9R1Y+SFc9Rlc+R1Y9R1g9SFc9R1c9SFc+R1c9Rlc9R1c9R1c9SFc9R1c9R1Y9R1f////47kAZAAAAKHRSTlMAAQQFBgcMDRAdHiFmZ293goyVmKirra6vsbK1usPExcXP2tvc3d/mLcr8mwAAAAFiS0dEKcq3hSQAAAB2SURBVBjThc7ZFoIgFAXQQ4JTliZOOVRaVP//hQJeNZ46L3edDYsLsMaDEyZV7PYh/RWW3wKc3kenYxfqQLIIk1NIi8bMnj/64mB73Qk95ODzttTiVVduWKWAEepA9DobqRp738pTi/+5i+1bWui9TdSXcsH/zK15B5Da4/74AAAAAElFTkSuQmCC",Dr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGVJREFUGBmVwdsCQkAUQNEtIipFQlR0EZ3//8CGmdFrrcV/BMupSxTBirshREZoVXHJAcEI+nXycEEwsivec89Xm0J5ZrYZIt/fvldYJ5kcMZavHcrhtkBL7y5K0MdoTc6krvjJB4ifBrYdwvLwAAAAAElFTkSuQmCC",_r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAAAAAgIBVVVUrVVVERFU8S1pDQ1E7RVhASFg+RlU8R1c9RVY/R1Y9SFg/Rlk9R1g+SFc9Rlc8SFg9Rlg9R1g9R1Y9R1c+RlY9R1c9R1c9SFY9R1c9R1c+SFc9R1c9R1c9R1c9R1Y+Rlc9R1c9R1c9R1c9R1c9R1c9R1c9R1f///9wTW6UAAAAKnRSTlMAAQIDBg8RExogIS87QUNFS1JpbnF6go+Rn6irsLPLzdTe4+Tq7vT4+fscy10YAAAAAWJLR0QrJLnkCAAAAGBJREFUGBmdwdsWQlAAQMEdooikyJ1Q5P8/0FlOubxZZtjrkISsOO/uDL2AFD+zgAWjtW61yuyRozUus9KDMGVy6Uxdt78n/qJ+5PNz/FwR7i8FyatUBKN1kIqAURKzyQDrjgXkjtxK1wAAAABJRU5ErkJggg==",Pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAABAQEAzM2ZGRl06Rl08RFo8SldARlk7R1k8RlU9R1U9SVU+RVc+SFY8Rlc+SFg8SFY+R1g9SFY+RlY8Rlg+R1c+Rlg9R1g+R1c9R1g+R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1Y9R1c8R1c9R1c9R1c9Rlc9R1c9R1f///99ZXGyAAAAKHRSTlMABAULFiImKCszNj9GSkxOWVpcX2ZvdH2EmqrN0NHW29zj5ejq8Pb3yCx5eQAAAAFiS0dEKcq3hSQAAABWSURBVBjTY2AgCmiAgLIEE0JAiJOTW0xVHCHACSJFZdEEROQRAvysrOyCSpKohmqoc6CoYOOTVmRGNYNFjRdVgEFOGF0FD7LDuARkFBhRbFGRYiXOowAU0gecoB1FYgAAAABJRU5ErkJggg==",$r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAnklEQVQ4jcWSOw7CMBBE39oWPSVHQEjOCVLnBFHOyBGoqYECcQqoaBGeVKnAdpQmU620s0/7g7VlNUPbDZri8+n443c1gPdpB7z+Fc8CpI+LwCWXrwLkaZBdFwNIFuV0Ww4wxaCUBRR16PtN2w1PCtcqdrB9uz2yB6CcpzKCRVzKLrAKMEtRcsX5iwCJJih/AYCQS0wv/DXuzHj59TQCPqcrfjIJB5MAAAAASUVORK5CYII=",Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAM1BMVEUAAAA7RVhASVs+Rlg7SFU8R1g+Rlc8R1g+R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1f////E92BfAAAAD3RSTlMAGhwdJ3d4qaqv5ufw8fJmHhtWAAAAAWJLR0QQlbINLAAAADdJREFUGNNjYCAK8KNQtBLgYwSRjDxwAU5WEMnGDhdg4WZlZGTlYkK4jJmDl5edCZ/ToYA4jwIAzigBuWRZLZ0AAAAASUVORK5CYII=",Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAnFBMVEUAAAAAAAAAgIBVVVVAQFU3SVs8S1o9R1w+Rlg6SlpASFg+RlU6SVc7RVg8Rlg+Rlg/R1g9SFY+SFg+SFc8SFc+Rlg8SFY8RlY+R1g+R1Y+Rlg8Rlc+SFg9R1c9SFc9R1c+R1c9R1Y9R1c8R1c9R1g9R1g9R1c9R1c8R1c9R1c9SFc9R1c9R1c9R1c9R1c9R1c9R1c9R1c9R1f///96K4o3AAAAMnRSTlMAAQIDDA4RGR0fICEjNDc6PUdOUlVXWWJrc3R7gI2Sm6GxvMLDyc3R09vd3+309fr8/RCh/swAAAABYktHRDM31XxeAAAAZElEQVQY02NgIA4Iq+joqooh+KJ6Etw8UvricAElWRApowkXUFRAM0LQQI4DmW8EByjKmNlYUfUxSupzQZmsWvxgER0RmKQa2BZ2QwGYAJ+uPC+nkLoyE1w/l4K2noY0C3H+BAAncAfEJkWhEAAAAABJRU5ErkJggg==",zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABVVVVAQEArVVU5VVVAQFU3SVs5R1U5TFU8RFVASFg+RlU8SldARlk9SVU9SFk8RlU9R1U7SVc/R1Y9R1c9SFY9SFc9SFY+SFg9R1Y9Rlg9R1c9R1c9R1c+R1c9R1c8R1c9Rlg8R1c9R1g+Rlc9R1c9R1c9R1c9R1c9R1Y9R1c9R1c9R1c9R1c9R1c9R1c9R1f///8SZco5AAAAMXRSTlMAAQMEBgkMDhIbHiAhJigqLjM2OEFPXHV5gIKGk6Koqri+wMLGx83U2Nzj7u/w8fL1p0xyMQAAAAFiS0dEMkDSTMgAAABoSURBVBjTY2AgB8gqM4EoMS0OSXk5EItNQwJI8uiIMAhxqoGVCBoIMzCrSDMwcCvyQTSJa7JLqbEwMKirykMEGBWU9HhRzBUwlEHhA1Xo8yMLgMxQZ0XwIbYgNEHdoSuK7lJtLuJ8BgDQrgcbuWPXNAAAAABJRU5ErkJggg==",jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAkFBMVEUAAAAAgIBVVVVJSUlAQGBAQFVERFU9SVVASlU8RFVASFg6SVdAR1VARlk9R1U8Rlg+RVc9R1g+Rlg9SFg8R1c8RlY+SFg9SFY9R1c+R1g9SFc8R1c+R1c+SFc9R1Y9SFY9R1c9R1g+SFc9R1c9Rlc9R1c9R1c9R1c9R1c9R1Y9R1Y9R1c9R1c9R1c9R1f////jiaduAAAALnRSTlMAAgMHCAwPFRgeICMkKDY3RktXYGFigI6WnaSlqrK3vcHGy87S1NXb3ubp7fHzk2gqsQAAAAFiS0dELyPUIBEAAABiSURBVBjTY2AgAzAri4NpcQUmqAiPjiCQFNDmhKsR1eJgYNcUQtIlLccoK4lsDJuGvDorisEiesIMaCo02BjQzJAB0mISUki2iDAw8HGrIblDl5eBS5Ef2aUqLKpKMkR4DQDv1gZ3Go1zEQAAAABJRU5ErkJggg==",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA8ElEQVQ4jeWRvUoDURSEZ85dtRK7aCcWVmJtEDaNYRPsImw2159X8GnyCJolbEgnaSy2EvIIFmJvaZUY9x5LI9nraic45ZzhY4YD/Gk1ou44bHez7zL0HZrNeGtm5JFQvsna/nRy+1qWEx9gZuRMwDtQJhvFouPLeQGAWgeXAi5V0v4KcBxd1QgeBPOXfGdT7wEcHp3Y7R8DRBY9qo7yPH/PsqwAMF4PXFyWDUoBTq2S9bCVXC/ZDwD6vimf9U/Pd8NW8oyvH2LYTp4aUbxXOcEU7gLQAQBdshWOQxX2KgEKtUaZrlQzxQ2Ul5UT/qE+AI3BRc9uSCDPAAAAAElFTkSuQmCC",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABOUlEQVQ4je2QvUtCARTFf/c982trycKpIYKGlqY+FGnQiqRJnIzWQqgtXIIimt1aG1p0SyF5NSRYS9R/0NrQVkR+PH3epicK4ZC0daZzOfC7hwN/rUgircNyY9QHIwM8ronE07sIOWAKeAXyNauQB1hZS++hHAn4QYp179fBc7lcHwAgnJlKBDvw0vE2t0X0FMgDiDJTswqTQxvUrMK46xeSycugHTx3b7MVyPWarqfm6IqlcHVvFbM9QDSR3lf0ECSEPbhNtXrRBIjGU9M4xo0KYRQ/9I2ocCKqyzWrYDrqDfUDFjdT4aV4ZkLFqKgQVrjz2IHsAAB4Nzw0YrEdvynt436AYRvzprSvgVmQR/U1ttxWPYCoZrqOUXF8jQ/QVaDlZmP22y3giPDk7bQ2Hkqlz58G/dcv9Q2n32hulF2TowAAAABJRU5ErkJggg==",Wr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAAxSURBVAjXY2CAAWYXMFBgYIHwHbAyXFhcXKAiLAyoDBcXFpy6XOC6UKWYIJYKwF0BAHOuCQoquY55AAAAAElFTkSuQmCC",Yr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AGI9sLgcTI6GI2FwQCGQSwAADUiFAamiQmpAAAAAElFTkSuQmCC",Hr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AEwnEHIK4PH6TAwGguDAQyDWAAA9RMUBrWQGpQAAAAASUVORK5CYII=",Kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFwOoOQlwahF0ZjYQDBMIgFALUTFAbTYirrAAAAAElFTkSuQmCC",Gr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAAJ0lEQVQ4jWNgoBAwwhi27uH/SdF4eOdKRsKq6AFGvTAYwKgXBgMAAPBTFAZ3qmVkAAAAAElFTkSuQmCC",Jr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAAzM2YrVVVJSUk9SFg8RlY9R1Y8R1c9R1c9Rlc9R1f///9QjfnYAAAACnRSTlMABQYHYGJlra+1njVvfgAAAAFiS0dECx/XxMAAAAAoSURBVAjXY2CAA/UABgbWIgYGxk4DCMG2CgwSECJwNcQAFoh2B5KkADPdEacOm1TIAAAAAElFTkSuQmCC",Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAG1BMVEUAAABAQEA8S1o8R1Y+Rlc9R1c9R1c9R1f////nl+KoAAAAB3RSTlMABBGUlbO7ydSN6wAAAAFiS0dECIbelXoAAAApSURBVAjXY2CAg3IwYMAGmIKgDLEyAQjDvdyAHYdiuBRcMVw7JkC3FAArJgs7P7dCZAAAAABJRU5ErkJggg==",Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAABAQEA8SFg8R1Y+Rlc9R1c9R1c9R1dFS1ROT1BPT0/////9olEBAAAAB3RSTlMABECUlbu/AxMlgQAAAAFiS0dECx/XxMAAAAA2SURBVAjXY2CAg3IYg52Bvby8HMyASRUwoIGVDVCGqAFUsasAVKRzAbpiuHY2BahipgQcJgMA/tcK8xtGzrIAAAAASUVORK5CYII=",ec="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAflBMVEUAAAAAgIBVVVUzTU0+RVo+RFc+SlU+SVg8RlU7RVg8Rlg7SVc+Rlg9RVY8SFU/R1g9SFg+SFY9SFY8Rlg+Rlc8R1c9R1g9R1c+Rlc9R1c9R1g9R1c+SFc9R1c9R1c9R1c8R1c9R1c9R1c9R1c9R1Y8R1c9R1g8R1c9R1f////HRSvjAAAAJ3RSTlMAAgMKJSktMTM0Nzg6Ozw9Q0pcZnjCw8XHyMnKy9TV1tfa3N7m6Ow9HbHWAAAAAWJLR0QpyreFJAAAAGVJREFUGNOFz8kSwWAUROHPFEGIMeY5uO//hDYWf1E4y9PV1dV8sI2ENSJN46dYVm+iWnyvdHcZaL5EeZ0eOyhuRSAmdS4/tGWX2TkQ9wH6+/GpZx6IERjWBY10pQUPbNIvK/95ApvLCnWV+SkGAAAAAElFTkSuQmCC",tc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAIVBMVEUAAAA3SVtERFU8Rlg9R1Y9Rlg8SFc9R1c9R1c9R1f///8OwK+UAAAACXRSTlMADg+DhYaH+PlFyGUBAAAAAWJLR0QKaND0VgAAADVJREFUCNdjYIABts6ZQNDKwMAhwMnAySDOwMAJhUiMmWCAVYoINRwKIEqdgYEFbFczAyYAALRoD8n+O8X7AAAAAElFTkSuQmCC",ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEUAAAAAAABGRl1AQFA6Rl05TFU8RFU+RlU6SVc+RVpARlk+RFc6RVU+SVg7SVc/SFU8SFU9SVU9RlY+Rlg9Rlc9SFY+RlY8SFc+R1g9Rlc8SFg+R1c8SFc+R1Y+R1c9Rlg8R1c+RlY9SFc9R1c8R1Y+R1c9R1c+R1c9R1Y9R1c9R1g9R1c9R1c9R1c9R1Y9R1Y9R1c8R1f///9df1iTAAAAMnRSTlMAAQsQFhseISMlKCkwMTg5PD9QV1hcX2prbW5vcnOEhpCRkpOUqqy2t8XG2uDh4+bn6Kl8Ee0AAAABYktHRDJA0kzIAAAAcklEQVQYGQXBBwLBMAAAwENTe9WoFXsH5f+fcwcAAID2ct0FgPJ73FclADHlhKoDUL8FOKwAAOcFAP0H+a8F4pReVQipBDEFvargHsH4FTS+BerAdUatCYDnAMIEwGmLkCKA7LMbzt8bAGSHx2UEAADAH9DFB04VCI4zAAAAAElFTkSuQmCC",nc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAb1BMVEUAAABVVVU8S1o5R1VDQ1FATVk6Rl0+RVo8Slc9SFk9R1c7RVg/R1g+RlY8SFg+SFc9R1Y+Rlg9Rlc9R1c9Rlc9SFY9Rlg+R1c9SFc8R1Y9R1c9R1c9SFc9R1c9R1c9R1g9R1c9Rlc9R1c9R1f///8zJMhcAAAAI3RSTlMAAxESExQWJSYuMjQ9PlFSU1dYiYqLo7a5urzc3d7r7O3296tJ8dIAAAABYktHRCS0BvmZAAAAVElEQVQY053EORKCQAAAsCyrKB4ggnggeOz//2hLYcGQIvxx3OIUCTko3s+V8+cetB3Evm4eu3F/vVTDGrpWuH1rsX8VIA9kJTYHM6Upy6SUpi3wA3oQBcTpxJSwAAAAAElFTkSuQmCC",lc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAAzM2Y3SVtERFU9SVU5TFVARlk8SFg+SFc8Rlg9R1Y9Rlg8SFc+R1g9Rlc9R1c9R1c9R1c9R1c9R1c+SFlBS1tETl5GUGBGUWBXYXFYY3Jtd4aIkqKJk6KQmqn///+BgndPAAAAE3RSTlMABQ4PFRsoQFKDhYaHndLx9/j51euREwAAAAFiS0dEHwUNEL0AAABbSURBVBjTY2DABDxCwlAgxA0WEGKCSTEJgilhhGJhXAJyclJiopJyckgqOFhZhFBUSIuLCKOo4GdjFEZRISEji6qCnU+AF0UFBOByhxAzjM8McToXwnOcWPwOAMNdB2CQm99LAAAAAElFTkSuQmCC",oc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAUVBMVEUAAABmZmZVVYBJbW1VVXdQYHBOWGxTWnFSWm5TXXFSXG9SXHBRW29SXG9SXG9TXG9SXG5SXG9TW29SXG9TW3BSXG9SXG9RXG5SXG9TXG////+yGw2IAAAAGnRSTlMABQYHDxAaIkFNTmRlepWqq6ytr7C1wcLq7pNxeq0AAAABYktHRBp1Z+QyAAAATElEQVQI12NgIAPwcsBYTHxsDIwS7Gx8TCAeo7AoMwOXGIRmYBASAYoKcANViQhCuSySrDAuSBEPPwNMMcgocU4GBqhRIAExRnIcBwAL/QKNbAjqXgAAAABJRU5ErkJggg==",sc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEUAAABAQEAzM2ZGRl1AQFU7Tk48S1o9SVU9R1Y9R1c9SFY9R1c+Rlc+SFc9R1c9Rlc9R1Y9R1c9Rlc9R1c9R1c9R1f///9HtE8rAAAAFXRSTlMABAULDA0RFYKJi42VmbO1t7vS+fqSQw0RAAAAAWJLR0QWfNGoGQAAAFdJREFUGBkFwYcBgkAAALGoiCIWyt/+q5oAAAAAANZRVWMFnDdgOgEBBAgg+FyNCbif0D6/RlWNF9QXAGift6p6Au+LQMcCEOhxLIBAFSCAAFtV1Q8AAH+MlAVVTkhGJgAAAABJRU5ErkJggg==",ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAA9SVU+SFg+R1Y9R1Y9Rlc+R1c9Rlc9R1f///9noqaFAAAACHRSTlMAFYCItLW20pbgUbMAAAABYktHRAnx2aXsAAAANklEQVQI12NggIOMjo4OBRCjgYGBoxjGEDeAMjoaIAwIgWBwdHRARTgYCDPQtUcALe1wQDgCABn0EmuJtBWkAAAAAElFTkSuQmCC",rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAe1BMVEUAAAAAAAAAgIA5VVVGRl1AQFU6Rl1ASlU9R1w7R1k9SFk8RlU/SFU9SVU/Rlk9RlY9R1Y8SFY8R1g+RlY9R1c8SFc+RlY8Rlc9Rlg9Rlg9R1c+Rlc9R1g9R1c9R1c9SFc9R1c8R1c9R1c9R1c9R1c9R1c9R1c9R1f///8mEHjhAAAAJ3RSTlMAAQIJCwwWGBkrLjM5P0VQU1ldX2RqkZijwMHHycrN3eDo6+/w8/c/aEsTAAAAAWJLR0QovbC1sgAAAFtJREFUGNNjYMAAsupQIM4IEVBHkmRHExBRYUMREFbjh6pgBfOFVPmgZjDLiwJpQWVeuKGcCmJMAko8DAwsMEM55CQVuYG0FNwWVgkuOBvZHUQKyKgjgDQDEQAAa98IGcmJyhIAAAAASUVORK5CYII=",cc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAz1BMVEUAAAAAAAAAgIBAQFU7Tk43SVs8RFU6SlpASFg+RlU8RFo6SVdAR1U6RVU+SVg8RlU7RVg+RlY9SFg8R1c9R1c9R1Y8Rlg+SFc+R1g9R1c9Rlc8SFg9SFc9R1Y8R1g+Rlc+SFg9R1c9R1Y8Rlg+R1c8Rlc+SFc9R1g9R1c8Rlc+R1g9SFc8R1c9R1g9Rlc9R1Y+SFc9R1c9R1Y9SFc8R1Y9R1c9R1c+SFc9R1g9R1c9R1c9R1Y9R1c8R1c9R1Y9R1c9R1c9R1c9R1c9R1f////kTFPbAAAAQ3RSTlMAAQIMDQ4eHyAhIiMkMDEzNF9gYWRlZmdrbG1udXZ3eICBgoOEmJmam5ydpKWmp7Gys7S5uru8y8zN5ebn6Onq9/3+2KlzWgAAAAFiS0dERPm0mMEAAAD9SURBVBgZhcFte4FgGIDhK1aUDbMxM8VMsXdmtlj01P3//9N60nHQJ+fJWfVBsFwGgxpl7bXINgz/RNYtjirTdDe0yTjuPp0YFCofElQpVGfyZnAwFZcTrjySa6cBJfOkifazq1Jixt9k6jIk5/R6NjkvtYAHsdFulIjqoDXkHgi2aI6SjLLRIh/4+kW7k1wXLVwAyxCtJ7lbtM0nEGzRHCUZZaNFPjAQB62jRNQ12qX0gZq45Oxut05ulFpk1vsLSsx4hdZKZ5Q8J1fknsTjhCdjDirvMjcpmC/yalAwJknsNcg0RnEyNjhqrkSicBOJrJqUWX1/sfD7Fuf8A/JKIgzf/RoEAAAAAElFTkSuQmCC",dc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAbFBMVEUAAAAAAAAzM2YrVVU5VVU3SVs5R1U9SVU+RVo+SlU+SVg8RlY8SFY9R1c9R1Y9SFY8R1c9R1g8Rlc9Rlg9R1c8R1g9R1c9R1Y9R1Y9R1c9R1c+Rlc9R1c9R1g9R1c9R1c+Rlc9R1c9R1f///8UOCwUAAAAInRSTlMAAQUGCQ4SFSUtMU1ZcIWLjJeYo6ipr7G0uL/HyszN1OTqk8O17wAAAAFiS0dEIypibDoAAABgSURBVBjTY2AgAogogQFCQJoHTQWnIgeaCK8ME6oAozgfmhJ2BS4GBjYpVgZWKTaEAIOQKIOwILIWFnlReRYUQ7mVuFGsZZaVlGVGdpiABKMYP5LT2eTYGEAYyTlQjAYAnoAFnPcjJSYAAAAASUVORK5CYII=",hc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEUAAAAAAAAAgIBVVVVAQEA+Rlg9RVY8SFU/R1g+RlY9SFY8R1c9R1c9R1c+Rlc9R1g8R1c9R1g9Rlc9R1c9R1c9R1c9SFY8R1c9R1c9R1c9R1f///+zMICDAAAAGnRSTlMAAQIDBDo7PD0+i4yNk5WXpaanqLu8vdfY2SY5IPUAAAABYktHRBsCYNSkAAAAbElEQVQYGQXBBwKDIBAAsIBasdY9uf8/tAkAAAAAoBz1qXsP0C5nn+VyzS2wfBNBGmcwnAmBdH3g6CGgbFAzBDQvvCAiIrxQM4Dmhb0AGFbozwRIdwfmMYH0m4B2vkrWDPfUAny2+tS1AwAA/lKtBH5OtPfsAAAAAElFTkSuQmCC",fc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAYFBMVEUAAAArVVU5TFVASVs+Rlg8TFc+SVg+Rlg8SFU/R1g8R1k7Rlc9R1g+Rlc9SFY8SFc+R1Y9R1c9R1Y+R1c9R1Y+R1c9R1c9R1Y+Rlc9R1c9R1Y9R1Y9R1c8R1c9R1f////KAOEWAAAAHnRSTlMABhscHS8xOjw9SElLW1yHiIm0trfZ4uPk5ebp6/0q4FxUAAAAAWJLR0QfBQ0QvQAAAGdJREFUGNN9jskOgkAUBAsGEUVxZJnhufT/fyYXkzchwTr0odJJNxxxWyXl3kU+A11yoSJh+MhF9XzZcioacazDFMkdcEmABWiMPktKVxdOnEIzPwpRRbOl3R27v/X9fwyK2R8+u2MDhRQGtwwXG7YAAAAASUVORK5CYII=",uc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAilBMVEUAAAA3SVtERFVAQFA8S1o+RlU+RVpARlc+SlU8Rlg7SVc+RlY8R1Y9SFY9R1g8Rlc8RlY+SFg9RlY8SFg9R1Y8SFY9Rlg8SFc9R1c9SFY8R1c9R1c8R1c9R1c9R1c9SFc9SFg9R1c9R1g9R1c9R1c9R1c9R1c9R1c9SFc9R1c9R1c9R1c9R1f///+dRdSiAAAALHRSTlMADg8QESElLC03OD5ER0tMTU5QUVNZhoe8vb6/19jZ3d3l7O/x8vP09vf4/SaRJScAAAABYktHRC3N2kE9AAAAc0lEQVQYGQXBBQKCQAAAsN2JHYggKmED1v/f5wYAALJ6GKoMgEOTh5C3JUDWjCA5p4B6BxQnQB+A+AR0AYgdoMqB4gjYtgkk1w1AeS5iKC6vdQRIT3133Ow/9wUAmLx/wwoALB+/zxQAzG7fOQAQxwAA+AOHiAZ7S/gziwAAAABJRU5ErkJggg==",pc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAElBMVEUAAAA8R1c9R1g9R1c9R1f////4xTreAAAABHRSTlMAwsPFKmGWBgAAAAFiS0dEBfhv6ccAAAA9SURBVAjXY2BAABMXFycww4GBgQWZwewCBgpQUaAwmMHi4IAkwgJSAhYB60JiMLmAGC4CyCaruLg4MmABAK6mCQnMcOUgAAAAAElFTkSuQmCC",El="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAL0lEQVRoge3RoQ0AAAgDQdh/aFigmiDu5KsmrQIAAAAA/unQ5nwFF9LXAAAAAHy14HMBAug6NlQAAAAASUVORK5CYII=",mc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAANklEQVRoge3UsQkAQAgDQN1/6HcBa3n0rkwVCCQCAAAAAPhPNtkbb8GEbmvgBFd/h6sHAIBVCqg8AgOBAhyrAAAAAElFTkSuQmCC",Ol="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3RQQ0AAAgDMfAvGgxMACTt87LfqgAAAACAezq0CRvtf0tfAwAAAHDVAlQQGAInOy4AAAAAAElFTkSuQmCC",Ml="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAJUlEQVRoge3FQREAAAwCIPuX3nLowYcEAAAAAOhwnhwAAACAJg/gLTrGTJMeQQAAAABJRU5ErkJggg==",gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAdklEQVRoge3JMVLCABRF0YMuAcu00LIGop29K5QdsBD3ADUtLU2KjONoazL3VO//S5IkSZIkWYrnH34v+MABV9zrq+rg6ds94AuveJv2OOtjfdF97xe72T7igk+cpn2sL7oPsPG3Ld6nfcatvqqeJEmSJEn+uQdnL6BXV6mCJAAAAABJRU5ErkJggg==",kc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAALUlEQVRoge3KwQ0AAAQEQfovmgrEl2TmeXsRAAAAAMA9Oey1/PTfHQAAAIDrGqi1DwIKMqgNAAAAAElFTkSuQmCC",bc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMElEQVRoge3LsQ0AAAjDMPj/aHiAgREke4zaCAAAAADgnhxaLba16L43vwAAAAB80GuiEAKxygkwAAAAAElFTkSuQmCC",yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAAUCAYAAABLTIm0AAAABmJLR0QA/wD/AP+gvaeTAAAAMUlEQVRoge3LwQkAMAgDQN1/aLtAEZ8Kd7+EJAIAAAAA2Cc/XTW7GmbfvV8AAAAALnj0XRgCL0bySQAAAABJRU5ErkJggg==",wc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAAwSURBVAjXY2AAAcb8DiCZy56/Iv8/Q6FQ/uH8/0BG/jYQBRbJOwRmwNWAQANTfj8ArFYW+qKsr5kAAAAASUVORK5CYII=",Ac="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAHCAQAAACFbCRbAAAAAmJLR0QA/4ePzL8AAAApSURBVAjXY8if2MDEAAL5//PXp3FBGP/zT5SIQRj/87ehiEDV9EN0AQD+gxekoNbgEwAAAABJRU5ErkJggg==",xc=["title"],Cc=["title"],vc={class:"options"},Sc=["title"],Bc={class:"options"},Nc={class:"options"},Vc=["title"],Rc=["title"],Ec=["title"],Oc=["title"],Mc=["title"],Tc={class:"options"},Ic={class:"options"},Fc={class:"options"},Dc={class:"options"},_c={class:"options"},Pc={class:"menu-item__search__collapse__search"},$c={class:"arrow-left"},Lc={class:"arrow-right"},Uc=ee(i.defineComponent({__name:"toolbar",props:{items:{type:Array,default(){return["simple"]}},editor:{type:Object}},setup(a,{expose:e}){const t=a,n=i.ref(),l=i.computed(()=>{let E=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Watermark","Codeblock","PageBreak","Control","Checkbox","Radio","Latex","Date","Block","Divider","Search","SearchCollapse","Print"];return t.items&&(t.items.length>1?E=t.items:t.items[0]=="simple"&&(E=["Undo","Redo","Painter","Format","Divider","Font","Size","SizeAdd","SizeMinus","Bold","Italic","Underline","Strikeout","Superscript","Subscript","Color","Highlight","Divider","Title","RowFlexLeft","RowFlexCenter","RowFlexRight","RowFlexAlignment","RowFlexJustify","RowMargin","List","Divider","Table","Image","Hyperlink","Separator","Codeblock","Divider","Search","SearchCollapse","Print"])),E});function o(){return n.value?.clientHeight}function s(){return n.value?.clientWidth}const r=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent);function c(E,g){console.log("exec cmd "+E+",params:",g),E!="Separator"&&Array.isArray(g)?t.editor?.command["execute"+E](g[0],g[1]):t.editor?.command["execute"+E](g)}function h(E,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+E+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px"}let f=!0,d;function p(){f?(f=!1,d=window.setTimeout(()=>{f=!0,t.editor?.command.executePainter({isDblclick:!1})},200)):window.clearTimeout(d)}function m(){f=!0,window.clearTimeout(d),t.editor?.command.executePainter({isDblclick:!0})}function b(){new De({title:"LaTeX",data:[{type:"textarea",height:100,name:"value",placeholder:"请输入LaTeX文本"}],onConfirm:E=>{const g=E.find(S=>S.name==="value")?.value;g&&t.editor?.command.executeInsertElementList([{type:ae.ElementType.LATEX,value:g}])}})}function y(E){t.editor?.command.executeInsertElementList([{type:E,checkbox:{value:!1},value:""}])}function A(E,g){const S=g.target.getBoundingClientRect(),I=n.value.querySelector("."+E+" .options");I.classList.toggle("visible"),I.style.top=S.height+S.top+"px";const V=ua();I.firstChild.childNodes.forEach(F=>{const $=F.attributes.getNamedItem("label-format").value;F.innerText=V.format($),F.onclick=()=>{t.editor?.command.executeInsertElementList([{type:ae.ElementType.DATE,dateFormat:F.attributes.getNamedItem("data-format").value,valueList:[{value:F.innerText.trim()}]}])}})}function x(){new De({title:"内容块",data:[{type:"select",label:"类型",name:"type",value:"iframe",required:!0,options:[{label:"网址",value:"iframe"},{label:"视频",value:"video"}]},{type:"number",label:"宽度",name:"width",placeholder:"请输入宽度(默认页面内宽度)"},{type:"number",label:"高度",name:"height",required:!0,placeholder:"请输入高度"},{type:"input",label:"地址",name:"src",required:!1,placeholder:"请输入地址"},{type:"textarea",label:"HTML",height:100,name:"srcdoc",required:!1,placeholder:"请输入HTML代码(仅网址类型有效)"}],onConfirm:E=>{const g=E.find(Q=>Q.name==="type")?.value;if(!g)return;const S=E.find(Q=>Q.name==="width")?.value,I=E.find(Q=>Q.name==="height")?.value;if(!I)return;const V=E.find(Q=>Q.name==="src")?.value,F=E.find(Q=>Q.name==="srcdoc")?.value,$={type:g};if($.type===ae.BlockType.IFRAME){if(!V&&!F)return;$.iframeBlock={src:V,srcdoc:F}}else if($.type===ae.BlockType.VIDEO){if(!V)return;$.videoBlock={src:V}}const D={type:ae.ElementType.BLOCK,value:"",height:Number(I),block:$};S&&(D.width=Number(S)),t.editor?.command.executeInsertElementList([D])}})}function w(E){const g=E.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__table__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-270/2+"px";const I=n.value.querySelector(".menu-item__table__collapse .table-close"),V=n.value.querySelector(".menu-item__table__collapse .table-select"),F=n.value.querySelector(".menu-item__table__collapse .table-panel"),$=[];n.value.querySelector(".menu-item__table__collapse .table-panel table").firstChild.childNodes.forEach(L=>{$.push(L.childNodes)});let D=0,Q=0;F.onmousemove=L=>{const{offsetX:_,offsetY:q}=L;$.forEach(U=>{U.forEach(P=>{P.classList.remove("active")})}),D=Math.ceil(_/22)||1,Q=Math.ceil(q/26)||1,$.forEach((U,P)=>{U.forEach((re,H)=>{H<D&&P<Q&&re.classList.add("active")})}),V.innerText=`${Q}×${D}`},F.onclick=()=>{S.style.display="none",t.editor?.command.executeInsertTable(Q,D)},I.onclick=L=>{L.stopPropagation(),S.style.display="none"}}function R(){const E=n.value.querySelector(".menu-item__image .image");E.click(),E.onchange=function(){const g=E.files[0],S=new FileReader;S.readAsDataURL(g),S.onload=function(){const I=new Image,V=S.result;I.src=V,I.onload=function(){t.editor?.command.executeImage({value:V,width:I.width,height:I.height}),E.value=""}}}}function k(){new De({title:"超链接",data:[{type:"text",label:"文本",name:"name",required:!0,placeholder:"请输入文本",value:t.editor?.command.getRangeText()},{type:"text",label:"链接",name:"url",required:!0,placeholder:"请输入链接"}],onConfirm:E=>{const g=E.find(I=>I.name==="name")?.value;if(!g)return;const S=E.find(I=>I.name==="url")?.value;S&&t.editor?.command.executeHyperlink({type:ae.ElementType.HYPERLINK,value:"",url:S,valueList:ae.splitText(g).map(I=>({value:I,size:16}))})}})}function u(E){E==="add"?new De({title:"水印",data:[{type:"text",label:"内容",name:"data",required:!0,placeholder:"请输入内容"},{type:"color",label:"颜色",name:"color",required:!0,value:"#AEB5C0"},{type:"number",label:"字体大小",name:"size",required:!0,value:"120"},{type:"number",label:"透明度",name:"opacity",required:!0,value:"0.3"},{type:"select",label:"重复",name:"repeat",value:"0",required:!1,options:[{label:"不重复",value:"0"},{label:"重复",value:"1"}]},{type:"number",label:"水平间隔",name:"horizontalGap",required:!1,value:"10"},{type:"number",label:"垂直间隔",name:"verticalGap",required:!1,value:"10"}],onConfirm:g=>{if(~g.findIndex(F=>!F.value))return;const I=g.reduce((F,$)=>(F[$.name]=$.value,F),{}),V=I.repeat==="1";t.editor?.command.executeAddWatermark({data:I.data,color:I.color,size:Number(I.size),opacity:Number(I.opacity),repeat:V,gap:V&&I.horizontalGap&&I.verticalGap?[Number(I.horizontalGap),Number(I.verticalGap)]:void 0})}}):t.editor?.command.executeDeleteWatermark()}function N(){new De({title:"代码块",data:[{type:"textarea",name:"codeblock",placeholder:"请输入代码",width:500,height:300}],onConfirm:E=>{const g=E.find(F=>F.name==="codeblock")?.value;if(!g)return;const S=xl.tokenize(g,xl.languages.javascript),I=Or(S),V=[];for(let F=0;F<I.length;F++){const $=I[F],D=ae.splitText($.content);for(let Q=0;Q<D.length;Q++){const O={value:D[Q]};$.color&&(O.color=$.color),$.bold&&(O.bold=!0),$.italic&&(O.italic=!0),V.push(O)}}V.unshift({value:`
2
+ `}),t.editor?.command.executeInsertElementList(V)}})}function M(E){const g=E.target.getBoundingClientRect(),S=n.value.querySelector(".menu-item__search__collapse");S.style.display="block",S.style.top=g.height+g.top+"px",S.style.left=g.left-260/2+"px";const I=n.value.querySelector(".menu-item__search__collapse__search input"),V=n.value.querySelector(".menu-item__search__collapse__replace input"),F=S.querySelector(".search-result");I.focus();const $=()=>{const D=t.editor?.command.getSearchNavigateInfo();if(D){const{index:Q,count:L}=D;F.innerText=`${Q}/${L}`}else F.innerText=""};S.querySelector("span").onclick=()=>{S.style.display="none",I.value="",V.value="",t.editor?.command.executeSearch(null),$()},I.oninput=()=>{t.editor?.command.executeSearch(I.value||null),$()},I.onkeydown=D=>{D.key==="Enter"&&(t.editor?.command.executeSearch(I.value||null),$())},S.querySelector("button").onclick=()=>{const D=I.value,Q=V.value;D&&Q&&D!==Q&&t.editor?.command.executeReplace(Q)},S.querySelector(".arrow-left").onclick=()=>{t.editor?.command.executeSearchNavigatePre(),$()},S.querySelector(".arrow-right").onclick=()=>{t.editor?.command.executeSearchNavigateNext(),$()}}function v(){const E=n.value.querySelector(".menu-item__color .input-color");E.oninput=function(){t.editor?.command.executeColor(E.value)},E.click()}function C(){const E=n.value.querySelector(".menu-item__highlight .input-highlight");E.oninput=function(){t.editor?.command.executeHighlight(E.value)},E.click()}function B(E){switch(E){case ae.ControlType.TEXT:new De({title:"文本控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(V=>V.name==="placeholder")?.value;if(!S)return;const I=g.find(V=>V.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,value:I?[{value:I}]:null,placeholder:S}})}});break;case ae.ControlType.SELECT:new De({title:"列举控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
3
3
  [{
4
4
  "value":"有",
5
5
  "code":"98175"
6
- }]`}],onConfirm:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const T=g.find(F=>F.name==="valueSets")?.value;if(!T)return;const O=g.find(F=>F.name==="code")?.value;t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,code:O,value:null,placeholder:S,valueSets:JSON.parse(T)}})}});break;case re.ControlType.CHECKBOX:new De({title:"复选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值,多个值以英文逗号分割"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
6
+ }]`}],onConfirm:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="valueSets")?.value;if(!I)return;const V=g.find(F=>F.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:V,value:null,placeholder:S,valueSets:JSON.parse(I)}})}});break;case ae.ControlType.CHECKBOX:new De({title:"复选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值,多个值以英文逗号分割"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
7
7
  [{
8
8
  "value":"有",
9
9
  "code":"98175"
10
- }]`}],onConfirm:g=>{const S=g.find(O=>O.name==="valueSets")?.value;if(!S)return;const T=g.find(O=>O.name==="code")?.value;t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,code:T,value:null,valueSets:JSON.parse(S)}})}});break;case re.ControlType.RADIO:new De({title:"单选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
10
+ }]`}],onConfirm:g=>{const S=g.find(V=>V.name==="valueSets")?.value;if(!S)return;const I=g.find(V=>V.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ae.ControlType.RADIO:new De({title:"单选框控件",data:[{type:"text",label:"默认值",name:"code",placeholder:"请输入默认值"},{type:"textarea",label:"值集",name:"valueSets",required:!0,height:100,placeholder:`请输入值集JSON,例:
11
11
  [{
12
12
  "value":"有",
13
13
  "code":"98175"
14
- }]`}],onConfirm:g=>{const S=g.find(O=>O.name==="valueSets")?.value;if(!S)return;const T=g.find(O=>O.name==="code")?.value;t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,code:T,value:null,valueSets:JSON.parse(S)}})}});break;case re.ControlType.DATE:new De({title:"日期控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"},{type:"select",label:"日期格式",name:"dateFormat",value:"yyyy-MM-dd hh:mm:ss",required:!0,options:[{label:"yyyy-MM-dd hh:mm:ss",value:"yyyy-MM-dd hh:mm:ss"},{label:"yyyy-MM-dd",value:"yyyy-MM-dd"}]}],onConfirm:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const T=g.find(F=>F.name==="value")?.value||"",O=g.find(F=>F.name==="dateFormat")?.value||"";t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,dateFormat:O,value:T?[{value:T}]:null,placeholder:S}})}});break;case re.ControlType.NUMBER:new De({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(O=>O.name==="placeholder")?.value;if(!S)return;const T=g.find(O=>O.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:re.ElementType.CONTROL,value:"",control:{type:R,value:T?[{value:T}]:null,placeholder:S}})}});break}}return i.onMounted(()=>{window.addEventListener("click",R=>{const g=n.value?.querySelector(".visible");!g||g.contains(R.target)||g.classList.remove("visible")},{capture:!0}),t.editor&&(t.editor.listener.rangeStyleChange=R=>{i.nextTick(()=>{if(R.type===re.ElementType.TEXT){const g=n.value,S=g.querySelector(".menu-item__font .select");S&&(S.textContent=R.font);const T=g.querySelector(".menu-item__size .select");if(T){const I={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};T.textContent=I[R.size]||"小四"}const O=g.querySelector(".menu-item__bold");O&&O.classList.toggle("active",R.bold);const F=g.querySelector(".menu-item__italic");F&&F.classList.toggle("active",R.italic);const $=g.querySelector(".menu-item__underline");$&&$.classList.toggle("active",R.underline);const D=g.querySelector(".menu-item__strikeout");D&&D.classList.toggle("active",R.strikeout);const Q=g.querySelector(".menu-item__color span");Q&&(Q.style.backgroundColor=R.color||"#000000");const U=g.querySelector(".menu-item__highlight span");U&&(U.style.backgroundColor=R.highlight);const E=g.querySelector(".menu-item__title .select");if(E){const I={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};E.textContent=I[R.level]||"正文"}["left","center","right","alignment","justify"].forEach(I=>{const _=g.querySelector(`.menu-item__${I}`);_&&_.classList.toggle("active",R.rowFlex===I)})}})})}),e({getHeight:o,getWidth:s}),(R,g)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"dom",ref:n,class:"unione-rich-toolbar menu","editor-component":"menu"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(S,T)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[S=="Undo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__undo",key:S,title:`撤销(${i.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:g[0]||(g[0]=O=>c("Undo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Mr)})`})},null,4)],8,xc)):i.createCommentVNode("",!0),S=="Redo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__redo",key:S,title:`重做(${i.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:g[1]||(g[1]=O=>c("Redo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Tr)})`})},null,4)],8,Cc)):i.createCommentVNode("",!0),S=="Painter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__painter",key:S,title:"格式刷(双击可连续使用)",onClick:p,onDblclick:m},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ir)})`})},null,4)],32)):i.createCommentVNode("",!0),S=="Format"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__format",key:S,title:"清除格式",onClick:g[2]||(g[2]=O=>c("Format")),"data-item":"Format"},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Fr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Divider"?(i.openBlock(),i.createElementBlock("div",{class:"menu-divider",key:S+T,"data-item":"Divider"})):i.createCommentVNode("",!0),S=="Font"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__font",onClick:g[19]||(g[19]=O=>h("menu-item__font",O)),style:{display:"none"},key:S},[g[99]||(g[99]=i.createElementVNode("span",{class:"select",title:"字体"},"微软雅黑",-1)),i.createElementVNode("div",{class:"options",ref_for:!0,ref:"fontOptions"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[3]||(g[3]=O=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),i.createElementVNode("li",{onClick:g[4]||(g[4]=O=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),i.createElementVNode("li",{onClick:g[5]||(g[5]=O=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),i.createElementVNode("li",{onClick:g[6]||(g[6]=O=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),i.createElementVNode("li",{onClick:g[7]||(g[7]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[8]||(g[8]=O=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),i.createElementVNode("li",{onClick:g[9]||(g[9]=O=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[10]||(g[10]=O=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),i.createElementVNode("li",{onClick:g[11]||(g[11]=O=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),i.createElementVNode("li",{onClick:g[12]||(g[12]=O=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),i.createElementVNode("li",{onClick:g[13]||(g[13]=O=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),i.createElementVNode("li",{onClick:g[14]||(g[14]=O=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),i.createElementVNode("li",{onClick:g[15]||(g[15]=O=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),i.createElementVNode("li",{onClick:g[16]||(g[16]=O=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),i.createElementVNode("li",{onClick:g[17]||(g[17]=O=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),i.createElementVNode("li",{onClick:g[18]||(g[18]=O=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):i.createCommentVNode("",!0),S=="Size"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size",onClick:g[36]||(g[36]=O=>h("menu-item__size",O)),key:S},[g[100]||(g[100]=i.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),i.createElementVNode("div",vc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[20]||(g[20]=O=>c("Size",56))},"初号"),i.createElementVNode("li",{onClick:g[21]||(g[21]=O=>c("Size",48))},"小初"),i.createElementVNode("li",{onClick:g[22]||(g[22]=O=>c("Size",34))},"一号"),i.createElementVNode("li",{onClick:g[23]||(g[23]=O=>c("Size",32))},"小一"),i.createElementVNode("li",{onClick:g[24]||(g[24]=O=>c("Size",29))},"二号"),i.createElementVNode("li",{onClick:g[25]||(g[25]=O=>c("Size",24))},"小二"),i.createElementVNode("li",{onClick:g[26]||(g[26]=O=>c("Size",21))},"三号"),i.createElementVNode("li",{onClick:g[27]||(g[27]=O=>c("Size",20))},"小三"),i.createElementVNode("li",{onClick:g[28]||(g[28]=O=>c("Size",18))},"四号"),i.createElementVNode("li",{onClick:g[29]||(g[29]=O=>c("Size",16))},"小四"),i.createElementVNode("li",{onClick:g[30]||(g[30]=O=>c("Size",14))},"五号"),i.createElementVNode("li",{onClick:g[31]||(g[31]=O=>c("Size",12))},"小五"),i.createElementVNode("li",{onClick:g[32]||(g[32]=O=>c("Size",10))},"六号"),i.createElementVNode("li",{onClick:g[33]||(g[33]=O=>c("Size",8))},"小六"),i.createElementVNode("li",{onClick:g[34]||(g[34]=O=>c("Size",7))},"七号"),i.createElementVNode("li",{onClick:g[35]||(g[35]=O=>c("Size",6))},"八号")])])])):i.createCommentVNode("",!0),S=="SizeAdd"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:g[37]||(g[37]=O=>c("SizeAdd")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Dr)})`})},null,4)])):i.createCommentVNode("",!0),S=="SizeMinus"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:g[38]||(g[38]=O=>c("SizeMinus")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(_r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Bold"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:g[39]||(g[39]=O=>c("Bold")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Pr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Italic"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:g[40]||(g[40]=O=>c("Italic")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref($r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Underline"?(i.openBlock(),i.createElementBlock("div",{title:`下划线(${i.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:g[46]||(g[46]=O=>h("menu-item__underline",O)),"data-item":"Underline",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Lr)})`})},null,4),g[101]||(g[101]=i.createElementVNode("span",{class:"select"},null,-1)),i.createElementVNode("div",Bc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-decoration-style":"solid",onClick:g[41]||(g[41]=O=>c("Underline",{style:"solid"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"double",onClick:g[42]||(g[42]=O=>c("Underline",{style:"double"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(mc)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dashed",onClick:g[43]||(g[43]=O=>c("Underline",{style:"dashed"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dotted",onClick:g[44]||(g[44]=O=>c("Underline",{style:"dotted"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"wavy",onClick:g[45]||(g[45]=O=>c("Underline",{style:"wavy"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(gc)})`})},null,4)])])])],8,Sc)):i.createCommentVNode("",!0),S=="Strikeout"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:g[47]||(g[47]=O=>c("Strikeout")),"data-item":"Strikeout",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ur)})`})},null,4)])):i.createCommentVNode("",!0),S=="Superscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:g[48]||(g[48]=O=>c("Superscript")),"data-item":"Superscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(zr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Subscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:g[49]||(g[49]=O=>c("Subscript")),"data-item":"Subscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(jr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Color"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:v,"data-item":"Color",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(qr)})`})},null,4),g[102]||(g[102]=i.createElementVNode("span",null,null,-1)),g[103]||(g[103]=i.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):i.createCommentVNode("",!0),S=="Highlight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:C,"data-item":"Highlight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Qr)})`})},null,4),g[104]||(g[104]=i.createElementVNode("span",null,null,-1)),g[105]||(g[105]=i.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):i.createCommentVNode("",!0),S=="Title"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__title",onClick:g[57]||(g[57]=O=>h("menu-item__title",O)),"data-item":"Title",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Wr)})`})},null,4),g[106]||(g[106]=i.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),i.createElementVNode("div",Nc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{style:{"font-size":"16px"},onClick:g[50]||(g[50]=O=>c("Title",null))},"正文"),i.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:g[51]||(g[51]=O=>c("Title","first"))},"标题1"),i.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:g[52]||(g[52]=O=>c("Title","second"))},"标题2"),i.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:g[53]||(g[53]=O=>c("Title","third"))},"标题3"),i.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:g[54]||(g[54]=O=>c("Title","fourth"))},"标题4"),i.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:g[55]||(g[55]=O=>c("Title","fifth"))},"标题5"),i.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:g[56]||(g[56]=O=>c("Title","sixth"))},"标题6")])])])):i.createCommentVNode("",!0),S=="RowFlexLeft"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__left",onClick:g[58]||(g[58]=O=>c("RowFlex","left")),title:`左对齐(${i.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Yr)})`})},null,4)],8,Vc)):i.createCommentVNode("",!0),S=="RowFlexCenter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__center",onClick:g[59]||(g[59]=O=>c("RowFlex","center")),title:`居中对齐(${i.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Hr)})`})},null,4)],8,Rc)):i.createCommentVNode("",!0),S=="RowFlexRight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__right",onClick:g[60]||(g[60]=O=>c("RowFlex","right")),title:`右对齐(${i.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Kr)})`})},null,4)],8,Ec)):i.createCommentVNode("",!0),S=="RowFlexAlignment"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:g[61]||(g[61]=O=>c("RowFlex","alignment")),title:`两端对齐(${i.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Gr)})`})},null,4)],8,Oc)):i.createCommentVNode("",!0),S=="RowFlexJustify"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:g[62]||(g[62]=O=>c("RowFlex","justify")),title:`分散对齐(${i.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Jr)})`})},null,4)],8,Mc)):i.createCommentVNode("",!0),S=="RowMargin"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:g[71]||(g[71]=O=>h("menu-item__row-margin",O)),"data-item":"RowMargin",key:S},[i.createElementVNode("i",{title:"行间距",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Xr)})`})},null,4),i.createElementVNode("div",Tc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-rowmargin":"1",onClick:g[63]||(g[63]=O=>c("RowMargin",1))},"1"),i.createElementVNode("li",{"data-rowmargin":"1.25",onClick:g[64]||(g[64]=O=>c("RowMargin",1.25))},"1.25"),i.createElementVNode("li",{"data-rowmargin":"1.5",onClick:g[65]||(g[65]=O=>c("RowMargin",1.5))},"1.5"),i.createElementVNode("li",{"data-rowmargin":"1.75",onClick:g[66]||(g[66]=O=>c("RowMargin",1.75))},"1.75"),i.createElementVNode("li",{"data-rowmargin":"2",onClick:g[67]||(g[67]=O=>c("RowMargin",2))},"2"),i.createElementVNode("li",{"data-rowmargin":"2.5",onClick:g[68]||(g[68]=O=>c("RowMargin",2.5))},"2.5"),i.createElementVNode("li",{"data-rowmargin":"3",onClick:g[69]||(g[69]=O=>c("RowMargin",3))},"3"),i.createElementVNode("li",{"data-rowmargin":"5",onClick:g[70]||(g[70]=O=>c("RowMargin",5))},"5")])])])):i.createCommentVNode("",!0),S=="List"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__list",onClick:g[77]||(g[77]=O=>h("menu-item__list",O)),key:S},[i.createElementVNode("i",{title:"列表",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Zr)})`})},null,4),i.createElementVNode("div",Ic,[i.createElementVNode("ul",null,[g[112]||(g[112]=i.createElementVNode("li",null,[i.createElementVNode("label",null,"取消列表")],-1)),i.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:g[72]||(g[72]=O=>c("List",["ol","decimal"]))},g[107]||(g[107]=[i.createElementVNode("label",null,"有序列表:",-1),i.createElementVNode("ol",null,[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"checkbox",onClick:g[73]||(g[73]=O=>c("List",["ul","checkbox"]))},g[108]||(g[108]=[i.createElementVNode("label",null,"复选框列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☑️ '"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"disc",onClick:g[74]||(g[74]=O=>c("List",["ul","disc"]))},g[109]||(g[109]=[i.createElementVNode("label",null,"实心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"disc"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"circle",onClick:g[75]||(g[75]=O=>c("List",["ul","circle"]))},g[110]||(g[110]=[i.createElementVNode("label",null,"空心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"circle"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"square",onClick:g[76]||(g[76]=O=>c("List",["ul","square"]))},g[111]||(g[111]=[i.createElementVNode("label",null,"空心方块列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[i.createElementVNode("li",null,"________")],-1)]))])])])):i.createCommentVNode("",!0),S=="Table"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__table",onClick:w,key:S},[i.createElementVNode("i",{title:"表格",style:i.normalizeStyle({backgroundImage:`url(${i.unref(tc)})`})},null,4),g[113]||(g[113]=i.createStaticVNode('<div class="menu-item__table__collapse" data-v-b97ae666><div class="table-close" data-v-b97ae666>×</div><div class="table-title" data-v-b97ae666><span class="table-select" data-v-b97ae666>插入</span><span data-v-b97ae666>表格</span></div><div class="table-panel" data-v-b97ae666><table data-v-b97ae666><tbody data-v-b97ae666><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr></tbody></table></div></div>',1))])):i.createCommentVNode("",!0),S=="Image"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__image",onClick:V,key:S},[i.createElementVNode("i",{title:"图片",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ec)})`})},null,4),g[114]||(g[114]=i.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):i.createCommentVNode("",!0),S=="Hyperlink"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:S},[i.createElementVNode("i",{title:"超链接",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ic)})`})},null,4)])):i.createCommentVNode("",!0),S=="Separator"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:g[84]||(g[84]=O=>h("menu-item__separator",O)),key:S},[i.createElementVNode("i",{title:"分割线",style:i.normalizeStyle({backgroundImage:`url(${i.unref(nc)})`})},null,4),i.createElementVNode("div",Fc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-separator":"0,0",onClick:g[78]||(g[78]=O=>c("Separator",[0,0]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"1,1",onClick:g[79]||(g[79]=O=>c("Separator",[1,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"3,1",onClick:g[80]||(g[80]=O=>c("Separator",[3,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"4,4",onClick:g[81]||(g[81]=O=>c("Separator",[4,4]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(kc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:g[82]||(g[82]=O=>c("Separator",[7,3,3,3]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(bc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:g[83]||(g[83]=O=>c("Separator",[6,2,2,2,2,2]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(yc)})`})},null,4)])])])])):i.createCommentVNode("",!0),S=="Watermark"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:g[87]||(g[87]=O=>h("menu-item__watermark",O)),key:S},[i.createElementVNode("i",{title:"水印(添加、删除)",style:i.normalizeStyle({backgroundImage:`url(${i.unref(lc)})`})},null,4),i.createElementVNode("div",Dc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-menu":"add",onClick:g[85]||(g[85]=O=>u("add"))},"添加水印"),i.createElementVNode("li",{"data-menu":"delete",onClick:g[86]||(g[86]=O=>u("delete"))},"删除水印")])])])):i.createCommentVNode("",!0),S=="Codeblock"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:N,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(oc)})`})},null,4)])):i.createCommentVNode("",!0),S=="PageBreak"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(sc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Control"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__control",onClick:g[94]||(g[94]=O=>h("menu-item__control",O)),key:S},[i.createElementVNode("i",{title:"控件",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ac)})`})},null,4),i.createElementVNode("div",_c,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-control":"text",onClick:g[88]||(g[88]=O=>B("text"))},"文本"),i.createElementVNode("li",{"data-control":"number",onClick:g[89]||(g[89]=O=>B("number"))},"数值"),i.createElementVNode("li",{"data-control":"select",onClick:g[90]||(g[90]=O=>B("select"))},"列举"),i.createElementVNode("li",{"data-control":"date",onClick:g[91]||(g[91]=O=>B("date"))},"日期"),i.createElementVNode("li",{"data-control":"checkbox",onClick:g[92]||(g[92]=O=>B("checkbox"))},"复选框"),i.createElementVNode("li",{"data-control":"radio",onClick:g[93]||(g[93]=O=>B("radio"))},"单选框")])])])):i.createCommentVNode("",!0),S=="Checkbox"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:g[95]||(g[95]=O=>y("checkbox")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(rc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Radio"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:g[96]||(g[96]=O=>y("radio")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(cc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Latex"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:b,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(dc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Date"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__date",onClick:g[97]||(g[97]=O=>A("menu-item__date",O)),key:S},[i.createElementVNode("i",{title:"日期",style:i.normalizeStyle({backgroundImage:`url(${i.unref(hc)})`})},null,4),g[115]||(g[115]=i.createElementVNode("div",{class:"options"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),i.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):i.createCommentVNode("",!0),S=="Block"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:x,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(fc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Search"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:M,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(uc)})`})},null,4)])):i.createCommentVNode("",!0),S=="SearchCollapse"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:S},[i.createElementVNode("div",Pc,[g[116]||(g[116]=i.createElementVNode("input",{type:"text"},null,-1)),g[117]||(g[117]=i.createElementVNode("label",{class:"search-result"},null,-1)),i.createElementVNode("div",$c,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(wc)})`})},null,4)]),i.createElementVNode("div",Lc,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ac)})`})},null,4)]),g[118]||(g[118]=i.createElementVNode("span",null,"×",-1))]),g[119]||(g[119]=i.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[i.createElementVNode("input",{type:"text"}),i.createElementVNode("button",null,"替换")],-1))])):i.createCommentVNode("",!0),S=="Print"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:g[98]||(g[98]=O=>c("Print")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(pc)})`})},null,4)])):i.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-b97ae666"]]),zc=te(i.defineComponent({__name:"richText",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},model:{type:String,default:"edit"},options:{type:Object,default:()=>({})},toolbar:{type:Array,default:()=>["simple"]}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a,{expose:e}){const t=a,n=i.useModel(a,"value"),l=i.ref(!1),o=i.computed(()=>t.editor?.widget(t.wid)||t.widget||{}),s=i.computed(()=>t.editor?.model.value||t.model);i.computed(()=>o.value.props||{});const r=i.ref(),c=i.ref(),h=i.ref(),f=i.ref();i.onMounted(()=>{i.nextTick(()=>{d()})});function d(){const p=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;console.log("width:"+p+",height:"+m);const b=JSON.parse(JSON.stringify(t.options));f.value=new re.Editor(h.value,[],{mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:p,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...b}),f.value.listener.contentChange=()=>{f.value.command.getValueAsync().then(({data:y})=>{n.value=y})},n.value&&Object.keys(n.value).length&&(f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))),l.value=!0)}return i.watch(n,()=>{n.value&&Object.keys(n.value).length&&l.value==!1&&f.value&&(f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))),l.value=!0)}),i.watch(s,()=>{f.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(p,m)=>(i.openBlock(),i.createBlock(lt,{class:"unione-rich-text",model:t.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r},{default:i.withCtx(()=>[(s.value=="edit"||s.value=="run")&&f.value?(i.openBlock(),i.createBlock(Uc,{key:0,ref_key:"canvasMenuDom",ref:c,editor:f.value,items:a.toolbar},null,8,["editor","items"])):i.createCommentVNode("",!0),i.createElementVNode("div",{ref_key:"canvasEditorDom",ref:h,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-2dcd520e"]]),jc={class:"page-setting-dialog"},qt=i.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=a,n=i.computed(()=>t.editor?.model?.value),l=Y.useSession(),o=i.computed(()=>l.getPrincipal()),s=i.ref(!1);i.provide("closeSetting",()=>{t.editor?.save().then(p=>{s.value=!1})});function r(){s.value=!0}function c(){t.editor?.save().then(p=>{console.log("res",p)})}function h(){t.editor?.save().then(p=>{console.log("res",p)})}const f=i.ref("");function d(p){f.value||(f.value=n.value),p?t.editor?.setModel("edit"):t.editor?.setModel(f.value)}return(p,m)=>{const b=i.resolveComponent("SettingOutlined"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("SaveOutlined"),x=i.resolveComponent("FormOutlined"),w=i.resolveComponent("StopOutlined"),V=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-page",n.value])},[n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle},{default:i.withCtx(()=>[i.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:1,title:"保存页面"},{default:i.withCtx(()=>[i.createVNode(A,{class:"btn-save",onClick:c})]),_:1})):i.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:2,title:"编辑页面"},{default:i.withCtx(()=>[i.createVNode(x,{class:"btn-edit",onClick:m[0]||(m[0]=k=>d(!0))})]),_:1})):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:3,title:"退出编辑"},{default:i.withCtx(()=>[i.createVNode(w,{class:"btn-edit",onClick:m[1]||(m[1]=k=>d(!1))})]),_:1})):i.createCommentVNode("",!0),i.renderSlot(p.$slots,"default"),n.value=="edit"?(i.openBlock(),i.createBlock(V,{key:4,title:t.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:h},{default:i.withCtx(()=>[i.createElementVNode("div",jc,[i.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),qc={class:"unione-props-setting data-field-manage"},Qc={key:0},Wc={key:1},Yc={key:2},Hc={key:3},Kc={key:4},Gc={key:5},Jc={key:6},Xc=["onClick"],Zc=["onClick"],ed=["onClick"],td={key:1},id=te(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(m=>{n.value.selectedRowKeys.includes(m)||n.value.selectedRowKeys.push(m);const b=[];t.value.forEach(y=>{!p.includes(y.name)&&n.value.selectedRowKeys.includes(y.name)&&b.push(y.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(y=>!b.includes(y)))})}}),l={mounted:p=>p.focus()},o=i.ref({});function s(){const p=Object.keys(o.value);if(p.length)for(let m in p){const b=t.value.filter(y=>y.name==m);if(b&&b[0]){let y=o.value[m];Object.keys(y).forEach(A=>{b[0][A]=y[A]})}}o.value={}}function r(p,m){s();const b={};b[m]=p[m]||"",o.value[p.name]=b}function c(p,m){if(!p||!m){o.value={};return}const b=o.value[p.name][m];if(m=="name"&&t.value.filter(A=>A[m]==b&&A.name!=p.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}p[m]=b,o.value={}}function h(p,m){t.value.filter(y=>y.name==p.name).forEach(y=>{y[m]=!y[m]})}function f(){if(s(),t.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),o.value[m.name]={name:"new_"}}function d(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(p=>!n.value.selectedRowKeys.includes(p.name)),n.value.selectedRowKeys=[]}})}return(p,m)=>{const b=i.resolveComponent("a-button"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("a-input"),x=i.resolveComponent("a-input-number"),w=i.resolveComponent("a-select-option"),V=i.resolveComponent("a-select"),k=i.resolveComponent("a-checkbox"),u=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",qc,[i.createVNode(b,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:i.withCtx(()=>m[1]||(m[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:d,size:"small"},{default:i.withCtx(()=>m[2]||(m[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(u,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:i.withCtx(({column:N})=>[N.key==="name"?(i.openBlock(),i.createElementBlock("span",Qc,[m[3]||(m[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="title"?(i.openBlock(),i.createElementBlock("span",Wc,[m[4]||(m[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="descs"?(i.openBlock(),i.createElementBlock("span",Yc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataLen"?(i.openBlock(),i.createElementBlock("span",Hc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataPrec"?(i.openBlock(),i.createElementBlock("span",Kc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="defaultValue"?(i.openBlock(),i.createElementBlock("span",Gc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataType"?(i.openBlock(),i.createElementBlock("span",Jc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="isPk"?(i.openBlock(),i.createBlock(y,{key:7,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[m[5]||(m[5]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isFk"?(i.openBlock(),i.createBlock(y,{key:8,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isNull"?(i.openBlock(),i.createBlock(y,{key:9,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="syncDbEnable"?(i.openBlock(),i.createBlock(y,{key:10,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:N,text:M,record:v})=>[["name","title","descs","defaultValue"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(A,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Xc)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Zc)):["dataType"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(V,{key:0,value:v[N.dataIndex],"onUpdate:value":C=>v[N.dataIndex]=C,onBlur:m[0]||(m[0]=C=>c())},{default:i.withCtx(()=>[i.createVNode(w,{key:"String",value:"String"}),i.createVNode(w,{key:"Long",value:"Long"}),i.createVNode(w,{key:"Short",value:"Short"}),i.createVNode(w,{key:"Integer",value:"Integer"}),i.createVNode(w,{key:"Float",value:"Float"}),i.createVNode(w,{key:"Double",value:"Double"}),i.createVNode(w,{key:"Date",value:"Date"}),i.createVNode(w,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",td,i.toDisplayString(M),1))],10,ed)):["syncDbEnable","isFk","isPk"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:3,checked:v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:4,checked:!v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),nd={class:"unione-props-setting data-field-setting"},ld={key:0},od=["onClick"],sd={class:"field-txt"},ad=["onClick"],rd={key:1,class:"field-txt"},cd=["onClick"],dd={key:1},hd=["onClick"],fd={key:0,class:"field-txt"},ud={key:4,class:"edit-field"},pd={key:0},md=["onClick"],gd=te(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:x})=>x+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),t=i.useModel(a,"modelValue"),n={mounted:x=>x.focus()},l=i.ref({});function o(){const x=Object.keys(l.value);if(x.length)for(let w in x){const V=t.value.filter(k=>k.name==w);if(V&&V[0]){let k=l.value[w];Object.keys(k).forEach(u=>{u=="convertName"?(V[0].convert||(V[0].convert={}),V[0].convert.type=k[u]):V[0][u]=k[u]})}}l.value={}}function s(x,w){o();const V={};w=="convertName"?(x.convert||(x.convert={}),V[w]=x.convert?.type):V[w]=x[w]||"",l.value[x.name]=V}function r(x,w){{l.value={};return}}function c(x,w){t.value.filter(k=>k.name==x.name).forEach(k=>{k[w]=!k[w]})}const h=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function f(x,w){const V=t.value.filter(u=>u.name==x.name);V.forEach(u=>{w!="isSort"?u[w]=!0:u[w]=!u[w]});const k=V[0];if(!(!k||w=="isSort")){switch(h.value.prop=w,h.value.field=x,k.show||(k.show={}),w){case"isQuery":k.show.query||(k.show.query={}),h.value.show=k.show.query,h.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":k.show.form||(k.show.form={}),h.value.show=k.show.form,h.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":k.show.view||(k.show.view={}),h.value.show=k.show.view,h.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":k.show.list||(k.show.list={}),h.value.show=k.show.list,h.value.title=`列头设置/${x.title}(${x.name})`;break}h.value.visible=!0}}const d=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const w=d.value.options.filter(V=>V.value==x);return w[0]?w[0].label:x}}),p=i.ref({visible:!1,field:{},props:{},showInfo:x=>{let w="";return x.rules&&(w=x.rules.filter(V=>V.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const x=p.value.props,w={name:"range",trigger:x.trigger,whitespace:x.whitespace,message:x.rangeMessage};x.rangeMin!=null&&x.rangeMin!=null&&(w.min=x.rangeMin,w.enable=!0),x.rangeMax!=null&&x.rangeMax!=null&&(w.max=x.rangeMax,w.enable=!0);const V={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(V.pattern=x.regExpress,V.enable=!0),p.value.field.rules=[w,V],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function m(x){p.value.visible=!0,p.value.field=x;const w=x.rules||[],V={trigger:"change",whitespace:!0};w.forEach(k=>{k.name=="reg"&&(V.trigger=k.trigger,V.whitespace=k.whitespace,V.regExpress=k.pattern,V.regMessage=k.message),k.name=="range"&&(V.rangeMin=k.min,V.rangeMax=k.max,V.rangeMessage=k.message)}),p.value.props=V}const b=i.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:x=>{const w=b.value.widgets.filter(V=>V.value==x);return w[0]?w[0].label:x},toSetting:()=>{}}),y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(x,w)=>{y.value.convert.options.splice(x,1)},toSetting:()=>{y.value.visible=!1}});function A(x){y.value.visible=!0,y.value.field=x,y.value.convert=x.convert||{}}return(x,w)=>{const V=i.resolveComponent("ToolOutlined"),k=i.resolveComponent("a-button"),u=i.resolveComponent("a-select"),N=i.resolveComponent("a-checkbox"),M=i.resolveComponent("a-table"),v=i.resolveComponent("a-input-number"),C=i.resolveComponent("a-form-item"),B=i.resolveComponent("a-input"),R=i.resolveComponent("a-form"),g=i.resolveComponent("a-modal"),S=i.resolveComponent("a-col"),T=i.resolveComponent("a-row"),O=i.resolveComponent("a-select-option"),F=i.resolveComponent("a-divider"),$=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createElementBlock("div",nd,[i.createVNode(M,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:D})=>[["widget","queryType","rules","convertName"].includes(D.key)?(i.openBlock(),i.createElementBlock("span",ld,[i.createVNode(V),i.createTextVNode(" "+i.toDisplayString(D.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:D,text:Q,record:U})=>[["rules"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!p.value.showInfo(U)&&"empty"]),onClick:E=>m(U)},[i.createElementVNode("span",sd,i.toDisplayString(p.value.showInfo(U)),1),p.value.showInfo(U)?(i.openBlock(),i.createBlock(k,{key:0,type:"link"},{default:i.withCtx(()=>w[22]||(w[22]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,od)):["widget"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!l.value[U.name]||!Object.keys(l.value[U.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:E=>s(U,D.dataIndex)},[l.value[U.name]&&Object.keys(l.value[U.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:U[D.dataIndex],"onUpdate:value":E=>U[D.dataIndex]=E,allowClear:!0,options:b.value.widgets,onBlur:w[0]||(w[0]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",rd,i.toDisplayString(b.value.widgetName(Q)),1))],10,ad)):["queryType"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[U.isQuery?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!l.value[U.name]||!Object.keys(l.value[U.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:E=>s(U,D.dataIndex)},[l.value[U.name]&&Object.keys(l.value[U.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:U[D.dataIndex],"onUpdate:value":E=>U[D.dataIndex]=E,allowClear:!0,options:d.value.options,onBlur:w[1]||(w[1]=E=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",dd,i.toDisplayString(d.value.showLabel(Q)),1))],10,cd)):i.createCommentVNode("",!0)],64)):["convertName"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!l.value[U.name]||!Object.keys(l.value[U.name]).includes(D.dataIndex))&&!U.convert?.type&&"empty"]),onClick:E=>s(U,D.dataIndex)},[l.value[U.name]&&Object.keys(l.value[U.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:U.convert.type,"onUpdate:value":E=>U.convert.type=E,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:w[2]||(w[2]=E=>r())},null,8,["value","onUpdate:value"])),[[n]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[U.convert?.type?(i.openBlock(),i.createElementBlock("span",fd,i.toDisplayString(U.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),U.convert?.type?(i.openBlock(),i.createBlock(k,{key:1,type:"link",onClick:i.withModifiers(E=>A(U),["stop"])},{default:i.withCtx(()=>w[23]||(w[23]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,hd)):["isQuery","isForm","isView","isList","isSort"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",ud,[i.createVNode(N,{checked:U[D.dataIndex],onClick:E=>c(U,D.dataIndex)},null,8,["checked","onClick"]),i.createVNode(k,{type:"link",onClick:E=>f(U,D.dataIndex)},{default:i.withCtx(()=>w[24]||(w[24]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(g,{visible:h.value.visible,"onUpdate:visible":w[9]||(w[9]=D=>h.value.visible=D),title:h.value.title,onOk:h.value.toSetting},{default:i.withCtx(()=>[i.createVNode(R,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(C,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(v,{value:h.value.show.index,"onUpdate:value":w[3]||(w[3]=D=>h.value.show.index=D)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.width,"onUpdate:value":w[4]||(w[4]=D=>h.value.show.width=D)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.labelWidth,"onUpdate:value":w[5]||(w[5]=D=>h.value.show.labelWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.valueWidth,"onUpdate:value":w[6]||(w[6]=D=>h.value.show.valueWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.fixed,"onUpdate:value":w[7]||(w[7]=D=>h.value.show.fixed=D),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.align,"onUpdate:value":w[8]||(w[8]=D=>h.value.show.align=D),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:y.value.visible,"onUpdate:visible":w[11]||(w[11]=D=>y.value.visible=D),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",pd,[i.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>w[25]||(w[25]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(M,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:D,text:Q,record:U,index:E})=>[D.dataIndex==="label"?(i.openBlock(),i.createBlock(B,{key:0,value:U.label,"onUpdate:value":P=>U.label=P,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="value"?(i.openBlock(),i.createBlock(B,{key:1,value:U.value,"onUpdate:value":P=>U.value=P,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:P=>y.value.toDelOption(E,U)},"删除",8,md)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(R,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(T,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(S,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(C,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(B,{value:y.value.convert.dict,"onUpdate:value":w[10]||(w[10]=D=>y.value.convert.dict=D)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:b.value.visible,"onUpdate:visible":w[13]||(w[13]=D=>b.value.visible=D),title:"控件设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(R,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[b.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(C,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(u,{value:b.value.props.mode,"onUpdate:value":w[12]||(w[12]=D=>b.value.props.mode=D),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(O,{value:"multiple"},{default:i.withCtx(()=>w[26]||(w[26]=[i.createTextVNode("多选")])),_:1}),i.createVNode(O,{value:"tags"},{default:i.withCtx(()=>w[27]||(w[27]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(g,{visible:p.value.visible,"onUpdate:visible":w[21]||(w[21]=D=>p.value.visible=D),title:"规则设置",onOk:p.value.toSetting},{default:i.withCtx(()=>[i.createVNode(R,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[28]||(w[28]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(C,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode($,{value:p.value.props.trigger,"onUpdate:value":w[14]||(w[14]=D=>p.value.props.trigger=D),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(N,{value:p.value.props.whitespace,"onUpdate:value":w[15]||(w[15]=D=>p.value.props.whitespace=D),checked:p.value.props.whitespace},{default:i.withCtx(()=>w[29]||(w[29]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[30]||(w[30]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(C,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(v,{value:p.value.props.rangeMin,"onUpdate:value":w[16]||(w[16]=D=>p.value.props.rangeMin=D)},null,8,["value"]),w[31]||(w[31]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(v,{value:p.value.props.rangeMax,"onUpdate:value":w[17]||(w[17]=D=>p.value.props.rangeMax=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.rangeMessage,"onUpdate:value":w[18]||(w[18]=D=>p.value.props.rangeMessage=D)},null,8,["value"])]),_:1}),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[32]||(w[32]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(C,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regExpress,"onUpdate:value":w[19]||(w[19]=D=>p.value.props.regExpress=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regMessage,"onUpdate:value":w[20]||(w[20]=D=>p.value.props.regMessage=D)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),kd={class:"unione-props-setting data-field"},bd=te(i.defineComponent({__name:"dataField",props:i.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=i.useModel(a,"modelValue");return(t,n)=>{const l=i.resolveComponent("OrderedListOutlined"),o=i.resolveComponent("a-tab-pane"),s=i.resolveComponent("ToolOutlined"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",kd,[i.createVNode(r,null,{default:i.withCtx(()=>[i.createVNode(o,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(l),n[2]||(n[2]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(id,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),i.createVNode(o,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(s),n[3]||(n[3]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(gd,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),yd={key:0,class:"data-model-list"},wd=["onClick"],Ad=te(i.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const t=i.computed(()=>l.editor.dataModels()),n=i.ref({sn:"new_",title:"新建数据",fields:[]});i.onMounted(()=>{t.value&&t.value[0]&&(n.value=t.value[0])});const l=a;function o(d){n.value=d}function s(){if(t.value.length>=l.limit){X.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const d=pa.v4(),p={sn:d,title:"新建数据",name:"new_",fields:[]};n.value=p,console.log("data model added",p),l.editor.dataModel(d,p)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=i.ref(),h=i.inject("closeSetting");function f(){c.value.validate().then(d=>{h&&h()})}return e({toSaving:f}),(d,p)=>{const m=i.resolveComponent("a-input"),b=i.resolveComponent("a-form-item"),y=i.resolveComponent("a-textarea"),A=i.resolveComponent("a-form");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(i.openBlock(),i.createElementBlock("div",yd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,x=>(i.openBlock(),i.createElementBlock("div",{key:x.sn,class:i.normalizeClass(["title",n.value&&n.value.sn==x.sn&&"slt"]),onClick:w=>o(x)},i.toDisplayString(x.title),11,wd))),128)),i.createElementVNode("div",{class:"title btn-add",onClick:s},"+")])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[i.createVNode(A,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:i.withCtx(()=>[i.createVNode(b,{label:"数据标题",name:"title",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.title,"onUpdate:value":p[0]||(p[0]=x=>n.value.title=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.name,"onUpdate:value":p[1]||(p[1]=x=>n.value.name=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.url,"onUpdate:value":p[2]||(p[2]=x=>n.value.url=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据说明",name:"descs"},{default:i.withCtx(()=>[i.createVNode(y,{value:n.value.descs,"onUpdate:value":p[3]||(p[3]=x=>n.value.descs=x)},null,8,["value"])]),_:1})]),_:1},8,["model"]),i.createVNode(bd,{modelValue:n.value.fields,"onUpdate:modelValue":p[4]||(p[4]=x=>n.value.fields=x)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),xd={class:"unione-props-setting unione-page-setting"},Qt=te(i.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref({});return i.onMounted(()=>{t.value=e.editor.define.value}),(n,l)=>{const o=i.resolveComponent("a-form-item"),s=i.resolveComponent("a-input"),r=i.resolveComponent("a-switch"),c=i.resolveComponent("a-textarea"),h=i.resolveComponent("a-form"),f=i.resolveComponent("a-tab-pane"),d=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",xd,[i.createVNode(d,{type:"card"},{default:i.withCtx(()=>[i.createVNode(f,{key:"pageDefine",tab:"页面设置"},{default:i.withCtx(()=>[i.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(i.openBlock(),i.createBlock(o,{key:0,label:"页面编码"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.sn)+"/V"+i.toDisplayString(t.value.vers),1)]),_:1})):i.createCommentVNode("",!0),i.createVNode(o,{label:"页面标题",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=p=>t.value.title=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"页面组件",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=p=>t.value.component=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"icon图标"},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=p=>t.value.icon=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"是否全局"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=p=>t.value.isGlobal=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"是否模版"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=p=>t.value.isTmpl=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"页面备注"},{default:i.withCtx(()=>[i.createVNode(c,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=p=>t.value.descs=p),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),i.createVNode(f,{key:"dataDefine",tab:"数据设置"},{default:i.withCtx(()=>[i.createVNode(Ad,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Tl=te(i.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},n=new ut,l=i.computed(()=>n.$widgetList.value||[]);i.watch(()=>e.pageDefine,s=>{s&&n.load(o.value,s)});const o=i.ref("new_");return i.onMounted(()=>{const s=i.inject("route");console.log("unione page view route",s),o.value=e.psn||s?.query?.psn||s?.meta?.psn||"new_",console.log("unione page view,psn:"+o.value),n.setModel("run"),n.load(o.value,e.pageDefine||t)}),(s,r)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-view","setting-title":"页面设置",editor:i.unref(n)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,c=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.render||c.widget),{key:c.wid,wid:c.wid,widget:c,editor:i.unref(n)},null,8,["wid","widget","editor"]))),128))]),_:2},[i.unref(n)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Cd={class:"form-btns"},Il=i.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){const e=i.inject("router"),t=a,n={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new ut,o=i.computed(()=>l.$widgetList.value||[]),s=i.computed(()=>{const d=l.define.value?.configs?.btns||[],p=d.map(m=>m.name);if(!p.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};d.splice(m.index,0,m)}if(!p.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=m.index||1;d.splice(b,0,m)}if(!p.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};d.splice(m.index,0,m)}if(!p.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};d.splice(m.index,0,m)}return l.model.value=="view"&&d.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),d});function r({btn:d,event:p}){d.name=="save"&&c(),d.name=="reset",d.name=="back"&&h()}async function c(){const d=l.dataManager().form();let p={};for(let m in d){const b=await d[m].validate();if(l.dataManager().psn()==m){for(let y in p)b[y]=p[y];p=b}else p[m]=b}console.log("=======form data=====",p),l.dataManager().primary().save({data:p,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}i.watch(()=>t.pageDefine,d=>{d&&l.load(f.value,d)});const f=i.ref("new_");return i.onMounted(()=>{const d=i.inject("route");console.log("unione page view route",d),f.value=t.psn||d?.query?.psn||d?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),l.setModel(d?.query?.model||d?.meta?.model||"run"),d?.query&&l.dataManager().params(d.query),l.load(f.value,t.pageDefine||n)}),(d,p)=>{const m=i.resolveComponent("unione-btn");return i.openBlock(),i.createBlock(qt,{class:"unione-page-form","setting-title":"页面设置",editor:i.unref(l)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,b=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:i.unref(l)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Cd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b.name},[b.visible!=!1?(i.openBlock(),i.createBlock(m,{key:0,widget:b,editor:i.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128))])]),_:2},[i.unref(l)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),vd=["onMouseover"],Sd={key:0,class:"node-opts"},Bd={class:"form-warp"},Nd={class:"form-btns"},Fl=i.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick"],setup(a,{emit:e}){const t=Y.useDialog(),n=i.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(l.fields?.length){const P={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[P]}o.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage),o.configs.btns=l.btns||[],l.btns==!1&&(o.configs.btns=!1),o.configs.opts=l.opts||[],l.opts==!1&&(o.configs.opts=!1),o.configs.event=l.event||{},o.configs.setting=l.setting||{}}const r=new ut,c=i.ref(!1),h=i.ref([]),f=i.ref({}),d=i.ref(null),p=i.ref(null),m=i.ref([]),b=i.ref([]),y=i.ref(0),A=i.computed(()=>{const P={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",...l.setting?.tree||{}};return r.define.value?.configs?.tree||P}),x=i.computed(()=>{const P=r.define.value?.configs?.opts;if(typeof P=="boolean"&&P==!1)return!1;const I=(P||[]).map(z=>typeof z=="string"?{name:z,visible:!1}:z),_=[];return I.forEach(z=>{_.push(z.name)}),console.log("opts addBtn",I),I.filter(z=>z.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),w=i.computed(()=>{const P=r.define.value?.configs?.opts;if(typeof P=="boolean"&&P==!1)return[];const I=(P||[]).map(K=>typeof K=="string"?{name:K,visible:!1}:K),_=[],z=[];return I.forEach(K=>{z.push(K.name),K.name!="add"&&_.push(K)}),z.includes("delete")||_.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),z.includes("child")||_.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",_),_});function V({btn:P,event:I},_){I.stopPropagation();const z=f.value[_[A.value.idField]];if(console.log("onTreeMenuClick,btn:",P),console.log("onTreeMenuClick,node:",_),console.log("onTreeMenuClick,curentNode:",z),P.name=="child"){const K=f.value[z[A.value.idField]];K.isLeaf=!1,d.value={},d.value[A.value.pidField]=K[A.value.idField],d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,d.value.parentNode=K,y.value=y.value+1,K.children||(K.children=[],b.value.push(K[A.value.idField])),T.value.createNode&&T.value.createNode(d.value,K,r.dataManager().params()),f.value[d.value[A.value.idField]]=d.value,K.children.push(d.value),m.value=[d.value[A.value.idField]],r.dataManager().primary().setValue(d.value)}P.name=="delete"&&(z[A.value.idField]&&(z[A.value.idField]+"").startsWith("new_")?(z.parentNode?z.parentNode.children=z.parentNode.children.filter(K=>K[A.value.idField]!=z[A.value.idField]):h.value=h.value.filter(K=>K[A.value.idField]!=z[A.value.idField]),delete f.value[z[A.value.idField]]):r.dataManager().primary().deleteByIds([z[A.value.idField]]).then(()=>{if(z.parentNode){const K=f.value[z[A.value.pidField]];K.children=K.children.filter(L=>L[A.value.idField]!=z[A.value.idField])}else h.value=h.value.filter(K=>K[A.value.idField]!=z[A.value.idField]);delete f.value[z[A.value.idField]]}))}function k(P,{expanded:I,node:_}){I&&(d.value=_.dataRef,r.dataManager().primary().setValue(d.value),g())}function u(P,I){I.selected?(d.value=I.node.dataRef,r.dataManager().primary().setValue(d.value)):d.value&&(m.value=[d.value[A.value.idField]]),$("treeClick",{keys:P,event:I})}const N=i.computed(()=>{if(l.storage?.orderBy){const P=l.storage.orderBy.split(" ");return[{name:P[0],asc:P[1].toLowerCase()=="asc"}]}return[]});i.watch(()=>l.params,()=>{c.value&&(h.value=[],f.value={},d.value=null,m.value=[],b.value=[],y.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),g())}),i.watch(()=>d.value,()=>{console.log("active node changed",d.value),v(!d.value)});const M=i.ref(null);i.watch(M,()=>{M.value&&d.value&&r.dataManager().primary().setValue(d.value)});function v(P=!0){const I=r.dataManager().form();for(let _ in I)I[_].setDisabled(P)}function C(){if(d.value={},d.value[A.value.pidField]=-1,d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,y.value=y.value+1,T.value.createNode&&T.value.createNode(d.value,null,r.dataManager().params()),d.value[A.value.pidField]==-1)h.value.push(d.value);else{const P=f.value[d.value[A.value.pidField]];P?(P.children||(P.children=[]),P.children.push(d.value)):h.value.push(d.value)}m.value=[d.value[A.value.idField]],f.value[d.value[A.value.idField]]=d.value,r.dataManager().primary().setValue(d.value)}const B=i.ref(""),R=pt(()=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:B.value,needCount:!1,body:A.value.async==!1?null:{},sorts:N.value}).then(P=>{if(f.value={},h.value=[],P.body?.length){const I={};P.body.forEach(_=>{I[_[A.value.idField]]=_}),P.body.forEach(_=>{const z=I[_[A.value.pidField]];z?(z.children||(z.children=[],z.isLeaf=!1),z.children.push(_)):h.value.push(_)})}})},400);function g(){const P={};if(P[A.value.pidField]=l.params[A.value.pidField]||-1,d.value){if(d.value.children?.length||A.value.async==!1)return;P[A.value.pidField]=d.value[A.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:P,sorts:N.value}).then(I=>{d.value.children=I.body||[],d.value.children.forEach(_=>{_.isLeaf=!!_[A.value.leafField],f.value[_[A.value.idField]]=_,_.parentNode=f.value[_[A.value.pidField]]})})}else{const I=A.value.async==!1?null:{page:1,pageSize:999,body:P,sorts:N.value};r.dataManager().primary().find(I).then(_=>{if(A.value.async==!1){if(h.value=[],_.body?.length){const z={};_.body.forEach(K=>{z[K[A.value.idField]]=K}),_.body.forEach(K=>{const L=z[K[A.value.pidField]];L?(L.children||(L.children=[],L.isLeaf=!1),L.children.push(K)):h.value.push(K)})}}else h.value=_.body||[],h.value.forEach(z=>{z.isLeaf=!!z[A.value.leafField],f.value[z[A.value.idField]]=z})})}}const S=i.computed(()=>r.$widgetList.value||[]),T=i.computed(()=>{const P={...r.define.value?.configs?.event||{}};for(const I in P)P[I]&&typeof P[I]!="function"&&P[I].enable&&P[I].scriptText&&(I=="createNode"?P[I]=new Function("node","parent","params",P[I].scriptText):P[I]=new Function("data","event",P[I].scriptText));return P}),O=i.computed(()=>r.define.value?.configs?.setting||l.setting||{});i.provide("pageSetting",O.value);const F=i.computed(()=>{const P=r.define.value?.configs?.btns;if(typeof P=="boolean"&&P==!1)return[];const I=(r.define.value?.configs?.btns||[]).map(z=>typeof z=="string"?{name:z,visible:!1}:{size:"default",...z}),_=I.map(z=>z.name);if(!_.includes("save")){const z={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};I.splice(z.index,0,z)}if(!_.includes("reset")){const z={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};I.splice(z.index,0,z)}if(!_.includes("back")){const z={title:"返回",type:"default",index:I.length,visible:!0,size:"default",name:"back"};I.splice(z.index,0,z)}return r.model.value=="view"&&I.filter(z=>["save","submit","reset"].includes(z.name)).forEach(z=>{z.visible=!1}),I}),$=e;function D({btn:P,event:I}){P.name=="save"&&Q({btn:P,event:I}),P.name=="reset",P.name=="back"&&U(),$("btnClick",{btn:P,event:I})}async function Q(P){const I=r.dataManager().form();let _={...d.value};for(let z in I){const K=await I[z].validate();if(r.dataManager().psn()==z)for(let L in K)_[L]=K[L];else _[z]=K}if(_[A.value.pidField]&&(_[A.value.pidField]+"").startsWith("new_")){t.error({content:"请先保存父节点!"});return}_[A.value.idField]&&(_[A.value.idField]+"").startsWith("new_")&&delete _[A.value.idField],delete _.parentNode,delete _.children,_[A.value.leafField]=_[A.value.leafField]?1:0,T.value.preSave&&T.value.preSave(_,P),console.log("=======form data=====",_),r.dataManager().primary().save({data:_}).then(z=>{console.log("save result:",z),d.value[A.value.idField]=z.body,m.value=[z.body],f.value[z.body]=d.value,d.value.children?.forEach(K=>{K[A.value.pidField]=z.body}),T.value.postSaved&&T.value.postSaved(_,P)})}function U(){n.back()}const E=i.ref("new_");return i.onMounted(()=>{const P=i.inject("route");console.log("unione page tree route",P),E.value=l.psn||P?.query?.psn||P?.meta?.psn||"new_",console.log("unione page tree,psn:"+E.value),r.setModel(P?.query?.model||P?.meta?.model||"run");const I={...l.params||{},...P?.query||{},...P?.params||{}};r.dataManager().params(I),s(),r.load(E.value,o),i.nextTick(()=>{v(!0)}),g(),c.value=!0}),(P,I)=>{const _=i.resolveComponent("SearchOutlined"),z=i.resolveComponent("a-input"),K=i.resolveComponent("unione-btn"),L=i.resolveComponent("a-tree");return i.openBlock(),i.createBlock(qt,{class:"unione-page-tree","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",{class:"tree-warp",onContextmenu:I[4]||(I[4]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(z,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:B.value,"onUpdate:value":I[0]||(I[0]=J=>B.value=J),onChange:i.unref(R),onPressEnter:i.unref(R)},{suffix:i.withCtx(()=>[i.createVNode(_)]),_:1},8,["value","onChange","onPressEnter"]),x.value?(i.openBlock(),i.createBlock(K,{key:0,widget:x.value,onClick:C},null,8,["widget"])):i.createCommentVNode("",!0),i.createVNode(L,{"show-line":A.value.showLine,"show-icon":A.value.showIcon,disabled:A.value.disabled,blockNode:!0,draggable:A.value.draggable,multiple:A.value.multiple,selectable:A.value.selectable,checkable:A.value.checkable,fieldNames:{title:A.value.labelField,key:A.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":I[2]||(I[2]=J=>m.value=J),expandedKeys:b.value,"onUpdate:expandedKeys":I[3]||(I[3]=J=>b.value=J),"tree-data":h.value,onExpand:k,onSelect:u},i.createSlots({icon:i.withCtx(({dataRef:J})=>[J[A.value.iconField]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(J[A.value.iconField]),{key:0,class:"node-icon"})):i.createCommentVNode("",!0)]),_:2},[w.value?.length?{name:"title",fn:i.withCtx(({dataRef:J})=>[i.createElementVNode("div",{class:"node-label",onMouseover:()=>p.value=J,onMouseleave:I[1]||(I[1]=()=>p.value=null)},[i.createElementVNode("span",null,i.toDisplayString(J[A.value.labelField]),1),d.value&&d.value[A.value.idField]==J[A.value.idField]||p.value&&p.value[A.value.idField]==J[A.value.idField]?(i.openBlock(),i.createElementBlock("div",Sd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(w.value,ee=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[!T.value.btnVisible||T.value.btnVisible(ee,J)?(i.openBlock(),i.createBlock(K,{key:ee.name,widget:ee,ctx:{node:J},onClick:ke=>V(ke,J)},null,8,["widget","ctx","onClick"])):i.createCommentVNode("",!0)],64))),256))])):i.createCommentVNode("",!0)],40,vd)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),i.createElementVNode("div",Bd,[i.renderSlot(P.$slots,"form-warp",{class:"form-warp"},()=>[i.createElementVNode("div",{ref_key:"formWarp",ref:M},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(S.value,J=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(J.widget),{key:J.wid,wid:J.wid,widget:J,editor:i.unref(r)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Nd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(F.value,J=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:J.name},[J.visible!=!1?(i.openBlock(),i.createBlock(K,{key:0,widget:J,editor:i.unref(r),disabled:!d.value,ctx:{},onClick:D},null,8,["widget","editor","disabled"])):i.createCommentVNode("",!0)],64))),128))])],512)])])]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Dl=i.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},selection:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:t}){const n=a,l=i.ref(null),o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(n.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=n.fields.filter(V=>V.isQuery),o.configs.widgets[0].btns=n.queryBtns||[],o.configs.widgets[0].params=n.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const w=n.fields.filter(V=>V.isPk)[0];w&&w.name&&(o.configs.widgets[1].dataKey=w.name),o.configs.widgets[1].columns=n.fields.filter(V=>V.hidden!=!0),o.configs.widgets[1].operation=Y.utils.obj.ext(o.configs.widgets[1].operation,n.operation||{}),n.operation==!1&&(o.configs.widgets[1].operation=!1),n.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=n.leftBtns==!1?!1:n.leftBtns||[],o.configs.widgets[1].rightBtns=n.rightBtns==!1?!1:n.rightBtns||[],r.dataManager().use("primary","list").store(n.storage)}}const r=new ut,c=i.computed(()=>r.$widgetList.value||[]),h=t;function f(w){h("btnClick",w)}const d=i.ref("new_");i.onMounted(()=>{const w=i.inject("route");console.log("unione page view route",w),d.value=n.psn||w?.query?.psn||w?.meta?.psn||"new_",console.log("unione page view,psn:"+d.value),r.setModel(w?.query?.model||w?.meta?.model||"run");const V={...n.params||{},...w?.query||{},...w?.params||{}};r.dataManager().params(V),s(),r.load(d.value,o)});function p(){return r.dataManager().use("primary","list")}function m(w){w?r.ebus.$emit("table-list-search",w):r.ebus.$emit("table-list-reload")}function b(w){r.dataManager().params(w),r.ebus.$emit("query-form-params",w),r.ebus.$emit("table-list-search",{params:w})}function y(){return l.value?l.value[0]:null}function A(){return l.value?l.value[0].getSelected():null}function x(){l.value&&l.value[0].clearSelected()}return e({storage:p,editor:r,reload:m,setParams:b,getTable:y,getSelected:A,clearSelected:x}),(w,V)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-list","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,k=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:k.wid},[k.widget=="unione-table"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),mt={release(a){return Y.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return Y.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return Y.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return Y.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return Y.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return Y.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return Y.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},Vd={class:"unione-page list-page"},Rd=te(i.defineComponent({__name:"list",setup(a){const e=Fe(),t=Y.useDialog(),n=i.inject("router"),l=i.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),o=i.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});i.onMounted(()=>{r()});const s=i.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){s.value.loading=!0,mt.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(k=>{s.value.data=k.body,s.value.pagination.total=k.total*1}).finally(()=>{s.value.loading=!1})}function c(k){s.value.pagination.current=k.pagination.current,s.value.pagination.pageSize=k.pagination.pageSize,r()}function h({params:k,keywords:u}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=u,r()}function f({btn:k,event:u,row:N}){console.log("table btn click",k,u,N),(k.name=="add"||k.name=="edit")&&n.push({path:"/dev/data/define/edit",query:N?{id:N.id}:{}}),k.name=="impFromDb"&&(p.value=!0),k.name=="release"&&d(N),k.name=="view"&&n.push({path:e.listPageUrl,query:{psn:N.sn+":list",model:"preview"}})}function d(k){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([k.id]).then(u=>{u.success?(t.success({title:"发布成功",content:u.body}),r()):t.error({title:"发布失败",content:u.body})})}})}const p=i.ref(!1),m=i.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=i.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),y=i.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function A(k){!k||!Object.keys(k).length||!k.dsId||(X.message.loading("数据加载中..."),y.value.params=k,y.value.loading=!0,mt.loadFromDb(k).then(u=>{y.value.loading=!1,X.message.destroy(),u.success?(u.body.forEach(N=>{N.checkable=!!N.id}),y.value.data=u.body,y.value.pagination.total=u.body.length):X.message.error(u.message)}))}function x(k){y.value.pagination.current=k.pagination.current,y.value.pagination.pageSize=k.pagination.pageSize}const w=i.ref();function V({btn:k}){if(k.name!="imp")return;const u=w.value.getSelected();u?.keys?.length?t.confirm({content:"确定导入选中的"+u.keys.length+"条记录么?",onOk:()=>{X.message.loading("数据导入中..."),mt.impFromDb({dsId:y.value.params.dsId,tables:u.keys.join()}).then(N=>{X.message.destroy(),N.success?(t.success({content:N.message}),s.value.pagination.current=1,r()):t.error({context:N.message})})}}):t.error({content:"请选择目标记录!"})}return(k,u)=>{const N=i.resolveComponent("UnioneQuery"),M=i.resolveComponent("UnioneTable"),v=i.resolveComponent("a-drawer");return i.openBlock(),i.createElementBlock("div",Vd,[i.createVNode(N,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),i.createVNode(M,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:f},null,8,["widget","dataList","loading","pagination"]),i.createVNode(v,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":u[0]||(u[0]=C=>p.value=C),placement:"left"},{default:i.withCtx(()=>[i.createVNode(N,{widget:m.value,onQuery:A,onReset:A,onBtnClick:V,class:"load-table-form"},null,8,["widget"]),i.createVNode(M,{widget:b.value,dataList:y.value.data,loading:y.value.loading,pagination:y.value.pagination,onChange:x,rowKey:"name",ref_key:"loadTableObj",ref:w},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),Ed={class:"unione-props-setting data-field-manage"},Od={key:0},Md={key:1},Td=["onClick"],Id=["onClick"],Fd=["onClick"],Dd={key:1},_d=te(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{n.value.selectedRowKeys.includes(b)||n.value.selectedRowKeys.push(b);const y=[];t.value.forEach(A=>{!m.includes(A.name)&&n.value.selectedRowKeys.includes(A.name)&&y.push(A.name)}),y.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(A=>!y.includes(A)))})}}),l={mounted:m=>m.focus()},o=i.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let b in m){const y=t.value.filter(A=>A.name==b);if(y&&y[0]){let A=o.value[b];Object.keys(A).forEach(x=>{y[0][x]=A[x]})}}o.value={}}function r(m,b){s();const y={};y[b]=m[b]||"",o.value[m.name]=y}function c(m,b){if(!m||!b){o.value={};return}const y=o.value[m.name][b];if(b=="name"&&t.value.filter(x=>x[b]==y&&x.name!=m.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}m[b]=y,o.value={}}function h(m,b){const y=t.value.filter(A=>A.name==m.name)[0];return b=="isFk"?y.configs?.fkey?.enable:y[b]==1}function f(m,b){const y=t.value.filter(A=>A.name==m.name)[0];b=="isFk"?(y.configs||(y.configs={}),y.configs.fkey||(y.configs.fkey={}),y.configs.fkey.enable=!y.configs.fkey.enable):y[b]!=1?y[b]=1:y[b]=0}function d(){if(s(),t.value.filter(y=>y.name=="new_").length>0){o.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),o.value[b.name]={name:"new_"}}function p(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!n.value.selectedRowKeys.includes(m.name)),n.value.selectedRowKeys=[]}})}return(m,b)=>{const y=i.resolveComponent("a-button"),A=i.resolveComponent("a-tooltip"),x=i.resolveComponent("a-input"),w=i.resolveComponent("a-input-number"),V=i.resolveComponent("a-select-option"),k=i.resolveComponent("a-select"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",Ed,[i.createVNode(y,{class:"btn btn-add",type:"primary",onClick:d,size:"small"},{default:i.withCtx(()=>b[1]||(b[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:i.withCtx(()=>b[2]||(b[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(N,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:M})=>[["name","title"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Od,[b[3]||(b[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Md,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),M.key==="isPk"?(i.openBlock(),i.createBlock(A,{key:2,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[b[4]||(b[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isFk"?(i.openBlock(),i.createBlock(A,{key:3,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isNull"?(i.openBlock(),i.createBlock(A,{key:4,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="syncEnable"?(i.openBlock(),i.createBlock(A,{key:5,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:M,text:v,record:C})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Td)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(w,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Id)):["dataType"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(k,{key:0,value:C[M.dataIndex],"onUpdate:value":B=>C[M.dataIndex]=B,onBlur:b[0]||(b[0]=B=>c())},{default:i.withCtx(()=>[i.createVNode(V,{key:"String",value:"String"}),i.createVNode(V,{key:"Long",value:"Long"}),i.createVNode(V,{key:"Short",value:"Short"}),i.createVNode(V,{key:"Integer",value:"Integer"}),i.createVNode(V,{key:"Float",value:"Float"}),i.createVNode(V,{key:"Double",value:"Double"}),i.createVNode(V,{key:"Date",value:"Date"}),i.createVNode(V,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",Dd,i.toDisplayString(v),1))],10,Fd)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:3,checked:h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:4,checked:!h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),_l=1024;let Pd=0,an=class{constructor(e,t){this.from=e,this.to=t}};class ne{constructor(e={}){this.id=Pd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Be.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}ne.closedBy=new ne({deserialize:a=>a.split(" ")}),ne.openedBy=new ne({deserialize:a=>a.split(" ")}),ne.group=new ne({deserialize:a=>a.split(" ")}),ne.isolate=new ne({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),ne.contextHash=new ne({perNode:!0}),ne.lookAhead=new ne({perNode:!0}),ne.mounted=new ne({perNode:!0});class ui{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ne.mounted.id]}}const $d=Object.create(null);class Be{constructor(e,t,n,l=0){this.name=e,this.props=t,this.id=n,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):$d,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Be(e.name||"",t,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ne.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let l of n.split(" "))t[l]=e[n];return n=>{for(let l=n.prop(ne.group),o=-1;o<(l?l.length:0);o++){let s=t[o<0?n.name:l[o]];if(s)return s}}}}Be.none=new Be("",Object.create(null),0,8);class rn{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let l=null;for(let o of e){let s=o(n);s&&(l||(l=Object.assign({},n.props)),l[s[0].id]=s[1])}t.push(l?new Be(n.name,l,n.id,n.flags):n)}return new rn(t)}}const pi=new WeakMap,Pl=new WeakMap;var me;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(me||(me={}));class fe{constructor(e,t,n,l,o){if(this.type=e,this.children=t,this.positions=n,this.length=l,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,r]of o)this.props[typeof s=="number"?s:s.id]=r}}toString(){let e=ui.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let l=n.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new hn(this.topNode,e)}cursorAt(e,t=0,n=0){let l=pi.get(this)||this.topNode,o=new hn(l);return o.moveTo(e,t),pi.set(this,o._tree),o}get topNode(){return new Oe(this,0,0,null)}resolve(e,t=0){let n=Wt(pi.get(this)||this.topNode,e,t,!1);return pi.set(this,n),n}resolveInner(e,t=0){let n=Wt(Pl.get(this)||this.topNode,e,t,!0);return Pl.set(this,n),n}resolveStack(e,t=0){return zd(this,e,t)}iterate(e){let{enter:t,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&me.IncludeAnonymous)>0;for(let c=this.cursor(s|me.IncludeAnonymous);;){let h=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&n&&(r||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:un(Be.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,l)=>new fe(this.type,t,n,l,this.propValues),e.makeTree||((t,n,l)=>new fe(Be.none,t,n,l)))}static build(e){return jd(e)}}fe.empty=new fe(Be.none,[],[],0);class cn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new cn(this.buffer,this.index)}}class ot{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Be.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],l=this.set.types[t],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,t,n,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=t&&!($l(o,l,s[c+1],s[c+2])&&(r=c,n>0));c=s[c+3]);return r}slice(e,t,n){let l=this.buffer,o=new Uint16Array(t-e),s=0;for(let r=e,c=0;r<t;){o[c++]=l[r++],o[c++]=l[r++]-n;let h=o[c++]=l[r++]-n;o[c++]=l[r++]-e,s=Math.max(s,h)}return new ot(o,s,this.set)}}function $l(a,e,t,n){switch(a){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Wt(a,e,t,n){for(var l;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let s=!n&&a instanceof Oe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:me.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Oe&&s.index<0&&((l=r.enter(e,t,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,t,o);if(!s)return a;a=s}}class Ll{cursor(e=0){return new hn(this,e)}getChild(e,t=null,n=null){let l=Ul(this,e,t,n);return l.length?l[0]:null}getChildren(e,t=null,n=null){return Ul(this,e,t,n)}resolve(e,t=0){return Wt(this,e,t,!1)}resolveInner(e,t=0){return Wt(this,e,t,!0)}matchContext(e){return dn(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(n=t,t=l.prevSibling):t=l}return n}get node(){return this}get next(){return this.parent}}class Oe extends Ll{constructor(e,t,n,l){super(),this._tree=e,this.from=t,this.index=n,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,h=t>0?r.length:-1;e!=h;e+=t){let f=r[e],d=c[e]+s.from;if($l(l,n,d,d+f.length)){if(f instanceof ot){if(o&me.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,t,n-d,l);if(p>-1)return new st(new Ld(s,f,e,d),null,p)}else if(o&me.IncludeAnonymous||!f.type.isAnonymous||fn(f)){let p;if(!(o&me.IgnoreMounts)&&(p=ui.get(f))&&!p.overlay)return new Oe(p.tree,d,e,s);let m=new Oe(f,d,e,s);return o&me.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?f.children.length-1:0,t,n,l)}}}if(o&me.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let l;if(!(n&me.IgnoreOverlays)&&(l=ui.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((t>0?s<=o:s<o)&&(t<0?r>=o:r>o))return new Oe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ul(a,e,t,n){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let s=!1;!s;)if(s=l.type.is(t),!l.nextSibling())return o}for(;;){if(n!=null&&l.type.is(n))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return n==null?o:[]}}function dn(a,e,t=e.length-1){for(let n=a.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Ld{constructor(e,t,n,l){this.parent=e,this.buffer=t,this.index=n,this.start=l}}class st extends Ll{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new st(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&me.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new st(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new st(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new st(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,l=this.index+4,o=n.buffer[this.index+3];if(o>l){let s=n.buffer[this.index+1];e.push(n.slice(l,o,s)),t.push(0)}return new fe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zl(a){if(!a.length)return null;let e=0,t=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>t.from||s.to<t.to)&&(t=s,e=o)}let n=t instanceof Oe&&t.index<0?null:t.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Ud(l,t)}class Ud{constructor(e,t){this.heads=e,this.node=t}get next(){return zl(this.heads)}}function zd(a,e,t){let n=a.resolveInner(e,t),l=null;for(let o=n instanceof Oe?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[n])).push(s.resolve(e,t)),o=s}else{let s=ui.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Oe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(Wt(r,e,t,!1))}}return l?zl(l):n}class hn{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Oe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=n+l.buffer[e+1],this.to=n+l.buffer[e+2],!0}yield(e){return e?e instanceof Oe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&me.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&me.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&me.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let l=n<0?0:this.stack[n]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(l)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(l.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:n}=l)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let o=t+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let r=n._tree.children[o];if(this.mode&me.IncludeAnonymous||r instanceof ot||!r.type.isAnonymous||fn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let l=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==l){if(l==this.index)return s;t=s,n=o+1;break e}l=this.stack[--o]}for(let l=n;l<this.stack.length;l++)t=new st(this.buffer,t,this.stack[l]);return this.bufferNode=new st(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,l=!0}}}matchContext(e){if(!this.buffer)return dn(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return dn(this.node,e,l);let s=n[t.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function fn(a){return a.children.some(e=>e instanceof ot||!e.type.isAnonymous||fn(e))}function jd(a){var e;let{buffer:t,nodeSet:n,maxBufferLength:l=_l,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(t)?new cn(t,t.length):t,c=n.types,h=0,f=0;function d(u,N,M,v,C,B){let{id:R,start:g,end:S,size:T}=r,O=f;for(;T<0;)if(r.next(),T==-1){let U=o[R];M.push(U),v.push(g-u);return}else if(T==-3){h=R;return}else if(T==-4){f=R;return}else throw new RangeError(`Unrecognized record size: ${T}`);let F=c[R],$,D,Q=g-u;if(S-g<=l&&(D=A(r.pos-N,C))){let U=new Uint16Array(D.size-D.skip),E=r.pos-D.size,P=U.length;for(;r.pos>E;)P=x(D.start,U,P);$=new ot(U,S-D.start,n),Q=D.start-u}else{let U=r.pos-T;r.next();let E=[],P=[],I=R>=s?R:-1,_=0,z=S;for(;r.pos>U;)I>=0&&r.id==I&&r.size>=0?(r.end<=z-l&&(b(E,P,g,_,r.end,z,I,O),_=E.length,z=r.end),r.next()):B>2500?p(g,U,E,P):d(g,U,E,P,I,B+1);if(I>=0&&_>0&&_<E.length&&b(E,P,g,_,g,z,I,O),E.reverse(),P.reverse(),I>-1&&_>0){let K=m(F);$=un(F,E,P,0,E.length,0,S-g,K,K)}else $=y(F,E,P,S-g,O-S)}M.push($),v.push(Q)}function p(u,N,M,v){let C=[],B=0,R=-1;for(;r.pos>N;){let{id:g,start:S,end:T,size:O}=r;if(O>4)r.next();else{if(R>-1&&S<R)break;R<0&&(R=T-l),C.push(g,S,T),B++,r.next()}}if(B){let g=new Uint16Array(B*4),S=C[C.length-2];for(let T=C.length-3,O=0;T>=0;T-=3)g[O++]=C[T],g[O++]=C[T+1]-S,g[O++]=C[T+2]-S,g[O++]=O;M.push(new ot(g,C[2]-S,n)),v.push(S-u)}}function m(u){return(N,M,v)=>{let C=0,B=N.length-1,R,g;if(B>=0&&(R=N[B])instanceof fe){if(!B&&R.type==u&&R.length==v)return R;(g=R.prop(ne.lookAhead))&&(C=M[B]+R.length+g)}return y(u,N,M,v,C)}}function b(u,N,M,v,C,B,R,g){let S=[],T=[];for(;u.length>v;)S.push(u.pop()),T.push(N.pop()+M-C);u.push(y(n.types[R],S,T,B-C,g-B)),N.push(C-M)}function y(u,N,M,v,C=0,B){if(h){let R=[ne.contextHash,h];B=B?[R].concat(B):[R]}if(C>25){let R=[ne.lookAhead,C];B=B?[R].concat(B):[R]}return new fe(u,N,M,v,B)}function A(u,N){let M=r.fork(),v=0,C=0,B=0,R=M.end-l,g={size:0,start:0,skip:0};e:for(let S=M.pos-u;M.pos>S;){let T=M.size;if(M.id==N&&T>=0){g.size=v,g.start=C,g.skip=B,B+=4,v+=4,M.next();continue}let O=M.pos-T;if(T<0||O<S||M.start<R)break;let F=M.id>=s?4:0,$=M.start;for(M.next();M.pos>O;){if(M.size<0)if(M.size==-3)F+=4;else break e;else M.id>=s&&(F+=4);M.next()}C=$,v+=T,B+=F}return(N<0||v==u)&&(g.size=v,g.start=C,g.skip=B),g.size>4?g:void 0}function x(u,N,M){let{id:v,start:C,end:B,size:R}=r;if(r.next(),R>=0&&v<s){let g=M;if(R>4){let S=r.pos-(R-4);for(;r.pos>S;)M=x(u,N,M)}N[--M]=g,N[--M]=B-u,N[--M]=C-u,N[--M]=v}else R==-3?h=v:R==-4&&(f=v);return M}let w=[],V=[];for(;r.pos>0;)d(a.start||0,a.bufferStart||0,w,V,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:w.length?V[0]+w[0].length:0;return new fe(c[a.topID],w.reverse(),V.reverse(),k)}const jl=new WeakMap;function mi(a,e){if(!a.isAnonymous||e instanceof ot||e.type!=a)return 1;let t=jl.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=a||!(n instanceof fe)){t=1;break}t+=mi(a,n)}jl.set(e,t)}return t}function un(a,e,t,n,l,o,s,r,c){let h=0;for(let b=n;b<l;b++)h+=mi(a,e[b]);let f=Math.ceil(h*1.5/8),d=[],p=[];function m(b,y,A,x,w){for(let V=A;V<x;){let k=V,u=y[V],N=mi(a,b[V]);for(V++;V<x;V++){let M=mi(a,b[V]);if(N+M>=f)break;N+=M}if(V==k+1){if(N>f){let M=b[k];m(M.children,M.positions,0,M.children.length,y[k]+w);continue}d.push(b[k])}else{let M=y[V-1]+b[V-1].length-u;d.push(un(a,b,y,k,V,u,M,null,c))}p.push(u+w-o)}}return m(e,t,n,l,0),(r||c)(d,p,s)}class gt{constructor(e,t,n,l,o=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=l,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let l=[new gt(0,e.length,e,0,!1,n)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,n=128){if(!t.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,h=0;;r++){let f=r<t.length?t[r]:null,d=f?f.fromA:1e9;if(d-c>=n)for(;s&&s.from<d;){let p=s;if(c>=p.from||d<=p.to||h){let m=Math.max(p.from,c)-h,b=Math.min(p.to,d)-h;p=m>=b?null:new gt(m,b,p.tree,p.offset+h,r>0,!!f)}if(p&&l.push(p),s.to>d)break;s=o<e.length?e[o++]:null}if(!f)break;c=f.toA,h=f.toA-f.toB}return l}}class ql{startParse(e,t,n){return typeof e=="string"&&(e=new qd(e)),n=n?n.length?n.map(l=>new an(l.from,l.to)):[new an(0,0)]:[new an(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let l=this.startParse(e,t,n);for(;;){let o=l.advance();if(o)return o}}}class qd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ne({perNode:!0});class gi{constructor(e,t,n,l,o,s,r,c,h,f=0,d){this.p=e,this.stack=t,this.state=n,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=d}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let l=e.parser.context;return new gi(e,[],t,n,n,0,[],0,l?new Ql(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,l=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let r=o.dynamicPrecedence(l);if(r&&(this.score+=r),n==0){this.pushState(o.getGoto(this.state,l,!0),this.reducePos),l<o.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(l,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),h=c?this.stack[c-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let d=c?this.stack[c-1]:0,p=this.bufferBase+this.buffer.length-d;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,m,p+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,n,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,r=this.buffer.length;if(r==0&&s.parent&&(r=s.bufferBase-s.parent.bufferBase,s=s.parent),r>0&&s.buffer[r-4]==0&&s.buffer[r-1]>-1){if(t==n)return;if(s.buffer[r-2]>=t){s.buffer[r-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,t,n,l);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let r=!1;for(let c=s;c>0&&this.buffer[c-2]>n;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,l>4&&(l-=4)}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=n,this.buffer[s+3]=l}}shift(e,t,n,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||t<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,n),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,l,4)}}apply(e,t,n,l){e&65536?this.reduce(e):this.shift(e,t,n,l)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(n,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new gi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Qd(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<t.length;o+=2)(s=t[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(t[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<t.length;o+=2){let s=t[o+1];l.some((r,c)=>c&1&&r==s)||l.push(t[o],s)}t=l}let n=[];for(let l=0;l<t.length&&n.length<4;l+=2){let o=t[l+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(t[l],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,l=t&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;t=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,s=>{if(!(s&393216))if(s&65536){let r=(s>>19)-o;if(r>1){let c=s&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return r<<19|65536|c}}else{let r=n(s,o+1);if(r!=null)return r}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Ql(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Ql{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Qd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class ki{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ki(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ki(this.stack,this.pos,this.index)}}function bi(a,e=Uint16Array){if(typeof a!="string")return a;let t=null;for(let n=0,l=0;n<a.length;){let o=0;for(;;){let s=a.charCodeAt(n++),r=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,r=!0),o+=c,r)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class yi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Wl=new yi;class Wd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Wl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!l)return null;let s=this.ranges[--l];o-=n.from-s.to,n=s}for(;t<0?o>n.to:o>=n.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-n.to,n=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,l;if(t>=0&&t<this.chunk.length)n=this.pos+e,l=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=n;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-n)),l=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),l}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Wl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(n+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return n}}class St{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}St.prototype.contextual=St.prototype.fallback=St.prototype.extend=!1,St.prototype.fallback=St.prototype.extend=!1;function Yd(a,e,t,n,l,o){let s=0,r=1<<n,{dialect:c}=t.p.parser;e:for(;r&a[s];){let h=a[s+1];for(let m=s+3;m<h;m+=2)if((a[m+1]&r)>0){let b=a[m];if(c.allows(b)&&(e.token.value==-1||e.token.value==b||Hd(b,e.token.value,l,o))){e.acceptToken(b);break}}let f=e.next,d=0,p=a[s+2];if(e.next<0&&p>d&&a[h+p*3-3]==65535){s=a[h+p*3-1];continue e}for(;d<p;){let m=d+p>>1,b=h+m+(m<<1),y=a[b],A=a[b+1]||65536;if(f<y)p=m;else if(f>=A)d=m+1;else{s=a[b+2],e.advance();continue e}}break}}function Yl(a,e,t){for(let n=e,l;(l=a[n])!=65535;n++)if(l==t)return n-e;return-1}function Hd(a,e,t,n){let l=Yl(t,n,e);return l<0||Yl(t,n,a)<l}const Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let pn=null;function Hl(a,e,t){let n=a.cursor(me.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(a.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:a.length}}class Kd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Hl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Hl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],l=this.index[t];if(l==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[l],s=this.start[t]+n.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof fe){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(ne.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}}class Gd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new yi)}getActions(e){let t=0,n=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let h=0;h<o.length;h++){if(!(1<<h&s))continue;let f=o[h],d=this.tokens[h];if(!(n&&!f.fallback)&&((f.contextual||d.start!=e.pos||d.mask!=s||d.context!=r)&&(this.updateCachedToken(d,f,e),d.mask=s,d.context=r),d.lookAhead>d.end+25&&(c=Math.max(d.lookAhead,c)),d.value!=0)){let p=t;if(d.extended>-1&&(t=this.addActions(e,d.extended,d.end,t)),t=this.addActions(e,d.value,d.end,t),!f.extend&&(n=d,t>p))break}}for(;this.actions.length>t;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new yi,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yi,{pos:n,p:l}=e;return t.start=n,t.end=Math.min(n+1,l.stream.end),t.value=n==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,n){let l=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(l,e),n),e.value>-1){let{parser:o}=n.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let r=o.specializers[s](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,n,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=n,l}addActions(e,t,n,l){let{state:o}=e,{parser:s}=e.p,{data:r}=s;for(let c=0;c<2;c++)for(let h=s.stateSlot(o,c?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=Je(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(Je(r,h+2),t,n,l));break}r[h]==t&&(l=this.putAction(Je(r,h+1),t,n,l))}return l}}class Jd{constructor(e,t,n,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Wd(t,l),this.tokens=new Gd(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[gi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new Kd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let r=e[s];for(;;){if(this.tokens.mainToken=null,r.pos>t)n.push(r);else{if(this.advanceStack(r,n,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!n.length){let s=l&&Zd(l);if(s)return Ve&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ve&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let s=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,n);if(s)return Ve&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((r,c)=>c.score-r.score);n.length>s;)n.pop();n.some(r=>r.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let r=n[s];for(let c=s+1;c<n.length;c++){let h=n[c];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)n.splice(c--,1);else{n.splice(s--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let l=e.pos,{parser:o}=this,s=Ve?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let d=this.fragments.nodeAt(l);d;){let p=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(e.state,d.type.id):-1;if(p>-1&&d.length&&(!h||(d.prop(ne.contextHash)||0)==f))return e.useNode(d,p),Ve&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof fe)||d.children.length==0||d.positions[0]>0)break;let m=d.children[0];if(m instanceof fe&&d.positions[0]==0)d=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ve&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;h<c.length;){let f=c[h++],d=c[h++],p=c[h++],m=h==c.length||!n,b=m?e:e.split(),y=this.tokens.mainToken;if(b.apply(f,d,y?y.start:b.pos,p),Ve&&console.log(s+this.stackID(b)+` (via ${f&65536?`reduce of ${o.getName(f&65535)}`:"shift"} for ${o.getName(d)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?t.push(b):n.push(b)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Kl(e,t),!0}}runRecovery(e,t,n){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=t[s<<1],h=t[(s<<1)+1],f=Ve?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Ve&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let d=r.split(),p=f;for(let m=0;d.forceReduce()&&m<10&&(Ve&&console.log(p+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));m++)Ve&&(p=this.stackID(d)+" -> ");for(let m of r.recoverByInsert(c))Ve&&console.log(f+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>r.pos?(h==r.pos&&(h++,c=0),r.recoverByDelete(c,h),Ve&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),Kl(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),fe.build({buffer:ki.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(pn||(pn=new WeakMap)).get(e);return t||pn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Kl(a,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==a.pos&&n.sameState(a)){e[t].score<a.score&&(e[t]=a);return}}e.push(a)}class Xd{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class wi extends ql{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let n=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function o(r,c,h){l[r].push([c,c.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let c=r[0];typeof c=="string"&&(c=ne[c]);for(let h=1;h<r.length;){let f=r[h++];if(f>=0)o(f,c,r[h++]);else{let d=r[h+-f];for(let p=-f;p>0;p--)o(r[h++],c,d);h++}}}this.nodeSet=new rn(t.map((r,c)=>Be.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:n.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=_l;let s=bi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(Gl),this.states=bi(e.states,Uint32Array),this.data=bi(e.stateData),this.goto=bi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new St(s,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let l=new Jd(this,e,t,n);for(let o of this.wrappers)l=o(l,e,t,n);return l}getGoto(e,t,n=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&n)return c;for(let h=o+(s>>1);o<h;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,t){let n=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=n[o])==65535)if(n[o+1]==1)s=n[o=Je(n,o+2)];else{if(n[o+1]==2)return Je(n,o+2);break}if(s==t||s==0)return Je(n,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),l=n?t(n):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Je(this.data,o+2);else break;l=t(Je(this.data,o+1))}return l}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Je(this.data,n+2);else break;if(!(this.data[n+2]&1)){let l=this.data[n+1];t.some((o,s)=>s&1&&o==l)||t.push(this.data[n],l)}}return t}configure(e){let t=Object.assign(Object.create(wi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let l=e.tokenizers.find(o=>o.from==n);return l?l.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,l)=>{let o=e.specializers.find(r=>r.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[l]=Gl(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let o of e.split(" ")){let s=t.indexOf(o);s>=0&&(n[s]=!0)}let l=null;for(let o=0;o<t.length;o++)if(!n[o])for(let s=this.dialects[t[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Xd(e,n,l)}static deserialize(e){return new wi(e)}}function Je(a,e){return a[e]|a[e+1]<<16}function Zd(a){let e=null;for(let t of a){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Gl(a){if(a.external){let e=a.extend?1:0;return(t,n)=>a.external(t,n)<<1|e}return a.get}let eh=0;class Me{constructor(e,t,n,l){this.name=e,this.set=t,this.base=n,this.modified=l,this.id=eh++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Me&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new Me(n,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new Ai(e);return n=>n.modified.indexOf(t)>-1?n:Ai.get(n.base||n,n.modified.concat(t).sort((l,o)=>l.id-o.id))}}let th=0;class Ai{constructor(e){this.name=e,this.instances=[],this.id=th++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(r=>r.base==e&&ih(t,r.modified));if(n)return n;let l=[],o=new Me(e.name,l,e,t);for(let r of t)r.instances.push(o);let s=nh(t);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ai.get(r,c));return o}}function ih(a,e){return a.length==e.length&&a.every((t,n)=>t==e[n])}function nh(a){let e=[[]];for(let t=0;t<a.length;t++)for(let n=0,l=e.length;n<l;n++)e.push(e[n].concat(a[t]));return e.sort((t,n)=>n.length-t.length)}function Jl(a){let e=Object.create(null);for(let t in a){let n=a[t];Array.isArray(n)||(n=[n]);for(let l of t.split(" "))if(l){let o=[],s=2,r=l;for(let d=0;;){if(r=="..."&&d>0&&d+3==l.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!p)throw new RangeError("Invalid path: "+l);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),d+=p[0].length,d==l.length)break;let m=l[d++];if(d==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(d)}let c=o.length-1,h=o[c];if(!h)throw new RangeError("Invalid path: "+l);let f=new mn(n,s,c>0?o.slice(0,c):null);e[h]=f.sort(e[h])}}return lh.add(e)}const lh=new ne;class mn{constructor(e,t,n,l){this.tags=e,this.mode=t,this.context=n,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}mn.empty=new mn([],2,null);function Xl(a,e){let t=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let s of o.tag)t[s.id]=o.class;let{scope:n,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let h=t[c.id];if(h){s=s?s+" "+h:h;break}}return s},scope:n}}const q=Me.define,xi=q(),at=q(),Zl=q(at),eo=q(at),rt=q(),Ci=q(rt),gn=q(rt),Le=q(),kt=q(Le),Ue=q(),ze=q(),kn=q(),Yt=q(kn),vi=q(),j={comment:xi,lineComment:q(xi),blockComment:q(xi),docComment:q(xi),name:at,variableName:q(at),typeName:Zl,tagName:q(Zl),propertyName:eo,attributeName:q(eo),className:q(at),labelName:q(at),namespace:q(at),macroName:q(at),literal:rt,string:Ci,docString:q(Ci),character:q(Ci),attributeValue:q(Ci),number:gn,integer:q(gn),float:q(gn),bool:q(rt),regexp:q(rt),escape:q(rt),color:q(rt),url:q(rt),keyword:Ue,self:q(Ue),null:q(Ue),atom:q(Ue),unit:q(Ue),modifier:q(Ue),operatorKeyword:q(Ue),controlKeyword:q(Ue),definitionKeyword:q(Ue),moduleKeyword:q(Ue),operator:ze,derefOperator:q(ze),arithmeticOperator:q(ze),logicOperator:q(ze),bitwiseOperator:q(ze),compareOperator:q(ze),updateOperator:q(ze),definitionOperator:q(ze),typeOperator:q(ze),controlOperator:q(ze),punctuation:kn,separator:q(kn),bracket:Yt,angleBracket:q(Yt),squareBracket:q(Yt),paren:q(Yt),brace:q(Yt),content:Le,heading:kt,heading1:q(kt),heading2:q(kt),heading3:q(kt),heading4:q(kt),heading5:q(kt),heading6:q(kt),contentSeparator:q(Le),list:q(Le),quote:q(Le),emphasis:q(Le),strong:q(Le),link:q(Le),monospace:q(Le),strikethrough:q(Le),inserted:q(),deleted:q(),changed:q(),invalid:q(),meta:vi,documentMeta:q(vi),annotation:q(vi),processingInstruction:q(vi),definition:Me.defineModifier("definition"),constant:Me.defineModifier("constant"),function:Me.defineModifier("function"),standard:Me.defineModifier("standard"),local:Me.defineModifier("local"),special:Me.defineModifier("special")};for(let a in j){let e=j[a];e instanceof Me&&(e.name=a)}Xl([{tag:j.link,class:"tok-link"},{tag:j.heading,class:"tok-heading"},{tag:j.emphasis,class:"tok-emphasis"},{tag:j.strong,class:"tok-strong"},{tag:j.keyword,class:"tok-keyword"},{tag:j.atom,class:"tok-atom"},{tag:j.bool,class:"tok-bool"},{tag:j.url,class:"tok-url"},{tag:j.labelName,class:"tok-labelName"},{tag:j.inserted,class:"tok-inserted"},{tag:j.deleted,class:"tok-deleted"},{tag:j.literal,class:"tok-literal"},{tag:j.string,class:"tok-string"},{tag:j.number,class:"tok-number"},{tag:[j.regexp,j.escape,j.special(j.string)],class:"tok-string2"},{tag:j.variableName,class:"tok-variableName"},{tag:j.local(j.variableName),class:"tok-variableName tok-local"},{tag:j.definition(j.variableName),class:"tok-variableName tok-definition"},{tag:j.special(j.variableName),class:"tok-variableName2"},{tag:j.definition(j.propertyName),class:"tok-propertyName tok-definition"},{tag:j.typeName,class:"tok-typeName"},{tag:j.namespace,class:"tok-namespace"},{tag:j.className,class:"tok-className"},{tag:j.macroName,class:"tok-macroName"},{tag:j.propertyName,class:"tok-propertyName"},{tag:j.operator,class:"tok-operator"},{tag:j.comment,class:"tok-comment"},{tag:j.meta,class:"tok-meta"},{tag:j.invalid,class:"tok-invalid"},{tag:j.punctuation,class:"tok-punctuation"}]);const oh=Jl({String:j.string,Number:j.number,"True False":j.bool,PropertyName:j.propertyName,Null:j.null,",":j.separator,"[ ]":j.squareBracket,"{ }":j.brace}),sh=wi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[oh],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let bn=[],to=[];(()=>{let a="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<a.length;e++)(e%2?to:bn).push(t=t+a[e])})();function ah(a){if(a<768)return!1;for(let e=0,t=bn.length;;){let n=e+t>>1;if(a<bn[n])t=n;else if(a>=to[n])e=n+1;else return!0;if(e==t)return!1}}function io(a){return a>=127462&&a<=127487}const no=8205;function rh(a,e,t=!0,n=!0){return(t?lo:ch)(a,e,n)}function lo(a,e,t){if(e==a.length)return e;e&&oo(a.charCodeAt(e))&&so(a.charCodeAt(e-1))&&e--;let n=yn(a,e);for(e+=ao(n);e<a.length;){let l=yn(a,e);if(n==no||l==no||t&&ah(l))e+=ao(l),n=l;else if(io(l)){let o=0,s=e-2;for(;s>=0&&io(yn(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function ch(a,e,t){for(;e>0;){let n=lo(a,e-2,t);if(n<e)return n;e--}return 0}function yn(a,e){let t=a.charCodeAt(e);if(!so(t)||e+1==a.length)return t;let n=a.charCodeAt(e+1);return oo(n)?(t-55296<<10)+(n-56320)+65536:t}function oo(a){return a>=56320&&a<57344}function so(a){return a>=55296&&a<56320}function ao(a){return a<65536?1:2}class ie{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Bt(this,e,t);let l=[];return this.decompose(0,e,l,2),n.length&&n.decompose(0,n.length,l,3),this.decompose(t,this.length,l,1),je.from(l,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Bt(this,e,t);let n=[];return this.decompose(e,t,n,0),je.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),l=new Ht(this),o=new Ht(e);for(let s=t,r=t;;){if(l.next(s),o.next(s),s=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(r+=l.value.length,l.done||r>=n)return!0}}iter(e=1){return new Ht(this,e)}iterRange(e,t=this.length){return new co(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;n=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ho(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?ie.empty:e.length<=32?new he(e):je.from(he.split(e,[]))}}class he extends ie{constructor(e,t=dh(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((t?n:r)>=e)return new hh(l,r,n,s);l=r+1,n++}}decompose(e,t,n,l){let o=e<=0&&t>=this.length?this:new he(ro(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=Si(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new he(r,s.length+o.length));else{let c=r.length>>1;n.push(new he(r.slice(0,c)),new he(r.slice(c)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof he))return super.replace(e,t,n);[e,t]=Bt(this,e,t);let l=Si(this.text,Si(n.text,ro(this.text,0,e)),t),o=this.length+n.length-(t-e);return l.length<=32?new he(l,o):je.from(he.split(l,[]),o)}sliceString(e,t=this.length,n=`
15
- `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<=t&&s<this.text.length;s++){let r=this.text[s],c=o+r.length;o>e&&s&&(l+=n),e<c&&t>o&&(l+=r.slice(Math.max(0,e-o),t-o)),o=c+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],l=-1;for(let o of e)n.push(o),l+=o.length+1,n.length==32&&(t.push(new he(n,l)),n=[],l=-1);return l>-1&&t.push(new he(n,l)),t}}class je extends ie{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.children[o],r=l+s.length,c=n+s.lines-1;if((t?c:r)>=e)return s.lineInner(e,t,n,l);l=r+1,n=c+1}}decompose(e,t,n,l){for(let o=0,s=0;s<=t&&o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e<=c&&t>=s){let h=l&((s<=e?1:0)|(c>=t?2:0));s>=e&&c<=t&&!h?n.push(r):r.decompose(e-s,t-s,n,h)}s=c+1}}replace(e,t,n){if([e,t]=Bt(this,e,t),n.lines<this.lines)for(let l=0,o=0;l<this.children.length;l++){let s=this.children[l],r=o+s.length;if(e>=o&&t<=r){let c=s.replace(e-o,t-o,n),h=this.lines-s.lines+c.lines;if(c.lines<h>>4&&c.lines>h>>6){let f=this.children.slice();return f[l]=c,new je(f,this.length-(t-e)+n.length)}return super.replace(o,r,c)}o=r+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
16
- `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<this.children.length&&s<=t;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=n),e<c&&t>s&&(l+=r.sliceString(e-s,t-s,n)),s=c+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof je))return 0;let n=0,[l,o,s,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==s||o==r)return n;let c=this.children[l],h=e.children[o];if(c!=h)return n+c.scanIdentical(h,t);n+=c.length+1}}static from(e,t=e.reduce((n,l)=>n+l.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let b of e)b.flatten(m);return new he(m,t)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,h=-1,f=[];function d(m){let b;if(m.lines>o&&m instanceof je)for(let y of m.children)d(y);else m.lines>s&&(c>s||!c)?(p(),r.push(m)):m instanceof he&&c&&(b=f[f.length-1])instanceof he&&m.lines+b.lines<=32?(c+=m.lines,h+=m.length+1,f[f.length-1]=new he(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>l&&p(),c+=m.lines,h+=m.length+1,f.push(m))}function p(){c!=0&&(r.push(f.length==1?f[0]:je.from(f,h)),h=-1,c=f.length=0)}for(let m of e)d(m);return p(),r.length==1?r[0]:new je(r,t)}}ie.empty=new he([""],0);function dh(a){let e=-1;for(let t of a)e+=t.length+1;return e}function Si(a,e,t=0,n=1e9){for(let l=0,o=0,s=!0;o<a.length&&l<=n;o++){let r=a[o],c=l+r.length;c>=t&&(c>n&&(r=r.slice(0,n-l)),l<t&&(r=r.slice(t-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function ro(a,e,t){return Si(a,[""],e,t)}class Ht{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof he?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,l=this.nodes[n],o=this.offsets[n],s=o>>1,r=l instanceof he?l.text.length:l.children.length;if(s==(t>0?r:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
17
- `,this;e--}else if(l instanceof he){let c=l.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof he?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class co{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Ht(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=n?l:t<0?l.slice(l.length-n):l.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class ho{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},Ht.prototype[Symbol.iterator]=co.prototype[Symbol.iterator]=ho.prototype[Symbol.iterator]=function(){return this});class hh{constructor(e,t,n,l){this.from=e,this.to=t,this.number=n,this.text=l}get length(){return this.to-this.from}}function Bt(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}function Xe(a,e,t=!0,n=!0){return rh(a,e,t,n)}const wn=/\r\n?|\n/;var Re=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Re||(Re={}));class Ze{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,l=0;t<this.sections.length;){let o=this.sections[t++],s=this.sections[t++];s<0?(e(n,l,o),l+=o):l+=s,n+=o}}iterChangedRanges(e,t=!1){An(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];l<0?e.push(n,l):e.push(l,n)}return new Ze(e)}composeDesc(e){return this.empty?e:e.empty?this:fo(this,e)}mapDesc(e,t=!1){return e.empty?this:xn(this,e,t)}mapPos(e,t=-1,n=Re.Simple){let l=0,o=0;for(let s=0;s<this.sections.length;){let r=this.sections[s++],c=this.sections[s++],h=l+r;if(c<0){if(h>e)return o+(e-l);o+=r}else{if(n!=Re.Simple&&h>=e&&(n==Re.TrackDel&&l<e&&h>e||n==Re.TrackBefore&&l<e||n==Re.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?o:o+c;o+=c}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let n=0,l=0;n<this.sections.length&&l<=t;){let o=this.sections[n++],s=this.sections[n++],r=l+o;if(s>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+n+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ze(e)}static create(e){return new Ze(e)}}class ge extends Ze{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return An(this,(t,n,l,o,s)=>e=e.replace(l,l+(n-t),s),!1),e}mapDesc(e,t=!1){return xn(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let l=0,o=0;l<t.length;l+=2){let s=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=s;let c=l>>1;for(;n.length<c;)n.push(ie.empty);n.push(s?e.slice(o,o+s):ie.empty)}o+=s}return new ge(t,n)}compose(e){return this.empty?e:e.empty?this:fo(this,e,!0)}map(e,t=!1){return e.empty?this:xn(this,e,t,!0)}iterChanges(e,t=!1){An(this,e,t)}get desc(){return Ze.create(this.sections)}filter(e){let t=[],n=[],l=[],o=new Kt(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let f=Math.min(o.len,c-r);Ae(l,f,-1);let d=o.ins==-1?-1:o.off==0?o.ins:0;Ae(t,f,d),d>0&&ct(n,t,o.text),o.forward(f),r+=f}let h=e[s++];for(;r<h;){if(o.done)break e;let f=Math.min(o.len,h-r);Ae(t,f,-1),Ae(l,f,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(f),r+=f}}return{changes:new ge(t,n),filtered:Ze.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],l=this.sections[t+1];l<0?e.push(n):l==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let l=[],o=[],s=0,r=null;function c(f=!1){if(!f&&!l.length)return;s<t&&Ae(l,t-s,-1);let d=new ge(l,o);r=r?r.compose(d.map(r)):d,l=[],o=[],s=0}function h(f){if(Array.isArray(f))for(let d of f)h(d);else if(f instanceof ge){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);c(),r=r?r.compose(f.map(r)):f}else{let{from:d,to:p=d,insert:m}=f;if(d>p||d<0||p>t)throw new RangeError(`Invalid change range ${d} to ${p} (in doc of length ${t})`);let b=m?typeof m=="string"?ie.of(m.split(n||wn)):m:ie.empty,y=b.length;if(d==p&&y==0)return;d<s&&c(),d>s&&Ae(l,d-s,-1),Ae(l,p-d,y),ct(o,l,b),s=p}}return h(e),c(!r),r}static empty(e){return new ge(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,r)=>r&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;n.length<l;)n.push(ie.empty);n[l]=ie.of(o.slice(1)),t.push(o[0],n[l].length)}}}return new ge(t,n)}static createSet(e,t){return new ge(e,t)}}function Ae(a,e,t,n=!1){if(e==0&&t<=0)return;let l=a.length-2;l>=0&&t<=0&&t==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=t:n?(a[l]+=e,a[l+1]+=t):a.push(e,t)}function ct(a,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<n;)a.push(ie.empty);a.push(t)}}function An(a,e,t){let n=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let h=l,f=o,d=ie.empty;for(;h+=r,f+=c,c&&n&&(d=d.append(n[s-2>>1])),!(t||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,h,o,f,d),l=h,o=f}}}function xn(a,e,t,n=!1){let l=[],o=n?[]:null,s=new Kt(a),r=new Kt(e);for(let c=-1;;){if(s.done&&r.len||r.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&r.ins==-1){let h=Math.min(s.len,r.len);Ae(l,h,-1),s.forward(h),r.forward(h)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!t))){let h=r.len;for(Ae(l,r.ins,-1);h;){let f=Math.min(s.len,h);s.ins>=0&&c<s.i&&s.len<=f&&(Ae(l,0,s.ins),o&&ct(o,l,s.text),c=s.i),s.forward(f),h-=f}r.next()}else if(s.ins>=0){let h=0,f=s.len;for(;f;)if(r.ins==-1){let d=Math.min(f,r.len);h+=d,f-=d,r.forward(d)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;Ae(l,h,c<s.i?s.ins:0),o&&c<s.i&&ct(o,l,s.text),c=s.i,s.forward(s.len-f)}else{if(s.done&&r.done)return o?ge.createSet(l,o):Ze.create(l);throw new Error("Mismatched change set lengths")}}}function fo(a,e,t=!1){let n=[],l=t?[]:null,o=new Kt(a),s=new Kt(e);for(let r=!1;;){if(o.done&&s.done)return l?ge.createSet(n,l):Ze.create(n);if(o.ins==0)Ae(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ae(n,0,s.ins,r),l&&ct(l,n,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let c=Math.min(o.len2,s.len),h=n.length;if(o.ins==-1){let f=s.ins==-1?-1:s.off?0:s.ins;Ae(n,c,f,r),l&&f&&ct(l,n,s.text)}else s.ins==-1?(Ae(n,o.off?0:o.len,c,r),l&&ct(l,n,o.textBit(c))):(Ae(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&ct(l,n,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||n.length>h),o.forward2(c),s.forward(c)}}}}class Kt{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ie.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?ie.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class bt{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,l;return this.empty?n=l=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),n==this.from&&l==this.to?this:new bt(n,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,n){return new bt(e,t,n)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,H.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>bt.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=n:o.from<n)return H.normalized(e.slice(),t);n=o.to}return new H(e,t)}static cursor(e,t=0,n,l){return bt.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(l??16777215)<<6)}static range(e,t,n,l){let o=(n??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?bt.create(t,e,48|o):bt.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort((l,o)=>l.from-o.from),t=e.indexOf(n);for(let l=1;l<e.length;l++){let o=e[l],s=e[l-1];if(o.empty?o.from<=s.to:o.from<s.to){let r=s.from,c=Math.max(o.to,s.to);l<=t&&t--,e.splice(--l,2,o.anchor>o.head?H.range(c,r):H.range(r,c))}}return new H(e,t)}}function uo(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Cn=0;class G{constructor(e,t,n,l,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=l,this.id=Cn++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new G(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:vn),!!e.static,e.enables)}of(e){return new Bi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function vn(a,e){return a==e||a.length==e.length&&a.every((t,n)=>t===e[n])}class Bi{constructor(e,t,n,l){this.dependencies=e,this.facet=t,this.type=n,this.value=l,this.id=Cn++}dynamicSlot(e){var t;let n=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,h=!1,f=[];for(let d of this.dependencies)d=="doc"?c=!0:d=="selection"?h=!0:((t=e[d.id])!==null&&t!==void 0?t:1)&1||f.push(e[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,p){if(c&&p.docChanged||h&&(p.docChanged||p.selection)||Sn(d,f)){let m=n(d);if(r?!po(m,d.values[s],l):!l(m,d.values[s]))return d.values[s]=m,1}return 0},reconfigure:(d,p)=>{let m,b=p.config.address[o];if(b!=null){let y=Ei(p,b);if(this.dependencies.every(A=>A instanceof G?p.facet(A)===d.facet(A):A instanceof yt?p.field(A,!1)==d.field(A,!1):!0)||(r?po(m=n(d),y,l):l(m=n(d),y)))return d.values[s]=y,0}else m=n(d);return d.values[s]=m,1}}}}function po(a,e,t){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(!t(a[n],e[n]))return!1;return!0}function Sn(a,e){let t=!1;for(let n of e)Jt(a,n)&1&&(t=!0);return t}function fh(a,e,t){let n=t.map(c=>a[c.id]),l=t.map(c=>c.type),o=n.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let h=[];for(let f=0;f<n.length;f++){let d=Ei(c,n[f]);if(l[f]==2)for(let p of d)h.push(p);else h.push(d)}return e.combine(h)}return{create(c){for(let h of n)Jt(c,h);return c.values[s]=r(c),1},update(c,h){if(!Sn(c,o))return 0;let f=r(c);return e.compare(f,c.values[s])?0:(c.values[s]=f,1)},reconfigure(c,h){let f=Sn(c,n),d=h.config.facets[e.id],p=h.facet(e);if(d&&!f&&vn(t,d))return c.values[s]=p,0;let m=r(c);return e.compare(m,p)?(c.values[s]=p,0):(c.values[s]=m,1)}}}const Ni=G.define({static:!0});class yt{constructor(e,t,n,l,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let t=new yt(Cn++,e.create,e.update,e.compare||((n,l)=>n===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ni).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,l)=>{let o=n.values[t],s=this.updateF(o,l);return this.compareF(o,s)?0:(n.values[t]=s,1)},reconfigure:(n,l)=>{let o=n.facet(Ni),s=l.facet(Ni),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(n.values[t]=r.create(n),1):l.config.address[this.id]!=null?(n.values[t]=l.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Ni.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function Gt(a){return e=>new mo(e,a)}const uh={highest:Gt(wt.highest),high:Gt(wt.high),default:Gt(wt.default),low:Gt(wt.low),lowest:Gt(wt.lowest)};class mo{constructor(e,t){this.inner=e,this.prec=t}}class Vi{of(e){return new Bn(this,e)}reconfigure(e){return Vi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bn{constructor(e,t){this.compartment=e,this.inner=t}}class Ri{constructor(e,t,n,l,o,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let l=[],o=Object.create(null),s=new Map;for(let p of ph(e,t,s))p instanceof yt?l.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let r=Object.create(null),c=[],h=[];for(let p of l)r[p.id]=h.length<<1,h.push(m=>p.slot(m));let f=n?.config.facets;for(let p in o){let m=o[p],b=m[0].facet,y=f&&f[p]||[];if(m.every(A=>A.type==0))if(r[b.id]=c.length<<1|1,vn(y,m))c.push(n.facet(b));else{let A=b.combine(m.map(x=>x.value));c.push(n&&b.compare(A,n.facet(b))?n.facet(b):A)}else{for(let A of m)A.type==0?(r[A.id]=c.length<<1|1,c.push(A.value)):(r[A.id]=h.length<<1,h.push(x=>A.dynamicSlot(x)));r[b.id]=h.length<<1,h.push(A=>fh(A,b,m))}}let d=h.map(p=>p(r));return new Ri(e,s,d,r,c,o)}}function ph(a,e,t){let n=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let h=n[c].indexOf(s);h>-1&&n[c].splice(h,1),s instanceof Bn&&t.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let h of s)o(h,r);else if(s instanceof Bn){if(t.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(s.compartment)||s.inner;t.set(s.compartment,h),o(h,r)}else if(s instanceof mo)o(s.inner,s.prec);else if(s instanceof yt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Bi)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,wt.default);else{let h=s.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(h,r)}}return o(a,wt.default),n.reduce((s,r)=>s.concat(r))}function Jt(a,e){if(e&1)return 2;let t=e>>1,n=a.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;a.status[t]=4;let l=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|l}function Ei(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const go=G.define(),Nn=G.define({combine:a=>a.some(e=>e),static:!0}),ko=G.define({combine:a=>a.length?a[0]:void 0,static:!0}),bo=G.define(),yo=G.define(),wo=G.define(),Ao=G.define({combine:a=>a.length?a[0]:!1});class Nt{constructor(e,t){this.type=e,this.value=t}static define(){return new mh}}class mh{of(e){return new Nt(this,e)}}class gh{constructor(e){this.map=e}of(e){return new pe(this,e)}}class pe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new pe(this.type,t)}is(e){return this.type==e}static define(e={}){return new gh(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let l of e){let o=l.map(t);o&&n.push(o)}return n}}pe.reconfigure=pe.define(),pe.appendConfig=pe.define();class xe{constructor(e,t,n,l,o,s){this.startState=e,this.changes=t,this.selection=n,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&uo(n,t.newLength),o.some(r=>r.type==xe.time)||(this.annotations=o.concat(xe.time.of(Date.now())))}static create(e,t,n,l,o,s){return new xe(e,t,n,l,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(xe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}xe.time=Nt.define(),xe.userEvent=Nt.define(),xe.addToHistory=Nt.define(),xe.remote=Nt.define();function kh(a,e){let t=[];for(let n=0,l=0;;){let o,s;if(n<a.length&&(l==e.length||e[l]>=a[n]))o=a[n++],s=a[n++];else if(l<e.length)o=e[l++],s=e[l++];else return t;!t.length||t[t.length-1]<o?t.push(o,s):t[t.length-1]<s&&(t[t.length-1]=s)}}function xo(a,e,t){var n;let l,o,s;return t?(l=e.changes,o=ge.empty(e.changes.length),s=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),o=a.changes.mapDesc(e.changes,!0),s=a.changes.compose(l)),{changes:s,selection:e.selection?e.selection.map(o):(n=a.selection)===null||n===void 0?void 0:n.map(l),effects:pe.mapEffects(a.effects,l).concat(pe.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Vn(a,e,t){let n=e.selection,l=Vt(e.annotations);return e.userEvent&&(l=l.concat(xe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ge?e.changes:ge.of(e.changes||[],t,a.facet(ko)),selection:n&&(n instanceof H?n:H.single(n.anchor,n.head)),effects:Vt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Co(a,e,t){let n=Vn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let s=!!e[o].sequential;n=xo(n,Vn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=xe.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return yh(t?bh(l):l)}function bh(a){let e=a.startState,t=!0;for(let l of e.facet(bo)){let o=l(a);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:kh(t,o))}if(t!==!0){let l,o;if(t===!1)o=a.changes.invertedDesc,l=ge.empty(e.doc.length);else{let s=a.changes.filter(t);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=xe.create(e,l,a.selection&&a.selection.map(o),pe.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(yo);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof xe?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof xe?a=o[0]:a=Co(e,Vt(o),!1)}return a}function yh(a){let e=a.startState,t=e.facet(wo),n=a;for(let l=t.length-1;l>=0;l--){let o=t[l](a);o&&Object.keys(o).length&&(n=xo(n,Vn(e,o,a.changes.newLength),!0))}return n==a?a:xe.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const wh=[];function Vt(a){return a==null?wh:Array.isArray(a)?a:[a]}var et=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(et||(et={}));const Ah=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Rn;try{Rn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function xh(a){if(Rn)return Rn.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ah.test(t)))return!0}return!1}function Ch(a){return e=>{if(!/\S/.test(e))return et.Space;if(xh(e))return et.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return et.Word;return et.Other}}class oe{constructor(e,t,n,l,o,s){this.config=e,this.doc=t,this.selection=n,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Jt(this,r<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Jt(this,n),Ei(this,n)}update(...e){return Co(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:l}=t;for(let r of e.effects)r.is(Vi.reconfigure)?(t&&(l=new Map,t.compartments.forEach((c,h)=>l.set(h,c)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(pe.reconfigure)?(t=null,n=r.value):r.is(pe.appendConfig)&&(t=null,n=Vt(n).concat(r.value));let o;t?o=e.startState.values.slice():(t=Ri.resolve(n,l,this),o=new oe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let s=e.startState.facet(Nn)?e.newSelection:e.newSelection.asSingle();new oe(t,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),l=this.changes(n.changes),o=[n.range],s=Vt(n.effects);for(let r=1;r<t.ranges.length;r++){let c=e(t.ranges[r]),h=this.changes(c.changes),f=h.map(l);for(let p=0;p<r;p++)o[p]=o[p].map(f);let d=l.mapDesc(h,!0);o.push(c.range.map(d)),l=l.compose(f),s=pe.mapEffects(s,f).concat(pe.mapEffects(Vt(c.effects),d))}return{changes:l,selection:H.create(o,t.mainIndex),effects:s}}changes(e=[]){return e instanceof ge?e:ge.of(e,this.doc.length,this.facet(oe.lineSeparator))}toText(e){return ie.of(e.split(this.facet(oe.lineSeparator)||wn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Jt(this,t),Ei(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let l=e[n];l instanceof yt&&this.config.address[l.id]!=null&&(t[n]=l.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let s=n[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return oe.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Ri.resolve(e.extensions||[],new Map),n=e.doc instanceof ie?e.doc:ie.of((e.doc||"").split(t.staticFacet(oe.lineSeparator)||wn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return uo(l,n.length),t.staticFacet(Nn)||(l=l.asSingle()),new oe(t,n,l,t.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(oe.tabSize)}get lineBreak(){return this.facet(oe.lineSeparator)||`
18
- `}get readOnly(){return this.facet(Ao)}phrase(e,...t){for(let n of this.facet(oe.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?n:t[o-1]})),e}languageDataAt(e,t,n=-1){let l=[];for(let o of this.facet(go))for(let s of o(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return Ch(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-n,r=e-n;for(;s>0;){let c=Xe(t,s,!1);if(o(t.slice(c,s))!=et.Word)break;s=c}for(;r<l;){let c=Xe(t,r);if(o(t.slice(r,c))!=et.Word)break;r=c}return s==r?null:H.range(s+n,r+n)}}oe.allowMultipleSelections=Nn,oe.tabSize=G.define({combine:a=>a.length?a[0]:4}),oe.lineSeparator=ko,oe.readOnly=Ao,oe.phrases=G.define({compare(a,e){let t=Object.keys(a),n=Object.keys(e);return t.length==n.length&&t.every(l=>a[l]==e[l])}}),oe.languageData=go,oe.changeFilter=bo,oe.transactionFilter=yo,oe.transactionExtender=wo,Vi.reconfigure=pe.define();class Rt{eq(e){return this==e}range(e,t=e){return Xt.create(e,t,this)}}Rt.prototype.startSide=Rt.prototype.endSide=0,Rt.prototype.point=!1,Rt.prototype.mapMode=Re.TrackDel;class Xt{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Xt(e,t,n)}}function En(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class On{constructor(e,t,n,l){this.from=e,this.to=t,this.value=n,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,l=0){let o=n?this.to:this.from;for(let s=l,r=o.length;;){if(s==r)return s;let c=s+r>>1,h=o[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==s)return h>=0?s:r;h>=0?r=c:s=c+1}}between(e,t,n,l){for(let o=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,t){let n=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let h=this.value[c],f=this.from[c]+e,d=this.to[c]+e,p,m;if(f==d){let b=t.mapPos(f,h.startSide,h.mapMode);if(b==null||(p=m=b,h.startSide!=h.endSide&&(m=t.mapPos(f,h.endSide),m<p)))continue}else if(p=t.mapPos(f,h.startSide),m=t.mapPos(d,h.endSide),p>m||p==m&&h.startSide>0&&h.endSide<=0)continue;(m-p||h.endSide-h.startSide)<0||(s<0&&(s=p),h.point&&(r=Math.max(r,m-p)),n.push(h),l.push(p-s),o.push(m-s))}return{mapped:n.length?new On(l,o,n,r):null,pos:s}}}class ce{constructor(e,t,n,l){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=l}static create(e,t,n,l){return new ce(e,t,n,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(t.length==0&&!s)return this;if(n&&(t=t.slice().sort(En)),this.isEmpty)return t.length?ce.of(t):this;let r=new So(this,null,-1).goto(0),c=0,h=[],f=new Oi;for(;r.value||c<t.length;)if(c<t.length&&(r.from-t[c].from||r.startSide-t[c].value.startSide)>=0){let d=t[c++];f.addInner(d.from,d.to,d.value)||h.push(d)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(r.chunkIndex)<t[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&f.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(f.addInner(r.from,r.to,r.value)||h.push(Xt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?ce.empty:this.nextLayer.update({add:h,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],l=-1;for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],c=this.chunk[s],h=e.touchesRange(r,r+c.length);if(h===!1)l=Math.max(l,c.maxPoint),t.push(c),n.push(e.mapPos(r));else if(h===!0){let{mapped:f,pos:d}=c.map(r,e);f&&(l=Math.max(l,f.maxPoint),t.push(f),n.push(d))}}let o=this.nextLayer.map(e);return t.length==0?o:new ce(n,t,o||ce.empty,l)}between(e,t,n){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(t>=o&&e<=o+s.length&&s.between(o,e-o,t-o,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Zt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Zt.from(e).goto(t)}static compare(e,t,n,l,o=-1){let s=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),r=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),c=vo(s,r,n),h=new ei(s,c,o),f=new ei(r,c,o);n.iterGaps((d,p,m)=>Bo(h,d,f,p,m,l)),n.empty&&n.length==0&&Bo(h,0,f,0,0,l)}static eq(e,t,n=0,l){l==null&&(l=999999999);let o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=vo(o,s),c=new ei(o,r,0).goto(n),h=new ei(s,r,0).goto(n);for(;;){if(c.to!=h.to||!Tn(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>l)return!0;c.next(),h.next()}}static spans(e,t,n,l,o=-1){let s=new ei(e,null,o).goto(t),r=t,c=s.openStart;for(;;){let h=Math.min(s.to,n);if(s.point){let f=s.activeForPoint(s.to),d=s.pointFrom<t?f.length+1:s.point.startSide<0?f.length:Math.min(f.length,c);l.point(r,h,s.point,f,d,s.pointRank),c=Math.min(s.openEnd(h),f.length)}else h>r&&(l.span(r,h,s.active,c),c=s.openEnd(h));if(s.to>n)return c+(s.point&&s.to>n?1:0);r=s.to,s.next()}}static of(e,t=!1){let n=new Oi;for(let l of e instanceof Xt?[e]:t?vh(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return ce.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=ce.empty;l=l.nextLayer)t=new ce(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}ce.empty=new ce([],[],null,-1);function vh(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let n=a[t];if(En(e,n)>0)return a.slice().sort(En);e=n}return a}ce.empty.nextLayer=ce.empty;class Oi{finishChunk(e){this.chunks.push(new On(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Oi)).add(e,t,n)}addInner(e,t,n){let l=e-this.lastTo||n.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ce.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function vo(a,e,t){let n=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&n.set(o.chunk[s],o.chunkPos[s]);let l=new Set;for(let o of e)for(let s=0;s<o.chunk.length;s++){let r=n.get(o.chunk[s]);r!=null&&(t?t.mapPos(r):r)==o.chunkPos[s]&&!t?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class So{constructor(e,t,n,l=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Zt{constructor(e){this.heap=e}static from(e,t=null,n=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&l.push(new So(s,t,n,o));return l.length==1?l[0]:new Zt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Mn(this.heap,0)}}}function Mn(a,e){for(let t=a[e];;){let n=(e<<1)+1;if(n>=a.length)break;let l=a[n];if(n+1<a.length&&l.compare(a[n+1])>=0&&(l=a[n+1],n++),t.compare(l)<0)break;a[n]=t,a[e]=l,e=n}}class ei{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Zt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Mi(this.active,e),Mi(this.activeTo,e),Mi(this.activeRank,e),this.minActive=No(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:l,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Ti(this.active,t,n),Ti(this.activeTo,t,l),Ti(this.activeRank,t,o),e&&Ti(e,t,this.cursor.from),this.minActive=No(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),n&&Mi(n,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let l=n.length-1;l>=0&&n[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Bo(a,e,t,n,l,o){a.goto(e),t.goto(n);let s=n+l,r=n,c=n-e;for(;;){let h=a.to+c-t.to,f=h||a.endSide-t.endSide,d=f<0?a.to+c:t.to,p=Math.min(d,s);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&Tn(a.activeForPoint(a.to),t.activeForPoint(t.to))||o.comparePoint(r,p,a.point,t.point):p>r&&!Tn(a.active,t.active)&&o.compareRange(r,p,a.active,t.active),d>s)break;(h||a.openEnd!=t.openEnd)&&o.boundChange&&o.boundChange(d),r=d,f<=0&&a.next(),f>=0&&t.next()}}function Tn(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function Mi(a,e){for(let t=e,n=a.length-1;t<n;t++)a[t]=a[t+1];a.pop()}function Ti(a,e,t){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=t}function No(a,e){let t=-1,n=1e9;for(let l=0;l<e.length;l++)(e[l]-n||a[l].endSide-a[t].endSide)<0&&(t=l,n=e[l]);return t}function Sh(a,e,t,n){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?t-o%t:1,l=Xe(a,l)}return n===!0?-1:a.length}const In="ͼ",Vo=typeof Symbol>"u"?"__"+In:Symbol.for(In),Fn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class dt{constructor(e,t){this.rules=[];let{finish:n}=t||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,h){let f=[],d=/^@(\w+)\b/.exec(s[0]),p=d&&d[1]=="keyframes";if(d&&r==null)return c.push(s[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(y=>s.map(A=>y.replace(/&/,A))).reduce((y,A)=>y.concat(A)),b,c);else if(b&&typeof b=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),b,f,p)}else b!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+b+";")}(f.length||p)&&c.push((n&&!d&&!h?s.map(n):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
14
+ }]`}],onConfirm:g=>{const S=g.find(V=>V.name==="valueSets")?.value;if(!S)return;const I=g.find(V=>V.name==="code")?.value;t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,code:I,value:null,valueSets:JSON.parse(S)}})}});break;case ae.ControlType.DATE:new De({title:"日期控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"},{type:"select",label:"日期格式",name:"dateFormat",value:"yyyy-MM-dd hh:mm:ss",required:!0,options:[{label:"yyyy-MM-dd hh:mm:ss",value:"yyyy-MM-dd hh:mm:ss"},{label:"yyyy-MM-dd",value:"yyyy-MM-dd"}]}],onConfirm:g=>{const S=g.find(F=>F.name==="placeholder")?.value;if(!S)return;const I=g.find(F=>F.name==="value")?.value||"",V=g.find(F=>F.name==="dateFormat")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,dateFormat:V,value:I?[{value:I}]:null,placeholder:S}})}});break;case ae.ControlType.NUMBER:new De({title:"数值控件",data:[{type:"text",label:"占位符",name:"placeholder",required:!0,placeholder:"请输入占位符"},{type:"text",label:"默认值",name:"value",placeholder:"请输入默认值"}],onConfirm:g=>{const S=g.find(V=>V.name==="placeholder")?.value;if(!S)return;const I=g.find(V=>V.name==="value")?.value||"";t.editor?.command.executeInsertControl({type:ae.ElementType.CONTROL,value:"",control:{type:E,value:I?[{value:I}]:null,placeholder:S}})}});break}}return i.onMounted(()=>{window.addEventListener("click",E=>{const g=n.value?.querySelector(".visible");!g||g.contains(E.target)||g.classList.remove("visible")},{capture:!0}),t.editor&&(t.editor.listener.rangeStyleChange=E=>{i.nextTick(()=>{if(E.type===ae.ElementType.TEXT){const g=n.value,S=g.querySelector(".menu-item__font .select");S&&(S.textContent=E.font);const I=g.querySelector(".menu-item__size .select");if(I){const T={56:"初号",48:"小初",34:"一号",32:"小一",29:"二号",24:"小二",21:"三号",20:"小三",18:"四号",16:"小四",14:"五号",12:"小五",10:"六号",8:"小六",7:"七号",6:"八号"};I.textContent=T[E.size]||"小四"}const V=g.querySelector(".menu-item__bold");V&&V.classList.toggle("active",E.bold);const F=g.querySelector(".menu-item__italic");F&&F.classList.toggle("active",E.italic);const $=g.querySelector(".menu-item__underline");$&&$.classList.toggle("active",E.underline);const D=g.querySelector(".menu-item__strikeout");D&&D.classList.toggle("active",E.strikeout);const Q=g.querySelector(".menu-item__color span");Q&&(Q.style.backgroundColor=E.color||"#000000");const L=g.querySelector(".menu-item__highlight span");L&&(L.style.backgroundColor=E.highlight);const O=g.querySelector(".menu-item__title .select");if(O){const T={null:"正文",first:"标题1",second:"标题2",third:"标题3",fourth:"标题4",fifth:"标题5",sixth:"标题6"};O.textContent=T[E.level]||"正文"}["left","center","right","alignment","justify"].forEach(T=>{const _=g.querySelector(`.menu-item__${T}`);_&&_.classList.toggle("active",E.rowFlex===T)})}})})}),e({getHeight:o,getWidth:s}),(E,g)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"dom",ref:n,class:"unione-rich-toolbar menu","editor-component":"menu"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(S,I)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[S=="Undo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__undo",key:S,title:`撤销(${i.unref(r)?"⌘":"Ctrl"}+Z)`,onClick:g[0]||(g[0]=V=>c("Undo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Mr)})`})},null,4)],8,xc)):i.createCommentVNode("",!0),S=="Redo"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__redo",key:S,title:`重做(${i.unref(r)?"⌘":"Ctrl"}+Y)`,onClick:g[1]||(g[1]=V=>c("Redo"))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Tr)})`})},null,4)],8,Cc)):i.createCommentVNode("",!0),S=="Painter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__painter",key:S,title:"格式刷(双击可连续使用)",onClick:p,onDblclick:m},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ir)})`})},null,4)],32)):i.createCommentVNode("",!0),S=="Format"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__format",key:S,title:"清除格式",onClick:g[2]||(g[2]=V=>c("Format")),"data-item":"Format"},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Fr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Divider"?(i.openBlock(),i.createElementBlock("div",{class:"menu-divider",key:S+I,"data-item":"Divider"})):i.createCommentVNode("",!0),S=="Font"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__font",onClick:g[19]||(g[19]=V=>h("menu-item__font",V)),style:{display:"none"},key:S},[g[99]||(g[99]=i.createElementVNode("span",{class:"select",title:"字体"},"微软雅黑",-1)),i.createElementVNode("div",{class:"options",ref_for:!0,ref:"fontOptions"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[3]||(g[3]=V=>c("Font","Microsoft YaHei")),style:{"font-family":"'Microsoft YaHei'"}}," 微软雅黑 "),i.createElementVNode("li",{onClick:g[4]||(g[4]=V=>c("Font","华文宋体")),style:{"font-family":"'华文宋体'"}}," 华文宋体 "),i.createElementVNode("li",{onClick:g[5]||(g[5]=V=>c("Font","华文黑体")),style:{"font-family":"'华文黑体'"}}," 华文黑体 "),i.createElementVNode("li",{onClick:g[6]||(g[6]=V=>c("Font","华文仿宋")),style:{"font-family":"'华文仿宋'"}}," 华文仿宋 "),i.createElementVNode("li",{onClick:g[7]||(g[7]=V=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[8]||(g[8]=V=>c("Font","华文琥珀")),style:{"font-family":"'华文琥珀'"}}," 华文琥珀 "),i.createElementVNode("li",{onClick:g[9]||(g[9]=V=>c("Font","华文楷体")),style:{"font-family":"'华文楷体'"}}," 华文楷体 "),i.createElementVNode("li",{onClick:g[10]||(g[10]=V=>c("Font","华文隶书")),style:{"font-family":"'华文隶书'"}}," 华文隶书 "),i.createElementVNode("li",{onClick:g[11]||(g[11]=V=>c("Font","华文新魏")),style:{"font-family":"'华文新魏'"}}," 华文新魏 "),i.createElementVNode("li",{onClick:g[12]||(g[12]=V=>c("Font","华文行楷")),style:{"font-family":"'华文行楷'"}}," 华文行楷 "),i.createElementVNode("li",{onClick:g[13]||(g[13]=V=>c("Font","华文中宋")),style:{"font-family":"'华文中宋'"}}," 华文中宋 "),i.createElementVNode("li",{onClick:g[14]||(g[14]=V=>c("Font","华文彩云")),style:{"font-family":"'华文彩云'"}}," 华文彩云 "),i.createElementVNode("li",{onClick:g[15]||(g[15]=V=>c("Font","Arial")),style:{"font-family":"'Arial'"}},"Arial"),i.createElementVNode("li",{onClick:g[16]||(g[16]=V=>c("Font","Segoe UI")),style:{"font-family":"'Segoe UI'"}}," Segoe UI "),i.createElementVNode("li",{onClick:g[17]||(g[17]=V=>c("Font","Ink Free")),style:{"font-family":"'Ink Free'"}}," Ink Free "),i.createElementVNode("li",{onClick:g[18]||(g[18]=V=>c("Font","Fantasy")),style:{"font-family":"'Fantasy'"}},"Fantasy")])],512)])):i.createCommentVNode("",!0),S=="Size"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size",onClick:g[36]||(g[36]=V=>h("menu-item__size",V)),key:S},[g[100]||(g[100]=i.createElementVNode("span",{class:"select",title:"字体"},"小四",-1)),i.createElementVNode("div",vc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{onClick:g[20]||(g[20]=V=>c("Size",56))},"初号"),i.createElementVNode("li",{onClick:g[21]||(g[21]=V=>c("Size",48))},"小初"),i.createElementVNode("li",{onClick:g[22]||(g[22]=V=>c("Size",34))},"一号"),i.createElementVNode("li",{onClick:g[23]||(g[23]=V=>c("Size",32))},"小一"),i.createElementVNode("li",{onClick:g[24]||(g[24]=V=>c("Size",29))},"二号"),i.createElementVNode("li",{onClick:g[25]||(g[25]=V=>c("Size",24))},"小二"),i.createElementVNode("li",{onClick:g[26]||(g[26]=V=>c("Size",21))},"三号"),i.createElementVNode("li",{onClick:g[27]||(g[27]=V=>c("Size",20))},"小三"),i.createElementVNode("li",{onClick:g[28]||(g[28]=V=>c("Size",18))},"四号"),i.createElementVNode("li",{onClick:g[29]||(g[29]=V=>c("Size",16))},"小四"),i.createElementVNode("li",{onClick:g[30]||(g[30]=V=>c("Size",14))},"五号"),i.createElementVNode("li",{onClick:g[31]||(g[31]=V=>c("Size",12))},"小五"),i.createElementVNode("li",{onClick:g[32]||(g[32]=V=>c("Size",10))},"六号"),i.createElementVNode("li",{onClick:g[33]||(g[33]=V=>c("Size",8))},"小六"),i.createElementVNode("li",{onClick:g[34]||(g[34]=V=>c("Size",7))},"七号"),i.createElementVNode("li",{onClick:g[35]||(g[35]=V=>c("Size",6))},"八号")])])])):i.createCommentVNode("",!0),S=="SizeAdd"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-add",onClick:g[37]||(g[37]=V=>c("SizeAdd")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Dr)})`})},null,4)])):i.createCommentVNode("",!0),S=="SizeMinus"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__size-minus",onClick:g[38]||(g[38]=V=>c("SizeMinus")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(_r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Bold"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__bold",onClick:g[39]||(g[39]=V=>c("Bold")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Pr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Italic"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__italic",onClick:g[40]||(g[40]=V=>c("Italic")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref($r)})`})},null,4)])):i.createCommentVNode("",!0),S=="Underline"?(i.openBlock(),i.createElementBlock("div",{title:`下划线(${i.unref(r)?"⌘":"Ctrl"}+U)`,class:"menu-item menu-item__underline",onClick:g[46]||(g[46]=V=>h("menu-item__underline",V)),"data-item":"Underline",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Lr)})`})},null,4),g[101]||(g[101]=i.createElementVNode("span",{class:"select"},null,-1)),i.createElementVNode("div",Bc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-decoration-style":"solid",onClick:g[41]||(g[41]=V=>c("Underline",{style:"solid"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"double",onClick:g[42]||(g[42]=V=>c("Underline",{style:"double"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(mc)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dashed",onClick:g[43]||(g[43]=V=>c("Underline",{style:"dashed"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"dotted",onClick:g[44]||(g[44]=V=>c("Underline",{style:"dotted"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-decoration-style":"wavy",onClick:g[45]||(g[45]=V=>c("Underline",{style:"wavy"}))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(gc)})`})},null,4)])])])],8,Sc)):i.createCommentVNode("",!0),S=="Strikeout"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__strikeout",title:"删除线(Ctrl+Shift+X)",onClick:g[47]||(g[47]=V=>c("Strikeout")),"data-item":"Strikeout",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ur)})`})},null,4)])):i.createCommentVNode("",!0),S=="Superscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__superscript",onClick:g[48]||(g[48]=V=>c("Superscript")),"data-item":"Superscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(zr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Subscript"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__subscript",onClick:g[49]||(g[49]=V=>c("Subscript")),"data-item":"Subscript",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(jr)})`})},null,4)])):i.createCommentVNode("",!0),S=="Color"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__color",title:"字体颜色",onClick:v,"data-item":"Color",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(qr)})`})},null,4),g[102]||(g[102]=i.createElementVNode("span",null,null,-1)),g[103]||(g[103]=i.createElementVNode("input",{type:"color",class:"input-color"},null,-1))])):i.createCommentVNode("",!0),S=="Highlight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__highlight",title:"高亮",onClick:C,"data-item":"Highlight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Qr)})`})},null,4),g[104]||(g[104]=i.createElementVNode("span",null,null,-1)),g[105]||(g[105]=i.createElementVNode("input",{type:"color",class:"input-highlight"},null,-1))])):i.createCommentVNode("",!0),S=="Title"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__title",onClick:g[57]||(g[57]=V=>h("menu-item__title",V)),"data-item":"Title",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Wr)})`})},null,4),g[106]||(g[106]=i.createElementVNode("span",{class:"select",title:"切换标题"},"正文",-1)),i.createElementVNode("div",Nc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{style:{"font-size":"16px"},onClick:g[50]||(g[50]=V=>c("Title",null))},"正文"),i.createElementVNode("li",{"data-level":"first",style:{"font-size":"26px"},onClick:g[51]||(g[51]=V=>c("Title","first"))},"标题1"),i.createElementVNode("li",{"data-level":"second",style:{"font-size":"24px"},onClick:g[52]||(g[52]=V=>c("Title","second"))},"标题2"),i.createElementVNode("li",{"data-level":"third",style:{"font-size":"22px"},onClick:g[53]||(g[53]=V=>c("Title","third"))},"标题3"),i.createElementVNode("li",{"data-level":"fourth",style:{"font-size":"20px"},onClick:g[54]||(g[54]=V=>c("Title","fourth"))},"标题4"),i.createElementVNode("li",{"data-level":"fifth",style:{"font-size":"18px"},onClick:g[55]||(g[55]=V=>c("Title","fifth"))},"标题5"),i.createElementVNode("li",{"data-level":"sixth",style:{"font-size":"16px"},onClick:g[56]||(g[56]=V=>c("Title","sixth"))},"标题6")])])])):i.createCommentVNode("",!0),S=="RowFlexLeft"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__left",onClick:g[58]||(g[58]=V=>c("RowFlex","left")),title:`左对齐(${i.unref(r)?"⌘":"Ctrl"}+L)`,"data-item":"RowFlexLeft",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Yr)})`})},null,4)],8,Vc)):i.createCommentVNode("",!0),S=="RowFlexCenter"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__center",onClick:g[59]||(g[59]=V=>c("RowFlex","center")),title:`居中对齐(${i.unref(r)?"⌘":"Ctrl"}+E)`,"data-item":"RowFlexCenter",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Hr)})`})},null,4)],8,Rc)):i.createCommentVNode("",!0),S=="RowFlexRight"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__right",onClick:g[60]||(g[60]=V=>c("RowFlex","right")),title:`右对齐(${i.unref(r)?"⌘":"Ctrl"}+R)`,"data-item":"RowFlexRight",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Kr)})`})},null,4)],8,Ec)):i.createCommentVNode("",!0),S=="RowFlexAlignment"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__alignment",onClick:g[61]||(g[61]=V=>c("RowFlex","alignment")),title:`两端对齐(${i.unref(r)?"⌘":"Ctrl"}+J)`,"data-item":"RowFlexAlignment",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Gr)})`})},null,4)],8,Oc)):i.createCommentVNode("",!0),S=="RowFlexJustify"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__justify",onClick:g[62]||(g[62]=V=>c("RowFlex","justify")),title:`分散对齐(${i.unref(r)?"⌘":"Ctrl"}+Shift+J)`,"data-item":"RowFlexJustify",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Jr)})`})},null,4)],8,Mc)):i.createCommentVNode("",!0),S=="RowMargin"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__row-margin",onClick:g[71]||(g[71]=V=>h("menu-item__row-margin",V)),"data-item":"RowMargin",key:S},[i.createElementVNode("i",{title:"行间距",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Xr)})`})},null,4),i.createElementVNode("div",Tc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-rowmargin":"1",onClick:g[63]||(g[63]=V=>c("RowMargin",1))},"1"),i.createElementVNode("li",{"data-rowmargin":"1.25",onClick:g[64]||(g[64]=V=>c("RowMargin",1.25))},"1.25"),i.createElementVNode("li",{"data-rowmargin":"1.5",onClick:g[65]||(g[65]=V=>c("RowMargin",1.5))},"1.5"),i.createElementVNode("li",{"data-rowmargin":"1.75",onClick:g[66]||(g[66]=V=>c("RowMargin",1.75))},"1.75"),i.createElementVNode("li",{"data-rowmargin":"2",onClick:g[67]||(g[67]=V=>c("RowMargin",2))},"2"),i.createElementVNode("li",{"data-rowmargin":"2.5",onClick:g[68]||(g[68]=V=>c("RowMargin",2.5))},"2.5"),i.createElementVNode("li",{"data-rowmargin":"3",onClick:g[69]||(g[69]=V=>c("RowMargin",3))},"3"),i.createElementVNode("li",{"data-rowmargin":"5",onClick:g[70]||(g[70]=V=>c("RowMargin",5))},"5")])])])):i.createCommentVNode("",!0),S=="List"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__list",onClick:g[77]||(g[77]=V=>h("menu-item__list",V)),key:S},[i.createElementVNode("i",{title:"列表",style:i.normalizeStyle({backgroundImage:`url(${i.unref(Zr)})`})},null,4),i.createElementVNode("div",Ic,[i.createElementVNode("ul",null,[g[112]||(g[112]=i.createElementVNode("li",null,[i.createElementVNode("label",null,"取消列表")],-1)),i.createElementVNode("li",{"data-list-type":"ol","data-list-style":"decimal",onClick:g[72]||(g[72]=V=>c("List",["ol","decimal"]))},g[107]||(g[107]=[i.createElementVNode("label",null,"有序列表:",-1),i.createElementVNode("ol",null,[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"checkbox",onClick:g[73]||(g[73]=V=>c("List",["ul","checkbox"]))},g[108]||(g[108]=[i.createElementVNode("label",null,"复选框列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☑️ '"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"disc",onClick:g[74]||(g[74]=V=>c("List",["ul","disc"]))},g[109]||(g[109]=[i.createElementVNode("label",null,"实心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"disc"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"circle",onClick:g[75]||(g[75]=V=>c("List",["ul","circle"]))},g[110]||(g[110]=[i.createElementVNode("label",null,"空心圆点列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"circle"}},[i.createElementVNode("li",null,"________")],-1)])),i.createElementVNode("li",{"data-list-type":"ul","data-list-style":"square",onClick:g[76]||(g[76]=V=>c("List",["ul","square"]))},g[111]||(g[111]=[i.createElementVNode("label",null,"空心方块列表:",-1),i.createElementVNode("ul",{style:{"list-style-type":"'☐ '"}},[i.createElementVNode("li",null,"________")],-1)]))])])])):i.createCommentVNode("",!0),S=="Table"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__table",onClick:w,key:S},[i.createElementVNode("i",{title:"表格",style:i.normalizeStyle({backgroundImage:`url(${i.unref(tc)})`})},null,4),g[113]||(g[113]=i.createStaticVNode('<div class="menu-item__table__collapse" data-v-b97ae666><div class="table-close" data-v-b97ae666>×</div><div class="table-title" data-v-b97ae666><span class="table-select" data-v-b97ae666>插入</span><span data-v-b97ae666>表格</span></div><div class="table-panel" data-v-b97ae666><table data-v-b97ae666><tbody data-v-b97ae666><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr><tr class="table-row" data-v-b97ae666><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td><td class="table-cel" data-v-b97ae666></td></tr></tbody></table></div></div>',1))])):i.createCommentVNode("",!0),S=="Image"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__image",onClick:R,key:S},[i.createElementVNode("i",{title:"图片",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ec)})`})},null,4),g[114]||(g[114]=i.createElementVNode("input",{type:"file",class:"image",accept:".png, .jpg, .jpeg, .png, .gif"},null,-1))])):i.createCommentVNode("",!0),S=="Hyperlink"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__hyperlink",onClick:k,key:S},[i.createElementVNode("i",{title:"超链接",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ic)})`})},null,4)])):i.createCommentVNode("",!0),S=="Separator"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__separator",onClick:g[84]||(g[84]=V=>h("menu-item__separator",V)),key:S},[i.createElementVNode("i",{title:"分割线",style:i.normalizeStyle({backgroundImage:`url(${i.unref(nc)})`})},null,4),i.createElementVNode("div",Fc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-separator":"0,0",onClick:g[78]||(g[78]=V=>c("Separator",[0,0]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(El)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"1,1",onClick:g[79]||(g[79]=V=>c("Separator",[1,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ml)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"3,1",onClick:g[80]||(g[80]=V=>c("Separator",[3,1]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ol)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"4,4",onClick:g[81]||(g[81]=V=>c("Separator",[4,4]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(kc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"7,3,3,3",onClick:g[82]||(g[82]=V=>c("Separator",[7,3,3,3]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(bc)})`})},null,4)]),i.createElementVNode("li",{"data-separator":"6,2,2,2,2,2",onClick:g[83]||(g[83]=V=>c("Separator",[6,2,2,2,2,2]))},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(yc)})`})},null,4)])])])])):i.createCommentVNode("",!0),S=="Watermark"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__watermark",onClick:g[87]||(g[87]=V=>h("menu-item__watermark",V)),key:S},[i.createElementVNode("i",{title:"水印(添加、删除)",style:i.normalizeStyle({backgroundImage:`url(${i.unref(lc)})`})},null,4),i.createElementVNode("div",Dc,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-menu":"add",onClick:g[85]||(g[85]=V=>u("add"))},"添加水印"),i.createElementVNode("li",{"data-menu":"delete",onClick:g[86]||(g[86]=V=>u("delete"))},"删除水印")])])])):i.createCommentVNode("",!0),S=="Codeblock"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__codeblock",title:"代码块",onClick:N,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(oc)})`})},null,4)])):i.createCommentVNode("",!0),S=="PageBreak"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__page-break",title:"分页符",key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(sc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Control"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__control",onClick:g[94]||(g[94]=V=>h("menu-item__control",V)),key:S},[i.createElementVNode("i",{title:"控件",style:i.normalizeStyle({backgroundImage:`url(${i.unref(ac)})`})},null,4),i.createElementVNode("div",_c,[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-control":"text",onClick:g[88]||(g[88]=V=>B("text"))},"文本"),i.createElementVNode("li",{"data-control":"number",onClick:g[89]||(g[89]=V=>B("number"))},"数值"),i.createElementVNode("li",{"data-control":"select",onClick:g[90]||(g[90]=V=>B("select"))},"列举"),i.createElementVNode("li",{"data-control":"date",onClick:g[91]||(g[91]=V=>B("date"))},"日期"),i.createElementVNode("li",{"data-control":"checkbox",onClick:g[92]||(g[92]=V=>B("checkbox"))},"复选框"),i.createElementVNode("li",{"data-control":"radio",onClick:g[93]||(g[93]=V=>B("radio"))},"单选框")])])])):i.createCommentVNode("",!0),S=="Checkbox"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__checkbox",title:"复选框",onClick:g[95]||(g[95]=V=>y("checkbox")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(rc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Radio"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__radio",title:"单选框",onClick:g[96]||(g[96]=V=>y("radio")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(cc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Latex"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__latex",title:"LateX",onClick:b,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(dc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Date"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__date",onClick:g[97]||(g[97]=V=>A("menu-item__date",V)),key:S},[i.createElementVNode("i",{title:"日期",style:i.normalizeStyle({backgroundImage:`url(${i.unref(hc)})`})},null,4),g[115]||(g[115]=i.createElementVNode("div",{class:"options"},[i.createElementVNode("ul",null,[i.createElementVNode("li",{"data-format":"yyyy-MM-dd","label-format":"YYYY-MM-DD"}),i.createElementVNode("li",{"data-format":"yyyy-MM-dd hh:mm:ss","label-format":"YYYY-MM-DD HH:mm:ss"})])],-1))])):i.createCommentVNode("",!0),S=="Block"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__block",title:"内容块",onClick:x,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(fc)})`})},null,4)])):i.createCommentVNode("",!0),S=="Search"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search","data-menu":"search",onClick:M,key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(uc)})`})},null,4)])):i.createCommentVNode("",!0),S=="SearchCollapse"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__search__collapse","data-menu":"search","data-item":"SearchCollapse",key:S},[i.createElementVNode("div",Pc,[g[116]||(g[116]=i.createElementVNode("input",{type:"text"},null,-1)),g[117]||(g[117]=i.createElementVNode("label",{class:"search-result"},null,-1)),i.createElementVNode("div",$c,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(wc)})`})},null,4)]),i.createElementVNode("div",Lc,[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(Ac)})`})},null,4)]),g[118]||(g[118]=i.createElementVNode("span",null,"×",-1))]),g[119]||(g[119]=i.createElementVNode("div",{class:"menu-item menu-item__search__collapse__replace"},[i.createElementVNode("input",{type:"text"}),i.createElementVNode("button",null,"替换")],-1))])):i.createCommentVNode("",!0),S=="Print"?(i.openBlock(),i.createElementBlock("div",{class:"menu-item menu-item__print","data-menu":"print",onClick:g[98]||(g[98]=V=>c("Print")),key:S},[i.createElementVNode("i",{style:i.normalizeStyle({backgroundImage:`url(${i.unref(pc)})`})},null,4)])):i.createCommentVNode("",!0)],64))),256))],512))}}),[["__scopeId","data-v-b97ae666"]]),zc=ee(i.defineComponent({__name:"richText",props:i.mergeModels({wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1},model:{type:String,default:"edit"},options:{type:Object,default:()=>({})},toolbar:{type:Array,default:()=>["simple"]}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(a,{expose:e}){const t=a,n=i.useModel(a,"value"),l=i.ref(!1),o=i.computed(()=>t.editor?.widget(t.wid)||t.widget||{}),s=i.computed(()=>t.editor?.model.value||t.model);i.computed(()=>o.value.props||{});const r=i.ref(),c=i.ref(),h=i.ref(),f=i.ref();i.onMounted(()=>{i.nextTick(()=>{d()}),window.addEventListener("click",()=>{l.value=!1})});function d(){const p=r.value.getWidth(),m=r.value.getHeight()-(c.value?.getHeight()||0)||200;console.log("width:"+p+",height:"+m);const b=JSON.parse(JSON.stringify(t.options));f.value=new ae.Editor(h.value,[],{mode:s.value=="edit"||s.value=="run"?"edit":"readonly",locale:"zhCN",defaultType:"TEXT",defaultColor:"#000000",defaultFont:"Microsoft YaHei",defaultSize:16,minSize:5,maxSize:72,defaultRowMargin:1,defaultBasicRowMarginHeight:3,defaultTabWidth:32,width:p,height:m,scale:1,pageGap:0,underlineColor:"#000000",strikeoutColor:"#FF0000",rangeAlpha:.6,rangeColor:"#AECBFA",rangeMinWidth:5,searchMatchAlpha:.6,searchMatchColor:"#FFFF00",searchNavigateMatchColor:"#AAD280",highlightAlpha:.6,highlightMarginHeight:8,resizerColor:"#4182D9",resizerSize:5,marginIndicatorSize:35,marginIndicatorColor:"#BABABA",margins:[10,10,10,10],pageMode:"continuity",renderMode:"speed",defaultHyperlinkColor:"#0000FF",paperDirection:"vertical",inactiveAlpha:.6,historyMaxRecordCount:100,wordBreak:"break-word",printPixelRatio:3,maskMargin:[0,0,0,0],letterClass:["A-Za-z"],contextMenuDisableKeys:[],shortcutDisableKeys:[],scrollContainerSelector:"",pageOuterSelectionDisable:!1,placeholder:{data:"请输入正文",color:"#DCDFE6",opacity:1,size:16,font:"Microsoft YaHei"},zone:{tipDisabled:!1},table:{tdPadding:[0,5,5,5],defaultTrMinHeight:42,defaultColMinWidth:40,defaultBorderColor:"#000000"},header:{top:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},footer:{bottom:30,inactiveAlpha:1,maxHeightRadio:"half",disabled:!0,editable:!0},control:{placeholderColor:"#9c9b9b",bracketColor:"#000000",prefix:"{",postfix:"}",borderWidth:1,borderColor:"#000000",activeBackgroundColor:"",disabledBackgroundColor:"",existValueBackgroundColor:"",noValueBackgroundColor:""},checkbox:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#ffffff",verticalAlign:"bottom"},radio:{width:14,height:14,gap:5,lineWidth:1,fillStyle:"#5175f4",strokeStyle:"#000000",verticalAlign:"bottom"},cursor:{width:1,color:"#000000",dragWidth:2,dragColor:"#0000FF",dragFloatImageDisabled:!1},title:{defaultFirstSize:26,defaultSecondSize:24,defaultThirdSize:22,defaultFourthSize:20,defaultFifthSize:18,defaultSixthSize:16},group:{opacity:.1,backgroundColor:"#E99D00",activeOpacity:.5,activeBackgroundColor:"#E99D00",disabled:!0,deletable:!0},pageBreak:{font:"Microsoft YaHei",fontSize:12,lineDash:[3,1]},background:{color:"#FFFFFF",image:"",size:"cover",repeat:"no-repeat",applyPageNumbers:[]},lineBreak:{disabled:!0,color:"#CCCCCC",lineWidth:1},separator:{lineWidth:1,strokeStyle:"#000000"},lineNumber:{size:12,font:"Microsoft YaHei",color:"#000000",disabled:!0,right:20,type:"continuity"},pageBorder:{color:"#000000",lineWidth:1,padding:[0,5,0,5],disabled:!0},badge:{top:0,left:5},modeRule:{print:{imagePreviewerDisabled:!1},readonly:{imagePreviewerDisabled:!1},form:{controlDeletableDisabled:!1}},...b}),f.value.listener.contentChange=()=>{f.value.command.getValueAsync().then(({data:y})=>{n.value=JSON.stringify(y)})},n.value&&(typeof n.value=="string"?n.value=JSON.parse(n.value):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}return i.watch(n,()=>{l.value==!1&&n.value&&f.value&&(typeof n.value=="string"?n.value=JSON.parse(n.value):Object.keys(n.value).length?f.value.command.executeSetValue(JSON.parse(JSON.stringify(n.value))):f.value.command.executeSetValue({header:[],main:[],footer:[]}))}),i.watch(s,()=>{f.value?.command.executeMode(s.value=="edit"||s.value=="run"?"edit":"readonly")}),e({}),(p,m)=>(i.openBlock(),i.createBlock(lt,{class:"unione-rich-text",model:t.editor?.model.value,"setting-title":"富文本设置",ref_key:"richTextDom",ref:r,onClick:m[0]||(m[0]=i.withModifiers(b=>l.value=!0,["stop"]))},{default:i.withCtx(()=>[(s.value=="edit"||s.value=="run")&&f.value?(i.openBlock(),i.createBlock(Uc,{key:0,ref_key:"canvasMenuDom",ref:c,editor:f.value,items:a.toolbar},null,8,["editor","items"])):i.createCommentVNode("",!0),i.createElementVNode("div",{ref_key:"canvasEditorDom",ref:h,class:"canvas-editor"},null,512)]),_:1},8,["model"]))}}),[["__scopeId","data-v-108483bc"]]),jc={class:"page-setting-dialog"},qt=i.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(a,{emit:e}){const t=a,n=i.computed(()=>t.editor?.model?.value),l=Y.useSession(),o=i.computed(()=>l.getPrincipal()),s=i.ref(!1);i.provide("closeSetting",()=>{t.editor?.save().then(p=>{s.value=!1})});function r(){s.value=!0}function c(){t.editor?.save().then(p=>{console.log("res",p)})}function h(){t.editor?.save().then(p=>{console.log("res",p)})}const f=i.ref("");function d(p){f.value||(f.value=n.value),p?t.editor?.setModel("edit"):t.editor?.setModel(f.value)}return(p,m)=>{const b=i.resolveComponent("SettingOutlined"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("SaveOutlined"),x=i.resolveComponent("FormOutlined"),w=i.resolveComponent("StopOutlined"),R=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-page",n.value])},[n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:0,title:a.settingTitle},{default:i.withCtx(()=>[i.createVNode(b,{class:"page-setting",onClick:r})]),_:1},8,["title"])):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:1,title:"保存页面"},{default:i.withCtx(()=>[i.createVNode(A,{class:"btn-save",onClick:c})]),_:1})):i.createCommentVNode("",!0),n.value!="edit"&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:2,title:"编辑页面"},{default:i.withCtx(()=>[i.createVNode(x,{class:"btn-edit",onClick:m[0]||(m[0]=k=>d(!0))})]),_:1})):i.createCommentVNode("",!0),n.value=="edit"&&p.$slots["page-setting"]&&o.value?.userRoles?.includes("FORM-ADMIN")?(i.openBlock(),i.createBlock(y,{key:3,title:"退出编辑"},{default:i.withCtx(()=>[i.createVNode(w,{class:"btn-edit",onClick:m[1]||(m[1]=k=>d(!1))})]),_:1})):i.createCommentVNode("",!0),i.renderSlot(p.$slots,"default"),n.value=="edit"?(i.openBlock(),i.createBlock(R,{key:4,title:t.settingTitle,open:s.value,"onUpdate:open":m[2]||(m[2]=k=>s.value=k),centered:"",width:"85%",onOk:h},{default:i.withCtx(()=>[i.createElementVNode("div",jc,[i.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):i.createCommentVNode("",!0)],2)}}}),qc={class:"unione-props-setting data-field-manage"},Qc={key:0},Wc={key:1},Yc={key:2},Hc={key:3},Kc={key:4},Gc={key:5},Jc={key:6},Xc=["onClick"],Zc=["onClick"],ed=["onClick"],td={key:1},id=ee(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"defaultValue",key:"defaultValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncDbEnable",key:"syncDbEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(m=>{n.value.selectedRowKeys.includes(m)||n.value.selectedRowKeys.push(m);const b=[];t.value.forEach(y=>{!p.includes(y.name)&&n.value.selectedRowKeys.includes(y.name)&&b.push(y.name)}),b.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(y=>!b.includes(y)))})}}),l={mounted:p=>p.focus()},o=i.ref({});function s(){const p=Object.keys(o.value);if(p.length)for(let m in p){const b=t.value.filter(y=>y.name==m);if(b&&b[0]){let y=o.value[m];Object.keys(y).forEach(A=>{b[0][A]=y[A]})}}o.value={}}function r(p,m){s();const b={};b[m]=p[m]||"",o.value[p.name]=b}function c(p,m){if(!p||!m){o.value={};return}const b=o.value[p.name][m];if(m=="name"&&t.value.filter(A=>A[m]==b&&A.name!=p.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+b+"]已存在"});return}p[m]=b,o.value={}}function h(p,m){t.value.filter(y=>y.name==p.name).forEach(y=>{y[m]=!y[m]})}function f(){if(s(),t.value.filter(b=>b.name=="new_").length>0){o.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),o.value[m.name]={name:"new_"}}function d(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(p=>!n.value.selectedRowKeys.includes(p.name)),n.value.selectedRowKeys=[]}})}return(p,m)=>{const b=i.resolveComponent("a-button"),y=i.resolveComponent("a-tooltip"),A=i.resolveComponent("a-input"),x=i.resolveComponent("a-input-number"),w=i.resolveComponent("a-select-option"),R=i.resolveComponent("a-select"),k=i.resolveComponent("a-checkbox"),u=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",qc,[i.createVNode(b,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:i.withCtx(()=>m[1]||(m[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(b,{class:"btn btn-delete",type:"primary",danger:"",onClick:d,size:"small"},{default:i.withCtx(()=>m[2]||(m[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(u,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:i.withCtx(({column:N})=>[N.key==="name"?(i.openBlock(),i.createElementBlock("span",Qc,[m[3]||(m[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="title"?(i.openBlock(),i.createElementBlock("span",Wc,[m[4]||(m[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="descs"?(i.openBlock(),i.createElementBlock("span",Yc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataLen"?(i.openBlock(),i.createElementBlock("span",Hc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataPrec"?(i.openBlock(),i.createElementBlock("span",Kc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="defaultValue"?(i.openBlock(),i.createElementBlock("span",Gc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="dataType"?(i.openBlock(),i.createElementBlock("span",Jc,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(N.title),1)])):i.createCommentVNode("",!0),N.key==="isPk"?(i.openBlock(),i.createBlock(y,{key:7,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[m[5]||(m[5]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isFk"?(i.openBlock(),i.createBlock(y,{key:8,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="isNull"?(i.openBlock(),i.createBlock(y,{key:9,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0),N.key==="syncDbEnable"?(i.openBlock(),i.createBlock(y,{key:10,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(N.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:N,text:M,record:v})=>[["name","title","descs","defaultValue"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(A,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Xc)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[v.name][N.dataIndex],"onUpdate:value":C=>o.value[v.name][N.dataIndex]=C,onBlur:C=>c(v,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M||" "),1)],64))],10,Zc)):["dataType"].includes(N.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[v.name]||!Object.keys(o.value[v.name]).includes(N.dataIndex))&&!M&&"empty"]),onClick:C=>r(v,N.dataIndex)},[o.value[v.name]&&Object.keys(o.value[v.name]).includes(N.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(R,{key:0,value:v[N.dataIndex],"onUpdate:value":C=>v[N.dataIndex]=C,onBlur:m[0]||(m[0]=C=>c())},{default:i.withCtx(()=>[i.createVNode(w,{key:"String",value:"String"}),i.createVNode(w,{key:"Long",value:"Long"}),i.createVNode(w,{key:"Short",value:"Short"}),i.createVNode(w,{key:"Integer",value:"Integer"}),i.createVNode(w,{key:"Float",value:"Float"}),i.createVNode(w,{key:"Double",value:"Double"}),i.createVNode(w,{key:"Date",value:"Date"}),i.createVNode(w,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",td,i.toDisplayString(M),1))],10,ed)):["syncDbEnable","isFk","isPk"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:3,checked:v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(N.dataIndex)?(i.openBlock(),i.createBlock(k,{key:4,checked:!v[N.dataIndex],onClick:C=>h(v,N.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),nd={class:"unione-props-setting data-field-setting"},ld={key:0},od=["onClick"],sd={class:"field-txt"},ad=["onClick"],rd={key:1,class:"field-txt"},cd=["onClick"],dd={key:1},hd=["onClick"],fd={key:0,class:"field-txt"},ud={key:4,class:"edit-field"},pd={key:0},md=["onClick"],gd=ee(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:x})=>x+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"isForm",key:"isForm",width:"40px",align:"center"},{title:"详情",dataIndex:"isView",key:"isView",width:"40px",align:"center"},{title:"列表",dataIndex:"isList",key:"isList",width:"40px",align:"center"},{title:"排序",dataIndex:"isSort",key:"isSort",width:"40px",align:"center"},{title:"查询",dataIndex:"isQuery",key:"isQuery",width:"40px",align:"center"},{title:"查询类型",dataIndex:"queryType",key:"queryType",width:"60px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),t=i.useModel(a,"modelValue"),n={mounted:x=>x.focus()},l=i.ref({});function o(){const x=Object.keys(l.value);if(x.length)for(let w in x){const R=t.value.filter(k=>k.name==w);if(R&&R[0]){let k=l.value[w];Object.keys(k).forEach(u=>{u=="convertName"?(R[0].convert||(R[0].convert={}),R[0].convert.type=k[u]):R[0][u]=k[u]})}}l.value={}}function s(x,w){o();const R={};w=="convertName"?(x.convert||(x.convert={}),R[w]=x.convert?.type):R[w]=x[w]||"",l.value[x.name]=R}function r(x,w){{l.value={};return}}function c(x,w){t.value.filter(k=>k.name==x.name).forEach(k=>{k[w]=!k[w]})}const h=i.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{h.value.visible=!1}});function f(x,w){const R=t.value.filter(u=>u.name==x.name);R.forEach(u=>{w!="isSort"?u[w]=!0:u[w]=!u[w]});const k=R[0];if(!(!k||w=="isSort")){switch(h.value.prop=w,h.value.field=x,k.show||(k.show={}),w){case"isQuery":k.show.query||(k.show.query={}),h.value.show=k.show.query,h.value.title=`查询设置/${x.title}(${x.name})`;break;case"isForm":k.show.form||(k.show.form={}),h.value.show=k.show.form,h.value.title=`表单设置/${x.title}(${x.name})`;break;case"isView":k.show.view||(k.show.view={}),h.value.show=k.show.view,h.value.title=`详情设置/${x.title}(${x.name})`;break;case"isList":k.show.list||(k.show.list={}),h.value.show=k.show.list,h.value.title=`列头设置/${x.title}(${x.name})`;break}h.value.visible=!0}}const d=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:x=>{const w=d.value.options.filter(R=>R.value==x);return w[0]?w[0].label:x}}),p=i.ref({visible:!1,field:{},props:{},showInfo:x=>{let w="";return x.rules&&(w=x.rules.filter(R=>R.enable).length||""),w&&(w="("+w+")"),w},toSetting:()=>{const x=p.value.props,w={name:"range",trigger:x.trigger,whitespace:x.whitespace,message:x.rangeMessage};x.rangeMin!=null&&x.rangeMin!=null&&(w.min=x.rangeMin,w.enable=!0),x.rangeMax!=null&&x.rangeMax!=null&&(w.max=x.rangeMax,w.enable=!0);const R={name:"reg",trigger:x.trigger,whitespace:x.whitespace,message:x.regMessage};x.regExpress&&(R.pattern=x.regExpress,R.enable=!0),p.value.field.rules=[w,R],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function m(x){p.value.visible=!0,p.value.field=x;const w=x.rules||[],R={trigger:"change",whitespace:!0};w.forEach(k=>{k.name=="reg"&&(R.trigger=k.trigger,R.whitespace=k.whitespace,R.regExpress=k.pattern,R.regMessage=k.message),k.name=="range"&&(R.rangeMin=k.min,R.rangeMax=k.max,R.rangeMessage=k.message)}),p.value.props=R}const b=i.ref({visible:!1,field:{},props:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-textarea",label:"文本域"},{value:"a-input",label:"文本框"},{value:"a-checkbox",label:"多选框"},{value:"a-radio",label:"单选框"},{value:"a-input-number",label:"数值框"},{value:"a-select",label:"下拉框"},{value:"a-tree-select",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-switch",label:"开关"},{value:"a-slider",label:"滑块"}],widgetName:x=>{const w=b.value.widgets.filter(R=>R.value==x);return w[0]?w[0].label:x},toSetting:()=>{}}),y=i.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{y.value.convert.options||(y.value.convert.options=[]),y.value.convert.options.push({label:"",value:""})},toDelOption:(x,w)=>{y.value.convert.options.splice(x,1)},toSetting:()=>{y.value.visible=!1}});function A(x){y.value.visible=!0,y.value.field=x,y.value.convert=x.convert||{}}return(x,w)=>{const R=i.resolveComponent("ToolOutlined"),k=i.resolveComponent("a-button"),u=i.resolveComponent("a-select"),N=i.resolveComponent("a-checkbox"),M=i.resolveComponent("a-table"),v=i.resolveComponent("a-input-number"),C=i.resolveComponent("a-form-item"),B=i.resolveComponent("a-input"),E=i.resolveComponent("a-form"),g=i.resolveComponent("a-modal"),S=i.resolveComponent("a-col"),I=i.resolveComponent("a-row"),V=i.resolveComponent("a-select-option"),F=i.resolveComponent("a-divider"),$=i.resolveComponent("a-checkbox-group");return i.openBlock(),i.createElementBlock("div",nd,[i.createVNode(M,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:D})=>[["widget","queryType","rules","convertName"].includes(D.key)?(i.openBlock(),i.createElementBlock("span",ld,[i.createVNode(R),i.createTextVNode(" "+i.toDisplayString(D.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:D,text:Q,record:L})=>[["rules"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!p.value.showInfo(L)&&"empty"]),onClick:O=>m(L)},[i.createElementVNode("span",sd,i.toDisplayString(p.value.showInfo(L)),1),p.value.showInfo(L)?(i.openBlock(),i.createBlock(k,{key:0,type:"link"},{default:i.withCtx(()=>w[22]||(w[22]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,od)):["widget"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L[D.dataIndex],"onUpdate:value":O=>L[D.dataIndex]=O,allowClear:!0,options:b.value.widgets,onBlur:w[0]||(w[0]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",rd,i.toDisplayString(b.value.widgetName(Q)),1))],10,ad)):["queryType"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:2},[L.isQuery?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!Q&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L[D.dataIndex],"onUpdate:value":O=>L[D.dataIndex]=O,allowClear:!0,options:d.value.options,onBlur:w[1]||(w[1]=O=>r())},null,8,["value","onUpdate:value","options"])),[[n]]):(i.openBlock(),i.createElementBlock("span",dd,i.toDisplayString(d.value.showLabel(Q)),1))],10,cd)):i.createCommentVNode("",!0)],64)):["convertName"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!l.value[L.name]||!Object.keys(l.value[L.name]).includes(D.dataIndex))&&!L.convert?.type&&"empty"]),onClick:O=>s(L,D.dataIndex)},[l.value[L.name]&&Object.keys(l.value[L.name]).includes(D.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(u,{key:0,value:L.convert.type,"onUpdate:value":O=>L.convert.type=O,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:w[2]||(w[2]=O=>r())},null,8,["value","onUpdate:value"])),[[n]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[L.convert?.type?(i.openBlock(),i.createElementBlock("span",fd,i.toDisplayString(L.convert.type=="dict"?"字典":"静态"),1)):i.createCommentVNode("",!0),L.convert?.type?(i.openBlock(),i.createBlock(k,{key:1,type:"link",onClick:i.withModifiers(O=>A(L),["stop"])},{default:i.withCtx(()=>w[23]||(w[23]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,hd)):["isQuery","isForm","isView","isList","isSort"].includes(D.dataIndex)?(i.openBlock(),i.createElementBlock("div",ud,[i.createVNode(N,{checked:L[D.dataIndex],onClick:O=>c(L,D.dataIndex)},null,8,["checked","onClick"]),i.createVNode(k,{type:"link",onClick:O=>f(L,D.dataIndex)},{default:i.withCtx(()=>w[24]||(w[24]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(g,{visible:h.value.visible,"onUpdate:visible":w[9]||(w[9]=D=>h.value.visible=D),title:h.value.title,onOk:h.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:h.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(C,{label:"显示顺序"},{default:i.withCtx(()=>[i.createVNode(v,{value:h.value.show.index,"onUpdate:value":w[3]||(w[3]=D=>h.value.show.index=D)},null,8,["value"])]),_:1}),["isQuery"].includes(h.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"显示宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.width,"onUpdate:value":w[4]||(w[4]=D=>h.value.show.width=D)},null,8,["value"])]),_:1})),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:1,label:"标题宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.labelWidth,"onUpdate:value":w[5]||(w[5]=D=>h.value.show.labelWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isForm","isView"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:2,label:"控件宽度"},{default:i.withCtx(()=>[i.createVNode(B,{value:h.value.show.valueWidth,"onUpdate:value":w[6]||(w[6]=D=>h.value.show.valueWidth=D)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:3,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.fixed,"onUpdate:value":w[7]||(w[7]=D=>h.value.show.fixed=D),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["isList"].includes(h.value.prop)?(i.openBlock(),i.createBlock(C,{key:4,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(u,{value:h.value.show.align,"onUpdate:value":w[8]||(w[8]=D=>h.value.show.align=D),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:y.value.visible,"onUpdate:visible":w[11]||(w[11]=D=>y.value.visible=D),title:y.value.convert.type=="dict"?"字典设置":"选项设置",onOk:y.value.toSetting},{default:i.withCtx(()=>[y.value.convert.type!="dict"?(i.openBlock(),i.createElementBlock("div",pd,[i.createVNode(k,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:y.value.toAddOption},{default:i.withCtx(()=>w[25]||(w[25]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(M,{columns:y.value.optionColumn,"data-source":y.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:D,text:Q,record:L,index:O})=>[D.dataIndex==="label"?(i.openBlock(),i.createBlock(B,{key:0,value:L.label,"onUpdate:value":G=>L.label=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="value"?(i.openBlock(),i.createBlock(B,{key:1,value:L.value,"onUpdate:value":G=>L.value=G,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),D.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:G=>y.value.toDelOption(O,L)},"删除",8,md)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):i.createCommentVNode("",!0),y.value.convert.type=="dict"?(i.openBlock(),i.createBlock(E,{key:1,model:y.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:i.withCtx(()=>[i.createVNode(I,{type:"flex",style:{width:"100%"}},{default:i.withCtx(()=>[i.createVNode(S,{span:24,order:1},{default:i.withCtx(()=>[i.createVNode(C,{label:"字典名称:"},{default:i.withCtx(()=>[i.createVNode(B,{value:y.value.convert.dict,"onUpdate:value":w[10]||(w[10]=D=>y.value.convert.dict=D)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):i.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),i.createVNode(g,{visible:b.value.visible,"onUpdate:visible":w[13]||(w[13]=D=>b.value.visible=D),title:"控件设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:i.withCtx(()=>[b.value.field.widget=="a-select"?(i.openBlock(),i.createBlock(C,{key:0,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(u,{value:b.value.props.mode,"onUpdate:value":w[12]||(w[12]=D=>b.value.props.mode=D),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(V,{value:"multiple"},{default:i.withCtx(()=>w[26]||(w[26]=[i.createTextVNode("多选")])),_:1}),i.createVNode(V,{value:"tags"},{default:i.withCtx(()=>w[27]||(w[27]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(g,{visible:p.value.visible,"onUpdate:visible":w[21]||(w[21]=D=>p.value.visible=D),title:"规则设置",onOk:p.value.toSetting},{default:i.withCtx(()=>[i.createVNode(E,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[28]||(w[28]=[i.createTextVNode("基本设置")])),_:1}),i.createVNode(C,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode($,{value:p.value.props.trigger,"onUpdate:value":w[14]||(w[14]=D=>p.value.props.trigger=D),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(C,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(N,{value:p.value.props.whitespace,"onUpdate:value":w[15]||(w[15]=D=>p.value.props.whitespace=D),checked:p.value.props.whitespace},{default:i.withCtx(()=>w[29]||(w[29]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[30]||(w[30]=[i.createTextVNode("数值区间")])),_:1}),i.createVNode(C,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(v,{value:p.value.props.rangeMin,"onUpdate:value":w[16]||(w[16]=D=>p.value.props.rangeMin=D)},null,8,["value"]),w[31]||(w[31]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(v,{value:p.value.props.rangeMax,"onUpdate:value":w[17]||(w[17]=D=>p.value.props.rangeMax=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.rangeMessage,"onUpdate:value":w[18]||(w[18]=D=>p.value.props.rangeMessage=D)},null,8,["value"])]),_:1}),i.createVNode(F,{orientation:"left"},{default:i.withCtx(()=>w[32]||(w[32]=[i.createTextVNode("正则验证")])),_:1}),i.createVNode(C,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regExpress,"onUpdate:value":w[19]||(w[19]=D=>p.value.props.regExpress=D)},null,8,["value"])]),_:1}),i.createVNode(C,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode(B,{value:p.value.props.regMessage,"onUpdate:value":w[20]||(w[20]=D=>p.value.props.regMessage=D)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),kd={class:"unione-props-setting data-field"},bd=ee(i.defineComponent({__name:"dataField",props:i.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=i.useModel(a,"modelValue");return(t,n)=>{const l=i.resolveComponent("OrderedListOutlined"),o=i.resolveComponent("a-tab-pane"),s=i.resolveComponent("ToolOutlined"),r=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",kd,[i.createVNode(r,null,{default:i.withCtx(()=>[i.createVNode(o,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(l),n[2]||(n[2]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(id,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=c=>e.value=c)},null,8,["modelValue"])]),_:1}),i.createVNode(o,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(s),n[3]||(n[3]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(gd,{modelValue:e.value,"onUpdate:modelValue":n[1]||(n[1]=c=>e.value=c)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),yd={key:0,class:"data-model-list"},wd=["onClick"],Ad=ee(i.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(a,{expose:e}){const t=i.computed(()=>l.editor.dataModels()),n=i.ref({sn:"new_",title:"新建数据",fields:[]});i.onMounted(()=>{t.value&&t.value[0]&&(n.value=t.value[0])});const l=a;function o(d){n.value=d}function s(){if(t.value.length>=l.limit){X.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const d=pa.v4(),p={sn:d,title:"新建数据",name:"new_",fields:[]};n.value=p,console.log("data model added",p),l.editor.dataModel(d,p)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},c=i.ref(),h=i.inject("closeSetting");function f(){c.value.validate().then(d=>{h&&h()})}return e({toSaving:f}),(d,p)=>{const m=i.resolveComponent("a-input"),b=i.resolveComponent("a-form-item"),y=i.resolveComponent("a-textarea"),A=i.resolveComponent("a-form");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(i.openBlock(),i.createElementBlock("div",yd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,x=>(i.openBlock(),i.createElementBlock("div",{key:x.sn,class:i.normalizeClass(["title",n.value&&n.value.sn==x.sn&&"slt"]),onClick:w=>o(x)},i.toDisplayString(x.title),11,wd))),128)),i.createElementVNode("div",{class:"title btn-add",onClick:s},"+")])):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[i.createVNode(A,{ref_key:"formObj",ref:c,rules:r,model:n.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:i.withCtx(()=>[i.createVNode(b,{label:"数据标题",name:"title",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.title,"onUpdate:value":p[0]||(p[0]=x=>n.value.title=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据名称",name:"name",required:""},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.name,"onUpdate:value":p[1]||(p[1]=x=>n.value.name=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:i.withCtx(()=>[i.createVNode(m,{value:n.value.url,"onUpdate:value":p[2]||(p[2]=x=>n.value.url=x)},null,8,["value"])]),_:1}),i.createVNode(b,{label:"数据说明",name:"descs"},{default:i.withCtx(()=>[i.createVNode(y,{value:n.value.descs,"onUpdate:value":p[3]||(p[3]=x=>n.value.descs=x)},null,8,["value"])]),_:1})]),_:1},8,["model"]),i.createVNode(bd,{modelValue:n.value.fields,"onUpdate:modelValue":p[4]||(p[4]=x=>n.value.fields=x)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),xd={class:"unione-props-setting unione-page-setting"},Qt=ee(i.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(a){const e=a,t=i.ref({});return i.onMounted(()=>{t.value=e.editor.define.value}),(n,l)=>{const o=i.resolveComponent("a-form-item"),s=i.resolveComponent("a-input"),r=i.resolveComponent("a-switch"),c=i.resolveComponent("a-textarea"),h=i.resolveComponent("a-form"),f=i.resolveComponent("a-tab-pane"),d=i.resolveComponent("a-tabs");return i.openBlock(),i.createElementBlock("div",xd,[i.createVNode(d,{type:"card"},{default:i.withCtx(()=>[i.createVNode(f,{key:"pageDefine",tab:"页面设置"},{default:i.withCtx(()=>[i.createVNode(h,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(i.openBlock(),i.createBlock(o,{key:0,label:"页面编码"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.sn)+"/V"+i.toDisplayString(t.value.vers),1)]),_:1})):i.createCommentVNode("",!0),i.createVNode(o,{label:"页面标题",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=p=>t.value.title=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"页面组件",required:""},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=p=>t.value.component=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"icon图标"},{default:i.withCtx(()=>[i.createVNode(s,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=p=>t.value.icon=p)},null,8,["value"])]),_:1}),i.createVNode(o,{label:"是否全局"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=p=>t.value.isGlobal=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"是否模版"},{default:i.withCtx(()=>[i.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=p=>t.value.isTmpl=p),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),i.createVNode(o,{label:"页面备注"},{default:i.withCtx(()=>[i.createVNode(c,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=p=>t.value.descs=p),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),i.createVNode(f,{key:"dataDefine",tab:"数据设置"},{default:i.withCtx(()=>[i.createVNode(Ad,{editor:a.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Tl=ee(i.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){console.log("unione page view setup .....");const e=a,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},n=new ut,l=i.computed(()=>n.$widgetList.value||[]);i.watch(()=>e.pageDefine,s=>{s&&n.load(o.value,s)});const o=i.ref("new_");return i.onMounted(()=>{const s=i.inject("route");console.log("unione page view route",s),o.value=e.psn||s?.query?.psn||s?.meta?.psn||"new_",console.log("unione page view,psn:"+o.value),n.setModel("run"),n.load(o.value,e.pageDefine||t)}),(s,r)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-view","setting-title":"页面设置",editor:i.unref(n)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,c=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.render||c.widget),{key:c.wid,wid:c.wid,widget:c,editor:i.unref(n)},null,8,["wid","widget","editor"]))),128))]),_:2},[i.unref(n)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(n)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Cd={class:"form-btns"},Il=i.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(a){const e=i.inject("router"),t=a,n={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new ut,o=i.computed(()=>l.$widgetList.value||[]),s=i.computed(()=>{const d=l.define.value?.configs?.btns||[],p=d.map(m=>m.name);if(!p.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};d.splice(m.index,0,m)}if(!p.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let b=m.index||1;d.splice(b,0,m)}if(!p.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};d.splice(m.index,0,m)}if(!p.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};d.splice(m.index,0,m)}return l.model.value=="view"&&d.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),d});function r({btn:d,event:p}){d.name=="save"&&c(),d.name=="reset",d.name=="back"&&h()}async function c(){const d=l.dataManager().form();let p={};for(let m in d){const b=await d[m].validate();if(l.dataManager().psn()==m){for(let y in p)b[y]=p[y];p=b}else p[m]=b}console.log("=======form data=====",p),l.dataManager().primary().save({data:p,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function h(){e.back()}i.watch(()=>t.pageDefine,d=>{d&&l.load(f.value,d)});const f=i.ref("new_");return i.onMounted(()=>{const d=i.inject("route");console.log("unione page view route",d),f.value=t.psn||d?.query?.psn||d?.meta?.psn||"new_",console.log("unione page view,psn:"+f.value),l.setModel(d?.query?.model||d?.meta?.model||"run"),d?.query&&l.dataManager().params(d.query),l.load(f.value,t.pageDefine||n)}),(d,p)=>{const m=i.resolveComponent("unione-btn");return i.openBlock(),i.createBlock(qt,{class:"unione-page-form","setting-title":"页面设置",editor:i.unref(l)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,b=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b.widget),{key:b.wid,wid:b.wid,widget:b,editor:i.unref(l)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Cd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b.name},[b.visible!=!1?(i.openBlock(),i.createBlock(m,{key:0,widget:b,editor:i.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):i.createCommentVNode("",!0)],64))),128))])]),_:2},[i.unref(l)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),vd=["onMouseover"],Sd={key:0,class:"node-opts"},Bd={class:"form-warp"},Nd={class:"form-btns"},Fl=ee(i.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!1},setting:{type:Object,required:!0},opts:{type:Object,required:!1},btns:{type:Object,required:!1},event:{type:Object,required:!1}},emits:["btnClick","treeClick"],setup(a,{emit:e}){const t=Y.useDialog(),n=i.inject("router"),l=a,o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function s(){if(l.fields?.length){const T={widget:"unione-form",dsn:"primary",primary:!0,widgets:l.fields};o.configs.widgets=[T]}o.configs.dsnList=["primary"],r.dataManager().use("primary","form").store(l.storage),o.configs.btns=l.btns||[],l.btns==!1&&(o.configs.btns=!1),o.configs.opts=l.opts||[],l.opts==!1&&(o.configs.opts=!1),o.configs.event=l.event||{},o.configs.setting=l.setting||{}}const r=new ut,c=i.ref(!1),h=i.ref([]),f=i.ref({}),d=i.ref(null),p=i.ref(null),m=i.ref([]),b=i.ref([]),y=i.ref(0),A=i.computed(()=>{const T={searchEnable:!0,disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"pid",labelField:"title",leafField:"isLeaf",iconField:"iconName",...l.setting?.tree||{}};return r.define.value?.configs?.tree||T}),x=i.computed(()=>A.value.searchEnable),w=i.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return!1;const _=(T||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:U),q=[];return _.forEach(U=>{q.push(U.name)}),console.log("opts addBtn",_),_.filter(U=>U.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),R=i.computed(()=>{const T=r.define.value?.configs?.opts;if(typeof T=="boolean"&&T==!1)return[];const _=(T||[]).map(P=>typeof P=="string"?{name:P,visible:!1}:P),q=[],U=[];return _.forEach(P=>{U.push(P.name),P.name!="add"&&q.push(P)}),U.includes("delete")||q.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),U.includes("child")||q.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),console.log("opts menuBtn",q),q});function k({btn:T,event:_},q){_.stopPropagation();const U=f.value[q[A.value.idField]];if(console.log("onTreeMenuClick,btn:",T),console.log("onTreeMenuClick,node:",q),console.log("onTreeMenuClick,curentNode:",U),T.name=="child"){if(V.value.preCreate&&V.value.preCreate(U)==!1)return;const P=f.value[U[A.value.idField]];P.isLeaf=!1,d.value={},d.value[A.value.pidField]=P[A.value.idField],d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,d.value.parentNode=P,y.value=y.value+1,P.children||(P.children=[],b.value.push(P[A.value.idField])),V.value.createNode&&V.value.createNode(d.value,P,r.dataManager().params()),f.value[d.value[A.value.idField]]=d.value,P.children.push(d.value),m.value=[d.value[A.value.idField]],r.dataManager().primary().setValue(d.value)}if(T.name=="delete"){if(V.value.preDelete&&V.value.preDelete(U)==!1)return;U[A.value.idField]&&(U[A.value.idField]+"").startsWith("new_")?(U.parentNode?U.parentNode.children=U.parentNode.children.filter(P=>P[A.value.idField]!=U[A.value.idField]):h.value=h.value.filter(P=>P[A.value.idField]!=U[A.value.idField]),delete f.value[U[A.value.idField]]):r.dataManager().primary().deleteByIds([U[A.value.idField]]).then(()=>{if(U.parentNode){const P=f.value[U[A.value.pidField]];P.children=P.children.filter(re=>re[A.value.idField]!=U[A.value.idField])}else h.value=h.value.filter(P=>P[A.value.idField]!=U[A.value.idField]);delete f.value[U[A.value.idField]]})}}function u(T,{expanded:_,node:q}){_&&(d.value=q.dataRef,r.dataManager().primary().setValue(d.value),S())}function N(T,_){_.selected?(d.value=_.node.dataRef,r.dataManager().primary().setValue(d.value)):d.value&&(m.value=[d.value[A.value.idField]]),D("treeClick",{keys:T,event:_})}const M=i.computed(()=>{if(l.storage?.orderBy){const T=l.storage.orderBy.split(" ");return[{name:T[0],asc:T[1].toLowerCase()=="asc"}]}return[]});i.watch(()=>l.params,()=>{c.value&&(h.value=[],f.value={},d.value=null,m.value=[],b.value=[],y.value=0,r.dataManager().params(l.params||{}),console.log("params changed props.params",l.params),S())}),i.watch(()=>d.value,()=>{console.log("active node changed",d.value),C(!d.value)});const v=i.ref(null);i.watch(v,()=>{v.value&&d.value&&r.dataManager().primary().setValue(d.value)});function C(T=!0){const _=r.dataManager().form();for(let q in _)_[q].setDisabled(T)}function B(){if(!(V.value.preCreate&&V.value.preCreate()==!1)){if(d.value={},d.value[A.value.pidField]=-1,d.value[A.value.labelField]="新建...",d.value[A.value.idField]="new_"+y.value,y.value=y.value+1,V.value.createNode&&V.value.createNode(d.value,null,r.dataManager().params()),d.value[A.value.pidField]==-1)h.value.push(d.value);else{const T=f.value[d.value[A.value.pidField]];T?(T.children||(T.children=[]),T.children.push(d.value)):h.value.push(d.value)}m.value=[d.value[A.value.idField]],f.value[d.value[A.value.idField]]=d.value,r.dataManager().primary().setValue(d.value)}}const E=i.ref(""),g=pt(T=>{r.dataManager().primary().find({page:1,pageSize:9999,keywords:T||E.value,needCount:!1,body:A.value.async==!1?null:{},sorts:M.value}).then(_=>{if(f.value={},h.value=[],_.body?.length){const q={};_.body.forEach(U=>{q[U[A.value.idField]]=U}),_.body.forEach(U=>{const P=q[U[A.value.pidField]];P?(P.children||(P.children=[],P.isLeaf=!1),P.children.push(U)):h.value.push(U)})}})},400);function S(){const T={};if(T[A.value.pidField]=l.params[A.value.pidField]||-1,d.value){if(d.value.children?.length||A.value.async==!1)return;T[A.value.pidField]=d.value[A.value.idField],r.dataManager().primary().find({page:1,pageSize:999,body:T,sorts:M.value}).then(_=>{d.value.children=_.body||[],d.value.children.forEach(q=>{q.isLeaf=!!q[A.value.leafField],f.value[q[A.value.idField]]=q,q.parentNode=f.value[q[A.value.pidField]]})})}else{const _=A.value.async==!1?null:{page:1,pageSize:999,body:T,sorts:M.value};r.dataManager().primary().find(_).then(q=>{if(A.value.async==!1){if(h.value=[],q.body?.length){const U={};q.body.forEach(P=>{U[P[A.value.idField]]=P}),q.body.forEach(P=>{const re=U[P[A.value.pidField]];re?(re.children||(re.children=[],re.isLeaf=!1),re.children.push(P)):h.value.push(P)})}}else h.value=q.body||[],h.value.forEach(U=>{U.isLeaf=!!U[A.value.leafField],f.value[U[A.value.idField]]=U})})}}const I=i.computed(()=>r.$widgetList.value||[]),V=i.computed(()=>{const T={...r.define.value?.configs?.event||{}};for(const _ in T)T[_]&&typeof T[_]!="function"&&T[_].enable&&T[_].scriptText&&(_=="createNode"&&(T[_]=new Function("node","parent","params",T[_].scriptText)),_=="preCreate"?T[_]=new Function("parent",T[_].scriptText):T[_]=new Function("data","event",T[_].scriptText));return T}),F=i.computed(()=>r.define.value?.configs?.setting||l.setting||{});i.provide("pageSetting",F.value);const $=i.computed(()=>{const T=r.define.value?.configs?.btns;if(typeof T=="boolean"&&T==!1)return[];const _=(r.define.value?.configs?.btns||[]).map(U=>typeof U=="string"?{name:U,visible:!1}:{size:"default",...U}),q=_.map(U=>U.name);if(!q.includes("save")){const U={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};_.splice(U.index,0,U)}if(!q.includes("reset")){const U={title:"重置",type:"default",index:1,visible:!0,size:"default",props:{danger:!0},name:"reset"};_.splice(U.index,0,U)}if(!q.includes("back")){const U={title:"返回",type:"default",index:_.length,visible:!0,size:"default",name:"back"};_.splice(U.index,0,U)}return r.model.value=="view"&&_.filter(U=>["save","submit","reset"].includes(U.name)).forEach(U=>{U.visible=!1}),_}),D=e;function Q({btn:T,event:_}){T.name=="save"&&L({btn:T,event:_}),T.name=="reset",T.name=="back"&&O(),D("btnClick",{btn:T,event:_})}async function L(T){const _=r.dataManager().form();let q={...d.value};for(let U in _){const P=await _[U].validate();if(r.dataManager().psn()==U)for(let re in P)q[re]=P[re];else q[U]=P}if(q[A.value.pidField]&&(q[A.value.pidField]+"").startsWith("new_")){t.error({content:"请先保存父节点!"});return}q[A.value.idField]&&(q[A.value.idField]+"").startsWith("new_")&&delete q[A.value.idField],delete q.parentNode,delete q.children,q[A.value.leafField]=q[A.value.leafField]?1:0,V.value.preSave&&V.value.preSave(q,T),console.log("=======form data=====",q),r.dataManager().primary().save({data:q}).then(U=>{console.log("save result:",U),d.value[A.value.idField]=U.body,m.value=[U.body],f.value[U.body]=d.value,d.value.children?.forEach(P=>{P[A.value.pidField]=U.body}),V.value.postSaved&&V.value.postSaved(q,T)})}function O(){n.back()}const G=i.ref("new_");return i.onMounted(()=>{const T=i.inject("route");console.log("unione page tree route",T),G.value=l.psn||T?.query?.psn||T?.meta?.psn||"new_",console.log("unione page tree,psn:"+G.value),r.setModel(T?.query?.model||T?.meta?.model||"run");const _={...l.params||{},...T?.query||{},...T?.params||{}};r.dataManager().params(_),s(),r.load(G.value,o),i.nextTick(()=>{C(!0)}),S(),c.value=!0}),(T,_)=>{const q=i.resolveComponent("SearchOutlined"),U=i.resolveComponent("a-input"),P=i.resolveComponent("unione-btn"),re=i.resolveComponent("a-tree");return i.openBlock(),i.createBlock(qt,{class:"unione-page-tree","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[i.createElementVNode("div",{class:"tree-warp",onContextmenu:_[6]||(_[6]=i.withModifiers(()=>{},["prevent"]))},[i.renderSlot(T.$slots,"tree-top",{onChange:_[0]||(_[0]=(...H)=>i.unref(g)&&i.unref(g)(...H)),onPressEnter:_[1]||(_[1]=(...H)=>i.unref(g)&&i.unref(g)(...H))},()=>[x.value?(i.openBlock(),i.createBlock(U,{key:0,size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:E.value,"onUpdate:value":_[2]||(_[2]=H=>E.value=H),onChange:i.unref(g),onPressEnter:i.unref(g)},{suffix:i.withCtx(()=>[i.createVNode(q)]),_:1},8,["value","onChange","onPressEnter"])):i.createCommentVNode("",!0)],!0),w.value?(i.openBlock(),i.createBlock(P,{key:0,widget:w.value,onClick:B},null,8,["widget"])):i.createCommentVNode("",!0),i.createVNode(re,{"show-line":A.value.showLine,"show-icon":A.value.showIcon,disabled:A.value.disabled,blockNode:!0,draggable:A.value.draggable,multiple:A.value.multiple,selectable:A.value.selectable,checkable:A.value.checkable,fieldNames:{title:A.value.labelField,key:A.value.idField},selectedKeys:m.value,"onUpdate:selectedKeys":_[4]||(_[4]=H=>m.value=H),expandedKeys:b.value,"onUpdate:expandedKeys":_[5]||(_[5]=H=>b.value=H),"tree-data":h.value,onExpand:u,onSelect:N},i.createSlots({icon:i.withCtx(({dataRef:H})=>[H[A.value.iconField]?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(H[A.value.iconField]),{key:0,class:"node-icon"})):i.createCommentVNode("",!0)]),_:2},[R.value?.length?{name:"title",fn:i.withCtx(({dataRef:H})=>[i.createElementVNode("div",{class:"node-label",onMouseover:()=>p.value=H,onMouseleave:_[3]||(_[3]=()=>p.value=null)},[i.createElementVNode("span",null,i.toDisplayString(H[A.value.labelField]),1),d.value&&d.value[A.value.idField]==H[A.value.idField]||p.value&&p.value[A.value.idField]==H[A.value.idField]?(i.openBlock(),i.createElementBlock("div",Sd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(R.value,pe=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[!V.value.btnVisible||V.value.btnVisible(pe,H)?(i.openBlock(),i.createBlock(P,{key:pe.name,widget:pe,ctx:{node:H},onClick:Hu=>k(Hu,H)},null,8,["widget","ctx","onClick"])):i.createCommentVNode("",!0)],64))),256))])):i.createCommentVNode("",!0)],40,vd)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),i.createElementVNode("div",Bd,[i.renderSlot(T.$slots,"form-warp",{},()=>[i.createElementVNode("div",{ref_key:"formWarp",ref:v},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(I.value,H=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(H.widget),{key:H.wid,wid:H.wid,widget:H,editor:i.unref(r)},null,8,["wid","widget","editor"]))),128)),i.createElementVNode("div",Nd,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList($.value,H=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:H.name},[H.visible!=!1?(i.openBlock(),i.createBlock(P,{key:0,widget:H,editor:i.unref(r),disabled:!d.value,ctx:{},onClick:Q},null,8,["widget","editor","disabled"])):i.createCommentVNode("",!0)],64))),128))])],512)],!0)])]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),[["__scopeId","data-v-969fb71b"]]),Dl=i.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},queryBtns:{type:Array,required:!1},operation:{type:Object,required:!1},selection:{type:Object,required:!1},leftBtns:{type:Object,required:!1},rightBtns:{type:Object,required:!1}},emits:["btnClick"],setup(a,{expose:e,emit:t}){const n=a,l=i.ref(null),o={sn:"new_",title:"新建页面",types:"code",vers:1,configs:{widgets:[{widget:"unione-query",dsn:"",primary:!0,fields:[]},{widget:"unione-table",dsn:"",columns:[]}],dsnList:[]},component:"unione-page-list"};function s(){if(n.fields?.length){o.configs.widgets[0].dsn="primary",o.configs.widgets[0].fields=n.fields.filter(R=>R.isQuery),o.configs.widgets[0].btns=n.queryBtns||[],o.configs.widgets[0].params=n.params||{},o.configs.dsnList=["primary"],o.configs.widgets[1].dsn="primary";const w=n.fields.filter(R=>R.isPk)[0];w&&w.name&&(o.configs.widgets[1].dataKey=w.name),o.configs.widgets[1].columns=n.fields.filter(R=>R.hidden!=!0),o.configs.widgets[1].operation=Y.utils.obj.ext(o.configs.widgets[1].operation,n.operation||{}),n.operation==!1&&(o.configs.widgets[1].operation=!1),n.selection==!1&&(o.configs.widgets[1].selection=!1),o.configs.widgets[1].leftBtns=n.leftBtns==!1?!1:n.leftBtns||[],o.configs.widgets[1].rightBtns=n.rightBtns==!1?!1:n.rightBtns||[],r.dataManager().use("primary","list").store(n.storage)}}const r=new ut,c=i.computed(()=>r.$widgetList.value||[]),h=t;function f(w){h("btnClick",w)}const d=i.ref("new_");i.onMounted(()=>{const w=i.inject("route");console.log("unione page view route",w),d.value=n.psn||w?.query?.psn||w?.meta?.psn||"new_",console.log("unione page view,psn:"+d.value),r.setModel(w?.query?.model||w?.meta?.model||"run");const R={...n.params||{},...w?.query||{},...w?.params||{}};r.dataManager().params(R),s(),r.load(d.value,o)});function p(){return r.dataManager().use("primary","list")}function m(w){w?r.ebus.$emit("table-list-search",w):r.ebus.$emit("table-list-reload")}function b(w){r.dataManager().params(w),r.ebus.$emit("query-form-params",w),r.ebus.$emit("table-list-search",{params:w})}function y(){return l.value?l.value[0]:null}function A(){return l.value?l.value[0].getSelected():null}function x(){l.value&&l.value[0].clearSelected()}return e({storage:p,editor:r,reload:m,setParams:b,getTable:y,getSelected:A,clearSelected:x}),(w,R)=>(i.openBlock(),i.createBlock(qt,{class:"unione-page-list","setting-title":"页面设置",editor:i.unref(r)},i.createSlots({default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,k=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:k.wid},[k.widget=="unione-table"?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:0,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f,ref_for:!0,ref_key:"table",ref:l},null,40,["wid","widget","editor"])):(i.openBlock(),i.createBlock(i.resolveDynamicComponent(k.widget),{key:1,wid:k.wid,widget:k,editor:i.unref(r),onBtnClick:f},null,40,["wid","widget","editor"]))],64))),128))]),_:2},[i.unref(r)?{name:"page-setting",fn:i.withCtx(()=>[i.createVNode(Qt,{editor:i.unref(r)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),mt={release(a){return Y.axios.admin({url:"/api/data/define/release",method:"post",data:a})},find(a){return Y.axios.admin({url:"/api/data/define/find",method:"post",data:a})},save(a){return Y.axios.admin({url:"/api/data/define/save",method:"post",data:a})},delete(a){return Y.axios.admin({url:"/api/data/define/delete",method:"post",data:a})},detail(a){return Y.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:a})},loadFromDb(a){return Y.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})},impFromDb(a){return Y.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:a})}},Vd={class:"unione-page list-page"},Rd=ee(i.defineComponent({__name:"list",setup(a){const e=Fe(),t=Y.useDialog(),n=i.inject("router"),l=i.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),o=i.ref({leftBtns:[{visible:!1,name:"delBatch"},{title:"从数据库导入",icon:"FunnelPlotOutlined",name:"impFromDb",props:{danger:!0,ghost:!0}},{title:"代码生成",icon:"CodeOutlined",name:"genCode"}],rightBtns:[{visible:!1,name:"downTmpl"}],columns:[{title:"类别",name:"category"},{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"编码",name:"sn"},{title:"版本",name:"vers"},{title:"发布时间",name:"publishDate"},{title:"创建时间",name:"created"},{title:"状态",name:"status"}],operation:{title:"操作",width:190,btns:[{title:"预览",name:"view"},{title:"版本发布",name:"release",props:{danger:!0}},{title:"版本管理",name:"vers"},{title:"配置管理",name:"configs"},{title:"权限管理",name:"permis"},{title:"权限分配",name:"auth"},{title:"复制",name:"copy"}],count:2,more:{layout:"vertical"}}});i.onMounted(()=>{r()});const s=i.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){s.value.loading=!0,mt.find({page:s.value.pagination.current,pageSize:s.value.pagination.pageSize,body:s.value.params,keywords:s.value.keywords}).then(k=>{s.value.data=k.body,s.value.pagination.total=k.total*1}).finally(()=>{s.value.loading=!1})}function c(k){s.value.pagination.current=k.pagination.current,s.value.pagination.pageSize=k.pagination.pageSize,r()}function h({params:k,keywords:u}){s.value.pagination.current=1,s.value.params=k,s.value.keywords=u,r()}function f({btn:k,event:u,row:N}){console.log("table btn click",k,u,N),(k.name=="add"||k.name=="edit")&&n.push({path:"/dev/data/define/edit",query:N?{id:N.id}:{}}),k.name=="impFromDb"&&(p.value=!0),k.name=="release"&&d(N),k.name=="view"&&n.push({path:e.listPageUrl,query:{psn:N.sn+":list",model:"preview"}})}function d(k){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([k.id]).then(u=>{u.success?(t.success({title:"发布成功",content:u.body}),r()):t.error({title:"发布失败",content:u.body})})}})}const p=i.ref(!1),m=i.ref({keywords:{visible:!1},fields:[{title:"数据源",name:"dsId",value:1,visible:!0,widget:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0}},{title:"名称",name:"tableName",visible:!0}],btns:[{visible:!1,name:"reset"},{name:"advanced",visible:!1},{name:"imp",title:"提交",props:{danger:!0}}]}),b=i.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),y=i.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function A(k){!k||!Object.keys(k).length||!k.dsId||(X.message.loading("数据加载中..."),y.value.params=k,y.value.loading=!0,mt.loadFromDb(k).then(u=>{y.value.loading=!1,X.message.destroy(),u.success?(u.body.forEach(N=>{N.checkable=!!N.id}),y.value.data=u.body,y.value.pagination.total=u.body.length):X.message.error(u.message)}))}function x(k){y.value.pagination.current=k.pagination.current,y.value.pagination.pageSize=k.pagination.pageSize}const w=i.ref();function R({btn:k}){if(k.name!="imp")return;const u=w.value.getSelected();u?.keys?.length?t.confirm({content:"确定导入选中的"+u.keys.length+"条记录么?",onOk:()=>{X.message.loading("数据导入中..."),mt.impFromDb({dsId:y.value.params.dsId,tables:u.keys.join()}).then(N=>{X.message.destroy(),N.success?(t.success({content:N.message}),s.value.pagination.current=1,r()):t.error({context:N.message})})}}):t.error({content:"请选择目标记录!"})}return(k,u)=>{const N=i.resolveComponent("UnioneQuery"),M=i.resolveComponent("UnioneTable"),v=i.resolveComponent("a-drawer");return i.openBlock(),i.createElementBlock("div",Vd,[i.createVNode(N,{widget:l.value,onQuery:h,onReset:h},null,8,["widget"]),i.createVNode(M,{widget:o.value,dataList:s.value.data,loading:s.value.loading,pagination:s.value.pagination,onChange:c,onBtnClick:f},null,8,["widget","dataList","loading","pagination"]),i.createVNode(v,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":u[0]||(u[0]=C=>p.value=C),placement:"left"},{default:i.withCtx(()=>[i.createVNode(N,{widget:m.value,onQuery:A,onReset:A,onBtnClick:R,class:"load-table-form"},null,8,["widget"]),i.createVNode(M,{widget:b.value,dataList:y.value.data,loading:y.value.loading,pagination:y.value.pagination,onChange:x,rowKey:"name",ref_key:"loadTableObj",ref:w},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-165bc175"]]),Ed={class:"unione-props-setting data-field-manage"},Od={key:0},Md={key:1},Td=["onClick"],Id=["onClick"],Fd=["onClick"],Dd={key:1},_d=ee(i.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:m})=>m+1},{title:"名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"标题",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"数据类型",dataIndex:"dataType",key:"dataType",width:"80px",align:"center"},{title:"长度",dataIndex:"dataLen",key:"dataLen",width:"60px",align:"center"},{title:"小数点",dataIndex:"dataPrec",key:"dataPrec",width:"60px",align:"center"},{title:"默认值",dataIndex:"dataValue",key:"dataValue",width:"60px",align:"center"},{title:"主键",dataIndex:"isPk",key:"isPk",width:"40px",align:"center"},{title:"外键",dataIndex:"isFk",key:"isFk",width:"30px",align:"center"},{title:"非空",dataIndex:"isNull",key:"isNull",width:"30px",align:"center"},{title:"同步",dataIndex:"syncEnable",key:"syncEnable",width:"30px",align:"center"},{title:"备注",dataIndex:"descs",key:"descs",width:"140px",align:"center"}]),t=i.useModel(a,"modelValue"),n=i.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(b=>{n.value.selectedRowKeys.includes(b)||n.value.selectedRowKeys.push(b);const y=[];t.value.forEach(A=>{!m.includes(A.name)&&n.value.selectedRowKeys.includes(A.name)&&y.push(A.name)}),y.length&&(n.value.selectedRowKeys=n.value.selectedRowKeys.filter(A=>!y.includes(A)))})}}),l={mounted:m=>m.focus()},o=i.ref({});function s(){const m=Object.keys(o.value);if(m.length)for(let b in m){const y=t.value.filter(A=>A.name==b);if(y&&y[0]){let A=o.value[b];Object.keys(A).forEach(x=>{y[0][x]=A[x]})}}o.value={}}function r(m,b){s();const y={};y[b]=m[b]||"",o.value[m.name]=y}function c(m,b){if(!m||!b){o.value={};return}const y=o.value[m.name][b];if(b=="name"&&t.value.filter(x=>x[b]==y&&x.name!=m.name).length>0){X.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}m[b]=y,o.value={}}function h(m,b){const y=t.value.filter(A=>A.name==m.name)[0];return b=="isFk"?y.configs?.fkey?.enable:y[b]==1}function f(m,b){const y=t.value.filter(A=>A.name==m.name)[0];b=="isFk"?(y.configs||(y.configs={}),y.configs.fkey||(y.configs.fkey={}),y.configs.fkey.enable=!y.configs.fkey.enable):y[b]!=1?y[b]=1:y[b]=0}function d(){if(s(),t.value.filter(y=>y.name=="new_").length>0){o.value.new_={name:"new_"};return}const b={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(b),o.value[b.name]={name:"new_"}}function p(){if(!n.value.selectedRowKeys.length){X.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}X.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+n.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!n.value.selectedRowKeys.includes(m.name)),n.value.selectedRowKeys=[]}})}return(m,b)=>{const y=i.resolveComponent("a-button"),A=i.resolveComponent("a-tooltip"),x=i.resolveComponent("a-input"),w=i.resolveComponent("a-input-number"),R=i.resolveComponent("a-select-option"),k=i.resolveComponent("a-select"),u=i.resolveComponent("a-checkbox"),N=i.resolveComponent("a-table");return i.openBlock(),i.createElementBlock("div",Ed,[i.createVNode(y,{class:"btn btn-add",type:"primary",onClick:d,size:"small"},{default:i.withCtx(()=>b[1]||(b[1]=[i.createTextVNode("新增")])),_:1}),i.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:i.withCtx(()=>b[2]||(b[2]=[i.createTextVNode(" 删除 ")])),_:1}),i.createVNode(N,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":n.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:M})=>[["name","title"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Od,[b[3]||(b[3]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(M.key)?(i.openBlock(),i.createElementBlock("span",Md,[i.createVNode(i.unref(Ke.FormOutlined)),i.createTextVNode(" "+i.toDisplayString(M.title),1)])):i.createCommentVNode("",!0),M.key==="isPk"?(i.openBlock(),i.createBlock(A,{key:2,title:"至少配置一个主键字段"},{default:i.withCtx(()=>[b[4]||(b[4]=i.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isFk"?(i.openBlock(),i.createBlock(A,{key:3,title:"是否是外键字段"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="isNull"?(i.openBlock(),i.createBlock(A,{key:4,title:"是否允许为空"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0),M.key==="syncEnable"?(i.openBlock(),i.createBlock(A,{key:5,title:"是否同步到数据库"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.title),1)]),_:2},1024)):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:M,text:v,record:C})=>[["name","title","descs","dataValue"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(x,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Td)):i.createCommentVNode("",!0),["dataLen","dataPrec"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(w,{key:0,value:o.value[C.name][M.dataIndex],"onUpdate:value":B=>o.value[C.name][M.dataIndex]=B,onBlur:B=>c(C,M.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(v||" "),1)],64))],10,Id)):["dataType"].includes(M.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[C.name]||!Object.keys(o.value[C.name]).includes(M.dataIndex))&&!v&&"empty"]),onClick:B=>r(C,M.dataIndex)},[o.value[C.name]&&Object.keys(o.value[C.name]).includes(M.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(k,{key:0,value:C[M.dataIndex],"onUpdate:value":B=>C[M.dataIndex]=B,onBlur:b[0]||(b[0]=B=>c())},{default:i.withCtx(()=>[i.createVNode(R,{key:"String",value:"String"}),i.createVNode(R,{key:"Long",value:"Long"}),i.createVNode(R,{key:"Short",value:"Short"}),i.createVNode(R,{key:"Integer",value:"Integer"}),i.createVNode(R,{key:"Float",value:"Float"}),i.createVNode(R,{key:"Double",value:"Double"}),i.createVNode(R,{key:"Date",value:"Date"}),i.createVNode(R,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(i.openBlock(),i.createElementBlock("span",Dd,i.toDisplayString(v),1))],10,Fd)):["syncEnable","isFk","isPk"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:3,checked:h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(M.dataIndex)?(i.openBlock(),i.createBlock(u,{key:4,checked:!h(C,M.dataIndex),onClick:B=>f(C,M.dataIndex)},null,8,["checked","onClick"])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),_l=1024;let Pd=0,an=class{constructor(e,t){this.from=e,this.to=t}};class ie{constructor(e={}){this.id=Pd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Be.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}ie.closedBy=new ie({deserialize:a=>a.split(" ")}),ie.openedBy=new ie({deserialize:a=>a.split(" ")}),ie.group=new ie({deserialize:a=>a.split(" ")}),ie.isolate=new ie({deserialize:a=>{if(a&&a!="rtl"&&a!="ltr"&&a!="auto")throw new RangeError("Invalid value for isolate: "+a);return a||"auto"}}),ie.contextHash=new ie({perNode:!0}),ie.lookAhead=new ie({perNode:!0}),ie.mounted=new ie({perNode:!0});class ui{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[ie.mounted.id]}}const $d=Object.create(null);class Be{constructor(e,t,n,l=0){this.name=e,this.props=t,this.id=n,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):$d,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Be(e.name||"",t,e.id,n);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ie.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let l of n.split(" "))t[l]=e[n];return n=>{for(let l=n.prop(ie.group),o=-1;o<(l?l.length:0);o++){let s=t[o<0?n.name:l[o]];if(s)return s}}}}Be.none=new Be("",Object.create(null),0,8);class rn{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let l=null;for(let o of e){let s=o(n);s&&(l||(l=Object.assign({},n.props)),l[s[0].id]=s[1])}t.push(l?new Be(n.name,l,n.id,n.flags):n)}return new rn(t)}}const pi=new WeakMap,Pl=new WeakMap;var ge;(function(a){a[a.ExcludeBuffers=1]="ExcludeBuffers",a[a.IncludeAnonymous=2]="IncludeAnonymous",a[a.IgnoreMounts=4]="IgnoreMounts",a[a.IgnoreOverlays=8]="IgnoreOverlays"})(ge||(ge={}));class fe{constructor(e,t,n,l,o){if(this.type=e,this.children=t,this.positions=n,this.length=l,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,r]of o)this.props[typeof s=="number"?s:s.id]=r}}toString(){let e=ui.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let l=n.toString();l&&(t&&(t+=","),t+=l)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new hn(this.topNode,e)}cursorAt(e,t=0,n=0){let l=pi.get(this)||this.topNode,o=new hn(l);return o.moveTo(e,t),pi.set(this,o._tree),o}get topNode(){return new Oe(this,0,0,null)}resolve(e,t=0){let n=Wt(pi.get(this)||this.topNode,e,t,!1);return pi.set(this,n),n}resolveInner(e,t=0){let n=Wt(Pl.get(this)||this.topNode,e,t,!0);return Pl.set(this,n),n}resolveStack(e,t=0){return zd(this,e,t)}iterate(e){let{enter:t,leave:n,from:l=0,to:o=this.length}=e,s=e.mode||0,r=(s&ge.IncludeAnonymous)>0;for(let c=this.cursor(s|ge.IncludeAnonymous);;){let h=!1;if(c.from<=o&&c.to>=l&&(!r&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&n&&(r||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:un(Be.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,l)=>new fe(this.type,t,n,l,this.propValues),e.makeTree||((t,n,l)=>new fe(Be.none,t,n,l)))}static build(e){return jd(e)}}fe.empty=new fe(Be.none,[],[],0);class cn{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new cn(this.buffer,this.index)}}class ot{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Be.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],l=this.set.types[t],o=l.name;if(/\W/.test(o)&&!l.isError&&(o=JSON.stringify(o)),e+=4,n==e)return o;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,t,n,l,o){let{buffer:s}=this,r=-1;for(let c=e;c!=t&&!($l(o,l,s[c+1],s[c+2])&&(r=c,n>0));c=s[c+3]);return r}slice(e,t,n){let l=this.buffer,o=new Uint16Array(t-e),s=0;for(let r=e,c=0;r<t;){o[c++]=l[r++],o[c++]=l[r++]-n;let h=o[c++]=l[r++]-n;o[c++]=l[r++]-e,s=Math.max(s,h)}return new ot(o,s,this.set)}}function $l(a,e,t,n){switch(a){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Wt(a,e,t,n){for(var l;a.from==a.to||(t<1?a.from>=e:a.from>e)||(t>-1?a.to<=e:a.to<e);){let s=!n&&a instanceof Oe&&a.index<0?null:a.parent;if(!s)return a;a=s}let o=n?0:ge.IgnoreOverlays;if(n)for(let s=a,r=s.parent;r;s=r,r=s.parent)s instanceof Oe&&s.index<0&&((l=r.enter(e,t,o))===null||l===void 0?void 0:l.from)!=s.from&&(a=r);for(;;){let s=a.enter(e,t,o);if(!s)return a;a=s}}class Ll{cursor(e=0){return new hn(this,e)}getChild(e,t=null,n=null){let l=Ul(this,e,t,n);return l.length?l[0]:null}getChildren(e,t=null,n=null){return Ul(this,e,t,n)}resolve(e,t=0){return Wt(this,e,t,!1)}resolveInner(e,t=0){return Wt(this,e,t,!0)}matchContext(e){return dn(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(n=t,t=l.prevSibling):t=l}return n}get node(){return this}get next(){return this.parent}}class Oe extends Ll{constructor(e,t,n,l){super(),this._tree=e,this.from=t,this.index=n,this._parent=l}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,l,o=0){for(let s=this;;){for(let{children:r,positions:c}=s._tree,h=t>0?r.length:-1;e!=h;e+=t){let f=r[e],d=c[e]+s.from;if($l(l,n,d,d+f.length)){if(f instanceof ot){if(o&ge.ExcludeBuffers)continue;let p=f.findChild(0,f.buffer.length,t,n-d,l);if(p>-1)return new st(new Ld(s,f,e,d),null,p)}else if(o&ge.IncludeAnonymous||!f.type.isAnonymous||fn(f)){let p;if(!(o&ge.IgnoreMounts)&&(p=ui.get(f))&&!p.overlay)return new Oe(p.tree,d,e,s);let m=new Oe(f,d,e,s);return o&ge.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?f.children.length-1:0,t,n,l)}}}if(o&ge.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let l;if(!(n&ge.IgnoreOverlays)&&(l=ui.get(this._tree))&&l.overlay){let o=e-this.from;for(let{from:s,to:r}of l.overlay)if((t>0?s<=o:s<o)&&(t<0?r>=o:r>o))return new Oe(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ul(a,e,t,n){let l=a.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let s=!1;!s;)if(s=l.type.is(t),!l.nextSibling())return o}for(;;){if(n!=null&&l.type.is(n))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return n==null?o:[]}}function dn(a,e,t=e.length-1){for(let n=a.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Ld{constructor(e,t,n,l){this.parent=e,this.buffer=t,this.index=n,this.start=l}}class st extends Ll{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new st(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&ge.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new st(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new st(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new st(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,l=this.index+4,o=n.buffer[this.index+3];if(o>l){let s=n.buffer[this.index+1];e.push(n.slice(l,o,s)),t.push(0)}return new fe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function zl(a){if(!a.length)return null;let e=0,t=a[0];for(let o=1;o<a.length;o++){let s=a[o];(s.from>t.from||s.to<t.to)&&(t=s,e=o)}let n=t instanceof Oe&&t.index<0?null:t.parent,l=a.slice();return n?l[e]=n:l.splice(e,1),new Ud(l,t)}class Ud{constructor(e,t){this.heads=e,this.node=t}get next(){return zl(this.heads)}}function zd(a,e,t){let n=a.resolveInner(e,t),l=null;for(let o=n instanceof Oe?n:n.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(l||(l=[n])).push(s.resolve(e,t)),o=s}else{let s=ui.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let r=new Oe(s.tree,s.overlay[0].from+o.from,-1,o);(l||(l=[n])).push(Wt(r,e,t,!1))}}return l?zl(l):n}class hn{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Oe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=n+l.buffer[e+1],this.to=n+l.buffer[e+2],!0}yield(e){return e?e instanceof Oe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,n);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&ge.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ge.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ge.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let l=n<0?0:this.stack[n]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(l)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(l.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:n}=l)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let o=t+e,s=e<0?-1:n._tree.children.length;o!=s;o+=e){let r=n._tree.children[o];if(this.mode&ge.IncludeAnonymous||r instanceof ot||!r.type.isAnonymous||fn(r))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let l=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==l){if(l==this.index)return s;t=s,n=o+1;break e}l=this.stack[--o]}for(let l=n;l<this.stack.length;l++)t=new st(this.buffer,t,this.stack[l]);return this.bufferNode=new st(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,l=!0}}}matchContext(e){if(!this.buffer)return dn(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let l=e.length-1,o=this.stack.length-1;l>=0;o--){if(o<0)return dn(this.node,e,l);let s=n[t.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[l]&&e[l]!=s.name)return!1;l--}}return!0}}function fn(a){return a.children.some(e=>e instanceof ot||!e.type.isAnonymous||fn(e))}function jd(a){var e;let{buffer:t,nodeSet:n,maxBufferLength:l=_l,reused:o=[],minRepeatType:s=n.types.length}=a,r=Array.isArray(t)?new cn(t,t.length):t,c=n.types,h=0,f=0;function d(u,N,M,v,C,B){let{id:E,start:g,end:S,size:I}=r,V=f;for(;I<0;)if(r.next(),I==-1){let L=o[E];M.push(L),v.push(g-u);return}else if(I==-3){h=E;return}else if(I==-4){f=E;return}else throw new RangeError(`Unrecognized record size: ${I}`);let F=c[E],$,D,Q=g-u;if(S-g<=l&&(D=A(r.pos-N,C))){let L=new Uint16Array(D.size-D.skip),O=r.pos-D.size,G=L.length;for(;r.pos>O;)G=x(D.start,L,G);$=new ot(L,S-D.start,n),Q=D.start-u}else{let L=r.pos-I;r.next();let O=[],G=[],T=E>=s?E:-1,_=0,q=S;for(;r.pos>L;)T>=0&&r.id==T&&r.size>=0?(r.end<=q-l&&(b(O,G,g,_,r.end,q,T,V),_=O.length,q=r.end),r.next()):B>2500?p(g,L,O,G):d(g,L,O,G,T,B+1);if(T>=0&&_>0&&_<O.length&&b(O,G,g,_,g,q,T,V),O.reverse(),G.reverse(),T>-1&&_>0){let U=m(F);$=un(F,O,G,0,O.length,0,S-g,U,U)}else $=y(F,O,G,S-g,V-S)}M.push($),v.push(Q)}function p(u,N,M,v){let C=[],B=0,E=-1;for(;r.pos>N;){let{id:g,start:S,end:I,size:V}=r;if(V>4)r.next();else{if(E>-1&&S<E)break;E<0&&(E=I-l),C.push(g,S,I),B++,r.next()}}if(B){let g=new Uint16Array(B*4),S=C[C.length-2];for(let I=C.length-3,V=0;I>=0;I-=3)g[V++]=C[I],g[V++]=C[I+1]-S,g[V++]=C[I+2]-S,g[V++]=V;M.push(new ot(g,C[2]-S,n)),v.push(S-u)}}function m(u){return(N,M,v)=>{let C=0,B=N.length-1,E,g;if(B>=0&&(E=N[B])instanceof fe){if(!B&&E.type==u&&E.length==v)return E;(g=E.prop(ie.lookAhead))&&(C=M[B]+E.length+g)}return y(u,N,M,v,C)}}function b(u,N,M,v,C,B,E,g){let S=[],I=[];for(;u.length>v;)S.push(u.pop()),I.push(N.pop()+M-C);u.push(y(n.types[E],S,I,B-C,g-B)),N.push(C-M)}function y(u,N,M,v,C=0,B){if(h){let E=[ie.contextHash,h];B=B?[E].concat(B):[E]}if(C>25){let E=[ie.lookAhead,C];B=B?[E].concat(B):[E]}return new fe(u,N,M,v,B)}function A(u,N){let M=r.fork(),v=0,C=0,B=0,E=M.end-l,g={size:0,start:0,skip:0};e:for(let S=M.pos-u;M.pos>S;){let I=M.size;if(M.id==N&&I>=0){g.size=v,g.start=C,g.skip=B,B+=4,v+=4,M.next();continue}let V=M.pos-I;if(I<0||V<S||M.start<E)break;let F=M.id>=s?4:0,$=M.start;for(M.next();M.pos>V;){if(M.size<0)if(M.size==-3)F+=4;else break e;else M.id>=s&&(F+=4);M.next()}C=$,v+=I,B+=F}return(N<0||v==u)&&(g.size=v,g.start=C,g.skip=B),g.size>4?g:void 0}function x(u,N,M){let{id:v,start:C,end:B,size:E}=r;if(r.next(),E>=0&&v<s){let g=M;if(E>4){let S=r.pos-(E-4);for(;r.pos>S;)M=x(u,N,M)}N[--M]=g,N[--M]=B-u,N[--M]=C-u,N[--M]=v}else E==-3?h=v:E==-4&&(f=v);return M}let w=[],R=[];for(;r.pos>0;)d(a.start||0,a.bufferStart||0,w,R,-1,0);let k=(e=a.length)!==null&&e!==void 0?e:w.length?R[0]+w[0].length:0;return new fe(c[a.topID],w.reverse(),R.reverse(),k)}const jl=new WeakMap;function mi(a,e){if(!a.isAnonymous||e instanceof ot||e.type!=a)return 1;let t=jl.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=a||!(n instanceof fe)){t=1;break}t+=mi(a,n)}jl.set(e,t)}return t}function un(a,e,t,n,l,o,s,r,c){let h=0;for(let b=n;b<l;b++)h+=mi(a,e[b]);let f=Math.ceil(h*1.5/8),d=[],p=[];function m(b,y,A,x,w){for(let R=A;R<x;){let k=R,u=y[R],N=mi(a,b[R]);for(R++;R<x;R++){let M=mi(a,b[R]);if(N+M>=f)break;N+=M}if(R==k+1){if(N>f){let M=b[k];m(M.children,M.positions,0,M.children.length,y[k]+w);continue}d.push(b[k])}else{let M=y[R-1]+b[R-1].length-u;d.push(un(a,b,y,k,R,u,M,null,c))}p.push(u+w-o)}}return m(e,t,n,l,0),(r||c)(d,p,s)}class gt{constructor(e,t,n,l,o=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=l,this.open=(o?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let l=[new gt(0,e.length,e,0,!1,n)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,n=128){if(!t.length)return e;let l=[],o=1,s=e.length?e[0]:null;for(let r=0,c=0,h=0;;r++){let f=r<t.length?t[r]:null,d=f?f.fromA:1e9;if(d-c>=n)for(;s&&s.from<d;){let p=s;if(c>=p.from||d<=p.to||h){let m=Math.max(p.from,c)-h,b=Math.min(p.to,d)-h;p=m>=b?null:new gt(m,b,p.tree,p.offset+h,r>0,!!f)}if(p&&l.push(p),s.to>d)break;s=o<e.length?e[o++]:null}if(!f)break;c=f.toA,h=f.toA-f.toB}return l}}class ql{startParse(e,t,n){return typeof e=="string"&&(e=new qd(e)),n=n?n.length?n.map(l=>new an(l.from,l.to)):[new an(0,0)]:[new an(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let l=this.startParse(e,t,n);for(;;){let o=l.advance();if(o)return o}}}class qd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ie({perNode:!0});class gi{constructor(e,t,n,l,o,s,r,c,h,f=0,d){this.p=e,this.stack=t,this.state=n,this.reducePos=l,this.pos=o,this.score=s,this.buffer=r,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=d}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let l=e.parser.context;return new gi(e,[],t,n,n,0,[],0,l?new Ql(l,l.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,l=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25;s&&this.setLookAhead(this.pos);let r=o.dynamicPrecedence(l);if(r&&(this.score+=r),n==0){this.pushState(o.getGoto(this.state,l,!0),this.reducePos),l<o.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(l,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),h=c?this.stack[c-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let d=c?this.stack[c-1]:0,p=this.bufferBase+this.buffer.length-d;if(l<o.minRepeatTerm||e&131072){let m=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,h,m,p+4,!0)}if(e&262144)this.state=this.stack[c];else{let m=this.stack[c-3];this.state=o.getGoto(m,l,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(l,h)}storeNode(e,t,n,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,r=this.buffer.length;if(r==0&&s.parent&&(r=s.bufferBase-s.parent.bufferBase,s=s.parent),r>0&&s.buffer[r-4]==0&&s.buffer[r-1]>-1){if(t==n)return;if(s.buffer[r-2]>=t){s.buffer[r-2]=n;return}}}if(!o||this.pos==n)this.buffer.push(e,t,n,l);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0){let r=!1;for(let c=s;c>0&&this.buffer[c-2]>n;c-=4)if(this.buffer[c-1]>=0){r=!0;break}if(r)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,l>4&&(l-=4)}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=n,this.buffer[s+3]=l}}shift(e,t,n,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,l,4);else{let o=e,{parser:s}=this.p;(l>this.pos||t<=s.maxNode)&&(this.pos=l,s.stateFlag(o,1)||(this.reducePos=l)),this.pushState(o,n),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,l,4)}}apply(e,t,n,l){e&65536?this.reduce(e):this.shift(e,t,n,l)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(n,l,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new gi(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Qd(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let l=[];for(let o=0,s;o<t.length;o+=2)(s=t[o+1])!=this.state&&this.p.parser.hasAction(s,e)&&l.push(t[o],s);if(this.stack.length<120)for(let o=0;l.length<8&&o<t.length;o+=2){let s=t[o+1];l.some((r,c)=>c&1&&r==s)||l.push(t[o],s)}t=l}let n=[];for(let l=0;l<t.length&&n.length<4;l+=2){let o=t[l+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(t[l],this.pos),s.reducePos=this.pos,s.score-=200,n.push(s)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,l=t&65535,o=this.stack.length-n*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;t=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,s=>{if(!(s&393216))if(s&65536){let r=(s>>19)-o;if(r>1){let c=s&65535,h=this.stack.length-r*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return r<<19|65536|c}}else{let r=n(s,o+1);if(r!=null)return r}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Ql(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Ql{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Qd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class ki{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ki(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ki(this.stack,this.pos,this.index)}}function bi(a,e=Uint16Array){if(typeof a!="string")return a;let t=null;for(let n=0,l=0;n<a.length;){let o=0;for(;;){let s=a.charCodeAt(n++),r=!1;if(s==126){o=65535;break}s>=92&&s--,s>=34&&s--;let c=s-32;if(c>=46&&(c-=46,r=!0),o+=c,r)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class yi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Wl=new yi;class Wd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Wl,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,l=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!l)return null;let s=this.ranges[--l];o-=n.from-s.to,n=s}for(;t<0?o>n.to:o>=n.to;){if(l==this.ranges.length-1)return null;let s=this.ranges[++l];o+=s.from-n.to,n=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,l;if(t>=0&&t<this.chunk.length)n=this.pos+e,l=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(n=o,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let s=this.rangeIndex,r=this.range;for(;r.to<=n;)r=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-n)),l=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),l}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Wl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(n+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return n}}class St{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}St.prototype.contextual=St.prototype.fallback=St.prototype.extend=!1,St.prototype.fallback=St.prototype.extend=!1;function Yd(a,e,t,n,l,o){let s=0,r=1<<n,{dialect:c}=t.p.parser;e:for(;r&a[s];){let h=a[s+1];for(let m=s+3;m<h;m+=2)if((a[m+1]&r)>0){let b=a[m];if(c.allows(b)&&(e.token.value==-1||e.token.value==b||Hd(b,e.token.value,l,o))){e.acceptToken(b);break}}let f=e.next,d=0,p=a[s+2];if(e.next<0&&p>d&&a[h+p*3-3]==65535){s=a[h+p*3-1];continue e}for(;d<p;){let m=d+p>>1,b=h+m+(m<<1),y=a[b],A=a[b+1]||65536;if(f<y)p=m;else if(f>=A)d=m+1;else{s=a[b+2],e.advance();continue e}}break}}function Yl(a,e,t){for(let n=e,l;(l=a[n])!=65535;n++)if(l==t)return n-e;return-1}function Hd(a,e,t,n){let l=Yl(t,n,e);return l<0||Yl(t,n,a)<l}const Ve=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let pn=null;function Hl(a,e,t){let n=a.cursor(ge.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(a.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:a.length}}class Kd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Hl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Hl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],l=this.index[t];if(l==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[l],s=this.start[t]+n.positions[l];if(s>e)return this.nextStart=s,null;if(o instanceof fe){if(s==e){if(s<this.safeFrom)return null;let r=s+o.length;if(r<=this.safeTo){let c=o.prop(ie.lookAhead);if(!c||r+c<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}}class Gd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new yi)}getActions(e){let t=0,n=null,{parser:l}=e.p,{tokenizers:o}=l,s=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,c=0;for(let h=0;h<o.length;h++){if(!(1<<h&s))continue;let f=o[h],d=this.tokens[h];if(!(n&&!f.fallback)&&((f.contextual||d.start!=e.pos||d.mask!=s||d.context!=r)&&(this.updateCachedToken(d,f,e),d.mask=s,d.context=r),d.lookAhead>d.end+25&&(c=Math.max(d.lookAhead,c)),d.value!=0)){let p=t;if(d.extended>-1&&(t=this.addActions(e,d.extended,d.end,t)),t=this.addActions(e,d.value,d.end,t),!f.extend&&(n=d,t>p))break}}for(;this.actions.length>t;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new yi,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yi,{pos:n,p:l}=e;return t.start=n,t.end=Math.min(n+1,l.stream.end),t.value=n==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,n){let l=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(l,e),n),e.value>-1){let{parser:o}=n.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let r=o.specializers[s](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){r&1?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,n,l){for(let o=0;o<l;o+=3)if(this.actions[o]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=n,l}addActions(e,t,n,l){let{state:o}=e,{parser:s}=e.p,{data:r}=s;for(let c=0;c<2;c++)for(let h=s.stateSlot(o,c?2:1);;h+=3){if(r[h]==65535)if(r[h+1]==1)h=Je(r,h+2);else{l==0&&r[h+1]==2&&(l=this.putAction(Je(r,h+2),t,n,l));break}r[h]==t&&(l=this.putAction(Je(r,h+1),t,n,l))}return l}}class Jd{constructor(e,t,n,l){this.parser=e,this.input=t,this.ranges=l,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Wd(t,l),this.tokens=new Gd(e,this.stream),this.topTerm=e.top[1];let{from:o}=l[0];this.stacks=[gi.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>e.bufferLength*4?new Kd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let r=e[s];for(;;){if(this.tokens.mainToken=null,r.pos>t)n.push(r);else{if(this.advanceStack(r,n,e))continue;{l||(l=[],o=[]),l.push(r);let c=this.tokens.getMainToken(r);o.push(c.value,c.end)}}break}}if(!n.length){let s=l&&Zd(l);if(s)return Ve&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Ve&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let s=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,n);if(s)return Ve&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(n.length>s)for(n.sort((r,c)=>c.score-r.score);n.length>s;)n.pop();n.some(r=>r.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let s=0;s<n.length-1;s++){let r=n[s];for(let c=s+1;c<n.length;c++){let h=n[c];if(r.sameState(h)||r.buffer.length>500&&h.buffer.length>500)if((r.score-h.score||r.buffer.length-h.buffer.length)>0)n.splice(c--,1);else{n.splice(s--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let s=1;s<n.length;s++)n[s].pos<this.minStackPos&&(this.minStackPos=n[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let l=e.pos,{parser:o}=this,s=Ve?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let d=this.fragments.nodeAt(l);d;){let p=this.parser.nodeSet.types[d.type.id]==d.type?o.getGoto(e.state,d.type.id):-1;if(p>-1&&d.length&&(!h||(d.prop(ie.contextHash)||0)==f))return e.useNode(d,p),Ve&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(d.type.id)})`),!0;if(!(d instanceof fe)||d.children.length==0||d.positions[0]>0)break;let m=d.children[0];if(m instanceof fe&&d.positions[0]==0)d=m;else break}}let r=o.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ve&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;h<c.length;){let f=c[h++],d=c[h++],p=c[h++],m=h==c.length||!n,b=m?e:e.split(),y=this.tokens.mainToken;if(b.apply(f,d,y?y.start:b.pos,p),Ve&&console.log(s+this.stackID(b)+` (via ${f&65536?`reduce of ${o.getName(f&65535)}`:"shift"} for ${o.getName(d)} @ ${l}${b==e?"":", split"})`),m)return!0;b.pos>l?t.push(b):n.push(b)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Kl(e,t),!0}}runRecovery(e,t,n){let l=null,o=!1;for(let s=0;s<e.length;s++){let r=e[s],c=t[s<<1],h=t[(s<<1)+1],f=Ve?this.stackID(r)+" -> ":"";if(r.deadEnd&&(o||(o=!0,r.restart(),Ve&&console.log(f+this.stackID(r)+" (restarted)"),this.advanceFully(r,n))))continue;let d=r.split(),p=f;for(let m=0;d.forceReduce()&&m<10&&(Ve&&console.log(p+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,n));m++)Ve&&(p=this.stackID(d)+" -> ");for(let m of r.recoverByInsert(c))Ve&&console.log(f+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,n);this.stream.end>r.pos?(h==r.pos&&(h++,c=0),r.recoverByDelete(c,h),Ve&&console.log(f+this.stackID(r)+` (via recover-delete ${this.parser.getName(c)})`),Kl(r,n)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),fe.build({buffer:ki.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(pn||(pn=new WeakMap)).get(e);return t||pn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Kl(a,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==a.pos&&n.sameState(a)){e[t].score<a.score&&(e[t]=a);return}}e.push(a)}class Xd{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class wi extends ql{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let r=0;r<e.repeatNodeCount;r++)t.push("");let n=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function o(r,c,h){l[r].push([c,c.deserialize(String(h))])}if(e.nodeProps)for(let r of e.nodeProps){let c=r[0];typeof c=="string"&&(c=ie[c]);for(let h=1;h<r.length;){let f=r[h++];if(f>=0)o(f,c,r[h++]);else{let d=r[h+-f];for(let p=-f;p>0;p--)o(r[h++],c,d);h++}}}this.nodeSet=new rn(t.map((r,c)=>Be.define({name:c>=this.minRepeatTerm?void 0:r,id:c,props:l[c],top:n.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=_l;let s=bi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let r=0;r<this.specializerSpecs.length;r++)this.specialized[r]=this.specializerSpecs[r].term;this.specializers=this.specializerSpecs.map(Gl),this.states=bi(e.states,Uint32Array),this.data=bi(e.stateData),this.goto=bi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new St(s,r):r),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let l=new Jd(this,e,t,n);for(let o of this.wrappers)l=o(l,e,t,n);return l}getGoto(e,t,n=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let s=l[o++],r=s&1,c=l[o++];if(r&&n)return c;for(let h=o+(s>>1);o<h;o++)if(l[o]==e)return c;if(r)return-1}}hasAction(e,t){let n=this.data;for(let l=0;l<2;l++)for(let o=this.stateSlot(e,l?2:1),s;;o+=3){if((s=n[o])==65535)if(n[o+1]==1)s=n[o=Je(n,o+2)];else{if(n[o+1]==2)return Je(n,o+2);break}if(s==t||s==0)return Je(n,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),l=n?t(n):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Je(this.data,o+2);else break;l=t(Je(this.data,o+1))}return l}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Je(this.data,n+2);else break;if(!(this.data[n+2]&1)){let l=this.data[n+1];t.some((o,s)=>s&1&&o==l)||t.push(this.data[n],l)}}return t}configure(e){let t=Object.assign(Object.create(wi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let l=e.tokenizers.find(o=>o.from==n);return l?l.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,l)=>{let o=e.specializers.find(r=>r.from==n.external);if(!o)return n;let s=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[l]=Gl(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let o of e.split(" ")){let s=t.indexOf(o);s>=0&&(n[s]=!0)}let l=null;for(let o=0;o<t.length;o++)if(!n[o])for(let s=this.dialects[t[o]],r;(r=this.data[s++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Xd(e,n,l)}static deserialize(e){return new wi(e)}}function Je(a,e){return a[e]|a[e+1]<<16}function Zd(a){let e=null;for(let t of a){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Gl(a){if(a.external){let e=a.extend?1:0;return(t,n)=>a.external(t,n)<<1|e}return a.get}let eh=0;class Me{constructor(e,t,n,l){this.name=e,this.set=t,this.base=n,this.modified=l,this.id=eh++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Me&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new Me(n,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new Ai(e);return n=>n.modified.indexOf(t)>-1?n:Ai.get(n.base||n,n.modified.concat(t).sort((l,o)=>l.id-o.id))}}let th=0;class Ai{constructor(e){this.name=e,this.instances=[],this.id=th++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(r=>r.base==e&&ih(t,r.modified));if(n)return n;let l=[],o=new Me(e.name,l,e,t);for(let r of t)r.instances.push(o);let s=nh(t);for(let r of e.set)if(!r.modified.length)for(let c of s)l.push(Ai.get(r,c));return o}}function ih(a,e){return a.length==e.length&&a.every((t,n)=>t==e[n])}function nh(a){let e=[[]];for(let t=0;t<a.length;t++)for(let n=0,l=e.length;n<l;n++)e.push(e[n].concat(a[t]));return e.sort((t,n)=>n.length-t.length)}function Jl(a){let e=Object.create(null);for(let t in a){let n=a[t];Array.isArray(n)||(n=[n]);for(let l of t.split(" "))if(l){let o=[],s=2,r=l;for(let d=0;;){if(r=="..."&&d>0&&d+3==l.length){s=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!p)throw new RangeError("Invalid path: "+l);if(o.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),d+=p[0].length,d==l.length)break;let m=l[d++];if(d==l.length&&m=="!"){s=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(d)}let c=o.length-1,h=o[c];if(!h)throw new RangeError("Invalid path: "+l);let f=new mn(n,s,c>0?o.slice(0,c):null);e[h]=f.sort(e[h])}}return lh.add(e)}const lh=new ie;class mn{constructor(e,t,n,l){this.tags=e,this.mode=t,this.context=n,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}mn.empty=new mn([],2,null);function Xl(a,e){let t=Object.create(null);for(let o of a)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let s of o.tag)t[s.id]=o.class;let{scope:n,all:l=null}=e||{};return{style:o=>{let s=l;for(let r of o)for(let c of r.set){let h=t[c.id];if(h){s=s?s+" "+h:h;break}}return s},scope:n}}const j=Me.define,xi=j(),at=j(),Zl=j(at),eo=j(at),rt=j(),Ci=j(rt),gn=j(rt),Le=j(),kt=j(Le),Ue=j(),ze=j(),kn=j(),Yt=j(kn),vi=j(),z={comment:xi,lineComment:j(xi),blockComment:j(xi),docComment:j(xi),name:at,variableName:j(at),typeName:Zl,tagName:j(Zl),propertyName:eo,attributeName:j(eo),className:j(at),labelName:j(at),namespace:j(at),macroName:j(at),literal:rt,string:Ci,docString:j(Ci),character:j(Ci),attributeValue:j(Ci),number:gn,integer:j(gn),float:j(gn),bool:j(rt),regexp:j(rt),escape:j(rt),color:j(rt),url:j(rt),keyword:Ue,self:j(Ue),null:j(Ue),atom:j(Ue),unit:j(Ue),modifier:j(Ue),operatorKeyword:j(Ue),controlKeyword:j(Ue),definitionKeyword:j(Ue),moduleKeyword:j(Ue),operator:ze,derefOperator:j(ze),arithmeticOperator:j(ze),logicOperator:j(ze),bitwiseOperator:j(ze),compareOperator:j(ze),updateOperator:j(ze),definitionOperator:j(ze),typeOperator:j(ze),controlOperator:j(ze),punctuation:kn,separator:j(kn),bracket:Yt,angleBracket:j(Yt),squareBracket:j(Yt),paren:j(Yt),brace:j(Yt),content:Le,heading:kt,heading1:j(kt),heading2:j(kt),heading3:j(kt),heading4:j(kt),heading5:j(kt),heading6:j(kt),contentSeparator:j(Le),list:j(Le),quote:j(Le),emphasis:j(Le),strong:j(Le),link:j(Le),monospace:j(Le),strikethrough:j(Le),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:vi,documentMeta:j(vi),annotation:j(vi),processingInstruction:j(vi),definition:Me.defineModifier("definition"),constant:Me.defineModifier("constant"),function:Me.defineModifier("function"),standard:Me.defineModifier("standard"),local:Me.defineModifier("local"),special:Me.defineModifier("special")};for(let a in z){let e=z[a];e instanceof Me&&(e.name=a)}Xl([{tag:z.link,class:"tok-link"},{tag:z.heading,class:"tok-heading"},{tag:z.emphasis,class:"tok-emphasis"},{tag:z.strong,class:"tok-strong"},{tag:z.keyword,class:"tok-keyword"},{tag:z.atom,class:"tok-atom"},{tag:z.bool,class:"tok-bool"},{tag:z.url,class:"tok-url"},{tag:z.labelName,class:"tok-labelName"},{tag:z.inserted,class:"tok-inserted"},{tag:z.deleted,class:"tok-deleted"},{tag:z.literal,class:"tok-literal"},{tag:z.string,class:"tok-string"},{tag:z.number,class:"tok-number"},{tag:[z.regexp,z.escape,z.special(z.string)],class:"tok-string2"},{tag:z.variableName,class:"tok-variableName"},{tag:z.local(z.variableName),class:"tok-variableName tok-local"},{tag:z.definition(z.variableName),class:"tok-variableName tok-definition"},{tag:z.special(z.variableName),class:"tok-variableName2"},{tag:z.definition(z.propertyName),class:"tok-propertyName tok-definition"},{tag:z.typeName,class:"tok-typeName"},{tag:z.namespace,class:"tok-namespace"},{tag:z.className,class:"tok-className"},{tag:z.macroName,class:"tok-macroName"},{tag:z.propertyName,class:"tok-propertyName"},{tag:z.operator,class:"tok-operator"},{tag:z.comment,class:"tok-comment"},{tag:z.meta,class:"tok-meta"},{tag:z.invalid,class:"tok-invalid"},{tag:z.punctuation,class:"tok-punctuation"}]);const oh=Jl({String:z.string,Number:z.number,"True False":z.bool,PropertyName:z.propertyName,Null:z.null,",":z.separator,"[ ]":z.squareBracket,"{ }":z.brace}),sh=wi.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[oh],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});let bn=[],to=[];(()=>{let a="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<a.length;e++)(e%2?to:bn).push(t=t+a[e])})();function ah(a){if(a<768)return!1;for(let e=0,t=bn.length;;){let n=e+t>>1;if(a<bn[n])t=n;else if(a>=to[n])e=n+1;else return!0;if(e==t)return!1}}function io(a){return a>=127462&&a<=127487}const no=8205;function rh(a,e,t=!0,n=!0){return(t?lo:ch)(a,e,n)}function lo(a,e,t){if(e==a.length)return e;e&&oo(a.charCodeAt(e))&&so(a.charCodeAt(e-1))&&e--;let n=yn(a,e);for(e+=ao(n);e<a.length;){let l=yn(a,e);if(n==no||l==no||t&&ah(l))e+=ao(l),n=l;else if(io(l)){let o=0,s=e-2;for(;s>=0&&io(yn(a,s));)o++,s-=2;if(o%2==0)break;e+=2}else break}return e}function ch(a,e,t){for(;e>0;){let n=lo(a,e-2,t);if(n<e)return n;e--}return 0}function yn(a,e){let t=a.charCodeAt(e);if(!so(t)||e+1==a.length)return t;let n=a.charCodeAt(e+1);return oo(n)?(t-55296<<10)+(n-56320)+65536:t}function oo(a){return a>=56320&&a<57344}function so(a){return a>=55296&&a<56320}function ao(a){return a<65536?1:2}class te{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Bt(this,e,t);let l=[];return this.decompose(0,e,l,2),n.length&&n.decompose(0,n.length,l,3),this.decompose(t,this.length,l,1),je.from(l,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Bt(this,e,t);let n=[];return this.decompose(e,t,n,0),je.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),l=new Ht(this),o=new Ht(e);for(let s=t,r=t;;){if(l.next(s),o.next(s),s=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(r+=l.value.length,l.done||r>=n)return!0}}iter(e=1){return new Ht(this,e)}iterRange(e,t=this.length){return new co(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;n=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ho(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?te.empty:e.length<=32?new he(e):je.from(he.split(e,[]))}}class he extends te{constructor(e,t=dh(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.text[o],r=l+s.length;if((t?n:r)>=e)return new hh(l,r,n,s);l=r+1,n++}}decompose(e,t,n,l){let o=e<=0&&t>=this.length?this:new he(ro(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let s=n.pop(),r=Si(o.text,s.text.slice(),0,o.length);if(r.length<=32)n.push(new he(r,s.length+o.length));else{let c=r.length>>1;n.push(new he(r.slice(0,c)),new he(r.slice(c)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof he))return super.replace(e,t,n);[e,t]=Bt(this,e,t);let l=Si(this.text,Si(n.text,ro(this.text,0,e)),t),o=this.length+n.length-(t-e);return l.length<=32?new he(l,o):je.from(he.split(l,[]),o)}sliceString(e,t=this.length,n=`
15
+ `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<=t&&s<this.text.length;s++){let r=this.text[s],c=o+r.length;o>e&&s&&(l+=n),e<c&&t>o&&(l+=r.slice(Math.max(0,e-o),t-o)),o=c+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],l=-1;for(let o of e)n.push(o),l+=o.length+1,n.length==32&&(t.push(new he(n,l)),n=[],l=-1);return l>-1&&t.push(new he(n,l)),t}}class je extends te{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,l){for(let o=0;;o++){let s=this.children[o],r=l+s.length,c=n+s.lines-1;if((t?c:r)>=e)return s.lineInner(e,t,n,l);l=r+1,n=c+1}}decompose(e,t,n,l){for(let o=0,s=0;s<=t&&o<this.children.length;o++){let r=this.children[o],c=s+r.length;if(e<=c&&t>=s){let h=l&((s<=e?1:0)|(c>=t?2:0));s>=e&&c<=t&&!h?n.push(r):r.decompose(e-s,t-s,n,h)}s=c+1}}replace(e,t,n){if([e,t]=Bt(this,e,t),n.lines<this.lines)for(let l=0,o=0;l<this.children.length;l++){let s=this.children[l],r=o+s.length;if(e>=o&&t<=r){let c=s.replace(e-o,t-o,n),h=this.lines-s.lines+c.lines;if(c.lines<h>>4&&c.lines>h>>6){let f=this.children.slice();return f[l]=c,new je(f,this.length-(t-e)+n.length)}return super.replace(o,r,c)}o=r+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
16
+ `){[e,t]=Bt(this,e,t);let l="";for(let o=0,s=0;o<this.children.length&&s<=t;o++){let r=this.children[o],c=s+r.length;s>e&&o&&(l+=n),e<c&&t>s&&(l+=r.sliceString(e-s,t-s,n)),s=c+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof je))return 0;let n=0,[l,o,s,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==s||o==r)return n;let c=this.children[l],h=e.children[o];if(c!=h)return n+c.scanIdentical(h,t);n+=c.length+1}}static from(e,t=e.reduce((n,l)=>n+l.length+1,-1)){let n=0;for(let m of e)n+=m.lines;if(n<32){let m=[];for(let b of e)b.flatten(m);return new he(m,t)}let l=Math.max(32,n>>5),o=l<<1,s=l>>1,r=[],c=0,h=-1,f=[];function d(m){let b;if(m.lines>o&&m instanceof je)for(let y of m.children)d(y);else m.lines>s&&(c>s||!c)?(p(),r.push(m)):m instanceof he&&c&&(b=f[f.length-1])instanceof he&&m.lines+b.lines<=32?(c+=m.lines,h+=m.length+1,f[f.length-1]=new he(b.text.concat(m.text),b.length+1+m.length)):(c+m.lines>l&&p(),c+=m.lines,h+=m.length+1,f.push(m))}function p(){c!=0&&(r.push(f.length==1?f[0]:je.from(f,h)),h=-1,c=f.length=0)}for(let m of e)d(m);return p(),r.length==1?r[0]:new je(r,t)}}te.empty=new he([""],0);function dh(a){let e=-1;for(let t of a)e+=t.length+1;return e}function Si(a,e,t=0,n=1e9){for(let l=0,o=0,s=!0;o<a.length&&l<=n;o++){let r=a[o],c=l+r.length;c>=t&&(c>n&&(r=r.slice(0,n-l)),l<t&&(r=r.slice(t-l)),s?(e[e.length-1]+=r,s=!1):e.push(r)),l=c+1}return e}function ro(a,e,t){return Si(a,[""],e,t)}class Ht{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof he?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,l=this.nodes[n],o=this.offsets[n],s=o>>1,r=l instanceof he?l.text.length:l.children.length;if(s==(t>0?r:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
17
+ `,this;e--}else if(l instanceof he){let c=l.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=l.children[s+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof he?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class co{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Ht(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=n?l:t<0?l.slice(l.length-n):l.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class ho{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(te.prototype[Symbol.iterator]=function(){return this.iter()},Ht.prototype[Symbol.iterator]=co.prototype[Symbol.iterator]=ho.prototype[Symbol.iterator]=function(){return this});class hh{constructor(e,t,n,l){this.from=e,this.to=t,this.number=n,this.text=l}get length(){return this.to-this.from}}function Bt(a,e,t){return e=Math.max(0,Math.min(a.length,e)),[e,Math.max(e,Math.min(a.length,t))]}function Xe(a,e,t=!0,n=!0){return rh(a,e,t,n)}const wn=/\r\n?|\n/;var Re=function(a){return a[a.Simple=0]="Simple",a[a.TrackDel=1]="TrackDel",a[a.TrackBefore=2]="TrackBefore",a[a.TrackAfter=3]="TrackAfter",a}(Re||(Re={}));class Ze{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,l=0;t<this.sections.length;){let o=this.sections[t++],s=this.sections[t++];s<0?(e(n,l,o),l+=o):l+=s,n+=o}}iterChangedRanges(e,t=!1){An(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];l<0?e.push(n,l):e.push(l,n)}return new Ze(e)}composeDesc(e){return this.empty?e:e.empty?this:fo(this,e)}mapDesc(e,t=!1){return e.empty?this:xn(this,e,t)}mapPos(e,t=-1,n=Re.Simple){let l=0,o=0;for(let s=0;s<this.sections.length;){let r=this.sections[s++],c=this.sections[s++],h=l+r;if(c<0){if(h>e)return o+(e-l);o+=r}else{if(n!=Re.Simple&&h>=e&&(n==Re.TrackDel&&l<e&&h>e||n==Re.TrackBefore&&l<e||n==Re.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!r)return e==l||t<0?o:o+c;o+=c}l=h}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let n=0,l=0;n<this.sections.length&&l<=t;){let o=this.sections[n++],s=this.sections[n++],r=l+o;if(s>=0&&l<=t&&r>=e)return l<e&&r>t?"cover":!0;l=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+n+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ze(e)}static create(e){return new Ze(e)}}class ke extends Ze{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return An(this,(t,n,l,o,s)=>e=e.replace(l,l+(n-t),s),!1),e}mapDesc(e,t=!1){return xn(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let l=0,o=0;l<t.length;l+=2){let s=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=s;let c=l>>1;for(;n.length<c;)n.push(te.empty);n.push(s?e.slice(o,o+s):te.empty)}o+=s}return new ke(t,n)}compose(e){return this.empty?e:e.empty?this:fo(this,e,!0)}map(e,t=!1){return e.empty?this:xn(this,e,t,!0)}iterChanges(e,t=!1){An(this,e,t)}get desc(){return Ze.create(this.sections)}filter(e){let t=[],n=[],l=[],o=new Kt(this);e:for(let s=0,r=0;;){let c=s==e.length?1e9:e[s++];for(;r<c||r==c&&o.len==0;){if(o.done)break e;let f=Math.min(o.len,c-r);Ae(l,f,-1);let d=o.ins==-1?-1:o.off==0?o.ins:0;Ae(t,f,d),d>0&&ct(n,t,o.text),o.forward(f),r+=f}let h=e[s++];for(;r<h;){if(o.done)break e;let f=Math.min(o.len,h-r);Ae(t,f,-1),Ae(l,f,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(f),r+=f}}return{changes:new ke(t,n),filtered:Ze.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],l=this.sections[t+1];l<0?e.push(n):l==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let l=[],o=[],s=0,r=null;function c(f=!1){if(!f&&!l.length)return;s<t&&Ae(l,t-s,-1);let d=new ke(l,o);r=r?r.compose(d.map(r)):d,l=[],o=[],s=0}function h(f){if(Array.isArray(f))for(let d of f)h(d);else if(f instanceof ke){if(f.length!=t)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${t})`);c(),r=r?r.compose(f.map(r)):f}else{let{from:d,to:p=d,insert:m}=f;if(d>p||d<0||p>t)throw new RangeError(`Invalid change range ${d} to ${p} (in doc of length ${t})`);let b=m?typeof m=="string"?te.of(m.split(n||wn)):m:te.empty,y=b.length;if(d==p&&y==0)return;d<s&&c(),d>s&&Ae(l,d-s,-1),Ae(l,p-d,y),ct(o,l,b),s=p}}return h(e),c(!r),r}static empty(e){return new ke(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let l=0;l<e.length;l++){let o=e[l];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((s,r)=>r&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;n.length<l;)n.push(te.empty);n[l]=te.of(o.slice(1)),t.push(o[0],n[l].length)}}}return new ke(t,n)}static createSet(e,t){return new ke(e,t)}}function Ae(a,e,t,n=!1){if(e==0&&t<=0)return;let l=a.length-2;l>=0&&t<=0&&t==a[l+1]?a[l]+=e:l>=0&&e==0&&a[l]==0?a[l+1]+=t:n?(a[l]+=e,a[l+1]+=t):a.push(e,t)}function ct(a,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<a.length)a[a.length-1]=a[a.length-1].append(t);else{for(;a.length<n;)a.push(te.empty);a.push(t)}}function An(a,e,t){let n=a.inserted;for(let l=0,o=0,s=0;s<a.sections.length;){let r=a.sections[s++],c=a.sections[s++];if(c<0)l+=r,o+=r;else{let h=l,f=o,d=te.empty;for(;h+=r,f+=c,c&&n&&(d=d.append(n[s-2>>1])),!(t||s==a.sections.length||a.sections[s+1]<0);)r=a.sections[s++],c=a.sections[s++];e(l,h,o,f,d),l=h,o=f}}}function xn(a,e,t,n=!1){let l=[],o=n?[]:null,s=new Kt(a),r=new Kt(e);for(let c=-1;;){if(s.done&&r.len||r.done&&s.len)throw new Error("Mismatched change set lengths");if(s.ins==-1&&r.ins==-1){let h=Math.min(s.len,r.len);Ae(l,h,-1),s.forward(h),r.forward(h)}else if(r.ins>=0&&(s.ins<0||c==s.i||s.off==0&&(r.len<s.len||r.len==s.len&&!t))){let h=r.len;for(Ae(l,r.ins,-1);h;){let f=Math.min(s.len,h);s.ins>=0&&c<s.i&&s.len<=f&&(Ae(l,0,s.ins),o&&ct(o,l,s.text),c=s.i),s.forward(f),h-=f}r.next()}else if(s.ins>=0){let h=0,f=s.len;for(;f;)if(r.ins==-1){let d=Math.min(f,r.len);h+=d,f-=d,r.forward(d)}else if(r.ins==0&&r.len<f)f-=r.len,r.next();else break;Ae(l,h,c<s.i?s.ins:0),o&&c<s.i&&ct(o,l,s.text),c=s.i,s.forward(s.len-f)}else{if(s.done&&r.done)return o?ke.createSet(l,o):Ze.create(l);throw new Error("Mismatched change set lengths")}}}function fo(a,e,t=!1){let n=[],l=t?[]:null,o=new Kt(a),s=new Kt(e);for(let r=!1;;){if(o.done&&s.done)return l?ke.createSet(n,l):Ze.create(n);if(o.ins==0)Ae(n,o.len,0,r),o.next();else if(s.len==0&&!s.done)Ae(n,0,s.ins,r),l&&ct(l,n,s.text),s.next();else{if(o.done||s.done)throw new Error("Mismatched change set lengths");{let c=Math.min(o.len2,s.len),h=n.length;if(o.ins==-1){let f=s.ins==-1?-1:s.off?0:s.ins;Ae(n,c,f,r),l&&f&&ct(l,n,s.text)}else s.ins==-1?(Ae(n,o.off?0:o.len,c,r),l&&ct(l,n,o.textBit(c))):(Ae(n,o.off?0:o.len,s.off?0:s.ins,r),l&&!s.off&&ct(l,n,s.text));r=(o.ins>c||s.ins>=0&&s.len>c)&&(r||n.length>h),o.forward2(c),s.forward(c)}}}}class Kt{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?te.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?te.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class bt{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,l;return this.empty?n=l=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),n==this.from&&l==this.to?this:new bt(n,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return K.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return K.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return K.range(e.anchor,e.head)}static create(e,t,n){return new bt(e,t,n)}}class K{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:K.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new K([this.main],0)}addRange(e,t=!0){return K.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,K.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new K(e.ranges.map(t=>bt.fromJSON(t)),e.main)}static single(e,t=e){return new K([K.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,l=0;l<e.length;l++){let o=e[l];if(o.empty?o.from<=n:o.from<n)return K.normalized(e.slice(),t);n=o.to}return new K(e,t)}static cursor(e,t=0,n,l){return bt.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(l??16777215)<<6)}static range(e,t,n,l){let o=(n??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?bt.create(t,e,48|o):bt.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort((l,o)=>l.from-o.from),t=e.indexOf(n);for(let l=1;l<e.length;l++){let o=e[l],s=e[l-1];if(o.empty?o.from<=s.to:o.from<s.to){let r=s.from,c=Math.max(o.to,s.to);l<=t&&t--,e.splice(--l,2,o.anchor>o.head?K.range(c,r):K.range(r,c))}}return new K(e,t)}}function uo(a,e){for(let t of a.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Cn=0;class J{constructor(e,t,n,l,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=l,this.id=Cn++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new J(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:vn),!!e.static,e.enables)}of(e){return new Bi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bi(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function vn(a,e){return a==e||a.length==e.length&&a.every((t,n)=>t===e[n])}class Bi{constructor(e,t,n,l){this.dependencies=e,this.facet=t,this.type=n,this.value=l,this.id=Cn++}dynamicSlot(e){var t;let n=this.value,l=this.facet.compareInput,o=this.id,s=e[o]>>1,r=this.type==2,c=!1,h=!1,f=[];for(let d of this.dependencies)d=="doc"?c=!0:d=="selection"?h=!0:((t=e[d.id])!==null&&t!==void 0?t:1)&1||f.push(e[d.id]);return{create(d){return d.values[s]=n(d),1},update(d,p){if(c&&p.docChanged||h&&(p.docChanged||p.selection)||Sn(d,f)){let m=n(d);if(r?!po(m,d.values[s],l):!l(m,d.values[s]))return d.values[s]=m,1}return 0},reconfigure:(d,p)=>{let m,b=p.config.address[o];if(b!=null){let y=Ei(p,b);if(this.dependencies.every(A=>A instanceof J?p.facet(A)===d.facet(A):A instanceof yt?p.field(A,!1)==d.field(A,!1):!0)||(r?po(m=n(d),y,l):l(m=n(d),y)))return d.values[s]=y,0}else m=n(d);return d.values[s]=m,1}}}}function po(a,e,t){if(a.length!=e.length)return!1;for(let n=0;n<a.length;n++)if(!t(a[n],e[n]))return!1;return!0}function Sn(a,e){let t=!1;for(let n of e)Jt(a,n)&1&&(t=!0);return t}function fh(a,e,t){let n=t.map(c=>a[c.id]),l=t.map(c=>c.type),o=n.filter(c=>!(c&1)),s=a[e.id]>>1;function r(c){let h=[];for(let f=0;f<n.length;f++){let d=Ei(c,n[f]);if(l[f]==2)for(let p of d)h.push(p);else h.push(d)}return e.combine(h)}return{create(c){for(let h of n)Jt(c,h);return c.values[s]=r(c),1},update(c,h){if(!Sn(c,o))return 0;let f=r(c);return e.compare(f,c.values[s])?0:(c.values[s]=f,1)},reconfigure(c,h){let f=Sn(c,n),d=h.config.facets[e.id],p=h.facet(e);if(d&&!f&&vn(t,d))return c.values[s]=p,0;let m=r(c);return e.compare(m,p)?(c.values[s]=p,0):(c.values[s]=m,1)}}}const Ni=J.define({static:!0});class yt{constructor(e,t,n,l,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=l,this.spec=o,this.provides=void 0}static define(e){let t=new yt(Cn++,e.create,e.update,e.compare||((n,l)=>n===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Ni).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,l)=>{let o=n.values[t],s=this.updateF(o,l);return this.compareF(o,s)?0:(n.values[t]=s,1)},reconfigure:(n,l)=>{let o=n.facet(Ni),s=l.facet(Ni),r;return(r=o.find(c=>c.field==this))&&r!=s.find(c=>c.field==this)?(n.values[t]=r.create(n),1):l.config.address[this.id]!=null?(n.values[t]=l.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Ni.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function Gt(a){return e=>new mo(e,a)}const uh={highest:Gt(wt.highest),high:Gt(wt.high),default:Gt(wt.default),low:Gt(wt.low),lowest:Gt(wt.lowest)};class mo{constructor(e,t){this.inner=e,this.prec=t}}class Vi{of(e){return new Bn(this,e)}reconfigure(e){return Vi.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Bn{constructor(e,t){this.compartment=e,this.inner=t}}class Ri{constructor(e,t,n,l,o,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=l,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let l=[],o=Object.create(null),s=new Map;for(let p of ph(e,t,s))p instanceof yt?l.push(p):(o[p.facet.id]||(o[p.facet.id]=[])).push(p);let r=Object.create(null),c=[],h=[];for(let p of l)r[p.id]=h.length<<1,h.push(m=>p.slot(m));let f=n?.config.facets;for(let p in o){let m=o[p],b=m[0].facet,y=f&&f[p]||[];if(m.every(A=>A.type==0))if(r[b.id]=c.length<<1|1,vn(y,m))c.push(n.facet(b));else{let A=b.combine(m.map(x=>x.value));c.push(n&&b.compare(A,n.facet(b))?n.facet(b):A)}else{for(let A of m)A.type==0?(r[A.id]=c.length<<1|1,c.push(A.value)):(r[A.id]=h.length<<1,h.push(x=>A.dynamicSlot(x)));r[b.id]=h.length<<1,h.push(A=>fh(A,b,m))}}let d=h.map(p=>p(r));return new Ri(e,s,d,r,c,o)}}function ph(a,e,t){let n=[[],[],[],[],[]],l=new Map;function o(s,r){let c=l.get(s);if(c!=null){if(c<=r)return;let h=n[c].indexOf(s);h>-1&&n[c].splice(h,1),s instanceof Bn&&t.delete(s.compartment)}if(l.set(s,r),Array.isArray(s))for(let h of s)o(h,r);else if(s instanceof Bn){if(t.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(s.compartment)||s.inner;t.set(s.compartment,h),o(h,r)}else if(s instanceof mo)o(s.inner,s.prec);else if(s instanceof yt)n[r].push(s),s.provides&&o(s.provides,r);else if(s instanceof Bi)n[r].push(s),s.facet.extensions&&o(s.facet.extensions,wt.default);else{let h=s.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(h,r)}}return o(a,wt.default),n.reduce((s,r)=>s.concat(r))}function Jt(a,e){if(e&1)return 2;let t=e>>1,n=a.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;a.status[t]=4;let l=a.computeSlot(a,a.config.dynamicSlots[t]);return a.status[t]=2|l}function Ei(a,e){return e&1?a.config.staticValues[e>>1]:a.values[e>>1]}const go=J.define(),Nn=J.define({combine:a=>a.some(e=>e),static:!0}),ko=J.define({combine:a=>a.length?a[0]:void 0,static:!0}),bo=J.define(),yo=J.define(),wo=J.define(),Ao=J.define({combine:a=>a.length?a[0]:!1});class Nt{constructor(e,t){this.type=e,this.value=t}static define(){return new mh}}class mh{of(e){return new Nt(this,e)}}class gh{constructor(e){this.map=e}of(e){return new me(this,e)}}class me{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new me(this.type,t)}is(e){return this.type==e}static define(e={}){return new gh(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let l of e){let o=l.map(t);o&&n.push(o)}return n}}me.reconfigure=me.define(),me.appendConfig=me.define();class xe{constructor(e,t,n,l,o,s){this.startState=e,this.changes=t,this.selection=n,this.effects=l,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,n&&uo(n,t.newLength),o.some(r=>r.type==xe.time)||(this.annotations=o.concat(xe.time.of(Date.now())))}static create(e,t,n,l,o,s){return new xe(e,t,n,l,o,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(xe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}xe.time=Nt.define(),xe.userEvent=Nt.define(),xe.addToHistory=Nt.define(),xe.remote=Nt.define();function kh(a,e){let t=[];for(let n=0,l=0;;){let o,s;if(n<a.length&&(l==e.length||e[l]>=a[n]))o=a[n++],s=a[n++];else if(l<e.length)o=e[l++],s=e[l++];else return t;!t.length||t[t.length-1]<o?t.push(o,s):t[t.length-1]<s&&(t[t.length-1]=s)}}function xo(a,e,t){var n;let l,o,s;return t?(l=e.changes,o=ke.empty(e.changes.length),s=a.changes.compose(e.changes)):(l=e.changes.map(a.changes),o=a.changes.mapDesc(e.changes,!0),s=a.changes.compose(l)),{changes:s,selection:e.selection?e.selection.map(o):(n=a.selection)===null||n===void 0?void 0:n.map(l),effects:me.mapEffects(a.effects,l).concat(me.mapEffects(e.effects,o)),annotations:a.annotations.length?a.annotations.concat(e.annotations):e.annotations,scrollIntoView:a.scrollIntoView||e.scrollIntoView}}function Vn(a,e,t){let n=e.selection,l=Vt(e.annotations);return e.userEvent&&(l=l.concat(xe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ke?e.changes:ke.of(e.changes||[],t,a.facet(ko)),selection:n&&(n instanceof K?n:K.single(n.anchor,n.head)),effects:Vt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function Co(a,e,t){let n=Vn(a,e.length?e[0]:{},a.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let s=!!e[o].sequential;n=xo(n,Vn(a,e[o],s?n.changes.newLength:a.doc.length),s)}let l=xe.create(a,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return yh(t?bh(l):l)}function bh(a){let e=a.startState,t=!0;for(let l of e.facet(bo)){let o=l(a);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:kh(t,o))}if(t!==!0){let l,o;if(t===!1)o=a.changes.invertedDesc,l=ke.empty(e.doc.length);else{let s=a.changes.filter(t);l=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}a=xe.create(e,l,a.selection&&a.selection.map(o),me.mapEffects(a.effects,o),a.annotations,a.scrollIntoView)}let n=e.facet(yo);for(let l=n.length-1;l>=0;l--){let o=n[l](a);o instanceof xe?a=o:Array.isArray(o)&&o.length==1&&o[0]instanceof xe?a=o[0]:a=Co(e,Vt(o),!1)}return a}function yh(a){let e=a.startState,t=e.facet(wo),n=a;for(let l=t.length-1;l>=0;l--){let o=t[l](a);o&&Object.keys(o).length&&(n=xo(n,Vn(e,o,a.changes.newLength),!0))}return n==a?a:xe.create(e,a.changes,a.selection,n.effects,n.annotations,n.scrollIntoView)}const wh=[];function Vt(a){return a==null?wh:Array.isArray(a)?a:[a]}var et=function(a){return a[a.Word=0]="Word",a[a.Space=1]="Space",a[a.Other=2]="Other",a}(et||(et={}));const Ah=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Rn;try{Rn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function xh(a){if(Rn)return Rn.test(a);for(let e=0;e<a.length;e++){let t=a[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Ah.test(t)))return!0}return!1}function Ch(a){return e=>{if(!/\S/.test(e))return et.Space;if(xh(e))return et.Word;for(let t=0;t<a.length;t++)if(e.indexOf(a[t])>-1)return et.Word;return et.Other}}class le{constructor(e,t,n,l,o,s){this.config=e,this.doc=t,this.selection=n,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Jt(this,r<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Jt(this,n),Ei(this,n)}update(...e){return Co(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:l}=t;for(let r of e.effects)r.is(Vi.reconfigure)?(t&&(l=new Map,t.compartments.forEach((c,h)=>l.set(h,c)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(me.reconfigure)?(t=null,n=r.value):r.is(me.appendConfig)&&(t=null,n=Vt(n).concat(r.value));let o;t?o=e.startState.values.slice():(t=Ri.resolve(n,l,this),o=new le(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let s=e.startState.facet(Nn)?e.newSelection:e.newSelection.asSingle();new le(t,e.newDoc,s,o,(r,c)=>c.update(r,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:K.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),l=this.changes(n.changes),o=[n.range],s=Vt(n.effects);for(let r=1;r<t.ranges.length;r++){let c=e(t.ranges[r]),h=this.changes(c.changes),f=h.map(l);for(let p=0;p<r;p++)o[p]=o[p].map(f);let d=l.mapDesc(h,!0);o.push(c.range.map(d)),l=l.compose(f),s=me.mapEffects(s,f).concat(me.mapEffects(Vt(c.effects),d))}return{changes:l,selection:K.create(o,t.mainIndex),effects:s}}changes(e=[]){return e instanceof ke?e:ke.of(e,this.doc.length,this.facet(le.lineSeparator))}toText(e){return te.of(e.split(this.facet(le.lineSeparator)||wn))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Jt(this,t),Ei(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let l=e[n];l instanceof yt&&this.config.address[l.id]!=null&&(t[n]=l.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let s=n[o],r=e[o];l.push(s.init(c=>s.spec.fromJSON(r,c)))}}return le.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Ri.resolve(e.extensions||[],new Map),n=e.doc instanceof te?e.doc:te.of((e.doc||"").split(t.staticFacet(le.lineSeparator)||wn)),l=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return uo(l,n.length),t.staticFacet(Nn)||(l=l.asSingle()),new le(t,n,l,t.dynamicSlots.map(()=>null),(o,s)=>s.create(o),null)}get tabSize(){return this.facet(le.tabSize)}get lineBreak(){return this.facet(le.lineSeparator)||`
18
+ `}get readOnly(){return this.facet(Ao)}phrase(e,...t){for(let n of this.facet(le.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?n:t[o-1]})),e}languageDataAt(e,t,n=-1){let l=[];for(let o of this.facet(go))for(let s of o(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&l.push(s[e]);return l}charCategorizer(e){return Ch(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),s=e-n,r=e-n;for(;s>0;){let c=Xe(t,s,!1);if(o(t.slice(c,s))!=et.Word)break;s=c}for(;r<l;){let c=Xe(t,r);if(o(t.slice(r,c))!=et.Word)break;r=c}return s==r?null:K.range(s+n,r+n)}}le.allowMultipleSelections=Nn,le.tabSize=J.define({combine:a=>a.length?a[0]:4}),le.lineSeparator=ko,le.readOnly=Ao,le.phrases=J.define({compare(a,e){let t=Object.keys(a),n=Object.keys(e);return t.length==n.length&&t.every(l=>a[l]==e[l])}}),le.languageData=go,le.changeFilter=bo,le.transactionFilter=yo,le.transactionExtender=wo,Vi.reconfigure=me.define();class Rt{eq(e){return this==e}range(e,t=e){return Xt.create(e,t,this)}}Rt.prototype.startSide=Rt.prototype.endSide=0,Rt.prototype.point=!1,Rt.prototype.mapMode=Re.TrackDel;class Xt{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Xt(e,t,n)}}function En(a,e){return a.from-e.from||a.value.startSide-e.value.startSide}class On{constructor(e,t,n,l){this.from=e,this.to=t,this.value=n,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,l=0){let o=n?this.to:this.from;for(let s=l,r=o.length;;){if(s==r)return s;let c=s+r>>1,h=o[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==s)return h>=0?s:r;h>=0?r=c:s=c+1}}between(e,t,n,l){for(let o=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,o);o<s;o++)if(l(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,t){let n=[],l=[],o=[],s=-1,r=-1;for(let c=0;c<this.value.length;c++){let h=this.value[c],f=this.from[c]+e,d=this.to[c]+e,p,m;if(f==d){let b=t.mapPos(f,h.startSide,h.mapMode);if(b==null||(p=m=b,h.startSide!=h.endSide&&(m=t.mapPos(f,h.endSide),m<p)))continue}else if(p=t.mapPos(f,h.startSide),m=t.mapPos(d,h.endSide),p>m||p==m&&h.startSide>0&&h.endSide<=0)continue;(m-p||h.endSide-h.startSide)<0||(s<0&&(s=p),h.point&&(r=Math.max(r,m-p)),n.push(h),l.push(p-s),o.push(m-s))}return{mapped:n.length?new On(l,o,n,r):null,pos:s}}}class ce{constructor(e,t,n,l){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=l}static create(e,t,n,l){return new ce(e,t,n,l)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:l=0,filterTo:o=this.length}=e,s=e.filter;if(t.length==0&&!s)return this;if(n&&(t=t.slice().sort(En)),this.isEmpty)return t.length?ce.of(t):this;let r=new So(this,null,-1).goto(0),c=0,h=[],f=new Oi;for(;r.value||c<t.length;)if(c<t.length&&(r.from-t[c].from||r.startSide-t[c].value.startSide)>=0){let d=t[c++];f.addInner(d.from,d.to,d.value)||h.push(d)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(r.chunkIndex)<t[c].from)&&(!s||l>this.chunkEnd(r.chunkIndex)||o<this.chunkPos[r.chunkIndex])&&f.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!s||l>r.to||o<r.from||s(r.from,r.to,r.value))&&(f.addInner(r.from,r.to,r.value)||h.push(Xt.create(r.from,r.to,r.value))),r.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?ce.empty:this.nextLayer.update({add:h,filter:s,filterFrom:l,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],l=-1;for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],c=this.chunk[s],h=e.touchesRange(r,r+c.length);if(h===!1)l=Math.max(l,c.maxPoint),t.push(c),n.push(e.mapPos(r));else if(h===!0){let{mapped:f,pos:d}=c.map(r,e);f&&(l=Math.max(l,f.maxPoint),t.push(f),n.push(d))}}let o=this.nextLayer.map(e);return t.length==0?o:new ce(n,t,o||ce.empty,l)}between(e,t,n){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let o=this.chunkPos[l],s=this.chunk[l];if(t>=o&&e<=o+s.length&&s.between(o,e-o,t-o,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Zt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Zt.from(e).goto(t)}static compare(e,t,n,l,o=-1){let s=e.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),r=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=o),c=vo(s,r,n),h=new ei(s,c,o),f=new ei(r,c,o);n.iterGaps((d,p,m)=>Bo(h,d,f,p,m,l)),n.empty&&n.length==0&&Bo(h,0,f,0,0,l)}static eq(e,t,n=0,l){l==null&&(l=999999999);let o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0),s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(o.length!=s.length)return!1;if(!o.length)return!0;let r=vo(o,s),c=new ei(o,r,0).goto(n),h=new ei(s,r,0).goto(n);for(;;){if(c.to!=h.to||!Tn(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>l)return!0;c.next(),h.next()}}static spans(e,t,n,l,o=-1){let s=new ei(e,null,o).goto(t),r=t,c=s.openStart;for(;;){let h=Math.min(s.to,n);if(s.point){let f=s.activeForPoint(s.to),d=s.pointFrom<t?f.length+1:s.point.startSide<0?f.length:Math.min(f.length,c);l.point(r,h,s.point,f,d,s.pointRank),c=Math.min(s.openEnd(h),f.length)}else h>r&&(l.span(r,h,s.active,c),c=s.openEnd(h));if(s.to>n)return c+(s.point&&s.to>n?1:0);r=s.to,s.next()}}static of(e,t=!1){let n=new Oi;for(let l of e instanceof Xt?[e]:t?vh(e):e)n.add(l.from,l.to,l.value);return n.finish()}static join(e){if(!e.length)return ce.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let l=e[n];l!=ce.empty;l=l.nextLayer)t=new ce(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}ce.empty=new ce([],[],null,-1);function vh(a){if(a.length>1)for(let e=a[0],t=1;t<a.length;t++){let n=a[t];if(En(e,n)>0)return a.slice().sort(En);e=n}return a}ce.empty.nextLayer=ce.empty;class Oi{finishChunk(e){this.chunks.push(new On(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Oi)).add(e,t,n)}addInner(e,t,n){let l=e-this.lastTo||n.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(ce.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ce.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function vo(a,e,t){let n=new Map;for(let o of a)for(let s=0;s<o.chunk.length;s++)o.chunk[s].maxPoint<=0&&n.set(o.chunk[s],o.chunkPos[s]);let l=new Set;for(let o of e)for(let s=0;s<o.chunk.length;s++){let r=n.get(o.chunk[s]);r!=null&&(t?t.mapPos(r):r)==o.chunkPos[s]&&!t?.touchesRange(r,r+o.chunk[s].length)&&l.add(o.chunk[s])}return l}class So{constructor(e,t,n,l=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=l}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let l=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(l)||this.layer.chunkEnd(this.chunkIndex)<e||l.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<l)&&this.setRangeIndex(l)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Zt{constructor(e){this.heap=e}static from(e,t=null,n=-1){let l=[];for(let o=0;o<e.length;o++)for(let s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&l.push(new So(s,t,n,o));return l.length==1?l[0]:new Zt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Mn(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Mn(this.heap,0)}}}function Mn(a,e){for(let t=a[e];;){let n=(e<<1)+1;if(n>=a.length)break;let l=a[n];if(n+1<a.length&&l.compare(a[n+1])>=0&&(l=a[n+1],n++),t.compare(l)<0)break;a[n]=t,a[e]=l,e=n}}class ei{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Zt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Mi(this.active,e),Mi(this.activeTo,e),Mi(this.activeRank,e),this.minActive=No(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:l,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||l-this.activeTo[t])>0;)t++;Ti(this.active,t,n),Ti(this.activeTo,t,l),Ti(this.activeRank,t,o),e&&Ti(e,t,this.cursor.from),this.minActive=No(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),n&&Mi(n,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let l=n.length-1;l>=0&&n[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Bo(a,e,t,n,l,o){a.goto(e),t.goto(n);let s=n+l,r=n,c=n-e;for(;;){let h=a.to+c-t.to,f=h||a.endSide-t.endSide,d=f<0?a.to+c:t.to,p=Math.min(d,s);if(a.point||t.point?a.point&&t.point&&(a.point==t.point||a.point.eq(t.point))&&Tn(a.activeForPoint(a.to),t.activeForPoint(t.to))||o.comparePoint(r,p,a.point,t.point):p>r&&!Tn(a.active,t.active)&&o.compareRange(r,p,a.active,t.active),d>s)break;(h||a.openEnd!=t.openEnd)&&o.boundChange&&o.boundChange(d),r=d,f<=0&&a.next(),f>=0&&t.next()}}function Tn(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++)if(a[t]!=e[t]&&!a[t].eq(e[t]))return!1;return!0}function Mi(a,e){for(let t=e,n=a.length-1;t<n;t++)a[t]=a[t+1];a.pop()}function Ti(a,e,t){for(let n=a.length-1;n>=e;n--)a[n+1]=a[n];a[e]=t}function No(a,e){let t=-1,n=1e9;for(let l=0;l<e.length;l++)(e[l]-n||a[l].endSide-a[t].endSide)<0&&(t=l,n=e[l]);return t}function Sh(a,e,t,n){for(let l=0,o=0;;){if(o>=e)return l;if(l==a.length)break;o+=a.charCodeAt(l)==9?t-o%t:1,l=Xe(a,l)}return n===!0?-1:a.length}const In="ͼ",Vo=typeof Symbol>"u"?"__"+In:Symbol.for(In),Fn=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class dt{constructor(e,t){this.rules=[];let{finish:n}=t||{};function l(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function o(s,r,c,h){let f=[],d=/^@(\w+)\b/.exec(s[0]),p=d&&d[1]=="keyframes";if(d&&r==null)return c.push(s[0]+";");for(let m in r){let b=r[m];if(/&/.test(m))o(m.split(/,\s*/).map(y=>s.map(A=>y.replace(/&/,A))).reduce((y,A)=>y.concat(A)),b,c);else if(b&&typeof b=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");o(l(m),b,f,p)}else b!=null&&f.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+b+";")}(f.length||p)&&c.push((n&&!d&&!h?s.map(n):s).join(", ")+" {"+f.join(" ")+"}")}for(let s in e)o(l(s),e[s],this.rules)}getRules(){return this.rules.join(`
19
19
  `)}static newName(){let e=Ro[Vo]||1;return Ro[Vo]=e+1,In+e.toString(36)}static mount(e,t,n){let l=e[Fn],o=n&&n.nonce;l?o&&l.setNonce(o):l=new Bh(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let Eo=new Map;class Bh{constructor(e,t){let n=e.ownerDocument||e,l=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=Eo.get(n);if(o)return e[Fn]=o;this.sheet=new l.CSSStyleSheet,Eo.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Fn]=this}mount(e,t){let n=this.sheet,l=0,o=0;for(let s=0;s<e.length;s++){let r=e[s],c=this.modules.indexOf(r);if(c<o&&c>-1&&(this.modules.splice(c,1),o--,c=-1),c==-1){if(this.modules.splice(o++,0,r),n)for(let h=0;h<r.rules.length;h++)n.insertRule(r.rules[h],l++)}else{for(;o<c;)l+=this.modules[o++].rules.length;l+=r.rules.length,o++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let s="";for(let c=0;c<this.modules.length;c++)s+=this.modules[c].getRules()+`
20
- `;this.styleTag.textContent=s;let r=t.head||t;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Et={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Dn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},be=0;be<10;be++)Et[48+be]=Et[96+be]=String(be);for(var be=1;be<=24;be++)Et[be+111]="F"+be;for(var be=65;be<=90;be++)Et[be]=String.fromCharCode(be+32),Dn[be]=String.fromCharCode(be);for(var _n in Et)Dn.hasOwnProperty(_n)||(Dn[_n]=Et[_n]);function ti(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Pn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function Ii(a,e){if(!e.anchorNode)return!1;try{return Pn(a,e.anchorNode)}catch{return!1}}function ii(a){return a.nodeType==3?xt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ni(a,e,t,n){return t?Oo(a,e,t,n,-1)||Oo(a,e,t,n,1):!1}function At(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Fi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function Oo(a,e,t,n,l){for(;;){if(a==t&&e==n)return!0;if(e==(l<0?0:qe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=At(a)+(l<0?0:1),a=o}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?qe(a):0}else return!1}}function qe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Di(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function Nh(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function Mo(a,e){let t=e.width/a.offsetWidth,n=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-a.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function Vh(a,e,t,n,l,o,s,r){let c=a.ownerDocument,h=c.defaultView||window;for(let f=a,d=!1;f&&!d;)if(f.nodeType==1){let p,m=f==c.body,b=1,y=1;if(m)p=Nh(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(d=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let w=f.getBoundingClientRect();({scaleX:b,scaleY:y}=Mo(f,w)),p={left:w.left,right:w.left+f.clientWidth*b,top:w.top,bottom:w.top+f.clientHeight*y}}let A=0,x=0;if(l=="nearest")e.top<p.top?(x=e.top-(p.top+s),t>0&&e.bottom>p.bottom+x&&(x=e.bottom-p.bottom+s)):e.bottom>p.bottom&&(x=e.bottom-p.bottom+s,t<0&&e.top-x<p.top&&(x=e.top-(p.top+s)));else{let w=e.bottom-e.top,V=p.bottom-p.top;x=(l=="center"&&w<=V?e.top+w/2-V/2:l=="start"||l=="center"&&t<0?e.top-s:e.bottom-V+s)-p.top}if(n=="nearest"?e.left<p.left?(A=e.left-(p.left+o),t>0&&e.right>p.right+A&&(A=e.right-p.right+o)):e.right>p.right&&(A=e.right-p.right+o,t<0&&e.left<p.left+A&&(A=e.left-(p.left+o))):A=(n=="center"?e.left+(e.right-e.left)/2-(p.right-p.left)/2:n=="start"==r?e.left-o:e.right-(p.right-p.left)+o)-p.left,A||x)if(m)h.scrollBy(A,x);else{let w=0,V=0;if(x){let k=f.scrollTop;f.scrollTop+=x/y,V=(f.scrollTop-k)*y}if(A){let k=f.scrollLeft;f.scrollLeft+=A/b,w=(f.scrollLeft-k)*b}e={left:e.left-w,top:e.top-V,right:e.right-w,bottom:e.bottom-V},w&&Math.abs(w-A)<1&&(n="nearest"),V&&Math.abs(V-x)<1&&(l="nearest")}if(m)break;(e.top<p.top||e.bottom>p.bottom||e.left<p.left||e.right>p.right)&&(e={left:Math.max(e.left,p.left),right:Math.min(e.right,p.right),top:Math.max(e.top,p.top),bottom:Math.min(e.bottom,p.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Rh(a){let e=a.ownerDocument,t,n;for(let l=a.parentNode;l&&!(l==e.body||t&&n);)if(l.nodeType==1)!n&&l.scrollHeight>l.clientHeight&&(n=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:n}}class Eh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?qe(t):0),n,Math.min(e.focusOffset,n?qe(n):0))}set(e,t,n,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=l}}let Ot=null;function To(a){if(a.setActive)return a.setActive();if(Ot)return a.focus(Ot);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;t<e.length;){let n=e[t++],l=e[t++],o=e[t++];n.scrollTop!=l&&(n.scrollTop=l),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let Io;function xt(a,e,t=e){let n=Io||(Io=document.createRange());return n.setEnd(a,t),n.setStart(a,e),n}function Mt(a,e,t,n){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=n);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,a.dispatchEvent(o);let s=new KeyboardEvent("keyup",l);return s.synthetic=!0,a.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Oh(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Fo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function Mh(a,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,qe(t));;)if(n){if(t.nodeType!=1)return!1;let l=t.childNodes[n-1];l.contentEditable=="false"?n--:(t=l,n=qe(t))}else{if(t==a)return!0;n=At(t),t=t.parentNode}}function Do(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function _o(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=qe(t)}else if(t.parentNode&&!Fi(t))n=At(t),t=t.parentNode;else return null}}function Po(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Fi(t))n=At(t)+1,t=t.parentNode;else return null}}class Ce{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ce(e.parentNode,At(e),t)}static after(e,t){return new Ce(e.parentNode,At(e)+1,t)}}const $n=[];class se{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:n.firstChild)){let r=se.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,t),s.flags&=-8}if(o=l?l.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&o!=s.dom&&(t.written=!0),s.dom.parentNode==n)for(;o&&o!=s.dom;)o=$o(o);else n.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:n.firstChild,o&&t&&t.node==n&&(t.written=!0);o;)o=$o(o)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let l=qe(e)==0?0:t==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;l==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?l=-1:l=1),e=o}l<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!se.get(n);)n=n.nextSibling;if(!n)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==n)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,t,n=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,h=n,f=n;c<this.children.length;c++){let d=this.children[c],p=h+d.length;if(h<e&&p>t)return d.domBoundsAround(e,t,h);if(p>=e&&l==-1&&(l=c,o=h),h>t&&d.dom.parentNode==this.dom){s=c,r=f;break}f=p,h=p+d.breakAfter}return{from:o,to:r<0?n+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=$n){this.markDirty();for(let l=e;l<t;l++){let o=this.children[l];o.parent==this&&n.indexOf(o)<0&&o.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let l=0;l<n.length;l++)n[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Lo(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,l,o,s){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}se.prototype.breakAfter=0;function $o(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Lo{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Uo(a,e,t,n,l,o,s,r,c){let{children:h}=a,f=h.length?h[e]:null,d=o.length?o[o.length-1]:null,p=d?d.breakAfter:s;if(!(e==n&&f&&!s&&!p&&o.length<2&&f.merge(t,l,o.length?d:null,t==0,r,c))){if(n<h.length){let m=h[n];m&&(l<m.length||m.breakAfter&&d?.breakAfter)?(e==n&&(m=m.split(l),l=0),!p&&d&&m.merge(0,l,d,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(d?d.breakAfter=1:s=1),n++}for(f&&(f.breakAfter=s,t>0&&(!s&&o.length&&f.merge(t,f.length,o[0],!1,r,0)?f.breakAfter=o.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,r,0),e++));e<n&&o.length;)if(h[n-1].become(o[o.length-1]))n--,o.pop(),c=o.length?0:r;else if(h[e].become(o[0]))e++,o.shift(),r=o.length?0:c;else break;!o.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,r,c)&&e--,(e<n||o.length)&&a.replaceChildren(e,n,o)}}function zo(a,e,t,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(t,1),{i:h,off:f}=s.findPos(e,-1),d=e-t;for(let p of n)d+=p.length;a.length+=d,Uo(a,h,f,r,c,n,0,l,o)}let Ne=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ln=typeof document<"u"?document:{documentElement:{style:{}}};const Un=/Edge\/(\d+)/.exec(Ne.userAgent),jo=/MSIE \d/.test(Ne.userAgent),zn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),_i=!!(jo||zn||Un),qo=!_i&&/gecko\/(\d+)/i.test(Ne.userAgent),jn=!_i&&/Chrome\/(\d+)/.exec(Ne.userAgent),Qo="webkitFontSmoothing"in Ln.documentElement.style,Wo=!_i&&/Apple Computer/.test(Ne.vendor),Yo=Wo&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var W={mac:Yo||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:_i,ie_version:jo?Ln.documentMode||6:zn?+zn[1]:Un?+Un[1]:0,gecko:qo,gecko_version:qo?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Yo,android:/Android\b/.test(Ne.userAgent),webkit:Qo,safari:Wo,webkit_version:Qo?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:Ln.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Th=256;class _e extends se{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof _e)||this.length-(t-e)+n.length>Th||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new _e(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ce(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Ih(this.dom,e,t)}}class tt extends se{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let l of t)l.setParent(this)}setAttrs(e){if(Fo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,l,o,s){return n&&(!(n instanceof tt&&n.mark.eq(this.mark))||e&&o<=0||t<this.length&&s<=0)?!1:(zo(this,e,t,n?n.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let t=[],n=0,l=-1,o=0;for(let r of this.children){let c=n+r.length;c>e&&t.push(n<e?r.split(e-n):r),l<0&&n>=e&&(l=o),n=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new tt(this.mark,t,s)}domAtPos(e){return Ho(this,e)}coordsAt(e,t){return Go(this,e,t)}}function Ih(a,e,t){let n=a.nodeValue.length;e>n&&(e=n);let l=e,o=e,s=0;e==0&&t<0||e==n&&t>=0?W.chrome||W.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):t<0?l--:o<n&&o++;let r=xt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:t>=0)?0:r.length-1];return W.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,h=>h.width)||c),s?Di(c,s<0):c||null}class Ct extends se{static create(e,t,n){return new Ct(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ct.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,l,o,s){return n&&(!(n instanceof Ct)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Ct&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return ie.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,l=this.posAtStart;return n?n.slice(l,l+this.length):ie.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let l=this.dom.getClientRects(),o=null;if(!l.length)return null;let s=this.side?this.side<0:e>0;for(let r=s?l.length-1:0;o=l[r],!(e>0?r==0:r==l.length-1||o.top<o.bottom);r+=s?-1:1);return Di(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Tt extends se{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Tt&&e.side==this.side}split(){return new Tt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ce.before(this.dom):Ce.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ie.empty}get isHidden(){return!0}}_e.prototype.children=Ct.prototype.children=Tt.prototype.children=$n;function Ho(a,e){let t=a.dom,{children:n}=a,l=0;for(let o=0;l<n.length;l++){let s=n[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==t)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=n[o-1];if(s.dom.parentNode==t)return s.domAtPos(s.length)}for(let o=l;o<n.length;o++){let s=n[o];if(s.dom.parentNode==t)return s.domAtPos(0)}return new Ce(t,0)}function Ko(a,e,t){let n,{children:l}=a;t>0&&e instanceof tt&&l.length&&(n=l[l.length-1])instanceof tt&&n.mark.eq(e.mark)?Ko(n,e.children[0],t-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Go(a,e,t){let n=null,l=-1,o=null,s=-1;function r(h,f){for(let d=0,p=0;d<h.children.length&&p<=f;d++){let m=h.children[d],b=p+m.length;b>=f&&(m.children.length?r(m,f-p):(!o||o.isHidden&&(t>0||Dh(o,m)))&&(b>f||p==b&&m.getSide()>0)?(o=m,s=f-p):(p<f||p==b&&m.getSide()<0&&!m.isHidden)&&(n=m,l=f-p)),p=b}}r(a,e);let c=(t<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),t):Fh(a)}function Fh(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=ii(e);return t[t.length-1]||null}function Dh(a,e){let t=a.coordsAt(0,1),n=e.coordsAt(0,1);return t&&n&&n.top<t.bottom}function qn(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const Jo=Object.create(null);function Pi(a,e,t){if(a==e)return!0;a||(a=Jo),e||(e=Jo);let n=Object.keys(a),l=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let o of n)if(o!=t&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Qn(a,e,t){let n=!1;if(e)for(let l in e)t&&l in t||(n=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(n=!0,l=="style"?a.style.cssText=t[l]:a.setAttribute(l,t[l]));return n}function _h(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let n=a.attributes[t];e[n.name]=n.value}return e}class Wn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Qe=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Qe||(Qe={}));class ve extends Rt{constructor(e,t,n,l){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=l}get heightRelevant(){return!1}static mark(e){return new li(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ht(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,l;if(e.isBlockGap)n=-5e8,l=4e8;else{let{start:o,end:s}=Xo(e,t);n=(o?t?-3e8:-1:5e8)-1,l=(s?t?2e8:1:-6e8)+1}return new ht(e,n,l,t,e.widget||null,!0)}static line(e){return new oi(e)}static set(e,t=!1){return ce.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ve.none=ce.empty;class li extends ve{constructor(e){let{start:t,end:n}=Xo(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof li&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Pi(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}li.prototype.point=!1;class oi extends ve{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof oi&&this.spec.class==e.spec.class&&Pi(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}oi.prototype.mapMode=Re.TrackBefore,oi.prototype.point=!0;class ht extends ve{constructor(e,t,n,l,o,s){super(t,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?t<=0?Re.TrackBefore:Re.TrackAfter:Re.TrackDel}get type(){return this.startSide!=this.endSide?Qe.WidgetRange:this.startSide<=0?Qe.WidgetBefore:Qe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ht&&Ph(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ht.prototype.point=!0;function Xo(a,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=a;return t==null&&(t=a.inclusive),n==null&&(n=a.inclusive),{start:t??e,end:n??e}}function Ph(a,e){return a==e||!!(a&&e&&a.compare(e))}function $i(a,e,t,n=0){let l=t.length-1;l>=0&&t[l]+n>=a?t[l]=Math.max(t[l],e):t.push(a,e)}class ue extends se{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,l,o,s){if(n){if(!(n instanceof ue))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),zo(this,e,t,n?n.children.slice():[],o,s),!0}split(e){let t=new ue;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:l}=this.childPos(e);l&&(t.append(this.children[n].split(l),0),this.children[n].merge(l,this.children[n].length,null,!1,0,0),n++);for(let o=n;o<this.children.length;o++)t.append(this.children[o],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Pi(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ko(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=qn(t,this.attrs||{})),n&&(this.attrs=qn({class:n},this.attrs||{}))}domAtPos(e){return Ho(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Fo(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Qn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&se.get(l)instanceof tt;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=se.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!W.ios||!this.children.some(o=>o instanceof _e))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof _e)||/[^ -~]/.test(n.text))return null;let l=ii(n.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Go(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:n.top+s,bottom:n.bottom-s,left:n.left,right:n.left}}}return n}become(e){return e instanceof ue&&this.children.length==0&&e.children.length==0&&Pi(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,l=0;n<e.children.length;n++){let o=e.children[n],s=l+o.length;if(s>=t){if(o instanceof ue)return o;if(s>t)break}l=s+o.breakAfter}return null}}class it extends se{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,l,o,s){return n&&(!(n instanceof it)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new it(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return $n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):ie.empty}domBoundsAround(){return null}become(e){return e instanceof it&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof Yn?null:Di(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class Yn extends Wn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class si{constructor(e,t,n,l){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof it&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ue),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Li(new Tt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof it)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Li(new _e(this.text.slice(this.textOff,this.textOff+l)),t),n),this.atCursorPos=!0,this.textOff+=l,e-=l,n=0}}span(e,t,n,l){this.buildText(t-e,n,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,n,l,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof ht){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(n instanceof ht)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new it(n.widget||It.block,r,n));else{let c=Ct.create(n.widget||It.inline,r,r?0:n.startSide),h=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<t||n.startSide>0),f=!c.isEditable&&(e<t||o>l.length||n.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(d.append(Li(new Tt(1),l),o),o=l.length+Math.max(0,o-l.length)),d.append(Li(c,l),o),this.atCursorPos=f,this.pendingBuffer=f?e<t||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=o)}static build(e,t,n,l,o){let s=new si(e,t,n,o);return s.openEnd=ce.spans(l,t,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Li(a,e){for(let t of e)a=new tt(t,[a],a.length);return a}class It extends Wn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}It.inline=new It("span"),It.block=new It("div");var ye=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(ye||(ye={}));const vt=ye.LTR,Hn=ye.RTL;function Zo(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const $h=Zo("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Lh=Zo("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Kn=Object.create(null),We=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Kn[e]=t,Kn[t]=-e}function es(a){return a<=247?$h[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Lh[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Uh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ft{get dir(){return this.level%2?Hn:vt}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=t&&r.to>=t){if(r.level==n)return s;(o<0||(l!=0?l<0?r.from<t:r.to>t:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ts(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let n=a[t],l=e[t];if(n.from!=l.from||n.to!=l.to||n.direction!=l.direction||!ts(n.inner,l.inner))return!1}return!0}const ae=[];function zh(a,e,t,n,l){for(let o=0;o<=n.length;o++){let s=o?n[o-1].to:e,r=o<n.length?n[o].from:t,c=o?256:l;for(let h=s,f=c,d=c;h<r;h++){let p=es(a.charCodeAt(h));p==512?p=f:p==8&&d==4&&(p=16),ae[h]=p==4?2:p,p&7&&(d=p),f=p}for(let h=s,f=c,d=c;h<r;h++){let p=ae[h];if(p==128)h<r-1&&f==ae[h+1]&&f&24?p=ae[h]=f:ae[h]=256;else if(p==64){let m=h+1;for(;m<r&&ae[m]==64;)m++;let b=h&&f==8||m<t&&ae[m]==8?d==1?1:8:256;for(let y=h;y<m;y++)ae[y]=b;h=m-1}else p==8&&d==1&&(ae[h]=1);f=p,p&7&&(d=p)}}}function jh(a,e,t,n,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=n.length;s++){let h=s?n[s-1].to:e,f=s<n.length?n[s].from:t;for(let d=h,p,m,b;d<f;d++)if(m=Kn[p=a.charCodeAt(d)])if(m<0){for(let y=r-3;y>=0;y-=3)if(We[y+1]==-m){let A=We[y+2],x=A&2?l:A&4?A&1?o:l:0;x&&(ae[d]=ae[We[y]]=x),r=y;break}}else{if(We.length==189)break;We[r++]=d,We[r++]=p,We[r++]=c}else if((b=ae[d])==2||b==1){let y=b==l;c=y?0:1;for(let A=r-3;A>=0;A-=3){let x=We[A+2];if(x&2)break;if(y)We[A+2]|=2;else{if(x&4)break;We[A+2]|=4}}}}}function qh(a,e,t,n){for(let l=0,o=n;l<=t.length;l++){let s=l?t[l-1].to:a,r=l<t.length?t[l].from:e;for(let c=s;c<r;){let h=ae[c];if(h==256){let f=c+1;for(;;)if(f==r){if(l==t.length)break;f=t[l++].to,r=l<t.length?t[l].from:e}else if(ae[f]==256)f++;else break;let d=o==1,p=(f<e?ae[f]:n)==1,m=d==p?d?1:2:n;for(let b=f,y=l,A=y?t[y-1].to:a;b>c;)b==A&&(b=t[--y].from,A=y?t[y-1].to:a),ae[--b]=m;c=f}else o=h,c++}}}function Gn(a,e,t,n,l,o,s){let r=n%2?2:1;if(n%2==l%2)for(let c=e,h=0;c<t;){let f=!0,d=!1;if(h==o.length||c<o[h].from){let y=ae[c];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h<o.length&&b==o[h].from){if(d)break e;let y=o[h];if(!f)for(let A=y.to,x=h+1;;){if(A==t)break e;if(x<o.length&&o[x].from==A)A=o[x++].to;else{if(ae[A]==r)break e;break}}if(h++,p)p.push(y);else{y.from>c&&s.push(new ft(c,y.from,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.to}b=y.to}else{if(b==t||(f?ae[b]!=r:ae[b]==r))break;b++}p?Gn(a,c,b,n+1,l,p,s):c<b&&s.push(new ft(c,b,m)),c=b}else for(let c=t,h=o.length;c>e;){let f=!0,d=!1;if(!h||c>o[h-1].to){let y=ae[c-1];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h&&b==o[h-1].to){if(d)break e;let y=o[--h];if(!f)for(let A=y.from,x=h;;){if(A==e)break e;if(x&&o[x-1].to==A)A=o[--x].from;else{if(ae[A-1]==r)break e;break}}if(p)p.push(y);else{y.to<c&&s.push(new ft(y.to,c,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.from}b=y.from}else{if(b==e||(f?ae[b-1]!=r:ae[b-1]==r))break;b--}p?Gn(a,b,c,n+1,l,p,s):b<c&&s.push(new ft(b,c,m)),c=b}}function Jn(a,e,t,n,l,o,s){let r=e%2?2:1;zh(a,l,o,n,r),jh(a,l,o,n,r),qh(l,o,n,r),Gn(a,l,o,e,t,n,s)}function Qh(a,e,t){if(!a)return[new ft(0,0,e==Hn?1:0)];if(e==vt&&!t.length&&!Uh.test(a))return is(a.length);if(t.length)for(;a.length>ae.length;)ae[ae.length]=256;let n=[],l=e==vt?0:1;return Jn(a,l,l,t,0,a.length,n),n}function is(a){return[new ft(0,a,0)]}let ns="";function Wh(a,e,t,n,l){var o;let s=n.head-a.from,r=ft.find(e,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),c=e[r],h=c.side(l,t);if(s==h){let p=r+=l?1:-1;if(p<0||p>=e.length)return null;c=e[r=p],s=c.side(!l,t),h=c.side(l,t)}let f=Xe(a.text,s,c.forward(l,t));(f<c.from||f>c.to)&&(f=h),ns=a.text.slice(Math.min(s,f),Math.max(s,f));let d=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return d&&f==h&&d.level+(l?0:1)<c.level?H.cursor(d.side(!l,t)+a.from,d.forward(l,t)?1:-1,d.level):H.cursor(f+a.from,c.forward(l,t)?-1:1,c.level)}function Yh(a,e,t){for(let n=e;n<t;n++){let l=es(a.charCodeAt(n));if(l==1)return vt;if(l==2||l==4)return Hn}return vt}const ls=G.define(),os=G.define(),ss=G.define(),as=G.define(),Xn=G.define(),rs=G.define(),cs=G.define(),Zn=G.define(),el=G.define(),ds=G.define({combine:a=>a.some(e=>e)}),Hh=G.define({combine:a=>a.some(e=>e)}),hs=G.define();class Ft{constructor(e,t="nearest",n="nearest",l=5,o=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Ft(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ft(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ui=pe.define({map:(a,e)=>a.map(e)}),fs=pe.define();function Ye(a,e,t){let n=a.facet(as);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const nt=G.define({combine:a=>a.length?a[0]:!0});let Kh=0;const Dt=G.define({combine(a){return a.filter((e,t)=>{for(let n=0;n<t;n++)if(a[n].plugin==e.plugin)return!1;return!0})}});class _t{constructor(e,t,n,l,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Dt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Dt.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=t||{};return new _t(Kh++,e,n,l,r=>{let c=[];return s&&c.push(ai.of(h=>{let f=h.plugin(r);return f?s(f):ve.none})),o&&c.push(o(r)),c})}static fromClass(e,t){return _t.define((n,l)=>new e(n,l),t)}}class tl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Ye(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Ye(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Ye(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const us=G.define(),il=G.define(),ai=G.define(),ps=G.define(),nl=G.define(),ms=G.define();function gs(a,e){let t=a.state.facet(ms);if(!t.length)return t;let n=t.map(o=>o instanceof Function?o(a):o),l=[];return ce.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let h=o-e.from,f=s-e.from,d=l;for(let p=r.length-1;p>=0;p--,c--){let m=r[p].spec.bidiIsolate,b;if(m==null&&(m=Yh(e.text,h,f)),c>0&&d.length&&(b=d[d.length-1]).to==h&&b.direction==m)b.to=f,d=b.inner;else{let y={from:h,to:f,direction:m,inner:[]};d.push(y),d=y.inner}}}}),l}const ks=G.define();function bs(a){let e=0,t=0,n=0,l=0;for(let o of a.state.facet(ks)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(t=Math.max(t,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:t,top:n,bottom:l}}const ri=G.define();class Te{constructor(e,t,n,l){this.fromA=e,this.toA=t,this.fromB=n,this.toB=l}join(e){return new Te(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>n.toA)){if(l.toA<n.fromA)break;n=n.join(l),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],h=s-r,f=c?c.fromB:1e9;for(;o<t.length&&t[o]<f;){let d=t[o],p=t[o+1],m=Math.max(r,d),b=Math.min(f,p);if(m<=b&&new Te(m+h,b+h,m,b).addToSet(n),p>f)break;o+=2}if(!c)return n;new Te(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class zi{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ge.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new Te(o,s,r,c))),this.changedRanges=l}static create(e,t,n){return new zi(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class ys extends se{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ve.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ue],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Te(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:h,toA:f})=>f<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!nf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Jh(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;n=new Te(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(W.ie||W.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=ef(s,r,e.changes);return n=Te.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||l.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof it&&s.widget instanceof Yn&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,t,n){let l=n?n.range.addToSet(e.slice()):e,o=this.childCursor(t);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:h,fromB:f,toB:d}=r,p,m,b,y;if(n&&n.range.fromB<d&&n.range.toB>f){let k=si.build(this.view.state.doc,f,n.range.fromB,this.decorations,this.dynamicDecorationMap),u=si.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,b=k.openStart,y=u.openEnd;let N=this.compositionView(n);u.breakAtStart?N.breakAfter=1:u.content.length&&N.merge(N.length,N.length,u.content[0],!1,u.openStart,0)&&(N.breakAfter=u.content[0].breakAfter,u.content.shift()),k.content.length&&N.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),p=k.content.concat(N).concat(u.content)}else({content:p,breakAtStart:m,openStart:b,openEnd:y}=si.build(this.view.state.doc,f,d,this.decorations,this.dynamicDecorationMap));let{i:A,off:x}=o.findPos(h,1),{i:w,off:V}=o.findPos(c,-1);Uo(this,w,V,A,x,p,m,b,y)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(fs)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new _e(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new tt(l,[t],t.length);let n=new ue;return n.append(t,0),n}fixCompositionDOM(e){let t=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=se.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},n=this.childPos(e.range.fromB,1),l=this.children[n.i];t(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)n=l.childPos(n.off,1),l=l.children[n.i],t(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,l=n==this.dom,o=!l&&!(this.view.state.facet(nt)||this.dom.tabIndex>-1)&&Ii(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(l||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?c:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Gh(c)){let d=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(d,c.node.childNodes[c.offset]||null)),c=h=new Ce(d,0),s=!0}let f=this.view.observer.selectionRange;(s||!f.focusNode||(!ni(c.node,c.offset,f.anchorNode,f.anchorOffset)||!ni(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(f.focusNode)&&tf(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=ti(this.view.root);if(d)if(r.empty){if(W.gecko){let p=Xh(c.node,c.offset);if(p&&p!=3){let m=(p==1?_o:Po)(c.node,c.offset);m&&(c=new Ce(m.node,m.offset))}}d.collapse(c.node,c.offset),r.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=r.bidiLevel)}else if(d.extend){d.collapse(c.node,c.offset);try{d.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();r.anchor>r.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ce(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Ce(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ni(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ti(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let s=ue.find(this,t.head);if(!s)return;let r=s.posAtStart;if(t.head==r||t.head==r+s.length)return;let c=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);n.collapse(f.node,f.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=t.from&&n.collapse(l,o)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let l=e.offset;!n&&l<t.childNodes.length;l++){let o=se.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=se.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(o.length))}return n?new Ce(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=se.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(n<l.length||l instanceof ue)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,l=0;for(let o=this.length,s=this.children.length-1;s>=0;s--){let r=this.children[s],c=o-r.breakAfter,h=c-r.length;if(c<e)break;if(h<=e&&(h<e||r.covers(-1))&&(c>e||r.covers(1))&&(!n||r instanceof ue&&!(n instanceof ue&&t>=0)))n=r,l=h;else if(n&&h==e&&c==e&&r instanceof it&&Math.abs(t)<2){if(r.deco.startSide<0)break;s&&(n=null)}o=h}return n?n.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ue))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(n,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}n=c}if(!(l instanceof _e))return null;let o=Xe(l.text,n);if(o==n)return null;let s=xt(l.dom,n,o).getClientRects();for(let r=0;r<s.length;r++){let c=s[r];if(r==s.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:l}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,c=this.view.textDirection==ye.LTR;for(let h=0,f=0;f<this.children.length;f++){let d=this.children[f],p=h+d.length;if(p>l)break;if(h>=n){let m=d.dom.getBoundingClientRect();if(t.push(m.height),s){let b=d.dom.lastChild,y=b?ii(b):[];if(y.length){let A=y[y.length-1],x=c?A.right-m.left:m.right-A.left;x>r&&(r=x,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=p)}}}h=p+d.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ye.RTL:ye.LTR}measureTextSize(){for(let o of this.children)if(o instanceof ue){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),t,n,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=ii(e.firstChild)[0];t=e.getBoundingClientRect().height,n=o?o.width/27:7,l=o?o.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Lo(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],s=o?o.from-1:this.length;if(s>n){let r=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ve.replace({widget:new Yn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return ve.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ai).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(ps).map((o,s)=>{let r=typeof o=="function";return r&&(n=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=n,t.push(ce.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(hs))try{if(h(this.view,e.range,e))return!0}catch(f){Ye(this.view.state,f,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!n)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,l.left),top:Math.min(n.top,l.top),right:Math.max(n.right,l.right),bottom:Math.max(n.bottom,l.bottom)});let o=bs(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;Vh(this.view.scrollDOM,s,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==ye.LTR)}}function Gh(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function ws(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let n=_o(t.focusNode,t.focusOffset),l=Po(t.focusNode,t.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=se.get(l.node);if(!r||r instanceof _e&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=se.get(n.node);!c||c instanceof _e&&c.text!=n.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=n,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Jh(a,e,t){let n=ws(a,t);if(!n)return null;let{node:l,from:o,to:s}=n,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(n.from,n.to)!=r)return null;let c=e.invertedDesc,h=new Te(c.mapPos(o),c.mapPos(s),o,s),f=[];for(let d=l.parentNode;;d=d.parentNode){let p=se.get(d);if(p instanceof tt)f.push({node:d,deco:p.mark});else{if(p instanceof ue||d.nodeName=="DIV"&&d.parentNode==a.contentDOM)return{range:h,text:l,marks:f,line:d};if(d!=a.contentDOM)f.push({node:d,deco:new li({inclusive:!0,attributes:_h(d),tagName:d.tagName.toLowerCase()})});else return null}}}function Xh(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let Zh=class{constructor(){this.changes=[]}compareRange(e,t){$i(e,t,this.changes)}comparePoint(e,t){$i(e,t,this.changes)}boundChange(e){$i(e,e,this.changes)}};function ef(a,e,t){let n=new Zh;return ce.compare(a,e,t,n),n.changes}function tf(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function nf(a,e){let t=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(t=!0)}),t}function lf(a,e,t=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return H.cursor(e);o==0?t=1:o==l.length&&(t=-1);let s=o,r=o;t<0?s=Xe(l.text,o,!1):r=Xe(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let h=Xe(l.text,s,!1);if(n(l.text.slice(h,s))!=c)break;s=h}for(;r<l.length;){let h=Xe(l.text,r);if(n(l.text.slice(r,h))!=c)break;r=h}return H.range(s+l.from,r+l.from)}function of(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function sf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ll(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function As(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function xs(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ol(a,e,t){let n,l,o,s,r=!1,c,h,f,d;for(let b=a.firstChild;b;b=b.nextSibling){let y=ii(b);for(let A=0;A<y.length;A++){let x=y[A];l&&ll(l,x)&&(x=As(xs(x,l.bottom),l.top));let w=of(e,x),V=sf(t,x);if(w==0&&V==0)return b.nodeType==3?Cs(b,e,t):ol(b,e,t);(!n||s>V||s==V&&o>w)&&(n=b,l=x,o=w,s=V,r=w?e<x.left?A>0:A<y.length-1:!0),w==0?t>x.bottom&&(!f||f.bottom<x.bottom)?(c=b,f=x):t<x.top&&(!d||d.top>x.top)&&(h=b,d=x):f&&ll(f,x)?f=xs(f,x.bottom):d&&ll(d,x)&&(d=As(d,x.top))}}if(f&&f.bottom>=t?(n=c,l=f):d&&d.top<=t&&(n=h,l=d),!n)return{node:a,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return Cs(n,p,t);if(r&&n.contentEditable!="false")return ol(n,p,t);let m=Array.prototype.indexOf.call(a.childNodes,n)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function Cs(a,e,t){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=xt(a,r,r+1).getClientRects();for(let h=0;h<c.length;h++){let f=c[h];if(f.top==f.bottom)continue;s||(s=e-f.left);let d=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&d<o){let p=e>=(f.left+f.right)/2,m=p;if((W.chrome||W.gecko)&&xt(a,r).getBoundingClientRect().left==f.right&&(m=!p),d<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=d}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function vs(a,e,t,n=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:h}=a.viewState,{x:f,y:d}=e,p=d-r;if(p<0)return 0;if(p>h)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,u=!1;c=a.elementAtHeight(p),c.type!=Qe.Text;)for(;p=n>0?c.bottom+k:c.top-k,!(p>=0&&p<=h);){if(u)return t?null:0;u=!0,n=-n}d=r+p;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:t?null:Ss(a,s,c,f,d);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:Ss(a,s,c,f,d);let b=a.dom.ownerDocument,y=a.root.elementFromPoint?a.root:b,A=y.elementFromPoint(f,d);A&&!a.contentDOM.contains(A)&&(A=null),A||(f=Math.max(s.left+1,Math.min(s.right-1,f)),A=y.elementFromPoint(f,d),A&&!a.contentDOM.contains(A)&&(A=null));let x,w=-1;if(A&&((l=a.docView.nearest(A))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(f,d);k&&({offsetNode:x,offset:w}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(f,d);k&&({startContainer:x,startOffset:w}=k,(!a.contentDOM.contains(x)||W.safari&&af(x,w,f)||W.chrome&&rf(x,w,f))&&(x=void 0))}x&&(w=Math.min(qe(x),w))}if(!x||!a.docView.dom.contains(x)){let k=ue.find(a.docView,m);if(!k)return p>c.top+c.height/2?c.to:c.from;({node:x,offset:w}=ol(k.dom,f,d))}let V=a.docView.nearest(x);if(!V)return null;if(V.isWidget&&((o=V.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=V.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?V.posAtStart:V.posAtEnd}else return V.localPosFromDOM(x,w)+V.posAtStart}function Ss(a,e,t,n,l){let o=Math.round((n-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-t.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(t.from,t.to);return t.from+Sh(s,o,a.state.tabSize)}function af(a,e,t){let n,l=a;if(a.nodeType!=3||e!=(n=a.nodeValue.length))return!1;for(;;){let o=l.nextSibling;if(o){if(o.nodeName=="BR")break;return!1}else{let s=l.parentNode;if(!s||s.nodeName=="DIV")break;l=s}}return xt(a,n-1,n).getBoundingClientRect().right>t}function rf(a,e,t){if(e!=0)return!1;for(let l=a;;){let o=l.parentNode;if(!o||o.nodeType!=1||o.firstChild!=l)return!1;if(o.classList.contains("cm-line"))break;l=o}let n=a.nodeType==1?a.getBoundingClientRect():xt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function cf(a,e,t){let n=a.lineBlockAt(e);if(Array.isArray(n.type)){let l;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Qe.Text&&(l.type!=o.type||(t<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function df(a,e,t,n){let l=cf(a,e.head,e.assoc||-1),o=!n||l.type!=Qe.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let s=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),c=a.posAtCoords({x:t==(r==ye.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return H.cursor(c,t?-1:1)}return H.cursor(t?l.to:l.from,t?-1:1)}function Bs(a,e,t,n){let l=a.state.doc.lineAt(e.head),o=a.bidiSpans(l),s=a.textDirectionAt(l.from);for(let r=e,c=null;;){let h=Wh(l,o,s,r,t),f=ns;if(!h){if(l.number==(t?a.state.doc.lines:1))return r;f=`
21
- `,l=a.state.doc.line(l.number+(t?1:-1)),o=a.bidiSpans(l),h=a.visualLineSide(l,!t)}if(c){if(!c(f))return r}else{if(!n)return h;c=n(f)}r=h}}function hf(a,e,t){let n=a.state.charCategorizer(e),l=n(t);return o=>{let s=n(o);return l==et.Space&&(l=s),l==s}}function ff(a,e,t,n){let l=e.head,o=t?1:-1;if(l==(t?a.state.doc.length:0))return H.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),h=a.coordsAtPos(l,e.assoc||-1),f=a.documentTop;if(h)s==null&&(s=h.left-c.left),r=o<0?h.top:h.bottom;else{let m=a.viewState.lineBlockAt(l);s==null&&(s=Math.min(c.right-c.left,a.defaultCharacterWidth*(l-m.from))),r=(o<0?m.top:m.bottom)+f}let d=c.left+s,p=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(p+m)*o,y=vs(a,{x:d,y:b},!1,o);if(b<c.top||b>c.bottom||(o<0?y<l:y>l)){let A=a.docView.coordsForChar(y),x=!A||b<A.top?-1:1;return H.cursor(y,x,void 0,s)}}}function ji(a,e,t){for(;;){let n=0;for(let l of a)l.between(e-1,e+1,(o,s,r)=>{if(e>o&&e<s){let c=n||t||(e-o<s-e?-1:1);e=c<0?o:s,n=c}});if(!n)return e}}function sl(a,e,t){let n=ji(a.state.facet(nl).map(l=>l(a)),t.from,e.head>t.from?-1:1);return n==t.from?t:H.cursor(n,n<t.from?1:-1)}const ci="￿";class uf{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(oe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let l=e;;){this.findPointBefore(n,l);let o=this.text.length;this.readNode(l);let s=l.nextSibling;if(s==t)break;let r=se.get(l),c=se.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:Fi(l))||Fi(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=l.exec(t))&&(o=r.index,s=r[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let t=se.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let l=n.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(pf(e,n.node,n.offset)?t:0))}}function pf(a,e,t){for(;;){if(!e||t<qe(e))return!1;if(e==a)return!0;t=At(e)+1,e=e.parentNode}}class Ns{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class mf{constructor(e,t,n,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let r=o||s?[]:bf(e),c=new uf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=yf(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Pn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=s&&s.node==r.anchorNode&&s.offset==r.anchorOffset||!Pn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to<e.state.doc.length)){let d=Math.min(c,h),p=Math.max(c,h),m=f.from-d,b=f.to-p;(m==0||m==1||d==0)&&(b==0||b==-1||p==e.state.doc.length)&&(c=0,h=e.state.doc.length)}this.newSel=H.single(h,c)}}}function Vs(a,e){let t,{newSel:n}=e,l=a.state.selection.main,o=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:r}=e.bounds,c=l.from,h=null;(o===8||W.android&&e.text.length<r-s)&&(c=l.to,h="end");let f=kf(a.state.doc.sliceString(s,r,ci),e.text,c-s,h);f&&(W.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ci+ci&&f.toB--,t={from:s+f.from,to:s+f.toA,insert:ie.of(e.text.slice(f.from,f.toB).split(ci))})}else n&&(!a.hasFocus&&a.state.facet(nt)||n.main.eq(l))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!l.empty&&n&&n.main.empty?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(W.mac||W.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=H.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:ie.of([t.insert.toString().replace("."," ")])}):t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,t.from).append(t.insert).append(a.state.doc.slice(t.to,l.to))}:W.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
22
- `&&a.lineWrapping&&(n&&(n=H.single(n.main.anchor-1,n.main.head-1)),t={from:l.from,to:l.to,insert:ie.of([" "])}),t)return al(a,t,n,o);if(n&&!n.main.eq(l)){let s=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(s=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:n,scrollIntoView:s,userEvent:r}),!0}else return!1}function al(a,e,t,n=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Mt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&Mt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Mt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=gf(a,e,t));return a.state.facet(rs).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function gf(a,e,t){let n,l=a.state,o=l.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=o.from<e.from?l.sliceDoc(o.from,e.from):"",c=o.to>e.to?l.sliceDoc(e.to,o.to):"";n=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let h=a.state.sliceDoc(e.from,e.to),f,d=t&&ws(a,t.main.head);if(d){let b=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-b}}else f=a.state.doc.lineAt(o.head);let p=o.to-e.to,m=o.to-o.from;n=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:r,range:c||b.map(r)};let y=b.to-p,A=y-h.length;if(b.to-b.from!=m||a.state.sliceDoc(A,y)!=h||b.to>=f.from&&b.from<=f.to)return{range:b};let x=l.changes({from:A,to:y,insert:e.insert}),w=b.to-o.to;return{changes:x,range:c?H.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):b.map(x)}})}else n={changes:r,selection:c&&l.selection.replaceRange(c)}}let s="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,s+=".compose",a.inputState.compositionFirstChange&&(s+=".start",a.inputState.compositionFirstChange=!1)),l.update(n,{userEvent:s,scrollIntoView:!0})}function kf(a,e,t,n){let l=Math.min(a.length,e.length),o=0;for(;o<l&&a.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==l&&a.length==e.length)return null;let s=a.length,r=e.length;for(;s>0&&r>0&&a.charCodeAt(s-1)==e.charCodeAt(r-1);)s--,r--;if(n=="end"){let c=Math.max(0,o-Math.min(s,r));t-=s+c-o}if(s<o&&a.length<e.length){let c=t<=o&&t>=s?o-t:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=t<=o&&t>=r?o-t:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function bf(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}=a.observer.selectionRange;return t&&(e.push(new Ns(t,n)),(l!=t||o!=n)&&e.push(new Ns(l,o))),e}function yf(a,e){if(a.length==0)return null;let t=a[0].pos,n=a.length==2?a[1].pos:t;return t>-1&&n>-1?H.single(t+e,n+e):null}class wf{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&_f(e.contentDOM.ownerDocument)}handleEvent(e){!Rf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let l of n.observers)l(this.view,t);for(let l of n.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Af(e),n=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let s=!t[o].handlers.length,r=n[o];r&&s!=!r.handlers.length&&(l.removeEventListener(o,this.handleEvent),r=null),r||l.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Cf.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Es.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||xf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Rs(a,e){return(t,n)=>{try{return e.call(a,n,t)}catch(l){Ye(t.state,l)}}}function Af(a){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of a){let l=n.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&t(r).handlers.push(Rs(n.value,c))}if(s)for(let r in s){let c=s[r];c&&t(r).observers.push(Rs(n.value,c))}}for(let n in Pe)t(n).handlers.push(Pe[n]);for(let n in Ie)t(n).observers.push(Ie[n]);return e}const Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xf="dthko",Cf=[16,17,18,20,91,92,224,225],qi=6;function Qi(a){return Math.max(0,a)*.7+8}function vf(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class Sf{constructor(e,t,n,l){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Rh(e.contentDOM),this.atoms=e.state.facet(nl).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(oe.allowMultipleSelections)&&Bf(e,t),this.dragging=Vf(e,t)&&$s(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&vf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,l=0,o=0,s=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:r}=this.scrollParents.y.getBoundingClientRect());let c=bs(this.view);e.clientX-c.left<=l+qi?t=-Qi(l-e.clientX):e.clientX+c.right>=s-qi&&(t=Qi(e.clientX-s)),e.clientY-c.top<=o+qi?n=-Qi(o-e.clientY):e.clientY+c.bottom>=r-qi&&(n=Qi(e.clientY-r)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let l=e.ranges[n],o=null;if(l.empty){let s=ji(this.atoms,l.from,0);s!=l.from&&(o=H.cursor(s,-1))}else{let s=ji(this.atoms,l.from,-1),r=ji(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=H.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?H.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Bf(a,e){let t=a.state.facet(ls);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function Nf(a,e){let t=a.state.facet(os);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function Vf(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let n=ti(a.root);if(!n||n.rangeCount==0)return!0;let l=n.getRangeAt(0).getClientRects();for(let o=0;o<l.length;o++){let s=l[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function Rf(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=se.get(t))&&n.ignoreEvent(e))return!1;return!0}const Pe=Object.create(null),Ie=Object.create(null),Os=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function Ef(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),Ms(a,t.value)},50)}function Wi(a,e,t){for(let n of a.facet(e))t=n(t,a);return t}function Ms(a,e){e=Wi(a.state,Zn,e);let{state:t}=a,n,l=1,o=t.toText(e),s=o.lines==t.selection.ranges.length;if(rl!=null&&t.selection.ranges.every(c=>c.empty)&&rl==o.toString()){let c=-1;n=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let d=t.toText((s?o.line(l++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:d},range:H.cursor(h.from+d.length)}})}else s?n=t.changeByRange(c=>{let h=o.line(l++);return{changes:{from:c.from,to:c.to,insert:h.text},range:H.cursor(c.from+h.length)}}):n=t.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ie.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Pe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Ie.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Ie.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Pe.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of a.state.facet(ss))if(t=n(a,e),t)break;if(!t&&e.button==0&&(t=Tf(a,e)),t){let n=!a.hasFocus;a.inputState.startMouseSelection(new Sf(a,e,t,n)),n&&a.observer.ignore(()=>{To(a.contentDOM);let o=a.root.activeElement;o&&!o.contains(a.contentDOM)&&o.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function Ts(a,e,t,n){if(n==1)return H.cursor(e,t);if(n==2)return lf(a.state,e,t);{let l=ue.find(a.docView,e),o=a.state.doc.lineAt(l?l.posAtEnd:e),s=l?l.posAtStart:o.from,r=l?l.posAtEnd:o.to;return r<a.state.doc.length&&r==o.to&&r++,H.range(s,r)}}let Is=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function Of(a,e,t,n){let l=ue.find(a.docView,e);if(!l)return 1;let o=e-l.posAtStart;if(o==0)return 1;if(o==l.length)return-1;let s=l.coordsAt(o,-1);if(s&&Is(t,n,s))return-1;let r=l.coordsAt(o,1);return r&&Is(t,n,r)?1:s&&s.bottom>=n?-1:1}function Fs(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Of(a,t,e.clientX,e.clientY)}}const Mf=W.ie&&W.ie_version<=11;let Ds=null,_s=0,Ps=0;function $s(a){if(!Mf)return a.detail;let e=Ds,t=Ps;return Ds=a,Ps=Date.now(),_s=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(_s+1)%3:1}function Tf(a,e){let t=Fs(a,e),n=$s(e),l=a.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,s,r){let c=Fs(a,o),h,f=Ts(a,c.pos,c.bias,n);if(t.pos!=c.pos&&!s){let d=Ts(a,t.pos,t.bias,n),p=Math.min(d.from,f.from),m=Math.max(d.to,f.to);f=p<f.from?H.range(p,m):H.range(m,p)}return s?l.replaceRange(l.main.extend(f.from,f.to)):r&&n==1&&l.ranges.length>1&&(h=If(l,c.pos))?h:r?l.addRange(f):H.create([f])}}}function If(a,e){for(let t=0;t<a.ranges.length;t++){let{from:n,to:l}=a.ranges[t];if(n<=e&&l>=e)return H.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}Pe.dragstart=(a,e)=>{let{selection:{main:t}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let o=l.posAtStart,s=o+l.length;(o>=t.to||s<=t.from)&&(t=H.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wi(a.state,el,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Pe.dragend=a=>(a.inputState.draggedContent=null,!1);function Ls(a,e,t,n){if(t=Wi(a.state,Zn,t),!t)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&Nf(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:t},c=a.state.changes(s?[s,r]:r);a.focus(),a.dispatch({changes:c,selection:{anchor:c.mapPos(l,-1),head:c.mapPos(l,1)},userEvent:s?"move.drop":"input.drop"}),a.inputState.draggedContent=null}Pe.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),l=0,o=()=>{++l==t.length&&Ls(a,e,n.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<t.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(n[s]=r.result),o()},r.readAsText(t[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ls(a,e,n,!0),!0}return!1},Pe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=Os?null:e.clipboardData;return t?(Ms(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Ef(a),!1)};function Ff(a,e){let t=a.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),a.focus()},50)}function Df(a){let e=[],t=[],n=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of a.selection.ranges){let s=a.doc.lineAt(o);s.number>l&&(e.push(s.text),t.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}n=!0}return{text:Wi(a,el,e.join(a.lineBreak)),ranges:t,linewise:n}}let rl=null;Pe.copy=Pe.cut=(a,e)=>{let{text:t,ranges:n,linewise:l}=Df(a.state);if(!t&&!l)return!1;rl=l?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Os?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(Ff(a,t),!1)};const Us=Nt.define();function zs(a,e){let t=[];for(let n of a.facet(cs)){let l=n(a,e);l&&t.push(l)}return t.length?a.update({effects:t,annotations:Us.of(!0)}):null}function js(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=zs(a.state,e);t?a.dispatch(t):a.update([])}},10)}Ie.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),js(a)},Ie.blur=a=>{a.observer.clearSelectionRange(),js(a)},Ie.compositionstart=Ie.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Ie.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Ie.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Pe.beforeinput=(a,e)=>{var t,n;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),h=a.posAtDOM(r.endContainer,r.endOffset);return al(a,{from:c,to:h,insert:a.state.toText(o)},null),!0}}let l;if(W.chrome&&W.android&&(l=Es.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Ie.compositionend(a,e),20),!1};const qs=new Set;function _f(a){qs.has(a)||(qs.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Qs=["pre-wrap","normal","pre-line","break-spaces"];let Pt=!1;function Ws(){Pt=!1}class Pf{constructor(e){this.lineWrapping=e,this.doc=ie.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Qs.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let l=e[n];l<0?n++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,n,l,o,s){let r=Qs.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=n,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let h=0;h<s.length;h++){let f=s[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return c}}class $f{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class He{constructor(e,t,n,l,o){this.from=e,this.length=t,this.top=n,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Qe.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ht?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new He(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var de=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(de||(de={}));const Yi=.001;class Se{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Yi&&(Pt=!0),this.height=e)}replace(e,t,n){return Se.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,l){let o=this,s=n.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:h,fromB:f,toB:d}=l[r],p=o.lineAt(c,de.ByPosNoHeight,n.setDoc(t),0,0),m=p.to>=h?p:o.lineAt(h,de.ByPosNoHeight,n,0,0);for(d+=m.to-h,h=m.to;r>0&&p.from<=l[r-1].toA;)c=l[r-1].fromA,f=l[r-1].fromB,r--,c<p.from&&(p=o.lineAt(c,de.ByPosNoHeight,n,0,0));f+=p.from-c,c=p.from;let b=cl.build(n.setDoc(s),e,f,d);o=Hi(o,o.replace(c,h,b))}return o.updateHeight(n,0)}static empty(){return new Ee(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,l=0,o=0;for(;;)if(t==n)if(l>o*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,l-=r.size}else if(o>l*2){let r=e[n];r.break?e.splice(n,1,r.left,null,r.right):e.splice(n,1,r.left,r.right),n+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[t++];r&&(l+=r.size)}else{let r=e[--n];r&&(o+=r.size)}let s=0;return e[t-1]==null?(s=1,t--):e[t]==null&&(s=1,n++),new Lf(Se.of(e.slice(0,t)),s,Se.of(e.slice(n)))}}function Hi(a,e){return a==e?a:(a.constructor!=e.constructor&&(Pt=!0),e)}Se.prototype.size=1;class Ys extends Se{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,l,o){return this.blockAt(0,n,l,o)}forEachLine(e,t,n,l,o,s){e<=o+this.length&&t>=o&&s(this.blockAt(0,n,l,o))}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ee extends Ys{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.breaks)}replace(e,t,n){let l=n[0];return n.length==1&&(l instanceof Ee||l instanceof we&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof we?l=new Ee(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Se.of(n)}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class we extends Se{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-n+1,s,r=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*o);s=c/o,this.length>o+1&&(r=(this.height-c)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:l,perLine:s,perChar:r}}blockAt(e,t,n,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),f=t.doc.lineAt(h),d=r+f.length*c,p=Math.max(n,e-d/2);return new He(f.from,f.length,p,d,0)}else{let h=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:f,length:d}=t.doc.line(o+h);return new He(f,d,n+r*h,r,0)}}lineAt(e,t,n,l,o){if(t==de.ByHeight)return this.blockAt(e,n,l,o);if(t==de.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new He(m,b-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),h=n.doc.lineAt(e),f=r+h.length*c,d=h.number-s,p=l+r*d+c*(h.from-o-d);return new He(h.from,h.length,Math.max(l,Math.min(p,l+this.height-f)),f,0)}forEachLine(e,t,n,l,o,s){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:r,perLine:c,perChar:h}=this.heightMetrics(n,o);for(let f=e,d=l;f<=t;){let p=n.doc.lineAt(f);if(f==e){let b=p.number-r;d+=c*b+h*(e-o-b)}let m=c+h*p.length;s(new He(p.from,p.length,d,m,0)),d+=m,f=p.to+1}}replace(e,t,n){let l=this.length-t;if(l>0){let o=n[n.length-1];o instanceof we?n[n.length-1]=new we(o.length+l):n.push(null,new we(l-1))}if(e>0){let o=n[0];o instanceof we?n[0]=new we(e+o.length):n.unshift(new we(e-1),null)}return Se.of(n)}decomposeLeft(e,t){t.push(new we(e-1),null)}decomposeRight(e,t){t.push(null,new we(this.length-e-1))}updateHeight(e,t=0,n=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let s=[],r=Math.max(t,l.from),c=-1;for(l.from>t&&s.push(new we(l.from-t-1).updateHeight(e,t));r<=o&&l.more;){let f=e.doc.lineAt(r).length;s.length&&s.push(null);let d=l.heights[l.index++];c==-1?c=d:Math.abs(d-c)>=Yi&&(c=-2);let p=new Ee(f,d);p.outdated=!1,s.push(p),r+=f+1}r<=o&&s.push(null,new we(o-r).updateHeight(e,r));let h=Se.of(s);return(c<0||Math.abs(h.height-this.height)>=Yi||Math.abs(c-this.heightMetrics(e,t).perLine)>=Yi)&&(Pt=!0),Hi(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Lf extends Se{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,l){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,l):this.right.blockAt(e,t,o,l+this.left.length+this.break)}lineAt(e,t,n,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=t==de.ByHeight?e<s:e<r,h=c?this.left.lineAt(e,t,n,l,o):this.right.lineAt(e,t,n,s,r);if(this.break||(c?h.to<r:h.from>r))return h;let f=t==de.ByPosNoHeight?de.ByPosNoHeight:de.ByPos;return c?h.join(this.right.lineAt(r,f,n,s,r)):this.left.lineAt(r,f,n,l,o).join(h)}forEachLine(e,t,n,l,o,s){let r=l+this.left.height,c=o+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,n,l,o,s),t>=c&&this.right.forEachLine(e,t,n,r,c,s);else{let h=this.lineAt(c,de.ByPos,n,l,o);e<h.from&&this.left.forEachLine(e,h.from-1,n,l,o,s),h.to>=e&&h.from<=t&&s(h),t>h.to&&this.right.forEachLine(h.to+1,t,n,r,c,s)}}replace(e,t,n){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,n));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of n)o.push(r);if(e>0&&Hs(o,s-1),t<this.length){let r=o.length;this.decomposeRight(t,o),Hs(o,r)}return Se.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,l=n+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Se.of(this.break?[e,null,t]:[e,t]):(this.left=Hi(this.left,e),this.right=Hi(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,l){let{left:o,right:s}=this,r=t+o.length+this.break,c=null;return l&&l.from<=t+o.length&&l.more?c=o=o.updateHeight(e,t,n,l):o.updateHeight(e,t,n),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,n,l):s.updateHeight(e,r,n),c?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Hs(a,e){let t,n;a[e]==null&&(t=a[e-1])instanceof we&&(n=a[e+1])instanceof we&&a.splice(e-1,3,new we(t.length+1+n.length))}const Uf=5;class cl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ee?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ee(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let l=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=t-e;n.block?this.addBlock(new Ys(s,l,n)):(s||o||l>=Uf)&&this.addLineDeco(l,o,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ee(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new we(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ee)return e;let t=new Ee(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let l=this.ensureLine();l.length+=n,l.collapsed+=n,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ee)&&!this.isCovered?this.nodes.push(new Ee(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let l of this.nodes)l instanceof Ee&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,t,n,l){let o=new cl(n,e);return ce.spans(t,n,l,o,0),o.finish(n)}}function zf(a,e,t){let n=new jf;return ce.compare(a,e,t,n,0),n.changes}class jf{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,l){(e<t||n&&n.heightRelevant||l&&l.heightRelevant)&&$i(e,t,this.changes,5)}}function qf(a,e){let t=a.getBoundingClientRect(),n=a.ownerDocument,l=n.defaultView||window,o=Math.max(0,t.left),s=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),c=Math.min(l.innerHeight,t.bottom);for(let h=a.parentNode;h&&h!=n.body;)if(h.nodeType==1){let f=h,d=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&d.overflow!="visible"){let p=f.getBoundingClientRect();o=Math.max(o,p.left),s=Math.min(s,p.right),r=Math.max(r,p.top),c=Math.min(h==a.parentNode?l.innerHeight:c,p.bottom)}h=d.position=="absolute"||d.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:o-t.left,right:Math.max(o,s)-t.left,top:r-(t.top+e),bottom:Math.max(r,c)-(t.top+e)}}function Qf(a){let e=a.getBoundingClientRect(),t=a.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Wf(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class dl{constructor(e,t,n,l){this.from=e,this.to=t,this.size=n,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let l=e[n],o=t[n];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,t){return ve.replace({widget:new Yf(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Yf extends Wn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ks{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Gs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ye.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(il).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Pf(t),this.stateDeco=e.facet(ai).filter(n=>typeof n!="function"),this.heightMap=Se.empty().applyChanges(this.stateDeco,ie.empty,this.heightOracle.setDoc(e.doc),[new Te(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ve.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let l=n?t.head:t.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new Ki(o,s))}}return this.viewports=e.sort((n,l)=>n.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Gs:new hl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(di(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ai).filter(f=>typeof f!="function");let l=e.changedRanges,o=Te.extendWithRanges(l,zf(n,this.stateDeco,e?e.changes:ge.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ws(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Pt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let c=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Hh)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ye.RTL:ye.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=t.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,f=0;if(r.width&&r.height){let{scaleX:k,scaleY:u}=Mo(t,r);(k>.005&&Math.abs(this.scaleX-k)>.005||u>.005&&Math.abs(this.scaleY-u)>.005)&&(this.scaleX=k,this.scaleY=u,h|=16,s=c=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=p)&&(this.paddingTop=d,this.paddingBottom=p,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Do(e.scrollDOM);let b=(this.printing?Wf:qf)(t,this.paddingTop),y=b.top-this.pixelViewport.top,A=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&!Qf(e.dom))return 0;let w=r.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(w-this.contentDOMWidth)>l.charWidth){let{lineHeight:u,charWidth:N,textHeight:M}=e.docView.measureTextSize();s=u>0&&l.refresh(o,u,N,M,Math.max(5,w/N),k),s&&(e.docView.minWidth=0,h|=16)}y>0&&A>0?f=Math.max(y,A):y<0&&A<0&&(f=Math.min(y,A)),Ws();for(let u of this.viewports){let N=u.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(u);this.heightMap=(s?Se.empty().applyChanges(this.stateDeco,ie.empty,this.heightOracle,[new Te(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new $f(u.from,N))}Pt&&(h|=2)}let V=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return V&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||V)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new Ki(l.lineAt(s-n*1e3,de.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,de.ByHeight,o,0,0).to);if(t){let{head:h}=t.range;if(h<c.from||h>c.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=l.lineAt(h,de.ByPos,o,0,0),p;t.y=="center"?p=(d.top+d.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<c.from?p=d.top:p=d.bottom-f,c=new Ki(l.lineAt(p-1e3/2,de.ByHeight,o,0,0).from,l.lineAt(p+f+1e3/2,de.ByHeight,o,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Ki(this.heightMap.lineAt(n,de.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,de.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,de.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=r+Math.max(10,Math.min(n,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let l of e)t.touchesRange(l.from,l.to)||n.push(new dl(t.mapPos(l.from),t.mapPos(l.to),l.size,l.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,l=n?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=ye.LTR&&!n)return[];let r=[],c=(f,d,p,m)=>{if(d-f<o)return;let b=this.state.selection.main,y=[b.from];b.empty||y.push(b.to);for(let x of y)if(x>f&&x<d){c(f,x-10,p,m),c(x+10,d,p,m);return}let A=Kf(e,x=>x.from>=p.from&&x.to<=p.to&&Math.abs(x.from-f)<o&&Math.abs(x.to-d)<o&&!y.some(w=>x.from<w&&x.to>w));if(!A){if(d<p.to&&t&&n&&t.visibleRanges.some(V=>V.from<=d&&V.to>=d)){let V=t.moveToLineBoundary(H.cursor(d),!1,!0).head;V>f&&(d=V)}let x=this.gapSize(p,f,d,m),w=n||x<2e6?x:2e6;A=new dl(f,d,x,w)}r.push(A)},h=f=>{if(f.length<s||f.type!=Qe.Text)return;let d=Hf(f.from,f.to,this.stateDeco);if(d.total<s)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let y=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,A,x;if(p!=null){let w=Ji(d,p),V=((this.visibleBottom-this.visibleTop)/2+y)/f.height;A=w-V,x=w+V}else A=(this.visibleTop-f.top-y)/f.height,x=(this.visibleBottom-f.top+y)/f.height;m=Gi(d,A),b=Gi(d,x)}else{let y=d.total*this.heightOracle.charWidth,A=l*this.heightOracle.charWidth,x=0;if(y>2e6)for(let N of e)N.from>=f.from&&N.from<f.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=N.size-N.displaySize);let w=this.pixelViewport.left+x,V=this.pixelViewport.right+x,k,u;if(p!=null){let N=Ji(d,p),M=((V-w)/2+A)/y;k=N-M,u=N+M}else k=(w-A)/y,u=(V+A)/y;m=Gi(d,k),b=Gi(d,u)}m>f.from&&c(f.from,m,f,d),b<f.to&&c(b,f.to,f,d)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return r}gapSize(e,t,n,l){let o=Ji(l,n)-Ji(l,t);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){dl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ve.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];ce.spans(t,this.viewport.from,this.viewport.to,{span(o,s){n.push({from:o,to:s})},point(){}},20);let l=0;if(n.length!=this.visibleRanges.length)l=12;else for(let o=0;o<n.length&&!(l&8);o++){let s=this.visibleRanges[o],r=n[o];(s.from!=r.from||s.to!=r.to)&&(l|=4,e&&e.mapPos(s.from,-1)==r.from&&e.mapPos(s.to,1)==r.to||(l|=8))}return this.visibleRanges=n,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||di(this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||di(this.heightMap.lineAt(this.scaler.fromDOM(e),de.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return di(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ki{constructor(e,t){this.from=e,this.to=t}}function Hf(a,e,t){let n=[],l=a,o=0;return ce.spans(t,a,e,{span(){},point(s,r){s>l&&(n.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(n.push({from:l,to:e}),o+=e-l),{total:o,ranges:n}}function Gi({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(a*t);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(n<=r)return o+n;n-=r}}function Ji(a,e){let t=0;for(let{from:n,to:l}of a.ranges){if(e<=l){t+=e-n;break}t+=l-n}return t/a.total}function Kf(a,e){for(let t of a)if(e(t))return t}const Gs={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class hl{constructor(e,t,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let h=t.lineAt(r,de.ByPos,e,0,0).top,f=t.lineAt(c,de.ByPos,e,0,0).bottom;return l+=f-h,{from:r,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=s+(r.top-o)*this.scale,s=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(e){for(let t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return l+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,l=o.domBottom}}fromDOM(e){for(let t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,l=o.domBottom}}eq(e){return e instanceof hl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function di(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),n=e.toDOM(a.bottom);return new He(a.from,a.length,t,n-t,Array.isArray(a._content)?a._content.map(l=>di(l,e)):a._content)}const Xi=G.define({combine:a=>a.join(" ")}),fl=G.define({combine:a=>a.indexOf(!0)>-1}),ul=dt.newName(),Js=dt.newName(),Xs=dt.newName(),Zs={"&light":"."+Js,"&dark":"."+Xs};function pl(a,e,t){return new dt(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,l=>{if(l=="&")return a;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):a+" "+n}})}const Gf=pl("."+ul,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Zs),Jf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ml=W.ie&&W.ie_version<=11;class Xf{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Eh,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new eu(e),e.state.facet(nt)&&(e.contentDOM.editContext=this.editContext.editContext)),ml&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,l=this.selectionRange;if(n.state.facet(nt)?n.root.activeElement!=this.dom:!Ii(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!n.state.selection.main.empty&&l.focusNode&&ni(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ti(e.root);if(!t)return!1;let n=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Zf(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let l=Ii(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mh(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Jf),ml&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ml&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let l=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Mt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),t==-1?{from:t,to:n}=s:(t=Math.min(s.from,t),n=Math.max(s.to,n)))}return{from:t,to:n,typeOver:l}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),l=this.selectionChanged&&Ii(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new mf(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,l=Vs(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=ea(t,e.previousSibling||e.target.previousSibling,-1),l=ea(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(nt)!=e.state.facet(nt)&&(e.view.contentDOM.editContext=e.state.facet(nt)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ea(a,e,t){for(;e;){let n=se.get(e);if(n&&n.parent==a)return n;let l=e.parentNode;e=l!=a.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function ta(a,e){let t=e.startContainer,n=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return ni(s.node,s.offset,l,o)&&([t,n,l,o]=[l,o,t,n]),{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}}function Zf(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ta(a,l)}let t=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",n,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",n,!0),t?ta(a,t):null}class eu{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:r,drifted:!1});let h={from:r,to:c,insert:ie.of(n.text.split(`
23
- `))};if(h.from==this.from&&o<this.from?h.from=o:h.to==this.to&&o>this.to&&(h.to=o),h.from==h.to&&!h.insert.length){let f=H.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));f.main.eq(l)||e.dispatch({selection:f,userEvent:"select"});return}if((W.mac||W.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:r,to:c,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);al(e,h,H.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let l=[],o=null;for(let s=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);s<r;s++){let c=e.coordsForChar(s);o=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||o||new DOMRect,l.push(o)}t.updateCharacterBounds(n.rangeStart,l)},this.handlers.textformatupdate=n=>{let l=[];for(let o of n.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),h=this.toEditorPos(o.rangeEnd);if(c<h){let f=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(ve.mark({attributes:{style:f}}).range(c,h))}}}e.dispatch({effects:fs.of(ve.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let l=ti(n.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,h)=>{if(n)return;let f=h.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(o+=t,s+=t,s<=this.from)this.from+=f,this.to+=f;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),h.toString()),this.to+=f}t+=f}),l&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(n,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class le{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(l=>l.forEach(o=>n(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Oh(e.parent)||document,this.viewState=new Ks(e.state||oe.create(e)),e.scrollTo&&e.scrollTo.is(Ui)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Dt).map(l=>new tl(l));for(let l of this.plugins)l.update(this);this.observer=new Xf(this),this.inputState=new wf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ys(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof xe?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,l,o=this.state;for(let p of e){if(p.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=p.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(p=>p.annotation(Us))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=zs(o,s),c||(r=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(f=null)):this.observer.clear(),o.facet(oe.phrases)!=this.state.facet(oe.phrases))return this.setState(o);l=zi.create(this,o,e),l.flags|=r;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(d&&(d=d.map(p.changes)),p.scrollIntoView){let{main:m}=p.state.selection;d=new Ft(m.empty?m:H.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of p.effects)m.is(Ui)&&(d=m.value.clip(this.state))}this.viewState.update(l,d),this.bidiCache=Zi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(ri)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(p=>p.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Xi)!=l.state.facet(Xi)&&(this.viewState.mustMeasureContent=!0),(t||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(Xn))try{p(l)}catch(m){Ye(this.state,m,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!Vs(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Ks(e),this.plugins=e.facet(Dt).map(n=>new tl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new ys(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Dt),n=e.state.facet(Dt);if(t!=n){let l=[];for(let o of n){let s=t.indexOf(o);if(s<0)l.push(new tl(o));else{let r=this.plugins[s];r.mustUpdate=e,l.push(r)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Ye(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,l=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(s<0)if(Do(n))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(m=>{try{return m.read(this)}catch(b){return Ye(this.state,b),ia}}),d=zi.create(this,this.state,[]),p=!1;d.flags|=c,t?t.flags|=c:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d),p&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(f[m]!=ia)try{let b=h[m];b.write&&b.write(f[m],this)}catch(b){Ye(this.state,b)}if(p&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let b=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(b>1||b<-1){l=l+b,n.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Xn))r(t)}get themeClasses(){return ul+" "+(this.state.facet(fl)?Xs:Js)+" "+this.state.facet(Xi)}updateAttrs(){let e=na(this,us,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nt)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),na(this,il,t);let n=this.observer.ignore(()=>{let l=Qn(this.contentDOM,this.contentAttrs,t),o=Qn(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let l of n.effects)if(l.is(le.announce)){t&&(this.announceDOM.textContent=""),t=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(ri);let e=this.state.facet(le.cspNonce);dt.mount(this.root,this.styleModules.concat(Gf).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return sl(this,e,Bs(this,e,t,n))}moveByGroup(e,t){return sl(this,e,Bs(this,e,t,n=>hf(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return H.cursor(o.side(t,l)+e.from,o.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,n=!0){return df(this,e,t,n)}moveVertically(e,t,n){return sl(this,e,ff(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),vs(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[ft.find(o,e-l.from,-1,t)];return Di(n,s.dir==ye.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ds)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>tu)return is(e.length);let t=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||ts(o.isolates,n=gs(this,e))))return o.order;n||(n=gs(this,e));let l=Qh(e.text,t,n);return this.bidiCache.push(new Zi(e.from,e.to,t,n,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{To(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ui.of(new Ft(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ui.of(new Ft(H.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return _t.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return _t.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=dt.newName(),l=[Xi.of(n),ri.of(pl(`.${n}`,e))];return t&&t.dark&&l.push(fl.of(!0)),l}static baseTheme(e){return uh.lowest(ri.of(pl("."+ul,e,Zs)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),l=n&&se.get(n)||se.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}le.styleModule=ri,le.inputHandler=rs,le.clipboardInputFilter=Zn,le.clipboardOutputFilter=el,le.scrollHandler=hs,le.focusChangeEffect=cs,le.perLineTextDirection=ds,le.exceptionSink=as,le.updateListener=Xn,le.editable=nt,le.mouseSelectionStyle=ss,le.dragMovesSelection=os,le.clickAddsSelectionRange=ls,le.decorations=ai,le.outerDecorations=ps,le.atomicRanges=nl,le.bidiIsolatedRanges=ms,le.scrollMargins=ks,le.darkTheme=fl,le.cspNonce=G.define({combine:a=>a.length?a[0]:""}),le.contentAttributes=il,le.editorAttributes=us,le.lineWrapping=le.contentAttributes.of({class:"cm-lineWrapping"}),le.announce=pe.define();const tu=4096,ia={};class Zi{constructor(e,t,n,l,o,s){this.from=e,this.to=t,this.dir=n,this.isolates=l,this.fresh=o,this.order=s}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let n=[],l=e.length?e[e.length-1].dir:ye.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!t.touchesRange(s.from,s.to)&&n.push(new Zi(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function na(a,e,t){for(let n=a.state.facet(e),l=n.length-1;l>=0;l--){let o=n[l],s=typeof o=="function"?o(a):o;s&&qn(s,t)}return t}class $t extends Rt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}$t.prototype.elementClass="",$t.prototype.toDOM=void 0,$t.prototype.mapMode=Re.TrackBefore,$t.prototype.startSide=$t.prototype.endSide=-1,$t.prototype.point=!0;var gl;const Lt=new ne;function iu(a){return G.define({combine:a?e=>e.concat(a):void 0})}const nu=new ne;class $e{constructor(e,t,n=[],l=""){this.data=e,this.name=l,oe.prototype.hasOwnProperty("tree")||Object.defineProperty(oe.prototype,"tree",{get(){return kl(this)}}),this.parser=t,this.extension=[zt.of(this),oe.languageData.of((o,s,r)=>{let c=la(o,s,r),h=c.type.prop(Lt);if(!h)return[];let f=o.facet(h),d=c.type.prop(nu);if(d){let p=c.resolve(s-c.from,r);for(let m of d)if(m.test(p,o)){let b=o.facet(m.facet);return m.type=="replace"?b:b.concat(f)}}return f})].concat(n)}isActiveAt(e,t,n=-1){return la(e,t,n).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(zt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],l=(o,s)=>{if(o.prop(Lt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(ne.mounted);if(r){if(r.tree.prop(Lt)==this.data){if(r.overlay)for(let c of r.overlay)n.push({from:c.from+s,to:c.to+s});else n.push({from:s,to:s+o.length});return}else if(r.overlay){let c=n.length;if(l(r.tree,r.overlay[0].from+s),n.length>c)return}}for(let c=0;c<o.children.length;c++){let h=o.children[c];h instanceof fe&&l(h,o.positions[c]+s)}};return l(kl(e),0),n}get allowsNesting(){return!0}}$e.setState=pe.define();function la(a,e,t){let n=a.facet(zt),l=kl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,t,me.ExcludeBuffers))o.type.isTop&&(l=o);return l}class en extends $e{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=iu(e.languageData);return new en(t,e.parser.configure({props:[Lt.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new en(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kl(a){let e=a.field($e.state,!1);return e?e.tree:fe.empty}class lu{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let hi=null;class tn{constructor(e,t,n=[],l,o,s,r,c){this.parser=e,this.state=t,this.fragments=n,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new tn(e,t,[],fe.empty,0,n,[],null)}startParse(){return this.parser.startParse(new lu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=fe.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(gt.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(gt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hi;hi=this;try{return e()}finally{hi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=oa(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,d,p)=>c.push({fromA:h,toA:f,fromB:d,toB:p})),n=gt.applyChanges(n,c),l=fe.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);f<d&&r.push({from:f,to:d})}}}return new tn(this.parser,t,n,l,o,s,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:l,to:o}=this.skipped[n];l<e.to&&o>e.from&&(this.fragments=oa(this.fragments,l,o),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ql{createParse(t,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=hi;if(c){for(let h of l)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=s,new fe(Be.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return hi}}function oa(a,e,t){return gt.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ut{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ut(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=tn.create(e.facet(zt).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ut(n)}}$e.state=yt.define({create:Ut.init,update(a,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(zt)!=e.state.facet(zt)?Ut.init(e.state):a.apply(e)}});let sa=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(sa=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const bl=typeof navigator<"u"&&(!((gl=navigator.scheduling)===null||gl===void 0)&&gl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ou=_t.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=sa(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:l}}=this.view,o=n.field($e.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!bl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&n.doc.length>l+1e3,c=o.context.work(()=>bl&&bl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new Ut(o.context))})),this.chunkBudget>0&&!(c&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ye(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zt=G.define({combine(a){return a.length?a[0]:null},enables:a=>[$e.state,ou,le.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class su{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const au=new ne;function aa({except:a,units:e=1}={}){return t=>{let n=a&&a.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const ru=new ne;function cu(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}class yl{constructor(e,t){this.specs=e;let n;function l(r){let c=dt.newName();return(n||(n=Object.create(null)))["."+c]=r,c}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,s=t.scope;this.scope=s instanceof $e?r=>r.prop(Lt)==s.data:s?r=>r==s:void 0,this.style=Xl(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new dt(n):null,this.themeType=t.themeType}static define(e,t){return new yl(e,t||{})}}j.meta,j.link,j.heading,j.emphasis,j.strong,j.strikethrough,j.keyword,j.atom,j.bool,j.url,j.contentSeparator,j.labelName,j.literal,j.inserted,j.string,j.deleted,j.regexp,j.escape,j.string,j.variableName,j.variableName,j.typeName,j.namespace,j.className,j.variableName,j.macroName,j.propertyName,j.comment,j.invalid;const du=Object.create(null),ra=[Be.none],ca=[],da=Object.create(null),hu=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])hu[a]=fu(du,e);function wl(a,e){ca.indexOf(a)>-1||(ca.push(a),console.warn(e))}function fu(a,e){let t=[];for(let r of e.split(" ")){let c=[];for(let h of r.split(".")){let f=a[h]||j[h];f?typeof f=="function"?c.length?c=c.map(f):wl(h,`Modifier ${h} used at start of tag`):c.length?wl(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:wl(h,`Unknown highlighting tag ${h}`)}for(let h of c)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),l=n+" "+t.map(r=>r.id),o=da[l];if(o)return o.id;let s=da[l]=Be.define({id:ra.length,name:n,props:[Jl({[n]:t})]});return ra.push(s),s.id}ye.RTL,ye.LTR;const uu=en.define({name:"json",parser:sh.configure({props:[au.add({Object:aa({except:/^\s*\}/}),Array:aa({except:/^\s*\]/})}),ru.add({"Object Array":cu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function pu(){return new su(uu)}const Al=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function mu(){const a=Fe();if(a.formRules?.length){const e={};Al.forEach(n=>{e[n.name]=n});const t=[...Al];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):t.push(l)}),t}return Al}const gu={loadAdvances:mu},ku={class:"unione-props-setting data-field-setting"},bu={key:0},yu=["onClick"],wu={class:"field-txt"},Au=["onClick"],xu={key:1,class:"field-txt"},Cu=["onClick"],vu={key:0,class:"field-txt"},Su={key:3,class:"edit-field"},Bu=["onClick"],Nu=te(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([pu()]),t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=i.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=i.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let u in k){const N=n.value.filter(M=>M.name==u);if(N&&N[0]){let M=o.value[u];Object.keys(M).forEach(v=>{v=="convertName"?(N[0].convert||(N[0].convert={}),N[0].convert.type=M[v]):N[0][v]=M[v]})}}o.value={}}function r(k,u){s();const N={};u=="convertName"?(k.convert||(k.convert={}),N[u]=k.convert?.type):N[u]=k[u]||"",o.value[k.name]=N}function c(k,u){{o.value={};return}}function h(k,u){switch(u){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function f(k,u){switch(u){case"query":k.configs=Y.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=Y.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=Y.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=Y.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=Y.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const d=i.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function p(k,u){switch(d.value.prop=u,d.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),u){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),d.value.show=k.configs.query,d.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),d.value.show=k.configs.show.form,d.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),d.value.show=k.configs.show.view,d.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),d.value.show=k.configs.show.list,d.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),d.value.show=k.configs.sort,d.value.title=`排序设置/${k.title}(${k.name})`;break}d.value.visible=!0}const m=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const u=m.value.options.filter(N=>N.value==k);return u[0]?u[0].label:k}}),b=i.ref({visible:!1,field:{},props:{},advances:gu.loadAdvances(),showInfo:k=>{let u=0;if(k.configs?.rule){const N=k.configs.rule;N.advance&&u++,typeof N.rangeMin<"u"&&u++,typeof N.rangeMax<"u"&&u++,typeof N.regExpress<"u"&&u++}if(u>0)return"("+u+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=Y.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function y(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const A=i.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const u=k.configs?.widget?.name,N=A.value.widgets.filter(M=>M.value==u);return N[0]?N[0].label:u},toSetting:(k,u)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=u},toclose:()=>{A.value.visible=!1}});function x(k){A.value.field=k,k.configs=Y.utils.obj.ext(k.configs,{widget:{props:{}}}),A.value.widget=k.configs.widget,A.value.visible=!0}const w=i.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,u="--")=>w.value.types.filter(N=>N.value==k)[0]?.label||u,toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(k,u)=>{w.value.convert.options.splice(k,1)},toSetting:()=>{w.value.visible=!1}});function V(k){w.value.visible=!0,w.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),w.value.convert=k.configs.convert}return(k,u)=>{const N=i.resolveComponent("ToolOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-checkbox"),B=i.resolveComponent("a-table"),R=i.resolveComponent("a-switch"),g=i.resolveComponent("a-form-item"),S=i.resolveComponent("a-select-option"),T=i.resolveComponent("a-input-number"),O=i.resolveComponent("a-form"),F=i.resolveComponent("a-modal"),$=i.resolveComponent("a-input"),D=i.resolveComponent("unione-select-box"),Q=i.resolveComponent("a-checkbox-group"),U=i.resolveComponent("unione-section");return i.openBlock(),i.createElementBlock("div",ku,[i.createVNode(B,{columns:t.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:E})=>[["widget","queryType","rules","convertName"].includes(E.key)?(i.openBlock(),i.createElementBlock("span",bu,[i.createVNode(N),i.createTextVNode(" "+i.toDisplayString(E.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:E,text:P,record:I})=>[["rules"].includes(E.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!b.value.showInfo(I)&&"empty"]),onClick:_=>y(I)},[i.createElementVNode("span",wu,i.toDisplayString(b.value.showInfo(I)),1),b.value.showInfo(I)?(i.openBlock(),i.createBlock(M,{key:0,type:"link"},{default:i.withCtx(()=>u[50]||(u[50]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,yu)):["widget"].includes(E.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[I.name]||!Object.keys(o.value[I.name]).includes(E.dataIndex))&&!P&&"empty"]),onClick:_=>r(I,E.dataIndex)},[o.value[I.name]&&Object.keys(o.value[I.name]).includes(E.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(v,{key:0,value:I.configs?.widget?.name,allowClear:!0,options:A.value.widgets,onChange:_=>A.value.toSetting(I,_),onBlur:u[0]||(u[0]=_=>c())},null,8,["value","options","onChange"])),[[l]]):(i.openBlock(),i.createElementBlock("span",xu,i.toDisplayString(A.value.widgetName(I)),1)),i.createVNode(M,{type:"link",onClick:i.withModifiers(_=>x(I),["stop"])},{default:i.withCtx(()=>u[51]||(u[51]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Au)):["convertName"].includes(E.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[I.name]||!Object.keys(o.value[I.name]).includes(E.dataIndex))&&!I.convert?.type&&"empty"]),onClick:_=>V(I)},[I.configs?.convert?.types?(i.openBlock(),i.createElementBlock("span",vu,i.toDisplayString(w.value.getTypes(I.configs.convert.types)),1)):i.createCommentVNode("",!0)],10,Cu)):["query","form","view","list","sort"].includes(E.dataIndex)?(i.openBlock(),i.createElementBlock("div",Su,[i.createVNode(C,{checked:h(I,E.dataIndex),onClick:_=>f(I,E.dataIndex)},null,8,["checked","onClick"]),i.createVNode(M,{type:"link",onClick:_=>p(I,E.dataIndex)},{default:i.withCtx(()=>u[52]||(u[52]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(F,{visible:d.value.visible,"onUpdate:visible":u[14]||(u[14]=E=>d.value.visible=E),width:600,title:d.value.title,onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(O,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:i.normalizeClass(["field-setting-form","form-mix",d.value.prop])},{default:i.withCtx(()=>[i.createVNode(g,{label:"启用状态"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.show.enable,"onUpdate:checked":u[1]||(u[1]=E=>d.value.show.enable=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:0,label:"默认排序"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.show.defoult,"onUpdate:checked":u[2]||(u[2]=E=>d.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:1,label:"排序方式"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.show.asc,"onUpdate:checked":u[3]||(u[3]=E=>d.value.show.asc=E),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"&&d.value.show.types=="ADVANCE"?(i.openBlock(),i.createBlock(g,{key:2,label:"高级查询"})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.show.defoult,"onUpdate:checked":u[4]||(u[4]=E=>d.value.show.defoult=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.show.visible,"onUpdate:checked":u[5]||(u[5]=E=>d.value.show.visible=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:5,label:"查询方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.types,"onUpdate:value":u[6]||(u[6]=E=>d.value.show.types=E)},{default:i.withCtx(()=>[i.createVNode(S,{key:"EQ",value:"EQ"},{default:i.withCtx(()=>u[53]||(u[53]=[i.createTextVNode("精确查询")])),_:1}),i.createVNode(S,{key:"LIKE",value:"LIKE"},{default:i.withCtx(()=>u[54]||(u[54]=[i.createTextVNode("模糊查询")])),_:1}),i.createVNode(S,{key:"LLIKE",value:"LLIKE"},{default:i.withCtx(()=>u[55]||(u[55]=[i.createTextVNode("左模糊")])),_:1}),i.createVNode(S,{key:"RLIKE",value:"RLIKE"},{default:i.withCtx(()=>u[56]||(u[56]=[i.createTextVNode("右模糊")])),_:1}),i.createVNode(S,{key:"RANGE",value:"RANGE"},{default:i.withCtx(()=>u[57]||(u[57]=[i.createTextVNode("范围查询")])),_:1}),i.createVNode(S,{key:"ADVANCE",value:"ADVANCE"},{default:i.withCtx(()=>u[58]||(u[58]=[i.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0),["query","sort"].includes(d.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:i.withCtx(()=>[i.createVNode(T,{value:d.value.show.index,"onUpdate:value":u[7]||(u[7]=E=>d.value.show.index=E)},null,8,["value"])]),_:1})),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:i.withCtx(()=>[i.createVNode(T,{min:0,max:24,value:d.value.show.width,"onUpdate:value":u[8]||(u[8]=E=>d.value.show.width=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:i.withCtx(()=>[i.createVNode(T,{min:0,value:d.value.show.width,"onUpdate:value":u[9]||(u[9]=E=>d.value.show.width=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(T,{min:0,max:24,value:d.value.show.labelWidth,"onUpdate:value":u[10]||(u[10]=E=>d.value.show.labelWidth=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(T,{min:0,max:24,value:d.value.show.valueWidth,"onUpdate:value":u[11]||(u[11]=E=>d.value.show.valueWidth=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:11,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.fixed,"onUpdate:value":u[12]||(u[12]=E=>d.value.show.fixed=E),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:12,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.align,"onUpdate:value":u[13]||(u[13]=E=>d.value.show.align=E),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:w.value.visible,"onUpdate:visible":u[33]||(u[33]=E=>w.value.visible=E),width:600,title:w.value.getTypes(w.value.convert.types,"转换")+"设置",onOk:w.value.toSetting},{default:i.withCtx(()=>[i.createVNode(O,{model:w.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"转换类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:w.value.convert.types,"onUpdate:value":u[15]||(u[15]=E=>w.value.convert.types=E),allowClear:!0,options:w.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"是否搜索"},{default:i.withCtx(()=>[i.createVNode(R,{checked:d.value.convert.search,"onUpdate:checked":u[16]||(u[16]=E=>d.value.convert.search=E),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="option"?(i.openBlock(),i.createBlock(g,{key:1,label:"选项设置"},{default:i.withCtx(()=>[i.createVNode(M,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:i.withCtx(()=>u[59]||(u[59]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(B,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:E,record:P,index:I})=>[E.dataIndex==="label"?(i.openBlock(),i.createBlock($,{key:0,value:P.label,"onUpdate:value":_=>P.label=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),E.dataIndex==="value"?(i.openBlock(),i.createBlock($,{key:1,value:P.value,"onUpdate:value":_=>P.value=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),E.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:_=>w.value.toDelOption(I,P)},"删除",8,Bu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):i.createCommentVNode("",!0),["dbtable","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:2,label:"数据源"},{default:i.withCtx(()=>[i.createVNode(D,{value:w.value.convert.dsId,"onUpdate:value":u[17]||(u[17]=E=>w.value.convert.dsId=E),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:3,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[18]||(u[18]=E=>w.value.convert.tableName=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:4,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[19]||(u[19]=E=>w.value.convert.tableName=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:5,label:"主键字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.idField,"onUpdate:value":u[20]||(u[20]=E=>w.value.convert.idField=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:6,label:"父级字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.pidField,"onUpdate:value":u[21]||(u[21]=E=>w.value.convert.pidField=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:7,label:"value字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.valueField,"onUpdate:value":u[22]||(u[22]=E=>w.value.convert.valueField=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:8,label:"label字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.labelField,"onUpdate:value":u[23]||(u[23]=E=>w.value.convert.labelField=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableField,"onUpdate:value":u[24]||(u[24]=E=>w.value.convert.tableField=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableWhere,"onUpdate:value":u[25]||(u[25]=E=>w.value.convert.tableWhere=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[26]||(u[26]=E=>w.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[27]||(u[27]=E=>w.value.convert.tableOrder=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:13,label:"异步加载"},{default:i.withCtx(()=>[i.createVNode(R,{checked:w.value.convert.isAsync,"onUpdate:checked":u[28]||(u[28]=E=>w.value.convert.isAsync=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:14,label:"分页加载"},{default:i.withCtx(()=>[i.createVNode(R,{checked:w.value.convert.isPaging,"onUpdate:checked":u[29]||(u[29]=E=>w.value.convert.isPaging=E),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dict"?(i.openBlock(),i.createBlock(g,{key:15,label:"字典名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.dictName,"onUpdate:value":u[30]||(u[30]=E=>w.value.convert.dictName=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.url,"onUpdate:value":u[31]||(u[31]=E=>w.value.convert.url=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:w.value.convert.params,"onUpdate:modelValue":u[32]||(u[32]=E=>w.value.convert.params=E),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:A.value.visible,"onUpdate:visible":u[40]||(u[40]=E=>A.value.visible=E),width:600,title:"控件设置",onOk:A.value.toclose},{default:i.withCtx(()=>[i.createVNode(O,{model:A.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"组件类型"},{default:i.withCtx(()=>[i.withDirectives(i.createVNode(v,{value:A.value.widget.name,"onUpdate:value":u[34]||(u[34]=E=>A.value.widget.name=E),allowClear:!0,options:A.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),i.createVNode(g,{label:"输入提示"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.placeholder,"onUpdate:value":u[35]||(u[35]=E=>A.value.widget.placeholder=E)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"帮助说明"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.help,"onUpdate:value":u[36]||(u[36]=E=>A.value.widget.help=E)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"提示文本"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.tooltip,"onUpdate:value":u[37]||(u[37]=E=>A.value.widget.tooltip=E)},null,8,["value"])]),_:1}),["a-date-picker"].includes(A.value.widget.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"显示格式"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.field.dataFormat,"onUpdate:value":u[38]||(u[38]=E=>A.value.field.dataFormat=E)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),A.value.widget.name=="unione-select-box"?(i.openBlock(),i.createBlock(g,{key:1,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:A.value.widget.props.mode,"onUpdate:value":u[39]||(u[39]=E=>A.value.widget.props.mode=E),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(S,{value:"multiple"},{default:i.withCtx(()=>u[60]||(u[60]=[i.createTextVNode("多选")])),_:1}),i.createVNode(S,{value:"tags"},{default:i.withCtx(()=>u[61]||(u[61]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(F,{visible:b.value.visible,"onUpdate:visible":u[49]||(u[49]=E=>b.value.visible=E),width:600,title:"规则设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(O,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(U,{title:"基本设置",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(Q,{value:b.value.props.trigger,"onUpdate:value":u[41]||(u[41]=E=>b.value.props.trigger=E),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(C,{checked:b.value.props.whitespace,"onUpdate:checked":u[42]||(u[42]=E=>b.value.props.whitespace=E)},{default:i.withCtx(()=>u[62]||(u[62]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),i.createVNode(g,{label:"预设类型"},{default:i.withCtx(()=>[i.createVNode(v,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":u[43]||(u[43]=E=>b.value.props.advance=E)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(i.openBlock(),i.createBlock(U,{key:0,title:"数值验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(T,{value:b.value.props.rangeMin,"onUpdate:value":u[44]||(u[44]=E=>b.value.props.rangeMin=E)},null,8,["value"]),u[63]||(u[63]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(T,{value:b.value.props.rangeMax,"onUpdate:value":u[45]||(u[45]=E=>b.value.props.rangeMax=E)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":u[46]||(u[46]=E=>b.value.props.rangeMessage=E)},null,8,["value"])]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(U,{title:"正则验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":u[47]||(u[47]=E=>b.value.props.regExpress=E)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":u[48]||(u[48]=E=>b.value.props.regMessage=E)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),Vu={class:"unione-props-setting data-field-fkey"},Ru={key:0},Eu=["onClick"],Ou=["onClick"],Mu=["onClick"],Tu=["onClick"],Iu=["onClick"],Fu=["onClick"],Du=["onClick"],_u=["onClick"],Pu=te(i.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),n=i.useModel(a,"modelValue"),l=i.computed(()=>n.value.filter(p=>p.configs?.fkey?.enable)||[]),o=i.ref({});function s(){o.value={}}function r(p,m){s();const b={};b[m]=p.configs.fkey[m]||"",o.value[p.name]=b}function c(p,m,b){p.configs.fkey.dsn=m,p.configs.fkey.dsnName=b.name,p.configs.fkey.dsnTitle=b.title,p.configs.fkey.dsnId=b.id}function h(p,m,b,y){p.configs.fkey[m]=b,m=="fieldName"&&(p.configs.fkey.fieldTitle=y.title),m=="labelName"&&(p.configs.fkey.labelTitle=y.title)}function f(p){d.value.record=p,d.value.visible=!0,d.value.fields=p.configs?.fkey?.fields||[]}const d=i.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(p,m)=>{d.value.editField[p]=m},onShowFieldChange:(p,m,b)=>{p.name=b.name,p.title=b.title},toAddField:()=>{d.value.fields.push({name:"",title:""}),d.value.editField[d.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{d.value.fields.splice(p,1)}})},toSetting:()=>{d.value.visible=!1,d.value.record.configs=Y.utils.obj.ext(d.value.record.configs,{fkey:{fields:d.value.fields}})}});return(p,m)=>{const b=i.resolveComponent("FormOutlined"),y=i.resolveComponent("unione-select-box"),A=i.resolveComponent("a-button"),x=i.resolveComponent("a-table"),w=i.resolveComponent("a-input-number"),V=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",Vu,[i.createVNode(x,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:i.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(i.openBlock(),i.createElementBlock("span",Ru,[i.createVNode(b),i.createTextVNode(" "+i.toDisplayString(k.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:k,record:u})=>[["dsnName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnName),1)],64))],10,Eu)):["dsnTitle"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnTitle&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnTitle),1)],64))],10,Ou)):i.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.fieldName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"fieldName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.fieldTitle),1)],64))],10,Mu)):["labelName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.labelName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"labelName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.labelTitle)+" ",1),u.configs?.fkey?.labelName?(i.openBlock(),i.createBlock(A,{key:0,type:"link",onClick:i.withModifiers(N=>f(u),["stop"])},{default:i.withCtx(()=>m[4]||(m[4]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,Tu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(V,{visible:d.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>d.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(A,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:d.value.toAddField},{default:i.withCtx(()=>m[5]||(m[5]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(x,{columns:d.value.columns,"data-source":d.value.fields,size:"small"},{bodyCell:i.withCtx(({column:k,record:u,index:N,text:M})=>[k.dataIndex==="title"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",d.value.editField!="title"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="title"?(i.openBlock(),i.createBlock(y,{key:0,value:u[u.dataIndex],"onUpdate:value":v=>u[u.dataIndex]=v,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:d.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=v=>d.value.editField={}),onSelect:(v,C)=>d.value.onShowFieldChange(u,v,C)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Iu)):i.createCommentVNode("",!0),k.dataIndex==="width"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",d.value.editField!="width"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="width"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[1]||(m[1]=v=>d.value.editField={}),value:u.width,"onUpdate:value":v=>u.width=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Fu)):i.createCommentVNode("",!0),k.dataIndex==="index"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",d.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="index"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[2]||(m[2]=v=>d.value.editField={}),value:u.index,"onUpdate:value":v=>u.index=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Du)):i.createCommentVNode("",!0),k.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:3,onClick:v=>d.value.toDelField(N)},"删除",8,_u)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),$u={class:"unione-props-setting data-filter"},Lu={class:"title"},Uu={class:"name"},zu={class:"action"},ju=te(i.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.useModel(a,"modelValue");function n(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function o(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const s=i.ref(),r=i.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(h=>{if(r.value.name){const f=t.value.filter(d=>d.name==r.value.name)[0];if(!f){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(p=>p.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(d=>{f[d]=h[d]})}else{if(t.value.filter(d=>d.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function c(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
20
+ `;this.styleTag.textContent=s;let r=t.head||t;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Et={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Dn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},be=0;be<10;be++)Et[48+be]=Et[96+be]=String(be);for(var be=1;be<=24;be++)Et[be+111]="F"+be;for(var be=65;be<=90;be++)Et[be]=String.fromCharCode(be+32),Dn[be]=String.fromCharCode(be);for(var _n in Et)Dn.hasOwnProperty(_n)||(Dn[_n]=Et[_n]);function ti(a){let e;return a.nodeType==11?e=a.getSelection?a:a.ownerDocument:e=a,e.getSelection()}function Pn(a,e){return e?a==e||a.contains(e.nodeType!=1?e.parentNode:e):!1}function Ii(a,e){if(!e.anchorNode)return!1;try{return Pn(a,e.anchorNode)}catch{return!1}}function ii(a){return a.nodeType==3?xt(a,0,a.nodeValue.length).getClientRects():a.nodeType==1?a.getClientRects():[]}function ni(a,e,t,n){return t?Oo(a,e,t,n,-1)||Oo(a,e,t,n,1):!1}function At(a){for(var e=0;;e++)if(a=a.previousSibling,!a)return e}function Fi(a){return a.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(a.nodeName)}function Oo(a,e,t,n,l){for(;;){if(a==t&&e==n)return!0;if(e==(l<0?0:qe(a))){if(a.nodeName=="DIV")return!1;let o=a.parentNode;if(!o||o.nodeType!=1)return!1;e=At(a)+(l<0?0:1),a=o}else if(a.nodeType==1){if(a=a.childNodes[e+(l<0?-1:0)],a.nodeType==1&&a.contentEditable=="false")return!1;e=l<0?qe(a):0}else return!1}}function qe(a){return a.nodeType==3?a.nodeValue.length:a.childNodes.length}function Di(a,e){let t=e?a.left:a.right;return{left:t,right:t,top:a.top,bottom:a.bottom}}function Nh(a){let e=a.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:a.innerWidth,top:0,bottom:a.innerHeight}}function Mo(a,e){let t=e.width/a.offsetWidth,n=e.height/a.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-a.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-a.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function Vh(a,e,t,n,l,o,s,r){let c=a.ownerDocument,h=c.defaultView||window;for(let f=a,d=!1;f&&!d;)if(f.nodeType==1){let p,m=f==c.body,b=1,y=1;if(m)p=Nh(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(d=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let w=f.getBoundingClientRect();({scaleX:b,scaleY:y}=Mo(f,w)),p={left:w.left,right:w.left+f.clientWidth*b,top:w.top,bottom:w.top+f.clientHeight*y}}let A=0,x=0;if(l=="nearest")e.top<p.top?(x=e.top-(p.top+s),t>0&&e.bottom>p.bottom+x&&(x=e.bottom-p.bottom+s)):e.bottom>p.bottom&&(x=e.bottom-p.bottom+s,t<0&&e.top-x<p.top&&(x=e.top-(p.top+s)));else{let w=e.bottom-e.top,R=p.bottom-p.top;x=(l=="center"&&w<=R?e.top+w/2-R/2:l=="start"||l=="center"&&t<0?e.top-s:e.bottom-R+s)-p.top}if(n=="nearest"?e.left<p.left?(A=e.left-(p.left+o),t>0&&e.right>p.right+A&&(A=e.right-p.right+o)):e.right>p.right&&(A=e.right-p.right+o,t<0&&e.left<p.left+A&&(A=e.left-(p.left+o))):A=(n=="center"?e.left+(e.right-e.left)/2-(p.right-p.left)/2:n=="start"==r?e.left-o:e.right-(p.right-p.left)+o)-p.left,A||x)if(m)h.scrollBy(A,x);else{let w=0,R=0;if(x){let k=f.scrollTop;f.scrollTop+=x/y,R=(f.scrollTop-k)*y}if(A){let k=f.scrollLeft;f.scrollLeft+=A/b,w=(f.scrollLeft-k)*b}e={left:e.left-w,top:e.top-R,right:e.right-w,bottom:e.bottom-R},w&&Math.abs(w-A)<1&&(n="nearest"),R&&Math.abs(R-x)<1&&(l="nearest")}if(m)break;(e.top<p.top||e.bottom>p.bottom||e.left<p.left||e.right>p.right)&&(e={left:Math.max(e.left,p.left),right:Math.min(e.right,p.right),top:Math.max(e.top,p.top),bottom:Math.min(e.bottom,p.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function Rh(a){let e=a.ownerDocument,t,n;for(let l=a.parentNode;l&&!(l==e.body||t&&n);)if(l.nodeType==1)!n&&l.scrollHeight>l.clientHeight&&(n=l),!t&&l.scrollWidth>l.clientWidth&&(t=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:t,y:n}}class Eh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?qe(t):0),n,Math.min(e.focusOffset,n?qe(n):0))}set(e,t,n,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=l}}let Ot=null;function To(a){if(a.setActive)return a.setActive();if(Ot)return a.focus(Ot);let e=[];for(let t=a;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(a.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;t<e.length;){let n=e[t++],l=e[t++],o=e[t++];n.scrollTop!=l&&(n.scrollTop=l),n.scrollLeft!=o&&(n.scrollLeft=o)}}}let Io;function xt(a,e,t=e){let n=Io||(Io=document.createRange());return n.setEnd(a,t),n.setStart(a,e),n}function Mt(a,e,t,n){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=n);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,a.dispatchEvent(o);let s=new KeyboardEvent("keyup",l);return s.synthetic=!0,a.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Oh(a){for(;a;){if(a&&(a.nodeType==9||a.nodeType==11&&a.host))return a;a=a.assignedSlot||a.parentNode}return null}function Fo(a){for(;a.attributes.length;)a.removeAttributeNode(a.attributes[0])}function Mh(a,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,qe(t));;)if(n){if(t.nodeType!=1)return!1;let l=t.childNodes[n-1];l.contentEditable=="false"?n--:(t=l,n=qe(t))}else{if(t==a)return!0;n=At(t),t=t.parentNode}}function Do(a){return a.scrollTop>Math.max(1,a.scrollHeight-a.clientHeight-4)}function _o(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=qe(t)}else if(t.parentNode&&!Fi(t))n=At(t),t=t.parentNode;else return null}}function Po(a,e){for(let t=a,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!Fi(t))n=At(t)+1,t=t.parentNode;else return null}}class Ce{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ce(e.parentNode,At(e),t)}static after(e,t){return new Ce(e.parentNode,At(e)+1,t)}}const $n=[];class oe{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,l=null,o;for(let s of this.children){if(s.flags&7){if(!s.dom&&(o=l?l.nextSibling:n.firstChild)){let r=oe.get(o);(!r||!r.parent&&r.canReuseDOM(s))&&s.reuseDOM(o)}s.sync(e,t),s.flags&=-8}if(o=l?l.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&o!=s.dom&&(t.written=!0),s.dom.parentNode==n)for(;o&&o!=s.dom;)o=$o(o);else n.insertBefore(s.dom,o);l=s.dom}for(o=l?l.nextSibling:n.firstChild,o&&t&&t.node==n&&(t.written=!0);o;)o=$o(o)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let l=qe(e)==0?0:t==0?-1:1;for(;;){let o=e.parentNode;if(o==this.dom)break;l==0&&o.firstChild!=o.lastChild&&(e==o.firstChild?l=-1:l=1),e=o}l<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!oe.get(n);)n=n.nextSibling;if(!n)return this.length;for(let l=0,o=0;;l++){let s=this.children[l];if(s.dom==n)return o;o+=s.length+s.breakAfter}}domBoundsAround(e,t,n=0){let l=-1,o=-1,s=-1,r=-1;for(let c=0,h=n,f=n;c<this.children.length;c++){let d=this.children[c],p=h+d.length;if(h<e&&p>t)return d.domBoundsAround(e,t,h);if(p>=e&&l==-1&&(l=c,o=h),h>t&&d.dom.parentNode==this.dom){s=c,r=f;break}f=p,h=p+d.breakAfter}return{from:o,to:r<0?n+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=$n){this.markDirty();for(let l=e;l<t;l++){let o=this.children[l];o.parent==this&&n.indexOf(o)<0&&o.destroy()}n.length<250?this.children.splice(e,t-e,...n):this.children=[].concat(this.children.slice(0,e),n,this.children.slice(t));for(let l=0;l<n.length;l++)n[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Lo(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,l,o,s){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}oe.prototype.breakAfter=0;function $o(a){let e=a.nextSibling;return a.parentNode.removeChild(a),e}class Lo{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Uo(a,e,t,n,l,o,s,r,c){let{children:h}=a,f=h.length?h[e]:null,d=o.length?o[o.length-1]:null,p=d?d.breakAfter:s;if(!(e==n&&f&&!s&&!p&&o.length<2&&f.merge(t,l,o.length?d:null,t==0,r,c))){if(n<h.length){let m=h[n];m&&(l<m.length||m.breakAfter&&d?.breakAfter)?(e==n&&(m=m.split(l),l=0),!p&&d&&m.merge(0,l,d,!0,0,c)?o[o.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,c),o.push(m))):m?.breakAfter&&(d?d.breakAfter=1:s=1),n++}for(f&&(f.breakAfter=s,t>0&&(!s&&o.length&&f.merge(t,f.length,o[0],!1,r,0)?f.breakAfter=o.shift().breakAfter:(t<f.length||f.children.length&&f.children[f.children.length-1].length==0)&&f.merge(t,f.length,null,!1,r,0),e++));e<n&&o.length;)if(h[n-1].become(o[o.length-1]))n--,o.pop(),c=o.length?0:r;else if(h[e].become(o[0]))e++,o.shift(),r=o.length?0:c;else break;!o.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,r,c)&&e--,(e<n||o.length)&&a.replaceChildren(e,n,o)}}function zo(a,e,t,n,l,o){let s=a.childCursor(),{i:r,off:c}=s.findPos(t,1),{i:h,off:f}=s.findPos(e,-1),d=e-t;for(let p of n)d+=p.length;a.length+=d,Uo(a,h,f,r,c,n,0,l,o)}let Ne=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ln=typeof document<"u"?document:{documentElement:{style:{}}};const Un=/Edge\/(\d+)/.exec(Ne.userAgent),jo=/MSIE \d/.test(Ne.userAgent),zn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ne.userAgent),_i=!!(jo||zn||Un),qo=!_i&&/gecko\/(\d+)/i.test(Ne.userAgent),jn=!_i&&/Chrome\/(\d+)/.exec(Ne.userAgent),Qo="webkitFontSmoothing"in Ln.documentElement.style,Wo=!_i&&/Apple Computer/.test(Ne.vendor),Yo=Wo&&(/Mobile\/\w+/.test(Ne.userAgent)||Ne.maxTouchPoints>2);var W={mac:Yo||/Mac/.test(Ne.platform),windows:/Win/.test(Ne.platform),linux:/Linux|X11/.test(Ne.platform),ie:_i,ie_version:jo?Ln.documentMode||6:zn?+zn[1]:Un?+Un[1]:0,gecko:qo,gecko_version:qo?+(/Firefox\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Yo,android:/Android\b/.test(Ne.userAgent),webkit:Qo,safari:Wo,webkit_version:Qo?+(/\bAppleWebKit\/(\d+)/.exec(Ne.userAgent)||[0,0])[1]:0,tabSize:Ln.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Th=256;class _e extends oe{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,n){return this.flags&8||n&&(!(n instanceof _e)||this.length-(t-e)+n.length>Th||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new _e(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ce(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Ih(this.dom,e,t)}}class tt extends oe{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let l of t)l.setParent(this)}setAttrs(e){if(Fo(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,l,o,s){return n&&(!(n instanceof tt&&n.mark.eq(this.mark))||e&&o<=0||t<this.length&&s<=0)?!1:(zo(this,e,t,n?n.children.slice():[],o-1,s-1),this.markDirty(),!0)}split(e){let t=[],n=0,l=-1,o=0;for(let r of this.children){let c=n+r.length;c>e&&t.push(n<e?r.split(e-n):r),l<0&&n>=e&&(l=o),n=c,o++}let s=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new tt(this.mark,t,s)}domAtPos(e){return Ho(this,e)}coordsAt(e,t){return Go(this,e,t)}}function Ih(a,e,t){let n=a.nodeValue.length;e>n&&(e=n);let l=e,o=e,s=0;e==0&&t<0||e==n&&t>=0?W.chrome||W.gecko||(e?(l--,s=1):o<n&&(o++,s=-1)):t<0?l--:o<n&&o++;let r=xt(a,l,o).getClientRects();if(!r.length)return null;let c=r[(s?s<0:t>=0)?0:r.length-1];return W.safari&&!s&&c.width==0&&(c=Array.prototype.find.call(r,h=>h.width)||c),s?Di(c,s<0):c||null}class Ct extends oe{static create(e,t,n){return new Ct(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Ct.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,l,o,s){return n&&(!(n instanceof Ct)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Ct&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return te.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,l=this.posAtStart;return n?n.slice(l,l+this.length):te.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let l=this.dom.getClientRects(),o=null;if(!l.length)return null;let s=this.side?this.side<0:e>0;for(let r=s?l.length-1:0;o=l[r],!(e>0?r==0:r==l.length-1||o.top<o.bottom);r+=s?-1:1);return Di(o,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class Tt extends oe{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Tt&&e.side==this.side}split(){return new Tt(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ce.before(this.dom):Ce.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return te.empty}get isHidden(){return!0}}_e.prototype.children=Ct.prototype.children=Tt.prototype.children=$n;function Ho(a,e){let t=a.dom,{children:n}=a,l=0;for(let o=0;l<n.length;l++){let s=n[l],r=o+s.length;if(!(r==o&&s.getSide()<=0)){if(e>o&&e<r&&s.dom.parentNode==t)return s.domAtPos(e-o);if(e<=o)break;o=r}}for(let o=l;o>0;o--){let s=n[o-1];if(s.dom.parentNode==t)return s.domAtPos(s.length)}for(let o=l;o<n.length;o++){let s=n[o];if(s.dom.parentNode==t)return s.domAtPos(0)}return new Ce(t,0)}function Ko(a,e,t){let n,{children:l}=a;t>0&&e instanceof tt&&l.length&&(n=l[l.length-1])instanceof tt&&n.mark.eq(e.mark)?Ko(n,e.children[0],t-1):(l.push(e),e.setParent(a)),a.length+=e.length}function Go(a,e,t){let n=null,l=-1,o=null,s=-1;function r(h,f){for(let d=0,p=0;d<h.children.length&&p<=f;d++){let m=h.children[d],b=p+m.length;b>=f&&(m.children.length?r(m,f-p):(!o||o.isHidden&&(t>0||Dh(o,m)))&&(b>f||p==b&&m.getSide()>0)?(o=m,s=f-p):(p<f||p==b&&m.getSide()<0&&!m.isHidden)&&(n=m,l=f-p)),p=b}}r(a,e);let c=(t<0?n:o)||n||o;return c?c.coordsAt(Math.max(0,c==n?l:s),t):Fh(a)}function Fh(a){let e=a.dom.lastChild;if(!e)return a.dom.getBoundingClientRect();let t=ii(e);return t[t.length-1]||null}function Dh(a,e){let t=a.coordsAt(0,1),n=e.coordsAt(0,1);return t&&n&&n.top<t.bottom}function qn(a,e){for(let t in a)t=="class"&&e.class?e.class+=" "+a.class:t=="style"&&e.style?e.style+=";"+a.style:e[t]=a[t];return e}const Jo=Object.create(null);function Pi(a,e,t){if(a==e)return!0;a||(a=Jo),e||(e=Jo);let n=Object.keys(a),l=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let o of n)if(o!=t&&(l.indexOf(o)==-1||a[o]!==e[o]))return!1;return!0}function Qn(a,e,t){let n=!1;if(e)for(let l in e)t&&l in t||(n=!0,l=="style"?a.style.cssText="":a.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(n=!0,l=="style"?a.style.cssText=t[l]:a.setAttribute(l,t[l]));return n}function _h(a){let e=Object.create(null);for(let t=0;t<a.attributes.length;t++){let n=a.attributes[t];e[n.name]=n.value}return e}class Wn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Qe=function(a){return a[a.Text=0]="Text",a[a.WidgetBefore=1]="WidgetBefore",a[a.WidgetAfter=2]="WidgetAfter",a[a.WidgetRange=3]="WidgetRange",a}(Qe||(Qe={}));class ve extends Rt{constructor(e,t,n,l){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=l}get heightRelevant(){return!1}static mark(e){return new li(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new ht(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,l;if(e.isBlockGap)n=-5e8,l=4e8;else{let{start:o,end:s}=Xo(e,t);n=(o?t?-3e8:-1:5e8)-1,l=(s?t?2e8:1:-6e8)+1}return new ht(e,n,l,t,e.widget||null,!0)}static line(e){return new oi(e)}static set(e,t=!1){return ce.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ve.none=ce.empty;class li extends ve{constructor(e){let{start:t,end:n}=Xo(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof li&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Pi(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}li.prototype.point=!1;class oi extends ve{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof oi&&this.spec.class==e.spec.class&&Pi(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}oi.prototype.mapMode=Re.TrackBefore,oi.prototype.point=!0;class ht extends ve{constructor(e,t,n,l,o,s){super(t,n,o,e),this.block=l,this.isReplace=s,this.mapMode=l?t<=0?Re.TrackBefore:Re.TrackAfter:Re.TrackDel}get type(){return this.startSide!=this.endSide?Qe.WidgetRange:this.startSide<=0?Qe.WidgetBefore:Qe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ht&&Ph(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ht.prototype.point=!0;function Xo(a,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=a;return t==null&&(t=a.inclusive),n==null&&(n=a.inclusive),{start:t??e,end:n??e}}function Ph(a,e){return a==e||!!(a&&e&&a.compare(e))}function $i(a,e,t,n=0){let l=t.length-1;l>=0&&t[l]+n>=a?t[l]=Math.max(t[l],e):t.push(a,e)}class ue extends oe{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,l,o,s){if(n){if(!(n instanceof ue))return!1;this.dom||n.transferDOM(this)}return l&&this.setDeco(n?n.attrs:null),zo(this,e,t,n?n.children.slice():[],o,s),!0}split(e){let t=new ue;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:l}=this.childPos(e);l&&(t.append(this.children[n].split(l),0),this.children[n].merge(l,this.children[n].length,null,!1,0,0),n++);for(let o=n;o<this.children.length;o++)t.append(this.children[o],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Pi(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Ko(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=qn(t,this.attrs||{})),n&&(this.attrs=qn({class:n},this.attrs||{}))}domAtPos(e){return Ho(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Fo(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Qn(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let l=this.dom.lastChild;for(;l&&oe.get(l)instanceof tt;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((n=oe.get(l))===null||n===void 0?void 0:n.isEditable)==!1&&(!W.ios||!this.children.some(o=>o instanceof _e))){let o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof _e)||/[^ -~]/.test(n.text))return null;let l=ii(n.dom);if(l.length!=1)return null;e+=l[0].width,t=l[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Go(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:l}=this.parent.view.viewState,o=n.bottom-n.top;if(Math.abs(o-l.lineHeight)<2&&l.textHeight<o){let s=(o-l.textHeight)/2;return{top:n.top+s,bottom:n.bottom-s,left:n.left,right:n.left}}}return n}become(e){return e instanceof ue&&this.children.length==0&&e.children.length==0&&Pi(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let n=0,l=0;n<e.children.length;n++){let o=e.children[n],s=l+o.length;if(s>=t){if(o instanceof ue)return o;if(s>t)break}l=s+o.breakAfter}return null}}class it extends oe{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,l,o,s){return n&&(!(n instanceof it)||!this.widget.compare(n.widget)||e>0&&o<=0||t<this.length&&s<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ce.before(this.dom):Ce.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new it(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return $n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):te.empty}domBoundsAround(){return null}become(e){return e instanceof it&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);return n||(this.widget instanceof Yn?null:Di(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class Yn extends Wn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class si{constructor(e,t,n,l){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=l,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof it&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ue),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Li(new Tt(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof it)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:s,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Li(new _e(this.text.slice(this.textOff,this.textOff+l)),t),n),this.atCursorPos=!0,this.textOff+=l,e-=l,n=0}}span(e,t,n,l){this.buildText(t-e,n,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,n,l,o,s){if(this.disallowBlockEffectsFor[s]&&n instanceof ht){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=t-e;if(n instanceof ht)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new it(n.widget||It.block,r,n));else{let c=Ct.create(n.widget||It.inline,r,r?0:n.startSide),h=this.atCursorPos&&!c.isEditable&&o<=l.length&&(e<t||n.startSide>0),f=!c.isEditable&&(e<t||o>l.length||n.startSide<=0),d=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),h&&(d.append(Li(new Tt(1),l),o),o=l.length+Math.max(0,o-l.length)),d.append(Li(c,l),o),this.atCursorPos=f,this.pendingBuffer=f?e<t||o>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=o)}static build(e,t,n,l,o){let s=new si(e,t,n,o);return s.openEnd=ce.spans(l,t,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function Li(a,e){for(let t of e)a=new tt(t,[a],a.length);return a}class It extends Wn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}It.inline=new It("span"),It.block=new It("div");var ye=function(a){return a[a.LTR=0]="LTR",a[a.RTL=1]="RTL",a}(ye||(ye={}));const vt=ye.LTR,Hn=ye.RTL;function Zo(a){let e=[];for(let t=0;t<a.length;t++)e.push(1<<+a[t]);return e}const $h=Zo("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Lh=Zo("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Kn=Object.create(null),We=[];for(let a of["()","[]","{}"]){let e=a.charCodeAt(0),t=a.charCodeAt(1);Kn[e]=t,Kn[t]=-e}function es(a){return a<=247?$h[a]:1424<=a&&a<=1524?2:1536<=a&&a<=1785?Lh[a-1536]:1774<=a&&a<=2220?4:8192<=a&&a<=8204?256:64336<=a&&a<=65023?4:1}const Uh=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ft{get dir(){return this.level%2?Hn:vt}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,l){let o=-1;for(let s=0;s<e.length;s++){let r=e[s];if(r.from<=t&&r.to>=t){if(r.level==n)return s;(o<0||(l!=0?l<0?r.from<t:r.to>t:e[o].level>r.level))&&(o=s)}}if(o<0)throw new RangeError("Index out of range");return o}}function ts(a,e){if(a.length!=e.length)return!1;for(let t=0;t<a.length;t++){let n=a[t],l=e[t];if(n.from!=l.from||n.to!=l.to||n.direction!=l.direction||!ts(n.inner,l.inner))return!1}return!0}const se=[];function zh(a,e,t,n,l){for(let o=0;o<=n.length;o++){let s=o?n[o-1].to:e,r=o<n.length?n[o].from:t,c=o?256:l;for(let h=s,f=c,d=c;h<r;h++){let p=es(a.charCodeAt(h));p==512?p=f:p==8&&d==4&&(p=16),se[h]=p==4?2:p,p&7&&(d=p),f=p}for(let h=s,f=c,d=c;h<r;h++){let p=se[h];if(p==128)h<r-1&&f==se[h+1]&&f&24?p=se[h]=f:se[h]=256;else if(p==64){let m=h+1;for(;m<r&&se[m]==64;)m++;let b=h&&f==8||m<t&&se[m]==8?d==1?1:8:256;for(let y=h;y<m;y++)se[y]=b;h=m-1}else p==8&&d==1&&(se[h]=1);f=p,p&7&&(d=p)}}}function jh(a,e,t,n,l){let o=l==1?2:1;for(let s=0,r=0,c=0;s<=n.length;s++){let h=s?n[s-1].to:e,f=s<n.length?n[s].from:t;for(let d=h,p,m,b;d<f;d++)if(m=Kn[p=a.charCodeAt(d)])if(m<0){for(let y=r-3;y>=0;y-=3)if(We[y+1]==-m){let A=We[y+2],x=A&2?l:A&4?A&1?o:l:0;x&&(se[d]=se[We[y]]=x),r=y;break}}else{if(We.length==189)break;We[r++]=d,We[r++]=p,We[r++]=c}else if((b=se[d])==2||b==1){let y=b==l;c=y?0:1;for(let A=r-3;A>=0;A-=3){let x=We[A+2];if(x&2)break;if(y)We[A+2]|=2;else{if(x&4)break;We[A+2]|=4}}}}}function qh(a,e,t,n){for(let l=0,o=n;l<=t.length;l++){let s=l?t[l-1].to:a,r=l<t.length?t[l].from:e;for(let c=s;c<r;){let h=se[c];if(h==256){let f=c+1;for(;;)if(f==r){if(l==t.length)break;f=t[l++].to,r=l<t.length?t[l].from:e}else if(se[f]==256)f++;else break;let d=o==1,p=(f<e?se[f]:n)==1,m=d==p?d?1:2:n;for(let b=f,y=l,A=y?t[y-1].to:a;b>c;)b==A&&(b=t[--y].from,A=y?t[y-1].to:a),se[--b]=m;c=f}else o=h,c++}}}function Gn(a,e,t,n,l,o,s){let r=n%2?2:1;if(n%2==l%2)for(let c=e,h=0;c<t;){let f=!0,d=!1;if(h==o.length||c<o[h].from){let y=se[c];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h<o.length&&b==o[h].from){if(d)break e;let y=o[h];if(!f)for(let A=y.to,x=h+1;;){if(A==t)break e;if(x<o.length&&o[x].from==A)A=o[x++].to;else{if(se[A]==r)break e;break}}if(h++,p)p.push(y);else{y.from>c&&s.push(new ft(c,y.from,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.to}b=y.to}else{if(b==t||(f?se[b]!=r:se[b]==r))break;b++}p?Gn(a,c,b,n+1,l,p,s):c<b&&s.push(new ft(c,b,m)),c=b}else for(let c=t,h=o.length;c>e;){let f=!0,d=!1;if(!h||c>o[h-1].to){let y=se[c-1];y!=r&&(f=!1,d=y==16)}let p=!f&&r==1?[]:null,m=f?n:n+1,b=c;e:for(;;)if(h&&b==o[h-1].to){if(d)break e;let y=o[--h];if(!f)for(let A=y.from,x=h;;){if(A==e)break e;if(x&&o[x-1].to==A)A=o[--x].from;else{if(se[A-1]==r)break e;break}}if(p)p.push(y);else{y.to<c&&s.push(new ft(y.to,c,m));let A=y.direction==vt!=!(m%2);Jn(a,A?n+1:n,l,y.inner,y.from,y.to,s),c=y.from}b=y.from}else{if(b==e||(f?se[b-1]!=r:se[b-1]==r))break;b--}p?Gn(a,b,c,n+1,l,p,s):b<c&&s.push(new ft(b,c,m)),c=b}}function Jn(a,e,t,n,l,o,s){let r=e%2?2:1;zh(a,l,o,n,r),jh(a,l,o,n,r),qh(l,o,n,r),Gn(a,l,o,e,t,n,s)}function Qh(a,e,t){if(!a)return[new ft(0,0,e==Hn?1:0)];if(e==vt&&!t.length&&!Uh.test(a))return is(a.length);if(t.length)for(;a.length>se.length;)se[se.length]=256;let n=[],l=e==vt?0:1;return Jn(a,l,l,t,0,a.length,n),n}function is(a){return[new ft(0,a,0)]}let ns="";function Wh(a,e,t,n,l){var o;let s=n.head-a.from,r=ft.find(e,s,(o=n.bidiLevel)!==null&&o!==void 0?o:-1,n.assoc),c=e[r],h=c.side(l,t);if(s==h){let p=r+=l?1:-1;if(p<0||p>=e.length)return null;c=e[r=p],s=c.side(!l,t),h=c.side(l,t)}let f=Xe(a.text,s,c.forward(l,t));(f<c.from||f>c.to)&&(f=h),ns=a.text.slice(Math.min(s,f),Math.max(s,f));let d=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return d&&f==h&&d.level+(l?0:1)<c.level?K.cursor(d.side(!l,t)+a.from,d.forward(l,t)?1:-1,d.level):K.cursor(f+a.from,c.forward(l,t)?-1:1,c.level)}function Yh(a,e,t){for(let n=e;n<t;n++){let l=es(a.charCodeAt(n));if(l==1)return vt;if(l==2||l==4)return Hn}return vt}const ls=J.define(),os=J.define(),ss=J.define(),as=J.define(),Xn=J.define(),rs=J.define(),cs=J.define(),Zn=J.define(),el=J.define(),ds=J.define({combine:a=>a.some(e=>e)}),Hh=J.define({combine:a=>a.some(e=>e)}),hs=J.define();class Ft{constructor(e,t="nearest",n="nearest",l=5,o=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=l,this.xMargin=o,this.isSnapshot=s}map(e){return e.empty?this:new Ft(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ft(K.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ui=me.define({map:(a,e)=>a.map(e)}),fs=me.define();function Ye(a,e,t){let n=a.facet(as);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const nt=J.define({combine:a=>a.length?a[0]:!0});let Kh=0;const Dt=J.define({combine(a){return a.filter((e,t)=>{for(let n=0;n<t;n++)if(a[n].plugin==e.plugin)return!1;return!0})}});class _t{constructor(e,t,n,l,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=l,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(Dt.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Dt.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:l,provide:o,decorations:s}=t||{};return new _t(Kh++,e,n,l,r=>{let c=[];return s&&c.push(ai.of(h=>{let f=h.plugin(r);return f?s(f):ve.none})),o&&c.push(o(r)),c})}static fromClass(e,t){return _t.define((n,l)=>new e(n,l),t)}}class tl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Ye(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Ye(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Ye(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const us=J.define(),il=J.define(),ai=J.define(),ps=J.define(),nl=J.define(),ms=J.define();function gs(a,e){let t=a.state.facet(ms);if(!t.length)return t;let n=t.map(o=>o instanceof Function?o(a):o),l=[];return ce.spans(n,e.from,e.to,{point(){},span(o,s,r,c){let h=o-e.from,f=s-e.from,d=l;for(let p=r.length-1;p>=0;p--,c--){let m=r[p].spec.bidiIsolate,b;if(m==null&&(m=Yh(e.text,h,f)),c>0&&d.length&&(b=d[d.length-1]).to==h&&b.direction==m)b.to=f,d=b.inner;else{let y={from:h,to:f,direction:m,inner:[]};d.push(y),d=y.inner}}}}),l}const ks=J.define();function bs(a){let e=0,t=0,n=0,l=0;for(let o of a.state.facet(ks)){let s=o(a);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(t=Math.max(t,s.right)),s.top!=null&&(n=Math.max(n,s.top)),s.bottom!=null&&(l=Math.max(l,s.bottom)))}return{left:e,right:t,top:n,bottom:l}}const ri=J.define();class Te{constructor(e,t,n,l){this.fromA=e,this.toA=t,this.fromB=n,this.toB=l}join(e){return new Te(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>n.toA)){if(l.toA<n.fromA)break;n=n.join(l),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let l=0,o=0,s=0,r=0;;l++){let c=l==e.length?null:e[l],h=s-r,f=c?c.fromB:1e9;for(;o<t.length&&t[o]<f;){let d=t[o],p=t[o+1],m=Math.max(r,d),b=Math.min(f,p);if(m<=b&&new Te(m+h,b+h,m,b).addToSet(n),p>f)break;o+=2}if(!c)return n;new Te(c.fromA,c.toA,c.fromB,c.toB).addToSet(n),s=c.toA,r=c.toB}}}class zi{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ke.empty(this.startState.doc.length);for(let o of n)this.changes=this.changes.compose(o.changes);let l=[];this.changes.iterChangedRanges((o,s,r,c)=>l.push(new Te(o,s,r,c))),this.changedRanges=l}static create(e,t,n){return new zi(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class ys extends oe{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ve.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ue],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Te(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:h,toA:f})=>f<this.minWidthFrom||h>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!nf(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?Jh(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;n=new Te(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(W.ie||W.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),c=ef(s,r,e.changes);return n=Te.extendWithRanges(n,c),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:l}=this.view;l.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=W.chrome||W.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||l.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof it&&s.widget instanceof Yn&&o.push(s.dom);l.updateGaps(o)}updateChildren(e,t,n){let l=n?n.range.addToSet(e.slice()):e,o=this.childCursor(t);for(let s=l.length-1;;s--){let r=s>=0?l[s]:null;if(!r)break;let{fromA:c,toA:h,fromB:f,toB:d}=r,p,m,b,y;if(n&&n.range.fromB<d&&n.range.toB>f){let k=si.build(this.view.state.doc,f,n.range.fromB,this.decorations,this.dynamicDecorationMap),u=si.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);m=k.breakAtStart,b=k.openStart,y=u.openEnd;let N=this.compositionView(n);u.breakAtStart?N.breakAfter=1:u.content.length&&N.merge(N.length,N.length,u.content[0],!1,u.openStart,0)&&(N.breakAfter=u.content[0].breakAfter,u.content.shift()),k.content.length&&N.merge(0,0,k.content[k.content.length-1],!0,0,k.openEnd)&&k.content.pop(),p=k.content.concat(N).concat(u.content)}else({content:p,breakAtStart:m,openStart:b,openEnd:y}=si.build(this.view.state.doc,f,d,this.decorations,this.dynamicDecorationMap));let{i:A,off:x}=o.findPos(h,1),{i:w,off:R}=o.findPos(c,-1);Uo(this,w,R,A,x,p,m,b,y)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(fs)&&(this.editContextFormatting=n.value)}compositionView(e){let t=new _e(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new tt(l,[t],t.length);let n=new ue;return n.append(t,0),n}fixCompositionDOM(e){let t=(o,s)=>{s.flags|=8|(s.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(s);let r=oe.get(o);r&&r!=s&&(r.dom=null),s.setDOM(o)},n=this.childPos(e.range.fromB,1),l=this.children[n.i];t(e.line,l);for(let o=e.marks.length-1;o>=-1;o--)n=l.childPos(n.off,1),l=l.children[n.i],t(o>=0?e.marks[o].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,l=n==this.dom,o=!l&&!(this.view.state.facet(nt)||this.dom.tabIndex>-1)&&Ii(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(l||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?c:this.moveToLine(this.domAtPos(r.head));if(W.gecko&&r.empty&&!this.hasComposition&&Gh(c)){let d=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(d,c.node.childNodes[c.offset]||null)),c=h=new Ce(d,0),s=!0}let f=this.view.observer.selectionRange;(s||!f.focusNode||(!ni(c.node,c.offset,f.anchorNode,f.anchorOffset)||!ni(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,r))&&(this.view.observer.ignore(()=>{W.android&&W.chrome&&this.dom.contains(f.focusNode)&&tf(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let d=ti(this.view.root);if(d)if(r.empty){if(W.gecko){let p=Xh(c.node,c.offset);if(p&&p!=3){let m=(p==1?_o:Po)(c.node,c.offset);m&&(c=new Ce(m.node,m.offset))}}d.collapse(c.node,c.offset),r.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=r.bidiLevel)}else if(d.extend){d.collapse(c.node,c.offset);try{d.extend(h.node,h.offset)}catch{}}else{let p=document.createRange();r.anchor>r.head&&([c,h]=[h,c]),p.setEnd(h.node,h.offset),p.setStart(c.node,c.offset),d.removeAllRanges(),d.addRange(p)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ce(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Ce(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ni(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ti(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let s=ue.find(this,t.head);if(!s)return;let r=s.posAtStart;if(t.head==r||t.head==r+s.length)return;let c=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(t.head+t.assoc);n.collapse(f.node,f.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let d=e.observer.selectionRange;e.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=t.from&&n.collapse(l,o)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let l=e.offset;!n&&l<t.childNodes.length;l++){let o=oe.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(0))}for(let l=e.offset-1;!n&&l>=0;l--){let o=oe.get(t.childNodes[l]);o instanceof ue&&(n=o.domAtPos(o.length))}return n?new Ce(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=oe.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(n<l.length||l instanceof ue)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,l=0;for(let o=this.length,s=this.children.length-1;s>=0;s--){let r=this.children[s],c=o-r.breakAfter,h=c-r.length;if(c<e)break;if(h<=e&&(h<e||r.covers(-1))&&(c>e||r.covers(1))&&(!n||r instanceof ue&&!(n instanceof ue&&t>=0)))n=r,l=h;else if(n&&h==e&&c==e&&r instanceof it&&Math.abs(t)<2){if(r.deco.startSide<0)break;s&&(n=null)}o=h}return n?n.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),l=this.children[t];if(!(l instanceof ue))return null;for(;l.children.length;){let{i:r,off:c}=l.childPos(n,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}n=c}if(!(l instanceof _e))return null;let o=Xe(l.text,n);if(o==n)return null;let s=xt(l.dom,n,o).getClientRects();for(let r=0;r<s.length;r++){let c=s[r];if(r==s.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:l}=e,o=this.view.contentDOM.clientWidth,s=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,c=this.view.textDirection==ye.LTR;for(let h=0,f=0;f<this.children.length;f++){let d=this.children[f],p=h+d.length;if(p>l)break;if(h>=n){let m=d.dom.getBoundingClientRect();if(t.push(m.height),s){let b=d.dom.lastChild,y=b?ii(b):[];if(y.length){let A=y[y.length-1],x=c?A.right-m.left:m.right-A.left;x>r&&(r=x,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=p)}}}h=p+d.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ye.RTL:ye.LTR}measureTextSize(){for(let o of this.children)if(o instanceof ue){let s=o.measureTextSize();if(s)return s}let e=document.createElement("div"),t,n,l;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let o=ii(e.firstChild)[0];t=e.getBoundingClientRect().height,n=o?o.width/27:7,l=o?o.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Lo(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],s=o?o.from-1:this.length;if(s>n){let r=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ve.replace({widget:new Yn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!o)break;n=o.to+1}return ve.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ai).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),n=!1,l=this.view.state.facet(ps).map((o,s)=>{let r=typeof o=="function";return r&&(n=!0),r?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=n,t.push(ce.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(hs))try{if(h(this.view,e.range,e))return!0}catch(f){Ye(this.view.state,f,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!n)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,l.left),top:Math.min(n.top,l.top),right:Math.max(n.right,l.right),bottom:Math.max(n.bottom,l.bottom)});let o=bs(this.view),s={left:n.left-o.left,top:n.top-o.top,right:n.right+o.right,bottom:n.bottom+o.bottom},{offsetWidth:r,offsetHeight:c}=this.view.scrollDOM;Vh(this.view.scrollDOM,s,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,c),-c),this.view.textDirection==ye.LTR)}}function Gh(a){return a.node.nodeType==1&&a.node.firstChild&&(a.offset==0||a.node.childNodes[a.offset-1].contentEditable=="false")&&(a.offset==a.node.childNodes.length||a.node.childNodes[a.offset].contentEditable=="false")}function ws(a,e){let t=a.observer.selectionRange;if(!t.focusNode)return null;let n=_o(t.focusNode,t.focusOffset),l=Po(t.focusNode,t.focusOffset),o=n||l;if(l&&n&&l.node!=n.node){let r=oe.get(l.node);if(!r||r instanceof _e&&r.text!=l.node.nodeValue)o=l;else if(a.docView.lastCompositionAfterCursor){let c=oe.get(n.node);!c||c instanceof _e&&c.text!=n.node.nodeValue||(o=l)}}if(a.docView.lastCompositionAfterCursor=o!=n,!o)return null;let s=e-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function Jh(a,e,t){let n=ws(a,t);if(!n)return null;let{node:l,from:o,to:s}=n,r=l.nodeValue;if(/[\n\r]/.test(r)||a.state.doc.sliceString(n.from,n.to)!=r)return null;let c=e.invertedDesc,h=new Te(c.mapPos(o),c.mapPos(s),o,s),f=[];for(let d=l.parentNode;;d=d.parentNode){let p=oe.get(d);if(p instanceof tt)f.push({node:d,deco:p.mark});else{if(p instanceof ue||d.nodeName=="DIV"&&d.parentNode==a.contentDOM)return{range:h,text:l,marks:f,line:d};if(d!=a.contentDOM)f.push({node:d,deco:new li({inclusive:!0,attributes:_h(d),tagName:d.tagName.toLowerCase()})});else return null}}}function Xh(a,e){return a.nodeType!=1?0:(e&&a.childNodes[e-1].contentEditable=="false"?1:0)|(e<a.childNodes.length&&a.childNodes[e].contentEditable=="false"?2:0)}let Zh=class{constructor(){this.changes=[]}compareRange(e,t){$i(e,t,this.changes)}comparePoint(e,t){$i(e,t,this.changes)}boundChange(e){$i(e,e,this.changes)}};function ef(a,e,t){let n=new Zh;return ce.compare(a,e,t,n),n.changes}function tf(a,e){for(let t=a;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function nf(a,e){let t=!1;return e&&a.iterChangedRanges((n,l)=>{n<e.to&&l>e.from&&(t=!0)}),t}function lf(a,e,t=1){let n=a.charCategorizer(e),l=a.doc.lineAt(e),o=e-l.from;if(l.length==0)return K.cursor(e);o==0?t=1:o==l.length&&(t=-1);let s=o,r=o;t<0?s=Xe(l.text,o,!1):r=Xe(l.text,o);let c=n(l.text.slice(s,r));for(;s>0;){let h=Xe(l.text,s,!1);if(n(l.text.slice(h,s))!=c)break;s=h}for(;r<l.length;){let h=Xe(l.text,r);if(n(l.text.slice(r,h))!=c)break;r=h}return K.range(s+l.from,r+l.from)}function of(a,e){return e.left>a?e.left-a:Math.max(0,a-e.right)}function sf(a,e){return e.top>a?e.top-a:Math.max(0,a-e.bottom)}function ll(a,e){return a.top<e.bottom-1&&a.bottom>e.top+1}function As(a,e){return e<a.top?{top:e,left:a.left,right:a.right,bottom:a.bottom}:a}function xs(a,e){return e>a.bottom?{top:a.top,left:a.left,right:a.right,bottom:e}:a}function ol(a,e,t){let n,l,o,s,r=!1,c,h,f,d;for(let b=a.firstChild;b;b=b.nextSibling){let y=ii(b);for(let A=0;A<y.length;A++){let x=y[A];l&&ll(l,x)&&(x=As(xs(x,l.bottom),l.top));let w=of(e,x),R=sf(t,x);if(w==0&&R==0)return b.nodeType==3?Cs(b,e,t):ol(b,e,t);(!n||s>R||s==R&&o>w)&&(n=b,l=x,o=w,s=R,r=w?e<x.left?A>0:A<y.length-1:!0),w==0?t>x.bottom&&(!f||f.bottom<x.bottom)?(c=b,f=x):t<x.top&&(!d||d.top>x.top)&&(h=b,d=x):f&&ll(f,x)?f=xs(f,x.bottom):d&&ll(d,x)&&(d=As(d,x.top))}}if(f&&f.bottom>=t?(n=c,l=f):d&&d.top<=t&&(n=h,l=d),!n)return{node:a,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(n.nodeType==3)return Cs(n,p,t);if(r&&n.contentEditable!="false")return ol(n,p,t);let m=Array.prototype.indexOf.call(a.childNodes,n)+(e>=(l.left+l.right)/2?1:0);return{node:a,offset:m}}function Cs(a,e,t){let n=a.nodeValue.length,l=-1,o=1e9,s=0;for(let r=0;r<n;r++){let c=xt(a,r,r+1).getClientRects();for(let h=0;h<c.length;h++){let f=c[h];if(f.top==f.bottom)continue;s||(s=e-f.left);let d=(f.top>t?f.top-t:t-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&d<o){let p=e>=(f.left+f.right)/2,m=p;if((W.chrome||W.gecko)&&xt(a,r).getBoundingClientRect().left==f.right&&(m=!p),d<=0)return{node:a,offset:r+(m?1:0)};l=r+(m?1:0),o=d}}}return{node:a,offset:l>-1?l:s>0?a.nodeValue.length:0}}function vs(a,e,t,n=-1){var l,o;let s=a.contentDOM.getBoundingClientRect(),r=s.top+a.viewState.paddingTop,c,{docHeight:h}=a.viewState,{x:f,y:d}=e,p=d-r;if(p<0)return 0;if(p>h)return a.state.doc.length;for(let k=a.viewState.heightOracle.textHeight/2,u=!1;c=a.elementAtHeight(p),c.type!=Qe.Text;)for(;p=n>0?c.bottom+k:c.top-k,!(p>=0&&p<=h);){if(u)return t?null:0;u=!0,n=-n}d=r+p;let m=c.from;if(m<a.viewport.from)return a.viewport.from==0?0:t?null:Ss(a,s,c,f,d);if(m>a.viewport.to)return a.viewport.to==a.state.doc.length?a.state.doc.length:t?null:Ss(a,s,c,f,d);let b=a.dom.ownerDocument,y=a.root.elementFromPoint?a.root:b,A=y.elementFromPoint(f,d);A&&!a.contentDOM.contains(A)&&(A=null),A||(f=Math.max(s.left+1,Math.min(s.right-1,f)),A=y.elementFromPoint(f,d),A&&!a.contentDOM.contains(A)&&(A=null));let x,w=-1;if(A&&((l=a.docView.nearest(A))===null||l===void 0?void 0:l.isEditable)!=!1){if(b.caretPositionFromPoint){let k=b.caretPositionFromPoint(f,d);k&&({offsetNode:x,offset:w}=k)}else if(b.caretRangeFromPoint){let k=b.caretRangeFromPoint(f,d);k&&({startContainer:x,startOffset:w}=k,(!a.contentDOM.contains(x)||W.safari&&af(x,w,f)||W.chrome&&rf(x,w,f))&&(x=void 0))}x&&(w=Math.min(qe(x),w))}if(!x||!a.docView.dom.contains(x)){let k=ue.find(a.docView,m);if(!k)return p>c.top+c.height/2?c.to:c.from;({node:x,offset:w}=ol(k.dom,f,d))}let R=a.docView.nearest(x);if(!R)return null;if(R.isWidget&&((o=R.dom)===null||o===void 0?void 0:o.nodeType)==1){let k=R.dom.getBoundingClientRect();return e.y<k.top||e.y<=k.bottom&&e.x<=(k.left+k.right)/2?R.posAtStart:R.posAtEnd}else return R.localPosFromDOM(x,w)+R.posAtStart}function Ss(a,e,t,n,l){let o=Math.round((n-e.left)*a.defaultCharacterWidth);if(a.lineWrapping&&t.height>a.defaultLineHeight*1.5){let r=a.viewState.heightOracle.textHeight,c=Math.floor((l-t.top-(a.defaultLineHeight-r)*.5)/r);o+=c*a.viewState.heightOracle.lineLength}let s=a.state.sliceDoc(t.from,t.to);return t.from+Sh(s,o,a.state.tabSize)}function af(a,e,t){let n,l=a;if(a.nodeType!=3||e!=(n=a.nodeValue.length))return!1;for(;;){let o=l.nextSibling;if(o){if(o.nodeName=="BR")break;return!1}else{let s=l.parentNode;if(!s||s.nodeName=="DIV")break;l=s}}return xt(a,n-1,n).getBoundingClientRect().right>t}function rf(a,e,t){if(e!=0)return!1;for(let l=a;;){let o=l.parentNode;if(!o||o.nodeType!=1||o.firstChild!=l)return!1;if(o.classList.contains("cm-line"))break;l=o}let n=a.nodeType==1?a.getBoundingClientRect():xt(a,0,Math.max(a.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function cf(a,e,t){let n=a.lineBlockAt(e);if(Array.isArray(n.type)){let l;for(let o of n.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!l||o.type==Qe.Text&&(l.type!=o.type||(t<0?o.from<e:o.to>e)))&&(l=o)}}return l||n}return n}function df(a,e,t,n){let l=cf(a,e.head,e.assoc||-1),o=!n||l.type!=Qe.Text||!(a.lineWrapping||l.widgetLineBreaks)?null:a.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let s=a.dom.getBoundingClientRect(),r=a.textDirectionAt(l.from),c=a.posAtCoords({x:t==(r==ye.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(c!=null)return K.cursor(c,t?-1:1)}return K.cursor(t?l.to:l.from,t?-1:1)}function Bs(a,e,t,n){let l=a.state.doc.lineAt(e.head),o=a.bidiSpans(l),s=a.textDirectionAt(l.from);for(let r=e,c=null;;){let h=Wh(l,o,s,r,t),f=ns;if(!h){if(l.number==(t?a.state.doc.lines:1))return r;f=`
21
+ `,l=a.state.doc.line(l.number+(t?1:-1)),o=a.bidiSpans(l),h=a.visualLineSide(l,!t)}if(c){if(!c(f))return r}else{if(!n)return h;c=n(f)}r=h}}function hf(a,e,t){let n=a.state.charCategorizer(e),l=n(t);return o=>{let s=n(o);return l==et.Space&&(l=s),l==s}}function ff(a,e,t,n){let l=e.head,o=t?1:-1;if(l==(t?a.state.doc.length:0))return K.cursor(l,e.assoc);let s=e.goalColumn,r,c=a.contentDOM.getBoundingClientRect(),h=a.coordsAtPos(l,e.assoc||-1),f=a.documentTop;if(h)s==null&&(s=h.left-c.left),r=o<0?h.top:h.bottom;else{let m=a.viewState.lineBlockAt(l);s==null&&(s=Math.min(c.right-c.left,a.defaultCharacterWidth*(l-m.from))),r=(o<0?m.top:m.bottom)+f}let d=c.left+s,p=n??a.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let b=r+(p+m)*o,y=vs(a,{x:d,y:b},!1,o);if(b<c.top||b>c.bottom||(o<0?y<l:y>l)){let A=a.docView.coordsForChar(y),x=!A||b<A.top?-1:1;return K.cursor(y,x,void 0,s)}}}function ji(a,e,t){for(;;){let n=0;for(let l of a)l.between(e-1,e+1,(o,s,r)=>{if(e>o&&e<s){let c=n||t||(e-o<s-e?-1:1);e=c<0?o:s,n=c}});if(!n)return e}}function sl(a,e,t){let n=ji(a.state.facet(nl).map(l=>l(a)),t.from,e.head>t.from?-1:1);return n==t.from?t:K.cursor(n,n<t.from?1:-1)}const ci="￿";class uf{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(le.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let l=e;;){this.findPointBefore(n,l);let o=this.text.length;this.readNode(l);let s=l.nextSibling;if(s==t)break;let r=oe.get(l),c=oe.get(s);(r&&c?r.breakAfter:(r?r.breakAfter:Fi(l))||Fi(s)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>o)&&this.lineBreak(),l=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,s=1,r;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=l.exec(t))&&(o=r.index,s=r[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=s-1);n=o+s}}readNode(e){if(e.cmIgnore)return;let t=oe.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let l=n.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(pf(e,n.node,n.offset)?t:0))}}function pf(a,e,t){for(;;){if(!e||t<qe(e))return!1;if(e==a)return!0;t=At(e)+1,e=e.parentNode}}class Ns{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class mf{constructor(e,t,n,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let r=o||s?[]:bf(e),c=new uf(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=yf(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=o&&o.node==r.focusNode&&o.offset==r.focusOffset||!Pn(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),h=s&&s.node==r.anchorNode&&s.offset==r.anchorOffset||!Pn(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),f=e.viewport;if((W.ios||W.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to<e.state.doc.length)){let d=Math.min(c,h),p=Math.max(c,h),m=f.from-d,b=f.to-p;(m==0||m==1||d==0)&&(b==0||b==-1||p==e.state.doc.length)&&(c=0,h=e.state.doc.length)}this.newSel=K.single(h,c)}}}function Vs(a,e){let t,{newSel:n}=e,l=a.state.selection.main,o=a.inputState.lastKeyTime>Date.now()-100?a.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:r}=e.bounds,c=l.from,h=null;(o===8||W.android&&e.text.length<r-s)&&(c=l.to,h="end");let f=kf(a.state.doc.sliceString(s,r,ci),e.text,c-s,h);f&&(W.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==ci+ci&&f.toB--,t={from:s+f.from,to:s+f.toA,insert:te.of(e.text.slice(f.from,f.toB).split(ci))})}else n&&(!a.hasFocus&&a.state.facet(nt)||n.main.eq(l))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!l.empty&&n&&n.main.empty?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,l.to)}:(W.mac||W.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&a.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=K.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:te.of([t.insert.toString().replace("."," ")])}):t&&t.from>=l.from&&t.to<=l.to&&(t.from!=l.from||t.to!=l.to)&&l.to-l.from-(t.to-t.from)<=4?t={from:l.from,to:l.to,insert:a.state.doc.slice(l.from,t.from).append(t.insert).append(a.state.doc.slice(t.to,l.to))}:W.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
22
+ `&&a.lineWrapping&&(n&&(n=K.single(n.main.anchor-1,n.main.head-1)),t={from:l.from,to:l.to,insert:te.of([" "])}),t)return al(a,t,n,o);if(n&&!n.main.eq(l)){let s=!1,r="select";return a.inputState.lastSelectionTime>Date.now()-50&&(a.inputState.lastSelectionOrigin=="select"&&(s=!0),r=a.inputState.lastSelectionOrigin),a.dispatch({selection:n,scrollIntoView:s,userEvent:r}),!0}else return!1}function al(a,e,t,n=-1){if(W.ios&&a.inputState.flushIOSKey(e))return!0;let l=a.state.selection.main;if(W.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&a.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Mt(a.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&Mt(a.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&Mt(a.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();a.inputState.composing>=0&&a.inputState.composing++;let s,r=()=>s||(s=gf(a,e,t));return a.state.facet(rs).some(c=>c(a,e.from,e.to,o,r))||a.dispatch(r()),!0}function gf(a,e,t){let n,l=a.state,o=l.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&a.inputState.composing<0){let r=o.from<e.from?l.sliceDoc(o.from,e.from):"",c=o.to>e.to?l.sliceDoc(e.to,o.to):"";n=l.replaceSelection(a.state.toText(r+e.insert.sliceString(0,void 0,a.state.lineBreak)+c))}else{let r=l.changes(e),c=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&a.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let h=a.state.sliceDoc(e.from,e.to),f,d=t&&ws(a,t.main.head);if(d){let b=e.insert.length-(e.to-e.from);f={from:d.from,to:d.to-b}}else f=a.state.doc.lineAt(o.head);let p=o.to-e.to,m=o.to-o.from;n=l.changeByRange(b=>{if(b.from==o.from&&b.to==o.to)return{changes:r,range:c||b.map(r)};let y=b.to-p,A=y-h.length;if(b.to-b.from!=m||a.state.sliceDoc(A,y)!=h||b.to>=f.from&&b.from<=f.to)return{range:b};let x=l.changes({from:A,to:y,insert:e.insert}),w=b.to-o.to;return{changes:x,range:c?K.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):b.map(x)}})}else n={changes:r,selection:c&&l.selection.replaceRange(c)}}let s="input.type";return(a.composing||a.inputState.compositionPendingChange&&a.inputState.compositionEndedAt>Date.now()-50)&&(a.inputState.compositionPendingChange=!1,s+=".compose",a.inputState.compositionFirstChange&&(s+=".start",a.inputState.compositionFirstChange=!1)),l.update(n,{userEvent:s,scrollIntoView:!0})}function kf(a,e,t,n){let l=Math.min(a.length,e.length),o=0;for(;o<l&&a.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==l&&a.length==e.length)return null;let s=a.length,r=e.length;for(;s>0&&r>0&&a.charCodeAt(s-1)==e.charCodeAt(r-1);)s--,r--;if(n=="end"){let c=Math.max(0,o-Math.min(s,r));t-=s+c-o}if(s<o&&a.length<e.length){let c=t<=o&&t>=s?o-t:0;o-=c,r=o+(r-s),s=o}else if(r<o){let c=t<=o&&t>=r?o-t:0;o-=c,s=o+(s-r),r=o}return{from:o,toA:s,toB:r}}function bf(a){let e=[];if(a.root.activeElement!=a.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}=a.observer.selectionRange;return t&&(e.push(new Ns(t,n)),(l!=t||o!=n)&&e.push(new Ns(l,o))),e}function yf(a,e){if(a.length==0)return null;let t=a[0].pos,n=a.length==2?a[1].pos:t;return t>-1&&n>-1?K.single(t+e,n+e):null}class wf{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,W.safari&&e.contentDOM.addEventListener("input",()=>null),W.gecko&&_f(e.contentDOM.ownerDocument)}handleEvent(e){!Rf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let l of n.observers)l(this.view,t);for(let l of n.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Af(e),n=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let s=!t[o].handlers.length,r=n[o];r&&s!=!r.handlers.length&&(l.removeEventListener(o,this.handleEvent),r=null),r||l.addEventListener(o,this.handleEvent,{passive:s})}for(let o in n)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Cf.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),W.android&&W.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return W.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Es.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||xf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Mt(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:W.safari&&!W.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Rs(a,e){return(t,n)=>{try{return e.call(a,n,t)}catch(l){Ye(t.state,l)}}}function Af(a){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of a){let l=n.spec,o=l&&l.plugin.domEventHandlers,s=l&&l.plugin.domEventObservers;if(o)for(let r in o){let c=o[r];c&&t(r).handlers.push(Rs(n.value,c))}if(s)for(let r in s){let c=s[r];c&&t(r).observers.push(Rs(n.value,c))}}for(let n in Pe)t(n).handlers.push(Pe[n]);for(let n in Ie)t(n).observers.push(Ie[n]);return e}const Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xf="dthko",Cf=[16,17,18,20,91,92,224,225],qi=6;function Qi(a){return Math.max(0,a)*.7+8}function vf(a,e){return Math.max(Math.abs(a.clientX-e.clientX),Math.abs(a.clientY-e.clientY))}class Sf{constructor(e,t,n,l){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Rh(e.contentDOM),this.atoms=e.state.facet(nl).map(s=>s(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(le.allowMultipleSelections)&&Bf(e,t),this.dragging=Vf(e,t)&&$s(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&vf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,l=0,o=0,s=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:r}=this.scrollParents.y.getBoundingClientRect());let c=bs(this.view);e.clientX-c.left<=l+qi?t=-Qi(l-e.clientX):e.clientX+c.right>=s-qi&&(t=Qi(e.clientX-s)),e.clientY-c.top<=o+qi?n=-Qi(o-e.clientY):e.clientY+c.bottom>=r-qi&&(n=Qi(e.clientY-r)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let l=e.ranges[n],o=null;if(l.empty){let s=ji(this.atoms,l.from,0);s!=l.from&&(o=K.cursor(s,-1))}else{let s=ji(this.atoms,l.from,-1),r=ji(this.atoms,l.to,1);(s!=l.from||r!=l.to)&&(o=K.range(l.from==l.anchor?s:r,l.from==l.head?s:r))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?K.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Bf(a,e){let t=a.state.facet(ls);return t.length?t[0](e):W.mac?e.metaKey:e.ctrlKey}function Nf(a,e){let t=a.state.facet(os);return t.length?t[0](e):W.mac?!e.altKey:!e.ctrlKey}function Vf(a,e){let{main:t}=a.state.selection;if(t.empty)return!1;let n=ti(a.root);if(!n||n.rangeCount==0)return!0;let l=n.getRangeAt(0).getClientRects();for(let o=0;o<l.length;o++){let s=l[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function Rf(a,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=a.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=oe.get(t))&&n.ignoreEvent(e))return!1;return!0}const Pe=Object.create(null),Ie=Object.create(null),Os=W.ie&&W.ie_version<15||W.ios&&W.webkit_version<604;function Ef(a){let e=a.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{a.focus(),t.remove(),Ms(a,t.value)},50)}function Wi(a,e,t){for(let n of a.facet(e))t=n(t,a);return t}function Ms(a,e){e=Wi(a.state,Zn,e);let{state:t}=a,n,l=1,o=t.toText(e),s=o.lines==t.selection.ranges.length;if(rl!=null&&t.selection.ranges.every(c=>c.empty)&&rl==o.toString()){let c=-1;n=t.changeByRange(h=>{let f=t.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let d=t.toText((s?o.line(l++).text:e)+t.lineBreak);return{changes:{from:f.from,insert:d},range:K.cursor(h.from+d.length)}})}else s?n=t.changeByRange(c=>{let h=o.line(l++);return{changes:{from:c.from,to:c.to,insert:h.text},range:K.cursor(c.from+h.length)}}):n=t.replaceSelection(o);a.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ie.scroll=a=>{a.inputState.lastScrollTop=a.scrollDOM.scrollTop,a.inputState.lastScrollLeft=a.scrollDOM.scrollLeft},Pe.keydown=(a,e)=>(a.inputState.setSelectionOrigin("select"),e.keyCode==27&&a.inputState.tabFocusMode!=0&&(a.inputState.tabFocusMode=Date.now()+2e3),!1),Ie.touchstart=(a,e)=>{a.inputState.lastTouchTime=Date.now(),a.inputState.setSelectionOrigin("select.pointer")},Ie.touchmove=a=>{a.inputState.setSelectionOrigin("select.pointer")},Pe.mousedown=(a,e)=>{if(a.observer.flush(),a.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of a.state.facet(ss))if(t=n(a,e),t)break;if(!t&&e.button==0&&(t=Tf(a,e)),t){let n=!a.hasFocus;a.inputState.startMouseSelection(new Sf(a,e,t,n)),n&&a.observer.ignore(()=>{To(a.contentDOM);let o=a.root.activeElement;o&&!o.contains(a.contentDOM)&&o.blur()});let l=a.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function Ts(a,e,t,n){if(n==1)return K.cursor(e,t);if(n==2)return lf(a.state,e,t);{let l=ue.find(a.docView,e),o=a.state.doc.lineAt(l?l.posAtEnd:e),s=l?l.posAtStart:o.from,r=l?l.posAtEnd:o.to;return r<a.state.doc.length&&r==o.to&&r++,K.range(s,r)}}let Is=(a,e,t)=>e>=t.top&&e<=t.bottom&&a>=t.left&&a<=t.right;function Of(a,e,t,n){let l=ue.find(a.docView,e);if(!l)return 1;let o=e-l.posAtStart;if(o==0)return 1;if(o==l.length)return-1;let s=l.coordsAt(o,-1);if(s&&Is(t,n,s))return-1;let r=l.coordsAt(o,1);return r&&Is(t,n,r)?1:s&&s.bottom>=n?-1:1}function Fs(a,e){let t=a.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Of(a,t,e.clientX,e.clientY)}}const Mf=W.ie&&W.ie_version<=11;let Ds=null,_s=0,Ps=0;function $s(a){if(!Mf)return a.detail;let e=Ds,t=Ps;return Ds=a,Ps=Date.now(),_s=!e||t>Date.now()-400&&Math.abs(e.clientX-a.clientX)<2&&Math.abs(e.clientY-a.clientY)<2?(_s+1)%3:1}function Tf(a,e){let t=Fs(a,e),n=$s(e),l=a.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,s,r){let c=Fs(a,o),h,f=Ts(a,c.pos,c.bias,n);if(t.pos!=c.pos&&!s){let d=Ts(a,t.pos,t.bias,n),p=Math.min(d.from,f.from),m=Math.max(d.to,f.to);f=p<f.from?K.range(p,m):K.range(m,p)}return s?l.replaceRange(l.main.extend(f.from,f.to)):r&&n==1&&l.ranges.length>1&&(h=If(l,c.pos))?h:r?l.addRange(f):K.create([f])}}}function If(a,e){for(let t=0;t<a.ranges.length;t++){let{from:n,to:l}=a.ranges[t];if(n<=e&&l>=e)return K.create(a.ranges.slice(0,t).concat(a.ranges.slice(t+1)),a.mainIndex==t?0:a.mainIndex-(a.mainIndex>t?1:0))}return null}Pe.dragstart=(a,e)=>{let{selection:{main:t}}=a.state;if(e.target.draggable){let l=a.docView.nearest(e.target);if(l&&l.isWidget){let o=l.posAtStart,s=o+l.length;(o>=t.to||s<=t.from)&&(t=K.range(o,s))}}let{inputState:n}=a;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wi(a.state,el,a.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Pe.dragend=a=>(a.inputState.draggedContent=null,!1);function Ls(a,e,t,n){if(t=Wi(a.state,Zn,t),!t)return;let l=a.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=a.inputState,s=n&&o&&Nf(a,e)?{from:o.from,to:o.to}:null,r={from:l,insert:t},c=a.state.changes(s?[s,r]:r);a.focus(),a.dispatch({changes:c,selection:{anchor:c.mapPos(l,-1),head:c.mapPos(l,1)},userEvent:s?"move.drop":"input.drop"}),a.inputState.draggedContent=null}Pe.drop=(a,e)=>{if(!e.dataTransfer)return!1;if(a.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),l=0,o=()=>{++l==t.length&&Ls(a,e,n.filter(s=>s!=null).join(a.state.lineBreak),!1)};for(let s=0;s<t.length;s++){let r=new FileReader;r.onerror=o,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(n[s]=r.result),o()},r.readAsText(t[s])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ls(a,e,n,!0),!0}return!1},Pe.paste=(a,e)=>{if(a.state.readOnly)return!0;a.observer.flush();let t=Os?null:e.clipboardData;return t?(Ms(a,t.getData("text/plain")||t.getData("text/uri-list")),!0):(Ef(a),!1)};function Ff(a,e){let t=a.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),a.focus()},50)}function Df(a){let e=[],t=[],n=!1;for(let l of a.selection.ranges)l.empty||(e.push(a.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of a.selection.ranges){let s=a.doc.lineAt(o);s.number>l&&(e.push(s.text),t.push({from:s.from,to:Math.min(a.doc.length,s.to+1)})),l=s.number}n=!0}return{text:Wi(a,el,e.join(a.lineBreak)),ranges:t,linewise:n}}let rl=null;Pe.copy=Pe.cut=(a,e)=>{let{text:t,ranges:n,linewise:l}=Df(a.state);if(!t&&!l)return!1;rl=l?t:null,e.type=="cut"&&!a.state.readOnly&&a.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let o=Os?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(Ff(a,t),!1)};const Us=Nt.define();function zs(a,e){let t=[];for(let n of a.facet(cs)){let l=n(a,e);l&&t.push(l)}return t.length?a.update({effects:t,annotations:Us.of(!0)}):null}function js(a){setTimeout(()=>{let e=a.hasFocus;if(e!=a.inputState.notifiedFocused){let t=zs(a.state,e);t?a.dispatch(t):a.update([])}},10)}Ie.focus=a=>{a.inputState.lastFocusTime=Date.now(),!a.scrollDOM.scrollTop&&(a.inputState.lastScrollTop||a.inputState.lastScrollLeft)&&(a.scrollDOM.scrollTop=a.inputState.lastScrollTop,a.scrollDOM.scrollLeft=a.inputState.lastScrollLeft),js(a)},Ie.blur=a=>{a.observer.clearSelectionRange(),js(a)},Ie.compositionstart=Ie.compositionupdate=a=>{a.observer.editContext||(a.inputState.compositionFirstChange==null&&(a.inputState.compositionFirstChange=!0),a.inputState.composing<0&&(a.inputState.composing=0))},Ie.compositionend=a=>{a.observer.editContext||(a.inputState.composing=-1,a.inputState.compositionEndedAt=Date.now(),a.inputState.compositionPendingKey=!0,a.inputState.compositionPendingChange=a.observer.pendingRecords().length>0,a.inputState.compositionFirstChange=null,W.chrome&&W.android?a.observer.flushSoon():a.inputState.compositionPendingChange?Promise.resolve().then(()=>a.observer.flush()):setTimeout(()=>{a.inputState.composing<0&&a.docView.hasComposition&&a.update([])},50))},Ie.contextmenu=a=>{a.inputState.lastContextMenu=Date.now()},Pe.beforeinput=(a,e)=>{var t,n;if(e.inputType=="insertReplacementText"&&a.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),s=e.getTargetRanges();if(o&&s.length){let r=s[0],c=a.posAtDOM(r.startContainer,r.startOffset),h=a.posAtDOM(r.endContainer,r.endOffset);return al(a,{from:c,to:h,insert:a.state.toText(o)},null),!0}}let l;if(W.chrome&&W.android&&(l=Es.find(o=>o.inputType==e.inputType))&&(a.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&a.hasFocus&&(a.contentDOM.blur(),a.focus())},100)}return W.ios&&e.inputType=="deleteContentForward"&&a.observer.flushSoon(),W.safari&&e.inputType=="insertText"&&a.inputState.composing>=0&&setTimeout(()=>Ie.compositionend(a,e),20),!1};const qs=new Set;function _f(a){qs.has(a)||(qs.add(a),a.addEventListener("copy",()=>{}),a.addEventListener("cut",()=>{}))}const Qs=["pre-wrap","normal","pre-line","break-spaces"];let Pt=!1;function Ws(){Pt=!1}class Pf{constructor(e){this.lineWrapping=e,this.doc=te.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Qs.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let l=e[n];l<0?n++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,n,l,o,s){let r=Qs.indexOf(e)>-1,c=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=n,this.textHeight=l,this.lineLength=o,c){this.heightSamples={};for(let h=0;h<s.length;h++){let f=s[h];f<0?h++:this.heightSamples[Math.floor(f*10)]=!0}}return c}}class $f{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class He{constructor(e,t,n,l,o){this.from=e,this.length=t,this.top=n,this.height=l,this._content=o}get type(){return typeof this._content=="number"?Qe.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ht?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new He(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var de=function(a){return a[a.ByPos=0]="ByPos",a[a.ByHeight=1]="ByHeight",a[a.ByPosNoHeight=2]="ByPosNoHeight",a}(de||(de={}));const Yi=.001;class Se{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Yi&&(Pt=!0),this.height=e)}replace(e,t,n){return Se.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,l){let o=this,s=n.doc;for(let r=l.length-1;r>=0;r--){let{fromA:c,toA:h,fromB:f,toB:d}=l[r],p=o.lineAt(c,de.ByPosNoHeight,n.setDoc(t),0,0),m=p.to>=h?p:o.lineAt(h,de.ByPosNoHeight,n,0,0);for(d+=m.to-h,h=m.to;r>0&&p.from<=l[r-1].toA;)c=l[r-1].fromA,f=l[r-1].fromB,r--,c<p.from&&(p=o.lineAt(c,de.ByPosNoHeight,n,0,0));f+=p.from-c,c=p.from;let b=cl.build(n.setDoc(s),e,f,d);o=Hi(o,o.replace(c,h,b))}return o.updateHeight(n,0)}static empty(){return new Ee(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,l=0,o=0;for(;;)if(t==n)if(l>o*2){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,l-=r.size}else if(o>l*2){let r=e[n];r.break?e.splice(n,1,r.left,null,r.right):e.splice(n,1,r.left,r.right),n+=2+r.break,o-=r.size}else break;else if(l<o){let r=e[t++];r&&(l+=r.size)}else{let r=e[--n];r&&(o+=r.size)}let s=0;return e[t-1]==null?(s=1,t--):e[t]==null&&(s=1,n++),new Lf(Se.of(e.slice(0,t)),s,Se.of(e.slice(n)))}}function Hi(a,e){return a==e?a:(a.constructor!=e.constructor&&(Pt=!0),e)}Se.prototype.size=1;class Ys extends Se{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,l,o){return this.blockAt(0,n,l,o)}forEachLine(e,t,n,l,o,s){e<=o+this.length&&t>=o&&s(this.blockAt(0,n,l,o))}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&l.more&&this.setHeight(l.heights[l.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ee extends Ys{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,l){return new He(l,this.length,n,this.height,this.breaks)}replace(e,t,n){let l=n[0];return n.length==1&&(l instanceof Ee||l instanceof we&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof we?l=new Ee(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):Se.of(n)}updateHeight(e,t=0,n=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class we extends Se{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-n+1,s,r=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*o);s=c/o,this.length>o+1&&(r=(this.height-c)/(this.length-o-1))}else s=this.height/o;return{firstLine:n,lastLine:l,perLine:s,perChar:r}}blockAt(e,t,n,l){let{firstLine:o,lastLine:s,perLine:r,perChar:c}=this.heightMetrics(t,l);if(t.lineWrapping){let h=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),f=t.doc.lineAt(h),d=r+f.length*c,p=Math.max(n,e-d/2);return new He(f.from,f.length,p,d,0)}else{let h=Math.max(0,Math.min(s-o,Math.floor((e-n)/r))),{from:f,length:d}=t.doc.line(o+h);return new He(f,d,n+r*h,r,0)}}lineAt(e,t,n,l,o){if(t==de.ByHeight)return this.blockAt(e,n,l,o);if(t==de.ByPosNoHeight){let{from:m,to:b}=n.doc.lineAt(e);return new He(m,b-m,0,0,0)}let{firstLine:s,perLine:r,perChar:c}=this.heightMetrics(n,o),h=n.doc.lineAt(e),f=r+h.length*c,d=h.number-s,p=l+r*d+c*(h.from-o-d);return new He(h.from,h.length,Math.max(l,Math.min(p,l+this.height-f)),f,0)}forEachLine(e,t,n,l,o,s){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:r,perLine:c,perChar:h}=this.heightMetrics(n,o);for(let f=e,d=l;f<=t;){let p=n.doc.lineAt(f);if(f==e){let b=p.number-r;d+=c*b+h*(e-o-b)}let m=c+h*p.length;s(new He(p.from,p.length,d,m,0)),d+=m,f=p.to+1}}replace(e,t,n){let l=this.length-t;if(l>0){let o=n[n.length-1];o instanceof we?n[n.length-1]=new we(o.length+l):n.push(null,new we(l-1))}if(e>0){let o=n[0];o instanceof we?n[0]=new we(e+o.length):n.unshift(new we(e-1),null)}return Se.of(n)}decomposeLeft(e,t){t.push(new we(e-1),null)}decomposeRight(e,t){t.push(null,new we(this.length-e-1))}updateHeight(e,t=0,n=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let s=[],r=Math.max(t,l.from),c=-1;for(l.from>t&&s.push(new we(l.from-t-1).updateHeight(e,t));r<=o&&l.more;){let f=e.doc.lineAt(r).length;s.length&&s.push(null);let d=l.heights[l.index++];c==-1?c=d:Math.abs(d-c)>=Yi&&(c=-2);let p=new Ee(f,d);p.outdated=!1,s.push(p),r+=f+1}r<=o&&s.push(null,new we(o-r).updateHeight(e,r));let h=Se.of(s);return(c<0||Math.abs(h.height-this.height)>=Yi||Math.abs(c-this.heightMetrics(e,t).perLine)>=Yi)&&(Pt=!0),Hi(this,h)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Lf extends Se{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,l){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,l):this.right.blockAt(e,t,o,l+this.left.length+this.break)}lineAt(e,t,n,l,o){let s=l+this.left.height,r=o+this.left.length+this.break,c=t==de.ByHeight?e<s:e<r,h=c?this.left.lineAt(e,t,n,l,o):this.right.lineAt(e,t,n,s,r);if(this.break||(c?h.to<r:h.from>r))return h;let f=t==de.ByPosNoHeight?de.ByPosNoHeight:de.ByPos;return c?h.join(this.right.lineAt(r,f,n,s,r)):this.left.lineAt(r,f,n,l,o).join(h)}forEachLine(e,t,n,l,o,s){let r=l+this.left.height,c=o+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,n,l,o,s),t>=c&&this.right.forEachLine(e,t,n,r,c,s);else{let h=this.lineAt(c,de.ByPos,n,l,o);e<h.from&&this.left.forEachLine(e,h.from-1,n,l,o,s),h.to>=e&&h.from<=t&&s(h),t>h.to&&this.right.forEachLine(h.to+1,t,n,r,c,s)}}replace(e,t,n){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,n));let o=[];e>0&&this.decomposeLeft(e,o);let s=o.length;for(let r of n)o.push(r);if(e>0&&Hs(o,s-1),t<this.length){let r=o.length;this.decomposeRight(t,o),Hs(o,r)}return Se.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,l=n+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<l&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Se.of(this.break?[e,null,t]:[e,t]):(this.left=Hi(this.left,e),this.right=Hi(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,l){let{left:o,right:s}=this,r=t+o.length+this.break,c=null;return l&&l.from<=t+o.length&&l.more?c=o=o.updateHeight(e,t,n,l):o.updateHeight(e,t,n),l&&l.from<=r+s.length&&l.more?c=s=s.updateHeight(e,r,n,l):s.updateHeight(e,r,n),c?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Hs(a,e){let t,n;a[e]==null&&(t=a[e-1])instanceof we&&(n=a[e+1])instanceof we&&a.splice(e-1,3,new we(t.length+1+n.length))}const Uf=5;class cl{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Ee?l.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Ee(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let l=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let s=t-e;n.block?this.addBlock(new Ys(s,l,n)):(s||o||l>=Uf)&&this.addLineDeco(l,o,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ee(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new we(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ee)return e;let t=new Ee(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let l=this.ensureLine();l.length+=n,l.collapsed+=n,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ee)&&!this.isCovered?this.nodes.push(new Ee(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let l of this.nodes)l instanceof Ee&&l.updateHeight(this.oracle,n),n+=l?l.length:1;return this.nodes}static build(e,t,n,l){let o=new cl(n,e);return ce.spans(t,n,l,o,0),o.finish(n)}}function zf(a,e,t){let n=new jf;return ce.compare(a,e,t,n,0),n.changes}class jf{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,l){(e<t||n&&n.heightRelevant||l&&l.heightRelevant)&&$i(e,t,this.changes,5)}}function qf(a,e){let t=a.getBoundingClientRect(),n=a.ownerDocument,l=n.defaultView||window,o=Math.max(0,t.left),s=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),c=Math.min(l.innerHeight,t.bottom);for(let h=a.parentNode;h&&h!=n.body;)if(h.nodeType==1){let f=h,d=window.getComputedStyle(f);if((f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth)&&d.overflow!="visible"){let p=f.getBoundingClientRect();o=Math.max(o,p.left),s=Math.min(s,p.right),r=Math.max(r,p.top),c=Math.min(h==a.parentNode?l.innerHeight:c,p.bottom)}h=d.position=="absolute"||d.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:o-t.left,right:Math.max(o,s)-t.left,top:r-(t.top+e),bottom:Math.max(r,c)-(t.top+e)}}function Qf(a){let e=a.getBoundingClientRect(),t=a.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Wf(a,e){let t=a.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class dl{constructor(e,t,n,l){this.from=e,this.to=t,this.size=n,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let l=e[n],o=t[n];if(l.from!=o.from||l.to!=o.to||l.size!=o.size)return!1}return!0}draw(e,t){return ve.replace({widget:new Yf(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Yf extends Wn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ks{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Gs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ye.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(il).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Pf(t),this.stateDeco=e.facet(ai).filter(n=>typeof n!="function"),this.heightMap=Se.empty().applyChanges(this.stateDeco,te.empty,this.heightOracle.setDoc(e.doc),[new Te(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ve.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let l=n?t.head:t.anchor;if(!e.some(({from:o,to:s})=>l>=o&&l<=s)){let{from:o,to:s}=this.lineBlockAt(l);e.push(new Ki(o,s))}}return this.viewports=e.sort((n,l)=>n.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Gs:new hl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(di(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ai).filter(f=>typeof f!="function");let l=e.changedRanges,o=Te.extendWithRanges(l,zf(n,this.stateDeco,e?e.changes:ke.empty(this.state.doc.length))),s=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Ws(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Pt)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let c=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Hh)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),l=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ye.RTL:ye.LTR;let s=this.heightOracle.mustRefreshForWrapping(o),r=t.getBoundingClientRect(),c=s||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let h=0,f=0;if(r.width&&r.height){let{scaleX:k,scaleY:u}=Mo(t,r);(k>.005&&Math.abs(this.scaleX-k)>.005||u>.005&&Math.abs(this.scaleY-u)>.005)&&(this.scaleX=k,this.scaleY=u,h|=16,s=c=!0)}let d=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=p)&&(this.paddingTop=d,this.paddingBottom=p,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Do(e.scrollDOM);let b=(this.printing?Wf:qf)(t,this.paddingTop),y=b.top-this.pixelViewport.top,A=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(c=!0)),!this.inView&&!this.scrollTarget&&!Qf(e.dom))return 0;let w=r.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let k=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(k)&&(s=!0),s||l.lineWrapping&&Math.abs(w-this.contentDOMWidth)>l.charWidth){let{lineHeight:u,charWidth:N,textHeight:M}=e.docView.measureTextSize();s=u>0&&l.refresh(o,u,N,M,Math.max(5,w/N),k),s&&(e.docView.minWidth=0,h|=16)}y>0&&A>0?f=Math.max(y,A):y<0&&A<0&&(f=Math.min(y,A)),Ws();for(let u of this.viewports){let N=u.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(u);this.heightMap=(s?Se.empty().applyChanges(this.stateDeco,te.empty,this.heightOracle,[new Te(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,s,new $f(u.from,N))}Pt&&(h|=2)}let R=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:s,visibleBottom:r}=this,c=new Ki(l.lineAt(s-n*1e3,de.ByHeight,o,0,0).from,l.lineAt(r+(1-n)*1e3,de.ByHeight,o,0,0).to);if(t){let{head:h}=t.range;if(h<c.from||h>c.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=l.lineAt(h,de.ByPos,o,0,0),p;t.y=="center"?p=(d.top+d.bottom)/2-f/2:t.y=="start"||t.y=="nearest"&&h<c.from?p=d.top:p=d.bottom-f,c=new Ki(l.lineAt(p-1e3/2,de.ByHeight,o,0,0).from,l.lineAt(p+f+1e3/2,de.ByHeight,o,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Ki(this.heightMap.lineAt(n,de.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,de.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,de.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:r}=this;return(e==0||l<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=r+Math.max(10,Math.min(n,250)))&&l>s-2*1e3&&o<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let l of e)t.touchesRange(l.from,l.to)||n.push(new dl(t.mapPos(l.from),t.mapPos(l.to),l.size,l.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,l=n?1e4:2e3,o=l>>1,s=l<<1;if(this.defaultTextDirection!=ye.LTR&&!n)return[];let r=[],c=(f,d,p,m)=>{if(d-f<o)return;let b=this.state.selection.main,y=[b.from];b.empty||y.push(b.to);for(let x of y)if(x>f&&x<d){c(f,x-10,p,m),c(x+10,d,p,m);return}let A=Kf(e,x=>x.from>=p.from&&x.to<=p.to&&Math.abs(x.from-f)<o&&Math.abs(x.to-d)<o&&!y.some(w=>x.from<w&&x.to>w));if(!A){if(d<p.to&&t&&n&&t.visibleRanges.some(R=>R.from<=d&&R.to>=d)){let R=t.moveToLineBoundary(K.cursor(d),!1,!0).head;R>f&&(d=R)}let x=this.gapSize(p,f,d,m),w=n||x<2e6?x:2e6;A=new dl(f,d,x,w)}r.push(A)},h=f=>{if(f.length<s||f.type!=Qe.Text)return;let d=Hf(f.from,f.to,this.stateDeco);if(d.total<s)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,m,b;if(n){let y=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,A,x;if(p!=null){let w=Ji(d,p),R=((this.visibleBottom-this.visibleTop)/2+y)/f.height;A=w-R,x=w+R}else A=(this.visibleTop-f.top-y)/f.height,x=(this.visibleBottom-f.top+y)/f.height;m=Gi(d,A),b=Gi(d,x)}else{let y=d.total*this.heightOracle.charWidth,A=l*this.heightOracle.charWidth,x=0;if(y>2e6)for(let N of e)N.from>=f.from&&N.from<f.to&&N.size!=N.displaySize&&N.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=N.size-N.displaySize);let w=this.pixelViewport.left+x,R=this.pixelViewport.right+x,k,u;if(p!=null){let N=Ji(d,p),M=((R-w)/2+A)/y;k=N-M,u=N+M}else k=(w-A)/y,u=(R+A)/y;m=Gi(d,k),b=Gi(d,u)}m>f.from&&c(f.from,m,f,d),b<f.to&&c(b,f.to,f,d)};for(let f of this.viewportLines)Array.isArray(f.type)?f.type.forEach(h):h(f);return r}gapSize(e,t,n,l){let o=Ji(l,n)-Ji(l,t);return this.heightOracle.lineWrapping?e.height*o:l.total*this.heightOracle.charWidth*o}updateLineGaps(e){dl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=ve.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];ce.spans(t,this.viewport.from,this.viewport.to,{span(o,s){n.push({from:o,to:s})},point(){}},20);let l=0;if(n.length!=this.visibleRanges.length)l=12;else for(let o=0;o<n.length&&!(l&8);o++){let s=this.visibleRanges[o],r=n[o];(s.from!=r.from||s.to!=r.to)&&(l|=4,e&&e.mapPos(s.from,-1)==r.from&&e.mapPos(s.to,1)==r.to||(l|=8))}return this.visibleRanges=n,l}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||di(this.heightMap.lineAt(e,de.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||di(this.heightMap.lineAt(this.scaler.fromDOM(e),de.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return di(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ki{constructor(e,t){this.from=e,this.to=t}}function Hf(a,e,t){let n=[],l=a,o=0;return ce.spans(t,a,e,{span(){},point(s,r){s>l&&(n.push({from:l,to:s}),o+=s-l),l=r}},20),l<e&&(n.push({from:l,to:e}),o+=e-l),{total:o,ranges:n}}function Gi({total:a,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(a*t);for(let l=0;;l++){let{from:o,to:s}=e[l],r=s-o;if(n<=r)return o+n;n-=r}}function Ji(a,e){let t=0;for(let{from:n,to:l}of a.ranges){if(e<=l){t+=e-n;break}t+=l-n}return t/a.total}function Kf(a,e){for(let t of a)if(e(t))return t}const Gs={toDOM(a){return a},fromDOM(a){return a},scale:1,eq(a){return a==this}};class hl{constructor(e,t,n){let l=0,o=0,s=0;this.viewports=n.map(({from:r,to:c})=>{let h=t.lineAt(r,de.ByPos,e,0,0).top,f=t.lineAt(c,de.ByPos,e,0,0).bottom;return l+=f-h,{from:r,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=s+(r.top-o)*this.scale,s=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(e){for(let t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return l+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,l=o.domBottom}}fromDOM(e){for(let t=0,n=0,l=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-l)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,l=o.domBottom}}eq(e){return e instanceof hl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function di(a,e){if(e.scale==1)return a;let t=e.toDOM(a.top),n=e.toDOM(a.bottom);return new He(a.from,a.length,t,n-t,Array.isArray(a._content)?a._content.map(l=>di(l,e)):a._content)}const Xi=J.define({combine:a=>a.join(" ")}),fl=J.define({combine:a=>a.indexOf(!0)>-1}),ul=dt.newName(),Js=dt.newName(),Xs=dt.newName(),Zs={"&light":"."+Js,"&dark":"."+Xs};function pl(a,e,t){return new dt(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,l=>{if(l=="&")return a;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):a+" "+n}})}const Gf=pl("."+ul,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Zs),Jf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ml=W.ie&&W.ie_version<=11;class Xf{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Eh,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(W.ie&&W.ie_version<=11||W.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&W.android&&e.constructor.EDIT_CONTEXT!==!1&&!(W.chrome&&W.chrome_version<126)&&(this.editContext=new eu(e),e.state.facet(nt)&&(e.contentDOM.editContext=this.editContext.editContext)),ml&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,l=this.selectionRange;if(n.state.facet(nt)?n.root.activeElement!=this.dom:!Ii(this.dom,l))return;let o=l.anchorNode&&n.docView.nearest(l.anchorNode);if(o&&o.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(W.ie&&W.ie_version<=11||W.android&&W.chrome)&&!n.state.selection.main.empty&&l.focusNode&&ni(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ti(e.root);if(!t)return!1;let n=W.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Zf(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let l=Ii(this.dom,n);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mh(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),l&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Jf),ml&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ml&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let l=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&Mt(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,l=!1;for(let o of e){let s=this.readMutation(o);s&&(s.typeOver&&(l=!0),t==-1?{from:t,to:n}=s:(t=Math.min(s.from,t),n=Math.max(s.to,n)))}return{from:t,to:n,typeOver:l}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),l=this.selectionChanged&&Ii(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new mf(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,l=Vs(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let n=ea(t,e.previousSibling||e.target.previousSibling,-1),l=ea(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(nt)!=e.state.facet(nt)&&(e.view.contentDOM.editContext=e.state.facet(nt)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ea(a,e,t){for(;e;){let n=oe.get(e);if(n&&n.parent==a)return n;let l=e.parentNode;e=l!=a.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function ta(a,e){let t=e.startContainer,n=e.startOffset,l=e.endContainer,o=e.endOffset,s=a.docView.domAtPos(a.state.selection.main.anchor);return ni(s.node,s.offset,l,o)&&([t,n,l,o]=[l,o,t,n]),{anchorNode:t,anchorOffset:n,focusNode:l,focusOffset:o}}function Zf(a,e){if(e.getComposedRanges){let l=e.getComposedRanges(a.root)[0];if(l)return ta(a,l)}let t=null;function n(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return a.contentDOM.addEventListener("beforeinput",n,!0),a.dom.ownerDocument.execCommand("indent"),a.contentDOM.removeEventListener("beforeinput",n,!0),t?ta(a,t):null}class eu{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let l=e.state.selection.main,{anchor:o,head:s}=l,r=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:r,drifted:!1});let h={from:r,to:c,insert:te.of(n.text.split(`
23
+ `))};if(h.from==this.from&&o<this.from?h.from=o:h.to==this.to&&o>this.to&&(h.to=o),h.from==h.to&&!h.insert.length){let f=K.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));f.main.eq(l)||e.dispatch({selection:f,userEvent:"select"});return}if((W.mac||W.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:r,to:c,insert:te.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);al(e,h,K.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=n=>{let l=[],o=null;for(let s=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);s<r;s++){let c=e.coordsForChar(s);o=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||o||new DOMRect,l.push(o)}t.updateCharacterBounds(n.rangeStart,l)},this.handlers.textformatupdate=n=>{let l=[];for(let o of n.getTextFormats()){let s=o.underlineStyle,r=o.underlineThickness;if(s!="None"&&r!="None"){let c=this.toEditorPos(o.rangeStart),h=this.toEditorPos(o.rangeEnd);if(c<h){let f=`text-decoration: underline ${s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(ve.mark({attributes:{style:f}}).range(c,h))}}}e.dispatch({effects:fs.of(ve.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let l=ti(n.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,s,r,c,h)=>{if(n)return;let f=h.length-(s-o);if(l&&s>=l.to)if(l.from==o&&l.to==s&&l.insert.eq(h)){l=this.pendingContextChange=null,t+=f,this.to+=f;return}else l=null,this.revertPending(e.state);if(o+=t,s+=t,s<=this.from)this.from+=f,this.to+=f;else if(o<this.to){if(o<this.from||s>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(s),h.toString()),this.to+=f}t+=f}),l&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(n,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ne{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(l=>l.forEach(o=>n(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Oh(e.parent)||document,this.viewState=new Ks(e.state||le.create(e)),e.scrollTo&&e.scrollTo.is(Ui)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Dt).map(l=>new tl(l));for(let l of this.plugins)l.update(this);this.observer=new Xf(this),this.inputState=new wf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ys(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof xe?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,l,o=this.state;for(let p of e){if(p.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=p.state}if(this.destroyed){this.viewState.state=o;return}let s=this.hasFocus,r=0,c=null;e.some(p=>p.annotation(Us))?(this.inputState.notifiedFocused=s,r=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,c=zs(o,s),c||(r=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(f=null)):this.observer.clear(),o.facet(le.phrases)!=this.state.facet(le.phrases))return this.setState(o);l=zi.create(this,o,e),l.flags|=r;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(d&&(d=d.map(p.changes)),p.scrollIntoView){let{main:m}=p.state.selection;d=new Ft(m.empty?m:K.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of p.effects)m.is(Ui)&&(d=m.value.clip(this.state))}this.viewState.update(l,d),this.bidiCache=Zi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(ri)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(p=>p.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Xi)!=l.state.facet(Xi)&&(this.viewState.mustMeasureContent=!0),(t||n||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(Xn))try{p(l)}catch(m){Ye(this.state,m,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!Vs(this,f)&&h.force&&Mt(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Ks(e),this.plugins=e.facet(Dt).map(n=>new tl(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new ys(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Dt),n=e.state.facet(Dt);if(t!=n){let l=[];for(let o of n){let s=t.indexOf(o);if(s<0)l.push(new tl(o));else{let r=this.plugins[s];r.mustUpdate=e,l.push(r)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l<this.plugins.length;l++)this.plugins[l].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Ye(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,l=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:s}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(s<0)if(Do(n))o=-1,s=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);o=m.from,s=m.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(m=>{try{return m.read(this)}catch(b){return Ye(this.state,b),ia}}),d=zi.create(this,this.state,[]),p=!1;d.flags|=c,t?t.flags|=c:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d),p&&this.docViewUpdate());for(let m=0;m<h.length;m++)if(f[m]!=ia)try{let b=h[m];b.write&&b.write(f[m],this)}catch(b){Ye(this.state,b)}if(p&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let b=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-s;if(b>1||b<-1){l=l+b,n.scrollTop=l/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Xn))r(t)}get themeClasses(){return ul+" "+(this.state.facet(fl)?Xs:Js)+" "+this.state.facet(Xi)}updateAttrs(){let e=na(this,us,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(nt)?"true":"false",class:"cm-content",style:`${W.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),na(this,il,t);let n=this.observer.ignore(()=>{let l=Qn(this.contentDOM,this.contentAttrs,t),o=Qn(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let l of n.effects)if(l.is(ne.announce)){t&&(this.announceDOM.textContent=""),t=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(ri);let e=this.state.facet(ne.cspNonce);dt.mount(this.root,this.styleModules.concat(Gf).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return sl(this,e,Bs(this,e,t,n))}moveByGroup(e,t){return sl(this,e,Bs(this,e,t,n=>hf(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),l=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return K.cursor(o.side(t,l)+e.from,o.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,n=!0){return df(this,e,t,n)}moveVertically(e,t,n){return sl(this,e,ff(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),vs(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let l=this.state.doc.lineAt(e),o=this.bidiSpans(l),s=o[ft.find(o,e-l.from,-1,t)];return Di(n,s.dir==ye.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ds)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>tu)return is(e.length);let t=this.textDirectionAt(e.from),n;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||ts(o.isolates,n=gs(this,e))))return o.order;n||(n=gs(this,e));let l=Qh(e.text,t,n);return this.bidiCache.push(new Zi(e.from,e.to,t,n,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||W.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{To(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ui.of(new Ft(typeof e=="number"?K.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ui.of(new Ft(K.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return _t.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return _t.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=dt.newName(),l=[Xi.of(n),ri.of(pl(`.${n}`,e))];return t&&t.dark&&l.push(fl.of(!0)),l}static baseTheme(e){return uh.lowest(ri.of(pl("."+ul,e,Zs)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),l=n&&oe.get(n)||oe.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}ne.styleModule=ri,ne.inputHandler=rs,ne.clipboardInputFilter=Zn,ne.clipboardOutputFilter=el,ne.scrollHandler=hs,ne.focusChangeEffect=cs,ne.perLineTextDirection=ds,ne.exceptionSink=as,ne.updateListener=Xn,ne.editable=nt,ne.mouseSelectionStyle=ss,ne.dragMovesSelection=os,ne.clickAddsSelectionRange=ls,ne.decorations=ai,ne.outerDecorations=ps,ne.atomicRanges=nl,ne.bidiIsolatedRanges=ms,ne.scrollMargins=ks,ne.darkTheme=fl,ne.cspNonce=J.define({combine:a=>a.length?a[0]:""}),ne.contentAttributes=il,ne.editorAttributes=us,ne.lineWrapping=ne.contentAttributes.of({class:"cm-lineWrapping"}),ne.announce=me.define();const tu=4096,ia={};class Zi{constructor(e,t,n,l,o,s){this.from=e,this.to=t,this.dir=n,this.isolates=l,this.fresh=o,this.order=s}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let n=[],l=e.length?e[e.length-1].dir:ye.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let s=e[o];s.dir==l&&!t.touchesRange(s.from,s.to)&&n.push(new Zi(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function na(a,e,t){for(let n=a.state.facet(e),l=n.length-1;l>=0;l--){let o=n[l],s=typeof o=="function"?o(a):o;s&&qn(s,t)}return t}class $t extends Rt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}$t.prototype.elementClass="",$t.prototype.toDOM=void 0,$t.prototype.mapMode=Re.TrackBefore,$t.prototype.startSide=$t.prototype.endSide=-1,$t.prototype.point=!0;var gl;const Lt=new ie;function iu(a){return J.define({combine:a?e=>e.concat(a):void 0})}const nu=new ie;class $e{constructor(e,t,n=[],l=""){this.data=e,this.name=l,le.prototype.hasOwnProperty("tree")||Object.defineProperty(le.prototype,"tree",{get(){return kl(this)}}),this.parser=t,this.extension=[zt.of(this),le.languageData.of((o,s,r)=>{let c=la(o,s,r),h=c.type.prop(Lt);if(!h)return[];let f=o.facet(h),d=c.type.prop(nu);if(d){let p=c.resolve(s-c.from,r);for(let m of d)if(m.test(p,o)){let b=o.facet(m.facet);return m.type=="replace"?b:b.concat(f)}}return f})].concat(n)}isActiveAt(e,t,n=-1){return la(e,t,n).type.prop(Lt)==this.data}findRegions(e){let t=e.facet(zt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],l=(o,s)=>{if(o.prop(Lt)==this.data){n.push({from:s,to:s+o.length});return}let r=o.prop(ie.mounted);if(r){if(r.tree.prop(Lt)==this.data){if(r.overlay)for(let c of r.overlay)n.push({from:c.from+s,to:c.to+s});else n.push({from:s,to:s+o.length});return}else if(r.overlay){let c=n.length;if(l(r.tree,r.overlay[0].from+s),n.length>c)return}}for(let c=0;c<o.children.length;c++){let h=o.children[c];h instanceof fe&&l(h,o.positions[c]+s)}};return l(kl(e),0),n}get allowsNesting(){return!0}}$e.setState=me.define();function la(a,e,t){let n=a.facet(zt),l=kl(a).topNode;if(!n||n.allowsNesting)for(let o=l;o;o=o.enter(e,t,ge.ExcludeBuffers))o.type.isTop&&(l=o);return l}class en extends $e{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=iu(e.languageData);return new en(t,e.parser.configure({props:[Lt.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new en(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kl(a){let e=a.field($e.state,!1);return e?e.tree:fe.empty}class lu{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let hi=null;class tn{constructor(e,t,n=[],l,o,s,r,c){this.parser=e,this.state=t,this.fragments=n,this.tree=l,this.treeLen=o,this.viewport=s,this.skipped=r,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new tn(e,t,[],fe.empty,0,n,[],null)}startParse(){return this.parser.startParse(new lu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=fe.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let l=this.parse.advance();if(l)if(this.fragments=this.withoutTempSkipped(gt.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=l,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(gt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=hi;hi=this;try{return e()}finally{hi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=oa(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:l,treeLen:o,viewport:s,skipped:r}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,d,p)=>c.push({fromA:h,toA:f,fromB:d,toB:p})),n=gt.applyChanges(n,c),l=fe.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){r=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),d=e.mapPos(h.to,-1);f<d&&r.push({from:f,to:d})}}}return new tn(this.parser,t,n,l,o,s,r,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:l,to:o}=this.skipped[n];l<e.to&&o>e.from&&(this.fragments=oa(this.fragments,l,o),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ql{createParse(t,n,l){let o=l[0].from,s=l[l.length-1].to;return{parsedPos:o,advance(){let c=hi;if(c){for(let h of l)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=s,new fe(Be.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return hi}}function oa(a,e,t){return gt.applyChanges(a,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ut{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ut(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=tn.create(e.facet(zt).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ut(n)}}$e.state=yt.define({create:Ut.init,update(a,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(zt)!=e.state.facet(zt)?Ut.init(e.state):a.apply(e)}});let sa=a=>{let e=setTimeout(()=>a(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(sa=a=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(a,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const bl=typeof navigator<"u"&&(!((gl=navigator.scheduling)===null||gl===void 0)&&gl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ou=_t.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=sa(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:l}}=this.view,o=n.field($e.state);if(o.tree==o.context.tree&&o.context.isDone(l+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!bl?Math.max(25,e.timeRemaining()-5):1e9),r=o.context.treeLen<l&&n.doc.length>l+1e3,c=o.context.work(()=>bl&&bl()||Date.now()>s,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new Ut(o.context))})),this.chunkBudget>0&&!(c&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ye(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zt=J.define({combine(a){return a.length?a[0]:null},enables:a=>[$e.state,ou,ne.contentAttributes.compute([a],e=>{let t=e.facet(a);return t&&t.name?{"data-language":t.name}:{}})]});class su{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const au=new ie;function aa({except:a,units:e=1}={}){return t=>{let n=a&&a.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const ru=new ie;function cu(a){let e=a.firstChild,t=a.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?a.to:t.from}:null}class yl{constructor(e,t){this.specs=e;let n;function l(r){let c=dt.newName();return(n||(n=Object.create(null)))["."+c]=r,c}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,s=t.scope;this.scope=s instanceof $e?r=>r.prop(Lt)==s.data:s?r=>r==s:void 0,this.style=Xl(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:o}).style,this.module=n?new dt(n):null,this.themeType=t.themeType}static define(e,t){return new yl(e,t||{})}}z.meta,z.link,z.heading,z.emphasis,z.strong,z.strikethrough,z.keyword,z.atom,z.bool,z.url,z.contentSeparator,z.labelName,z.literal,z.inserted,z.string,z.deleted,z.regexp,z.escape,z.string,z.variableName,z.variableName,z.typeName,z.namespace,z.className,z.variableName,z.macroName,z.propertyName,z.comment,z.invalid;const du=Object.create(null),ra=[Be.none],ca=[],da=Object.create(null),hu=Object.create(null);for(let[a,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])hu[a]=fu(du,e);function wl(a,e){ca.indexOf(a)>-1||(ca.push(a),console.warn(e))}function fu(a,e){let t=[];for(let r of e.split(" ")){let c=[];for(let h of r.split(".")){let f=a[h]||z[h];f?typeof f=="function"?c.length?c=c.map(f):wl(h,`Modifier ${h} used at start of tag`):c.length?wl(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:wl(h,`Unknown highlighting tag ${h}`)}for(let h of c)t.push(h)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),l=n+" "+t.map(r=>r.id),o=da[l];if(o)return o.id;let s=da[l]=Be.define({id:ra.length,name:n,props:[Jl({[n]:t})]});return ra.push(s),s.id}ye.RTL,ye.LTR;const uu=en.define({name:"json",parser:sh.configure({props:[au.add({Object:aa({except:/^\s*\}/}),Array:aa({except:/^\s*\]/})}),ru.add({"Object Array":cu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function pu(){return new su(uu)}const Al=[{name:"tel",title:"手机号",express:"^1[3-9]\\d{9}$",error:"手机号不正确"},{name:"email",title:"邮箱",express:"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$",error:"邮箱不正确"},{name:"idcard",title:"身份证号码",express:"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)",error:"身份证号码不正确"}];function mu(){const a=Fe();if(a.formRules?.length){const e={};Al.forEach(n=>{e[n.name]=n});const t=[...Al];return a.formRules.forEach(n=>{const l=e[n.name];l?Object.assign(l,n):t.push(l)}),t}return Al}const gu={loadAdvances:mu},ku={class:"unione-props-setting data-field-setting"},bu={key:0},yu=["onClick"],wu={class:"field-txt"},Au=["onClick"],xu={key:1,class:"field-txt"},Cu=["onClick"],vu={key:0,class:"field-txt"},Su={key:3,class:"edit-field"},Bu=["onClick"],Nu=ee(i.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=i.ref([pu()]),t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:k})=>k+1},{title:"字段名称",dataIndex:"name",key:"name",width:"70px",rowDrag:!0,resizable:!0,fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"90px",align:"center"},{title:"控件类型",dataIndex:"widget",key:"widget",width:"60px",align:"center"},{title:"验证规则",dataIndex:"rules",key:"rules",width:"60px",align:"center"},{title:"表单",dataIndex:"form",key:"form",width:"40px",align:"center"},{title:"详情",dataIndex:"view",key:"view",width:"40px",align:"center"},{title:"列表",dataIndex:"list",key:"list",width:"40px",align:"center"},{title:"排序",dataIndex:"sort",key:"sort",width:"40px",align:"center"},{title:"查询",dataIndex:"query",key:"query",width:"40px",align:"center"},{title:"转换器",dataIndex:"convertName",key:"convertName",width:"50px",align:"center"}]),n=i.useModel(a,"modelValue"),l={mounted:k=>k.focus()},o=i.ref({});function s(){const k=Object.keys(o.value);if(k.length)for(let u in k){const N=n.value.filter(M=>M.name==u);if(N&&N[0]){let M=o.value[u];Object.keys(M).forEach(v=>{v=="convertName"?(N[0].convert||(N[0].convert={}),N[0].convert.type=M[v]):N[0][v]=M[v]})}}o.value={}}function r(k,u){s();const N={};u=="convertName"?(k.convert||(k.convert={}),N[u]=k.convert?.type):N[u]=k[u]||"",o.value[k.name]=N}function c(k,u){{o.value={};return}}function h(k,u){switch(u){case"query":return k.configs?.query?.enable;case"form":return k.configs?.show?.form?.enable;case"view":return k.configs?.show?.view?.enable;case"list":return k.configs?.show?.list?.enable;case"sort":return k.configs?.sort?.enable}}function f(k,u){switch(u){case"query":k.configs=Y.utils.obj.ext(k.configs,{query:{enable:!1}}),k.configs.query.enable=!k.configs.query.enable;break;case"form":k.configs=Y.utils.obj.ext(k.configs,{show:{form:{enable:!1}}}),k.configs.show.form.enable=!k.configs.show.form.enable;break;case"view":k.configs=Y.utils.obj.ext(k.configs,{show:{view:{enable:!1}}}),k.configs.show.view.enable=!k.configs.show.view.enable;break;case"list":k.configs=Y.utils.obj.ext(k.configs,{show:{list:{enable:!1}}}),k.configs.show.list.enable=!k.configs.show.list.enable;break;case"sort":k.configs=Y.utils.obj.ext(k.configs,{sort:{enable:!1}}),k.configs.sort.enable=!k.configs.sort.enable;break}console.log("record.configs",k.configs)}const d=i.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{d.value.visible=!1}});function p(k,u){switch(d.value.prop=u,d.value.field=k,k.configs||(k.configs={}),k.configs.show||(k.configs.show={}),u){case"query":k.configs.query||(k.configs.query={}),k.configs.query.types||(k.configs.query.types="EQ"),d.value.show=k.configs.query,d.value.title=`查询设置/${k.title}(${k.name})`;break;case"form":k.configs.show.form||(k.configs.show.form={}),d.value.show=k.configs.show.form,d.value.title=`表单设置/${k.title}(${k.name})`;break;case"view":k.configs.show.view||(k.configs.show.view={}),d.value.show=k.configs.show.view,d.value.title=`详情设置/${k.title}(${k.name})`;break;case"list":k.configs.show.list||(k.configs.show.list={}),d.value.show=k.configs.show.list,d.value.title=`列头设置/${k.title}(${k.name})`;break;case"sort":k.configs.sort||(k.configs.sort={}),d.value.show=k.configs.sort,d.value.title=`排序设置/${k.title}(${k.name})`;break}d.value.visible=!0}const m=i.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:k=>{const u=m.value.options.filter(N=>N.value==k);return u[0]?u[0].label:k}}),b=i.ref({visible:!1,field:{},props:{},advances:gu.loadAdvances(),showInfo:k=>{let u=0;if(k.configs?.rule){const N=k.configs.rule;N.advance&&u++,typeof N.rangeMin<"u"&&u++,typeof N.rangeMax<"u"&&u++,typeof N.regExpress<"u"&&u++}if(u>0)return"("+u+")"},toSetting:()=>{const k=b.value.props;b.value.field.configs=Y.utils.obj.ext(b.value.field.configs,{rule:{...k}}),b.value.visible=!1,b.value.props={}}});function y(k){b.value.visible=!0,b.value.field=k,b.value.props=k.configs?.rule||{}}const A=i.ref({visible:!1,field:{},widget:{},widgets:[{value:"a-input",label:"文本框"},{value:"a-input-number",label:"数值框"},{value:"unione-check-box",label:"多选框"},{value:"unione-radio-box",label:"单选框"},{value:"unione-switch-box",label:"开关"},{value:"unione-select-box",label:"下拉框"},{value:"unione-tree-box",label:"下拉树"},{value:"a-date-picker",label:"日期框"},{value:"a-input-password",label:"密码框"},{value:"a-input-search",label:"搜索框"},{value:"a-upload",label:"文件框"},{value:"unione-avatar",label:"头像框",disabled:!0},{value:"unione-picture-card",label:"照片墙"},{value:"a-slider",label:"滑块"},{value:"a-textarea",label:"文本域"}],widgetName:k=>{const u=k.configs?.widget?.name,N=A.value.widgets.filter(M=>M.value==u);return N[0]?N[0].label:u},toSetting:(k,u)=>{k.configs||(k.configs={}),k.configs.widget||(k.configs.widget={}),k.configs.widget.name=u},toclose:()=>{A.value.visible=!1}});function x(k){A.value.field=k,k.configs=Y.utils.obj.ext(k.configs,{widget:{props:{}}}),A.value.widget=k.configs.widget,A.value.visible=!0}const w=i.ref({visible:!1,field:{},convert:{},types:[{value:"dict",label:"字典"},{value:"option",label:"静态"},{value:"dbtable",label:"数据集"},{value:"remote",label:"远程接口"},{value:"local",label:"本地接口"}],optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],getTypes:(k,u="--")=>w.value.types.filter(N=>N.value==k)[0]?.label||u,toAddOption:()=>{w.value.convert.options||(w.value.convert.options=[]),w.value.convert.options.push({label:"",value:""})},toDelOption:(k,u)=>{w.value.convert.options.splice(k,1)},toSetting:()=>{w.value.visible=!1}});function R(k){w.value.visible=!0,w.value.field=k,k.configs||(k.configs={}),k.configs.convert||(k.configs.convert={}),w.value.convert=k.configs.convert}return(k,u)=>{const N=i.resolveComponent("ToolOutlined"),M=i.resolveComponent("a-button"),v=i.resolveComponent("a-select"),C=i.resolveComponent("a-checkbox"),B=i.resolveComponent("a-table"),E=i.resolveComponent("a-switch"),g=i.resolveComponent("a-form-item"),S=i.resolveComponent("a-select-option"),I=i.resolveComponent("a-input-number"),V=i.resolveComponent("a-form"),F=i.resolveComponent("a-modal"),$=i.resolveComponent("a-input"),D=i.resolveComponent("unione-select-box"),Q=i.resolveComponent("a-checkbox-group"),L=i.resolveComponent("unione-section");return i.openBlock(),i.createElementBlock("div",ku,[i.createVNode(B,{columns:t.value,"data-source":n.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:i.withCtx(({column:O})=>[["widget","queryType","rules","convertName"].includes(O.key)?(i.openBlock(),i.createElementBlock("span",bu,[i.createVNode(N),i.createTextVNode(" "+i.toDisplayString(O.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:O,text:G,record:T})=>[["rules"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",!b.value.showInfo(T)&&"empty"]),onClick:_=>y(T)},[i.createElementVNode("span",wu,i.toDisplayString(b.value.showInfo(T)),1),b.value.showInfo(T)?(i.openBlock(),i.createBlock(M,{key:0,type:"link"},{default:i.withCtx(()=>u[50]||(u[50]=[i.createTextVNode("设置")])),_:1})):i.createCommentVNode("",!0)],10,yu)):["widget"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!G&&"empty"]),onClick:_=>r(T,O.dataIndex)},[o.value[T.name]&&Object.keys(o.value[T.name]).includes(O.dataIndex)?i.withDirectives((i.openBlock(),i.createBlock(v,{key:0,value:T.configs?.widget?.name,allowClear:!0,options:A.value.widgets,onChange:_=>A.value.toSetting(T,_),onBlur:u[0]||(u[0]=_=>c())},null,8,["value","options","onChange"])),[[l]]):(i.openBlock(),i.createElementBlock("span",xu,i.toDisplayString(A.value.widgetName(T)),1)),i.createVNode(M,{type:"link",onClick:i.withModifiers(_=>x(T),["stop"])},{default:i.withCtx(()=>u[51]||(u[51]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Au)):["convertName"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[T.name]||!Object.keys(o.value[T.name]).includes(O.dataIndex))&&!T.convert?.type&&"empty"]),onClick:_=>R(T)},[T.configs?.convert?.types?(i.openBlock(),i.createElementBlock("span",vu,i.toDisplayString(w.value.getTypes(T.configs.convert.types)),1)):i.createCommentVNode("",!0)],10,Cu)):["query","form","view","list","sort"].includes(O.dataIndex)?(i.openBlock(),i.createElementBlock("div",Su,[i.createVNode(C,{checked:h(T,O.dataIndex),onClick:_=>f(T,O.dataIndex)},null,8,["checked","onClick"]),i.createVNode(M,{type:"link",onClick:_=>p(T,O.dataIndex)},{default:i.withCtx(()=>u[52]||(u[52]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])])):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(F,{visible:d.value.visible,"onUpdate:visible":u[14]||(u[14]=O=>d.value.visible=O),width:600,title:d.value.title,onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:d.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:i.normalizeClass(["field-setting-form","form-mix",d.value.prop])},{default:i.withCtx(()=>[i.createVNode(g,{label:"启用状态"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.enable,"onUpdate:checked":u[1]||(u[1]=O=>d.value.show.enable=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:0,label:"默认排序"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.defoult,"onUpdate:checked":u[2]||(u[2]=O=>d.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="sort"?(i.openBlock(),i.createBlock(g,{key:1,label:"排序方式"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.asc,"onUpdate:checked":u[3]||(u[3]=O=>d.value.show.asc=O),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"&&d.value.show.types=="ADVANCE"?(i.openBlock(),i.createBlock(g,{key:2,label:"高级查询"})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.defoult,"onUpdate:checked":u[4]||(u[4]=O=>d.value.show.defoult=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.show.visible,"onUpdate:checked":u[5]||(u[5]=O=>d.value.show.visible=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),d.value.prop=="query"?(i.openBlock(),i.createBlock(g,{key:5,label:"查询方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.types,"onUpdate:value":u[6]||(u[6]=O=>d.value.show.types=O)},{default:i.withCtx(()=>[i.createVNode(S,{key:"EQ",value:"EQ"},{default:i.withCtx(()=>u[53]||(u[53]=[i.createTextVNode("精确查询")])),_:1}),i.createVNode(S,{key:"LIKE",value:"LIKE"},{default:i.withCtx(()=>u[54]||(u[54]=[i.createTextVNode("模糊查询")])),_:1}),i.createVNode(S,{key:"LLIKE",value:"LLIKE"},{default:i.withCtx(()=>u[55]||(u[55]=[i.createTextVNode("左模糊")])),_:1}),i.createVNode(S,{key:"RLIKE",value:"RLIKE"},{default:i.withCtx(()=>u[56]||(u[56]=[i.createTextVNode("右模糊")])),_:1}),i.createVNode(S,{key:"RANGE",value:"RANGE"},{default:i.withCtx(()=>u[57]||(u[57]=[i.createTextVNode("范围查询")])),_:1}),i.createVNode(S,{key:"ADVANCE",value:"ADVANCE"},{default:i.withCtx(()=>u[58]||(u[58]=[i.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0),["query","sort"].includes(d.value.prop)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:i.withCtx(()=>[i.createVNode(I,{value:d.value.show.index,"onUpdate:value":u[7]||(u[7]=O=>d.value.show.index=O)},null,8,["value"])]),_:1})),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.width,"onUpdate:value":u[8]||(u[8]=O=>d.value.show.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,value:d.value.show.width,"onUpdate:value":u[9]||(u[9]=O=>d.value.show.width=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.labelWidth,"onUpdate:value":u[10]||(u[10]=O=>d.value.show.labelWidth=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["form","view"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:i.withCtx(()=>[i.createVNode(I,{min:0,max:24,value:d.value.show.valueWidth,"onUpdate:value":u[11]||(u[11]=O=>d.value.show.valueWidth=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:11,label:"固定位置"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.fixed,"onUpdate:value":u[12]||(u[12]=O=>d.value.show.fixed=O),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["list"].includes(d.value.prop)?(i.openBlock(),i.createBlock(g,{key:12,label:"对齐方式"},{default:i.withCtx(()=>[i.createVNode(v,{value:d.value.show.align,"onUpdate:value":u[13]||(u[13]=O=>d.value.show.align=O),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:w.value.visible,"onUpdate:visible":u[33]||(u[33]=O=>w.value.visible=O),width:600,title:w.value.getTypes(w.value.convert.types,"转换")+"设置",onOk:w.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:w.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"转换类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:w.value.convert.types,"onUpdate:value":u[15]||(u[15]=O=>w.value.convert.types=O),allowClear:!0,options:w.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"是否搜索"},{default:i.withCtx(()=>[i.createVNode(E,{checked:d.value.convert.search,"onUpdate:checked":u[16]||(u[16]=O=>d.value.convert.search=O),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="option"?(i.openBlock(),i.createBlock(g,{key:1,label:"选项设置"},{default:i.withCtx(()=>[i.createVNode(M,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:w.value.toAddOption},{default:i.withCtx(()=>u[59]||(u[59]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(B,{columns:w.value.optionColumn,"data-source":w.value.convert.options,size:"small"},{bodyCell:i.withCtx(({column:O,record:G,index:T})=>[O.dataIndex==="label"?(i.openBlock(),i.createBlock($,{key:0,value:G.label,"onUpdate:value":_=>G.label=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),O.dataIndex==="value"?(i.openBlock(),i.createBlock($,{key:1,value:G.value,"onUpdate:value":_=>G.value=_,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):i.createCommentVNode("",!0),O.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:2,onClick:_=>w.value.toDelOption(T,G)},"删除",8,Bu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):i.createCommentVNode("",!0),["dbtable","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:2,label:"数据源"},{default:i.withCtx(()=>[i.createVNode(D,{value:w.value.convert.dsId,"onUpdate:value":u[17]||(u[17]=O=>w.value.convert.dsId=O),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:3,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[18]||(u[18]=O=>w.value.convert.tableName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:4,label:"table名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableName,"onUpdate:value":u[19]||(u[19]=O=>w.value.convert.tableName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:5,label:"主键字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.idField,"onUpdate:value":u[20]||(u[20]=O=>w.value.convert.idField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"&&["unione-tree-box"].includes(w.value.field.widget?.name)?(i.openBlock(),i.createBlock(g,{key:6,label:"父级字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.pidField,"onUpdate:value":u[21]||(u[21]=O=>w.value.convert.pidField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:7,label:"value字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.valueField,"onUpdate:value":u[22]||(u[22]=O=>w.value.convert.valueField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:8,label:"label字段"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.labelField,"onUpdate:value":u[23]||(u[23]=O=>w.value.convert.labelField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableField,"onUpdate:value":u[24]||(u[24]=O=>w.value.convert.tableField=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableWhere,"onUpdate:value":u[25]||(u[25]=O=>w.value.convert.tableWhere=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[26]||(u[26]=O=>w.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.tableOrder,"onUpdate:value":u[27]||(u[27]=O=>w.value.convert.tableOrder=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:13,label:"异步加载"},{default:i.withCtx(()=>[i.createVNode(E,{checked:w.value.convert.isAsync,"onUpdate:checked":u[28]||(u[28]=O=>w.value.convert.isAsync=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dbtable"?(i.openBlock(),i.createBlock(g,{key:14,label:"分页加载"},{default:i.withCtx(()=>[i.createVNode(E,{checked:w.value.convert.isPaging,"onUpdate:checked":u[29]||(u[29]=O=>w.value.convert.isPaging=O),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):i.createCommentVNode("",!0),w.value.convert.types=="dict"?(i.openBlock(),i.createBlock(g,{key:15,label:"字典名称"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.dictName,"onUpdate:value":u[30]||(u[30]=O=>w.value.convert.dictName=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:i.withCtx(()=>[i.createVNode($,{value:w.value.convert.url,"onUpdate:value":u[31]||(u[31]=O=>w.value.convert.url=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),["local","remote"].includes(w.value.convert.types)?(i.openBlock(),i.createBlock(g,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:i.withCtx(()=>[i.createVNode(i.unref(jt.Codemirror),{modelValue:w.value.convert.params,"onUpdate:modelValue":u[32]||(u[32]=O=>w.value.convert.params=O),placeholder:"接口请求参数,eg:{sex:1}",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:e.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),i.createVNode(F,{visible:A.value.visible,"onUpdate:visible":u[40]||(u[40]=O=>A.value.visible=O),width:600,title:"控件设置",onOk:A.value.toclose},{default:i.withCtx(()=>[i.createVNode(V,{model:A.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(g,{label:"组件类型"},{default:i.withCtx(()=>[i.withDirectives(i.createVNode(v,{value:A.value.widget.name,"onUpdate:value":u[34]||(u[34]=O=>A.value.widget.name=O),allowClear:!0,options:A.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),i.createVNode(g,{label:"输入提示"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.placeholder,"onUpdate:value":u[35]||(u[35]=O=>A.value.widget.placeholder=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"帮助说明"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.help,"onUpdate:value":u[36]||(u[36]=O=>A.value.widget.help=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"提示文本"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.widget.tooltip,"onUpdate:value":u[37]||(u[37]=O=>A.value.widget.tooltip=O)},null,8,["value"])]),_:1}),["a-date-picker"].includes(A.value.widget.name)?(i.openBlock(),i.createBlock(g,{key:0,label:"显示格式"},{default:i.withCtx(()=>[i.createVNode($,{value:A.value.field.dataFormat,"onUpdate:value":u[38]||(u[38]=O=>A.value.field.dataFormat=O)},null,8,["value"])]),_:1})):i.createCommentVNode("",!0),A.value.widget.name=="unione-select-box"?(i.openBlock(),i.createBlock(g,{key:1,label:"下拉框类型"},{default:i.withCtx(()=>[i.createVNode(v,{value:A.value.widget.props.mode,"onUpdate:value":u[39]||(u[39]=O=>A.value.widget.props.mode=O),allowClear:!0},{default:i.withCtx(()=>[i.createVNode(S,{value:"multiple"},{default:i.withCtx(()=>u[60]||(u[60]=[i.createTextVNode("多选")])),_:1}),i.createVNode(S,{value:"tags"},{default:i.withCtx(()=>u[61]||(u[61]=[i.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):i.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),i.createVNode(F,{visible:b.value.visible,"onUpdate:visible":u[49]||(u[49]=O=>b.value.visible=O),width:600,title:"规则设置",onOk:b.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{model:b.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(L,{title:"基本设置",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"触发时机"},{default:i.withCtx(()=>[i.createVNode(Q,{value:b.value.props.trigger,"onUpdate:value":u[41]||(u[41]=O=>b.value.props.trigger=O),options:["change","blur"]},null,8,["value"])]),_:1}),b.value.field.isNull?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(g,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:i.withCtx(()=>[i.createVNode(C,{checked:b.value.props.whitespace,"onUpdate:checked":u[42]||(u[42]=O=>b.value.props.whitespace=O)},{default:i.withCtx(()=>u[62]||(u[62]=[i.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),i.createVNode(g,{label:"预设类型"},{default:i.withCtx(()=>[i.createVNode(v,{options:b.value.advances,fieldNames:{label:"title",value:"name"},value:b.value.props.advance,"onUpdate:value":u[43]||(u[43]=O=>b.value.props.advance=O)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(b.value.field.dataType)?(i.openBlock(),i.createBlock(L,{key:0,title:"数值验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"有效区间"},{default:i.withCtx(()=>[i.createVNode(I,{value:b.value.props.rangeMin,"onUpdate:value":u[44]||(u[44]=O=>b.value.props.rangeMin=O)},null,8,["value"]),u[63]||(u[63]=i.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),i.createVNode(I,{value:b.value.props.rangeMax,"onUpdate:value":u[45]||(u[45]=O=>b.value.props.rangeMax=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.rangeMessage,"onUpdate:value":u[46]||(u[46]=O=>b.value.props.rangeMessage=O)},null,8,["value"])]),_:1})]),_:1})):i.createCommentVNode("",!0),i.createVNode(L,{title:"正则验证",type:"line"},{default:i.withCtx(()=>[i.createVNode(g,{label:"表达式"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regExpress,"onUpdate:value":u[47]||(u[47]=O=>b.value.props.regExpress=O)},null,8,["value"])]),_:1}),i.createVNode(g,{label:"错误提示"},{default:i.withCtx(()=>[i.createVNode($,{value:b.value.props.regMessage,"onUpdate:value":u[48]||(u[48]=O=>b.value.props.regMessage=O)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),Vu={class:"unione-props-setting data-field-fkey"},Ru={key:0},Eu=["onClick"],Ou=["onClick"],Mu=["onClick"],Tu=["onClick"],Iu=["onClick"],Fu=["onClick"],Du=["onClick"],_u=["onClick"],Pu=ee(i.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:p})=>p+1},{title:"字段名称",dataIndex:"name",key:"name",width:"100px",fixed:"left",align:"center"},{title:"字段标题",dataIndex:"title",key:"title",width:"100px",fixed:"left",align:"center"},{title:"关联数据名称",dataIndex:"dsnName",key:"dsnName",width:"120px",align:"center"},{title:"关联数据标题",dataIndex:"dsnTitle",key:"dsnTitle",width:"150px",align:"center"},{title:"关联字段",dataIndex:"fieldName",key:"fieldName",width:"100px",align:"center"},{title:"显示字段",dataIndex:"labelName",key:"labelName",width:"120px",align:"center"}]),n=i.useModel(a,"modelValue"),l=i.computed(()=>n.value.filter(p=>p.configs?.fkey?.enable)||[]),o=i.ref({});function s(){o.value={}}function r(p,m){s();const b={};b[m]=p.configs.fkey[m]||"",o.value[p.name]=b}function c(p,m,b){p.configs.fkey.dsn=m,p.configs.fkey.dsnName=b.name,p.configs.fkey.dsnTitle=b.title,p.configs.fkey.dsnId=b.id}function h(p,m,b,y){p.configs.fkey[m]=b,m=="fieldName"&&(p.configs.fkey.fieldTitle=y.title),m=="labelName"&&(p.configs.fkey.labelTitle=y.title)}function f(p){d.value.record=p,d.value.visible=!0,d.value.fields=p.configs?.fkey?.fields||[]}const d=i.ref({visible:!1,record:null,editField:{},fields:[],columns:[{title:"字段名称",dataIndex:"title",key:"title",width:"100px",align:"center"},{title:"显示宽度",dataIndex:"width",key:"width",width:"60px",align:"center"},{title:"显示顺序",dataIndex:"index",key:"index",width:"60px",align:"center"},{title:"操作",dataIndex:"action",key:"action",width:"60px",align:"center"}],toEditField:(p,m)=>{d.value.editField[p]=m},onShowFieldChange:(p,m,b)=>{p.name=b.name,p.title=b.title},toAddField:()=>{d.value.fields.push({name:"",title:""}),d.value.editField[d.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{d.value.fields.splice(p,1)}})},toSetting:()=>{d.value.visible=!1,d.value.record.configs=Y.utils.obj.ext(d.value.record.configs,{fkey:{fields:d.value.fields}})}});return(p,m)=>{const b=i.resolveComponent("FormOutlined"),y=i.resolveComponent("unione-select-box"),A=i.resolveComponent("a-button"),x=i.resolveComponent("a-table"),w=i.resolveComponent("a-input-number"),R=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",Vu,[i.createVNode(x,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:i.withCtx(({column:k})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(k.key)?(i.openBlock(),i.createElementBlock("span",Ru,[i.createVNode(b),i.createTextVNode(" "+i.toDisplayString(k.title),1)])):i.createCommentVNode("",!0)]),bodyCell:i.withCtx(({column:k,record:u})=>[["dsnName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnName),1)],64))],10,Eu)):["dsnTitle"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.dsnTitle&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:s,onSelect:(N,M)=>c(u,N,M)},null,8,["value","onUpdate:value","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.dsnTitle),1)],64))],10,Ou)):i.createCommentVNode("",!0),["fieldName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.fieldName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"fieldName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.fieldTitle),1)],64))],10,Mu)):["labelName"].includes(k.dataIndex)?(i.openBlock(),i.createElementBlock("div",{key:3,class:i.normalizeClass(["edit-field",(!o.value[u.name]||!Object.keys(o.value[u.name]).includes(k.dataIndex))&&!u.configs?.fkey?.labelName&&"empty"]),onClick:N=>r(u,k.dataIndex)},[o.value[u.name]&&u.configs?.fkey?.dsn&&Object.keys(o.value[u.name]).includes(k.dataIndex)?(i.openBlock(),i.createBlock(y,{key:0,value:o.value[u.name][k.dataIndex],"onUpdate:value":N=>o.value[u.name][k.dataIndex]=N,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:u.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:s,onSelect:(N,M)=>h(u,"labelName",N,M)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(u.configs?.fkey?.labelTitle)+" ",1),u.configs?.fkey?.labelName?(i.openBlock(),i.createBlock(A,{key:0,type:"link",onClick:i.withModifiers(N=>f(u),["stop"])},{default:i.withCtx(()=>m[4]||(m[4]=[i.createTextVNode("设置")])),_:2},1032,["onClick"])):i.createCommentVNode("",!0)],64))],10,Tu)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),i.createVNode(R,{visible:d.value.visible,"onUpdate:visible":m[3]||(m[3]=k=>d.value.visible=k),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:d.value.toSetting},{default:i.withCtx(()=>[i.createVNode(A,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:d.value.toAddField},{default:i.withCtx(()=>m[5]||(m[5]=[i.createTextVNode("新增")])),_:1},8,["onClick"]),i.createVNode(x,{columns:d.value.columns,"data-source":d.value.fields,size:"small"},{bodyCell:i.withCtx(({column:k,record:u,index:N,text:M})=>[k.dataIndex==="title"?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["edit-field",d.value.editField!="title"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="title"?(i.openBlock(),i.createBlock(y,{key:0,value:u[u.dataIndex],"onUpdate:value":v=>u[u.dataIndex]=v,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:d.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=v=>d.value.editField={}),onSelect:(v,C)=>d.value.onShowFieldChange(u,v,C)},null,8,["value","onUpdate:value","convert","onSelect"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Iu)):i.createCommentVNode("",!0),k.dataIndex==="width"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["edit-field",d.value.editField!="width"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="width"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[1]||(m[1]=v=>d.value.editField={}),value:u.width,"onUpdate:value":v=>u.width=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Fu)):i.createCommentVNode("",!0),k.dataIndex==="index"?(i.openBlock(),i.createElementBlock("div",{key:2,class:i.normalizeClass(["edit-field",d.value.editField!="wiindexdth"&&!M&&"empty"]),onClick:v=>d.value.toEditField(N,k.dataIndex)},[d.value.editField[N]=="index"?(i.openBlock(),i.createBlock(w,{key:0,onBlur:m[2]||(m[2]=v=>d.value.editField={}),value:u.index,"onUpdate:value":v=>u.index=v,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(M),1)],64))],10,Du)):i.createCommentVNode("",!0),k.dataIndex==="action"?(i.openBlock(),i.createElementBlock("a",{key:3,onClick:v=>d.value.toDelField(N)},"删除",8,_u)):i.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),$u={class:"unione-props-setting data-filter"},Lu={class:"title"},Uu={class:"name"},zu={class:"action"},ju=ee(i.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(a){const e=Y.useDialog(),t=i.useModel(a,"modelValue");function n(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(h){r.value.visible=!0,r.value.filter={...h},r.value.name=h.name}function o(h){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(h,1)}})}const s=i.ref(),r=i.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{s.value.validate().then(h=>{if(r.value.name){const f=t.value.filter(d=>d.name==r.value.name)[0];if(!f){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(p=>p.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(h).forEach(d=>{f[d]=h[d]})}else{if(t.value.filter(d=>d.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(h)}r.value.visible=!1})}});function c(){const h=[];r.value.filter.filter||(r.value.filter.filter=""),h.push("-- @if(isNotEmpty(params."),h.push(r.value.filter.name||"xxx"),h.push(") && !isBlank(params."),h.push(r.value.filter.name||"xxx"),h.push(`)
24
24
  `),h.push(" AND XXX=#{params."),h.push(r.value.filter.name||"xxx"),h.push(`}
25
25
  `),h.push(`-- @}
26
- `),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,f)=>{const d=i.resolveComponent("a-button"),p=i.resolveComponent("a-card"),m=i.resolveComponent("PlusOutlined"),b=i.resolveComponent("a-empty"),y=i.resolveComponent("a-input"),A=i.resolveComponent("a-form-item"),x=i.resolveComponent("a-textarea"),w=i.resolveComponent("a-tag"),V=i.resolveComponent("a-form"),k=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",$u,[(t.value.length,i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,(u,N)=>(i.openBlock(),i.createBlock(p,{class:"filter-box",size:"small",key:N},{default:i.withCtx(()=>[i.createElementVNode("div",Lu,"过滤标题:"+i.toDisplayString(u.title),1),i.createElementVNode("div",Uu,"过滤名称:"+i.toDisplayString(u.name),1),i.createElementVNode("div",zu,[i.createVNode(d,{size:"small",onClick:M=>l(u)},{default:i.withCtx(()=>f[4]||(f[4]=[i.createTextVNode("编辑")])),_:2},1032,["onClick"]),i.createVNode(d,{danger:"",size:"small",onClick:M=>o(N)},{default:i.withCtx(()=>f[5]||(f[5]=[i.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),i.createVNode(p,{class:"filter-box btn-add",size:"small",onClick:n},{default:i.withCtx(()=>[i.createVNode(m,{class:"btn"})]),_:1})],64)),i.createVNode(k,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=u=>r.value.visible=u),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:i.withCtx(()=>[i.createVNode(V,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(A,{label:"过滤标题",name:"title"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=u=>r.value.filter.title=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤名称",name:"name"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=u=>r.value.filter.name=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:i.withCtx(()=>[i.createVNode(x,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=u=>r.value.filter.filter=u),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),i.createVNode(w,{class:"btn-tmpl",color:"blue",onClick:c},{default:i.withCtx(()=>f[6]||(f[6]=[i.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),qu={class:"unione-page form-page data-define-edit"},Qu={class:"actions"},Wu=te(i.defineComponent({__name:"edit",setup(a){const e=Y.useDialog(),t=i.inject("route"),n=i.inject("router"),l=i.ref(),o=i.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=i.ref(),r=i.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=i.ref({configs:{fields:[],filters:[]}}),h=i.ref(!1);function f(){n.back()}function d(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([c.value.id]).then(y=>{y.success?(e.success({title:"发布成功",content:y.body}),b(c.value.id)):e.error({title:"发布失败",content:y.body})})}})}async function p(){const y=await l.value.validate(),A={...c.value,...y};A.configs.show=await s.value.getValue(),console.log("formData",A),X.message.loading({content:"提交中..."}),h.value=!0,mt.save(A).then(x=>{X.message.destroy(),x.success?(c.value=x.body,l.value.setValue(x.body),s.value.setValue(x.body.configs?.show||{}),X.message.success("保存成功!")):X.message.error(x.message)}).finally(()=>{h.value=!1})}const m=i.ref(!1);i.onMounted(()=>{t.query.id&&b(t.query.id)});function b(y){X.message.loading({content:"加载中..."}),mt.detail(y).then(A=>{A.success?(c.value=A.body,l.value.setValue(A.body),s.value.setValue(A.body.configs?.show||{}),X.message.destroy()):X.message.error(A.message)})}return(y,A)=>{const x=i.resolveComponent("unione-form"),w=i.resolveComponent("unione-section"),V=i.resolveComponent("OrderedListOutlined"),k=i.resolveComponent("a-tab-pane"),u=i.resolveComponent("ToolOutlined"),N=i.resolveComponent("ApiOutlined"),M=i.resolveComponent("FunnelPlotOutlined"),v=i.resolveComponent("a-tabs"),C=i.resolveComponent("a-button");return i.openBlock(),i.createElementBlock("div",qu,[i.createVNode(w,{title:"基础信息",type:"line"},{default:i.withCtx(()=>[i.createVNode(x,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),i.createVNode(w,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":A[0]||(A[0]=B=>m.value=B)},{default:i.withCtx(()=>[i.createVNode(x,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),i.createVNode(v,null,{default:i.withCtx(()=>[i.createVNode(k,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(V),A[5]||(A[5]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(_d,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[1]||(A[1]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(u),A[6]||(A[6]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(Nu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[2]||(A[2]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-fkeys"},{tab:i.withCtx(()=>[i.createVNode(N),A[7]||(A[7]=i.createTextVNode("外键设置 "))]),default:i.withCtx(()=>[i.createVNode(Pu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[3]||(A[3]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"data-filter"},{tab:i.withCtx(()=>[i.createVNode(M),A[8]||(A[8]=i.createTextVNode("数据过滤 "))]),default:i.withCtx(()=>[i.createVNode(ju,{modelValue:c.value.configs.filters,"onUpdate:modelValue":A[4]||(A[4]=B=>c.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),i.createElementVNode("div",Qu,[i.createVNode(C,{type:"primary",onClick:p,loading:h.value},{default:i.withCtx(()=>A[9]||(A[9]=[i.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(i.openBlock(),i.createBlock(C,{key:0,danger:"",onClick:d,loading:h.value},{default:i.withCtx(()=>A[10]||(A[10]=[i.createTextVNode("发布")])),_:1},8,["loading"])):i.createCommentVNode("",!0),i.createVNode(C,{onClick:f},{default:i.withCtx(()=>A[11]||(A[11]=[i.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Yu={UnioneEditor:ut,locales:ln,loadConfig:Fe,DataStorage:on,Convertor:Ge,install(a,e){Y.loadConfig(e);const t=Fe(e);t.axios&&Y.axios.create(t.axios),a.component("UnioneBtn",Va),a.component("UnioneTabs",Ea),a.component("UnioneSection",Da),a.component("UnioneQuery",Vl),a.component("UnioneTable",Rl),a.component("UnioneRichText",zc),a.component("UnioneFormItem",er),a.component("UnioneForm",Ga),a.component("UnioneSelectBox",tr),a.component("UnioneSwitchBox",ir),a.component("UnioneRadioBox",nr),a.component("UnioneCheckBox",lr),a.component("UnionePwdBox",or),a.component("UnioneRandomInput",ar),a.component("UnionePageEditor",Tl),a.component("UnionePageForm",Il),a.component("UnionePageTree",Fl),a.component("UnionePageList",Dl)}};Z.Convertor=Ge,Z.DataStorage=on,Z.UnioneDataDefineEdit=Wu,Z.UnioneDataDefineList=Rd,Z.UnioneEditor=ut,Z.UnionePage=qt,Z.UnionePageEditor=Tl,Z.UnionePageForm=Il,Z.UnionePageList=Dl,Z.UnionePageSetting=Qt,Z.UnionePageTree=Fl,Z.UnioneQueryForm=Vl,Z.UnioneTableList=Rl,Z.default=Yu,Z.loadConfig=Fe,Z.locales=ln,Z.useDebounce=pt,Z.utils=sr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
26
+ `),r.value.filter.filter=r.value.filter.filter+h.join("")}return(h,f)=>{const d=i.resolveComponent("a-button"),p=i.resolveComponent("a-card"),m=i.resolveComponent("PlusOutlined"),b=i.resolveComponent("a-empty"),y=i.resolveComponent("a-input"),A=i.resolveComponent("a-form-item"),x=i.resolveComponent("a-textarea"),w=i.resolveComponent("a-tag"),R=i.resolveComponent("a-form"),k=i.resolveComponent("a-modal");return i.openBlock(),i.createElementBlock("div",$u,[(t.value.length,i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.value,(u,N)=>(i.openBlock(),i.createBlock(p,{class:"filter-box",size:"small",key:N},{default:i.withCtx(()=>[i.createElementVNode("div",Lu,"过滤标题:"+i.toDisplayString(u.title),1),i.createElementVNode("div",Uu,"过滤名称:"+i.toDisplayString(u.name),1),i.createElementVNode("div",zu,[i.createVNode(d,{size:"small",onClick:M=>l(u)},{default:i.withCtx(()=>f[4]||(f[4]=[i.createTextVNode("编辑")])),_:2},1032,["onClick"]),i.createVNode(d,{danger:"",size:"small",onClick:M=>o(N)},{default:i.withCtx(()=>f[5]||(f[5]=[i.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),i.createVNode(p,{class:"filter-box btn-add",size:"small",onClick:n},{default:i.withCtx(()=>[i.createVNode(m,{class:"btn"})]),_:1})],64)),i.createVNode(k,{visible:r.value.visible,"onUpdate:visible":f[3]||(f[3]=u=>r.value.visible=u),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:i.withCtx(()=>[i.createVNode(R,{ref_key:"filterForm",ref:s,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:i.withCtx(()=>[i.createVNode(A,{label:"过滤标题",name:"title"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.title,"onUpdate:value":f[0]||(f[0]=u=>r.value.filter.title=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤名称",name:"name"},{default:i.withCtx(()=>[i.createVNode(y,{value:r.value.filter.name,"onUpdate:value":f[1]||(f[1]=u=>r.value.filter.name=u)},null,8,["value"])]),_:1}),i.createVNode(A,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:i.withCtx(()=>[i.createVNode(x,{value:r.value.filter.filter,"onUpdate:value":f[2]||(f[2]=u=>r.value.filter.filter=u),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),i.createVNode(w,{class:"btn-tmpl",color:"blue",onClick:c},{default:i.withCtx(()=>f[6]||(f[6]=[i.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),qu={class:"unione-page form-page data-define-edit"},Qu={class:"actions"},Wu=ee(i.defineComponent({__name:"edit",setup(a){const e=Y.useDialog(),t=i.inject("route"),n=i.inject("router"),l=i.ref(),o=i.ref({isPrimary:!1,fields:[{title:"数据类型",name:"category",control:"unione-select-box",value:"sql",convert:{types:"dict",dictName:"DATACATEGORY"}},{title:"数据源",name:"dsId",control:"unione-select-box",convert:{types:"local",url:"/api/data/source/find",search:!0},props:{required:!0}},{title:"自定义",name:"isCustom",control:"unione-switch-box",value:0,convert:{types:"dict",dictName:"TUREORFALSE"}},{title:"数据标题",name:"title",dataLen:10,props:{required:!0}},{title:"数据名称",name:"name",props:{required:!0},rules:{whitespace:!0}},{title:"数据编码",name:"sn",dataLen:50},{title:"描述",name:"descs",control:"a-textarea",view:{width:3}}],setting:{showColumn:2,labelWidth:6}}),s=i.ref(),r=i.ref({isPrimary:!1,fields:[{title:"列表模版",name:"listTmpl",control:"unione-select-box",value:"normal",convert:{types:"option",options:[{value:"normal",label:"标准"}]},props:{required:!0}},{title:"表单风格",name:"showColumn",control:"unione-select-box",value:2,convert:{types:"option",options:[{value:1,label:"一列"},{value:2,label:"二列"},{value:3,label:"三列"}]},props:{required:!0}},{title:"标题宽度",name:"labelWidth",control:"a-input-number",value:9,rule:{rangeMin:1,rangeMax:24},props:{required:!0}}],setting:{showColumn:2,labelWidth:6}}),c=i.ref({configs:{fields:[],filters:[]}}),h=i.ref(!1);function f(){n.back()}function d(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{mt.release([c.value.id]).then(y=>{y.success?(e.success({title:"发布成功",content:y.body}),b(c.value.id)):e.error({title:"发布失败",content:y.body})})}})}async function p(){const y=await l.value.validate(),A={...c.value,...y};A.configs.show=await s.value.getValue(),console.log("formData",A),X.message.loading({content:"提交中..."}),h.value=!0,mt.save(A).then(x=>{X.message.destroy(),x.success?(c.value=x.body,l.value.setValue(x.body),s.value.setValue(x.body.configs?.show||{}),X.message.success("保存成功!")):X.message.error(x.message)}).finally(()=>{h.value=!1})}const m=i.ref(!1);i.onMounted(()=>{t.query.id&&b(t.query.id)});function b(y){X.message.loading({content:"加载中..."}),mt.detail(y).then(A=>{A.success?(c.value=A.body,l.value.setValue(A.body),s.value.setValue(A.body.configs?.show||{}),X.message.destroy()):X.message.error(A.message)})}return(y,A)=>{const x=i.resolveComponent("unione-form"),w=i.resolveComponent("unione-section"),R=i.resolveComponent("OrderedListOutlined"),k=i.resolveComponent("a-tab-pane"),u=i.resolveComponent("ToolOutlined"),N=i.resolveComponent("ApiOutlined"),M=i.resolveComponent("FunnelPlotOutlined"),v=i.resolveComponent("a-tabs"),C=i.resolveComponent("a-button");return i.openBlock(),i.createElementBlock("div",qu,[i.createVNode(w,{title:"基础信息",type:"line"},{default:i.withCtx(()=>[i.createVNode(x,{form:o.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),i.createVNode(w,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":A[0]||(A[0]=B=>m.value=B)},{default:i.withCtx(()=>[i.createVNode(x,{form:r.value,ref_key:"pageSettingObj",ref:s},null,8,["form"])]),_:1},8,["type","location","modelValue"]),i.createVNode(v,null,{default:i.withCtx(()=>[i.createVNode(k,{key:"field-mange"},{tab:i.withCtx(()=>[i.createVNode(R),A[5]||(A[5]=i.createTextVNode("字段管理 "))]),default:i.withCtx(()=>[i.createVNode(_d,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[1]||(A[1]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-setting"},{tab:i.withCtx(()=>[i.createVNode(u),A[6]||(A[6]=i.createTextVNode("字段设置 "))]),default:i.withCtx(()=>[i.createVNode(Nu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[2]||(A[2]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"field-fkeys"},{tab:i.withCtx(()=>[i.createVNode(N),A[7]||(A[7]=i.createTextVNode("外键设置 "))]),default:i.withCtx(()=>[i.createVNode(Pu,{modelValue:c.value.configs.fields,"onUpdate:modelValue":A[3]||(A[3]=B=>c.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),i.createVNode(k,{key:"data-filter"},{tab:i.withCtx(()=>[i.createVNode(M),A[8]||(A[8]=i.createTextVNode("数据过滤 "))]),default:i.withCtx(()=>[i.createVNode(ju,{modelValue:c.value.configs.filters,"onUpdate:modelValue":A[4]||(A[4]=B=>c.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),i.createElementVNode("div",Qu,[i.createVNode(C,{type:"primary",onClick:p,loading:h.value},{default:i.withCtx(()=>A[9]||(A[9]=[i.createTextVNode("保存")])),_:1},8,["loading"]),c.value.id?(i.openBlock(),i.createBlock(C,{key:0,danger:"",onClick:d,loading:h.value},{default:i.withCtx(()=>A[10]||(A[10]=[i.createTextVNode("发布")])),_:1},8,["loading"])):i.createCommentVNode("",!0),i.createVNode(C,{onClick:f},{default:i.withCtx(()=>A[11]||(A[11]=[i.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),Yu={UnioneEditor:ut,locales:ln,loadConfig:Fe,DataStorage:on,Convertor:Ge,install(a,e){Y.loadConfig(e);const t=Fe(e);t.axios&&Y.axios.create(t.axios),a.component("UnioneBtn",Va),a.component("UnioneTabs",Ea),a.component("UnioneSection",Da),a.component("UnioneQuery",Vl),a.component("UnioneTable",Rl),a.component("UnioneRichText",zc),a.component("UnioneFormItem",er),a.component("UnioneForm",Ga),a.component("UnioneSelectBox",tr),a.component("UnioneSwitchBox",ir),a.component("UnioneRadioBox",nr),a.component("UnioneCheckBox",lr),a.component("UnionePwdBox",or),a.component("UnioneRandomInput",ar),a.component("UnionePageEditor",Tl),a.component("UnionePageForm",Il),a.component("UnionePageTree",Fl),a.component("UnionePageList",Dl)}};Z.Convertor=Ge,Z.DataStorage=on,Z.UnioneDataDefineEdit=Wu,Z.UnioneDataDefineList=Rd,Z.UnioneEditor=ut,Z.UnionePage=qt,Z.UnionePageEditor=Tl,Z.UnionePageForm=Il,Z.UnionePageList=Dl,Z.UnionePageSetting=Qt,Z.UnionePageTree=Fl,Z.UnioneQueryForm=Vl,Z.UnioneTableList=Rl,Z.default=Yu,Z.loadConfig=Fe,Z.locales=ln,Z.useDebounce=pt,Z.utils=sr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});