unione-form-vue 0.0.8 → 0.0.9

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,13 +1,13 @@
1
- (function(Z,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("unione-base-vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","vue","unione-base-vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],n):(Z=typeof globalThis<"u"?globalThis:Z||self,n(Z.index={},Z.Vue,Z.UnioneBaseVue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.iconsVue,Z.uuid))})(this,function(Z,n,H,G,ia,Rt,na,We,la){"use strict";const sa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(sa);function Ae(o){return o&&(Ji.value=H.utils.obj.ext(Ji.value,o)),Ji.value}const oa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},aa={...{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"}},ra=n.ref([oa,aa]);function da(o,e){return H.locales.loadLanguage(o,()=>new Promise((t,i)=>{const l=ra.value.filter(s=>s.localeName==o);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const a={...s,localeName:o};t(a)}else{const a={...l[0],...s};t(a)}});else if(l.length==0){const s={...e,localeName:o};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+o)}))}const Zi={...H.locales};Zi.loadLanguage=da;class ca{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.ref({}),this.$model=t}params(e){return 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))),this.$params.value}psn(e){return e&&(this.$psn.value=e),this.$psn.value}regRef(e,t){}setRefData(e,t,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new ha(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),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 ha{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){this.$dsn=e,this.$type=t,this.$data=n.ref(t=="form"?{}:[]),this.$dialog=H.useDialog(),this.$model=i,this.$store={controller:"/api/data/storage/v1"}}$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(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}find(e){const t=this.$store.controller+"/find";return this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e.body=this.$processParams(e.body,this.$store.findParams),new Promise((i,l)=>{const s=G.message.loading("数据加载中...");H.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a.body,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+"/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((i,l)=>{const s=G.message.loading("数据提交中...");H.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),a.silence,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";H.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:a})}).finally(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/detail";H.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body),t(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:a})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=G.message.loading("数据处理中..."),s=this.$store.controller+"/delete";H.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:a})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(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 wt{define;ebus;model;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ca(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=H.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.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}H.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,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 i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),H.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(G.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),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 i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}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:"+ia.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function a(){t("saving"),l.value=!1}return(r,d)=>{const c=n.resolveComponent("SettingOutlined"),h=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(h,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(c,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=u=>l.value=u),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),ee=(o,e)=>{const t=o.__vccOpts||o;for(const[i,l]of e)t[i]=l;return t},rt=ee(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],di=ee(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(o,{expose:e}){const t=o,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{l.value.selectedRowKeys=g}}),s={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let p in g){const S=k.value.form.action.params[p];S&&a.value[p]&&Object.keys(a.value[p]).forEach(_=>{S[_]=a.value[p][_]})}a.value={}}function d(g,p,S){r();const _={};_[S]=p[S]||"",S=="showIndex"&&(_[S]=p.show?.query?.index),a.value[g]=_}function c(g,p,S){if(!p||!S){a.value={};return}const _=a.value[g][S];p[S]=_,a.value={}}function h(){k.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const u=n.ref(""),m=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(g,p)=>u.value!=p&&t.preset.includes(p)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),y=n.ref([na.javascript()]),k=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),x=n.ref();function w(g,p,S={}){g=JSON.parse(JSON.stringify(g)),g.event||(g.event={}),g.props||(g.props={}),g.action||(g.action={}),Object.keys(g.action).includes("maskClosable")||(g.action.maskClosable=!0),g.action.params||(g.action.params=[]),u.value=g.name,k.value.form=g,k.value.helps=S,k.value.visible=!0,x.value=p}const v=n.ref(null);function O(){v.value&&v.value.validate().then(()=>{k.value.visible=!1,x.value(k.value.form)})}return e({open:w,close}),(g,p)=>{const S=n.resolveComponent("a-input"),_=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),b=n.resolveComponent("a-input-number"),B=n.resolveComponent("a-checkbox"),A=n.resolveComponent("a-tab-pane"),V=n.resolveComponent("a-switch"),F=n.resolveComponent("a-button"),E=n.resolveComponent("a-divider"),M=n.resolveComponent("ToolOutlined"),P=n.resolveComponent("a-tooltip"),T=n.resolveComponent("a-table"),D=n.resolveComponent("a-tabs"),W=n.resolveComponent("a-form"),R=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock(R,{visible:k.value.visible,"onUpdate:visible":p[23]||(p[23]=N=>k.value.visible=N),title:k.value.title,centered:"",width:"50%",onOk:O},{default:n.withCtx(()=>[n.createVNode(W,{name:"basic",ref_key:"form",ref:v,rules:m.value,model:k.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(D,null,{default:n.withCtx(()=>[n.createVNode(A,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.title,"onUpdate:value":p[0]||(p[0]=N=>k.value.form.title=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.name,"onUpdate:value":p[1]||(p[1]=N=>k.value.form.name=N),disabled:t.preset.includes(k.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(_,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.icon,"onUpdate:value":p[2]||(p[2]=N=>k.value.form.icon=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.type,"onUpdate:value":p[3]||(p[3]=N=>k.value.form.type=N),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.index,"onUpdate:value":p[4]||(p[4]=N=>k.value.form.index=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.size,"onUpdate:value":p[5]||(p[5]=N=>k.value.form.size=N),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(B,{checked:k.value.form.props.block,"onUpdate:checked":p[6]||(p[6]=N=>k.value.form.props.block=N)},{default:n.withCtx(()=>p[24]||(p[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.danger,"onUpdate:checked":p[7]||(p[7]=N=>k.value.form.props.danger=N)},{default:n.withCtx(()=>p[25]||(p[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.ghost,"onUpdate:checked":p[8]||(p[8]=N=>k.value.form.props.ghost=N)},{default:n.withCtx(()=>p[26]||(p[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(A,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.type,"onUpdate:value":p[9]||(p[9]=N=>k.value.form.action.type=N),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.psn,"onUpdate:value":p[10]||(p[10]=N=>k.value.form.action.psn=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.component,"onUpdate:value":p[11]||(p[11]=N=>k.value.form.action.component=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(_,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.href,"onUpdate:value":p[12]||(p[12]=N=>k.value.form.action.href=N)},null,8,["value"])]),_:1}),["link","route"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.target,"onUpdate:value":p[13]||(p[13]=N=>k.value.form.action.target=N),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.position,"onUpdate:value":p[14]||(p[14]=N=>k.value.form.action.position=N),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.title,"onUpdate:value":p[15]||(p[15]=N=>k.value.form.action.title=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(V,{checked:k.value.form.action.maskClosable,"onUpdate:checked":p[16]||(p[16]=N=>k.value.form.action.maskClosable=N),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.action.width,"onUpdate:value":p[17]||(p[17]=N=>k.value.form.action.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.action.height,"onUpdate:value":p[18]||(p[18]=N=>k.value.form.action.height=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(E,{orientation:"left"},{default:n.withCtx(()=>[p[29]||(p[29]=n.createTextVNode("参数列表 ")),n.createVNode(F,{size:"small",class:"param-btn",onClick:h},{default:n.withCtx(()=>p[27]||(p[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(F,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>p[28]||(p[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(T,{columns:i.value,"data-source":k.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:N})=>[["name","title"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(M),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),["value"].includes(N.key)?(n.openBlock(),n.createBlock(P,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(M),n.createTextVNode(" "+n.toDisplayString(N.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:K,record:I,index:z})=>[["name","title","value"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[z]||!Object.keys(a.value[z]).includes(N.dataIndex))&&!K&&"empty"]),onClick:he=>d(z,I,N.dataIndex)},[a.value[z]&&Object.keys(a.value[z]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(S,{key:0,value:a.value[z][N.dataIndex],"onUpdate:value":he=>a.value[z][N.dataIndex]=he,onBlur:he=>c(z,I,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(K),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(A,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"点击事件",help:k.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.clickScript,"onUpdate:modelValue":p[19]||(p[19]=N=>k.value.form.event.clickScript=N),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"禁用逻辑",help:k.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.disableScript,"onUpdate:modelValue":p[20]||(p[20]=N=>k.value.form.event.disableScript=N),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"显示逻辑",help:k.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.visibleScript,"onUpdate:modelValue":p[21]||(p[21]=N=>k.value.form.event.visibleScript=N),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"动态标题",help:k.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.titleScript,"onUpdate:modelValue":p[22]||(p[22]=N=>k.value.form.event.titleScript=N),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=ee(n.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(o,{emit:e}){const t=Ae(),i=o,l=H.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const s=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title))}const r=n.computed(()=>s.value.title?s.value.title(u.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(u.value,i.widget)!=!1:!0),c=n.computed(()=>i.disabled?!0:s.value.disable?s.value.disable(u.value,i.widget):!1),h=n.ref(null);function f(){h.value?.open(i.widget,O=>{console.log("btn props",O),Object.keys(O).forEach(g=>{i.widget[g]=O[g]}),console.log("props btn",i.widget)})}const u=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),m=n.ref({open:!1}),y=n.computed(()=>{if(i.widget.action?.href){let O=i.widget.action.href;const g=O.matchAll("{[a-zA-Z.]*}"),p=[];let S=null;for(;S=g.next();){if(S&&S.value&&S.value[0]){let _=S.value[0].substring(1,S.value[0].length-1);p.includes(_)||p.push(_)}if(S.done)break}if(p.length>0)for(let _=0;_<p.length;_++){let C=p[_],b=H.utils.obj.getValue(u.value,C);b?b instanceof Object?O=O.replaceAll("{"+C+"}",JSON.stringify(b)):Array.isArray(b)?O=O.replaceAll("{"+C+"}",b.join(",")):O=O.replaceAll("{"+C+"}",b):O=O.replaceAll("{"+C+"}","")}return O}return""}),k=n.computed(()=>{const O={};if(i.widget.action?.href){let g=i.widget.action.href;const p=g.matchAll("{[a-zA-Z0-9.]*}"),S=[];let _=null;for(;_=p.next();){if(_&&_.value&&_.value[0]){let b=_.value[0].substring(1,_.value[0].length-1);S.includes(b)||S.push(b)}if(_.done)break}if(S.length>0)for(let b=0;b<S.length;b++){let B=S[b],A=H.utils.obj.getValue(u.value,B);A?A instanceof Object?g=g.replaceAll("{"+B+"}",JSON.stringify(A)):Array.isArray(A)?g=g.replaceAll("{"+B+"}",A.join(",")):g=g.replaceAll("{"+B+"}",A):g=g.replaceAll("{"+B+"}","")}const C=g.split("?")[1];C&&C.split("&").forEach(b=>{const B=b.split("=");B[0]&&B[1]&&(O[B[0]]=B[1])})}return i.widget.action?.params&&i.widget.action.params.filter(g=>g.value+"").forEach(g=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(g.value)){let S=H.utils.obj.getValue(u.value,g.value);O[g.name]=S}else O[g.name]=g.value}),O}),x=e,w=n.inject("router");function v(O){t.isDebug&&console.log("unione btn click",i.widget,O),!(s.value.click&&s.value.click(u.value,i.widget,O)==!1)&&(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog"?m.value.open=!0:i.widget.action?.type=="route"&&i.widget.action?.href&&w.push({path:i.widget.action.href,query:k.value}),x("click",{btn:i.widget,event:O}))}return(O,g)=>{const p=n.resolveComponent("a-button"),S=n.resolveComponent("a-drawer"),_=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(p,n.mergeProps({disabled:c.value,size:o.widget.size||"small",type:o.type||o.widget.type,shape:o.widget.shape,class:"unione-btn-"+o.widget.name,loading:o.widget.loading,target:o.widget.action?.target,title:o.widget.tooltip,onClick:v},o.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[o.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"]),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(S,{key:0,open:m.value.open,"onUpdate:open":g[0]||(g[0]=C=>m.value.open=C),title:o.widget.action?.title,placement:o.widget.action?.position,maskClosable:o.widget.action?.maskClosable,width:o.widget.action?.width,bodyStyle:{padding:0,overflow:!o.widget.action.component||o.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:y.value},null,8,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(_,{key:1,open:m.value.open,"onUpdate:open":g[1]||(g[1]=C=>m.value.open=C),title:o.widget.action?.title,width:o.widget.action?.width,maskClosable:o.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:y.value,style:n.normalizeStyle({height:o.widget.action?.height?o.widget.action?.height+"px":""})},null,12,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(di,{ref_key:"btnSetting",ref:h,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-42bd8785"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=ee(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(o){const e=o,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,s)=>{const a=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,c)=>(n.openBlock(),n.createBlock(a,{key:c,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(h,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=ee(n.defineComponent({__name:"section",props:n.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(o){const e=o,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,c)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",a.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",o.location,o.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=ee(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+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"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(b=>({value:b.sn,label:b.title+"("+b.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,b=C.map(B=>B.name);if(!b.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(B.index,0,B)}if(!b.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let A=B.index||1;C.splice(A,0,B)}if(!b.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(B.index,0,B)}if(!b.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(B.index,0,B)}return C}),a=n.ref(null);function r(C){a.value&&a.value.open(C,b=>{b.visible=!0,Object.keys(b).forEach(B=>{C[B]=b[B]}),i.value.configs.settings.btns.sort((B,A)=>{const V=B.index||1,F=A.index||1;return V-F}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let b={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};b.name="new_"+i.value.configs.settings.btns.length;const B=i.value.configs.settings.btns.filter(A=>A.name==b.name).length;B>0&&(b.name=b.name+B),i.value.configs.settings.btns.push(b),e.editor.widget(e.wid,i.value),a.value.open(b,A=>{Object.keys(A).forEach(V=>{b[V]=A[V]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(C){const b=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const B=[];i.value.configs.settings.btns.forEach(A=>{A.name!=C.name&&B.push(A)}),i.value.configs.settings.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{b()}})}const h=n.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:C=>{const b=h.value.widgets.filter(B=>B.value==C);return b[0]?b[0].label:C},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let b="";return C.rules&&(b=C.rules.filter(B=>B.enable).length||""),b&&(b="("+b+")"),b},toSetting:()=>{const C=f.value.props,b={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(b.min=C.rangeMin,b.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(b.max=C.rangeMax,b.enable=!0);const B={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(B.pattern=C.regExpress,B.enable=!0),f.value.field.rules=[b,B],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function u(C){f.value.visible=!0,f.value.field=C;const b=C.rules||[],B={trigger:"change",whitespace:!0};b.forEach(A=>{A.name=="reg"&&(B.trigger=A.trigger,B.whitespace=A.whitespace,B.regExpress=A.pattern,B.regMessage=A.message),A.name=="range"&&(B.rangeMin=A.min,B.rangeMax=A.max,B.rangeMessage=A.message)}),f.value.props=B}const m=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{m.value.visible=!1}});function y(C,b){const B=v.value.filter(V=>V.name==C.name);B.forEach(V=>{b!="isSort"?V[b]=!0:V[b]=!V[b]});const A=B[0];if(!(!A||b=="isSort")){switch(m.value.prop=b,m.value.field=C,A.show||(A.show={}),b){case"isQuery":A.show.query||(A.show.query={}),m.value.show=A.show.query,m.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":A.show.form||(A.show.form={}),m.value.show=A.show.form,m.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":A.show.view||(A.show.view={}),m.value.show=A.show.view,m.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":A.show.list||(A.show.list={}),m.value.show=A.show.list,m.value.title=`列头设置/${C.title}(${C.name})`;break}m.value.visible=!0}}const k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(C,b)=>{k.value.convert.options.splice(C,1)},toSetting:()=>{k.value.visible=!1}});function x(C){k.value.visible=!0,k.value.field=C,k.value.convert=C.convert||{}}const w=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),v=n.computed(()=>w.value.fields?.length?w.value.fields:[]),O={mounted:C=>C.focus()},g=n.ref({});function p(C,b){const B={};b=="convertName"?B[b]=C.convert?.type:B[b]=C[b]||"",g.value={},g.value[C.name]=B}function S(C,b){{g.value={};return}}function _(C,b){v.value.filter(A=>A.name==C.name).forEach(A=>{A[b]=!A[b]})}return(C,b)=>{const B=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),E=n.resolveComponent("a-select"),M=n.resolveComponent("ToolOutlined"),P=n.resolveComponent("a-checkbox"),T=n.resolveComponent("a-table"),D=n.resolveComponent("a-select-option"),W=n.resolveComponent("a-form-item"),R=n.resolveComponent("a-form"),N=n.resolveComponent("a-modal"),K=n.resolveComponent("a-checkbox-group"),I=n.resolveComponent("a-input-number"),z=n.resolveComponent("a-input"),he=n.resolveComponent("a-col"),Xi=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[23]||(b[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,L=>(n.openBlock(),n.createBlock(V,n.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:Ue=>r(L)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(L.title)+" ",1),L.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>c(L),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:b[0]||(b[0]=L=>d())},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[24]||(b[24]=[n.createTextVNode("表单设置")])),_:1}),b[36]||(b[36]=n.createTextVNode(" 数据模型:")),n.createVNode(E,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":b[1]||(b[1]=L=>i.value.dataModel=L)},null,8,["options","value"]),n.createVNode(T,{columns:t.value,"data-source":v.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(M),n.createTextVNode(" "+n.toDisplayString(L.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:L,text:Ue,record:ie})=>[["rules"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(ie)&&"empty"]),onClick:xe=>u(ie)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(ie)),1),f.value.showInfo(ie)?(n.openBlock(),n.createBlock(V,{key:0,type:"link"},{default:n.withCtx(()=>b[25]||(b[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[ie.name]||!Object.keys(g.value[ie.name]).includes(L.dataIndex))&&!Ue&&"empty"]),onClick:xe=>p(ie,L.dataIndex)},[g.value[ie.name]&&Object.keys(g.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(E,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:h.value.widgets,onBlur:b[2]||(b[2]=xe=>S())},null,8,["value","onUpdate:value","options"])),[[O]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(h.value.widgetName(Ue)),1))],10,Ea)):["convertName"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[ie.name]||!Object.keys(g.value[ie.name]).includes(L.dataIndex))&&!ie.convert?.type&&"empty"]),onClick:xe=>p(ie,L.dataIndex)},[g.value[ie.name]&&Object.keys(g.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(E,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:b[3]||(b[3]=xe=>S())},null,8,["value","onUpdate:value"])),[[O]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ie.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ie.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ie.convert?.type?(n.openBlock(),n.createBlock(V,{key:1,type:"link",onClick:n.withModifiers(xe=>x(ie),["stop"])},{default:n.withCtx(()=>b[26]||(b[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(P,{checked:ie[L.dataIndex],onClick:xe=>_(ie,L.dataIndex)},null,8,["checked","onClick"]),n.createVNode(V,{type:"link",onClick:xe=>y(ie,L.dataIndex)},{default:n.withCtx(()=>b[27]||(b[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(N,{visible:h.value.visible,"onUpdate:visible":b[5]||(b[5]=L=>h.value.visible=L),title:"控件设置",onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[h.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(W,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(E,{value:h.value.props.mode,"onUpdate:value":b[4]||(b[4]=L=>h.value.props.mode=L),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(D,{value:"multiple"},{default:n.withCtx(()=>b[28]||(b[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(D,{value:"tags"},{default:n.withCtx(()=>b[29]||(b[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:f.value.visible,"onUpdate:visible":b[13]||(b[13]=L=>f.value.visible=L),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[30]||(b[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(W,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(K,{value:f.value.props.trigger,"onUpdate:value":b[6]||(b[6]=L=>f.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(W,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(P,{value:f.value.props.whitespace,"onUpdate:value":b[7]||(b[7]=L=>f.value.props.whitespace=L),checked:f.value.props.whitespace},{default:n.withCtx(()=>b[31]||(b[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[32]||(b[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(W,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(I,{value:f.value.props.rangeMin,"onUpdate:value":b[8]||(b[8]=L=>f.value.props.rangeMin=L)},null,8,["value"]),b[33]||(b[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(I,{value:f.value.props.rangeMax,"onUpdate:value":b[9]||(b[9]=L=>f.value.props.rangeMax=L)},null,8,["value"])]),_:1}),n.createVNode(W,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(z,{value:f.value.props.rangeMessage,"onUpdate:value":b[10]||(b[10]=L=>f.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[34]||(b[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(W,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(z,{value:f.value.props.regExpress,"onUpdate:value":b[11]||(b[11]=L=>f.value.props.regExpress=L)},null,8,["value"])]),_:1}),n.createVNode(W,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(z,{value:f.value.props.regMessage,"onUpdate:value":b[12]||(b[12]=L=>f.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:m.value.visible,"onUpdate:visible":b[20]||(b[20]=L=>m.value.visible=L),title:m.value.title,onOk:m.value.toSetting},{default:n.withCtx(()=>[n.createVNode(R,{model:m.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(W,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(I,{value:m.value.show.index,"onUpdate:value":b[14]||(b[14]=L=>m.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(m.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(W,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(z,{value:m.value.show.width,"onUpdate:value":b[15]||(b[15]=L=>m.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(W,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(z,{value:m.value.show.labelWidth,"onUpdate:value":b[16]||(b[16]=L=>m.value.show.labelWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(m.value.prop)?(n.openBlock(),n.createBlock(W,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(z,{value:m.value.show.valueWidth,"onUpdate:value":b[17]||(b[17]=L=>m.value.show.valueWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(W,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(E,{value:m.value.show.fixed,"onUpdate:value":b[18]||(b[18]=L=>m.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(m.value.prop)?(n.openBlock(),n.createBlock(W,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(E,{value:m.value.show.align,"onUpdate:value":b[19]||(b[19]=L=>m.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(N,{visible:k.value.visible,"onUpdate:visible":b[22]||(b[22]=L=>k.value.visible=L),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(V,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>b[35]||(b[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(T,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:L,record:Ue,index:ie})=>[L.dataIndex==="label"?(n.openBlock(),n.createBlock(z,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="value"?(n.openBlock(),n.createBlock(z,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>k.value.toDelOption(ie,Ue)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(R,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Xi,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(he,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(W,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(z,{value:k.value.convert.dict,"onUpdate:value":b[21]||(b[21]=L=>k.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(di,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=ee(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(o,{expose:e}){const t=o,i=n.ref(!1),l=n.ref(),s=n.ref({}),a=n.ref(null);n.onMounted(()=>{if(t.editor&&r.value.dsn){const x=t.editor.dataManager();r.value.primary&&x.psn(r.value.dsn),a.value.setDisabled=k,a.value.getValue=f,a.value.setValue=u,a.value.reset=m,l.value=x.useForm(r.value.dsn,a.value,w=>{s.value=w.body||{}})}});const r=n.computed(()=>t.widget||t.form||{}),d=n.computed(()=>{let x=r.value.widgets||[];return!x.length&&t.form?.fields&&(x=t.form.fields),x.forEach(w=>{w.widget||(w.widget="unione-form-item"),w.control||(w.control="a-input")}),x}),c=n.inject("pageSetting"),h=n.computed(()=>r.value.setting||c?.form||{});n.provide("formSetting",h.value);function f(){return s.value}function u(x){s.value=x}function m(){s.value={};const x=w=>{w.widget=="unione-form-item"&&w.name&&w.value!=null&&w.value!=null&&w.value!=""&&(s.value[w.name]=w.value),w.widgets?.forEach(v=>{x(v)})};d.value.forEach(w=>{x(w)})}function y(){return a.value.validate()}function k(x=!0){i.value=x}return e({validate:y,getValue:f,setValue:u,reset:m,setDisabled:k}),(x,w)=>{const v=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:o.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(v,{ref_key:"formObj",ref:a,model:s.value,class:n.normalizeClass(["unione-form",o.editor?.model.value,"form-layout-col-"+(h.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(O,g)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(O.widget),{key:g,widget:O,editor:o.editor,value:s.value[O.name],"onUpdate:value":p=>s.value[O.name]=p,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&r.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:r.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-540f619c"]]);function kl(o,e=!1){const t=Ae();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+o+",force:"+e),!o)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+o);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((l,s)=>{H.axios.admin({url:"/api/system/dict/load/"+o}).then(a=>{if(a.success){const r=a.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+o,JSON.stringify(r)),l(r)):s("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),s("字典加载失败,dict:"+o+",error:"+a.message)})})}async function bl(o,e){const t=Ae();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+o+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await kl(o),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function za(o,e){const t=await bl(o,e);return Promise.resolve(t.dictValue)}const yl={load:kl,getLabel:za,getOption:bl};class dt{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=Ae()}load(e,t=!1){return this.config.isDebug&&console.log("进入:加载转换选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e+",force:"+t),!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}yl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(a=>{a.value=parseInt(a.value)}),i(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((i,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;H.axios.admin({url:a,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(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(c=>c.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField]=e,H.axios.admin({url:a,data:s,method:"POST"}).then(c=>{if(c.success){const h={};this.options.forEach(f=>{h[e]=!0}),c.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(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(this.config.isDebug&&console.log("进入:数据转换:value->label方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?yl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.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(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(a=>a.value==e);if(s.length)return t(s[0].label);i()})})}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((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;H.axios.admin({url:s,data:e,method:"POST"}).then(a=>{a.success?(this.$processOptions(a.body),this.options=[...this.options,...a.body],i(a.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,a),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+a.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){return this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.resolve(this.options.filter(t=>t.label.indexOf(e)>=0)):new Promise(t=>{const i=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;H.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$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],t.label=t[this.convertObj.labelField]}),e}}const qa={key:1,class:"text-view"},Ua=ee(n.defineComponent({__name:"formItem",props:n.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(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.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 l=n.ref({}),s=n.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&&(l.value[w]=null,typeof v=="function"?l.value[w]=v:v.enable&&v.scriptText&&(l.value[w]=new Function("value","ctx",v.scriptText)))}),x}),a=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),c=n.ref({}),h=n.computed(()=>{const x=[],w=s.value.rule||{};if(s.value.props?.required&&x.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||i.ruleTrigger||"change",validator:(v,O)=>(w?.whitespace&&O&&typeof O=="string"&&(O=O.trim()),O&&(O+"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),w.advance&&c.value[w.advance]){const v=c.value[w.advance];x.push({pattern:v.pattern,message:v.message||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"})}return w.regExpress&&x.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&x.push({validator:(v,O)=>O&&(O+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(O+"").length+"]"):Promise.resolve(),trigger:w?.trigger||i.ruleTrigger||"change"}),x}),f=n.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),x}),u=n.computed(()=>{const x=s.value.css||{},w=[];return x.cssName&&w.push(x.cssName),i.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}),m=n.computed(()=>{const x=i.showColumn||3;let w=s.value.view?.labelWidth||i.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=n.computed(()=>{const x=i.showColumn||3;let w=s.value.view?.valueWidth||i.valueWidth||15;return s.value.css?.cssName&&x>1&&u.value.includes("all-line")?{}:{span:w}}),k=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new dt(s.value.convert).convert(t.value.toString()).then(x=>{k.value=x})}),(x,w)=>{const v=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",u.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(v,{key:0,label:r.value,name:s.value.name,labelCol:m.value,wrapperCol:y.value,required:s.value.props?.required,rules:h.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:o.disabled,onChange:d.value,value:t.value,"onUpdate:value":w[0]||(w[0]=O=>t.value=O)},f.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",qa,n.toDisplayString(k.value?k.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-8941ba2b"]]);function wl(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Wa=ee(n.defineComponent({__name:"selectBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){Ae();const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=wl(h=>{c.value.search(h).then(f=>{i.value=f})},500);n.onMounted(()=>{c.value.load(t.value).then(h=>{i.value=h})});const r=n.ref({}),d=n.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const u=h.event[f];r.value[f]=null,u.enable&&u.scriptText&&(r.value[f]=new Function("value","ctx",u.scriptText))}),h}),c=n.computed(()=>{const h=d.value.convert||e.convert||{};return new dt(h)});return n.watch(t,()=>{t.value&&c.value.load(t.value).then(h=>{i.value=h})}),n.watch(()=>d.value.convert||e.convert||{},()=>{c.value.load().then(h=>{i.value=h})}),(h,f)=>{const u=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(u,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":f[0]||(f[0]=m=>t.value=m),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ha=ee(n.defineComponent({__name:"switchBox",props:n.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref({});n.onMounted(()=>{a.value?.load(t.value).then(r=>{r.forEach(d=>{d.value&&(d.value=="1"||d.value=="true"||d.value=="TRUE")?(i.value.checkedChildren=d.label,d.value=="true"||d.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=d.label,d.value=="false"||d.value=="FALSE"?i.value.unCheckedValue=!1:i.value.unCheckedValue=0)})})});const l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const c=r.event[d];l.value[d]=null,c.enable&&c.scriptText&&(l.value[d]=new Function("value","ctx",c.scriptText))}),r}),a=n.computed(()=>{const r=s.value.convert||e.convert;return r?new dt(r):null});return(r,d)=>{const c=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(c,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=h=>t.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ka=ee(n.defineComponent({__name:"radioBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];s.value[c]=null,h.enable&&h.scriptText&&(s.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Qa=ee(n.defineComponent({__name:"checkBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];s.value[c]=null,h.enable&&h.scriptText&&(s.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ga={class:"unione-props-setting unione-query-setting"},Ya={class:"unione-query-opts"},Xa={key:0},Ja=["onClick"],Za={key:1},er={key:1,class:"edit-field"},tr=["onClick"],ir=ee(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:O})=>O+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"}]),i=n.computed(()=>{const O=e.editor.widget(e.wid)||{};return O.configs||(O.configs={}),O.configs.btns||(O.configs.btns=[]),O}),l=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),s=n.computed(()=>{const O=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(p=>{O.push(p),g.push(p.name)}),g.includes("query")||O.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),O.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),O}),a=n.ref(null);function r(O){a.value&&a.value.open(O,g=>{g.visible=!0,Object.keys(g).forEach(p=>{O[p]=g[p]}),i.value.configs.btns.sort((p,S)=>{const _=p.index||1,C=S.index||1;return _-C}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const O=i.value.configs.btns.length+1;let g={title:"新增",name:"new_"+O,size:"default",index:O,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(g),e.editor.widget(e.wid,i.value),a.value.open(g,p=>{Object.keys(p).forEach(S=>{g[S]=p[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(O){const g=()=>{if(["query","reset","advanced"].includes(O.name))O.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const p=[];i.value.configs.btns.forEach(S=>{S.name!=O.name&&p.push(S)}),i.value.configs.btns=p}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const h=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>h.value.fields?.length?h.value.fields:[]),u={mounted:O=>O.focus()},m=n.ref({});function y(){const O=Object.keys(m.value);if(O.length)for(let g in O){const p=f.value.filter(S=>S.name==g);if(p&&p[0]){let S=m.value[g];Object.keys(S).forEach(_=>{if(_=="showIndex"){const C=p[0].show?.query||{};p[0].show||(p[0].show={}),p[0].show.query={...C,index:S[_]}}else p[0][_]=S[_]})}}m.value={}}function k(O,g){y();const p={};p[g]=O[g]||"",g=="showIndex"&&(p[g]=O.show?.query?.index),m.value[O.name]=p}function x(O,g){if(!O||!g){m.value={};return}const p=m.value[O.name][g];if(g=="showIndex"){const S=O.show?.query||{};O.show||(O.show={}),O.show.query={...S,index:p}}else O[g]=p;m.value={}}function w(O,g){f.value.filter(S=>S.name==O.name).forEach(S=>{S[g]=!S[g]})}const v=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:O=>{const g=v.value.options.filter(p=>p.value==O);return g[0]?g[0].label:O}});return(O,g)=>{const p=n.resolveComponent("a-divider"),S=n.resolveComponent("CloseOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-select"),B=n.resolveComponent("ToolOutlined"),A=n.resolveComponent("a-checkbox"),V=n.resolveComponent("a-input-number"),F=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Ga,[n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Ya,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,E=>(n.openBlock(),n.createBlock(_,n.mergeProps({key:E.name,class:["btn",E.name,!E.visible&&"deleted"],type:E.visible?E.type:"default",size:E.size||"default",ref_for:!0},E.props||{},{onClick:M=>r(E)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(E.title)+" ",1),E.visible?(n.openBlock(),n.createBlock(S,{key:0,class:"btn-del",onClick:n.withModifiers(M=>c(E),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[E.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(E.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(_,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=E=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(p,{orientation:"left"},{default:n.withCtx(()=>g[4]||(g[4]=[n.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=n.createTextVNode(" 数据模型:")),n.createVNode(b,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=E=>i.value.dataModel=E)},null,8,["options","value"]),n.createVNode(F,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:E})=>[["showIndex","queryType"].includes(E.key)?(n.openBlock(),n.createElementBlock("span",Xa,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(E.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:E,text:M,record:P})=>[["queryType"].includes(E.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!m.value[P.name]||!Object.keys(m.value[P.name]).includes(E.dataIndex))&&!M&&"empty"]),onClick:T=>k(P,E.dataIndex)},[m.value[P.name]&&Object.keys(m.value[P.name]).includes(E.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(b,{key:0,value:P[E.dataIndex],"onUpdate:value":T=>P[E.dataIndex]=T,allowClear:!0,options:v.value.options,onBlur:g[2]||(g[2]=T=>x())},null,8,["value","onUpdate:value","options"])),[[u]]):(n.openBlock(),n.createElementBlock("span",Za,n.toDisplayString(v.value.showLabel(M)),1))],10,Ja)):["isQuery"].includes(E.dataIndex)?(n.openBlock(),n.createElementBlock("div",er,[n.createVNode(A,{checked:P[E.dataIndex],onClick:T=>w(P,E.dataIndex)},null,8,["checked","onClick"])])):E.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!m.value[P.name]||!Object.keys(m.value[P.name]).includes(E.dataIndex))&&!M&&"empty"]),onClick:T=>k(P,E.dataIndex)},[m.value[P.name]&&Object.keys(m.value[P.name]).includes(E.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:m.value[P.name][E.dataIndex],"onUpdate:value":T=>m.value[P.name][E.dataIndex]=T,onBlur:T=>x(P,E.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[u]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(P.show?.query?.index||" "),1)],64))],10,tr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(di,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),nr={class:"query-btn"},lr={class:"btn-advanced-overlay"},xl=ee(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},emits:["query","reset","btnClick"],setup(o,{emit:e}){const t=o,i=n.computed(()=>{const k=t.editor?.widget(t.wid)||t.widget||{};return k.btns||(k.btns=[]),k}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let k=[];return i.value.fields?.length&&(k=i.value.fields),k.sort((x,w)=>{const v=x.show?.query?.index||1,O=w.show?.query?.index||1;return v-O}),k.forEach(x=>{x.widget=x.widget||"a-input",x.value!=null&&x.value!="undefined"&&typeof x.value<"u"&&(h.value[x.name]=x.value)}),k}),a=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const k=i.value.btns.filter(x=>x.name=="advanced")[0]||{};return k.event?.clickScript&&(k.event.click=new Function("ctx","btn","event",k.event.clickScript)),k.event?.disableScript&&(k.event.disable=new Function("ctx","btn",k.event.disableScript)),k.event?.visibleScript&&(k.event.visible=new Function("ctx","btn",k.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...k}}),d=["query","reset","advanced"],c=n.computed(()=>{const k=i.value.btns.filter(w=>w.name!="advanced"),x=[];return k.forEach(w=>{w.size||(w.size="default"),x.push(w.name)}),x.includes("query")||k.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||k.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),k.sort((w,v)=>{const O=w.index||1,g=v.index||1;return O-g}),k}),h=n.ref({});n.onMounted(()=>{t.editor?.ebus.$emit("table-list-search",h.value)});const f=e;function u({btn:k,event:x}){console.log("unione query form btn click",k,x),k.name=="query"&&m(),k.name=="reset"&&y(),f("btnClick",{btn:k,event:x})}function m(){const k=[];l.value.visible&&k.push(l.value.name),s.value.forEach(w=>{w.visible&&k.push(w.name)});const x={};Object.keys(h.value).forEach(w=>{k.includes(w)&&(x[w]=h.value[w])}),f("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){h.value={},s.value.forEach(k=>{k.visible=!1}),f("reset"),t.editor?.ebus.$emit("table-list-reset")}return(k,x)=>{const w=n.resolveComponent("a-input"),v=n.resolveComponent("a-form-item"),O=n.resolveComponent("unione-btn"),g=n.resolveComponent("a-checkbox"),p=n.resolveComponent("DownOutlined"),S=n.resolveComponent("a-button"),_=n.resolveComponent("a-dropdown"),C=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(C,{model:h.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(v,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(w,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":x[0]||(x[0]=b=>h.value[l.value.name]=b)},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible?(n.openBlock(),n.createBlock(v,{key:0,label:b.title,class:n.normalizeClass(["query-field",b.name]),style:n.normalizeStyle({width:a.value}),name:b.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),n.mergeProps({placeholder:b.placeholder,value:h.value[b.name],"onUpdate:value":B=>h.value[b.name]=B,ref_for:!0},b.props||{},{widget:b}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",nr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible!=!1?(n.openBlock(),n.createBlock(O,{key:0,widget:b,editor:o.editor,onClick:u,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(_,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createBlock(g,{key:b.name,class:"item",checked:b.visible,onClick:B=>b.visible=!b.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(b.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(S,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(p)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(ir,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-bf93af8d"]]),sr={class:"unione-props-setting unione-table-setting"},or={class:"unione-table-tools"},ar={key:1,class:"unione-table-opts"},rr={key:0},dr=["onClick"],cr={key:1,class:"edit-field"},hr=["onClick"],fr={key:1},ur=ee(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+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(C,b){let B=C.filter(A=>A.value==b);return B&&B[0]&&B[0].label||b}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,b){let B=C.filter(A=>A.value==b);return B&&B[0]&&B[0].label||b}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(b=>({value:b.sn,label:b.title+"("+b.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],b=i.value.configs.leftBtns;if(b.forEach(B=>{C.push(B.name)}),!C.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};b.splice(0,0,B)}if(!C.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};b.splice(1,0,B)}return b}),a=n.computed(()=>{if(!i.value)return[];const C=[],b=i.value.configs.rightBtns;if(b.forEach(B=>{C.push(B.name)}),!C.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};b.splice(0,0,B)}if(!C.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};b.splice(1,0,B)}if(!C.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};b.splice(2,0,B)}if(!C.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};b.splice(3,0,B)}return b});function r(C,b){C=="left"?h.value.open(b,B=>{B.visible=!0,Object.keys(B).forEach(A=>{b[A]=B[A]}),i.value.configs.leftBtns.sort((A,V)=>{const F=A.index||1,E=V.index||1;return F-E}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(b,B=>{B.visible=!0,Object.keys(B).forEach(A=>{b[A]=B[A]}),i.value.configs.rightBtns.sort((A,V)=>{const F=A.index||1,E=V.index||1;return F-E}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const b=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let B={title:"新增"+b,name:"new_"+b,index:b,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(B):i.value.configs.rightBtns.push(B),e.editor.widget(e.wid,i.value),r(C,B)}function c(C,b){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(b.name))b.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const A=[];i.value.configs.leftBtns.forEach(V=>{V.name!=b.name&&A.push(V)}),i.value.configs.leftBtns=A}else{const A=[];i.value.configs.rightBtns.forEach(V=>{V.name!=b.name&&A.push(V)}),i.value.configs.rightBtns=A}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const h=n.ref(null);function f(C){h.value.open(C,b=>{b.visible=!0,Object.keys(b).forEach(B=>{C[B]=b[B]}),i.value.configs.operation.btns.sort((B,A)=>{const V=B.index||1,F=A.index||1;return V-F}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(){const C=i.value.configs.operation.btns.length+1;let b={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(b),e.editor.widget(e.wid,i.value),h.value.open(b,B=>{Object.keys(B).forEach(A=>{b[A]=B[A]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function m(C){const b=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const B=[];i.value.configs.operation.btns.forEach(A=>{A.name!=C.name&&B.push(A)}),i.value.configs.operation.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{b()}})}const y=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),k=n.computed(()=>y.value.fields?.length?(y.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),y.value.fields):[]),x={mounted:C=>C.focus()},w=n.ref({});function v(){const C=Object.keys(w.value);if(C.length)for(let b in C){const B=k.value.filter(A=>A.name==b);if(B&&B[0]){let A=w.value[b];Object.keys(A).forEach(V=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),V=="showIndex"?B[0].show.list.index=A[V]:V=="showWidth"?B[0].show.list.width=A[V]:V=="fixed"?B[0].show.list.fixed=A[V]:V=="align"?B[0].show.list.align=A[V]:B[0][V]=A[V]})}}w.value={}}function O(C,b){v();const B={};b=="showIndex"?B[b]=C.show?.list?.index:b=="showWidth"?B[b]=C.show?.list?.width:b=="fixed"?B[b]=C.show?.list?.fixed:b=="align"?B[b]=C.show?.list?.align:B[b]=C[b]||"",w.value[C.name]=B}function g(C,b){if(!C||!b){w.value={};return}const B=w.value[C.name][b];C.show||(C.show={}),C.show.list||(C.show.list={}),b=="showIndex"?C.show.list.index=B:b=="showWidth"?C.show.list.width=B:b=="fixed"?C.show.list.fixed=B:b=="align"?C.show.list.align=B:C[b]=B,w.value={}}function p(C,b){return b=="showIndex"?C.show?.list?.index:b=="showWidth"?C.show?.list?.width:b=="fixed"?C.show?.list?.fixed:b=="align"?C.show?.list?.align:C[b]}function S(C,b){k.value.filter(A=>A.name==C.name).forEach(A=>{A[b]=!A[b]})}const _=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const b=_.value.options.filter(B=>B.value==C);return b[0]?b[0].label:C}});return(C,b)=>{const B=n.resolveComponent("a-divider"),A=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),E=n.resolveComponent("a-input"),M=n.resolveComponent("a-form-item"),P=n.resolveComponent("a-col"),T=n.resolveComponent("a-input-number"),D=n.resolveComponent("a-checkbox"),W=n.resolveComponent("a-row"),R=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),K=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",sr,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[8]||(b[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",or,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,I=>(n.openBlock(),n.createBlock(V,n.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:z=>r("left",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(z=>c("left",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:b[0]||(b[0]=I=>d("left"))},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:b[1]||(b[1]=I=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,I=>(n.openBlock(),n.createBlock(V,n.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:z=>r("right",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"bool-del",onClick:n.withModifiers(z=>c("right",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[9]||(b[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(W,{key:0},{default:n.withCtx(()=>[n.createVNode(P,{span:7},{default:n.withCtx(()=>[n.createVNode(M,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(E,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:5},{default:n.withCtx(()=>[n.createVNode(M,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(T,{value:i.value.configs.operation.width,"onUpdate:value":b[2]||(b[2]=I=>i.value.configs.operation.width=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:6},{default:n.withCtx(()=>[n.createVNode(M,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(T,{value:i.value.configs.operation.count,"onUpdate:value":b[3]||(b[3]=I=>i.value.configs.operation.count=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(P,{span:5},{default:n.withCtx(()=>[n.createVNode(M,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(D,{checked:i.value.configs.operation.visible,"onUpdate:checked":b[4]||(b[4]=I=>i.value.configs.operation.visible=I)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[10]||(b[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",ar,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,I=>(n.openBlock(),n.createBlock(V,n.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:z=>f(I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(A,{key:0,class:"btn-del",onClick:n.withModifiers(z=>m(I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),onClick:b[5]||(b[5]=I=>u()),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[11]||(b[11]=[n.createTextVNode("表头设置")])),_:1}),b[12]||(b[12]=n.createTextVNode(" 数据模型:")),n.createVNode(R,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":b[6]||(b[6]=I=>i.value.dataModel=I)},null,8,["options","value"]),n.createVNode(K,{columns:t.value,"data-source":k.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["showIndex","showWidth","align","fixed"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",rr,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,record:z})=>[["showIndex","showWidth"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!w.value[z.name]||!Object.keys(w.value[z.name]).includes(I.dataIndex))&&!p(z,I.dataIndex)&&"empty"]),onClick:he=>O(z,I.dataIndex)},[w.value[z.name]&&Object.keys(w.value[z.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(T,{key:0,value:w.value[z.name][I.dataIndex],"onUpdate:value":he=>w.value[z.name][I.dataIndex]=he,onBlur:he=>g(z,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[x]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p(z,I.dataIndex)),1)],64))],10,dr)):["isList","isQuery","isSort"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",cr,[n.createVNode(D,{checked:z[I.dataIndex],onClick:he=>S(z,I.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!w.value[z.name]||!Object.keys(w.value[z.name]).includes(I.dataIndex))&&!p(z,I.dataIndex)&&"empty"]),onClick:he=>O(z,I.dataIndex)},[w.value[z.name]&&Object.keys(w.value[z.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(R,{key:0,value:z.show.list[I.dataIndex],"onUpdate:value":he=>z.show.list[I.dataIndex]=he,allowClear:!0,options:I.options,onBlur:b[7]||(b[7]=he=>g())},null,8,["value","onUpdate:value","options"])),[[x]]):(n.openBlock(),n.createElementBlock("span",fr,n.toDisplayString(I.showLabel(I.options,p(z,I.dataIndex))),1))],10,hr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(di,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function en(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const pr={toHump:en},mr={class:"unione-table-tools"},gr={class:"unione-table-data"},kr={key:0,class:"unione-table-opts"},vl=ee(n.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(o,{expose:e,emit:t}){const i=Ae(),l=o,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),a=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),c=n.computed(()=>{const V=l.dataList||[];return!V.length&&d.value?d.value.data()||[]:V}),h=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const V=H.utils.obj.ext(s.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),F=[];let E=s.value.operation?.btns||[];if(E.forEach(M=>{F.push(M.name)}),F.includes("edit")||E.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),F.includes("view")||E.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),F.includes("delete")||E.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor){const M=E.filter(T=>T.name=="edit")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const T=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",D=l.editor.model.value;M.action.href=i.editPageUrl+"?psn="+T+"&model="+D+"&id={row."+l.rowKey+"}"}const P=E.filter(T=>T.name=="view")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const T=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";P.action.href=i.viewPageUrl+"?psn="+T+"&model=view&id={row."+l.rowKey+"}"}}return E=E.filter(M=>M.visible!=!1).sort((M,P)=>{const T=M.index||1,D=P.index||1;return T-D}),V.count&&(E.length>V.count+1?(V.btns=E.slice(0,V.count),V.more.items=E.slice(V.count,E.length),V.more.visible=!0):(V.btns=E,V.more.visible=!1)),V}),f=n.computed(()=>{let V=[];s.value.columns?.length&&(V=[...s.value.columns]);const F=[];V.forEach((M,P)=>{M.dataIndex=M.name,M.convert&&(M.dataIndex=M.name+"Label",M.convertObj=new dt(M.convert),M.customCell=(T,D,W)=>{const R=T[W.name];M.convertObj&&(T[W.dataIndex]==null||T[W.dataIndex]==null)&&R!=null&&R!=null&&(R+"").length>0&&(T[W.dataIndex]=R,M.convertObj.convert(R).then(N=>{N&&(T[W.dataIndex]=N)}))}),M.sort?.enable&&(M.sorter=!0,M.sort.defoult&&(M.defaultSortOrder=M.sort.asc?"ascend":"descend")),M.customRender=({text:T})=>T||"--",M.fkey?.enable&&(M.fkey.labelName&&(M.dataIndex=en(M.fkey.labelName)),M.fkey.labelTitle&&(M.title=M.fkey.labelTitle),M.customRender=({record:T,column:D})=>T&&T[D.name+"FEntry"]&&T[D.name+"FEntry"][D.dataIndex]||"--",M.fkey.fields?.forEach((T,D)=>{if(!T.name)return;const W=en(T.name),R={fkName:M.name,title:T.title,name:W,dataIndex:T.name,width:T.width,index:T.index||P+D+1,customRender:({record:N,column:K})=>{if(N&&N[K.fkName+"FEntry"]){const I=N[K.fkName+"FEntry"][K.name];if(I)return T.convertObj&&T.convertObj.convert(I)||I}return"--"}};T.convert&&(T.convertObj=new dt(T.convert)),F.push(R)}))}),F.forEach(M=>{V.splice(M.index,0,M)});const E=H.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return E&&E.visible!=!1&&(E.customRender=M=>v.value?(v.value.current-1)*v.value.pageSize+M.index+1:M.index,V=[E,...V]),h.value&&h.value.visible!=!1&&V.push({fixed:"right",align:"center",...h.value,name:"operation"}),V}),u=n.computed(()=>{if(s.value.leftBtns==!1)return[];const V=[],F=[];if((s.value.leftBtns||[]).forEach(M=>{M.visible!=!1&&V.push(M),F.push(M.name),M.name=="delBatch"&&!O.value&&(M.visible=!1)}),!F.includes("add")){const M={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};V.splice(0,0,M)}if(!F.includes("delBatch")&&O.value){const M={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};V.splice(1,0,M)}if(l.editor){const M=V.filter(P=>P.name=="add")[0];if(M.visible&&(M.action||(M.action={}),M.action.type||(M.action.type="route"),!M.action.href)){const P=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",T=l.editor.model.value;M.action.href=i.addPageUrl+"?psn="+P+"&model="+T}}return V});function m({btn:V,event:F}){if(i.isDebug&&console.log("unione table left btn click",V,F),V.name=="delBatch"){if(!g.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.loadByIds(g.value.selectedRowKeys);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+g.value.selectedRowKeys.length+")数据",onOk:()=>{S("delBatch",{btn:V,event:F,keys:g.value.selectedRowKeys}),S("leftBtnClick",{btn:V,event:F,keys:g.value.selectedRowKeys}),S("btnClick",{btn:V,event:F,keys:g.value.selectedRowKeys})}});return}S(V.name,{btn:V,event:F}),S("leftBtnClick",{btn:V,event:F}),S("btnClick",{btn:V,event:F})}const y=n.computed(()=>{if(s.value.rightBtns==!1)return[];const V=[],F=[];if((s.value.rightBtns||[]).forEach(M=>{M.visible!=!1&&V.push(M),F.push(M.name)}),!F.includes("impData")){const M={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};V.splice(1,0,M)}if(!F.includes("expData")){const M={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};V.splice(2,0,M)}if(!F.includes("downTmpl")){const M={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};V.splice(3,0,M)}return V});function k({btn:V,event:F}){i.isDebug&&console.log("unione table right btn click",V,F),S(V.name,{btn:V,event:F}),S("rightBtnClick",{btn:V,event:F}),S("btnClick",{btn:V,event:F})}const x=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),w=n.ref({}),v=n.computed(()=>H.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:V=>"共"+V+"记录",pageSize:10,current:1,total:0,position:["bottomCenter"]})),O=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),g=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(V,F)=>{g.value.selectedRowKeys=V,g.value.selectedRowList=F},getCheckboxProps:V=>({disabled:V.checkable})}),p=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],S=t;function _({btn:V,event:F},E){if(i.isDebug&&console.log("unione table opt btn click",V,F),V.name=="delete"){if(d.value){d.value.deleteByIds([E[r.value]]);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{S(V.name,{btn:V,event:F,row:E}),S("optBtnClick",{btn:V,event:F,row:E}),S("btnClick",{btn:V,event:F,row:E})}});return}S(V.name,{btn:V,event:F,row:E}),S("optBtnClick",{btn:V,event:F,row:E}),S("btnClick",{btn:V,event:F,row:E})}function C(V,F,E,M){B(),S("change",{pagination:V,filters:F,sorter:E,event:M})}function b(){G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${g.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{g.value.selectedRowKeys=[],g.value.selectedRowList=[]}})}function B(){console.log("dataStorage.value",d.value),d.value?.find({body:w.value,page:v.value.current,pageSize:v.value.pageSize})}n.onMounted(()=>{l.editor?.ebus.$on("table-list-search",V=>{console.log("table-list-search",V),w.value=V||{},B()})});function A(){return{keys:g.value.selectedRowKeys,rows:g.value.selectedRowList}}return e({getSelected:A,clearSelected:b}),(V,F)=>{const E=n.resolveComponent("unione-btn"),M=n.resolveComponent("DownOutlined"),P=n.resolveComponent("a-button"),T=n.resolveComponent("a-dropdown"),D=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",mr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(u.value,W=>(n.openBlock(),n.createBlock(E,{key:W.name,class:"btn",widget:W,editor:o.editor,onClick:m,preset:p,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),g.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:b},"当前选中记录("+n.toDisplayString(g.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,W=>(n.openBlock(),n.createBlock(E,{key:W.name,class:"btn right",widget:W,editor:o.editor,onClick:k,preset:p,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",gr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(D,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":c.value,"row-selection":O.value?g.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:v.value,onChange:C},x.value),{bodyCell:n.withCtx(({column:W,record:R})=>[W.name==="operation"?(n.openBlock(),n.createElementBlock("div",kr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.btns,N=>(n.openBlock(),n.createBlock(E,{key:N.name,class:"opt",widget:N,editor:o.editor,onClick:K=>_(K,R),preset:p,ctx:{row:R}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(n.openBlock(),n.createBlock(T,{key:0,trigger:[h.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.more.items,N=>(n.openBlock(),n.createBlock(E,{key:N.name,class:"item",widget:N,editor:o.editor,onClick:K=>_(K,R),type:"text",preset:p,ctx:{row:R}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(P,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(h.value.more.title)+" ",1),n.createVNode(M)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(ur,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a9f2c11d"]]),br={class:"page-setting-dialog"},Lt=n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=o,i=n.computed(()=>t.editor?.model?.value),l=H.useSession(),s=n.computed(()=>l.getPrincipal()),a=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(u=>{a.value=!1})});function r(){a.value=!0}function d(){t.editor?.save().then(u=>{console.log("res",u)})}function c(){t.editor?.save().then(u=>{console.log("res",u)})}const h=n.ref("");function f(u){h.value||(h.value=i.value),u?t.editor?.setModel("edit"):t.editor?.setModel(h.value)}return(u,m)=>{const y=n.resolveComponent("SettingOutlined"),k=n.resolveComponent("a-tooltip"),x=n.resolveComponent("SaveOutlined"),w=n.resolveComponent("FormOutlined"),v=n.resolveComponent("StopOutlined"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:0,title:o.settingTitle},{default:n.withCtx(()=>[n.createVNode(y,{class:"page-setting",onClick:r})]),_:1},8,["title"])):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(w,{class:"btn-edit",onClick:m[0]||(m[0]=g=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&u.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-edit",onClick:m[1]||(m[1]=g=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(u.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(O,{key:4,title:t.settingTitle,open:a.value,"onUpdate:open":m[2]||(m[2]=g=>a.value=g),centered:"",width:"85%",onOk:c},{default:n.withCtx(()=>[n.createElementVNode("div",br,[n.renderSlot(u.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),yr={class:"unione-props-setting data-field-manage"},wr={key:0},xr={key:1},vr={key:2},Cr={key:3},Sr={key:4},Nr={key:5},Br={key:6},Or=["onClick"],Vr=["onClick"],_r=["onClick"],Mr={key:1},Tr=ee(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+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=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(m=>{i.value.selectedRowKeys.includes(m)||i.value.selectedRowKeys.push(m);const y=[];t.value.forEach(k=>{!u.includes(k.name)&&i.value.selectedRowKeys.includes(k.name)&&y.push(k.name)}),y.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(k=>!y.includes(k)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function a(){const u=Object.keys(s.value);if(u.length)for(let m in u){const y=t.value.filter(k=>k.name==m);if(y&&y[0]){let k=s.value[m];Object.keys(k).forEach(x=>{y[0][x]=k[x]})}}s.value={}}function r(u,m){a();const y={};y[m]=u[m]||"",s.value[u.name]=y}function d(u,m){if(!u||!m){s.value={};return}const y=s.value[u.name][m];if(m=="name"&&t.value.filter(x=>x[m]==y&&x.name!=u.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}u[m]=y,s.value={}}function c(u,m){t.value.filter(k=>k.name==u.name).forEach(k=>{k[m]=!k[m]})}function h(){if(a(),t.value.filter(y=>y.name=="new_").length>0){s.value.new_={name:"new_"};return}const m={title:"",name:"new_",isPk:!1};t.value.push(m),s.value[m.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,m)=>{const y=n.resolveComponent("a-button"),k=n.resolveComponent("a-tooltip"),x=n.resolveComponent("a-input"),w=n.resolveComponent("a-input-number"),v=n.resolveComponent("a-select-option"),O=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),p=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",yr,[n.createVNode(y,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:n.withCtx(()=>m[1]||(m[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:n.withCtx(()=>m[2]||(m[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(p,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:S})=>[S.key==="name"?(n.openBlock(),n.createElementBlock("span",wr,[m[3]||(m[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="title"?(n.openBlock(),n.createElementBlock("span",xr,[m[4]||(m[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="descs"?(n.openBlock(),n.createElementBlock("span",vr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="isPk"?(n.openBlock(),n.createBlock(k,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[m[5]||(m[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isFk"?(n.openBlock(),n.createBlock(k,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isNull"?(n.openBlock(),n.createBlock(k,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="syncDbEnable"?(n.openBlock(),n.createBlock(k,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:_,record:C})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[C.name][S.dataIndex],"onUpdate:value":b=>s.value[C.name][S.dataIndex]=b,onBlur:b=>d(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,Or)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[C.name][S.dataIndex],"onUpdate:value":b=>s.value[C.name][S.dataIndex]=b,onBlur:b=>d(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,Vr)):["dataType"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:C[S.dataIndex],"onUpdate:value":b=>C[S.dataIndex]=b,onBlur:m[0]||(m[0]=b=>d())},{default:n.withCtx(()=>[n.createVNode(v,{key:"String",value:"String"}),n.createVNode(v,{key:"Long",value:"Long"}),n.createVNode(v,{key:"Short",value:"Short"}),n.createVNode(v,{key:"Integer",value:"Integer"}),n.createVNode(v,{key:"Float",value:"Float"}),n.createVNode(v,{key:"Double",value:"Double"}),n.createVNode(v,{key:"Date",value:"Date"}),n.createVNode(v,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Mr,n.toDisplayString(_),1))],10,_r)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:C[S.dataIndex],onClick:b=>c(C,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!C[S.dataIndex],onClick:b=>c(C,S.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Ar={class:"unione-props-setting data-field-setting"},Er={key:0},Ir=["onClick"],Dr={class:"field-txt"},Pr=["onClick"],Fr={key:1,class:"field-txt"},$r=["onClick"],Rr={key:1},Lr=["onClick"],jr={key:0,class:"field-txt"},zr={key:4,class:"edit-field"},qr={key:0},Ur=["onClick"],Wr=ee(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:w})=>w+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=n.useModel(o,"modelValue"),i={mounted:w=>w.focus()},l=n.ref({});function s(){const w=Object.keys(l.value);if(w.length)for(let v in w){const O=t.value.filter(g=>g.name==v);if(O&&O[0]){let g=l.value[v];Object.keys(g).forEach(p=>{p=="convertName"?(O[0].convert||(O[0].convert={}),O[0].convert.type=g[p]):O[0][p]=g[p]})}}l.value={}}function a(w,v){s();const O={};v=="convertName"?(w.convert||(w.convert={}),O[v]=w.convert?.type):O[v]=w[v]||"",l.value[w.name]=O}function r(w,v){{l.value={};return}}function d(w,v){t.value.filter(g=>g.name==w.name).forEach(g=>{g[v]=!g[v]})}const c=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function h(w,v){const O=t.value.filter(p=>p.name==w.name);O.forEach(p=>{v!="isSort"?p[v]=!0:p[v]=!p[v]});const g=O[0];if(!(!g||v=="isSort")){switch(c.value.prop=v,c.value.field=w,g.show||(g.show={}),v){case"isQuery":g.show.query||(g.show.query={}),c.value.show=g.show.query,c.value.title=`查询设置/${w.title}(${w.name})`;break;case"isForm":g.show.form||(g.show.form={}),c.value.show=g.show.form,c.value.title=`表单设置/${w.title}(${w.name})`;break;case"isView":g.show.view||(g.show.view={}),c.value.show=g.show.view,c.value.title=`详情设置/${w.title}(${w.name})`;break;case"isList":g.show.list||(g.show.list={}),c.value.show=g.show.list,c.value.title=`列头设置/${w.title}(${w.name})`;break}c.value.visible=!0}}const f=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:w=>{const v=f.value.options.filter(O=>O.value==w);return v[0]?v[0].label:w}}),u=n.ref({visible:!1,field:{},props:{},showInfo:w=>{let v="";return w.rules&&(v=w.rules.filter(O=>O.enable).length||""),v&&(v="("+v+")"),v},toSetting:()=>{const w=u.value.props,v={name:"range",trigger:w.trigger,whitespace:w.whitespace,message:w.rangeMessage};w.rangeMin!=null&&w.rangeMin!=null&&(v.min=w.rangeMin,v.enable=!0),w.rangeMax!=null&&w.rangeMax!=null&&(v.max=w.rangeMax,v.enable=!0);const O={name:"reg",trigger:w.trigger,whitespace:w.whitespace,message:w.regMessage};w.regExpress&&(O.pattern=w.regExpress,O.enable=!0),u.value.field.rules=[v,O],u.value.visible=!1,u.value.props={},console.log("rule",u.value.field.rules)}});function m(w){u.value.visible=!0,u.value.field=w;const v=w.rules||[],O={trigger:"change",whitespace:!0};v.forEach(g=>{g.name=="reg"&&(O.trigger=g.trigger,O.whitespace=g.whitespace,O.regExpress=g.pattern,O.regMessage=g.message),g.name=="range"&&(O.rangeMin=g.min,O.rangeMax=g.max,O.rangeMessage=g.message)}),u.value.props=O}const y=n.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:w=>{const v=y.value.widgets.filter(O=>O.value==w);return v[0]?v[0].label:w},toSetting:()=>{}}),k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(w,v)=>{k.value.convert.options.splice(w,1)},toSetting:()=>{k.value.visible=!1}});function x(w){k.value.visible=!0,k.value.field=w,k.value.convert=w.convert||{}}return(w,v)=>{const O=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),p=n.resolveComponent("a-select"),S=n.resolveComponent("a-checkbox"),_=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),b=n.resolveComponent("a-form-item"),B=n.resolveComponent("a-input"),A=n.resolveComponent("a-form"),V=n.resolveComponent("a-modal"),F=n.resolveComponent("a-col"),E=n.resolveComponent("a-row"),M=n.resolveComponent("a-select-option"),P=n.resolveComponent("a-divider"),T=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Ar,[n.createVNode(_,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:D})=>[["widget","queryType","rules","convertName"].includes(D.key)?(n.openBlock(),n.createElementBlock("span",Er,[n.createVNode(O),n.createTextVNode(" "+n.toDisplayString(D.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:D,text:W,record:R})=>[["rules"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!u.value.showInfo(R)&&"empty"]),onClick:N=>m(R)},[n.createElementVNode("span",Dr,n.toDisplayString(u.value.showInfo(R)),1),u.value.showInfo(R)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>v[22]||(v[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ir)):["widget"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(D.dataIndex))&&!W&&"empty"]),onClick:N=>a(R,D.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R[D.dataIndex],"onUpdate:value":N=>R[D.dataIndex]=N,allowClear:!0,options:y.value.widgets,onBlur:v[0]||(v[0]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Fr,n.toDisplayString(y.value.widgetName(W)),1))],10,Pr)):["queryType"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[R.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(D.dataIndex))&&!W&&"empty"]),onClick:N=>a(R,D.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R[D.dataIndex],"onUpdate:value":N=>R[D.dataIndex]=N,allowClear:!0,options:f.value.options,onBlur:v[1]||(v[1]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Rr,n.toDisplayString(f.value.showLabel(W)),1))],10,$r)):n.createCommentVNode("",!0)],64)):["convertName"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[R.name]||!Object.keys(l.value[R.name]).includes(D.dataIndex))&&!R.convert?.type&&"empty"]),onClick:N=>a(R,D.dataIndex)},[l.value[R.name]&&Object.keys(l.value[R.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(p,{key:0,value:R.convert.type,"onUpdate:value":N=>R.convert.type=N,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:v[2]||(v[2]=N=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[R.convert?.type?(n.openBlock(),n.createElementBlock("span",jr,n.toDisplayString(R.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),R.convert?.type?(n.openBlock(),n.createBlock(g,{key:1,type:"link",onClick:n.withModifiers(N=>x(R),["stop"])},{default:n.withCtx(()=>v[23]||(v[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Lr)):["isQuery","isForm","isView","isList","isSort"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",zr,[n.createVNode(S,{checked:R[D.dataIndex],onClick:N=>d(R,D.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:N=>h(R,D.dataIndex)},{default:n.withCtx(()=>v[24]||(v[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:c.value.visible,"onUpdate:visible":v[9]||(v[9]=D=>c.value.visible=D),title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(b,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.index,"onUpdate:value":v[3]||(v[3]=D=>c.value.show.index=D)},null,8,["value"])]),_:1}),["isQuery"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(b,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.width,"onUpdate:value":v[4]||(v[4]=D=>c.value.show.width=D)},null,8,["value"])]),_:1})),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.labelWidth,"onUpdate:value":v[5]||(v[5]=D=>c.value.show.labelWidth=D)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.valueWidth,"onUpdate:value":v[6]||(v[6]=D=>c.value.show.valueWidth=D)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(p,{value:c.value.show.fixed,"onUpdate:value":v[7]||(v[7]=D=>c.value.show.fixed=D),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(p,{value:c.value.show.align,"onUpdate:value":v[8]||(v[8]=D=>c.value.show.align=D),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:k.value.visible,"onUpdate:visible":v[11]||(v[11]=D=>k.value.visible=D),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",qr,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>v[25]||(v[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(_,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:D,text:W,record:R,index:N})=>[D.dataIndex==="label"?(n.openBlock(),n.createBlock(B,{key:0,value:R.label,"onUpdate:value":K=>R.label=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),D.dataIndex==="value"?(n.openBlock(),n.createBlock(B,{key:1,value:R.value,"onUpdate:value":K=>R.value=K,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),D.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:K=>k.value.toDelOption(N,R)},"删除",8,Ur)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(A,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(E,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(F,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(b,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(B,{value:k.value.convert.dict,"onUpdate:value":v[10]||(v[10]=D=>k.value.convert.dict=D)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:y.value.visible,"onUpdate:visible":v[13]||(v[13]=D=>y.value.visible=D),title:"控件设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:y.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[y.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(b,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(p,{value:y.value.props.mode,"onUpdate:value":v[12]||(v[12]=D=>y.value.props.mode=D),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(M,{value:"multiple"},{default:n.withCtx(()=>v[26]||(v[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(M,{value:"tags"},{default:n.withCtx(()=>v[27]||(v[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(V,{visible:u.value.visible,"onUpdate:visible":v[21]||(v[21]=D=>u.value.visible=D),title:"规则设置",onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode(A,{model:u.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>v[28]||(v[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(b,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(T,{value:u.value.props.trigger,"onUpdate:value":v[14]||(v[14]=D=>u.value.props.trigger=D),options:["change","blur"]},null,8,["value"])]),_:1}),u.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(b,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(S,{value:u.value.props.whitespace,"onUpdate:value":v[15]||(v[15]=D=>u.value.props.whitespace=D),checked:u.value.props.whitespace},{default:n.withCtx(()=>v[29]||(v[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>v[30]||(v[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(b,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:u.value.props.rangeMin,"onUpdate:value":v[16]||(v[16]=D=>u.value.props.rangeMin=D)},null,8,["value"]),v[31]||(v[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:u.value.props.rangeMax,"onUpdate:value":v[17]||(v[17]=D=>u.value.props.rangeMax=D)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.rangeMessage,"onUpdate:value":v[18]||(v[18]=D=>u.value.props.rangeMessage=D)},null,8,["value"])]),_:1}),n.createVNode(P,{orientation:"left"},{default:n.withCtx(()=>v[32]||(v[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(b,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regExpress,"onUpdate:value":v[19]||(v[19]=D=>u.value.props.regExpress=D)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:u.value.props.regMessage,"onUpdate:value":v[20]||(v[20]=D=>u.value.props.regMessage=D)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Hr={class:"unione-props-setting data-field"},Kr=ee(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=n.useModel(o,"modelValue");return(t,i)=>{const l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Hr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Tr,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Wr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Qr={key:0,class:"data-model-list"},Gr=["onClick"],Yr=ee(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=o;function s(f){i.value=f}function a(){if(t.value.length>=l.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=la.v4(),u={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=u,console.log("data model added",u),l.editor.dataModel(f,u)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),c=n.inject("closeSetting");function h(){d.value.validate().then(f=>{c&&c()})}return e({toSaving:h}),(f,u)=>{const m=n.resolveComponent("a-input"),y=n.resolveComponent("a-form-item"),k=n.resolveComponent("a-textarea"),x=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Qr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,w=>(n.openBlock(),n.createElementBlock("div",{key:w.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==w.sn&&"slt"]),onClick:v=>s(w)},n.toDisplayString(w.title),11,Gr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(x,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(y,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.title,"onUpdate:value":u[0]||(u[0]=w=>i.value.title=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.name,"onUpdate:value":u[1]||(u[1]=w=>i.value.name=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(m,{value:i.value.url,"onUpdate:value":u[2]||(u[2]=w=>i.value.url=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(k,{value:i.value.descs,"onUpdate:value":u[3]||(u[3]=w=>i.value.descs=w)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Kr,{modelValue:i.value.fields,"onUpdate:modelValue":u[4]||(u[4]=w=>i.value.fields=w)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Xr={class:"unione-props-setting unione-page-setting"},jt=ee(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,l)=>{const s=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),c=n.resolveComponent("a-form"),h=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Xr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(c,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=u=>t.value.title=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=u=>t.value.component=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=u=>t.value.icon=u)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isGlobal,"onUpdate:checked":l[3]||(l[3]=u=>t.value.isGlobal=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.createVNode(r,{checked:t.value.isTmpl,"onUpdate:checked":l[4]||(l[4]=u=>t.value.isTmpl=u),checkedValue:1,checkedChildren:"是",unCheckedChildren:"否",unCheckedValue:0},null,8,["checked"])]),_:1}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{value:t.value.descs,"onUpdate:value":l[5]||(l[5]=u=>t.value.descs=u),placeholder:"请输入页面备注...",rows:4},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1}),n.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Yr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Cl=ee(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(Lt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Jr={class:"form-btns"},Sl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new wt,s=n.computed(()=>l.$widgetList.value||[]),a=n.computed(()=>{const f=l.define.value?.configs?.btns||[],u=f.map(m=>m.name);if(!u.includes("save")){const m={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};f.splice(m.index,0,m)}if(!u.includes("submit")){const m={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let y=m.index||1;f.splice(y,0,m)}if(!u.includes("reset")){const m={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};f.splice(m.index,0,m)}if(!u.includes("back")){const m={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};f.splice(m.index,0,m)}return l.model.value=="view"&&f.filter(m=>["save","submit","reset"].includes(m.name)).forEach(m=>{m.visible=!1}),f});function r({btn:f,event:u}){f.name=="save"&&d(),f.name=="reset",f.name=="back"&&c()}async function d(){const f=l.dataManager().form();let u={};for(let m in f){const y=await f[m].validate();if(l.dataManager().psn()==m){for(let k in u)y[k]=u[k];u=y}else u[m]=y}console.log("=======form data=====",u),l.dataManager().primary().save({data:u,params:l.dataManager().params}).then(m=>{console.log("save result:",m)})}function c(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&l.load(h.value,f)});const h=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),h.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+h.value),l.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&l.dataManager().params(f.query),l.load(h.value,t.pageDefine||i)}),(f,u)=>{const m=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(Lt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,y=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(y.widget),{key:y.wid,wid:y.wid,widget:y,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Jr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,y=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y.name},[y.visible!=!1?(n.openBlock(),n.createBlock(m,{key:0,widget:y,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Zr={key:0,class:"node-opts"},ed={class:"form-warp"},td={class:"form-btns"},Nl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},setting:{type:Object,required:!0},btns:{type:Array,required:!1},event:{type:Object,required:!1}},setup(o){H.useDialog();const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function l(){if(t.fields?.length){const M={widget:"unione-form",dsn:"primary",primary:!0,widgets:t.fields};i.configs.widgets=[M],i.configs.dsnList=["primary"],s.dataManager().use("primary","form").store(t.storage)}i.configs.btns=t.btns||[],i.configs.setting=t.setting||{}}const s=new wt,a=n.ref([]),r=n.ref({}),d=n.ref(null),c=n.ref([]),h=n.ref([]),f=n.ref(0),u=n.computed(()=>{const M={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"parentId",labelField:"title",leafField:"isLeaf",...t.setting?.tree||{}};return s.define.value?.configs?.tree||M}),m=n.computed(()=>{const M=u.value.btns||[],P=[];return M.forEach(T=>{P.push(T.name)}),M.filter(T=>T.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),y=n.computed(()=>{const M=u.value.btns||[],P=[],T=[];return M.forEach(D=>{T.push(D.name),D.name!="add"&&P.push(D)}),T.includes("delete")||P.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),T.includes("child")||P.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),P});function k({btn:M,event:P}){if(P.stopPropagation(),console.log("onTreeMenuClick,btn:"+M+",node:",d.value),M.name=="child"){const T=r.value[d.value[u.value.idField]];T.isLeaf=!1,d.value={},d.value[u.value.pidField]=T[u.value.idField],d.value[u.value.labelField]="新建...",d.value[u.value.idField]="new_"+f.value,d.value.parentNode=T,f.value=f.value+1,T.children||(T.children=[],h.value.push(T[u.value.idField])),C.value.createNode&&C.value.createNode(d.value,T,s.dataManager().params()),T.children.push(d.value),c.value=[d.value[u.value.idField]],s.dataManager().primary().setValue(d.value)}M.name=="delete"&&(d.value[u.value.idField].startsWith("new_")?d.value.parentNode?d.value.parentNode.children=d.value.parentNode.children.filter(T=>T[u.value.idField]!=d.value[u.value.idField]):a.value=a.value.filter(T=>T[u.value.idField]!=d.value[u.value.idField]):s.dataManager().primary().deleteByIds([d.value[u.value.idField]]).then(()=>{d.value.parentNode?d.value.parentNode.children=d.value.parentNode.children.filter(T=>T[u.value.idField]!=d.value[u.value.idField]):a.value=a.value.filter(T=>T[u.value.idField]!=d.value[u.value.idField])}))}function x(M,{expanded:P,node:T}){P&&(d.value=T,s.dataManager().primary().setValue(d.value),S())}function w(M,{selected:P,node:T}){P?(d.value=T,s.dataManager().primary().setValue(d.value)):d.value&&(c.value=[d.value[u.value.idField]])}n.watch(()=>d.value,()=>{console.log("active node changed",d.value),v(!d.value)});function v(M=!0){const P=s.dataManager().form();for(let T in P)P[T].setDisabled(M)}function O(){d.value={},d.value[u.value.pidField]=-1,d.value[u.value.labelField]="新建...",d.value[u.value.idField]="new_"+f.value,f.value=f.value+1,C.value.createNode&&C.value.createNode(d.value,null,s.dataManager().params()),a.value.push(d.value),c.value=[d.value[u.value.idField]],s.dataManager().primary().setValue(d.value)}const g=n.ref(""),p=wl(()=>{s.dataManager().primary().find({page:1,pageSize:9999,keywords:g.value,needCount:!1,body:{}}).then(M=>{if(r.value={},a.value=[],M.body?.length){const P={};M.body.forEach(T=>{P[T[u.value.idField]]=T}),M.body.forEach(T=>{const D=P[T[u.value.pidField]];D?(D.children||(D.children=[],D.isLeaf=!1),D.children.push(T)):a.value.push(T)})}})},400);function S(){const M={};if(M[u.value.pidField]=-1,d.value){if(d.value.children?.length)return;M[u.value.pidField]=d.value[u.value.idField],s.dataManager().primary().find({page:1,pageSize:999,body:M}).then(P=>{d.value.dataRef.children=P.body||[],d.value.dataRef.children.forEach(T=>{T.isLeaf=!!T[u.value.leafField],r.value[T[u.value.idField]]=T,T.parentNode=r.value[T[u.value.pidField]]})})}else s.dataManager().primary().find({page:1,pageSize:999,body:M}).then(P=>{a.value=P.body||[],a.value.forEach(T=>{T.isLeaf=!!T[u.value.leafField],r.value[T[u.value.idField]]=T})})}const _=n.computed(()=>s.$widgetList.value||[]),C=n.computed(()=>{const M={...t.event||s.define.value?.configs?.event||{}};for(const P in M)M[P]&&typeof M[P]!="function"&&M[P].enable&&M[P].scriptText&&(P=="createNode"?M[P]=new Function("node","parent","params",M[P].scriptText):M[P]=new Function("data","event",M[P].scriptText));return M}),b=n.computed(()=>s.define.value?.configs?.setting||t.setting||{});n.provide("pageSetting",b.value);const B=n.computed(()=>{const M=s.define.value?.configs?.btns||t.btns||[],P=M.map(T=>T.name);if(!P.includes("save")){const T={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};M.splice(T.index,0,T)}if(!P.includes("submit")){const T={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let D=T.index||1;M.splice(D,0,T)}if(!P.includes("reset")){const T={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};M.splice(T.index,0,T)}if(!P.includes("back")){const T={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};M.splice(T.index,0,T)}return s.model.value=="view"&&M.filter(T=>["save","submit","reset"].includes(T.name)).forEach(T=>{T.visible=!1}),M});function A({btn:M,event:P}){M.name=="save"&&V({btn:M,event:P}),M.name=="reset",M.name=="back"&&F()}async function V(M){const P=s.dataManager().form();let T={...d.value};for(let D in P){const W=await P[D].validate();if(s.dataManager().psn()==D)for(let R in W)T[R]=W[R];else T[D]=W}T[u.value.idField].startsWith("new_")&&delete T[u.value.idField],delete T.parentNode,delete T.children,C.value.preSave&&C.value.preSave(T,M),console.log("=======form data=====",T),s.dataManager().primary().save({data:T}).then(D=>{console.log("save result:",D),d.value[u.value.idField]=D.body,c.value=[D.body],r.value[D.body]=d.value,C.value.postSaved&&C.value.postSaved(T,M)})}function F(){e.back()}const E=n.ref("new_");return n.onMounted(()=>{const M=n.inject("route");console.log("unione page tree route",M),E.value=t.psn||M?.query?.psn||M?.meta?.psn||"new_",console.log("unione page tree,psn:"+E.value),s.setModel(M?.query?.model||M?.meta?.model||"run");const P={...t.params||{},...M?.query||{},...M?.params||{}};s.dataManager().params(P),l(),s.load(E.value,i),n.nextTick(()=>{v(!0)}),S()}),(M,P)=>{const T=n.resolveComponent("SearchOutlined"),D=n.resolveComponent("a-input"),W=n.resolveComponent("unione-btn"),R=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(Lt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(s)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:P[3]||(P[3]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(D,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:g.value,"onUpdate:value":P[0]||(P[0]=N=>g.value=N),onChange:n.unref(p),onPressEnter:n.unref(p)},{suffix:n.withCtx(()=>[n.createVNode(T)]),_:1},8,["value","onChange","onPressEnter"]),n.createVNode(W,{widget:m.value,onClick:O},null,8,["widget"]),n.createVNode(R,{"show-line":u.value.showLine,"show-icon":u.value.showIcon,disabled:u.value.disabled,blockNode:!0,draggable:u.value.draggable,multiple:u.value.multiple,selectable:u.value.selectable,checkable:u.value.checkable,fieldNames:{title:u.value.labelField,key:u.value.idField},selectedKeys:c.value,"onUpdate:selectedKeys":P[1]||(P[1]=N=>c.value=N),expandedKeys:h.value,"onUpdate:expandedKeys":P[2]||(P[2]=N=>h.value=N),"tree-data":a.value,onExpand:x,onSelect:w},n.createSlots({icon:n.withCtx(({dataRef:N})=>[N.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(N.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[y.value?.length?{name:"title",fn:n.withCtx(({dataRef:N})=>[n.createElementVNode("span",null,n.toDisplayString(N[u.value.labelField]),1),d.value&&d.value[u.value.idField]==N[u.value.idField]?(n.openBlock(),n.createElementBlock("div",Zr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,K=>(n.openBlock(),n.createBlock(W,{key:K.name,widget:K,ctx:{node:N},onClick:k},null,8,["widget","ctx"]))),128))])):n.createCommentVNode("",!0)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",ed,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(_.value,N=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(N.widget),{key:N.wid,wid:N.wid,widget:N,editor:n.unref(s)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",td,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(B.value,N=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:N.name},[N.visible!=!1?(n.openBlock(),n.createBlock(W,{key:0,widget:N,editor:n.unref(s),disabled:!d.value,ctx:{},onClick:A},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])])]),_:2},[n.unref(s)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(s)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Bl=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[{wid:"query-form",widget:"unione-query-form",dataModel:"",configs:{keywords:{},fields:[],labelWidth:8}},{wid:"table-list",widget:"unione-table-list",dataModel:"",configs:{leftBtns:[],rightBtns:[],columns:[],operation:{title:"操作",visible:!0,width:150,btns:[],more:{layout:"horizontal"},count:2}}}],dsnList:[]},component:"unione-page-list"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel(a?.query?.model||a?.meta?.model||"run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(Lt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ct={release(o){return H.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return H.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return H.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return H.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return H.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return H.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return H.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},id={class:"unione-page list-page"},nd=ee(n.defineComponent({__name:"list",setup(o){const e=Ae(),t=H.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.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"}}});n.onMounted(()=>{r()});const a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ct.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params}).then(g=>{a.value.data=g.body,a.value.pagination.total=g.total*1}).finally(()=>{a.value.loading=!1})}function d(g){a.value.pagination.current=g.pagination.current,a.value.pagination.pageSize=g.pagination.pageSize,r()}function c(g){a.value.pagination.current=1,a.value.params=g||{},r()}function h({btn:g,event:p,row:S}){console.log("table btn click",g,p,S),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:S?{id:S.id}:{}}),g.name=="impFromDb"&&(u.value=!0),g.name=="release"&&f(S),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([g.id]).then(p=>{p.success?(t.success({title:"发布成功",content:p.body}),r()):t.error({title:"发布失败",content:p.body})})}})}const u=n.ref(!1),m=n.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}}]}),y=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),k=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function x(g){!g||!Object.keys(g).length||!g.dsId||(G.message.loading("数据加载中..."),k.value.params=g,k.value.loading=!0,ct.loadFromDb(g).then(p=>{k.value.loading=!1,G.message.destroy(),p.success?(p.body.forEach(S=>{S.checkable=!!S.id}),k.value.data=p.body,k.value.pagination.total=p.body.length):G.message.error(p.message)}))}function w(g){k.value.pagination.current=g.pagination.current,k.value.pagination.pageSize=g.pagination.pageSize}const v=n.ref();function O({btn:g}){if(g.name!="imp")return;const p=v.value.getSelected();p?.keys?.length?t.confirm({content:"确定导入选中的"+p.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:k.value.params.dsId,tables:p.keys.join()}).then(S=>{G.message.destroy(),S.success?(t.success({content:S.message}),c()):t.error({context:S.message})})}}):t.error({content:"请选择目标记录!"})}return(g,p)=>{const S=n.resolveComponent("UnioneQuery"),_=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",id,[n.createVNode(S,{widget:l.value,onQuery:c,onReset:c},null,8,["widget"]),n.createVNode(_,{widget:s.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:u.value,"onUpdate:visible":p[0]||(p[0]=b=>u.value=b),placement:"left"},{default:n.withCtx(()=>[n.createVNode(S,{widget:m.value,onQuery:x,onReset:x,onBtnClick:O,class:"load-table-form"},null,8,["widget"]),n.createVNode(_,{widget:y.value,dataList:k.value.data,loading:k.value.loading,pagination:k.value.pagination,onChange:w,rowKey:"name",ref_key:"loadTableObj",ref:v},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-d7658b67"]]),ld={class:"unione-props-setting data-field-manage"},sd={key:0},od={key:1},ad=["onClick"],rd=["onClick"],dd=["onClick"],cd={key:1},hd=ee(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.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=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:m=>{m.forEach(y=>{i.value.selectedRowKeys.includes(y)||i.value.selectedRowKeys.push(y);const k=[];t.value.forEach(x=>{!m.includes(x.name)&&i.value.selectedRowKeys.includes(x.name)&&k.push(x.name)}),k.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(x=>!k.includes(x)))})}}),l={mounted:m=>m.focus()},s=n.ref({});function a(){const m=Object.keys(s.value);if(m.length)for(let y in m){const k=t.value.filter(x=>x.name==y);if(k&&k[0]){let x=s.value[y];Object.keys(x).forEach(w=>{k[0][w]=x[w]})}}s.value={}}function r(m,y){a();const k={};k[y]=m[y]||"",s.value[m.name]=k}function d(m,y){if(!m||!y){s.value={};return}const k=s.value[m.name][y];if(y=="name"&&t.value.filter(w=>w[y]==k&&w.name!=m.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}m[y]=k,s.value={}}function c(m,y){const k=t.value.filter(x=>x.name==m.name)[0];return y=="isFk"?k.configs?.fkey?.enable:k[y]==1}function h(m,y){const k=t.value.filter(x=>x.name==m.name)[0];y=="isFk"?(k.configs||(k.configs={}),k.configs.fkey||(k.configs.fkey={}),k.configs.fkey.enable=!k.configs.fkey.enable):k[y]!=1?k[y]=1:k[y]=0}function f(){if(a(),t.value.filter(k=>k.name=="new_").length>0){s.value.new_={name:"new_"};return}const y={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(y),s.value[y.name]={name:"new_"}}function u(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(m=>!i.value.selectedRowKeys.includes(m.name)),i.value.selectedRowKeys=[]}})}return(m,y)=>{const k=n.resolveComponent("a-button"),x=n.resolveComponent("a-tooltip"),w=n.resolveComponent("a-input"),v=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),p=n.resolveComponent("a-checkbox"),S=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ld,[n.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>y[1]||(y[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:u,size:"small"},{default:n.withCtx(()=>y[2]||(y[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(S,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["name","title"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",sd,[y[3]||(y[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",od,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),_.key==="isPk"?(n.openBlock(),n.createBlock(x,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[y[4]||(y[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isFk"?(n.openBlock(),n.createBlock(x,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isNull"?(n.openBlock(),n.createBlock(x,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="syncEnable"?(n.openBlock(),n.createBlock(x,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,text:C,record:b})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[b.name][_.dataIndex],"onUpdate:value":B=>s.value[b.name][_.dataIndex]=B,onBlur:B=>d(b,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,ad)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[b.name][_.dataIndex],"onUpdate:value":B=>s.value[b.name][_.dataIndex]=B,onBlur:B=>d(b,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,rd)):["dataType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:b[_.dataIndex],"onUpdate:value":B=>b[_.dataIndex]=B,onBlur:y[0]||(y[0]=B=>d())},{default:n.withCtx(()=>[n.createVNode(O,{key:"String",value:"String"}),n.createVNode(O,{key:"Long",value:"Long"}),n.createVNode(O,{key:"Short",value:"Short"}),n.createVNode(O,{key:"Integer",value:"Integer"}),n.createVNode(O,{key:"Float",value:"Float"}),n.createVNode(O,{key:"Double",value:"Double"}),n.createVNode(O,{key:"Date",value:"Date"}),n.createVNode(O,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",cd,n.toDisplayString(C),1))],10,dd)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(p,{key:3,checked:c(b,_.dataIndex),onClick:B=>h(b,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(p,{key:4,checked:!c(b,_.dataIndex),onClick:B=>h(b,_.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Ol=1024;let fd=0,tn=class{constructor(e,t){this.from=e,this.to=t}};class Y{constructor(e={}){this.id=fd++,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=Ce.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:o=>o.split(" ")}),Y.openedBy=new Y({deserialize:o=>o.split(" ")}),Y.group=new Y({deserialize:o=>o.split(" ")}),Y.isolate=new Y({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});class ci{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[Y.mounted.id]}}const ud=Object.create(null);class Ce{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):ud,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ce(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[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(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(Y.group),s=-1;s<(l?l.length:0);s++){let a=t[s<0?i.name:l[s]];if(a)return a}}}}Ce.none=new Ce("",Object.create(null),0,8);class nn{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 i of this.types){let l=null;for(let s of e){let a=s(i);a&&(l||(l=Object.assign({},i.props)),l[a[0].id]=a[1])}t.push(l?new Ce(i.name,l,i.id,i.flags):i)}return new nn(t)}}const hi=new WeakMap,Vl=new WeakMap;var fe;(function(o){o[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class re{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,r]of s)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=ci.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.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 on(this.topNode,e)}cursorAt(e,t=0,i=0){let l=hi.get(this)||this.topNode,s=new on(l);return s.moveTo(e,t),hi.set(this,s._tree),s}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=zt(hi.get(this)||this.topNode,e,t,!1);return hi.set(this,i),i}resolveInner(e,t=0){let i=zt(Vl.get(this)||this.topNode,e,t,!0);return Vl.set(this,i),i}resolveStack(e,t=0){return gd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let c=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;c=!0}for(;c&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;c=!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:rn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new re(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new re(Ce.none,t,i,l)))}static build(e){return kd(e)}}re.empty=new re(Ce.none,[],[],0);class ln{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 ln(this.buffer,this.index)}}class Ze{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ce.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],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return s+"("+a.join(",")+")"}findChild(e,t,i,l,s){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(_l(s,l,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let c=s[d++]=l[r++]-i;s[d++]=l[r++]-e,a=Math.max(a,c)}return new Ze(s,a,this.set)}}function _l(o,e,t,i){switch(o){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function zt(o,e,t,i){for(var l;o.from==o.to||(t<1?o.from>=e:o.from>e)||(t>-1?o.to<=e:o.to<e);){let a=!i&&o instanceof Ve&&o.index<0?null:o.parent;if(!a)return o;o=a}let s=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof Ve&&a.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,s);if(!a)return o;o=a}}class Ml{cursor(e=0){return new on(this,e)}getChild(e,t=null,i=null){let l=Tl(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Tl(this,e,t,i)}resolve(e,t=0){return zt(this,e,t,!1)}resolveInner(e,t=0){return zt(this,e,t,!0)}matchContext(e){return sn(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class Ve extends Ml{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,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,i,l,s=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,c=t>0?r.length:-1;e!=c;e+=t){let h=r[e],f=d[e]+a.from;if(_l(l,i,f,f+h.length)){if(h instanceof Ze){if(s&fe.ExcludeBuffers)continue;let u=h.findChild(0,h.buffer.length,t,i-f,l);if(u>-1)return new et(new pd(a,h,e,f),null,u)}else if(s&fe.IncludeAnonymous||!h.type.isAnonymous||an(h)){let u;if(!(s&fe.IgnoreMounts)&&(u=ci.get(h))&&!u.overlay)return new Ve(u.tree,f,e,a);let m=new Ve(h,f,e,a);return s&fe.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?h.children.length-1:0,t,i,l)}}}if(s&fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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,i=0){let l;if(!(i&fe.IgnoreOverlays)&&(l=ci.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:a,to:r}of l.overlay)if((t>0?a<=s:a<s)&&(t<0?r>=s:r>s))return new Ve(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Tl(o,e,t,i){let l=o.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function sn(o,e,t=e.length-1){for(let i=o.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class pd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class et extends Ml{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new et(this.context,this,s)}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,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new et(this.context,this,s)}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 et(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 et(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let a=i.buffer[this.index+1];e.push(i.slice(l,s,a)),t.push(0)}return new re(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Al(o){if(!o.length)return null;let e=0,t=o[0];for(let s=1;s<o.length;s++){let a=o[s];(a.from>t.from||a.to<t.to)&&(t=a,e=s)}let i=t instanceof Ve&&t.index<0?null:t.parent,l=o.slice();return i?l[e]=i:l.splice(e,1),new md(l,t)}class md{constructor(e,t){this.heads=e,this.node=t}get next(){return Al(this.heads)}}function gd(o,e,t){let i=o.resolveInner(e,t),l=null;for(let s=i instanceof Ve?i:i.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(l||(l=[i])).push(a.resolve(e,t)),s=a}else{let a=ci.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new Ve(a.tree,a.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(zt(r,e,t,!1))}}return l?Al(l):i}class on{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 Ve)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Ve?(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,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.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,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+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<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,a=e<0?-1:i._tree.children.length;s!=a;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||an(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,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new et(this.buffer,t,this.stack[l]);return this.bufferNode=new et(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return sn(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return sn(this.node,e,l);let a=i[t.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function an(o){return o.children.some(e=>e instanceof Ze||!e.type.isAnonymous||an(e))}function kd(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Ol,reused:s=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new ln(t,t.length):t,d=i.types,c=0,h=0;function f(p,S,_,C,b,B){let{id:A,start:V,end:F,size:E}=r,M=h;for(;E<0;)if(r.next(),E==-1){let R=s[A];_.push(R),C.push(V-p);return}else if(E==-3){c=A;return}else if(E==-4){h=A;return}else throw new RangeError(`Unrecognized record size: ${E}`);let P=d[A],T,D,W=V-p;if(F-V<=l&&(D=x(r.pos-S,b))){let R=new Uint16Array(D.size-D.skip),N=r.pos-D.size,K=R.length;for(;r.pos>N;)K=w(D.start,R,K);T=new Ze(R,F-D.start,i),W=D.start-p}else{let R=r.pos-E;r.next();let N=[],K=[],I=A>=a?A:-1,z=0,he=F;for(;r.pos>R;)I>=0&&r.id==I&&r.size>=0?(r.end<=he-l&&(y(N,K,V,z,r.end,he,I,M),z=N.length,he=r.end),r.next()):B>2500?u(V,R,N,K):f(V,R,N,K,I,B+1);if(I>=0&&z>0&&z<N.length&&y(N,K,V,z,V,he,I,M),N.reverse(),K.reverse(),I>-1&&z>0){let Xi=m(P);T=rn(P,N,K,0,N.length,0,F-V,Xi,Xi)}else T=k(P,N,K,F-V,M-F)}_.push(T),C.push(W)}function u(p,S,_,C){let b=[],B=0,A=-1;for(;r.pos>S;){let{id:V,start:F,end:E,size:M}=r;if(M>4)r.next();else{if(A>-1&&F<A)break;A<0&&(A=E-l),b.push(V,F,E),B++,r.next()}}if(B){let V=new Uint16Array(B*4),F=b[b.length-2];for(let E=b.length-3,M=0;E>=0;E-=3)V[M++]=b[E],V[M++]=b[E+1]-F,V[M++]=b[E+2]-F,V[M++]=M;_.push(new Ze(V,b[2]-F,i)),C.push(F-p)}}function m(p){return(S,_,C)=>{let b=0,B=S.length-1,A,V;if(B>=0&&(A=S[B])instanceof re){if(!B&&A.type==p&&A.length==C)return A;(V=A.prop(Y.lookAhead))&&(b=_[B]+A.length+V)}return k(p,S,_,C,b)}}function y(p,S,_,C,b,B,A,V){let F=[],E=[];for(;p.length>C;)F.push(p.pop()),E.push(S.pop()+_-b);p.push(k(i.types[A],F,E,B-b,V-B)),S.push(b-_)}function k(p,S,_,C,b=0,B){if(c){let A=[Y.contextHash,c];B=B?[A].concat(B):[A]}if(b>25){let A=[Y.lookAhead,b];B=B?[A].concat(B):[A]}return new re(p,S,_,C,B)}function x(p,S){let _=r.fork(),C=0,b=0,B=0,A=_.end-l,V={size:0,start:0,skip:0};e:for(let F=_.pos-p;_.pos>F;){let E=_.size;if(_.id==S&&E>=0){V.size=C,V.start=b,V.skip=B,B+=4,C+=4,_.next();continue}let M=_.pos-E;if(E<0||M<F||_.start<A)break;let P=_.id>=a?4:0,T=_.start;for(_.next();_.pos>M;){if(_.size<0)if(_.size==-3)P+=4;else break e;else _.id>=a&&(P+=4);_.next()}b=T,C+=E,B+=P}return(S<0||C==p)&&(V.size=C,V.start=b,V.skip=B),V.size>4?V:void 0}function w(p,S,_){let{id:C,start:b,end:B,size:A}=r;if(r.next(),A>=0&&C<a){let V=_;if(A>4){let F=r.pos-(A-4);for(;r.pos>F;)_=w(p,S,_)}S[--_]=V,S[--_]=B-p,S[--_]=b-p,S[--_]=C}else A==-3?c=C:A==-4&&(h=C);return _}let v=[],O=[];for(;r.pos>0;)f(o.start||0,o.bufferStart||0,v,O,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:v.length?O[0]+v[0].length:0;return new re(d[o.topID],v.reverse(),O.reverse(),g)}const El=new WeakMap;function fi(o,e){if(!o.isAnonymous||e instanceof Ze||e.type!=o)return 1;let t=El.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof re)){t=1;break}t+=fi(o,i)}El.set(e,t)}return t}function rn(o,e,t,i,l,s,a,r,d){let c=0;for(let y=i;y<l;y++)c+=fi(o,e[y]);let h=Math.ceil(c*1.5/8),f=[],u=[];function m(y,k,x,w,v){for(let O=x;O<w;){let g=O,p=k[O],S=fi(o,y[O]);for(O++;O<w;O++){let _=fi(o,y[O]);if(S+_>=h)break;S+=_}if(O==g+1){if(S>h){let _=y[g];m(_.children,_.positions,0,_.children.length,k[g]+v);continue}f.push(y[g])}else{let _=k[O-1]+y[O-1].length-p;f.push(rn(o,y,k,g,O,p,_,null,d))}u.push(p+v-s)}}return m(e,t,i,l,0),(r||d)(f,u,a)}class ht{constructor(e,t,i,l,s=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new ht(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,a=e.length?e[0]:null;for(let r=0,d=0,c=0;;r++){let h=r<t.length?t[r]:null,f=h?h.fromA:1e9;if(f-d>=i)for(;a&&a.from<f;){let u=a;if(d>=u.from||f<=u.to||c){let m=Math.max(u.from,d)-c,y=Math.min(u.to,f)-c;u=m>=y?null:new ht(m,y,u.tree,u.offset+c,r>0,!!h)}if(u&&l.push(u),a.to>f)break;a=s<e.length?e[s++]:null}if(!h)break;d=h.toA,c=h.toA-h.toB}return l}}class Il{startParse(e,t,i){return typeof e=="string"&&(e=new bd(e)),i=i?i.length?i.map(l=>new tn(l.from,l.to)):[new tn(0,0)]:[new tn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class bd{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 Y({perNode:!0});class ui{constructor(e,t,i,l,s,a,r,d,c,h=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=c,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new ui(e,[],t,i,i,0,[],0,l?new Dl(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 i=e>>19,l=e&65535,{parser:s}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),c=d?this.stack[d-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let f=d?this.stack[d-1]:0,u=this.bufferBase+this.buffer.length-f;if(l<s.minRepeatTerm||e&131072){let m=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,c,m,u+4,!0)}if(e&262144)this.state=this.stack[d];else{let m=this.stack[d-3];this.state=s.getGoto(m,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,c)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,r=this.buffer.length;if(r==0&&a.parent&&(r=a.bufferBase-a.parent.bufferBase,a=a.parent),r>0&&a.buffer[r-4]==0&&a.buffer[r-1]>-1){if(t==i)return;if(a.buffer[r-2]>=t){a.buffer[r-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let r=!1;for(let d=a;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:a}=this.p;(l>this.pos||t<=a.maxNode)&&(this.pos=l,a.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,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 i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new ui(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new yd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}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 s=0,a;s<t.length;s+=2)(a=t[s+1])!=this.state&&this.p.parser.hasAction(a,e)&&l.push(t[s],a);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let a=t[s+1];l.some((r,d)=>d&1&&r==a)||l.push(t[s],a)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let a=this.split();a.pushState(s,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[l],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let i=t>>19,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=[],i=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-s;if(r>1){let d=a&65535,c=this.stack.length-r*3;if(c>=0&&e.getGoto(this.stack[c],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,s+1);if(r!=null)return r}})};return i(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 Dl(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 Dl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class yd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class pi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new pi(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 pi(this.stack,this.pos,this.index)}}function mi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,l=0;i<o.length;){let s=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){s=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class gi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Pl=new gi;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=Pl,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 i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let a=this.ranges[--l];s-=i.from-a.to,i=a}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];s+=a.from-i.to,i=a}return s}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,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}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=Pl,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 i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class xt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;xd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}xt.prototype.contextual=xt.prototype.fallback=xt.prototype.extend=!1,xt.prototype.fallback=xt.prototype.extend=!1;function xd(o,e,t,i,l,s){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let c=o[a+1];for(let m=a+3;m<c;m+=2)if((o[m+1]&r)>0){let y=o[m];if(d.allows(y)&&(e.token.value==-1||e.token.value==y||vd(y,e.token.value,l,s))){e.acceptToken(y);break}}let h=e.next,f=0,u=o[a+2];if(e.next<0&&u>f&&o[c+u*3-3]==65535){a=o[c+u*3-1];continue e}for(;f<u;){let m=f+u>>1,y=c+m+(m<<1),k=o[y],x=o[y+1]||65536;if(h<k)u=m;else if(h>=x)f=m+1;else{a=o[y+2],e.advance();continue e}}break}}function Fl(o,e,t){for(let i=e,l;(l=o[i])!=65535;i++)if(l==t)return i-e;return-1}function vd(o,e,t,i){let l=Fl(t,i,e);return l<0||Fl(t,i,o)<l}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dn=null;function $l(o,e,t){let i=o.cursor(fe.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(o.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:o.length}}class Cd{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?$l(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?$l(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 i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],a=this.start[t]+i.positions[l];if(a>e)return this.nextStart=a,null;if(s instanceof re){if(a==e){if(a<this.safeFrom)return null;let r=a+s.length;if(r<=this.safeTo){let d=s.prop(Y.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,a+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}}class Sd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new gi)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,a=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let c=0;c<s.length;c++){if(!(1<<c&a))continue;let h=s[c],f=this.tokens[c];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=a||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=a,f.context=r),f.lookAhead>f.end+25&&(d=Math.max(f.lookAhead,d)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!h.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new gi,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new gi,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let a=0;a<s.specialized.length;a++)if(s.specialized[a]==e.value){let r=s.specializers[a](this.stream.read(e.start,e.end),i);if(r>=0&&i.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,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let c=a.stateSlot(s,d?2:1);;c+=3){if(r[c]==65535)if(r[c+1]==1)c=He(r,c+2);else{l==0&&r[c+1]==2&&(l=this.putAction(He(r,c+2),t,i,l));break}r[c]==t&&(l=this.putAction(He(r,c+1),t,i,l))}return l}}class Nd{constructor(e,t,i,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 Sd(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[ui.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Cd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let r=e[a];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let a=l&&Od(l);if(a)return Ne&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ne&&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 a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,i);if(a)return Ne&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((r,d)=>d.score-r.score);i.length>a;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let r=i[a];for(let d=a+1;d<i.length;d++){let c=i[d];if(r.sameState(c)||r.buffer.length>500&&c.buffer.length>500)if((r.score-c.score||r.buffer.length-c.buffer.length)>0)i.splice(d--,1);else{i.splice(a--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].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,i){let l=e.pos,{parser:s}=this,a=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!c||(f.prop(Y.contextHash)||0)==h))return e.useNode(f,u),Ne&&console.log(a+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof re)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof re&&f.positions[0]==0)f=m;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let c=0;c<d.length;){let h=d[c++],f=d[c++],u=d[c++],m=c==d.length||!i,y=m?e:e.split(),k=this.tokens.mainToken;if(y.apply(h,f,k?k.start:y.pos,u),Ne&&console.log(a+this.stackID(y)+` (via ${h&65536?`reduce of ${s.getName(h&65535)}`:"shift"} for ${s.getName(f)} @ ${l}${y==e?"":", split"})`),m)return!0;y.pos>l?t.push(y):i.push(y)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Rl(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],c=t[(a<<1)+1],h=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Ne&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),u=h;for(let m=0;f.forceReduce()&&m<10&&(Ne&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));m++)Ne&&(u=this.stackID(f)+" -> ");for(let m of r.recoverByInsert(d))Ne&&console.log(h+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,i);this.stream.end>r.pos?(c==r.pos&&(c++,d=0),r.recoverByDelete(d,c),Ne&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Rl(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),re.build({buffer:pi.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=(dn||(dn=new WeakMap)).get(e);return t||dn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Rl(o,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==o.pos&&i.sameState(o)){e[t].score<o.score&&(e[t]=o);return}}e.push(o)}class Bd{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class ki extends Il{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 i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,c){l[r].push([d,d.deserialize(String(c))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=Y[d]);for(let c=1;c<r.length;){let h=r[c++];if(h>=0)s(h,d,r[c++]);else{let f=r[c+-h];for(let u=-h;u>0;u--)s(r[c++],d,f);c++}}}this.nodeSet=new nn(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Ol;let a=mi(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(Ll),this.states=mi(e.states,Uint32Array),this.data=mi(e.stateData),this.goto=mi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new xt(a,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,i){let l=new Nd(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let a=l[s++],r=a&1,d=l[s++];if(r&&i)return d;for(let c=s+(a>>1);s<c;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),a;;s+=3){if((a=i[s])==65535)if(i[s+1]==1)a=i[s=He(i,s+2)];else{if(i[s+1]==2)return He(i,s+2);break}if(a==t||a==0)return He(i,s+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,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=He(this.data,s+2);else break;l=t(He(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=He(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,a)=>a&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(ki.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let a=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=Ll(a),a})),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),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let a=t.indexOf(s);a>=0&&(i[a]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let a=this.dialects[t[s]],r;(r=this.data[a++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Bd(e,i,l)}static deserialize(e){return new ki(e)}}function He(o,e){return o[e]|o[e+1]<<16}function Od(o){let e=null;for(let t of o){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Ll(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Vd=0;class _e{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Vd++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof _e&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new _e(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new bi(e);return i=>i.modified.indexOf(t)>-1?i:bi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let _d=0;class bi{constructor(e){this.name=e,this.instances=[],this.id=_d++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Md(t,r.modified));if(i)return i;let l=[],s=new _e(e.name,l,e,t);for(let r of t)r.instances.push(s);let a=Td(t);for(let r of e.set)if(!r.modified.length)for(let d of a)l.push(bi.get(r,d));return s}}function Md(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Td(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function jl(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],a=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){a=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!u)throw new RangeError("Invalid path: "+l);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==l.length)break;let m=l[f++];if(f==l.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let d=s.length-1,c=s[d];if(!c)throw new RangeError("Invalid path: "+l);let h=new cn(i,a,d>0?s.slice(0,d):null);e[c]=h.sort(e[c])}}return Ad.add(e)}const Ad=new Y;class cn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,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}}cn.empty=new cn([],2,null);function zl(o,e){let t=Object.create(null);for(let s of o)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let a of s.tag)t[a.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let a=l;for(let r of s)for(let d of r.set){let c=t[d.id];if(c){a=a?a+" "+c:c;break}}return a},scope:i}}const j=_e.define,yi=j(),tt=j(),ql=j(tt),Ul=j(tt),it=j(),wi=j(it),hn=j(it),Pe=j(),ft=j(Pe),Fe=j(),$e=j(),fn=j(),qt=j(fn),xi=j(),$={comment:yi,lineComment:j(yi),blockComment:j(yi),docComment:j(yi),name:tt,variableName:j(tt),typeName:ql,tagName:j(ql),propertyName:Ul,attributeName:j(Ul),className:j(tt),labelName:j(tt),namespace:j(tt),macroName:j(tt),literal:it,string:wi,docString:j(wi),character:j(wi),attributeValue:j(wi),number:hn,integer:j(hn),float:j(hn),bool:j(it),regexp:j(it),escape:j(it),color:j(it),url:j(it),keyword:Fe,self:j(Fe),null:j(Fe),atom:j(Fe),unit:j(Fe),modifier:j(Fe),operatorKeyword:j(Fe),controlKeyword:j(Fe),definitionKeyword:j(Fe),moduleKeyword:j(Fe),operator:$e,derefOperator:j($e),arithmeticOperator:j($e),logicOperator:j($e),bitwiseOperator:j($e),compareOperator:j($e),updateOperator:j($e),definitionOperator:j($e),typeOperator:j($e),controlOperator:j($e),punctuation:fn,separator:j(fn),bracket:qt,angleBracket:j(qt),squareBracket:j(qt),paren:j(qt),brace:j(qt),content:Pe,heading:ft,heading1:j(ft),heading2:j(ft),heading3:j(ft),heading4:j(ft),heading5:j(ft),heading6:j(ft),contentSeparator:j(Pe),list:j(Pe),quote:j(Pe),emphasis:j(Pe),strong:j(Pe),link:j(Pe),monospace:j(Pe),strikethrough:j(Pe),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:xi,documentMeta:j(xi),annotation:j(xi),processingInstruction:j(xi),definition:_e.defineModifier("definition"),constant:_e.defineModifier("constant"),function:_e.defineModifier("function"),standard:_e.defineModifier("standard"),local:_e.defineModifier("local"),special:_e.defineModifier("special")};for(let o in $){let e=$[o];e instanceof _e&&(e.name=o)}zl([{tag:$.link,class:"tok-link"},{tag:$.heading,class:"tok-heading"},{tag:$.emphasis,class:"tok-emphasis"},{tag:$.strong,class:"tok-strong"},{tag:$.keyword,class:"tok-keyword"},{tag:$.atom,class:"tok-atom"},{tag:$.bool,class:"tok-bool"},{tag:$.url,class:"tok-url"},{tag:$.labelName,class:"tok-labelName"},{tag:$.inserted,class:"tok-inserted"},{tag:$.deleted,class:"tok-deleted"},{tag:$.literal,class:"tok-literal"},{tag:$.string,class:"tok-string"},{tag:$.number,class:"tok-number"},{tag:[$.regexp,$.escape,$.special($.string)],class:"tok-string2"},{tag:$.variableName,class:"tok-variableName"},{tag:$.local($.variableName),class:"tok-variableName tok-local"},{tag:$.definition($.variableName),class:"tok-variableName tok-definition"},{tag:$.special($.variableName),class:"tok-variableName2"},{tag:$.definition($.propertyName),class:"tok-propertyName tok-definition"},{tag:$.typeName,class:"tok-typeName"},{tag:$.namespace,class:"tok-namespace"},{tag:$.className,class:"tok-className"},{tag:$.macroName,class:"tok-macroName"},{tag:$.propertyName,class:"tok-propertyName"},{tag:$.operator,class:"tok-operator"},{tag:$.comment,class:"tok-comment"},{tag:$.meta,class:"tok-meta"},{tag:$.invalid,class:"tok-invalid"},{tag:$.punctuation,class:"tok-punctuation"}]);const Ed=jl({String:$.string,Number:$.number,"True False":$.bool,PropertyName:$.propertyName,Null:$.null,",":$.separator,"[ ]":$.squareBracket,"{ }":$.brace}),Id=ki.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:[Ed],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});class X{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,i){[e,t]=vt(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Re.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vt(this,e,t);let i=[];return this.decompose(e,t,i,0),Re.from(i,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),i=this.length-this.scanIdentical(e,-1),l=new Ut(this),s=new Ut(e);for(let a=t,r=t;;){if(l.next(a),s.next(a),a=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Ut(this,e)}iterRange(e,t=this.length){return new Hl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kl(i)}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]?X.empty:e.length<=32?new ae(e):Re.from(ae.split(e,[]))}}class ae extends X{constructor(e,t=Dd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.text[s],r=l+a.length;if((t?i:r)>=e)return new Pd(l,r,i,a);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new ae(Wl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),r=vi(s.text,a.text.slice(),0,s.length);if(r.length<=32)i.push(new ae(r,a.length+s.length));else{let d=r.length>>1;i.push(new ae(r.slice(0,d)),new ae(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);[e,t]=vt(this,e,t);let l=vi(this.text,vi(i.text,Wl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new ae(l,s):Re.from(ae.split(l,[]),s)}sliceString(e,t=this.length,i=`
1
+ (function(Z,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("unione-base-vue"),require("ant-design-vue"),require("lodash-es"),require("vue-codemirror"),require("@codemirror/lang-javascript"),require("@ant-design/icons-vue"),require("uuid")):typeof define=="function"&&define.amd?define(["exports","vue","unione-base-vue","ant-design-vue","lodash-es","vue-codemirror","@codemirror/lang-javascript","@ant-design/icons-vue","uuid"],n):(Z=typeof globalThis<"u"?globalThis:Z||self,n(Z.index={},Z.Vue,Z.UnioneBaseVue,Z.antDesignVue,Z.lodashEs,Z.vueCodemirror,Z.langJavascript,Z.iconsVue,Z.uuid))})(this,function(Z,n,K,G,ia,Rt,na,We,la){"use strict";const sa={isDebug:!0,axios:{form:"/portal"},listPageUrl:"/unione/page/list",addPageUrl:"/unione/page/add",editPageUrl:"/unione/page/edit",viewPageUrl:"/unione/page/view",formRules:[]},Ji=n.ref(sa);function Ae(o){return o&&(Ji.value=K.utils.obj.ext(Ji.value,o)),Ji.value}const oa={...{...{submit:"提交","submit.ok":"已提交","submit.error":"提交失败","confirm.ok":"确定","confirm.cancel":"取消","global.setting.title":"设置"},...{"pages.home":"首页"},...{"pages.layouts.userLayout.title":"user layout"}}},aa={...{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"}},ra=n.ref([oa,aa]);function da(o,e){return K.locales.loadLanguage(o,()=>new Promise((t,i)=>{const l=ra.value.filter(s=>s.localeName==o);if(e)if(typeof e=="function")e().then(s=>{if(l.length==0){const a={...s,localeName:o};t(a)}else{const a={...l[0],...s};t(a)}});else if(l.length==0){const s={...e,localeName:o};t(s)}else{const s={...l[0],...e};t(s)}else l.length>0?t(l[0]):i("local language not defined ,lang:"+o)}))}const Zi={...K.locales};Zi.loadLanguage=da;class ca{$psn;$pid;$store;$forms;$model;$params;$refObj;$refData;constructor(e,t){this.$psn=n.ref(e),this.$pid=n.ref(""),this.$store=n.ref({}),this.$forms=n.ref({}),this.$params=n.ref({}),this.$refObj=n.ref({}),this.$refData=n.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,i){}use(e,t,i){let l=this.$store.value[e];return l||(l=new ha(e,t,this.$model),this.$store.value[e]=l,l.$params=this.$params.value),i&&(l.$form=i,this.$forms.value[e]=i),l}useForm(e,t,i){const l=this.use(e,"form",t);return this.$psn.value==e&&this.$pid.value&&l.detail(this.$pid.value).then(s=>{i&&i(s)}),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 ha{$dsn;$type;$data;$dialog;$model;$form;$params;$store;constructor(e,t,i){this.$dsn=e,this.$type=t,this.$data=n.ref(t=="form"?{}:[]),this.$dialog=K.useDialog(),this.$model=i,this.$store={controller:"/api/data/storage/v1"}}$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(i=>{e[i.name]==null&&e[i.name]==null&&(this.$params[i.name]!=null&&this.$params[i.name]!=null?e[i.alias||i.name]=this.$params[i.name]:i.value!=null&&i.value!=null&&(e[i.alias||i.name]=i.value))});else if(this.$params)for(const i in this.$params)e[i]==null&&e[i]==null&&this.$params[i]!=null&&this.$params[i]!=null&&(e[i]=this.$params[i]);return e}find(e){const t=this.$store.controller+"/find";return this.$isStorage()&&(e.dsn=this.$dsn+(this.$model!="run"?"@dev":"")),e.body=this.$processParams(e.body,this.$store.findParams),new Promise((i,l)=>{const s=G.message.loading("数据加载中...");K.axios.form({url:t,method:"post",data:e}).then(a=>{a.success?(this.$data.value=a.body,i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据加载失败,model sn:"+this.$dsn,url:t,params:e,err:a})}).finally(()=>{s()})})}save(e){const t=this.$store.controller+"/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((i,l)=>{const s=G.message.loading("数据提交中...");K.axios.form({url:t,method:"post",data:this.$isStorage()?e:e.data}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body||{}),a.silence||G.message.success(a.message),i(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),l({info:"数据保存失败,model sn:"+this.$dsn,url:t,data:e,err:a})}).finally(()=>{s()})})}loadByIds(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/loadByIds";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据加载失败,model sn:"+this.$dsn,ids:e,err:a})}).finally(()=>{l()})})}detail(e){return new Promise((t,i)=>{const l=G.message.loading("数据加载中..."),s=this.$store.controller+"/detail";K.axios.form({url:s,method:"post",data:this.$isStorage()?{id:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?(this.$type=="form"&&(this.$data.value=a.body),t(a)):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"加载数据详情失败,model sn:"+this.$dsn,url:s,id:e,err:a})}).finally(()=>{l()})})}deleteByIds(e){return new Promise((t,i)=>{this.$dialog.confirm({content:"确定要删除选中记录么?共"+e.length+"条。",onOk:()=>{const l=G.message.loading("数据处理中..."),s=this.$store.controller+"/delete";K.axios.form({url:s,method:"post",data:this.$isStorage()?{ids:e,dsn:this.$dsn+(this.$model!="run"?"@dev":"")}:e}).then(a=>{a.success?t(a):(a.silence||this.$dialog.error({content:a.message||"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,result:a}))}).catch(a=>{this.$dialog.error({content:"未知错误,请联系管理员"}),i({info:"数据删除失败,model sn:"+this.$dsn,url:s,ids:e,err:a})}).finally(()=>{l()})}})})}}class fa{$event;$onces;$delayEmit;constructor(){this.$event=n.ref({}),this.$onces=n.ref({}),this.$delayEmit=n.ref({})}$on(e,t){if(this.$event.value[e]=t,this.$delayEmit.value[e]){const i=this.$delayEmit.value[e];t(i)}}$emit(e,t){if(this.$onces.value[e]){const i=this.$onces.value[e];delete this.$onces.value[e],i(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 wt{define;ebus;model;$widgetList;$widgetMap;$dataManager;$axiosProccess;$dialog;constructor(e={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]}}){const t=e.configs||{};this.model=n.ref("run"),this.define=n.ref(e),this.ebus=new fa,this.$widgetList=n.ref([]),this.$widgetMap=n.ref({}),this.$dataManager=new ca(t.dsnList?t.dsnList[0]:"",this.model),this.$axiosProccess=n.ref({}),this.$dialog=K.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.loadConfig(t.configs));return}const i=sessionStorage.getItem("PAGE_DEFINE:"+e);if(i&&this.model.value=="run"){this.define.value=JSON.parse(i),this.loadConfig(this.define.value.configs),console.log("从会话缓存中加载页面sn:"+e+",define:",this.define.value);return}K.axios.form({url:"/api/page/define/load/"+e,method:"post"}).then(l=>{l.success?(this.define.value=l.body,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 i={...this.define.value.configs||{},widgets:this.$widgetList.value,dsnList:this.$dataManager.dsnList()},l={...this.define.value};l.configs=JSON.stringify(i),K.axios.form({url:"/api/page/define/save",method:"post",data:l}).then(s=>{this.$axiosProccess.value.save=!1,s.success?(G.message.success(s.message),this.define.value=s.body,sessionStorage.setItem("PAGE_DEFINE:"+this.define.value.sn,JSON.stringify(this.define.value)),this.load(this.define.value.sn,this.define.value),e(s.body)):(this.$dialog.error({content:s.message}),t())}).catch(s=>{console.error("页面配置保存失败",s),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 i={...t,wid:e};this.$widgetMap.value[e]||(this.$widgetList.value.push(i),i.configs?.widgets&&this.$processWidget(i.configs.widgets)),this.$widgetMap.value[e]=i}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:"+ia.uniqueId()),this.$widgetMap.value[t.wid]=t,t.configs?.widgets&&this.$processWidget(t.configs.widgets)})}dataManager(){return this.$dataManager}}const ua={class:"widget-setting-dialog"},pa=n.defineComponent({__name:"widget",props:{model:{type:String,required:!1},settingTitle:{type:String,default:"组件设置"},custome:{type:Boolean,default:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=e,i=n.ref(),l=n.ref(!1);function s(){i.value&&(l.value=!0),t("setting")}function a(){t("saving"),l.value=!1}return(r,d)=>{const c=n.resolveComponent("SettingOutlined"),h=n.resolveComponent("a-tooltip"),f=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-widget",o.model])},[n.createVNode(h,{title:o.settingTitle},{default:n.withCtx(()=>[o.model=="edit"&&(r.$slots["widget-setting"]||o.custome)?(n.openBlock(),n.createBlock(c,{key:0,class:"widget-setting",onClick:s})):n.createCommentVNode("",!0)]),_:1},8,["title"]),n.renderSlot(r.$slots,"default",{},void 0,!0),o.model=="edit"&&r.$slots["widget-setting"]?(n.openBlock(),n.createBlock(f,{key:0,title:o.settingTitle,ref_key:"settingModal",ref:i,open:l.value,"onUpdate:open":d[0]||(d[0]=p=>l.value=p),centered:"",width:"80%",onOk:a},{default:n.withCtx(()=>[n.createElementVNode("div",ua,[n.renderSlot(r.$slots,"widget-setting",{},void 0,!0)])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),ee=(o,e)=>{const t=o.__vccOpts||o;for(const[i,l]of e)t[i]=l;return t},rt=ee(pa,[["__scopeId","data-v-3a88c0c0"]]),ma={key:0},ga=["onClick"],di=ee(n.defineComponent({__name:"btnSetting",props:{preset:{type:Array,default(){return[]}}},setup(o,{expose:e}){const t=o,i=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:g=>{l.value.selectedRowKeys=g}}),s={mounted:g=>g.focus()},a=n.ref({});function r(){const g=Object.keys(a.value);if(g.length)for(let m in g){const S=k.value.form.action.params[m];S&&a.value[m]&&Object.keys(a.value[m]).forEach(_=>{S[_]=a.value[m][_]})}a.value={}}function d(g,m,S){r();const _={};_[S]=m[S]||"",S=="showIndex"&&(_[S]=m.show?.query?.index),a.value[g]=_}function c(g,m,S){if(!m||!S){a.value={};return}const _=a.value[g][S];m[S]=_,a.value={}}function h(){k.value.form.action.params.push({title:"新建",name:"",value:""})}function f(){}const p=n.ref(""),u=n.ref({title:[{required:!0,message:"按钮标题不能为空"}],name:[{required:!0,message:"按钮名称不能为空"},{validator:(g,m)=>p.value!=m&&t.preset.includes(m)?Promise.reject("预设按钮名称,请使用其他名称,["+t.preset.join(",")+"]"):Promise.resolve(),trigger:"change"}]}),y=n.ref([na.javascript()]),k=n.ref({title:"按钮设置",visible:!1,form:{},helps:{}}),x=n.ref();function w(g,m,S={}){g=JSON.parse(JSON.stringify(g)),g.event||(g.event={}),g.props||(g.props={}),g.action||(g.action={}),Object.keys(g.action).includes("maskClosable")||(g.action.maskClosable=!0),g.action.params||(g.action.params=[]),p.value=g.name,k.value.form=g,k.value.helps=S,k.value.visible=!0,x.value=m}const v=n.ref(null);function O(){v.value&&v.value.validate().then(()=>{k.value.visible=!1,x.value(k.value.form)})}return e({open:w,close}),(g,m)=>{const S=n.resolveComponent("a-input"),_=n.resolveComponent("a-form-item"),C=n.resolveComponent("a-select"),b=n.resolveComponent("a-input-number"),B=n.resolveComponent("a-checkbox"),T=n.resolveComponent("a-tab-pane"),V=n.resolveComponent("a-switch"),F=n.resolveComponent("a-button"),D=n.resolveComponent("a-divider"),P=n.resolveComponent("ToolOutlined"),E=n.resolveComponent("a-tooltip"),A=n.resolveComponent("a-table"),M=n.resolveComponent("a-tabs"),z=n.resolveComponent("a-form"),$=n.resolveComponent("a-modal");return n.openBlock(),n.createBlock($,{visible:k.value.visible,"onUpdate:visible":m[23]||(m[23]=N=>k.value.visible=N),title:k.value.title,centered:"",width:"50%",onOk:O},{default:n.withCtx(()=>[n.createVNode(z,{name:"basic",ref_key:"form",ref:v,rules:u.value,model:k.value.form,"label-col":{span:5},"wrapper-col":{span:19},autocomplete:"off",class:"form-mix btn-setting-form"},{default:n.withCtx(()=>[n.createVNode(M,null,{default:n.withCtx(()=>[n.createVNode(T,{key:"base",tab:"基本设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"操作标题",required:"",name:"title"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.title,"onUpdate:value":m[0]||(m[0]=N=>k.value.form.title=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"操作名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.name,"onUpdate:value":m[1]||(m[1]=N=>k.value.form.name=N),disabled:t.preset.includes(k.value.form.name)},null,8,["value","disabled"])]),_:1}),n.createVNode(_,{label:"操作图标"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.icon,"onUpdate:value":m[2]||(m[2]=N=>k.value.form.icon=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.type,"onUpdate:value":m[3]||(m[3]=N=>k.value.form.type=N),allowClear:"",options:[{value:"primary",label:"主要按钮"},{value:"ghost",label:"幽灵按钮"},{value:"dashed",label:"虚线按钮"},{value:"link",label:"连接按钮"},{value:"text",label:"文本按钮"},{value:"default",label:"默认按钮"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.index,"onUpdate:value":m[4]||(m[4]=N=>k.value.form.index=N)},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮大小"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.size,"onUpdate:value":m[5]||(m[5]=N=>k.value.form.size=N),options:[{value:"small",label:"小"},{value:"middle",label:"中"},{value:"large",label:"大"}]},null,8,["value"])]),_:1}),n.createVNode(_,{label:"按钮特性"},{default:n.withCtx(()=>[n.createVNode(B,{checked:k.value.form.props.block,"onUpdate:checked":m[6]||(m[6]=N=>k.value.form.props.block=N)},{default:n.withCtx(()=>m[24]||(m[24]=[n.createTextVNode("自适应 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.danger,"onUpdate:checked":m[7]||(m[7]=N=>k.value.form.props.danger=N)},{default:n.withCtx(()=>m[25]||(m[25]=[n.createTextVNode("危险 ")])),_:1},8,["checked"]),n.createVNode(B,{checked:k.value.form.props.ghost,"onUpdate:checked":m[8]||(m[8]=N=>k.value.form.props.ghost=N)},{default:n.withCtx(()=>m[26]||(m[26]=[n.createTextVNode("幽灵 ")])),_:1},8,["checked"])]),_:1})]),_:1}),n.createVNode(T,{key:"action",tab:"响应设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"响应方式",required:""},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.type,"onUpdate:value":m[9]||(m[9]=N=>k.value.form.action.type=N),options:[{value:"link",label:"连接"},{value:"route",label:"路由"},{value:"drawer",label:"抽屉"},{value:"dialog",label:"对话框"}]},null,8,["value"])]),_:1}),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:0,label:"页面编码",help:"根据该页面编码渲染页面内容"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.psn,"onUpdate:value":m[10]||(m[10]=N=>k.value.form.action.psn=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:1,label:"组件名称",help:"组件方式渲染,Vue全局注册的组件名称,且监听params参数,psn参数"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.component,"onUpdate:value":m[11]||(m[11]=N=>k.value.form.action.component=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(_,{label:"连接地址"},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.href,"onUpdate:value":m[12]||(m[12]=N=>k.value.form.action.href=N)},null,8,["value"])]),_:1}),["link","route"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:2,label:"连接方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.target,"onUpdate:value":m[13]||(m[13]=N=>k.value.form.action.target=N),options:[{value:"_blank",label:"新卡片页"},{value:"_self",label:"当前页面"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:3,label:"抽屉位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:k.value.form.action.position,"onUpdate:value":m[14]||(m[14]=N=>k.value.form.action.position=N),options:[{value:"left",label:"左侧"},{value:"right",label:"右侧"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:4,label:"显示标题",required:""},{default:n.withCtx(()=>[n.createVNode(S,{value:k.value.form.action.title,"onUpdate:value":m[15]||(m[15]=N=>k.value.form.action.title=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:5,label:"蒙层关闭"},{default:n.withCtx(()=>[n.createVNode(V,{checked:k.value.form.action.maskClosable,"onUpdate:checked":m[16]||(m[16]=N=>k.value.form.action.maskClosable=N),"checked-children":"开","un-checked-children":"关"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),["drawer","dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:6,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.action.width,"onUpdate:value":m[17]||(m[17]=N=>k.value.form.action.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["dialog"].includes(k.value.form.action.type)?(n.openBlock(),n.createBlock(_,{key:7,label:"显示高度"},{default:n.withCtx(()=>[n.createVNode(b,{value:k.value.form.action.height,"onUpdate:value":m[18]||(m[18]=N=>k.value.form.action.height=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(D,{orientation:"left"},{default:n.withCtx(()=>[m[29]||(m[29]=n.createTextVNode("参数列表 ")),n.createVNode(F,{size:"small",class:"param-btn",onClick:h},{default:n.withCtx(()=>m[27]||(m[27]=[n.createTextVNode("添加")])),_:1}),n.createVNode(F,{size:"small",class:"param-btn",danger:"",onClick:f},{default:n.withCtx(()=>m[28]||(m[28]=[n.createTextVNode("删除")])),_:1})]),_:1}),n.createVNode(A,{columns:i.value,"data-source":k.value.form.action.params,bordered:"",pagination:!1,"row-selection":l.value,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:N})=>[["name","title"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",ma,[n.createVNode(P),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0),["value"].includes(N.key)?(n.openBlock(),n.createBlock(E,{key:1,title:"支持常量和变量,变量使用{row.属性}方式获取"},{default:n.withCtx(()=>[n.createElementVNode("span",null,[n.createVNode(P),n.createTextVNode(" "+n.toDisplayString(N.title),1)])]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:W,record:I,index:q})=>[["name","title","value"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!a.value[q]||!Object.keys(a.value[q]).includes(N.dataIndex))&&!W&&"empty"]),onClick:he=>d(q,I,N.dataIndex)},[a.value[q]&&Object.keys(a.value[q]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(S,{key:0,value:a.value[q][N.dataIndex],"onUpdate:value":he=>a.value[q][N.dataIndex]=he,onBlur:he=>c(q,I,N.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[s]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(W),1)],64))],10,ga)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])]),_:1}),n.createVNode(T,{key:"event",tab:"事件设置"},{default:n.withCtx(()=>[n.createVNode(_,{label:"点击事件",help:k.value.helps.clickScript||"点击事件处理脚本,上下文参数:ctx,当前按钮对象:btn,当前事件对象:event,返回false则不触发默认逻辑"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.clickScript,"onUpdate:modelValue":m[19]||(m[19]=N=>k.value.form.event.clickScript=N),placeholder:"请输入点击事件处理脚本",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"禁用逻辑",help:k.value.helps.disableScript||"按钮禁用逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回true禁用,否则可用"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.disableScript,"onUpdate:modelValue":m[20]||(m[20]=N=>k.value.form.event.disableScript=N),placeholder:"请输入按钮禁用逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"显示逻辑",help:k.value.helps.visibleScript||"按钮显示逻辑控制脚本,上下文参数:ctx,当前按钮对象:btn,返回false隐藏,否则可见"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.visibleScript,"onUpdate:modelValue":m[21]||(m[21]=N=>k.value.form.event.visibleScript=N),placeholder:"请输入按钮显示逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"]),n.createVNode(_,{label:"动态标题",help:k.value.helps.titleScript||"按钮显示标题控制脚本,上下文参数:ctx,当前按钮对象:btn"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:k.value.form.event.titleScript,"onUpdate:modelValue":m[22]||(m[22]=N=>k.value.form.event.titleScript=N),placeholder:"请输入按钮动态标题逻辑",style:{height:"250px"},autofocus:!0,"indent-with-tab":!0,tabSize:8,extensions:y.value,scrollbarStyle:null},null,8,["modelValue","extensions"])]),_:1},8,["help"])]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["visible","title"])}}}),[["__scopeId","data-v-75055a2b"]]),ka=["src"],ba=["src"],ya=ee(n.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(o,{emit:e}){const t=Ae(),i=o,l=K.useSession();n.watch(()=>i.widget?.event,()=>{a()}),n.onMounted(()=>{a()});const s=n.ref({});function a(){i.widget?.event&&(i.widget.event.clickScript?s.value.click=new Function("ctx","btn","event",i.widget.event.clickScript):i.widget.event.click&&(s.value.click=i.widget.event.click),i.widget.event.disableScript?s.value.disable=new Function("ctx","btn",i.widget.event.disableScript):i.widget.event.disable&&(s.value.disable=i.widget.event.disable),i.widget.event.visibleScript?s.value.visible=new Function("ctx","btn",i.widget.event.visibleScript):i.widget.event.visible&&(s.value.visible=i.widget.event.visible),i.widget.event.titleScript?s.value.title=new Function("ctx","btn",i.widget.event.titleScript):i.widget.event.title&&(s.value.title=i.widget.event.title))}const r=n.computed(()=>s.value.title?s.value.title(p.value,i.widget):i.widget.title),d=n.computed(()=>s.value.visible?s.value.visible(p.value,i.widget)!=!1:!0),c=n.computed(()=>i.disabled?!0:s.value.disable?s.value.disable(p.value,i.widget):!1),h=n.ref(null);function f(){h.value?.open(i.widget,O=>{console.log("btn props",O),Object.keys(O).forEach(g=>{i.widget[g]=O[g]}),console.log("props btn",i.widget)})}const p=n.computed(()=>({...i.ctx,user:l.getPrincipal(),token:l.getToken()})),u=n.ref({open:!1}),y=n.computed(()=>{if(i.widget.action?.href){let O=i.widget.action.href;const g=O.matchAll("{[a-zA-Z.]*}"),m=[];let S=null;for(;S=g.next();){if(S&&S.value&&S.value[0]){let _=S.value[0].substring(1,S.value[0].length-1);m.includes(_)||m.push(_)}if(S.done)break}if(m.length>0)for(let _=0;_<m.length;_++){let C=m[_],b=K.utils.obj.getValue(p.value,C);b?b instanceof Object?O=O.replaceAll("{"+C+"}",JSON.stringify(b)):Array.isArray(b)?O=O.replaceAll("{"+C+"}",b.join(",")):O=O.replaceAll("{"+C+"}",b):O=O.replaceAll("{"+C+"}","")}return O}return""}),k=n.computed(()=>{const O={};if(i.widget.action?.href){let g=i.widget.action.href;const m=g.matchAll("{[a-zA-Z0-9.]*}"),S=[];let _=null;for(;_=m.next();){if(_&&_.value&&_.value[0]){let b=_.value[0].substring(1,_.value[0].length-1);S.includes(b)||S.push(b)}if(_.done)break}if(S.length>0)for(let b=0;b<S.length;b++){let B=S[b],T=K.utils.obj.getValue(p.value,B);T?T instanceof Object?g=g.replaceAll("{"+B+"}",JSON.stringify(T)):Array.isArray(T)?g=g.replaceAll("{"+B+"}",T.join(",")):g=g.replaceAll("{"+B+"}",T):g=g.replaceAll("{"+B+"}","")}const C=g.split("?")[1];C&&C.split("&").forEach(b=>{const B=b.split("=");B[0]&&B[1]&&(O[B[0]]=B[1])})}return i.widget.action?.params&&i.widget.action.params.filter(g=>g.value+"").forEach(g=>{if(new RegExp("{[a-zA-Z0-9.]*}").test(g.value)){let S=K.utils.obj.getValue(p.value,g.value);O[g.name]=S}else O[g.name]=g.value}),O}),x=e,w=n.inject("router");function v(O){t.isDebug&&console.log("unione btn click",i.widget,O),!(s.value.click&&s.value.click(p.value,i.widget,O)==!1)&&(i.widget.action?.type=="drawer"||i.widget.action?.type=="dialog"?u.value.open=!0:i.widget.action?.type=="route"&&i.widget.action?.href&&w.push({path:i.widget.action.href,query:k.value}),x("click",{btn:i.widget,event:O}))}return(O,g)=>{const m=n.resolveComponent("a-button"),S=n.resolveComponent("a-drawer"),_=n.resolveComponent("a-modal");return d.value?(n.openBlock(),n.createBlock(rt,{key:0,class:n.normalizeClass(["unione-btn",o.widget.props?.block&&"unione-btn-block"]),model:o.editor?.model.value,onSetting:f,custome:!0,"setting-title":"按钮设置"},{default:n.withCtx(()=>[n.createVNode(m,n.mergeProps({disabled:c.value,size:o.widget.size||"small",type:o.type||o.widget.type,shape:o.widget.shape,class:"unione-btn-"+o.widget.name,loading:o.widget.loading,target:o.widget.action?.target,title:o.widget.tooltip,onClick:v},o.widget.props),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value)+" ",1)]),_:2},[o.widget.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(o.widget.icon)))]),key:"0"}:void 0]),1040,["disabled","size","type","shape","class","loading","target","title"]),o.widget.action?.type=="drawer"?(n.openBlock(),n.createBlock(S,{key:0,open:u.value.open,"onUpdate:open":g[0]||(g[0]=C=>u.value.open=C),title:o.widget.action?.title,placement:o.widget.action?.position,maskClosable:o.widget.action?.maskClosable,width:o.widget.action?.width,bodyStyle:{padding:0,overflow:!o.widget.action.component||o.widget.action.component=="iframe"?"hidden":"auto"}},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:y.value},null,8,ka)):n.createCommentVNode("",!0)]),_:1},8,["open","title","placement","maskClosable","width","bodyStyle"])):n.createCommentVNode("",!0),o.widget.action?.type=="dialog"?(n.openBlock(),n.createBlock(_,{key:1,open:u.value.open,"onUpdate:open":g[1]||(g[1]=C=>u.value.open=C),title:o.widget.action?.title,width:o.widget.action?.width,maskClosable:o.widget.action?.maskClosable,centered:"",footer:null},{default:n.withCtx(()=>[!o.widget.action.component||o.widget.action.component=="iframe"?(n.openBlock(),n.createElementBlock("iframe",{key:0,class:"unione-iframe unione-btn-iframe",src:y.value,style:n.normalizeStyle({height:o.widget.action?.height?o.widget.action?.height+"px":""})},null,12,ba)):n.createCommentVNode("",!0)]),_:1},8,["open","title","width","maskClosable"])):n.createCommentVNode("",!0),n.createVNode(di,{ref_key:"btnSetting",ref:h,preset:i.preset},null,8,["preset"])]),_:1},8,["class","model"])):n.createCommentVNode("",!0)}}}),[["__scopeId","data-v-42bd8785"]]),wa={key:0,class:"unione-widget-empty-tip"},xa=ee(n.defineComponent({__name:"tabs",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},setup(o){const e=o,t=n.ref(),i=n.computed(()=>e.editor?.widget(e.wid)||e.widget);return(l,s)=>{const a=n.resolveComponent("a-tab-pane"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-tabs"]),model:e.editor?.model},{default:n.withCtx(()=>[i.value?(n.openBlock(),n.createBlock(r,{key:0,activeKey:t.value,"onUpdate:activeKey":s[0]||(s[0]=d=>t.value=d)},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.chidlren,(d,c)=>(n.openBlock(),n.createBlock(a,{key:c,class:"unione-layout-tab-pane"},{tab:n.withCtx(()=>[n.createElementVNode("span",null,[d.icon?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.icon),{key:0})):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(d.title),1)])]),default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.chidlren,(h,f)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(h.widget),{key:f,wid:h.wid,editor:e.editor,widget:h},null,8,["wid","editor","widget"]))),128)),!d.chidlren||!d.chidlren.length?(n.openBlock(),n.createElementBlock("div",wa,n.toDisplayString(d.emptyTips),1)):n.createCommentVNode("",!0)]),_:2},1024))),128))]),_:1},8,["activeKey"])):n.createCommentVNode("",!0)]),_:1},8,["model"])}}}),[["__scopeId","data-v-7b565c89"]]),va={class:"title"},Ca={class:"text"},Sa={key:0,class:"reactive"},Na={key:1,class:"opts"},Ba={class:"warp"},Oa=ee(n.defineComponent({__name:"section",props:n.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(o){const e=o,t=n.computed(()=>e.editor?.widget(e.wid)||e.widget),i=n.computed(()=>t.value?.title||e.title),l=n.computed(()=>t.value?.icon||e.icon),s=n.computed(()=>t.value?.type||e.type),a=n.useModel(o,"modelValue");function r(){e.reactive&&(a.value=!a.value)}return(d,c)=>(n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-layout-section",a.value?"open":"close"]),model:e.editor?.model},{default:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["head",o.location,o.reactive&&"reactive"]),onClick:r},[n.createElementVNode("div",va,[s.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["type",s.value])},null,2)):n.createCommentVNode("",!0),l.value?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.value),{key:1,class:"icon"})):n.createCommentVNode("",!0),n.createElementVNode("span",Ca,n.toDisplayString(i.value),1)]),o.reactive?(n.openBlock(),n.createElementBlock("div",Sa,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(a.value?"UpOutlined":"DownOutlined")))])):n.createCommentVNode("",!0),o.location=="left"?(n.openBlock(),n.createElementBlock("div",Na,[n.renderSlot(d.$slots,"opts",{},void 0,!0)])):n.createCommentVNode("",!0)],2),n.withDirectives(n.createElementVNode("div",Ba,[n.renderSlot(d.$slots,"default",{},void 0,!0)],512),[[n.vShow,a.value]])]),_:3},8,["class","model"]))}}),[["__scopeId","data-v-e75e9a84"]]),Va={class:"unione-props-setting unione-form-setting"},_a={class:"unione-form-btns"},Ma={key:0},Ta=["onClick"],Aa={class:"field-txt"},Ea=["onClick"],Ia={key:1,class:"field-txt"},Da=["onClick"],Pa={key:0,class:"field-txt"},Fa={key:3,class:"edit-field"},$a={key:0},Ra=["onClick"],La=ee(n.defineComponent({__name:"formSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+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"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.settings||(C.configs.settings={}),C.configs.settings.btns||(C.configs.settings.btns=[]),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(b=>({value:b.sn,label:b.title+"("+b.name+")"}))),s=n.computed(()=>{const C=i.value.configs.settings.btns,b=C.map(B=>B.name);if(!b.includes("save")){const B={title:"保存",type:"primary",index:0,visible:!0,name:"save"};C.splice(B.index,0,B)}if(!b.includes("submit")){const B={title:"提交",type:"primary",index:1,visible:!0,name:"submit"};let T=B.index||1;C.splice(T,0,B)}if(!b.includes("reset")){const B={title:"重置",type:"default",index:2,visible:!0,props:{danger:!0},name:"reset"};C.splice(B.index,0,B)}if(!b.includes("back")){const B={title:"返回",type:"default",index:3,visible:!0,name:"back"};C.splice(B.index,0,B)}return C}),a=n.ref(null);function r(C){a.value&&a.value.open(C,b=>{b.visible=!0,Object.keys(b).forEach(B=>{C[B]=b[B]}),i.value.configs.settings.btns.sort((B,T)=>{const V=B.index||1,F=T.index||1;return V-F}),i.value.configs.settings.btns=[...i.value.configs.btns]})}function d(){const C=i.value.configs.settings.btns.length+1;let b={title:"新增",name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};b.name="new_"+i.value.configs.settings.btns.length;const B=i.value.configs.settings.btns.filter(T=>T.name==b.name).length;B>0&&(b.name=b.name+B),i.value.configs.settings.btns.push(b),e.editor.widget(e.wid,i.value),a.value.open(b,T=>{Object.keys(T).forEach(V=>{b[V]=T[V]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(C){const b=()=>{if(["save","submit","reset","back"].includes(C.name))C.visible=!1,i.value.configs.settings.btns=[...i.value.configs.settings.btns];else{const B=[];i.value.configs.settings.btns.forEach(T=>{T.name!=C.name&&B.push(T)}),i.value.configs.settings.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{b()}})}const h=n.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:C=>{const b=h.value.widgets.filter(B=>B.value==C);return b[0]?b[0].label:C},toSetting:()=>{}}),f=n.ref({visible:!1,field:{},props:{},showInfo:C=>{let b="";return C.rules&&(b=C.rules.filter(B=>B.enable).length||""),b&&(b="("+b+")"),b},toSetting:()=>{const C=f.value.props,b={name:"range",trigger:C.trigger,whitespace:C.whitespace,message:C.rangeMessage};C.rangeMin!=null&&C.rangeMin!=null&&(b.min=C.rangeMin,b.enable=!0),C.rangeMax!=null&&C.rangeMax!=null&&(b.max=C.rangeMax,b.enable=!0);const B={name:"reg",trigger:C.trigger,whitespace:C.whitespace,message:C.regMessage};C.regExpress&&(B.pattern=C.regExpress,B.enable=!0),f.value.field.rules=[b,B],f.value.visible=!1,f.value.props={},console.log("rule",f.value.field.rules)}});function p(C){f.value.visible=!0,f.value.field=C;const b=C.rules||[],B={trigger:"change",whitespace:!0};b.forEach(T=>{T.name=="reg"&&(B.trigger=T.trigger,B.whitespace=T.whitespace,B.regExpress=T.pattern,B.regMessage=T.message),T.name=="range"&&(B.rangeMin=T.min,B.rangeMax=T.max,B.rangeMessage=T.message)}),f.value.props=B}const u=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{u.value.visible=!1}});function y(C,b){const B=v.value.filter(V=>V.name==C.name);B.forEach(V=>{b!="isSort"?V[b]=!0:V[b]=!V[b]});const T=B[0];if(!(!T||b=="isSort")){switch(u.value.prop=b,u.value.field=C,T.show||(T.show={}),b){case"isQuery":T.show.query||(T.show.query={}),u.value.show=T.show.query,u.value.title=`查询设置/${C.title}(${C.name})`;break;case"isForm":T.show.form||(T.show.form={}),u.value.show=T.show.form,u.value.title=`表单设置/${C.title}(${C.name})`;break;case"isView":T.show.view||(T.show.view={}),u.value.show=T.show.view,u.value.title=`详情设置/${C.title}(${C.name})`;break;case"isList":T.show.list||(T.show.list={}),u.value.show=T.show.list,u.value.title=`列头设置/${C.title}(${C.name})`;break}u.value.visible=!0}}const k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(C,b)=>{k.value.convert.options.splice(C,1)},toSetting:()=>{k.value.visible=!1}});function x(C){k.value.visible=!0,k.value.field=C,k.value.convert=C.convert||{}}const w=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),v=n.computed(()=>w.value.fields?.length?w.value.fields:[]),O={mounted:C=>C.focus()},g=n.ref({});function m(C,b){const B={};b=="convertName"?B[b]=C.convert?.type:B[b]=C[b]||"",g.value={},g.value[C.name]=B}function S(C,b){{g.value={};return}}function _(C,b){v.value.filter(T=>T.name==C.name).forEach(T=>{T[b]=!T[b]})}return(C,b)=>{const B=n.resolveComponent("a-divider"),T=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-select"),P=n.resolveComponent("ToolOutlined"),E=n.resolveComponent("a-checkbox"),A=n.resolveComponent("a-table"),M=n.resolveComponent("a-select-option"),z=n.resolveComponent("a-form-item"),$=n.resolveComponent("a-form"),N=n.resolveComponent("a-modal"),W=n.resolveComponent("a-checkbox-group"),I=n.resolveComponent("a-input-number"),q=n.resolveComponent("a-input"),he=n.resolveComponent("a-col"),Xi=n.resolveComponent("a-row");return n.openBlock(),n.createElementBlock("div",Va,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[23]||(b[23]=[n.createTextVNode("按钮设置")])),_:1}),n.createElementVNode("div",_a,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,L=>(n.openBlock(),n.createBlock(V,n.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:Ue=>r(L)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(L.title)+" ",1),L.visible?(n.openBlock(),n.createBlock(T,{key:0,class:"btn-del",onClick:n.withModifiers(Ue=>c(L),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[L.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(L.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),size:"small",onClick:b[0]||(b[0]=L=>d())},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[24]||(b[24]=[n.createTextVNode("表单设置")])),_:1}),b[36]||(b[36]=n.createTextVNode(" 数据模型:")),n.createVNode(D,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":b[1]||(b[1]=L=>i.value.dataModel=L)},null,8,["options","value"]),n.createVNode(A,{columns:t.value,"data-source":v.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:L})=>[["widget","rules","convertName"].includes(L.key)?(n.openBlock(),n.createElementBlock("span",Ma,[n.createVNode(P),n.createTextVNode(" "+n.toDisplayString(L.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:L,text:Ue,record:ie})=>[["rules"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!f.value.showInfo(ie)&&"empty"]),onClick:xe=>p(ie)},[n.createElementVNode("span",Aa,n.toDisplayString(f.value.showInfo(ie)),1),f.value.showInfo(ie)?(n.openBlock(),n.createBlock(V,{key:0,type:"link"},{default:n.withCtx(()=>b[25]||(b[25]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ta)):["widget"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!g.value[ie.name]||!Object.keys(g.value[ie.name]).includes(L.dataIndex))&&!Ue&&"empty"]),onClick:xe=>m(ie,L.dataIndex)},[g.value[ie.name]&&Object.keys(g.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:h.value.widgets,onBlur:b[2]||(b[2]=xe=>S())},null,8,["value","onUpdate:value","options"])),[[O]]):(n.openBlock(),n.createElementBlock("span",Ia,n.toDisplayString(h.value.widgetName(Ue)),1))],10,Ea)):["convertName"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!g.value[ie.name]||!Object.keys(g.value[ie.name]).includes(L.dataIndex))&&!ie.convert?.type&&"empty"]),onClick:xe=>m(ie,L.dataIndex)},[g.value[ie.name]&&Object.keys(g.value[ie.name]).includes(L.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(D,{key:0,value:ie[L.dataIndex],"onUpdate:value":xe=>ie[L.dataIndex]=xe,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],onBlur:b[3]||(b[3]=xe=>S())},null,8,["value","onUpdate:value"])),[[O]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[ie.convert?.type?(n.openBlock(),n.createElementBlock("span",Pa,n.toDisplayString(ie.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),ie.convert?.type?(n.openBlock(),n.createBlock(V,{key:1,type:"link",onClick:n.withModifiers(xe=>x(ie),["stop"])},{default:n.withCtx(()=>b[26]||(b[26]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Da)):["isForm","isView"].includes(L.dataIndex)?(n.openBlock(),n.createElementBlock("div",Fa,[n.createVNode(E,{checked:ie[L.dataIndex],onClick:xe=>_(ie,L.dataIndex)},null,8,["checked","onClick"]),n.createVNode(V,{type:"link",onClick:xe=>y(ie,L.dataIndex)},{default:n.withCtx(()=>b[27]||(b[27]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(N,{visible:h.value.visible,"onUpdate:visible":b[5]||(b[5]=L=>h.value.visible=L),title:"控件设置",onOk:h.value.toSetting},{default:n.withCtx(()=>[n.createVNode($,{model:h.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[h.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(z,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(D,{value:h.value.props.mode,"onUpdate:value":b[4]||(b[4]=L=>h.value.props.mode=L),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(M,{value:"multiple"},{default:n.withCtx(()=>b[28]||(b[28]=[n.createTextVNode("多选")])),_:1}),n.createVNode(M,{value:"tags"},{default:n.withCtx(()=>b[29]||(b[29]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:f.value.visible,"onUpdate:visible":b[13]||(b[13]=L=>f.value.visible=L),title:"规则设置",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode($,{model:f.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[30]||(b[30]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(z,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(W,{value:f.value.props.trigger,"onUpdate:value":b[6]||(b[6]=L=>f.value.props.trigger=L),options:["change","blur"]},null,8,["value"])]),_:1}),f.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(z,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(E,{value:f.value.props.whitespace,"onUpdate:value":b[7]||(b[7]=L=>f.value.props.whitespace=L),checked:f.value.props.whitespace},{default:n.withCtx(()=>b[31]||(b[31]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[32]||(b[32]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(z,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(I,{value:f.value.props.rangeMin,"onUpdate:value":b[8]||(b[8]=L=>f.value.props.rangeMin=L)},null,8,["value"]),b[33]||(b[33]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(I,{value:f.value.props.rangeMax,"onUpdate:value":b[9]||(b[9]=L=>f.value.props.rangeMax=L)},null,8,["value"])]),_:1}),n.createVNode(z,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:f.value.props.rangeMessage,"onUpdate:value":b[10]||(b[10]=L=>f.value.props.rangeMessage=L)},null,8,["value"])]),_:1}),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[34]||(b[34]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(z,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(q,{value:f.value.props.regExpress,"onUpdate:value":b[11]||(b[11]=L=>f.value.props.regExpress=L)},null,8,["value"])]),_:1}),n.createVNode(z,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(q,{value:f.value.props.regMessage,"onUpdate:value":b[12]||(b[12]=L=>f.value.props.regMessage=L)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(N,{visible:u.value.visible,"onUpdate:visible":b[20]||(b[20]=L=>u.value.visible=L),title:u.value.title,onOk:u.value.toSetting},{default:n.withCtx(()=>[n.createVNode($,{model:u.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(z,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(I,{value:u.value.show.index,"onUpdate:value":b[14]||(b[14]=L=>u.value.show.index=L)},null,8,["value"])]),_:1}),["isQuery"].includes(u.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(z,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(q,{value:u.value.show.width,"onUpdate:value":b[15]||(b[15]=L=>u.value.show.width=L)},null,8,["value"])]),_:1})),["isForm","isView"].includes(u.value.prop)?(n.openBlock(),n.createBlock(z,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(q,{value:u.value.show.labelWidth,"onUpdate:value":b[16]||(b[16]=L=>u.value.show.labelWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(u.value.prop)?(n.openBlock(),n.createBlock(z,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(q,{value:u.value.show.valueWidth,"onUpdate:value":b[17]||(b[17]=L=>u.value.show.valueWidth=L)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(u.value.prop)?(n.openBlock(),n.createBlock(z,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(D,{value:u.value.show.fixed,"onUpdate:value":b[18]||(b[18]=L=>u.value.show.fixed=L),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(u.value.prop)?(n.openBlock(),n.createBlock(z,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(D,{value:u.value.show.align,"onUpdate:value":b[19]||(b[19]=L=>u.value.show.align=L),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(N,{visible:k.value.visible,"onUpdate:visible":b[22]||(b[22]=L=>k.value.visible=L),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",$a,[n.createVNode(V,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>b[35]||(b[35]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(A,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:L,record:Ue,index:ie})=>[L.dataIndex==="label"?(n.openBlock(),n.createBlock(q,{key:0,value:Ue.label,"onUpdate:value":xe=>Ue.label=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="value"?(n.openBlock(),n.createBlock(q,{key:1,value:Ue.value,"onUpdate:value":xe=>Ue.value=xe,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),L.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:xe=>k.value.toDelOption(ie,Ue)},"删除",8,Ra)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock($,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(Xi,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(he,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(z,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(q,{value:k.value.convert.dict,"onUpdate:value":b[21]||(b[21]=L=>k.value.convert.dict=L)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(di,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-c0f75bb9"]]),ja=ee(n.defineComponent({__name:"form",props:{editor:{type:Object,required:!1},widget:{type:Object,required:!1},form:{type:Object,required:!1}},setup(o,{expose:e}){const t=o,i=n.ref(!1),l=n.ref(),s=n.ref({}),a=n.ref(null);n.onMounted(()=>{if(t.editor&&r.value.dsn){const x=t.editor.dataManager();r.value.primary&&x.psn(r.value.dsn),a.value.setDisabled=k,a.value.getValue=f,a.value.setValue=p,a.value.reset=u,l.value=x.useForm(r.value.dsn,a.value,w=>{s.value=w.body||{}})}});const r=n.computed(()=>t.widget||t.form||{}),d=n.computed(()=>{let x=r.value.widgets||[];return!x.length&&t.form?.fields&&(x=t.form.fields),x.forEach(w=>{w.widget||(w.widget="unione-form-item"),w.control||(w.control="a-input")}),x}),c=n.inject("pageSetting"),h=n.computed(()=>r.value.setting||c?.form||{});n.provide("formSetting",h.value);function f(){return s.value}function p(x){s.value=x}function u(){s.value={};const x=w=>{w.widget=="unione-form-item"&&w.name&&w.value!=null&&w.value!=null&&w.value!=""&&(s.value[w.name]=w.value),w.widgets?.forEach(v=>{x(v)})};d.value.forEach(w=>{x(w)})}function y(){return a.value.validate()}function k(x=!0){i.value=x}return e({validate:y,getValue:f,setValue:p,reset:u,setDisabled:k}),(x,w)=>{const v=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-form-widget","setting-title":"表单设置",model:o.editor?.model.value},n.createSlots({default:n.withCtx(()=>[n.createVNode(v,{ref_key:"formObj",ref:a,model:s.value,class:n.normalizeClass(["unione-form",o.editor?.model.value,"form-layout-col-"+(h.value.showColumn||3)])},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d.value,(O,g)=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(O.widget),{key:g,widget:O,editor:o.editor,value:s.value[O.name],"onUpdate:value":m=>s.value[O.name]=m,disabled:i.value,formValue:s.value},null,40,["widget","editor","value","onUpdate:value","disabled","formValue"]))),128))]),_:1},8,["model","class"])]),_:2},[o.editor&&r.value.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(La,{wid:r.value.wid,editor:o.editor},null,8,["wid","editor"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-540f619c"]]);function kl(o,e=!1){const t=Ae();if(t.isDebug&&console.log("进入:加载字典数据方法,dict name:"+o+",force:"+e),!o)return Promise.reject("字典名称不能为空");const i=localStorage.getItem("UNIONE-DICT-"+o);return i&&e==!1?Promise.resolve(JSON.parse(i)):new Promise((l,s)=>{K.axios.admin({url:"/api/system/dict/load/"+o}).then(a=>{if(a.success){const r=a.body.filter(d=>d.dictName!=d.dictKey);r.forEach(d=>{d.value=d.dictKey,d.label=d.dictValue}),r.length?(localStorage.setItem("UNIONE-DICT-"+o,JSON.stringify(r)),l(r)):s("字典加载失败,dict:"+o+",字典项列表为空")}else t.isDebug&&console.error("字典加载失败,dict:"+o,a),s("字典加载失败,dict:"+o+",error:"+a.message)})})}async function bl(o,e){const t=Ae();if(t.isDebug&&console.log("进入:根据获取字典选项方法,dict name:"+o+",key:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("字典key为空");const i=await kl(o),l=i.filter(s=>s.dictKey==e);return l.length>0?Promise.resolve(l[0]):(t.isDebug&&console.log("字典项匹配失败,name:"+o+",key:"+e+"options:",i),Promise.reject("字典项匹配失败,name:"+o+",key:"+e))}async function za(o,e){const t=await bl(o,e);return Promise.resolve(t.dictValue)}const yl={load:kl,getLabel:za,getOption:bl};class dt{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=Ae()}load(e,t=!1){return this.config.isDebug&&console.log("进入:加载转换选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e+",force:"+t),!(e==null||e==null||e=="undefined"||!(e+"").length)&&this.options?.length&&this.options.filter(i=>i.value==e).length?Promise.resolve(this.options):this.convertObj.types=="dict"?new Promise((i,l)=>{if(!this.convertObj.dictName){l("字典名称不能为空,id:"+this.convertObj.id);return}yl.load(this.convertObj.dictName,t).then(s=>{this.options=s,typeof e=="number"&&this.options.forEach(a=>{a.value=parseInt(a.value)}),i(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((i,l)=>{const s=this.convertObj.params||{body:{}};this.convertObj.pidField&&(s.pid=-1);const a=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:a,data:s,method:"POST"}).then(r=>{r.success?(this.options=r.body,this.$processOptions(this.options),typeof e=="number"&&this.options.forEach(d=>{d.value=parseInt(d.value)}),e==null||e==null||e=="undefined"||!(e+"").length?this.options.length?i(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(c=>c.value==e).length?i(this.options):(s.body||(s.body={}),s.body[this.convertObj.valueField]=e,K.axios.admin({url:a,data:s,method:"POST"}).then(c=>{if(c.success){const h={};this.options.forEach(f=>{h[e]=!0}),c.body.forEach(f=>{h[f.value]||this.options.push(f)}),i(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(this.config.isDebug&&console.log("进入:数据转换:value->label方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",value:"+e),e==null||e==null||e=="undefined"||!(e+"").length)return Promise.reject("value为空");if(this.convertObj.types=="dict")return this.convertObj.dictName?yl.getLabel(this.convertObj.dictName,e):Promise.reject("字典名称不能为空");if(this.convertObj.types=="option"){if(this.convertObj.options?.length){const t=this.convertObj.options.filter(i=>i.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(i=>i.value==e);if(t.length)return Promise.resolve(t[0].label)}return new Promise((t,i)=>{this.load(e).then(l=>{const s=l.filter(a=>a.value==e);if(s.length)return t(s[0].label);i()})})}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((i,l)=>{const s=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:s,data:e,method:"POST"}).then(a=>{a.success?(this.$processOptions(a.body),this.options=[...this.options,...a.body],i(a.body)):(this.config.isDebug&&console.error("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e,a),l("加载下级数据项失败,type:"+this.convertObj.types+",id:"+this.convertObj.id+",pid:"+e+",error:"+a.message))})}):Promise.reject("转换器未设置parentField,id:"+this.convertObj.id)}search(e){return this.config.isDebug&&console.log("进入:搜索数据选项方法,id:"+this.convertObj.id+",type:"+this.convertObj.types+",keywords:"+e),this.convertObj.types=="dict"||this.convertObj.types=="option"?Promise.resolve(this.options.filter(t=>t.label.indexOf(e)>=0)):new Promise(t=>{const i=this.convertObj.types=="local"?this.convertObj.url:"/api/data/convertor/"+this.convertObj.id;K.axios.admin({url:i,data:{body:{keywords:e}},method:"POST"}).then(l=>{l.success?(this.$processOptions(l.body),t(l.body)):t([])})})}$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],t.label=t[this.convertObj.labelField]}),e}}const qa={key:1,class:"text-view"},Ua=ee(n.defineComponent({__name:"formItem",props:n.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(o){const e=o,t=n.useModel(o,"value"),i=n.inject("formSetting");n.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 l=n.ref({}),s=n.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&&(l.value[w]=null,typeof v=="function"?l.value[w]=v:v.enable&&v.scriptText&&(l.value[w]=new Function("value","ctx",v.scriptText)))}),x}),a=n.computed(()=>!(l.value.visible&&l.value.visible(e.formValue[s.value.name],e.formValue)==!1)),r=n.computed(()=>l.value.title&&l.value.title(e.formValue[s.value.name],e.formValue)||s.value.title),d=n.computed(()=>l.value.change&&l.value.change(e.formValue[s.value.name],e.formValue)||s.value.change),c=n.ref({}),h=n.computed(()=>{const x=[],w=s.value.rule||{};if(s.value.props?.required&&x.push({required:!0,whitespace:w?.whitespace||!1,trigger:w?.trigger||i.ruleTrigger||"change",validator:(v,O)=>(w?.whitespace&&O&&typeof O=="string"&&(O=O.trim()),O&&(O+"").length>0?Promise.resolve():Promise.reject(s.value.title+"不能为空!"))}),w.advance&&c.value[w.advance]){const v=c.value[w.advance];x.push({pattern:v.pattern,message:v.message||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"})}return w.regExpress&&x.push({pattern:w.regExpress,message:w.regMessage||"表单验证不通过!",trigger:w.trigger||i.ruleTrigger||"change"}),s.value.dataLen&&x.push({validator:(v,O)=>O&&(O+"").length>s.value.dataLen?Promise.reject("最大长度["+s.value.dataLen+"],当前:["+(O+"").length+"]"):Promise.resolve(),trigger:w?.trigger||i.ruleTrigger||"change"}),x}),f=n.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),x}),p=n.computed(()=>{const x=s.value.css||{},w=[];return x.cssName&&w.push(x.cssName),i.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}),u=n.computed(()=>{const x=i.showColumn||3;let w=s.value.view?.labelWidth||i.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=n.computed(()=>{const x=i.showColumn||3;let w=s.value.view?.valueWidth||i.valueWidth||15;return s.value.css?.cssName&&x>1&&p.value.includes("all-line")?{}:{span:w}}),k=n.ref();return n.watch(t,()=>{t.value&&e.editor?.model.value=="view"&&s.value.convert&&new dt(s.value.convert).convert(t.value.toString()).then(x=>{k.value=x})}),(x,w)=>{const v=n.resolveComponent("a-form-item");return n.openBlock(),n.createBlock(rt,{class:n.normalizeClass(["unione-form-item",p.value]),style:n.normalizeStyle(s.value.css?.cssText)},{default:n.withCtx(()=>[a.value?(n.openBlock(),n.createBlock(v,{key:0,label:r.value,name:s.value.name,labelCol:u.value,wrapperCol:y.value,required:s.value.props?.required,rules:h.value,help:(!e.editor||e.editor.model.value!="view")&&s.value.props?.help,tooltip:s.value.props?.tooltip},{default:n.withCtx(()=>[!o.editor||o.editor.model.value!="view"?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(s.value.control||"a-input"),n.mergeProps({key:0,wid:s.value.wid,widget:s.value,editor:e.editor,disabled:o.disabled,onChange:d.value,value:t.value,"onUpdate:value":w[0]||(w[0]=O=>t.value=O)},f.value,{style:s.value.css?.props}),null,16,["wid","widget","editor","disabled","onChange","value","style"])):t.value?(n.openBlock(),n.createElementBlock("div",qa,n.toDisplayString(k.value?k.value:t.value),1)):n.createCommentVNode("",!0)]),_:1},8,["label","name","labelCol","wrapperCol","required","rules","help","tooltip"])):n.createCommentVNode("",!0)]),_:1},8,["class","style"])}}}),[["__scopeId","data-v-8941ba2b"]]);function wl(o,e=350){let t=null;return i=>{clearTimeout(t),t=setTimeout(()=>{o(i)},e)}}const Wa=ee(n.defineComponent({__name:"selectBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){Ae();const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]),s=n.computed(()=>(d.value.convert||e.convert||{}).search||!1),a=wl(h=>{c.value.search(h).then(f=>{i.value=f})},500);n.onMounted(()=>{c.value.load(t.value).then(h=>{i.value=h})});const r=n.ref({}),d=n.computed(()=>{const h=e.editor?.widget(e.wid)||e.widget||{};return h.event&&Object.keys(h.event).forEach(f=>{const p=h.event[f];r.value[f]=null,p.enable&&p.scriptText&&(r.value[f]=new Function("value","ctx",p.scriptText))}),h}),c=n.computed(()=>{const h=d.value.convert||e.convert||{};return new dt(h)});return n.watch(t,()=>{t.value&&c.value.load(t.value).then(h=>{i.value=h})}),n.watch(()=>d.value.convert||e.convert||{},()=>{c.value.load().then(h=>{i.value=h})}),(h,f)=>{const p=n.resolveComponent("a-select");return n.openBlock(),n.createBlock(p,{class:"unione-form-select",options:l.value,showSearch:s.value,value:t.value,"onUpdate:value":f[0]||(f[0]=u=>t.value=u),onSearch:n.unref(a)},null,8,["options","showSearch","value","onSearch"])}}}),[["__scopeId","data-v-d885ca4f"]]),Ha=ee(n.defineComponent({__name:"switchBox",props:n.mergeModels({editor:{type:Object,required:!1},widget:{type:Object,required:!1},convert:{type:Object,required:!1}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref({});n.onMounted(()=>{a.value?.load(t.value).then(r=>{r.forEach(d=>{d.value&&(d.value=="1"||d.value=="true"||d.value=="TRUE")?(i.value.checkedChildren=d.label,d.value=="true"||d.value=="TRUE"?i.value.checkedValue=!0:i.value.checkedValue=1):(i.value.unCheckedChildren=d.label,d.value=="false"||d.value=="FALSE"?i.value.unCheckedValue=!1:i.value.unCheckedValue=0)})})});const l=n.ref({}),s=n.computed(()=>{const r=e.widget||{};return r.event&&Object.keys(r.event).forEach(d=>{const c=r.event[d];l.value[d]=null,c.enable&&c.scriptText&&(l.value[d]=new Function("value","ctx",c.scriptText))}),r}),a=n.computed(()=>{const r=s.value.convert||e.convert;return r?new dt(r):null});return(r,d)=>{const c=n.resolveComponent("a-switch");return n.openBlock(),n.createBlock(c,n.mergeProps({class:"unione-form-switch"},i.value,{checked:t.value,"onUpdate:checked":d[0]||(d[0]=h=>t.value=h)}),null,16,["checked"])}}}),[["__scopeId","data-v-a56d945e"]]),Ka=ee(n.defineComponent({__name:"radioBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];s.value[c]=null,h.enable&&h.scriptText&&(s.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-radio-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-radio",options:l.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-761054e0"]]),Qa=ee(n.defineComponent({__name:"checkBox",props:n.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}},{value:{},valueModifiers:{}}),emits:["update:value"],setup(o){const e=o,t=n.useModel(o,"value"),i=n.ref([]),l=n.computed(()=>i.value?.length?i.value:e.options?.length?e.options:[]);n.onMounted(()=>{r.value.load(t.value||a.value.value).then(d=>{i.value=d})});const s=n.ref({}),a=n.computed(()=>{const d=e.editor?.widget(e.wid)||e.widget||{};return d.event&&Object.keys(d.event).forEach(c=>{const h=d.event[c];s.value[c]=null,h.enable&&h.scriptText&&(s.value[c]=new Function("value","ctx",h.scriptText))}),d}),r=n.computed(()=>{const d=a.value.convert||e.convert||{};return new dt(d)});return(d,c)=>{const h=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createBlock(h,{class:"unione-form-checkbox",options:l.value,value:t.value,"onUpdate:value":c[0]||(c[0]=f=>t.value=f)},null,8,["options","value"])}}}),[["__scopeId","data-v-e2f0f7fc"]]),Ga={class:"unione-props-setting unione-query-setting"},Ya={class:"unione-query-opts"},Xa={key:0},Ja=["onClick"],Za={key:1},er={key:1,class:"edit-field"},tr=["onClick"],ir=ee(n.defineComponent({__name:"querySetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:O})=>O+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"}]),i=n.computed(()=>{const O=e.editor.widget(e.wid)||{};return O.configs||(O.configs={}),O.configs.btns||(O.configs.btns=[]),O}),l=n.computed(()=>(e.editor.dataModels()||[]).map(g=>({value:g.sn,label:g.title+"("+g.name+")"}))),s=n.computed(()=>{const O=[],g=[];return i.value.configs.btns||(i.value.configs.btns=[]),i.value.configs.btns.forEach(m=>{O.push(m),g.push(m.name)}),g.includes("query")||O.splice(0,0,{visible:!0,name:"query",title:"搜索",type:"primary"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"reset",title:"重置",type:"default"}),g.includes("reset")||O.splice(1,0,{visible:!0,name:"advanced",title:"高级搜索",type:"default"}),O.sort((m,S)=>{const _=m.index||1,C=S.index||1;return _-C}),O}),a=n.ref(null);function r(O){a.value&&a.value.open(O,g=>{g.visible=!0,Object.keys(g).forEach(m=>{O[m]=g[m]}),i.value.configs.btns.sort((m,S)=>{const _=m.index||1,C=S.index||1;return _-C}),i.value.configs.btns=[...i.value.configs.btns]})}function d(){const O=i.value.configs.btns.length+1;let g={title:"新增",name:"new_"+O,size:"default",index:O,visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.btns.push(g),e.editor.widget(e.wid,i.value),a.value.open(g,m=>{Object.keys(m).forEach(S=>{g[S]=m[S]}),i.value.configs.btns=[...i.value.configs.btns]})}function c(O){const g=()=>{if(["query","reset","advanced"].includes(O.name))O.visible=!1,i.value.configs.btns=[...i.value.configs.btns];else{const m=[];i.value.configs.btns.forEach(S=>{S.name!=O.name&&m.push(S)}),i.value.configs.btns=m}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{g()}})}const h=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),f=n.computed(()=>h.value.fields?.length?h.value.fields:[]),p={mounted:O=>O.focus()},u=n.ref({});function y(){const O=Object.keys(u.value);if(O.length)for(let g in O){const m=f.value.filter(S=>S.name==g);if(m&&m[0]){let S=u.value[g];Object.keys(S).forEach(_=>{if(_=="showIndex"){const C=m[0].show?.query||{};m[0].show||(m[0].show={}),m[0].show.query={...C,index:S[_]}}else m[0][_]=S[_]})}}u.value={}}function k(O,g){y();const m={};m[g]=O[g]||"",g=="showIndex"&&(m[g]=O.show?.query?.index),u.value[O.name]=m}function x(O,g){if(!O||!g){u.value={};return}const m=u.value[O.name][g];if(g=="showIndex"){const S=O.show?.query||{};O.show||(O.show={}),O.show.query={...S,index:m}}else O[g]=m;u.value={}}function w(O,g){f.value.filter(S=>S.name==O.name).forEach(S=>{S[g]=!S[g]})}const v=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:O=>{const g=v.value.options.filter(m=>m.value==O);return g[0]?g[0].label:O}});return(O,g)=>{const m=n.resolveComponent("a-divider"),S=n.resolveComponent("CloseOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("PlusOutlined"),b=n.resolveComponent("a-select"),B=n.resolveComponent("ToolOutlined"),T=n.resolveComponent("a-checkbox"),V=n.resolveComponent("a-input-number"),F=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",Ga,[n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[3]||(g[3]=[n.createTextVNode("查询按钮")])),_:1}),n.createElementVNode("div",Ya,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,D=>(n.openBlock(),n.createBlock(_,n.mergeProps({key:D.name,class:["btn",D.name,!D.visible&&"deleted"],type:D.visible?D.type:"default",size:D.size||"default",ref_for:!0},D.props||{},{onClick:P=>r(D)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(D.title)+" ",1),D.visible?(n.openBlock(),n.createBlock(S,{key:0,class:"btn-del",onClick:n.withModifiers(P=>c(D),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[D.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(D.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(_,{class:n.normalizeClass(["btn","btn-add"]),onClick:g[0]||(g[0]=D=>d()),size:"small"},{default:n.withCtx(()=>[n.createVNode(C)]),_:1})]),n.createVNode(m,{orientation:"left"},{default:n.withCtx(()=>g[4]||(g[4]=[n.createTextVNode("查询字段")])),_:1}),g[5]||(g[5]=n.createTextVNode(" 数据模型:")),n.createVNode(b,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":g[1]||(g[1]=D=>i.value.dataModel=D)},null,8,["options","value"]),n.createVNode(F,{columns:t.value,"data-source":f.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:D})=>[["showIndex","queryType"].includes(D.key)?(n.openBlock(),n.createElementBlock("span",Xa,[n.createVNode(B),n.createTextVNode(" "+n.toDisplayString(D.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:D,text:P,record:E})=>[["queryType"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!u.value[E.name]||!Object.keys(u.value[E.name]).includes(D.dataIndex))&&!P&&"empty"]),onClick:A=>k(E,D.dataIndex)},[u.value[E.name]&&Object.keys(u.value[E.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(b,{key:0,value:E[D.dataIndex],"onUpdate:value":A=>E[D.dataIndex]=A,allowClear:!0,options:v.value.options,onBlur:g[2]||(g[2]=A=>x())},null,8,["value","onUpdate:value","options"])),[[p]]):(n.openBlock(),n.createElementBlock("span",Za,n.toDisplayString(v.value.showLabel(P)),1))],10,Ja)):["isQuery"].includes(D.dataIndex)?(n.openBlock(),n.createElementBlock("div",er,[n.createVNode(T,{checked:E[D.dataIndex],onClick:A=>w(E,D.dataIndex)},null,8,["checked","onClick"])])):D.dataIndex=="showIndex"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!u.value[E.name]||!Object.keys(u.value[E.name]).includes(D.dataIndex))&&!P&&"empty"]),onClick:A=>k(E,D.dataIndex)},[u.value[E.name]&&Object.keys(u.value[E.name]).includes(D.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(V,{key:0,value:u.value[E.name][D.dataIndex],"onUpdate:value":A=>u.value[E.name][D.dataIndex]=A,onBlur:A=>x(E,D.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[p]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(E.show?.query?.index||" "),1)],64))],10,tr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(di,{ref_key:"btnSetting",ref:a},null,512)])}}}),[["__scopeId","data-v-ce575063"]]),nr={class:"query-btn"},lr={class:"btn-advanced-overlay"},xl=ee(n.defineComponent({__name:"queryForm",props:{wid:{type:String,required:!1},editor:{type:Object,required:!1},widget:{type:Object,required:!1}},emits:["query","reset","btnClick"],setup(o,{emit:e}){const t=o,i=n.computed(()=>{const k=t.editor?.widget(t.wid)||t.widget||{};return k.btns||(k.btns=[]),k}),l=n.computed(()=>({visible:!0,name:"keywords",title:"关键字",placeholder:"请输入搜索内容",...i.value.keywords||{}})),s=n.computed(()=>{let k=[];return i.value.fields?.length&&(k=i.value.fields),k.sort((x,w)=>{const v=x.show?.query?.index||1,O=w.show?.query?.index||1;return v-O}),k.forEach(x=>{x.widget=x.widget||"a-input",x.value!=null&&x.value!="undefined"&&typeof x.value<"u"&&(h.value[x.name]=x.value)}),k}),a=n.computed(()=>i.value.labelWidth||7),r=n.computed(()=>{const k=i.value.btns.filter(x=>x.name=="advanced")[0]||{};return k.event?.clickScript&&(k.event.click=new Function("ctx","btn","event",k.event.clickScript)),k.event?.disableScript&&(k.event.disable=new Function("ctx","btn",k.event.disableScript)),k.event?.visibleScript&&(k.event.visible=new Function("ctx","btn",k.event.visibleScript)),{visible:!0,name:"advanced",title:"高级搜索",...k}}),d=["query","reset","advanced"],c=n.computed(()=>{const k=i.value.btns.filter(w=>w.name!="advanced"),x=[];return k.forEach(w=>{w.size||(w.size="default"),x.push(w.name)}),x.includes("query")||k.splice(0,0,{visible:!0,name:"query",title:"查询",size:"default",type:"primary"}),x.includes("reset")||k.splice(1,0,{visible:!0,name:"reset",title:"重置",size:"default",type:"default"}),k.sort((w,v)=>{const O=w.index||1,g=v.index||1;return O-g}),k}),h=n.ref({});n.onMounted(()=>{t.editor?.ebus.$emit("table-list-search",h.value)});const f=e;function p({btn:k,event:x}){console.log("unione query form btn click",k,x),k.name=="query"&&u(),k.name=="reset"&&y(),f("btnClick",{btn:k,event:x})}function u(){const k=[];l.value.visible&&k.push(l.value.name),s.value.forEach(w=>{w.visible&&k.push(w.name)});const x={};Object.keys(h.value).forEach(w=>{k.includes(w)&&(x[w]=h.value[w])}),f("query",x),t.editor?.ebus.$emit("table-list-search",x)}function y(){h.value={},s.value.forEach(k=>{k.visible=!1}),f("reset"),t.editor?.ebus.$emit("table-list-reset")}return(k,x)=>{const w=n.resolveComponent("a-input"),v=n.resolveComponent("a-form-item"),O=n.resolveComponent("unione-btn"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("DownOutlined"),S=n.resolveComponent("a-button"),_=n.resolveComponent("a-dropdown"),C=n.resolveComponent("a-form");return n.openBlock(),n.createBlock(rt,{class:"unione-query-form",model:t.editor?.model.value,"setting-title":"查询设置"},n.createSlots({default:n.withCtx(()=>[n.createVNode(C,{model:h.value,layout:"horizontal","label-col":{span:a.value}},{default:n.withCtx(()=>[l.value.visible?(n.openBlock(),n.createBlock(v,{key:0,label:l.value.title,class:"query-field keywords",name:l.value.name,style:n.normalizeStyle({width:a.value})},{default:n.withCtx(()=>[n.createVNode(w,{placeholder:l.value.placeholder,value:h.value[l.value.name],"onUpdate:value":x[0]||(x[0]=b=>h.value[l.value.name]=b)},null,8,["placeholder","value"])]),_:1},8,["label","name","style"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible?(n.openBlock(),n.createBlock(v,{key:0,label:b.title,class:n.normalizeClass(["query-field",b.name]),style:n.normalizeStyle({width:a.value}),name:b.name},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(b.widget),n.mergeProps({placeholder:b.placeholder,value:h.value[b.name],"onUpdate:value":B=>h.value[b.name]=B,ref_for:!0},b.props||{},{widget:b}),null,16,["placeholder","value","onUpdate:value","widget"]))]),_:2},1032,["label","class","style","name"])):n.createCommentVNode("",!0)],64))),128)),n.createElementVNode("div",nr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(c.value,b=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:b.name},[b.visible!=!1?(n.openBlock(),n.createBlock(O,{key:0,widget:b,editor:o.editor,onClick:p,preset:d},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128)),r.value.visible&&s.value.length?(n.openBlock(),n.createBlock(_,{key:0,class:"btn btn-advanced",trigger:[r.value.trigger||"hover"]},{overlay:n.withCtx(()=>[n.createElementVNode("div",lr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,b=>(n.openBlock(),n.createBlock(g,{key:b.name,class:"item",checked:b.visible,onClick:B=>b.visible=!b.visible},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(b.title),1)]),_:2},1032,["checked","onClick"]))),128))])]),default:n.withCtx(()=>[n.createVNode(S,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.value.title)+" ",1),n.createVNode(m)]),_:1})]),_:1},8,["trigger"])):n.createCommentVNode("",!0)])]),_:1},8,["model","label-col"])]),_:2},[t.editor&&t.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(ir,{editor:t.editor,wid:t.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-bf93af8d"]]),sr={class:"unione-props-setting unione-table-setting"},or={class:"unione-table-tools"},ar={key:1,class:"unione-table-opts"},rr={key:0},dr=["onClick"],cr={key:1,class:"edit-field"},hr=["onClick"],fr={key:1},ur=ee(n.defineComponent({__name:"tableSetting",props:{wid:{type:String,required:!0},editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:C})=>C+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(C,b){let B=C.filter(T=>T.value==b);return B&&B[0]&&B[0].label||b}},{title:"固定位置",dataIndex:"fixed",key:"fixed",width:"55px",align:"center",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}],showLabel(C,b){let B=C.filter(T=>T.value==b);return B&&B[0]&&B[0].label||b}},{title:"列宽",dataIndex:"showWidth",key:"showWidth",width:"50px",align:"center"}]),i=n.computed(()=>{const C=e.editor.widget(e.wid)||{};return C.configs||(C.configs={}),C.configs.leftBtns||(C.configs.leftBtns=[]),C.configs.rightBtns||(C.configs.rightBtns=[]),C.configs.operation||(C.configs.operation={}),C.configs.operation.btns||(C.configs.operation.btns=[]),C.configs.operation.more||(C.configs.operation.more={}),C}),l=n.computed(()=>(e.editor.dataModels()||[]).map(b=>({value:b.sn,label:b.title+"("+b.name+")"}))),s=n.computed(()=>{if(!i.value)return[];const C=[],b=i.value.configs.leftBtns;if(b.forEach(B=>{C.push(B.name)}),!C.includes("add")){const B={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};b.splice(0,0,B)}if(!C.includes("delBatch")){const B={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};b.splice(1,0,B)}return b}),a=n.computed(()=>{if(!i.value)return[];const C=[],b=i.value.configs.rightBtns;if(b.forEach(B=>{C.push(B.name)}),!C.includes("downData")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"导出",index:0,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downData"};b.splice(0,0,B)}if(!C.includes("impData")){const B={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};b.splice(1,0,B)}if(!C.includes("expData")){const B={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};b.splice(2,0,B)}if(!C.includes("downTmpl")){const B={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};b.splice(3,0,B)}return b});function r(C,b){C=="left"?h.value.open(b,B=>{B.visible=!0,Object.keys(B).forEach(T=>{b[T]=B[T]}),i.value.configs.leftBtns.sort((T,V)=>{const F=T.index||1,D=V.index||1;return F-D}),i.value.configs.leftBtns=[...i.value.configs.leftBtns]}):h.value.open(b,B=>{B.visible=!0,Object.keys(B).forEach(T=>{b[T]=B[T]}),i.value.configs.rightBtns.sort((T,V)=>{const F=T.index||1,D=V.index||1;return F-D}),i.value.configs.rightBtns=[...i.value.configs.rightBtns]})}function d(C){const b=C=="left"?i.value.configs.leftBtns.length:i.value.configs.rightBtns.length;let B={title:"新增"+b,name:"new_"+b,index:b,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{}};C=="left"?i.value.configs.leftBtns.push(B):i.value.configs.rightBtns.push(B),e.editor.widget(e.wid,i.value),r(C,B)}function c(C,b){const B=()=>{if(["add","delBatch","expData","impData","downTmpl"].includes(b.name))b.visible=!1,C=="left"?i.value.configs.leftBtns=[...i.value.configs.leftBtns]:i.value.configs.rightBtns=[...i.value.configs.rightBtns];else if(C=="left"){const T=[];i.value.configs.leftBtns.forEach(V=>{V.name!=b.name&&T.push(V)}),i.value.configs.leftBtns=T}else{const T=[];i.value.configs.rightBtns.forEach(V=>{V.name!=b.name&&T.push(V)}),i.value.configs.rightBtns=T}};G.Modal.confirm({title:"确认信息",content:"请确定删除该工具?",onOk:()=>{B()}})}const h=n.ref(null);function f(C){h.value.open(C,b=>{b.visible=!0,Object.keys(b).forEach(B=>{C[B]=b[B]}),i.value.configs.operation.btns.sort((B,T)=>{const V=B.index||1,F=T.index||1;return V-F}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function p(){const C=i.value.configs.operation.btns.length+1;let b={title:"新增"+C,name:"new_"+C,index:C,size:"small",visible:!0,type:"default",props:{block:!1,ghost:!1,danger:!1},event:{clickScript:"",titleScript:"",disableScript:"",visibleScript:""}};i.value.configs.operation.btns.push(b),e.editor.widget(e.wid,i.value),h.value.open(b,B=>{Object.keys(B).forEach(T=>{b[T]=B[T]}),i.value.configs.operation.btns=[...i.value.configs.operation.btns]})}function u(C){const b=()=>{if(["delete","view","edit"].includes(C.name))C.visible=!1,i.value.configs.operation.btns=[...i.value.configs.operation.btns];else{const B=[];i.value.configs.operation.btns.forEach(T=>{T.name!=C.name&&B.push(T)}),i.value.configs.operation.btns=B}};G.Modal.confirm({title:"确认信息",content:"请确定删除该操作?",onOk:()=>{b()}})}const y=n.computed(()=>e.editor?.dataModel(i.value.dataModel||"none")||{}),k=n.computed(()=>y.value.fields?.length?(y.value.fields.forEach(C=>{C.show||(C.show={}),C.show.list||(C.show.list={})}),y.value.fields):[]),x={mounted:C=>C.focus()},w=n.ref({});function v(){const C=Object.keys(w.value);if(C.length)for(let b in C){const B=k.value.filter(T=>T.name==b);if(B&&B[0]){let T=w.value[b];Object.keys(T).forEach(V=>{B[0].show||(B[0].show={}),B[0].show.list||(B[0].show.list={}),V=="showIndex"?B[0].show.list.index=T[V]:V=="showWidth"?B[0].show.list.width=T[V]:V=="fixed"?B[0].show.list.fixed=T[V]:V=="align"?B[0].show.list.align=T[V]:B[0][V]=T[V]})}}w.value={}}function O(C,b){v();const B={};b=="showIndex"?B[b]=C.show?.list?.index:b=="showWidth"?B[b]=C.show?.list?.width:b=="fixed"?B[b]=C.show?.list?.fixed:b=="align"?B[b]=C.show?.list?.align:B[b]=C[b]||"",w.value[C.name]=B}function g(C,b){if(!C||!b){w.value={};return}const B=w.value[C.name][b];C.show||(C.show={}),C.show.list||(C.show.list={}),b=="showIndex"?C.show.list.index=B:b=="showWidth"?C.show.list.width=B:b=="fixed"?C.show.list.fixed=B:b=="align"?C.show.list.align=B:C[b]=B,w.value={}}function m(C,b){return b=="showIndex"?C.show?.list?.index:b=="showWidth"?C.show?.list?.width:b=="fixed"?C.show?.list?.fixed:b=="align"?C.show?.list?.align:C[b]}function S(C,b){k.value.filter(T=>T.name==C.name).forEach(T=>{T[b]=!T[b]})}const _=n.ref({options:[{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:C=>{const b=_.value.options.filter(B=>B.value==C);return b[0]?b[0].label:C}});return(C,b)=>{const B=n.resolveComponent("a-divider"),T=n.resolveComponent("CloseOutlined"),V=n.resolveComponent("a-button"),F=n.resolveComponent("PlusOutlined"),D=n.resolveComponent("a-input"),P=n.resolveComponent("a-form-item"),E=n.resolveComponent("a-col"),A=n.resolveComponent("a-input-number"),M=n.resolveComponent("a-checkbox"),z=n.resolveComponent("a-row"),$=n.resolveComponent("a-select"),N=n.resolveComponent("ToolOutlined"),W=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",sr,[n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[8]||(b[8]=[n.createTextVNode("工具设置")])),_:1}),n.createElementVNode("div",or,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,I=>(n.openBlock(),n.createBlock(V,n.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:q=>r("left",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(T,{key:0,class:"bool-del",onClick:n.withModifiers(q=>c("left",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add"]),size:"small",onClick:b[0]||(b[0]=I=>d("left"))},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),n.createVNode(V,{class:n.normalizeClass(["btn","tool-add","right"]),onClick:b[1]||(b[1]=I=>d("right")),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1}),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,I=>(n.openBlock(),n.createBlock(V,n.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:q=>r("right",I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(T,{key:0,class:"bool-del",onClick:n.withModifiers(q=>c("right",I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128))]),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[9]||(b[9]=[n.createTextVNode("操作设置")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createBlock(z,{key:0},{default:n.withCtx(()=>[n.createVNode(E,{span:7},{default:n.withCtx(()=>[n.createVNode(P,{label:"操作标题"},{default:n.withCtx(()=>[n.createVNode(D,{value:i.value.configs.operation.title},null,8,["value"])]),_:1})]),_:1}),n.createVNode(E,{span:5},{default:n.withCtx(()=>[n.createVNode(P,{label:"显示宽度",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(A,{value:i.value.configs.operation.width,"onUpdate:value":b[2]||(b[2]=I=>i.value.configs.operation.width=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(E,{span:6},{default:n.withCtx(()=>[n.createVNode(P,{label:"显示按钮数量",labelCol:{span:9}},{default:n.withCtx(()=>[n.createVNode(A,{value:i.value.configs.operation.count,"onUpdate:value":b[3]||(b[3]=I=>i.value.configs.operation.count=I)},null,8,["value"])]),_:1})]),_:1}),n.createVNode(E,{span:5},{default:n.withCtx(()=>[n.createVNode(P,{label:"是否显示"},{default:n.withCtx(()=>[n.createVNode(M,{checked:i.value.configs.operation.visible,"onUpdate:checked":b[4]||(b[4]=I=>i.value.configs.operation.visible=I)},null,8,["checked"])]),_:1})]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[10]||(b[10]=[n.createTextVNode("操作按钮")])),_:1}),i.value?.configs?.operation?(n.openBlock(),n.createElementBlock("div",ar,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.value.configs.operation.btns,I=>(n.openBlock(),n.createBlock(V,n.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:q=>f(I)}),n.createSlots({default:n.withCtx(()=>[n.createTextVNode(" "+n.toDisplayString(I.title)+" ",1),I.visible?(n.openBlock(),n.createBlock(T,{key:0,class:"btn-del",onClick:n.withModifiers(q=>u(I),["stop"])},null,8,["onClick"])):n.createCommentVNode("",!0)]),_:2},[I.icon?{name:"icon",fn:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(I.icon)))]),key:"0"}:void 0]),1040,["class","type","size","onClick"]))),128)),n.createVNode(V,{class:n.normalizeClass(["btn","btn-add"]),onClick:b[5]||(b[5]=I=>p()),size:"small"},{default:n.withCtx(()=>[n.createVNode(F)]),_:1})])):n.createCommentVNode("",!0),n.createVNode(B,{orientation:"left"},{default:n.withCtx(()=>b[11]||(b[11]=[n.createTextVNode("表头设置")])),_:1}),b[12]||(b[12]=n.createTextVNode(" 数据模型:")),n.createVNode($,{class:"data-model-list",options:l.value,value:i.value.dataModel,"onUpdate:value":b[6]||(b[6]=I=>i.value.dataModel=I)},null,8,["options","value"]),n.createVNode(W,{columns:t.value,"data-source":k.value,bordered:"",scroll:{x:800},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:I})=>[["showIndex","showWidth","align","fixed"].includes(I.key)?(n.openBlock(),n.createElementBlock("span",rr,[n.createVNode(N),n.createTextVNode(" "+n.toDisplayString(I.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:I,record:q})=>[["showIndex","showWidth"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!w.value[q.name]||!Object.keys(w.value[q.name]).includes(I.dataIndex))&&!m(q,I.dataIndex)&&"empty"]),onClick:he=>O(q,I.dataIndex)},[w.value[q.name]&&Object.keys(w.value[q.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(A,{key:0,value:w.value[q.name][I.dataIndex],"onUpdate:value":he=>w.value[q.name][I.dataIndex]=he,onBlur:he=>g(q,I.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[x]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m(q,I.dataIndex)),1)],64))],10,dr)):["isList","isQuery","isSort"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",cr,[n.createVNode(M,{checked:q[I.dataIndex],onClick:he=>S(q,I.dataIndex)},null,8,["checked","onClick"])])):["align","fixed"].includes(I.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!w.value[q.name]||!Object.keys(w.value[q.name]).includes(I.dataIndex))&&!m(q,I.dataIndex)&&"empty"]),onClick:he=>O(q,I.dataIndex)},[w.value[q.name]&&Object.keys(w.value[q.name]).includes(I.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock($,{key:0,value:q.show.list[I.dataIndex],"onUpdate:value":he=>q.show.list[I.dataIndex]=he,allowClear:!0,options:I.options,onBlur:b[7]||(b[7]=he=>g())},null,8,["value","onUpdate:value","options"])),[[x]]):(n.openBlock(),n.createElementBlock("span",fr,n.toDisplayString(I.showLabel(I.options,m(q,I.dataIndex))),1))],10,hr)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(di,{ref_key:"btnSetting",ref:h,preset:["edit","view","add","delBatch","expData","impData","downTmpl"]},null,512)])}}}),[["__scopeId","data-v-c966c24c"]]);function en(o){const e=o.toLowerCase().split("_"),t=[];t.push(e[0]);for(let i=1;i<e.length;i++){const l=e[i];l&&(t.push(l.charAt(0).toUpperCase()),l.length>1&&t.push(l.substring(1)))}return t.join("")}const pr={toHump:en},mr={class:"unione-table-tools"},gr={class:"unione-table-data"},kr={key:0,class:"unione-table-opts"},vl=ee(n.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(o,{expose:e,emit:t}){const i=Ae(),l=o,s=n.computed(()=>l.editor?.widget(l.wid)||l.widget||{}),a=n.computed(()=>s.value.props||{}),r=n.computed(()=>s.value.rowKey||l.rowKey||"id"),d=n.computed(()=>s.value.dsn?l.editor?.dataManager().use(s.value.dsn,"list"):null),c=n.computed(()=>{const V=l.dataList||[];return!V.length&&d.value?d.value.data()||[]:V}),h=n.computed(()=>{if(s.value.operation==!1)return{visible:!1};const V=K.utils.obj.ext(s.value.operation||{},{title:"操作",visible:!0,width:200,count:2,btns:[],more:{title:"更多",visible:!0,trigger:"hover",size:"small",layout:"horizontal",items:[]}}),F=[];let D=s.value.operation?.btns||[];if(D.forEach(P=>{F.push(P.name)}),F.includes("edit")||D.splice(0,0,{title:"编辑",name:"edit",type:"default",visible:!0}),F.includes("view")||D.splice(1,0,{title:"查看",name:"view",type:"default",visible:!0}),F.includes("delete")||D.push({title:"删除",name:"delete",type:"default",props:{danger:!0},visible:!0}),l.editor){const P=D.filter(A=>A.name=="edit")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const A=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",M=l.editor.model.value;P.action.href=i.editPageUrl+"?psn="+A+"&model="+M+"&id={row."+l.rowKey+"}"}const E=D.filter(A=>A.name=="view")[0];if(E.visible&&(E.action||(E.action={}),E.action.type||(E.action.type="route"),!E.action.href)){const A=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form";E.action.href=i.viewPageUrl+"?psn="+A+"&model=view&id={row."+l.rowKey+"}"}}return D=D.filter(P=>P.visible!=!1).sort((P,E)=>{const A=P.index||1,M=E.index||1;return A-M}),V.count&&(D.length>V.count+1?(V.btns=D.slice(0,V.count),V.more.items=D.slice(V.count,D.length),V.more.visible=!0):(V.btns=D,V.more.visible=!1)),V}),f=n.computed(()=>{let V=[];s.value.columns?.length&&(V=[...s.value.columns]);const F=[];V.forEach((P,E)=>{P.dataIndex=P.name,P.convert&&(P.dataIndex=P.name+"Label",P.convertObj=new dt(P.convert),P.customCell=(A,M,z)=>{const $=A[z.name];P.convertObj&&(A[z.dataIndex]==null||A[z.dataIndex]==null)&&$!=null&&$!=null&&($+"").length>0&&(A[z.dataIndex]=$,P.convertObj.convert($).then(N=>{N&&(A[z.dataIndex]=N)}))}),P.sort?.enable&&(P.sorter=!0,P.sort.defoult&&(P.defaultSortOrder=P.sort.asc?"ascend":"descend")),P.customRender=({text:A})=>A||"--",P.fkey?.enable&&(P.fkey.labelName&&(P.dataIndex=en(P.fkey.labelName)),P.fkey.labelTitle&&(P.title=P.fkey.labelTitle),P.customRender=({record:A,column:M})=>A&&A[M.name+"FEntry"]&&A[M.name+"FEntry"][M.dataIndex]||"--",P.fkey.fields?.forEach((A,M)=>{if(!A.name)return;const z=en(A.name),$={fkName:P.name,title:A.title,name:z,dataIndex:A.name,width:A.width,index:A.index||E+M+1,customRender:({record:N,column:W})=>{if(N&&N[W.fkName+"FEntry"]){const I=N[W.fkName+"FEntry"][W.name];if(I)return A.convertObj&&A.convertObj.convert(I)||I}return"--"}};A.convert&&(A.convertObj=new dt(A.convert)),F.push($)}))}),F.forEach(P=>{V.splice(P.index,0,P)});const D=K.utils.obj.ext(s.value.rownum,{title:"序号",fixed:"left",align:"center",width:60,visible:!0});return D&&D.visible!=!1&&(D.customRender=P=>v.value?(v.value.current-1)*v.value.pageSize+P.index+1:P.index,V=[D,...V]),h.value&&h.value.visible!=!1&&V.push({fixed:"right",align:"center",...h.value,name:"operation"}),V}),p=n.computed(()=>{if(s.value.leftBtns==!1)return[];const V=[],F=[];if((s.value.leftBtns||[]).forEach(P=>{P.visible!=!1&&V.push(P),F.push(P.name),P.name=="delBatch"&&!O.value&&(P.visible=!1)}),!F.includes("add")){const P={visible:!0,title:"新增",icon:"PlusOutlined",size:"small",index:0,type:"primary",props:{danger:!1,block:!1,ghost:!1},name:"add"};V.splice(0,0,P)}if(!F.includes("delBatch")&&O.value){const P={visible:!0,title:"批量删除",icon:"DeleteOutlined",size:"small",index:1,type:"primary",props:{danger:!0,block:!1,ghost:!1},name:"delBatch"};V.splice(1,0,P)}if(l.editor){const P=V.filter(E=>E.name=="add")[0];if(P.visible&&(P.action||(P.action={}),P.action.type||(P.action.type="route"),!P.action.href)){const E=(l.editor.sn().endsWith(":list")?l.editor.sn().substring(0,l.editor.sn().length-5):l.editor.sn())+":form",A=l.editor.model.value;P.action.href=i.addPageUrl+"?psn="+E+"&model="+A}}return V});function u({btn:V,event:F}){if(i.isDebug&&console.log("unione table left btn click",V,F),V.name=="delBatch"){if(!g.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的记录!"});return}if(d.value){d.value.loadByIds(g.value.selectedRowKeys);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除选中的("+g.value.selectedRowKeys.length+")数据",onOk:()=>{S("delBatch",{btn:V,event:F,keys:g.value.selectedRowKeys}),S("leftBtnClick",{btn:V,event:F,keys:g.value.selectedRowKeys}),S("btnClick",{btn:V,event:F,keys:g.value.selectedRowKeys})}});return}S(V.name,{btn:V,event:F}),S("leftBtnClick",{btn:V,event:F}),S("btnClick",{btn:V,event:F})}const y=n.computed(()=>{if(s.value.rightBtns==!1)return[];const V=[],F=[];if((s.value.rightBtns||[]).forEach(P=>{P.visible!=!1&&V.push(P),F.push(P.name)}),!F.includes("impData")){const P={visible:!0,title:"导入",icon:"CloudUploadOutlined",size:"small",index:1,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"impData"};V.splice(1,0,P)}if(!F.includes("expData")){const P={visible:!0,title:"导出",icon:"CloudUploadOutlined",size:"small",index:2,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"expData"};V.splice(2,0,P)}if(!F.includes("downTmpl")){const P={visible:!0,icon:"CloudDownloadOutlined",size:"small",title:"模版",index:3,type:"default",props:{danger:!1,block:!1,ghost:!1},name:"downTmpl"};V.splice(3,0,P)}return V});function k({btn:V,event:F}){i.isDebug&&console.log("unione table right btn click",V,F),S(V.name,{btn:V,event:F}),S("rightBtnClick",{btn:V,event:F}),S("btnClick",{btn:V,event:F})}const x=n.computed(()=>({bordered:!0,size:"small",...s.value.attrs||{}})),w=n.ref({}),v=n.computed(()=>K.utils.obj.ext(l.pagination||s.value.pagination,{showTotal:V=>"共"+V+"记录",pageSize:10,current:1,total:0,position:["bottomCenter"]})),O=n.computed(()=>typeof s.value.selection<"u"?s.value.selection:!0),g=n.ref({selectedRowKeys:[],selectedRowList:[],onChange:(V,F)=>{g.value.selectedRowKeys=V,g.value.selectedRowList=F},getCheckboxProps:V=>({disabled:V.checkable})}),m=["edit","view","add","delete","delBatch","impData","expData","downTmpl"],S=t;function _({btn:V,event:F},D){if(i.isDebug&&console.log("unione table opt btn click",V,F),V.name=="delete"){if(d.value){d.value.deleteByIds([D[r.value]]);return}G.Modal.confirm({title:"确认信息",content:"请确认是否要删除该记录?",onOk:()=>{S(V.name,{btn:V,event:F,row:D}),S("optBtnClick",{btn:V,event:F,row:D}),S("btnClick",{btn:V,event:F,row:D})}});return}S(V.name,{btn:V,event:F,row:D}),S("optBtnClick",{btn:V,event:F,row:D}),S("btnClick",{btn:V,event:F,row:D})}function C(V,F,D,P){B(),S("change",{pagination:V,filters:F,sorter:D,event:P})}function b(){G.Modal.confirm({title:"确认信息",content:`确定要清除当前选中的(${g.value.selectedRowKeys.length})条数据?`,centered:!0,onOk:()=>{g.value.selectedRowKeys=[],g.value.selectedRowList=[]}})}function B(){console.log("dataStorage.value",d.value),d.value?.find({body:w.value,page:v.value.current,pageSize:v.value.pageSize})}n.onMounted(()=>{l.editor?.ebus.$on("table-list-search",V=>{console.log("table-list-search",V),w.value=V||{},B()})});function T(){return{keys:g.value.selectedRowKeys,rows:g.value.selectedRowList}}return e({getSelected:T,clearSelected:b}),(V,F)=>{const D=n.resolveComponent("unione-btn"),P=n.resolveComponent("DownOutlined"),E=n.resolveComponent("a-button"),A=n.resolveComponent("a-dropdown"),M=n.resolveComponent("a-table");return n.openBlock(),n.createBlock(rt,{class:"unione-table-list",model:l.editor?.model.value,"setting-title":"列表设置"},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",mr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(p.value,z=>(n.openBlock(),n.createBlock(D,{key:z.name,class:"btn",widget:z,editor:o.editor,onClick:u,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128)),g.value.selectedRowKeys.length?(n.openBlock(),n.createElementBlock("span",{key:0,class:"selected-info",onClick:b},"当前选中记录("+n.toDisplayString(g.value.selectedRowKeys.length)+")",1)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(y.value,z=>(n.openBlock(),n.createBlock(D,{key:z.name,class:"btn right",widget:z,editor:o.editor,onClick:k,preset:m,ctx:{sltKeys:g.value.selectedRowKeys,sltRows:g.value.selectedRowList}},null,8,["widget","editor","ctx"]))),128))]),n.createElementVNode("div",gr,[f.value&&f.value.length?(n.openBlock(),n.createBlock(M,n.mergeProps({key:0,columns:f.value,rowKey:r.value,"data-source":c.value,"row-selection":O.value?g.value:null,scroll:{x:a.value.scrollX||"max-content",y:a.value.scrollY},pagination:v.value,onChange:C},x.value),{bodyCell:n.withCtx(({column:z,record:$})=>[z.name==="operation"?(n.openBlock(),n.createElementBlock("div",kr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.btns,N=>(n.openBlock(),n.createBlock(D,{key:N.name,class:"opt",widget:N,editor:o.editor,onClick:W=>_(W,$),preset:m,ctx:{row:$}},null,8,["widget","editor","onClick","ctx"]))),128)),h.value.more?.visible!=!1&&h.value.more.items?.length?(n.openBlock(),n.createBlock(A,{key:0,trigger:[h.value.more.trigger||"hover"],class:n.normalizeClass(["opt-more",h.value.more.size||"small"])},{overlay:n.withCtx(()=>[n.createElementVNode("div",{class:n.normalizeClass(["opt-more-overlay",h.value.more.layout])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.value.more.items,N=>(n.openBlock(),n.createBlock(D,{key:N.name,class:"item",widget:N,editor:o.editor,onClick:W=>_(W,$),type:"text",preset:m,ctx:{row:$}},null,8,["widget","editor","onClick","ctx"]))),128))],2)]),default:n.withCtx(()=>[n.createVNode(E,null,{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(h.value.more.title)+" ",1),n.createVNode(P)]),_:1})]),_:2},1032,["trigger","class"])):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0)]),_:1},16,["columns","rowKey","data-source","row-selection","scroll","pagination"])):n.createCommentVNode("",!0)])]),_:2},[l.editor&&l.wid?{name:"widget-setting",fn:n.withCtx(()=>[n.createVNode(ur,{editor:l.editor,wid:l.wid},null,8,["editor","wid"])]),key:"0"}:void 0]),1032,["model"])}}}),[["__scopeId","data-v-a9f2c11d"]]),br={class:"page-setting-dialog"},Lt=n.defineComponent({__name:"page",props:{settingTitle:{type:String,default:"页面设置"},editor:{type:Object,required:!1}},emits:["setting","saving"],setup(o,{emit:e}){const t=o,i=n.computed(()=>t.editor?.model?.value),l=K.useSession(),s=n.computed(()=>l.getPrincipal()),a=n.ref(!1);n.provide("closeSetting",()=>{t.editor?.save().then(p=>{a.value=!1})});function r(){a.value=!0}function d(){t.editor?.save().then(p=>{console.log("res",p)})}function c(){t.editor?.save().then(p=>{console.log("res",p)})}const h=n.ref("");function f(p){h.value||(h.value=i.value),p?t.editor?.setModel("edit"):t.editor?.setModel(h.value)}return(p,u)=>{const y=n.resolveComponent("SettingOutlined"),k=n.resolveComponent("a-tooltip"),x=n.resolveComponent("SaveOutlined"),w=n.resolveComponent("FormOutlined"),v=n.resolveComponent("StopOutlined"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-page",i.value])},[i.value=="edit"&&p.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:0,title:o.settingTitle},{default:n.withCtx(()=>[n.createVNode(y,{class:"page-setting",onClick:r})]),_:1},8,["title"])):n.createCommentVNode("",!0),i.value=="edit"&&p.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:1,title:"保存页面"},{default:n.withCtx(()=>[n.createVNode(x,{class:"btn-save",onClick:d})]),_:1})):n.createCommentVNode("",!0),i.value!="edit"&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:2,title:"编辑页面"},{default:n.withCtx(()=>[n.createVNode(w,{class:"btn-edit",onClick:u[0]||(u[0]=g=>f(!0))})]),_:1})):n.createCommentVNode("",!0),i.value=="edit"&&p.$slots["page-setting"]&&s.value?.userRoles?.includes("FORM-ADMIN")?(n.openBlock(),n.createBlock(k,{key:3,title:"退出编辑"},{default:n.withCtx(()=>[n.createVNode(v,{class:"btn-edit",onClick:u[1]||(u[1]=g=>f(!1))})]),_:1})):n.createCommentVNode("",!0),n.renderSlot(p.$slots,"default"),i.value=="edit"?(n.openBlock(),n.createBlock(O,{key:4,title:t.settingTitle,open:a.value,"onUpdate:open":u[2]||(u[2]=g=>a.value=g),centered:"",width:"85%",onOk:c},{default:n.withCtx(()=>[n.createElementVNode("div",br,[n.renderSlot(p.$slots,"page-setting")])]),_:3},8,["title","open"])):n.createCommentVNode("",!0)],2)}}}),yr={class:"unione-props-setting data-field-manage"},wr={key:0},xr={key:1},vr={key:2},Cr={key:3},Sr={key:4},Nr={key:5},Br={key:6},Or=["onClick"],Vr=["onClick"],_r=["onClick"],Mr={key:1},Tr=ee(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.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=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:p=>{p.forEach(u=>{i.value.selectedRowKeys.includes(u)||i.value.selectedRowKeys.push(u);const y=[];t.value.forEach(k=>{!p.includes(k.name)&&i.value.selectedRowKeys.includes(k.name)&&y.push(k.name)}),y.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(k=>!y.includes(k)))})}}),l={mounted:p=>p.focus()},s=n.ref({});function a(){const p=Object.keys(s.value);if(p.length)for(let u in p){const y=t.value.filter(k=>k.name==u);if(y&&y[0]){let k=s.value[u];Object.keys(k).forEach(x=>{y[0][x]=k[x]})}}s.value={}}function r(p,u){a();const y={};y[u]=p[u]||"",s.value[p.name]=y}function d(p,u){if(!p||!u){s.value={};return}const y=s.value[p.name][u];if(u=="name"&&t.value.filter(x=>x[u]==y&&x.name!=p.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+y+"]已存在"});return}p[u]=y,s.value={}}function c(p,u){t.value.filter(k=>k.name==p.name).forEach(k=>{k[u]=!k[u]})}function h(){if(a(),t.value.filter(y=>y.name=="new_").length>0){s.value.new_={name:"new_"};return}const u={title:"",name:"new_",isPk:!1};t.value.push(u),s.value[u.name]={name:"new_"}}function f(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(p=>!i.value.selectedRowKeys.includes(p.name)),i.value.selectedRowKeys=[]}})}return(p,u)=>{const y=n.resolveComponent("a-button"),k=n.resolveComponent("a-tooltip"),x=n.resolveComponent("a-input"),w=n.resolveComponent("a-input-number"),v=n.resolveComponent("a-select-option"),O=n.resolveComponent("a-select"),g=n.resolveComponent("a-checkbox"),m=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",yr,[n.createVNode(y,{class:"btn btn-add",type:"primary",onClick:h,size:"small"},{default:n.withCtx(()=>u[1]||(u[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(y,{class:"btn btn-delete",type:"primary",danger:"",onClick:f,size:"small"},{default:n.withCtx(()=>u[2]||(u[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(m,{columns:e.value,"data-source":t.value,pagination:!1,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small",sticky:""},{headerCell:n.withCtx(({column:S})=>[S.key==="name"?(n.openBlock(),n.createElementBlock("span",wr,[u[3]||(u[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="title"?(n.openBlock(),n.createElementBlock("span",xr,[u[4]||(u[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="descs"?(n.openBlock(),n.createElementBlock("span",vr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataLen"?(n.openBlock(),n.createElementBlock("span",Cr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataPrec"?(n.openBlock(),n.createElementBlock("span",Sr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="defaultValue"?(n.openBlock(),n.createElementBlock("span",Nr,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="dataType"?(n.openBlock(),n.createElementBlock("span",Br,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(S.title),1)])):n.createCommentVNode("",!0),S.key==="isPk"?(n.openBlock(),n.createBlock(k,{key:7,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[u[5]||(u[5]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isFk"?(n.openBlock(),n.createBlock(k,{key:8,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="isNull"?(n.openBlock(),n.createBlock(k,{key:9,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0),S.key==="syncDbEnable"?(n.openBlock(),n.createBlock(k,{key:10,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(S.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:S,text:_,record:C})=>[["name","title","descs","defaultValue"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(x,{key:0,value:s.value[C.name][S.dataIndex],"onUpdate:value":b=>s.value[C.name][S.dataIndex]=b,onBlur:b=>d(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,Or)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[C.name][S.dataIndex],"onUpdate:value":b=>s.value[C.name][S.dataIndex]=b,onBlur:b=>d(C,S.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_||" "),1)],64))],10,Vr)):["dataType"].includes(S.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[C.name]||!Object.keys(s.value[C.name]).includes(S.dataIndex))&&!_&&"empty"]),onClick:b=>r(C,S.dataIndex)},[s.value[C.name]&&Object.keys(s.value[C.name]).includes(S.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(O,{key:0,value:C[S.dataIndex],"onUpdate:value":b=>C[S.dataIndex]=b,onBlur:u[0]||(u[0]=b=>d())},{default:n.withCtx(()=>[n.createVNode(v,{key:"String",value:"String"}),n.createVNode(v,{key:"Long",value:"Long"}),n.createVNode(v,{key:"Short",value:"Short"}),n.createVNode(v,{key:"Integer",value:"Integer"}),n.createVNode(v,{key:"Float",value:"Float"}),n.createVNode(v,{key:"Double",value:"Double"}),n.createVNode(v,{key:"Date",value:"Date"}),n.createVNode(v,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Mr,n.toDisplayString(_),1))],10,_r)):["syncDbEnable","isFk","isPk"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:3,checked:C[S.dataIndex],onClick:b=>c(C,S.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(S.dataIndex)?(n.openBlock(),n.createBlock(g,{key:4,checked:!C[S.dataIndex],onClick:b=>c(C,S.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-f6307a23"]]),Ar={class:"unione-props-setting data-field-setting"},Er={key:0},Ir=["onClick"],Dr={class:"field-txt"},Pr=["onClick"],Fr={key:1,class:"field-txt"},$r=["onClick"],Rr={key:1},Lr=["onClick"],jr={key:0,class:"field-txt"},zr={key:4,class:"edit-field"},qr={key:0},Ur=["onClick"],Wr=ee(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:w})=>w+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=n.useModel(o,"modelValue"),i={mounted:w=>w.focus()},l=n.ref({});function s(){const w=Object.keys(l.value);if(w.length)for(let v in w){const O=t.value.filter(g=>g.name==v);if(O&&O[0]){let g=l.value[v];Object.keys(g).forEach(m=>{m=="convertName"?(O[0].convert||(O[0].convert={}),O[0].convert.type=g[m]):O[0][m]=g[m]})}}l.value={}}function a(w,v){s();const O={};v=="convertName"?(w.convert||(w.convert={}),O[v]=w.convert?.type):O[v]=w[v]||"",l.value[w.name]=O}function r(w,v){{l.value={};return}}function d(w,v){t.value.filter(g=>g.name==w.name).forEach(g=>{g[v]=!g[v]})}const c=n.ref({title:"列头设置",prop:"isList",visible:!1,field:{},show:{},toSetting:()=>{c.value.visible=!1}});function h(w,v){const O=t.value.filter(m=>m.name==w.name);O.forEach(m=>{v!="isSort"?m[v]=!0:m[v]=!m[v]});const g=O[0];if(!(!g||v=="isSort")){switch(c.value.prop=v,c.value.field=w,g.show||(g.show={}),v){case"isQuery":g.show.query||(g.show.query={}),c.value.show=g.show.query,c.value.title=`查询设置/${w.title}(${w.name})`;break;case"isForm":g.show.form||(g.show.form={}),c.value.show=g.show.form,c.value.title=`表单设置/${w.title}(${w.name})`;break;case"isView":g.show.view||(g.show.view={}),c.value.show=g.show.view,c.value.title=`详情设置/${w.title}(${w.name})`;break;case"isList":g.show.list||(g.show.list={}),c.value.show=g.show.list,c.value.title=`列头设置/${w.title}(${w.name})`;break}c.value.visible=!0}}const f=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:w=>{const v=f.value.options.filter(O=>O.value==w);return v[0]?v[0].label:w}}),p=n.ref({visible:!1,field:{},props:{},showInfo:w=>{let v="";return w.rules&&(v=w.rules.filter(O=>O.enable).length||""),v&&(v="("+v+")"),v},toSetting:()=>{const w=p.value.props,v={name:"range",trigger:w.trigger,whitespace:w.whitespace,message:w.rangeMessage};w.rangeMin!=null&&w.rangeMin!=null&&(v.min=w.rangeMin,v.enable=!0),w.rangeMax!=null&&w.rangeMax!=null&&(v.max=w.rangeMax,v.enable=!0);const O={name:"reg",trigger:w.trigger,whitespace:w.whitespace,message:w.regMessage};w.regExpress&&(O.pattern=w.regExpress,O.enable=!0),p.value.field.rules=[v,O],p.value.visible=!1,p.value.props={},console.log("rule",p.value.field.rules)}});function u(w){p.value.visible=!0,p.value.field=w;const v=w.rules||[],O={trigger:"change",whitespace:!0};v.forEach(g=>{g.name=="reg"&&(O.trigger=g.trigger,O.whitespace=g.whitespace,O.regExpress=g.pattern,O.regMessage=g.message),g.name=="range"&&(O.rangeMin=g.min,O.rangeMax=g.max,O.rangeMessage=g.message)}),p.value.props=O}const y=n.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:w=>{const v=y.value.widgets.filter(O=>O.value==w);return v[0]?v[0].label:w},toSetting:()=>{}}),k=n.ref({visible:!1,field:{},convert:{},optionColumn:[{title:"选项标题",dataIndex:"label"},{title:"选项值",dataIndex:"value"},{title:"操作",dataIndex:"action",width:"20%"}],toAddOption:()=>{k.value.convert.options||(k.value.convert.options=[]),k.value.convert.options.push({label:"",value:""})},toDelOption:(w,v)=>{k.value.convert.options.splice(w,1)},toSetting:()=>{k.value.visible=!1}});function x(w){k.value.visible=!0,k.value.field=w,k.value.convert=w.convert||{}}return(w,v)=>{const O=n.resolveComponent("ToolOutlined"),g=n.resolveComponent("a-button"),m=n.resolveComponent("a-select"),S=n.resolveComponent("a-checkbox"),_=n.resolveComponent("a-table"),C=n.resolveComponent("a-input-number"),b=n.resolveComponent("a-form-item"),B=n.resolveComponent("a-input"),T=n.resolveComponent("a-form"),V=n.resolveComponent("a-modal"),F=n.resolveComponent("a-col"),D=n.resolveComponent("a-row"),P=n.resolveComponent("a-select-option"),E=n.resolveComponent("a-divider"),A=n.resolveComponent("a-checkbox-group");return n.openBlock(),n.createElementBlock("div",Ar,[n.createVNode(_,{columns:e.value,"data-source":t.value,bordered:"",scroll:{x:1e3},pagination:!1,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:M})=>[["widget","queryType","rules","convertName"].includes(M.key)?(n.openBlock(),n.createElementBlock("span",Er,[n.createVNode(O),n.createTextVNode(" "+n.toDisplayString(M.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:M,text:z,record:$})=>[["rules"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!p.value.showInfo($)&&"empty"]),onClick:N=>u($)},[n.createElementVNode("span",Dr,n.toDisplayString(p.value.showInfo($)),1),p.value.showInfo($)?(n.openBlock(),n.createBlock(g,{key:0,type:"link"},{default:n.withCtx(()=>v[22]||(v[22]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Ir)):["widget"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!l.value[$.name]||!Object.keys(l.value[$.name]).includes(M.dataIndex))&&!z&&"empty"]),onClick:N=>a($,M.dataIndex)},[l.value[$.name]&&Object.keys(l.value[$.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:$[M.dataIndex],"onUpdate:value":N=>$[M.dataIndex]=N,allowClear:!0,options:y.value.widgets,onBlur:v[0]||(v[0]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Fr,n.toDisplayString(y.value.widgetName(z)),1))],10,Pr)):["queryType"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock(n.Fragment,{key:2},[$.isQuery?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!l.value[$.name]||!Object.keys(l.value[$.name]).includes(M.dataIndex))&&!z&&"empty"]),onClick:N=>a($,M.dataIndex)},[l.value[$.name]&&Object.keys(l.value[$.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:$[M.dataIndex],"onUpdate:value":N=>$[M.dataIndex]=N,allowClear:!0,options:f.value.options,onBlur:v[1]||(v[1]=N=>r())},null,8,["value","onUpdate:value","options"])),[[i]]):(n.openBlock(),n.createElementBlock("span",Rr,n.toDisplayString(f.value.showLabel(z)),1))],10,$r)):n.createCommentVNode("",!0)],64)):["convertName"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!l.value[$.name]||!Object.keys(l.value[$.name]).includes(M.dataIndex))&&!$.convert?.type&&"empty"]),onClick:N=>a($,M.dataIndex)},[l.value[$.name]&&Object.keys(l.value[$.name]).includes(M.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(m,{key:0,value:$.convert.type,"onUpdate:value":N=>$.convert.type=N,options:[{value:"dict",label:"字典"},{value:"option",label:"静态"}],allowClear:!0,onBlur:v[2]||(v[2]=N=>r())},null,8,["value","onUpdate:value"])),[[i]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[$.convert?.type?(n.openBlock(),n.createElementBlock("span",jr,n.toDisplayString($.convert.type=="dict"?"字典":"静态"),1)):n.createCommentVNode("",!0),$.convert?.type?(n.openBlock(),n.createBlock(g,{key:1,type:"link",onClick:n.withModifiers(N=>x($),["stop"])},{default:n.withCtx(()=>v[23]||(v[23]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,Lr)):["isQuery","isForm","isView","isList","isSort"].includes(M.dataIndex)?(n.openBlock(),n.createElementBlock("div",zr,[n.createVNode(S,{checked:$[M.dataIndex],onClick:N=>d($,M.dataIndex)},null,8,["checked","onClick"]),n.createVNode(g,{type:"link",onClick:N=>h($,M.dataIndex)},{default:n.withCtx(()=>v[24]||(v[24]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(V,{visible:c.value.visible,"onUpdate:visible":v[9]||(v[9]=M=>c.value.visible=M),title:c.value.title,onOk:c.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:c.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(b,{label:"显示顺序"},{default:n.withCtx(()=>[n.createVNode(C,{value:c.value.show.index,"onUpdate:value":v[3]||(v[3]=M=>c.value.show.index=M)},null,8,["value"])]),_:1}),["isQuery"].includes(c.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(b,{key:0,label:"显示宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.width,"onUpdate:value":v[4]||(v[4]=M=>c.value.show.width=M)},null,8,["value"])]),_:1})),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:1,label:"标题宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.labelWidth,"onUpdate:value":v[5]||(v[5]=M=>c.value.show.labelWidth=M)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isForm","isView"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:2,label:"控件宽度"},{default:n.withCtx(()=>[n.createVNode(B,{value:c.value.show.valueWidth,"onUpdate:value":v[6]||(v[6]=M=>c.value.show.valueWidth=M)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:3,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.fixed,"onUpdate:value":v[7]||(v[7]=M=>c.value.show.fixed=M),options:[{value:"",label:"无"},{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["isList"].includes(c.value.prop)?(n.openBlock(),n.createBlock(b,{key:4,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(m,{value:c.value.show.align,"onUpdate:value":v[8]||(v[8]=M=>c.value.show.align=M),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:k.value.visible,"onUpdate:visible":v[11]||(v[11]=M=>k.value.visible=M),title:k.value.convert.type=="dict"?"字典设置":"选项设置",onOk:k.value.toSetting},{default:n.withCtx(()=>[k.value.convert.type!="dict"?(n.openBlock(),n.createElementBlock("div",qr,[n.createVNode(g,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:k.value.toAddOption},{default:n.withCtx(()=>v[25]||(v[25]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(_,{columns:k.value.optionColumn,"data-source":k.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:M,text:z,record:$,index:N})=>[M.dataIndex==="label"?(n.openBlock(),n.createBlock(B,{key:0,value:$.label,"onUpdate:value":W=>$.label=W,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),M.dataIndex==="value"?(n.openBlock(),n.createBlock(B,{key:1,value:$.value,"onUpdate:value":W=>$.value=W,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),M.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:W=>k.value.toDelOption(N,$)},"删除",8,Ur)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])])):n.createCommentVNode("",!0),k.value.convert.type=="dict"?(n.openBlock(),n.createBlock(T,{key:1,model:k.value.convert,name:"basic","label-col":{span:8},"wrapper-col":{span:16},autocomplete:"off"},{default:n.withCtx(()=>[n.createVNode(D,{type:"flex",style:{width:"100%"}},{default:n.withCtx(()=>[n.createVNode(F,{span:24,order:1},{default:n.withCtx(()=>[n.createVNode(b,{label:"字典名称:"},{default:n.withCtx(()=>[n.createVNode(B,{value:k.value.convert.dict,"onUpdate:value":v[10]||(v[10]=M=>k.value.convert.dict=M)},null,8,["value"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])):n.createCommentVNode("",!0)]),_:1},8,["visible","title","onOk"]),n.createVNode(V,{visible:y.value.visible,"onUpdate:visible":v[13]||(v[13]=M=>y.value.visible=M),title:"控件设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:y.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off"},{default:n.withCtx(()=>[y.value.field.widget=="a-select"?(n.openBlock(),n.createBlock(b,{key:0,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(m,{value:y.value.props.mode,"onUpdate:value":v[12]||(v[12]=M=>y.value.props.mode=M),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(P,{value:"multiple"},{default:n.withCtx(()=>v[26]||(v[26]=[n.createTextVNode("多选")])),_:1}),n.createVNode(P,{value:"tags"},{default:n.withCtx(()=>v[27]||(v[27]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(V,{visible:p.value.visible,"onUpdate:visible":v[21]||(v[21]=M=>p.value.visible=M),title:"规则设置",onOk:p.value.toSetting},{default:n.withCtx(()=>[n.createVNode(T,{model:p.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(E,{orientation:"left"},{default:n.withCtx(()=>v[28]||(v[28]=[n.createTextVNode("基本设置")])),_:1}),n.createVNode(b,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(A,{value:p.value.props.trigger,"onUpdate:value":v[14]||(v[14]=M=>p.value.props.trigger=M),options:["change","blur"]},null,8,["value"])]),_:1}),p.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(b,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(S,{value:p.value.props.whitespace,"onUpdate:value":v[15]||(v[15]=M=>p.value.props.whitespace=M),checked:p.value.props.whitespace},{default:n.withCtx(()=>v[29]||(v[29]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["value","checked"])]),_:1})),n.createVNode(E,{orientation:"left"},{default:n.withCtx(()=>v[30]||(v[30]=[n.createTextVNode("数值区间")])),_:1}),n.createVNode(b,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(C,{value:p.value.props.rangeMin,"onUpdate:value":v[16]||(v[16]=M=>p.value.props.rangeMin=M)},null,8,["value"]),v[31]||(v[31]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(C,{value:p.value.props.rangeMax,"onUpdate:value":v[17]||(v[17]=M=>p.value.props.rangeMax=M)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:p.value.props.rangeMessage,"onUpdate:value":v[18]||(v[18]=M=>p.value.props.rangeMessage=M)},null,8,["value"])]),_:1}),n.createVNode(E,{orientation:"left"},{default:n.withCtx(()=>v[32]||(v[32]=[n.createTextVNode("正则验证")])),_:1}),n.createVNode(b,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(B,{value:p.value.props.regExpress,"onUpdate:value":v[19]||(v[19]=M=>p.value.props.regExpress=M)},null,8,["value"])]),_:1}),n.createVNode(b,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(B,{value:p.value.props.regMessage,"onUpdate:value":v[20]||(v[20]=M=>p.value.props.regMessage=M)},null,8,["value"])]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-ef9b9849"]]),Hr={class:"unione-props-setting data-field"},Kr=ee(n.defineComponent({__name:"dataField",props:n.mergeModels({filter:{type:Array,default(){return[]}}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=n.useModel(o,"modelValue");return(t,i)=>{const l=n.resolveComponent("OrderedListOutlined"),s=n.resolveComponent("a-tab-pane"),a=n.resolveComponent("ToolOutlined"),r=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Hr,[n.createVNode(r,null,{default:n.withCtx(()=>[n.createVNode(s,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(l),i[2]||(i[2]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(Tr,{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=d=>e.value=d)},null,8,["modelValue"])]),_:1}),n.createVNode(s,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(a),i[3]||(i[3]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Wr,{modelValue:e.value,"onUpdate:modelValue":i[1]||(i[1]=d=>e.value=d)},null,8,["modelValue"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-008d1148"]]),Qr={key:0,class:"data-model-list"},Gr=["onClick"],Yr=ee(n.defineComponent({__name:"dataDefine",props:{limit:{type:Number,default:100},editor:{type:Object,required:!0}},setup(o,{expose:e}){const t=n.computed(()=>l.editor.dataModels()),i=n.ref({sn:"new_",title:"新建数据",fields:[]});n.onMounted(()=>{t.value&&t.value[0]&&(i.value=t.value[0])});const l=o;function s(f){i.value=f}function a(){if(t.value.length>=l.limit){G.Modal.warn({title:"提示信息",content:"数据模型数量超出限制!"});return}const f=la.v4(),p={sn:f,title:"新建数据",name:"new_",fields:[]};i.value=p,console.log("data model added",p),l.editor.dataModel(f,p)}const r={title:[{required:!0,message:"数据标题不能为空",trigger:"change"}],name:[{required:!0,message:"数据名称不能为空",trigger:"change"}],url:[{required:!0,message:"数据URl不能为空",trigger:"change"}]},d=n.ref(),c=n.inject("closeSetting");function h(){d.value.validate().then(f=>{c&&c()})}return e({toSaving:h}),(f,p)=>{const u=n.resolveComponent("a-input"),y=n.resolveComponent("a-form-item"),k=n.resolveComponent("a-textarea"),x=n.resolveComponent("a-form");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["unione-props-setting","data-define",l.limit<=1&&"center"])},[l.limit>1?(n.openBlock(),n.createElementBlock("div",Qr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,w=>(n.openBlock(),n.createElementBlock("div",{key:w.sn,class:n.normalizeClass(["title",i.value&&i.value.sn==w.sn&&"slt"]),onClick:v=>s(w)},n.toDisplayString(w.title),11,Gr))),128)),n.createElementVNode("div",{class:"title btn-add",onClick:a},"+")])):n.createCommentVNode("",!0),n.createElementVNode("div",{class:n.normalizeClass(["data-model-form",l.limit<=1&&"center"])},[n.createVNode(x,{ref_key:"formObj",ref:d,rules:r,model:i.value,"label-col":{span:4},"wrapper-col":{span:20}},{default:n.withCtx(()=>[n.createVNode(y,{label:"数据标题",name:"title",required:""},{default:n.withCtx(()=>[n.createVNode(u,{value:i.value.title,"onUpdate:value":p[0]||(p[0]=w=>i.value.title=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据名称",name:"name",required:""},{default:n.withCtx(()=>[n.createVNode(u,{value:i.value.name,"onUpdate:value":p[1]||(p[1]=w=>i.value.name=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据URL",name:"url",required:"",tooltip:"数据请求url,统一使用post请求,保存接口:url/save,修改接口:url/update,查询接口:url/find,删除接口:url/delete,详情接口:url/detail"},{default:n.withCtx(()=>[n.createVNode(u,{value:i.value.url,"onUpdate:value":p[2]||(p[2]=w=>i.value.url=w)},null,8,["value"])]),_:1}),n.createVNode(y,{label:"数据说明",name:"descs"},{default:n.withCtx(()=>[n.createVNode(k,{value:i.value.descs,"onUpdate:value":p[3]||(p[3]=w=>i.value.descs=w)},null,8,["value"])]),_:1})]),_:1},8,["model"]),n.createVNode(Kr,{modelValue:i.value.fields,"onUpdate:modelValue":p[4]||(p[4]=w=>i.value.fields=w)},null,8,["modelValue"])],2)],2)}}}),[["__scopeId","data-v-6be2cc50"]]),Xr={class:"unione-props-setting unione-page-setting"},jt=ee(n.defineComponent({__name:"pageSetting",props:{editor:{type:Object,required:!0}},setup(o){const e=o,t=n.ref({});return n.onMounted(()=>{t.value=e.editor.define.value}),(i,l)=>{const s=n.resolveComponent("a-form-item"),a=n.resolveComponent("a-input"),r=n.resolveComponent("a-switch"),d=n.resolveComponent("a-textarea"),c=n.resolveComponent("a-form"),h=n.resolveComponent("a-tab-pane"),f=n.resolveComponent("a-tabs");return n.openBlock(),n.createElementBlock("div",Xr,[n.createVNode(f,{type:"card"},{default:n.withCtx(()=>[n.createVNode(h,{key:"pageDefine",tab:"页面设置"},{default:n.withCtx(()=>[n.createVNode(c,{model:t.value,name:"basic","label-col":{span:5},"wrapper-col":{span:16},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[t.value.sn&&t.value.sn!="new_"?(n.openBlock(),n.createBlock(s,{key:0,label:"页面编码"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(t.value.sn)+"/V"+n.toDisplayString(t.value.vers),1)]),_:1})):n.createCommentVNode("",!0),n.createVNode(s,{label:"页面标题",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.title,"onUpdate:value":l[0]||(l[0]=p=>t.value.title=p)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"页面组件",required:""},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.component,"onUpdate:value":l[1]||(l[1]=p=>t.value.component=p)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"icon图标"},{default:n.withCtx(()=>[n.createVNode(a,{value:t.value.icon,"onUpdate:value":l[2]||(l[2]=p=>t.value.icon=p)},null,8,["value"])]),_:1}),n.createVNode(s,{label:"是否全局"},{default:n.withCtx(()=>[n.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}),n.createVNode(s,{label:"是否模版"},{default:n.withCtx(()=>[n.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}),n.createVNode(s,{label:"页面备注"},{default:n.withCtx(()=>[n.createVNode(d,{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}),n.createVNode(h,{key:"dataDefine",tab:"数据设置"},{default:n.withCtx(()=>[n.createVNode(Yr,{editor:o.editor},null,8,["editor"])]),_:1})]),_:1})])}}}),[["__scopeId","data-v-2420ce7a"]]),Cl=ee(n.defineComponent({__name:"editor",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgetList:[],dataModels:[]},component:"unione-page-view"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel("run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(Lt,{class:"unione-page-view","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),[["__scopeId","data-v-f792d0b4"]]),Jr={class:"form-btns"},Sl=n.defineComponent({__name:"form",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-view"},l=new wt,s=n.computed(()=>l.$widgetList.value||[]),a=n.computed(()=>{const f=l.define.value?.configs?.btns||[],p=f.map(u=>u.name);if(!p.includes("save")){const u={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};f.splice(u.index,0,u)}if(!p.includes("submit")){const u={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let y=u.index||1;f.splice(y,0,u)}if(!p.includes("reset")){const u={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};f.splice(u.index,0,u)}if(!p.includes("back")){const u={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};f.splice(u.index,0,u)}return l.model.value=="view"&&f.filter(u=>["save","submit","reset"].includes(u.name)).forEach(u=>{u.visible=!1}),f});function r({btn:f,event:p}){f.name=="save"&&d(),f.name=="reset",f.name=="back"&&c()}async function d(){const f=l.dataManager().form();let p={};for(let u in f){const y=await f[u].validate();if(l.dataManager().psn()==u){for(let k in p)y[k]=p[k];p=y}else p[u]=y}console.log("=======form data=====",p),l.dataManager().primary().save({data:p,params:l.dataManager().params}).then(u=>{console.log("save result:",u)})}function c(){e.back()}n.watch(()=>t.pageDefine,f=>{f&&l.load(h.value,f)});const h=n.ref("new_");return n.onMounted(()=>{const f=n.inject("route");console.log("unione page view route",f),h.value=t.psn||f?.query?.psn||f?.meta?.psn||"new_",console.log("unione page view,psn:"+h.value),l.setModel(f?.query?.model||f?.meta?.model||"run"),f?.query&&l.dataManager().params(f.query),l.load(h.value,t.pageDefine||i)}),(f,p)=>{const u=n.resolveComponent("unione-btn");return n.openBlock(),n.createBlock(Lt,{class:"unione-page-form","setting-title":"页面设置",editor:n.unref(l)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(s.value,y=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(y.widget),{key:y.wid,wid:y.wid,widget:y,editor:n.unref(l)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",Jr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.value,y=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:y.name},[y.visible!=!1?(n.openBlock(),n.createBlock(u,{key:0,widget:y,editor:n.unref(l),ctx:{},onClick:r},null,8,["widget","editor"])):n.createCommentVNode("",!0)],64))),128))])]),_:2},[n.unref(l)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(l)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Zr={key:0,class:"node-opts"},ed={class:"form-warp"},td={class:"form-btns"},Nl=n.defineComponent({__name:"tree",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},storage:{type:Object,required:!0},fields:{type:Array,required:!0},setting:{type:Object,required:!0},btns:{type:Array,required:!1},event:{type:Object,required:!1}},setup(o){K.useDialog();const e=n.inject("router"),t=o,i={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[],dsnList:[]},component:"unione-page-tree"};function l(){if(t.fields?.length){const E={widget:"unione-form",dsn:"primary",primary:!0,widgets:t.fields};i.configs.widgets=[E],i.configs.dsnList=["primary"],s.dataManager().use("primary","form").store(t.storage)}i.configs.btns=t.btns||[],i.configs.setting=t.setting||{}}const s=new wt,a=n.ref(!1),r=n.ref([]),d=n.ref({}),c=n.ref(null),h=n.ref([]),f=n.ref([]),p=n.ref(0),u=n.computed(()=>{const E={disabled:!1,draggable:!1,multiple:!1,selectable:!0,checkable:!1,showLine:!0,showIcon:!0,idField:"id",pidField:"parentId",labelField:"title",leafField:"isLeaf",...t.setting?.tree||{}};return s.define.value?.configs?.tree||E}),y=n.computed(()=>{const E=u.value.btns||[],A=[];return E.forEach(M=>{A.push(M.name)}),E.filter(M=>M.name=="add")[0]||{visible:!0,name:"add",icon:"PlusOutlined",title:"新建",props:{block:!0,type:"dashed"}}}),k=n.computed(()=>{const E=u.value.btns||[],A=[],M=[];return E.forEach(z=>{M.push(z.name),z.name!="add"&&A.push(z)}),M.includes("delete")||A.splice(1,0,{visible:!0,name:"delete",icon:"DeleteOutlined",tooltip:"删除",props:{type:"text"}}),M.includes("child")||A.splice(2,0,{visible:!0,name:"child",icon:"PlusOutlined",tooltip:"创建下级",props:{type:"text"}}),A});function x({btn:E,event:A}){if(A.stopPropagation(),console.log("onTreeMenuClick,btn:"+E+",node:",c.value),E.name=="child"){const M=d.value[c.value[u.value.idField]];M.isLeaf=!1,c.value={},c.value[u.value.pidField]=M[u.value.idField],c.value[u.value.labelField]="新建...",c.value[u.value.idField]="new_"+p.value,c.value.parentNode=M,p.value=p.value+1,M.children||(M.children=[],f.value.push(M[u.value.idField])),b.value.createNode&&b.value.createNode(c.value,M,s.dataManager().params()),M.children.push(c.value),h.value=[c.value[u.value.idField]],s.dataManager().primary().setValue(c.value)}E.name=="delete"&&(c.value[u.value.idField].startsWith("new_")?c.value.parentNode?c.value.parentNode.children=c.value.parentNode.children.filter(M=>M[u.value.idField]!=c.value[u.value.idField]):r.value=r.value.filter(M=>M[u.value.idField]!=c.value[u.value.idField]):s.dataManager().primary().deleteByIds([c.value[u.value.idField]]).then(()=>{c.value.parentNode?c.value.parentNode.children=c.value.parentNode.children.filter(M=>M[u.value.idField]!=c.value[u.value.idField]):r.value=r.value.filter(M=>M[u.value.idField]!=c.value[u.value.idField])}))}function w(E,{expanded:A,node:M}){A&&(c.value=M,s.dataManager().primary().setValue(c.value),_())}function v(E,{selected:A,node:M}){A?(c.value=M,s.dataManager().primary().setValue(c.value)):c.value&&(h.value=[c.value[u.value.idField]])}n.watch(()=>t.params,()=>{a.value&&(r.value=[],d.value={},c.value=null,h.value=[],f.value=[],p.value=0,s.dataManager().params(t.params||{}),console.log("params changed props.params",t.params),_())}),n.watch(()=>c.value,()=>{console.log("active node changed",c.value),O(!c.value)});function O(E=!0){const A=s.dataManager().form();for(let M in A)A[M].setDisabled(E)}function g(){if(c.value={},c.value[u.value.pidField]=-1,c.value[u.value.labelField]="新建...",c.value[u.value.idField]="new_"+p.value,p.value=p.value+1,b.value.createNode&&b.value.createNode(c.value,null,s.dataManager().params()),c.value[u.value.pidField]==-1)r.value.push(c.value);else{const E=d.value[c.value[u.value.pidField]];E.children||(E.children=[]),E.children.push(c.value)}h.value=[c.value[u.value.idField]],s.dataManager().primary().setValue(c.value)}const m=n.ref(""),S=wl(()=>{s.dataManager().primary().find({page:1,pageSize:9999,keywords:m.value,needCount:!1,body:{}}).then(E=>{if(d.value={},r.value=[],E.body?.length){const A={};E.body.forEach(M=>{A[M[u.value.idField]]=M}),E.body.forEach(M=>{const z=A[M[u.value.pidField]];z?(z.children||(z.children=[],z.isLeaf=!1),z.children.push(M)):r.value.push(M)})}})},400);function _(){const E={};if(E[u.value.pidField]=-1,c.value){if(c.value.children?.length)return;E[u.value.pidField]=c.value[u.value.idField],s.dataManager().primary().find({page:1,pageSize:999,body:E}).then(A=>{c.value.dataRef.children=A.body||[],c.value.dataRef.children.forEach(M=>{M.isLeaf=!!M[u.value.leafField],d.value[M[u.value.idField]]=M,M.parentNode=d.value[M[u.value.pidField]]})})}else s.dataManager().primary().find({page:1,pageSize:999,body:E}).then(A=>{r.value=A.body||[],r.value.forEach(M=>{M.isLeaf=!!M[u.value.leafField],d.value[M[u.value.idField]]=M})})}const C=n.computed(()=>s.$widgetList.value||[]),b=n.computed(()=>{const E={...t.event||s.define.value?.configs?.event||{}};for(const A in E)E[A]&&typeof E[A]!="function"&&E[A].enable&&E[A].scriptText&&(A=="createNode"?E[A]=new Function("node","parent","params",E[A].scriptText):E[A]=new Function("data","event",E[A].scriptText));return E}),B=n.computed(()=>s.define.value?.configs?.setting||t.setting||{});n.provide("pageSetting",B.value);const T=n.computed(()=>{const E=s.define.value?.configs?.btns||t.btns||[],A=E.map(M=>M.name);if(!A.includes("save")){const M={title:"保存",type:"primary",index:0,visible:!0,size:"default",name:"save"};E.splice(M.index,0,M)}if(!A.includes("submit")){const M={title:"提交",type:"primary",index:1,visible:!0,size:"default",name:"submit"};let z=M.index||1;E.splice(z,0,M)}if(!A.includes("reset")){const M={title:"重置",type:"default",index:2,visible:!0,size:"default",props:{danger:!0},name:"reset"};E.splice(M.index,0,M)}if(!A.includes("back")){const M={title:"返回",type:"default",index:3,visible:!0,size:"default",name:"back"};E.splice(M.index,0,M)}return s.model.value=="view"&&E.filter(M=>["save","submit","reset"].includes(M.name)).forEach(M=>{M.visible=!1}),E});function V({btn:E,event:A}){E.name=="save"&&F({btn:E,event:A}),E.name=="reset",E.name=="back"&&D()}async function F(E){const A=s.dataManager().form();let M={...c.value};for(let z in A){const $=await A[z].validate();if(s.dataManager().psn()==z)for(let N in $)M[N]=$[N];else M[z]=$}M[u.value.idField].startsWith("new_")&&delete M[u.value.idField],delete M.parentNode,delete M.children,b.value.preSave&&b.value.preSave(M,E),console.log("=======form data=====",M),s.dataManager().primary().save({data:M}).then(z=>{console.log("save result:",z),c.value[u.value.idField]=z.body,h.value=[z.body],d.value[z.body]=c.value,b.value.postSaved&&b.value.postSaved(M,E)})}function D(){e.back()}const P=n.ref("new_");return n.onMounted(()=>{const E=n.inject("route");console.log("unione page tree route",E),P.value=t.psn||E?.query?.psn||E?.meta?.psn||"new_",console.log("unione page tree,psn:"+P.value),s.setModel(E?.query?.model||E?.meta?.model||"run");const A={...t.params||{},...E?.query||{},...E?.params||{}};s.dataManager().params(A),l(),s.load(P.value,i),n.nextTick(()=>{O(!0)}),_(),a.value=!0}),(E,A)=>{const M=n.resolveComponent("SearchOutlined"),z=n.resolveComponent("a-input"),$=n.resolveComponent("unione-btn"),N=n.resolveComponent("a-tree");return n.openBlock(),n.createBlock(Lt,{class:"unione-page-tree","setting-title":"页面设置",editor:n.unref(s)},n.createSlots({default:n.withCtx(()=>[n.createElementVNode("div",{class:"tree-warp",onContextmenu:A[3]||(A[3]=n.withModifiers(()=>{},["prevent"]))},[n.createVNode(z,{size:"small",class:"input-search",placeholder:"输入关键字搜索...",value:m.value,"onUpdate:value":A[0]||(A[0]=W=>m.value=W),onChange:n.unref(S),onPressEnter:n.unref(S)},{suffix:n.withCtx(()=>[n.createVNode(M)]),_:1},8,["value","onChange","onPressEnter"]),n.createVNode($,{widget:y.value,onClick:g},null,8,["widget"]),n.createVNode(N,{"show-line":u.value.showLine,"show-icon":u.value.showIcon,disabled:u.value.disabled,blockNode:!0,draggable:u.value.draggable,multiple:u.value.multiple,selectable:u.value.selectable,checkable:u.value.checkable,fieldNames:{title:u.value.labelField,key:u.value.idField},selectedKeys:h.value,"onUpdate:selectedKeys":A[1]||(A[1]=W=>h.value=W),expandedKeys:f.value,"onUpdate:expandedKeys":A[2]||(A[2]=W=>f.value=W),"tree-data":r.value,onExpand:w,onSelect:v},n.createSlots({icon:n.withCtx(({dataRef:W})=>[W.iconName?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(W.iconName),{key:0})):n.createCommentVNode("",!0)]),_:2},[k.value?.length?{name:"title",fn:n.withCtx(({dataRef:W})=>[n.createElementVNode("span",null,n.toDisplayString(W[u.value.labelField]),1),c.value&&c.value[u.value.idField]==W[u.value.idField]?(n.openBlock(),n.createElementBlock("div",Zr,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(k.value,I=>(n.openBlock(),n.createBlock($,{key:I.name,widget:I,ctx:{node:W},onClick:x},null,8,["widget","ctx"]))),128))])):n.createCommentVNode("",!0)]),key:"0"}:void 0]),1032,["show-line","show-icon","disabled","draggable","multiple","selectable","checkable","fieldNames","selectedKeys","expandedKeys","tree-data"])],32),n.createElementVNode("div",ed,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(C.value,W=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(W.widget),{key:W.wid,wid:W.wid,widget:W,editor:n.unref(s)},null,8,["wid","widget","editor"]))),128)),n.createElementVNode("div",td,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(T.value,W=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:W.name},[W.visible!=!1?(n.openBlock(),n.createBlock($,{key:0,widget:W,editor:n.unref(s),disabled:!c.value,ctx:{},onClick:V},null,8,["widget","editor","disabled"])):n.createCommentVNode("",!0)],64))),128))])])]),_:2},[n.unref(s)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(s)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"])}}}),Bl=n.defineComponent({__name:"list",props:{psn:{type:String,required:!1},params:{type:Object,default(){return{}}},pageDefine:{type:Object,required:!1}},setup(o){console.log("unione page view setup .....");const e=o,t={sn:"new_",title:"新建页面",types:"setting",vers:1,configs:{widgets:[{wid:"query-form",widget:"unione-query-form",dataModel:"",configs:{keywords:{},fields:[],labelWidth:8}},{wid:"table-list",widget:"unione-table-list",dataModel:"",configs:{leftBtns:[],rightBtns:[],columns:[],operation:{title:"操作",visible:!0,width:150,btns:[],more:{layout:"horizontal"},count:2}}}],dsnList:[]},component:"unione-page-list"},i=new wt,l=n.computed(()=>i.$widgetList.value||[]);n.watch(()=>e.pageDefine,a=>{a&&i.load(s.value,a)});const s=n.ref("new_");return n.onMounted(()=>{const a=n.inject("route");console.log("unione page view route",a),s.value=e.psn||a?.query?.psn||a?.meta?.psn||"new_",console.log("unione page view,psn:"+s.value),i.setModel(a?.query?.model||a?.meta?.model||"run"),i.load(s.value,e.pageDefine||t)}),(a,r)=>(n.openBlock(),n.createBlock(Lt,{class:"unione-page-list","setting-title":"页面设置",editor:n.unref(i)},n.createSlots({default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,d=>(n.openBlock(),n.createBlock(n.resolveDynamicComponent(d.render||d.widget),{key:d.wid,wid:d.wid,widget:d,editor:n.unref(i)},null,8,["wid","widget","editor"]))),128))]),_:2},[n.unref(i)?{name:"page-setting",fn:n.withCtx(()=>[n.createVNode(jt,{editor:n.unref(i)},null,8,["editor"])]),key:"0"}:void 0]),1032,["editor"]))}}),ct={release(o){return K.axios.admin({url:"/api/data/define/release",method:"post",data:o})},find(o){return K.axios.admin({url:"/api/data/define/find",method:"post",data:o})},save(o){return K.axios.admin({url:"/api/data/define/save",method:"post",data:o})},delete(o){return K.axios.admin({url:"/api/data/define/delete",method:"post",data:o})},detail(o){return K.axios.admin({url:"/api/data/define/detail",method:"post",headers:{"Content-Type":"application/json"},data:o})},loadFromDb(o){return K.axios.admin({url:"/api/data/define/load/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})},impFromDb(o){return K.axios.admin({url:"/api/data/define/imp/from/db",method:"post",headers:{"Content-Type":"multipart/form-data"},data:o})}},id={class:"unione-page list-page"},nd=ee(n.defineComponent({__name:"list",setup(o){const e=Ae(),t=K.useDialog(),i=n.inject("router"),l=n.ref({fields:[{title:"标题",name:"title"},{title:"名称",name:"name"},{title:"状态",name:"status"},{title:"类别",name:"category"}]}),s=n.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"}}});n.onMounted(()=>{r()});const a=n.ref({pagination:{total:0,current:1,pageSize:20},loading:!1,params:{},data:[]});function r(){a.value.loading=!0,ct.find({page:a.value.pagination.current,pageSize:a.value.pagination.pageSize,body:a.value.params}).then(g=>{a.value.data=g.body,a.value.pagination.total=g.total*1}).finally(()=>{a.value.loading=!1})}function d(g){a.value.pagination.current=g.pagination.current,a.value.pagination.pageSize=g.pagination.pageSize,r()}function c(g){a.value.pagination.current=1,a.value.params=g||{},r()}function h({btn:g,event:m,row:S}){console.log("table btn click",g,m,S),(g.name=="add"||g.name=="edit")&&i.push({path:"/system/data/define/edit",query:S?{id:S.id}:{}}),g.name=="impFromDb"&&(p.value=!0),g.name=="release"&&f(S),g.name=="view"&&i.push({path:e.listPageUrl,query:{psn:S.sn+":list",model:"preview"}})}function f(g){t.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([g.id]).then(m=>{m.success?(t.success({title:"发布成功",content:m.body}),r()):t.error({title:"发布失败",content:m.body})})}})}const p=n.ref(!1),u=n.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}}]}),y=n.ref({leftBtns:!1,rightBtns:!1,columns:[{title:"名称",name:"name"},{title:"标题",name:"title"}],operation:!1}),k=n.ref({pagination:{total:0,current:1,pageSize:10},loading:!1,params:{},data:[]});function x(g){!g||!Object.keys(g).length||!g.dsId||(G.message.loading("数据加载中..."),k.value.params=g,k.value.loading=!0,ct.loadFromDb(g).then(m=>{k.value.loading=!1,G.message.destroy(),m.success?(m.body.forEach(S=>{S.checkable=!!S.id}),k.value.data=m.body,k.value.pagination.total=m.body.length):G.message.error(m.message)}))}function w(g){k.value.pagination.current=g.pagination.current,k.value.pagination.pageSize=g.pagination.pageSize}const v=n.ref();function O({btn:g}){if(g.name!="imp")return;const m=v.value.getSelected();m?.keys?.length?t.confirm({content:"确定导入选中的"+m.keys.length+"条记录么?",onOk:()=>{G.message.loading("数据导入中..."),ct.impFromDb({dsId:k.value.params.dsId,tables:m.keys.join()}).then(S=>{G.message.destroy(),S.success?(t.success({content:S.message}),c()):t.error({context:S.message})})}}):t.error({content:"请选择目标记录!"})}return(g,m)=>{const S=n.resolveComponent("UnioneQuery"),_=n.resolveComponent("UnioneTable"),C=n.resolveComponent("a-drawer");return n.openBlock(),n.createElementBlock("div",id,[n.createVNode(S,{widget:l.value,onQuery:c,onReset:c},null,8,["widget"]),n.createVNode(_,{widget:s.value,dataList:a.value.data,loading:a.value.loading,pagination:a.value.pagination,onChange:d,onBtnClick:h},null,8,["widget","dataList","loading","pagination"]),n.createVNode(C,{title:"从数据库中导入",width:550,visible:p.value,"onUpdate:visible":m[0]||(m[0]=b=>p.value=b),placement:"left"},{default:n.withCtx(()=>[n.createVNode(S,{widget:u.value,onQuery:x,onReset:x,onBtnClick:O,class:"load-table-form"},null,8,["widget"]),n.createVNode(_,{widget:y.value,dataList:k.value.data,loading:k.value.loading,pagination:k.value.pagination,onChange:w,rowKey:"name",ref_key:"loadTableObj",ref:v},null,8,["widget","dataList","loading","pagination"])]),_:1},8,["visible"])])}}}),[["__scopeId","data-v-d7658b67"]]),ld={class:"unione-props-setting data-field-manage"},sd={key:0},od={key:1},ad=["onClick"],rd=["onClick"],dd=["onClick"],cd={key:1},hd=ee(n.defineComponent({__name:"dataFieldMange",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+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=n.useModel(o,"modelValue"),i=n.ref({selectedRowKeys:[],columnWidth:"25px",onChange:u=>{u.forEach(y=>{i.value.selectedRowKeys.includes(y)||i.value.selectedRowKeys.push(y);const k=[];t.value.forEach(x=>{!u.includes(x.name)&&i.value.selectedRowKeys.includes(x.name)&&k.push(x.name)}),k.length&&(i.value.selectedRowKeys=i.value.selectedRowKeys.filter(x=>!k.includes(x)))})}}),l={mounted:u=>u.focus()},s=n.ref({});function a(){const u=Object.keys(s.value);if(u.length)for(let y in u){const k=t.value.filter(x=>x.name==y);if(k&&k[0]){let x=s.value[y];Object.keys(x).forEach(w=>{k[0][w]=x[w]})}}s.value={}}function r(u,y){a();const k={};k[y]=u[y]||"",s.value[u.name]=k}function d(u,y){if(!u||!y){s.value={};return}const k=s.value[u.name][y];if(y=="name"&&t.value.filter(w=>w[y]==k&&w.name!=u.name).length>0){G.Modal.warn({title:"提示信息",content:"字段名称["+k+"]已存在"});return}u[y]=k,s.value={}}function c(u,y){const k=t.value.filter(x=>x.name==u.name)[0];return y=="isFk"?k.configs?.fkey?.enable:k[y]==1}function h(u,y){const k=t.value.filter(x=>x.name==u.name)[0];y=="isFk"?(k.configs||(k.configs={}),k.configs.fkey||(k.configs.fkey={}),k.configs.fkey.enable=!k.configs.fkey.enable):k[y]!=1?k[y]=1:k[y]=0}function f(){if(a(),t.value.filter(k=>k.name=="new_").length>0){s.value.new_={name:"new_"};return}const y={title:"",name:"new_",dataType:"String",isPk:0};t.value.push(y),s.value[y.name]={name:"new_"}}function p(){if(!i.value.selectedRowKeys.length){G.Modal.info({title:"提示信息",content:"请选择要删除的字段!"});return}G.Modal.confirm({title:"确认信息",content:"确定要删除选中的["+i.value.selectedRowKeys.length+"]字段么?",onOk:()=>{t.value=t.value.filter(u=>!i.value.selectedRowKeys.includes(u.name)),i.value.selectedRowKeys=[]}})}return(u,y)=>{const k=n.resolveComponent("a-button"),x=n.resolveComponent("a-tooltip"),w=n.resolveComponent("a-input"),v=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-select-option"),g=n.resolveComponent("a-select"),m=n.resolveComponent("a-checkbox"),S=n.resolveComponent("a-table");return n.openBlock(),n.createElementBlock("div",ld,[n.createVNode(k,{class:"btn btn-add",type:"primary",onClick:f,size:"small"},{default:n.withCtx(()=>y[1]||(y[1]=[n.createTextVNode("新增")])),_:1}),n.createVNode(k,{class:"btn btn-delete",type:"primary",danger:"",onClick:p,size:"small"},{default:n.withCtx(()=>y[2]||(y[2]=[n.createTextVNode(" 删除 ")])),_:1}),n.createVNode(S,{columns:e.value,"data-source":t.value,pagination:!0,bordered:"","row-selection":i.value,scroll:{x:1150},"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:_})=>[["name","title"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",sd,[y[3]||(y[3]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),["descs","dataLen","dataPrec","dataValue","dataType"].includes(_.key)?(n.openBlock(),n.createElementBlock("span",od,[n.createVNode(n.unref(We.FormOutlined)),n.createTextVNode(" "+n.toDisplayString(_.title),1)])):n.createCommentVNode("",!0),_.key==="isPk"?(n.openBlock(),n.createBlock(x,{key:2,title:"至少配置一个主键字段"},{default:n.withCtx(()=>[y[4]||(y[4]=n.createElementVNode("span",{style:{color:"red","margin-right":"3px","font-size":"16px"}},"*",-1)),n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isFk"?(n.openBlock(),n.createBlock(x,{key:3,title:"是否是外键字段"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="isNull"?(n.openBlock(),n.createBlock(x,{key:4,title:"是否允许为空"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0),_.key==="syncEnable"?(n.openBlock(),n.createBlock(x,{key:5,title:"是否同步到数据库"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(_.title),1)]),_:2},1024)):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:_,text:C,record:b})=>[["name","title","descs","dataValue"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(w,{key:0,value:s.value[b.name][_.dataIndex],"onUpdate:value":B=>s.value[b.name][_.dataIndex]=B,onBlur:B=>d(b,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,ad)):n.createCommentVNode("",!0),["dataLen","dataPrec"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(v,{key:0,value:s.value[b.name][_.dataIndex],"onUpdate:value":B=>s.value[b.name][_.dataIndex]=B,onBlur:B=>d(b,_.dataIndex),style:{margin:"-5px 0"}},null,8,["value","onUpdate:value","onBlur"])),[[l]]):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(C||" "),1)],64))],10,rd)):["dataType"].includes(_.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[b.name]||!Object.keys(s.value[b.name]).includes(_.dataIndex))&&!C&&"empty"]),onClick:B=>r(b,_.dataIndex)},[s.value[b.name]&&Object.keys(s.value[b.name]).includes(_.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(g,{key:0,value:b[_.dataIndex],"onUpdate:value":B=>b[_.dataIndex]=B,onBlur:y[0]||(y[0]=B=>d())},{default:n.withCtx(()=>[n.createVNode(O,{key:"String",value:"String"}),n.createVNode(O,{key:"Long",value:"Long"}),n.createVNode(O,{key:"Short",value:"Short"}),n.createVNode(O,{key:"Integer",value:"Integer"}),n.createVNode(O,{key:"Float",value:"Float"}),n.createVNode(O,{key:"Double",value:"Double"}),n.createVNode(O,{key:"Date",value:"Date"}),n.createVNode(O,{key:"Timestamp",value:"Timestamp"})]),_:2},1032,["value","onUpdate:value"])),[[l]]):(n.openBlock(),n.createElementBlock("span",cd,n.toDisplayString(C),1))],10,dd)):["syncEnable","isFk","isPk"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:3,checked:c(b,_.dataIndex),onClick:B=>h(b,_.dataIndex)},null,8,["checked","onClick"])):["isNull"].includes(_.dataIndex)?(n.openBlock(),n.createBlock(m,{key:4,checked:!c(b,_.dataIndex),onClick:B=>h(b,_.dataIndex)},null,8,["checked","onClick"])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source","row-selection"])])}}}),[["__scopeId","data-v-4020e3f0"]]),Ol=1024;let fd=0,tn=class{constructor(e,t){this.from=e,this.to=t}};class Y{constructor(e={}){this.id=fd++,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=Ce.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Y.closedBy=new Y({deserialize:o=>o.split(" ")}),Y.openedBy=new Y({deserialize:o=>o.split(" ")}),Y.group=new Y({deserialize:o=>o.split(" ")}),Y.isolate=new Y({deserialize:o=>{if(o&&o!="rtl"&&o!="ltr"&&o!="auto")throw new RangeError("Invalid value for isolate: "+o);return o||"auto"}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});class ci{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[Y.mounted.id]}}const ud=Object.create(null);class Ce{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):ud,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new Ce(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(l)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[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(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(Y.group),s=-1;s<(l?l.length:0);s++){let a=t[s<0?i.name:l[s]];if(a)return a}}}}Ce.none=new Ce("",Object.create(null),0,8);class nn{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 i of this.types){let l=null;for(let s of e){let a=s(i);a&&(l||(l=Object.assign({},i.props)),l[a[0].id]=a[1])}t.push(l?new Ce(i.name,l,i.id,i.flags):i)}return new nn(t)}}const hi=new WeakMap,Vl=new WeakMap;var fe;(function(o){o[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays"})(fe||(fe={}));class re{constructor(e,t,i,l,s){if(this.type=e,this.children=t,this.positions=i,this.length=l,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,r]of s)this.props[typeof a=="number"?a:a.id]=r}}toString(){let e=ci.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let l=i.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 on(this.topNode,e)}cursorAt(e,t=0,i=0){let l=hi.get(this)||this.topNode,s=new on(l);return s.moveTo(e,t),hi.set(this,s._tree),s}get topNode(){return new Ve(this,0,0,null)}resolve(e,t=0){let i=zt(hi.get(this)||this.topNode,e,t,!1);return hi.set(this,i),i}resolveInner(e,t=0){let i=zt(Vl.get(this)||this.topNode,e,t,!0);return Vl.set(this,i),i}resolveStack(e,t=0){return gd(this,e,t)}iterate(e){let{enter:t,leave:i,from:l=0,to:s=this.length}=e,a=e.mode||0,r=(a&fe.IncludeAnonymous)>0;for(let d=this.cursor(a|fe.IncludeAnonymous);;){let c=!1;if(d.from<=s&&d.to>=l&&(!r&&d.type.isAnonymous||t(d)!==!1)){if(d.firstChild())continue;c=!0}for(;c&&i&&(r||!d.type.isAnonymous)&&i(d),!d.nextSibling();){if(!d.parent())return;c=!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:rn(Ce.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new re(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new re(Ce.none,t,i,l)))}static build(e){return kd(e)}}re.empty=new re(Ce.none,[],[],0);class ln{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 ln(this.buffer,this.index)}}class Ze{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ce.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],i=this.buffer[e+3],l=this.set.types[t],s=l.name;if(/\W/.test(s)&&!l.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return s+"("+a.join(",")+")"}findChild(e,t,i,l,s){let{buffer:a}=this,r=-1;for(let d=e;d!=t&&!(_l(s,l,a[d+1],a[d+2])&&(r=d,i>0));d=a[d+3]);return r}slice(e,t,i){let l=this.buffer,s=new Uint16Array(t-e),a=0;for(let r=e,d=0;r<t;){s[d++]=l[r++],s[d++]=l[r++]-i;let c=s[d++]=l[r++]-i;s[d++]=l[r++]-e,a=Math.max(a,c)}return new Ze(s,a,this.set)}}function _l(o,e,t,i){switch(o){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function zt(o,e,t,i){for(var l;o.from==o.to||(t<1?o.from>=e:o.from>e)||(t>-1?o.to<=e:o.to<e);){let a=!i&&o instanceof Ve&&o.index<0?null:o.parent;if(!a)return o;o=a}let s=i?0:fe.IgnoreOverlays;if(i)for(let a=o,r=a.parent;r;a=r,r=a.parent)a instanceof Ve&&a.index<0&&((l=r.enter(e,t,s))===null||l===void 0?void 0:l.from)!=a.from&&(o=r);for(;;){let a=o.enter(e,t,s);if(!a)return o;o=a}}class Ml{cursor(e=0){return new on(this,e)}getChild(e,t=null,i=null){let l=Tl(this,e,t,i);return l.length?l[0]:null}getChildren(e,t=null,i=null){return Tl(this,e,t,i)}resolve(e,t=0){return zt(this,e,t,!1)}resolveInner(e,t=0){return zt(this,e,t,!0)}matchContext(e){return sn(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let l=t.lastChild;if(!l||l.to!=t.to)break;l.type.isError&&l.from==l.to?(i=t,t=l.prevSibling):t=l}return i}get node(){return this}get next(){return this.parent}}class Ve extends Ml{constructor(e,t,i,l){super(),this._tree=e,this.from=t,this.index=i,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,i,l,s=0){for(let a=this;;){for(let{children:r,positions:d}=a._tree,c=t>0?r.length:-1;e!=c;e+=t){let h=r[e],f=d[e]+a.from;if(_l(l,i,f,f+h.length)){if(h instanceof Ze){if(s&fe.ExcludeBuffers)continue;let p=h.findChild(0,h.buffer.length,t,i-f,l);if(p>-1)return new et(new pd(a,h,e,f),null,p)}else if(s&fe.IncludeAnonymous||!h.type.isAnonymous||an(h)){let p;if(!(s&fe.IgnoreMounts)&&(p=ci.get(h))&&!p.overlay)return new Ve(p.tree,f,e,a);let u=new Ve(h,f,e,a);return s&fe.IncludeAnonymous||!u.type.isAnonymous?u:u.nextChild(t<0?h.children.length-1:0,t,i,l)}}}if(s&fe.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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,i=0){let l;if(!(i&fe.IgnoreOverlays)&&(l=ci.get(this._tree))&&l.overlay){let s=e-this.from;for(let{from:a,to:r}of l.overlay)if((t>0?a<=s:a<s)&&(t<0?r>=s:r>s))return new Ve(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Tl(o,e,t,i){let l=o.cursor(),s=[];if(!l.firstChild())return s;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return s}for(;;){if(i!=null&&l.type.is(i))return s;if(l.type.is(e)&&s.push(l.node),!l.nextSibling())return i==null?s:[]}}function sn(o,e,t=e.length-1){for(let i=o.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class pd{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class et extends Ml{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new et(this.context,this,s)}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,i=0){if(i&fe.ExcludeBuffers)return null;let{buffer:l}=this.context,s=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new et(this.context,this,s)}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 et(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 et(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,s=i.buffer[this.index+3];if(s>l){let a=i.buffer[this.index+1];e.push(i.slice(l,s,a)),t.push(0)}return new re(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Al(o){if(!o.length)return null;let e=0,t=o[0];for(let s=1;s<o.length;s++){let a=o[s];(a.from>t.from||a.to<t.to)&&(t=a,e=s)}let i=t instanceof Ve&&t.index<0?null:t.parent,l=o.slice();return i?l[e]=i:l.splice(e,1),new md(l,t)}class md{constructor(e,t){this.heads=e,this.node=t}get next(){return Al(this.heads)}}function gd(o,e,t){let i=o.resolveInner(e,t),l=null;for(let s=i instanceof Ve?i:i.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(l||(l=[i])).push(a.resolve(e,t)),s=a}else{let a=ci.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let r=new Ve(a.tree,a.overlay[0].from+s.from,-1,s);(l||(l=[i])).push(zt(r,e,t,!1))}}return l?Al(l):i}class on{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 Ve)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Ve?(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,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,s=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}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,i=this.mode){return this.buffer?i&fe.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fe.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,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+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<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<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,i,{buffer:l}=this;if(l){if(e>0){if(this.index<l.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(l.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=l)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,a=e<0?-1:i._tree.children.length;s!=a;s+=e){let r=i._tree.children[s];if(this.mode&fe.IncludeAnonymous||r instanceof Ze||!r.type.isAnonymous||an(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,i=0;if(e&&e.context==this.buffer)e:for(let l=this.index,s=this.stack.length;s>=0;){for(let a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=s+1;break e}l=this.stack[--s]}for(let l=i;l<this.stack.length;l++)t=new et(this.buffer,t,this.stack[l]);return this.bufferNode=new et(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let l=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(l=!0)}for(;l&&t&&t(this),l=this.type.isAnonymous,!this.nextSibling();){if(!i)return;this.parent(),i--,l=!0}}}matchContext(e){if(!this.buffer)return sn(this.node,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let l=e.length-1,s=this.stack.length-1;l>=0;s--){if(s<0)return sn(this.node,e,l);let a=i[t.buffer[this.stack[s]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function an(o){return o.children.some(e=>e instanceof Ze||!e.type.isAnonymous||an(e))}function kd(o){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=Ol,reused:s=[],minRepeatType:a=i.types.length}=o,r=Array.isArray(t)?new ln(t,t.length):t,d=i.types,c=0,h=0;function f(m,S,_,C,b,B){let{id:T,start:V,end:F,size:D}=r,P=h;for(;D<0;)if(r.next(),D==-1){let $=s[T];_.push($),C.push(V-m);return}else if(D==-3){c=T;return}else if(D==-4){h=T;return}else throw new RangeError(`Unrecognized record size: ${D}`);let E=d[T],A,M,z=V-m;if(F-V<=l&&(M=x(r.pos-S,b))){let $=new Uint16Array(M.size-M.skip),N=r.pos-M.size,W=$.length;for(;r.pos>N;)W=w(M.start,$,W);A=new Ze($,F-M.start,i),z=M.start-m}else{let $=r.pos-D;r.next();let N=[],W=[],I=T>=a?T:-1,q=0,he=F;for(;r.pos>$;)I>=0&&r.id==I&&r.size>=0?(r.end<=he-l&&(y(N,W,V,q,r.end,he,I,P),q=N.length,he=r.end),r.next()):B>2500?p(V,$,N,W):f(V,$,N,W,I,B+1);if(I>=0&&q>0&&q<N.length&&y(N,W,V,q,V,he,I,P),N.reverse(),W.reverse(),I>-1&&q>0){let Xi=u(E);A=rn(E,N,W,0,N.length,0,F-V,Xi,Xi)}else A=k(E,N,W,F-V,P-F)}_.push(A),C.push(z)}function p(m,S,_,C){let b=[],B=0,T=-1;for(;r.pos>S;){let{id:V,start:F,end:D,size:P}=r;if(P>4)r.next();else{if(T>-1&&F<T)break;T<0&&(T=D-l),b.push(V,F,D),B++,r.next()}}if(B){let V=new Uint16Array(B*4),F=b[b.length-2];for(let D=b.length-3,P=0;D>=0;D-=3)V[P++]=b[D],V[P++]=b[D+1]-F,V[P++]=b[D+2]-F,V[P++]=P;_.push(new Ze(V,b[2]-F,i)),C.push(F-m)}}function u(m){return(S,_,C)=>{let b=0,B=S.length-1,T,V;if(B>=0&&(T=S[B])instanceof re){if(!B&&T.type==m&&T.length==C)return T;(V=T.prop(Y.lookAhead))&&(b=_[B]+T.length+V)}return k(m,S,_,C,b)}}function y(m,S,_,C,b,B,T,V){let F=[],D=[];for(;m.length>C;)F.push(m.pop()),D.push(S.pop()+_-b);m.push(k(i.types[T],F,D,B-b,V-B)),S.push(b-_)}function k(m,S,_,C,b=0,B){if(c){let T=[Y.contextHash,c];B=B?[T].concat(B):[T]}if(b>25){let T=[Y.lookAhead,b];B=B?[T].concat(B):[T]}return new re(m,S,_,C,B)}function x(m,S){let _=r.fork(),C=0,b=0,B=0,T=_.end-l,V={size:0,start:0,skip:0};e:for(let F=_.pos-m;_.pos>F;){let D=_.size;if(_.id==S&&D>=0){V.size=C,V.start=b,V.skip=B,B+=4,C+=4,_.next();continue}let P=_.pos-D;if(D<0||P<F||_.start<T)break;let E=_.id>=a?4:0,A=_.start;for(_.next();_.pos>P;){if(_.size<0)if(_.size==-3)E+=4;else break e;else _.id>=a&&(E+=4);_.next()}b=A,C+=D,B+=E}return(S<0||C==m)&&(V.size=C,V.start=b,V.skip=B),V.size>4?V:void 0}function w(m,S,_){let{id:C,start:b,end:B,size:T}=r;if(r.next(),T>=0&&C<a){let V=_;if(T>4){let F=r.pos-(T-4);for(;r.pos>F;)_=w(m,S,_)}S[--_]=V,S[--_]=B-m,S[--_]=b-m,S[--_]=C}else T==-3?c=C:T==-4&&(h=C);return _}let v=[],O=[];for(;r.pos>0;)f(o.start||0,o.bufferStart||0,v,O,-1,0);let g=(e=o.length)!==null&&e!==void 0?e:v.length?O[0]+v[0].length:0;return new re(d[o.topID],v.reverse(),O.reverse(),g)}const El=new WeakMap;function fi(o,e){if(!o.isAnonymous||e instanceof Ze||e.type!=o)return 1;let t=El.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=o||!(i instanceof re)){t=1;break}t+=fi(o,i)}El.set(e,t)}return t}function rn(o,e,t,i,l,s,a,r,d){let c=0;for(let y=i;y<l;y++)c+=fi(o,e[y]);let h=Math.ceil(c*1.5/8),f=[],p=[];function u(y,k,x,w,v){for(let O=x;O<w;){let g=O,m=k[O],S=fi(o,y[O]);for(O++;O<w;O++){let _=fi(o,y[O]);if(S+_>=h)break;S+=_}if(O==g+1){if(S>h){let _=y[g];u(_.children,_.positions,0,_.children.length,k[g]+v);continue}f.push(y[g])}else{let _=k[O-1]+y[O-1].length-m;f.push(rn(o,y,k,g,O,m,_,null,d))}p.push(m+v-s)}}return u(e,t,i,l,0),(r||d)(f,p,a)}class ht{constructor(e,t,i,l,s=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new ht(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&l.push(s);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],s=1,a=e.length?e[0]:null;for(let r=0,d=0,c=0;;r++){let h=r<t.length?t[r]:null,f=h?h.fromA:1e9;if(f-d>=i)for(;a&&a.from<f;){let p=a;if(d>=p.from||f<=p.to||c){let u=Math.max(p.from,d)-c,y=Math.min(p.to,f)-c;p=u>=y?null:new ht(u,y,p.tree,p.offset+c,r>0,!!h)}if(p&&l.push(p),a.to>f)break;a=s<e.length?e[s++]:null}if(!h)break;d=h.toA,c=h.toA-h.toB}return l}}class Il{startParse(e,t,i){return typeof e=="string"&&(e=new bd(e)),i=i?i.length?i.map(l=>new tn(l.from,l.to)):[new tn(0,0)]:[new tn(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let s=l.advance();if(s)return s}}}class bd{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 Y({perNode:!0});class ui{constructor(e,t,i,l,s,a,r,d,c,h=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=s,this.score=a,this.buffer=r,this.bufferBase=d,this.curContext=c,this.lookAhead=h,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new ui(e,[],t,i,i,0,[],0,l?new Dl(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 i=e>>19,l=e&65535,{parser:s}=this.p,a=this.reducePos<this.pos-25;a&&this.setLookAhead(this.pos);let r=s.dynamicPrecedence(l);if(r&&(this.score+=r),i==0){this.pushState(s.getGoto(this.state,l,!0),this.reducePos),l<s.minRepeatTerm&&this.storeNode(l,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(l,this.reducePos);return}let d=this.stack.length-(i-1)*3-(e&262144?6:0),c=d?this.stack[d-2]:this.p.ranges[0].from,h=this.reducePos-c;h>=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSize<h&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=h));let f=d?this.stack[d-1]:0,p=this.bufferBase+this.buffer.length-f;if(l<s.minRepeatTerm||e&131072){let u=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(l,c,u,p+4,!0)}if(e&262144)this.state=this.stack[d];else{let u=this.stack[d-3];this.state=s.getGoto(u,l,!0)}for(;this.stack.length>d;)this.stack.pop();this.reduceContext(l,c)}storeNode(e,t,i,l=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this,r=this.buffer.length;if(r==0&&a.parent&&(r=a.bufferBase-a.parent.bufferBase,a=a.parent),r>0&&a.buffer[r-4]==0&&a.buffer[r-1]>-1){if(t==i)return;if(a.buffer[r-2]>=t){a.buffer[r-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&this.buffer[a-4]!=0){let r=!1;for(let d=a;d>0&&this.buffer[d-2]>i;d-=4)if(this.buffer[d-1]>=0){r=!0;break}if(r)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4);else{let s=e,{parser:a}=this.p;(l>this.pos||t<=a.maxNode)&&(this.pos=l,a.stateFlag(s,1)||(this.reducePos=l)),this.pushState(s,i),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let l=this.pos;this.reducePos=this.pos=l+e.length,this.pushState(t,l),this.buffer.push(i,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 i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new ui(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new yd(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}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 s=0,a;s<t.length;s+=2)(a=t[s+1])!=this.state&&this.p.parser.hasAction(a,e)&&l.push(t[s],a);if(this.stack.length<120)for(let s=0;l.length<8&&s<t.length;s+=2){let a=t[s+1];l.some((r,d)=>d&1&&r==a)||l.push(t[s],a)}t=l}let i=[];for(let l=0;l<t.length&&i.length<4;l+=2){let s=t[l+1];if(s==this.state)continue;let a=this.split();a.pushState(s,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[l],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let i=t>>19,l=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=[],i=(l,s)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let r=(a>>19)-s;if(r>1){let d=a&65535,c=this.stack.length-r*3;if(c>=0&&e.getGoto(this.stack[c],d,!1)>=0)return r<<19|65536|d}}else{let r=i(a,s+1);if(r!=null)return r}})};return i(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 Dl(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 Dl{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class yd{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class pi{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new pi(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 pi(this.stack,this.pos,this.index)}}function mi(o,e=Uint16Array){if(typeof o!="string")return o;let t=null;for(let i=0,l=0;i<o.length;){let s=0;for(;;){let a=o.charCodeAt(i++),r=!1;if(a==126){s=65535;break}a>=92&&a--,a>=34&&a--;let d=a-32;if(d>=46&&(d-=46,r=!0),s+=d,r)break;s*=46}t?t[l++]=s:t=new e(s)}return t}class gi{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Pl=new gi;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=Pl,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 i=this.range,l=this.rangeIndex,s=this.pos+e;for(;s<i.from;){if(!l)return null;let a=this.ranges[--l];s-=i.from-a.to,i=a}for(;t<0?s>i.to:s>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];s+=a.from-i.to,i=a}return s}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,i,l;if(t>=0&&t<this.chunk.length)i=this.pos+e,l=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(i=s,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)l=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,r=this.range;for(;r.to<=i;)r=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>r.to&&(this.chunk2=this.chunk2.slice(0,r.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}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=Pl,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 i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class xt{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;xd(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}xt.prototype.contextual=xt.prototype.fallback=xt.prototype.extend=!1,xt.prototype.fallback=xt.prototype.extend=!1;function xd(o,e,t,i,l,s){let a=0,r=1<<i,{dialect:d}=t.p.parser;e:for(;r&o[a];){let c=o[a+1];for(let u=a+3;u<c;u+=2)if((o[u+1]&r)>0){let y=o[u];if(d.allows(y)&&(e.token.value==-1||e.token.value==y||vd(y,e.token.value,l,s))){e.acceptToken(y);break}}let h=e.next,f=0,p=o[a+2];if(e.next<0&&p>f&&o[c+p*3-3]==65535){a=o[c+p*3-1];continue e}for(;f<p;){let u=f+p>>1,y=c+u+(u<<1),k=o[y],x=o[y+1]||65536;if(h<k)p=u;else if(h>=x)f=u+1;else{a=o[y+2],e.advance();continue e}}break}}function Fl(o,e,t){for(let i=e,l;(l=o[i])!=65535;i++)if(l==t)return i-e;return-1}function vd(o,e,t,i){let l=Fl(t,i,e);return l<0||Fl(t,i,o)<l}const Ne=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let dn=null;function $l(o,e,t){let i=o.cursor(fe.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(o.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:o.length}}class Cd{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?$l(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?$l(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 i=this.trees[t],l=this.index[t];if(l==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=i.children[l],a=this.start[t]+i.positions[l];if(a>e)return this.nextStart=a,null;if(s instanceof re){if(a==e){if(a<this.safeFrom)return null;let r=a+s.length;if(r<=this.safeTo){let d=s.prop(Y.lookAhead);if(!d||r+d<this.fragment.to)return s}}this.index[t]++,a+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+s.length}}}class Sd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new gi)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:s}=l,a=l.stateSlot(e.state,3),r=e.curContext?e.curContext.hash:0,d=0;for(let c=0;c<s.length;c++){if(!(1<<c&a))continue;let h=s[c],f=this.tokens[c];if(!(i&&!h.fallback)&&((h.contextual||f.start!=e.pos||f.mask!=a||f.context!=r)&&(this.updateCachedToken(f,h,e),f.mask=a,f.context=r),f.lookAhead>f.end+25&&(d=Math.max(f.lookAhead,d)),f.value!=0)){let p=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!h.extend&&(i=f,t>p))break}}for(;this.actions.length>t;)this.actions.pop();return d&&e.setLookAhead(d),!i&&e.pos==this.stream.end&&(i=new gi,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new gi,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:s}=i.p;for(let a=0;a<s.specialized.length;a++)if(s.specialized[a]==e.value){let r=s.specializers[a](this.stream.read(e.start,e.end),i);if(r>=0&&i.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,i,l){for(let s=0;s<l;s+=3)if(this.actions[s]==e)return l;return this.actions[l++]=e,this.actions[l++]=t,this.actions[l++]=i,l}addActions(e,t,i,l){let{state:s}=e,{parser:a}=e.p,{data:r}=a;for(let d=0;d<2;d++)for(let c=a.stateSlot(s,d?2:1);;c+=3){if(r[c]==65535)if(r[c+1]==1)c=He(r,c+2);else{l==0&&r[c+1]==2&&(l=this.putAction(He(r,c+2),t,i,l));break}r[c]==t&&(l=this.putAction(He(r,c+1),t,i,l))}return l}}class Nd{constructor(e,t,i,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 Sd(e,this.stream),this.topTerm=e.top[1];let{from:s}=l[0];this.stacks=[ui.start(this,e.top[0],s)],this.fragments=i.length&&this.stream.end-s>e.bufferLength*4?new Cd(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let r=e[a];for(;;){if(this.tokens.mainToken=null,r.pos>t)i.push(r);else{if(this.advanceStack(r,i,e))continue;{l||(l=[],s=[]),l.push(r);let d=this.tokens.getMainToken(r);s.push(d.value,d.end)}}break}}if(!i.length){let a=l&&Od(l);if(a)return Ne&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ne&&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 a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,s,i);if(a)return Ne&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((r,d)=>d.score-r.score);i.length>a;)i.pop();i.some(r=>r.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let r=i[a];for(let d=a+1;d<i.length;d++){let c=i[d];if(r.sameState(c)||r.buffer.length>500&&c.buffer.length>500)if((r.score-c.score||r.buffer.length-c.buffer.length)>0)i.splice(d--,1);else{i.splice(a--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].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,i){let l=e.pos,{parser:s}=this,a=Ne?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let f=this.fragments.nodeAt(l);f;){let p=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(p>-1&&f.length&&(!c||(f.prop(Y.contextHash)||0)==h))return e.useNode(f,p),Ne&&console.log(a+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof re)||f.children.length==0||f.positions[0]>0)break;let u=f.children[0];if(u instanceof re&&f.positions[0]==0)f=u;else break}}let r=s.stateSlot(e.state,4);if(r>0)return e.reduce(r),Ne&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(r&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let d=this.tokens.getActions(e);for(let c=0;c<d.length;){let h=d[c++],f=d[c++],p=d[c++],u=c==d.length||!i,y=u?e:e.split(),k=this.tokens.mainToken;if(y.apply(h,f,k?k.start:y.pos,p),Ne&&console.log(a+this.stackID(y)+` (via ${h&65536?`reduce of ${s.getName(h&65535)}`:"shift"} for ${s.getName(f)} @ ${l}${y==e?"":", split"})`),u)return!0;y.pos>l?t.push(y):i.push(y)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Rl(e,t),!0}}runRecovery(e,t,i){let l=null,s=!1;for(let a=0;a<e.length;a++){let r=e[a],d=t[a<<1],c=t[(a<<1)+1],h=Ne?this.stackID(r)+" -> ":"";if(r.deadEnd&&(s||(s=!0,r.restart(),Ne&&console.log(h+this.stackID(r)+" (restarted)"),this.advanceFully(r,i))))continue;let f=r.split(),p=h;for(let u=0;f.forceReduce()&&u<10&&(Ne&&console.log(p+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));u++)Ne&&(p=this.stackID(f)+" -> ");for(let u of r.recoverByInsert(d))Ne&&console.log(h+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,i);this.stream.end>r.pos?(c==r.pos&&(c++,d=0),r.recoverByDelete(d,c),Ne&&console.log(h+this.stackID(r)+` (via recover-delete ${this.parser.getName(d)})`),Rl(r,i)):(!l||l.score<r.score)&&(l=r)}return l}stackToTree(e){return e.close(),re.build({buffer:pi.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=(dn||(dn=new WeakMap)).get(e);return t||dn.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Rl(o,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==o.pos&&i.sameState(o)){e[t].score<o.score&&(e[t]=o);return}}e.push(o)}class Bd{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class ki extends Il{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 i=Object.keys(e.topRules).map(r=>e.topRules[r][1]),l=[];for(let r=0;r<t.length;r++)l.push([]);function s(r,d,c){l[r].push([d,d.deserialize(String(c))])}if(e.nodeProps)for(let r of e.nodeProps){let d=r[0];typeof d=="string"&&(d=Y[d]);for(let c=1;c<r.length;){let h=r[c++];if(h>=0)s(h,d,r[c++]);else{let f=r[c+-h];for(let p=-h;p>0;p--)s(r[c++],d,f);c++}}}this.nodeSet=new nn(t.map((r,d)=>Ce.define({name:d>=this.minRepeatTerm?void 0:r,id:d,props:l[d],top:i.indexOf(d)>-1,error:d==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(d)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Ol;let a=mi(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(Ll),this.states=mi(e.states,Uint32Array),this.data=mi(e.stateData),this.goto=mi(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(r=>typeof r=="number"?new xt(a,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,i){let l=new Nd(this,e,t,i);for(let s of this.wrappers)l=s(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let s=l[t+1];;){let a=l[s++],r=a&1,d=l[s++];if(r&&i)return d;for(let c=s+(a>>1);s<c;s++)if(l[s]==e)return d;if(r)return-1}}hasAction(e,t){let i=this.data;for(let l=0;l<2;l++)for(let s=this.stateSlot(e,l?2:1),a;;s+=3){if((a=i[s])==65535)if(i[s+1]==1)a=i[s=He(i,s+2)];else{if(i[s+1]==2)return He(i,s+2);break}if(a==t||a==0)return He(i,s+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,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let s=this.stateSlot(e,1);l==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=He(this.data,s+2);else break;l=t(He(this.data,s+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=He(this.data,i+2);else break;if(!(this.data[i+2]&1)){let l=this.data[i+1];t.some((s,a)=>a&1&&s==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(ki.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(s=>s.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let s=e.specializers.find(r=>r.from==i.external);if(!s)return i;let a=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[l]=Ll(a),a})),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),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let a=t.indexOf(s);a>=0&&(i[a]=!0)}let l=null;for(let s=0;s<t.length;s++)if(!i[s])for(let a=this.dialects[t[s]],r;(r=this.data[a++])!=65535;)(l||(l=new Uint8Array(this.maxTerm+1)))[r]=1;return new Bd(e,i,l)}static deserialize(e){return new ki(e)}}function He(o,e){return o[e]|o[e+1]<<16}function Od(o){let e=null;for(let t of o){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Ll(o){if(o.external){let e=o.extend?1:0;return(t,i)=>o.external(t,i)<<1|e}return o.get}let Vd=0;class _e{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=Vd++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof _e&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let l=new _e(i,[],null,[]);if(l.set.push(l),t)for(let s of t.set)l.set.push(s);return l}static defineModifier(e){let t=new bi(e);return i=>i.modified.indexOf(t)>-1?i:bi.get(i.base||i,i.modified.concat(t).sort((l,s)=>l.id-s.id))}}let _d=0;class bi{constructor(e){this.name=e,this.instances=[],this.id=_d++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(r=>r.base==e&&Md(t,r.modified));if(i)return i;let l=[],s=new _e(e.name,l,e,t);for(let r of t)r.instances.push(s);let a=Td(t);for(let r of e.set)if(!r.modified.length)for(let d of a)l.push(bi.get(r,d));return s}}function Md(o,e){return o.length==e.length&&o.every((t,i)=>t==e[i])}function Td(o){let e=[[]];for(let t=0;t<o.length;t++)for(let i=0,l=e.length;i<l;i++)e.push(e[i].concat(o[t]));return e.sort((t,i)=>i.length-t.length)}function jl(o){let e=Object.create(null);for(let t in o){let i=o[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let s=[],a=2,r=l;for(let f=0;;){if(r=="..."&&f>0&&f+3==l.length){a=1;break}let p=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!p)throw new RangeError("Invalid path: "+l);if(s.push(p[0]=="*"?"":p[0][0]=='"'?JSON.parse(p[0]):p[0]),f+=p[0].length,f==l.length)break;let u=l[f++];if(f==l.length&&u=="!"){a=0;break}if(u!="/")throw new RangeError("Invalid path: "+l);r=l.slice(f)}let d=s.length-1,c=s[d];if(!c)throw new RangeError("Invalid path: "+l);let h=new cn(i,a,d>0?s.slice(0,d):null);e[c]=h.sort(e[c])}}return Ad.add(e)}const Ad=new Y;class cn{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,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}}cn.empty=new cn([],2,null);function zl(o,e){let t=Object.create(null);for(let s of o)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let a of s.tag)t[a.id]=s.class;let{scope:i,all:l=null}=e||{};return{style:s=>{let a=l;for(let r of s)for(let d of r.set){let c=t[d.id];if(c){a=a?a+" "+c:c;break}}return a},scope:i}}const j=_e.define,yi=j(),tt=j(),ql=j(tt),Ul=j(tt),it=j(),wi=j(it),hn=j(it),Pe=j(),ft=j(Pe),Fe=j(),$e=j(),fn=j(),qt=j(fn),xi=j(),R={comment:yi,lineComment:j(yi),blockComment:j(yi),docComment:j(yi),name:tt,variableName:j(tt),typeName:ql,tagName:j(ql),propertyName:Ul,attributeName:j(Ul),className:j(tt),labelName:j(tt),namespace:j(tt),macroName:j(tt),literal:it,string:wi,docString:j(wi),character:j(wi),attributeValue:j(wi),number:hn,integer:j(hn),float:j(hn),bool:j(it),regexp:j(it),escape:j(it),color:j(it),url:j(it),keyword:Fe,self:j(Fe),null:j(Fe),atom:j(Fe),unit:j(Fe),modifier:j(Fe),operatorKeyword:j(Fe),controlKeyword:j(Fe),definitionKeyword:j(Fe),moduleKeyword:j(Fe),operator:$e,derefOperator:j($e),arithmeticOperator:j($e),logicOperator:j($e),bitwiseOperator:j($e),compareOperator:j($e),updateOperator:j($e),definitionOperator:j($e),typeOperator:j($e),controlOperator:j($e),punctuation:fn,separator:j(fn),bracket:qt,angleBracket:j(qt),squareBracket:j(qt),paren:j(qt),brace:j(qt),content:Pe,heading:ft,heading1:j(ft),heading2:j(ft),heading3:j(ft),heading4:j(ft),heading5:j(ft),heading6:j(ft),contentSeparator:j(Pe),list:j(Pe),quote:j(Pe),emphasis:j(Pe),strong:j(Pe),link:j(Pe),monospace:j(Pe),strikethrough:j(Pe),inserted:j(),deleted:j(),changed:j(),invalid:j(),meta:xi,documentMeta:j(xi),annotation:j(xi),processingInstruction:j(xi),definition:_e.defineModifier("definition"),constant:_e.defineModifier("constant"),function:_e.defineModifier("function"),standard:_e.defineModifier("standard"),local:_e.defineModifier("local"),special:_e.defineModifier("special")};for(let o in R){let e=R[o];e instanceof _e&&(e.name=o)}zl([{tag:R.link,class:"tok-link"},{tag:R.heading,class:"tok-heading"},{tag:R.emphasis,class:"tok-emphasis"},{tag:R.strong,class:"tok-strong"},{tag:R.keyword,class:"tok-keyword"},{tag:R.atom,class:"tok-atom"},{tag:R.bool,class:"tok-bool"},{tag:R.url,class:"tok-url"},{tag:R.labelName,class:"tok-labelName"},{tag:R.inserted,class:"tok-inserted"},{tag:R.deleted,class:"tok-deleted"},{tag:R.literal,class:"tok-literal"},{tag:R.string,class:"tok-string"},{tag:R.number,class:"tok-number"},{tag:[R.regexp,R.escape,R.special(R.string)],class:"tok-string2"},{tag:R.variableName,class:"tok-variableName"},{tag:R.local(R.variableName),class:"tok-variableName tok-local"},{tag:R.definition(R.variableName),class:"tok-variableName tok-definition"},{tag:R.special(R.variableName),class:"tok-variableName2"},{tag:R.definition(R.propertyName),class:"tok-propertyName tok-definition"},{tag:R.typeName,class:"tok-typeName"},{tag:R.namespace,class:"tok-namespace"},{tag:R.className,class:"tok-className"},{tag:R.macroName,class:"tok-macroName"},{tag:R.propertyName,class:"tok-propertyName"},{tag:R.operator,class:"tok-operator"},{tag:R.comment,class:"tok-comment"},{tag:R.meta,class:"tok-meta"},{tag:R.invalid,class:"tok-invalid"},{tag:R.punctuation,class:"tok-punctuation"}]);const Ed=jl({String:R.string,Number:R.number,"True False":R.bool,PropertyName:R.propertyName,Null:R.null,",":R.separator,"[ ]":R.squareBracket,"{ }":R.brace}),Id=ki.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:[Ed],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});class X{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,i){[e,t]=vt(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Re.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vt(this,e,t);let i=[];return this.decompose(e,t,i,0),Re.from(i,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),i=this.length-this.scanIdentical(e,-1),l=new Ut(this),s=new Ut(e);for(let a=t,r=t;;){if(l.next(a),s.next(a),a=0,l.lineBreak!=s.lineBreak||l.done!=s.done||l.value!=s.value)return!1;if(r+=l.value.length,l.done||r>=i)return!0}}iter(e=1){return new Ut(this,e)}iterRange(e,t=this.length){return new Hl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Kl(i)}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]?X.empty:e.length<=32?new ae(e):Re.from(ae.split(e,[]))}}class ae extends X{constructor(e,t=Dd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.text[s],r=l+a.length;if((t?i:r)>=e)return new Pd(l,r,i,a);l=r+1,i++}}decompose(e,t,i,l){let s=e<=0&&t>=this.length?this:new ae(Wl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),r=vi(s.text,a.text.slice(),0,s.length);if(r.length<=32)i.push(new ae(r,a.length+s.length));else{let d=r.length>>1;i.push(new ae(r.slice(0,d)),new ae(r.slice(d)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ae))return super.replace(e,t,i);[e,t]=vt(this,e,t);let l=vi(this.text,vi(i.text,Wl(this.text,0,e)),t),s=this.length+i.length-(t-e);return l.length<=32?new ae(l,s):Re.from(ae.split(l,[]),s)}sliceString(e,t=this.length,i=`
2
2
  `){[e,t]=vt(this,e,t);let l="";for(let s=0,a=0;s<=t&&a<this.text.length;a++){let r=this.text[a],d=s+r.length;s>e&&a&&(l+=i),e<d&&t>s&&(l+=r.slice(Math.max(0,e-s),t-s)),s=d+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let s of e)i.push(s),l+=s.length+1,i.length==32&&(t.push(new ae(i,l)),i=[],l=-1);return l>-1&&t.push(new ae(i,l)),t}}class Re extends X{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let s=0;;s++){let a=this.children[s],r=l+a.length,d=i+a.lines-1;if((t?d:r)>=e)return a.lineInner(e,t,i,l);l=r+1,i=d+1}}decompose(e,t,i,l){for(let s=0,a=0;a<=t&&s<this.children.length;s++){let r=this.children[s],d=a+r.length;if(e<=d&&t>=a){let c=l&((a<=e?1:0)|(d>=t?2:0));a>=e&&d<=t&&!c?i.push(r):r.decompose(e-a,t-a,i,c)}a=d+1}}replace(e,t,i){if([e,t]=vt(this,e,t),i.lines<this.lines)for(let l=0,s=0;l<this.children.length;l++){let a=this.children[l],r=s+a.length;if(e>=s&&t<=r){let d=a.replace(e-s,t-s,i),c=this.lines-a.lines+d.lines;if(d.lines<c>>4&&d.lines>c>>6){let h=this.children.slice();return h[l]=d,new Re(h,this.length-(t-e)+i.length)}return super.replace(s,r,d)}s=r+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
- `){[e,t]=vt(this,e,t);let l="";for(let s=0,a=0;s<this.children.length&&a<=t;s++){let r=this.children[s],d=a+r.length;a>e&&s&&(l+=i),e<d&&t>a&&(l+=r.sliceString(e-a,t-a,i)),a=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[l,s,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==a||s==r)return i;let d=this.children[l],c=e.children[s];if(d!=c)return i+d.scanIdentical(c,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let m of e)i+=m.lines;if(i<32){let m=[];for(let y of e)y.flatten(m);return new ae(m,t)}let l=Math.max(32,i>>5),s=l<<1,a=l>>1,r=[],d=0,c=-1,h=[];function f(m){let y;if(m.lines>s&&m instanceof Re)for(let k of m.children)f(k);else m.lines>a&&(d>a||!d)?(u(),r.push(m)):m instanceof ae&&d&&(y=h[h.length-1])instanceof ae&&m.lines+y.lines<=32?(d+=m.lines,c+=m.length+1,h[h.length-1]=new ae(y.text.concat(m.text),y.length+1+m.length)):(d+m.lines>l&&u(),d+=m.lines,c+=m.length+1,h.push(m))}function u(){d!=0&&(r.push(h.length==1?h[0]:Re.from(h,c)),c=-1,d=h.length=0)}for(let m of e)f(m);return u(),r.length==1?r[0]:new Re(r,t)}}X.empty=new ae([""],0);function Dd(o){let e=-1;for(let t of o)e+=t.length+1;return e}function vi(o,e,t=0,i=1e9){for(let l=0,s=0,a=!0;s<o.length&&l<=i;s++){let r=o[s],d=l+r.length;d>=t&&(d>i&&(r=r.slice(0,i-l)),l<t&&(r=r.slice(t-l)),a?(e[e.length-1]+=r,a=!1):e.push(r)),l=d+1}return e}function Wl(o,e,t){return vi(o,[""],e,t)}class Ut{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 ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],s=this.offsets[i],a=s>>1,r=l instanceof ae?l.text.length:l.children.length;if(a==(t>0?r:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
- `,this;e--}else if(l instanceof ae){let d=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,d.length>Math.max(0,e))return this.value=e==0?d:t>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=l.children[a+(t<0?-1:0)];e>d.length?(e-=d.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(d),this.offsets.push(t>0?1:(d instanceof ae?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Hl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ut(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),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 Kl{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},Ut.prototype[Symbol.iterator]=Hl.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=function(){return this});class Pd{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function vt(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let Ct="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(o=>o?parseInt(o,36):1);for(let o=1;o<Ct.length;o++)Ct[o]+=Ct[o-1];function Fd(o){for(let e=1;e<Ct.length;e+=2)if(Ct[e]>o)return Ct[e-1]<=o;return!1}function Ql(o){return o>=127462&&o<=127487}const Gl=8205;function Ke(o,e,t=!0,i=!0){return(t?Yl:$d)(o,e,i)}function Yl(o,e,t){if(e==o.length)return e;e&&Xl(o.charCodeAt(e))&&Jl(o.charCodeAt(e-1))&&e--;let i=un(o,e);for(e+=Zl(i);e<o.length;){let l=un(o,e);if(i==Gl||l==Gl||t&&Fd(l))e+=Zl(l),i=l;else if(Ql(l)){let s=0,a=e-2;for(;a>=0&&Ql(un(o,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function $d(o,e,t){for(;e>0;){let i=Yl(o,e-2,t);if(i<e)return i;e--}return 0}function Xl(o){return o>=56320&&o<57344}function Jl(o){return o>=55296&&o<56320}function un(o,e){let t=o.charCodeAt(e);if(!Jl(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Xl(i)?(t-55296<<10)+(i-56320)+65536:t}function Zl(o){return o<65536?1:2}const pn=/\r\n?|\n/;var Be=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(Be||(Be={}));class Qe{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],a=this.sections[t++];a<0?(e(i,l,s),l+=s):l+=a,i+=s}}iterChangedRanges(e,t=!1){mn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:es(this,e)}mapDesc(e,t=!1){return e.empty?this:gn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let l=0,s=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],c=l+r;if(d<0){if(c>e)return s+(e-l);s+=r}else{if(i!=Be.Simple&&c>=e&&(i==Be.TrackDel&&l<e&&c>e||i==Be.TrackBefore&&l<e||i==Be.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=c}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],a=this.sections[i++],r=l+s;if(a>=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 i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(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 Qe(e)}static create(e){return new Qe(e)}}class ue extends Qe{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 mn(this,(t,i,l,s,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return gn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let a=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=a;let d=l>>1;for(;i.length<d;)i.push(X.empty);i.push(a?e.slice(s,s+a):X.empty)}s+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:es(this,e,!0)}map(e,t=!1){return e.empty?this:gn(this,e,t,!0)}iterChanges(e,t=!1){mn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Wt(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,d-r);ke(l,h,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,h,f),f>0&&nt(i,t,s.text),s.forward(h),r+=h}let c=e[a++];for(;r<c;){if(s.done)break e;let h=Math.min(s.len,c-r);ke(t,h,-1),ke(l,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),r+=h}}return{changes:new ue(t,i),filtered:Qe.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],a=0,r=null;function d(h=!1){if(!h&&!l.length)return;a<t&&ke(l,t-a,-1);let f=new ue(l,s);r=r?r.compose(f.map(r)):f,l=[],s=[],a=0}function c(h){if(Array.isArray(h))for(let f of h)c(f);else if(h instanceof ue){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);d(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:u=f,insert:m}=h;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let y=m?typeof m=="string"?X.of(m.split(i||pn)):m:X.empty,k=y.length;if(f==u&&k==0)return;f<a&&d(),f>a&&ke(l,f-a,-1),ke(l,u-f,k),nt(s,l,y),a=u}}return c(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(X.empty);i[l]=X.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(o,e,t,i=!1){if(e==0&&t<=0)return;let l=o.length-2;l>=0&&t<=0&&t==o[l+1]?o[l]+=e:e==0&&o[l]==0?o[l+1]+=t:i?(o[l]+=e,o[l+1]+=t):o.push(e,t)}function nt(o,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<o.length)o[o.length-1]=o[o.length-1].append(t);else{for(;o.length<i;)o.push(X.empty);o.push(t)}}function mn(o,e,t){let i=o.inserted;for(let l=0,s=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)l+=r,s+=r;else{let c=l,h=s,f=X.empty;for(;c+=r,h+=d,d&&i&&(f=f.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(l,c,s,h,f),l=c,s=h}}}function gn(o,e,t,i=!1){let l=[],s=i?[]:null,a=new Wt(o),r=new Wt(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let c=Math.min(a.len,r.len);ke(l,c,-1),a.forward(c),r.forward(c)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let c=r.len;for(ke(l,r.ins,-1);c;){let h=Math.min(a.len,c);a.ins>=0&&d<a.i&&a.len<=h&&(ke(l,0,a.ins),s&&nt(s,l,a.text),d=a.i),a.forward(h),c-=h}r.next()}else if(a.ins>=0){let c=0,h=a.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);c+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;ke(l,c,d<a.i?a.ins:0),s&&d<a.i&&nt(s,l,a.text),d=a.i,a.forward(a.len-h)}else{if(a.done&&r.done)return s?ue.createSet(l,s):Qe.create(l);throw new Error("Mismatched change set lengths")}}function es(o,e,t=!1){let i=[],l=t?[]:null,s=new Wt(o),a=new Wt(e);for(let r=!1;;){if(s.done&&a.done)return l?ue.createSet(i,l):Qe.create(i);if(s.ins==0)ke(i,s.len,0,r),s.next();else if(a.len==0&&!a.done)ke(i,0,a.ins,r),l&&nt(l,i,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,a.len),c=i.length;if(s.ins==-1){let h=a.ins==-1?-1:a.off?0:a.ins;ke(i,d,h,r),l&&h&&nt(l,i,a.text)}else a.ins==-1?(ke(i,s.off?0:s.len,d,r),l&&nt(l,i,s.textBit(d))):(ke(i,s.off?0:s.len,a.off?0:a.ins,r),l&&!a.off&&nt(l,i,a.text));r=(s.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>c),s.forward2(d),a.forward(d)}}}}class Wt{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?X.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?X.empty:t[i].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 ut{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}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 i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new ut(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return U.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return U.range(this.anchor,i)}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 U.range(e.anchor,e.head)}static create(e,t,i){return new ut(e,t,i)}}class U{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:U.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new U([this.main],0)}addRange(e,t=!0){return U.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,U.create(i,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 U(e.ranges.map(t=>ut.fromJSON(t)),e.main)}static single(e,t=e){return new U([U.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 i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return U.normalized(e.slice(),t);i=s.to}return new U(e,t)}static cursor(e,t=0,i,l){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?ut.create(t,e,48|s):ut.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],a=e[l-1];if(s.empty?s.from<=a.to:s.from<a.to){let r=a.from,d=Math.max(s.to,a.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?U.range(d,r):U.range(r,d))}}return new U(e,t)}}function ts(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let kn=0;class Q{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=kn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Q(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:bn),!!e.static,e.enables)}of(e){return new Ci([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function bn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Ci{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=kn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,a=e[s]>>1,r=this.type==2,d=!1,c=!1,h=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?c=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[a]=i(f),1},update(f,u){if(d&&u.docChanged||c&&(u.docChanged||u.selection)||yn(f,h)){let m=i(f);if(r?!is(m,f.values[a],l):!l(m,f.values[a]))return f.values[a]=m,1}return 0},reconfigure:(f,u)=>{let m,y=u.config.address[s];if(y!=null){let k=Bi(u,y);if(this.dependencies.every(x=>x instanceof Q?u.facet(x)===f.facet(x):x instanceof pt?u.field(x,!1)==f.field(x,!1):!0)||(r?is(m=i(f),k,l):l(m=i(f),k)))return f.values[a]=k,0}else m=i(f);return f.values[a]=m,1}}}}function is(o,e,t){if(o.length!=e.length)return!1;for(let i=0;i<o.length;i++)if(!t(o[i],e[i]))return!1;return!0}function yn(o,e){let t=!1;for(let i of e)Kt(o,i)&1&&(t=!0);return t}function Rd(o,e,t){let i=t.map(d=>o[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let c=[];for(let h=0;h<i.length;h++){let f=Bi(d,i[h]);if(l[h]==2)for(let u of f)c.push(u);else c.push(f)}return e.combine(c)}return{create(d){for(let c of i)Kt(d,c);return d.values[a]=r(d),1},update(d,c){if(!yn(d,s))return 0;let h=r(d);return e.compare(h,d.values[a])?0:(d.values[a]=h,1)},reconfigure(d,c){let h=yn(d,i),f=c.config.facets[e.id],u=c.facet(e);if(f&&!h&&bn(t,f))return d.values[a]=u,0;let m=r(d);return e.compare(m,u)?(d.values[a]=u,0):(d.values[a]=m,1)}}}const ns=Q.define({static:!0});class pt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new pt(kn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ns).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],a=this.updateF(s,l);return this.compareF(s,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ns.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Ht(o){return e=>new ls(e,o)}const Ld={highest:Ht(mt.highest),high:Ht(mt.high),default:Ht(mt.default),low:Ht(mt.low),lowest:Ht(mt.lowest)};class ls{constructor(e,t){this.inner=e,this.prec=t}}class Si{of(e){return new wn(this,e)}reconfigure(e){return Si.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class wn{constructor(e,t){this.compartment=e,this.inner=t}}class Ni{constructor(e,t,i,l,s,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<i.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,i){let l=[],s=Object.create(null),a=new Map;for(let u of jd(e,t,a))u instanceof pt?l.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let r=Object.create(null),d=[],c=[];for(let u of l)r[u.id]=c.length<<1,c.push(m=>u.slot(m));let h=i?.config.facets;for(let u in s){let m=s[u],y=m[0].facet,k=h&&h[u]||[];if(m.every(x=>x.type==0))if(r[y.id]=d.length<<1|1,bn(k,m))d.push(i.facet(y));else{let x=y.combine(m.map(w=>w.value));d.push(i&&y.compare(x,i.facet(y))?i.facet(y):x)}else{for(let x of m)x.type==0?(r[x.id]=d.length<<1|1,d.push(x.value)):(r[x.id]=c.length<<1,c.push(w=>x.dynamicSlot(w)));r[y.id]=c.length<<1,c.push(x=>Rd(x,y,m))}}let f=c.map(u=>u(r));return new Ni(e,a,f,r,d,s)}}function jd(o,e,t){let i=[[],[],[],[],[]],l=new Map;function s(a,r){let d=l.get(a);if(d!=null){if(d<=r)return;let c=i[d].indexOf(a);c>-1&&i[d].splice(c,1),a instanceof wn&&t.delete(a.compartment)}if(l.set(a,r),Array.isArray(a))for(let c of a)s(c,r);else if(a instanceof wn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(a.compartment)||a.inner;t.set(a.compartment,c),s(c,r)}else if(a instanceof ls)s(a.inner,a.prec);else if(a instanceof pt)i[r].push(a),a.provides&&s(a.provides,r);else if(a instanceof Ci)i[r].push(a),a.facet.extensions&&s(a.facet.extensions,mt.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,r)}}return s(o,mt.default),i.reduce((a,r)=>a.concat(r))}function Kt(o,e){if(e&1)return 2;let t=e>>1,i=o.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;o.status[t]=4;let l=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|l}function Bi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const ss=Q.define(),xn=Q.define({combine:o=>o.some(e=>e),static:!0}),os=Q.define({combine:o=>o.length?o[0]:void 0,static:!0}),as=Q.define(),rs=Q.define(),ds=Q.define(),cs=Q.define({combine:o=>o.length?o[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new zd}}class zd{of(e){return new St(this,e)}}class qd{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{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 ce(this.type,t)}is(e){return this.type==e}static define(e={}){return new qd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}ce.reconfigure=ce.define(),ce.appendConfig=ce.define();class be{constructor(e,t,i,l,s,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,i&&ts(i,t.newLength),s.some(r=>r.type==be.time)||(this.annotations=s.concat(be.time.of(Date.now())))}static create(e,t,i,l,s,a){return new be(e,t,i,l,s,a)}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(be.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}be.time=St.define(),be.userEvent=St.define(),be.addToHistory=St.define(),be.remote=St.define();function Ud(o,e){let t=[];for(let i=0,l=0;;){let s,a;if(i<o.length&&(l==e.length||e[l]>=o[i]))s=o[i++],a=o[i++];else if(l<e.length)s=e[l++],a=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function hs(o,e,t){var i;let l,s,a;return t?(l=e.changes,s=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(l=e.changes.map(o.changes),s=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(l)),{changes:a,selection:e.selection?e.selection.map(s):(i=o.selection)===null||i===void 0?void 0:i.map(l),effects:ce.mapEffects(o.effects,l).concat(ce.mapEffects(e.effects,s)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function vn(o,e,t){let i=e.selection,l=Nt(e.annotations);return e.userEvent&&(l=l.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(os)),selection:i&&(i instanceof U?i:U.single(i.anchor,i.head)),effects:Nt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function fs(o,e,t){let i=vn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let a=!!e[s].sequential;i=hs(i,vn(o,e[s],a?i.changes.newLength:o.doc.length),a)}let l=be.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Hd(t?Wd(l):l)}function Wd(o){let e=o.startState,t=!0;for(let l of e.facet(as)){let s=l(o);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Ud(t,s))}if(t!==!0){let l,s;if(t===!1)s=o.changes.invertedDesc,l=ue.empty(e.doc.length);else{let a=o.changes.filter(t);l=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}o=be.create(e,l,o.selection&&o.selection.map(s),ce.mapEffects(o.effects,s),o.annotations,o.scrollIntoView)}let i=e.facet(rs);for(let l=i.length-1;l>=0;l--){let s=i[l](o);s instanceof be?o=s:Array.isArray(s)&&s.length==1&&s[0]instanceof be?o=s[0]:o=fs(e,Nt(s),!1)}return o}function Hd(o){let e=o.startState,t=e.facet(ds),i=o;for(let l=t.length-1;l>=0;l--){let s=t[l](o);s&&Object.keys(s).length&&(i=hs(i,vn(e,s,o.changes.newLength),!0))}return i==o?o:be.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const Kd=[];function Nt(o){return o==null?Kd:Array.isArray(o)?o:[o]}var Ge=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Ge||(Ge={}));const Qd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cn;try{Cn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Gd(o){if(Cn)return Cn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Qd.test(t)))return!0}return!1}function Yd(o){return e=>{if(!/\S/.test(e))return Ge.Space;if(Gd(e))return Ge.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Ge.Word;return Ge.Other}}class te{constructor(e,t,i,l,s,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Kt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Kt(this,i),Bi(this,i)}update(...e){return fs(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Si.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,c)=>l.set(c,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(ce.reconfigure)?(t=null,i=r.value):r.is(ce.appendConfig)&&(t=null,i=Nt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Ni.resolve(i,l,this),s=new te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,c)=>c.reconfigure(d,this),null).values);let a=e.startState.facet(xn)?e.newSelection:e.newSelection.asSingle();new te(t,e.newDoc,a,s,(r,d)=>d.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:U.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],a=Nt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),c=this.changes(d.changes),h=c.map(l);for(let u=0;u<r;u++)s[u]=s[u].map(h);let f=l.mapDesc(c,!0);s.push(d.range.map(f)),l=l.compose(h),a=ce.mapEffects(a,h).concat(ce.mapEffects(Nt(d.effects),f))}return{changes:l,selection:U.create(s,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(te.lineSeparator))}toText(e){return X.of(e.split(this.facet(te.lineSeparator)||pn))}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:(Kt(this,t),Bi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof pt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let a=i[s],r=e[s];l.push(a.init(d=>a.spec.fromJSON(r,d)))}}return te.create({doc:e.doc,selection:U.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Ni.resolve(e.extensions||[],new Map),i=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(te.lineSeparator)||pn)),l=e.selection?e.selection instanceof U?e.selection:U.single(e.selection.anchor,e.selection.head):U.single(0);return ts(l,i.length),t.staticFacet(xn)||(l=l.asSingle()),new te(t,i,l,t.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(te.tabSize)}get lineBreak(){return this.facet(te.lineSeparator)||`
5
- `}get readOnly(){return this.facet(cs)}phrase(e,...t){for(let i of this.facet(te.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(ss))for(let a of s(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){return Yd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ke(t,a,!1);if(s(t.slice(d,a))!=Ge.Word)break;a=d}for(;r<l;){let d=Ke(t,r);if(s(t.slice(r,d))!=Ge.Word)break;r=d}return a==r?null:U.range(a+i,r+i)}}te.allowMultipleSelections=xn,te.tabSize=Q.define({combine:o=>o.length?o[0]:4}),te.lineSeparator=os,te.readOnly=cs,te.phrases=Q.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(l=>o[l]==e[l])}}),te.languageData=ss,te.changeFilter=as,te.transactionFilter=rs,te.transactionExtender=ds,Si.reconfigure=ce.define();class Bt{eq(e){return this==e}range(e,t=e){return Qt.create(e,t,this)}}Bt.prototype.startSide=Bt.prototype.endSide=0,Bt.prototype.point=!1,Bt.prototype.mapMode=Be.TrackDel;class Qt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Qt(e,t,i)}}function Sn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Nn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let a=l,r=s.length;;){if(a==r)return a;let d=a+r>>1,c=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return c>=0?a:r;c>=0?r=d:a=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,s);s<a;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let c=this.value[d],h=this.from[d]+e,f=this.to[d]+e,u,m;if(h==f){let y=t.mapPos(h,c.startSide,c.mapMode);if(y==null||(u=m=y,c.startSide!=c.endSide&&(m=t.mapPos(h,c.endSide),m<u)))continue}else if(u=t.mapPos(h,c.startSide),m=t.mapPos(f,c.endSide),u>m||u==m&&c.startSide>0&&c.endSide<=0)continue;(m-u||c.endSide-c.startSide)<0||(a<0&&(a=u),c.point&&(r=Math.max(r,m-u)),i.push(c),l.push(u-a),s.push(m-a))}return{mapped:i.length?new Nn(l,s,i,r):null,pos:a}}}class se{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new se(e,t,i,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:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Sn)),this.isEmpty)return t.length?se.of(t):this;let r=new ps(this,null,-1).goto(0),d=0,c=[],h=new Oi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let f=t[d++];h.addInner(f.from,f.to,f.value)||c.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||l>r.to||s<r.from||a(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||c.push(Qt.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?se.empty:this.nextLayer.update({add:c,filter:a,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],c=e.touchesRange(r,r+d.length);if(c===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(c===!0){let{mapped:h,pos:f}=d.map(r,e);h&&(l=Math.max(l,h.maxPoint),t.push(h),i.push(f))}}let s=this.nextLayer.map(e);return t.length==0?s:new se(i,t,s||se.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],a=this.chunk[l];if(t>=s&&e<=s+a.length&&a.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Gt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Gt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let a=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),d=us(a,r,i),c=new Yt(a,d,s),h=new Yt(r,d,s);i.iterGaps((f,u,m)=>ms(c,f,h,u,m,l)),i.empty&&i.length==0&&ms(c,0,h,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),a=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let r=us(s,a),d=new Yt(s,r,0).goto(i),c=new Yt(a,r,0).goto(i);for(;;){if(d.to!=c.to||!On(d.active,c.active)||d.point&&(!c.point||!d.point.eq(c.point)))return!1;if(d.to>l)return!0;d.next(),c.next()}}static spans(e,t,i,l,s=-1){let a=new Yt(e,null,s).goto(t),r=t,d=a.openStart;for(;;){let c=Math.min(a.to,i);if(a.point){let h=a.activeForPoint(a.to),f=a.pointFrom<t?h.length+1:a.point.startSide<0?h.length:Math.min(h.length,d);l.point(r,c,a.point,h,f,a.pointRank),d=Math.min(a.openEnd(c),h.length)}else c>r&&(l.span(r,c,a.active,d),d=a.openEnd(c));if(a.to>i)return d+(a.point&&a.to>i?1:0);r=a.to,a.next()}}static of(e,t=!1){let i=new Oi;for(let l of e instanceof Qt?[e]:t?Xd(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return se.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=se.empty;l=l.nextLayer)t=new se(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}se.empty=new se([],[],null,-1);function Xd(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Sn(e,i)>0)return o.slice().sort(Sn);e=i}return o}se.empty.nextLayer=se.empty;class Oi{finishChunk(e){this.chunks.push(new Nn(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,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Oi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.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=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(se.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=se.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function us(o,e,t){let i=new Map;for(let s of o)for(let a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&i.set(s.chunk[a],s.chunkPos[a]);let l=new Set;for(let s of e)for(let a=0;a<s.chunk.length;a++){let r=i.get(s.chunk[a]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[a]&&!t?.touchesRange(r,r+s.chunk[a].length)&&l.add(s.chunk[a])}return l}class ps{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,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,i){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++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||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],i=e+t.from[this.rangeIndex];if(this.from=i,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 Gt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let a=e[s];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&l.push(new ps(a,t,i,s));return l.length==1?l[0]:new Gt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Bn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Bn(this.heap,i);(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(),Bn(this.heap,0)}}}function Bn(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let l=o[i];if(i+1<o.length&&l.compare(o[i+1])>=0&&(l=o[i+1],i++),t.compare(l)<0)break;o[i]=t,o[e]=l,e=i}}class Yt{constructor(e,t,i){this.minPoint=i,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=Gt.from(e,t,i)}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){Vi(this.active,e),Vi(this.activeTo,e),Vi(this.activeRank,e),this.minActive=gs(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;_i(this.active,t,i),_i(this.activeTo,t,l),_i(this.activeRank,t,s),e&&_i(e,t,this.cursor.from),this.minActive=gs(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=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),i&&Vi(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function ms(o,e,t,i,l,s){o.goto(e),t.goto(i);let a=i+l,r=i,d=i-e;for(;;){let c=o.to+d-t.to||o.endSide-t.endSide,h=c<0?o.to+d:t.to,f=Math.min(h,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&On(o.activeForPoint(o.to),t.activeForPoint(t.to))||s.comparePoint(r,f,o.point,t.point):f>r&&!On(o.active,t.active)&&s.compareRange(r,f,o.active,t.active),h>a)break;r=h,c<=0&&o.next(),c>=0&&t.next()}}function On(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!=e[t]&&!o[t].eq(e[t]))return!1;return!0}function Vi(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function _i(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function gs(o,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||o[l].endSide-o[t].endSide)<0&&(t=l,i=e[l]);return t}function Jd(o,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==o.length)break;s+=o.charCodeAt(l)==9?t-s%t:1,l=Ke(o,l)}return i===!0?-1:o.length}const Vn="ͼ",ks=typeof Symbol>"u"?"__"+Vn:Symbol.for(Vn),_n=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class lt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,r,d,c){let h=[],f=/^@(\w+)\b/.exec(a[0]),u=f&&f[1]=="keyframes";if(f&&r==null)return d.push(a[0]+";");for(let m in r){let y=r[m];if(/&/.test(m))s(m.split(/,\s*/).map(k=>a.map(x=>k.replace(/&/,x))).reduce((k,x)=>k.concat(x)),y,d);else if(y&&typeof y=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(l(m),y,h,u)}else y!=null&&h.push(m.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+y+";")}(h.length||u)&&d.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)s(l(a),e[a],this.rules)}getRules(){return this.rules.join(`
3
+ `){[e,t]=vt(this,e,t);let l="";for(let s=0,a=0;s<this.children.length&&a<=t;s++){let r=this.children[s],d=a+r.length;a>e&&s&&(l+=i),e<d&&t>a&&(l+=r.sliceString(e-a,t-a,i)),a=d+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Re))return 0;let i=0,[l,s,a,r]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,s+=t){if(l==a||s==r)return i;let d=this.children[l],c=e.children[s];if(d!=c)return i+d.scanIdentical(c,t);i+=d.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let y of e)y.flatten(u);return new ae(u,t)}let l=Math.max(32,i>>5),s=l<<1,a=l>>1,r=[],d=0,c=-1,h=[];function f(u){let y;if(u.lines>s&&u instanceof Re)for(let k of u.children)f(k);else u.lines>a&&(d>a||!d)?(p(),r.push(u)):u instanceof ae&&d&&(y=h[h.length-1])instanceof ae&&u.lines+y.lines<=32?(d+=u.lines,c+=u.length+1,h[h.length-1]=new ae(y.text.concat(u.text),y.length+1+u.length)):(d+u.lines>l&&p(),d+=u.lines,c+=u.length+1,h.push(u))}function p(){d!=0&&(r.push(h.length==1?h[0]:Re.from(h,c)),c=-1,d=h.length=0)}for(let u of e)f(u);return p(),r.length==1?r[0]:new Re(r,t)}}X.empty=new ae([""],0);function Dd(o){let e=-1;for(let t of o)e+=t.length+1;return e}function vi(o,e,t=0,i=1e9){for(let l=0,s=0,a=!0;s<o.length&&l<=i;s++){let r=o[s],d=l+r.length;d>=t&&(d>i&&(r=r.slice(0,i-l)),l<t&&(r=r.slice(t-l)),a?(e[e.length-1]+=r,a=!1):e.push(r)),l=d+1}return e}function Wl(o,e,t){return vi(o,[""],e,t)}class Ut{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 ae?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],s=this.offsets[i],a=s>>1,r=l instanceof ae?l.text.length:l.children.length;if(a==(t>0?r:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
+ `,this;e--}else if(l instanceof ae){let d=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,d.length>Math.max(0,e))return this.value=e==0?d:t>0?d.slice(e):d.slice(0,d.length-e),this;e-=d.length}else{let d=l.children[a+(t<0?-1:0)];e>d.length?(e-=d.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(d),this.offsets.push(t>0?1:(d instanceof ae?d.text.length:d.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Hl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ut(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}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 i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),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 Kl{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},Ut.prototype[Symbol.iterator]=Hl.prototype[Symbol.iterator]=Kl.prototype[Symbol.iterator]=function(){return this});class Pd{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function vt(o,e,t){return e=Math.max(0,Math.min(o.length,e)),[e,Math.max(e,Math.min(o.length,t))]}let Ct="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(o=>o?parseInt(o,36):1);for(let o=1;o<Ct.length;o++)Ct[o]+=Ct[o-1];function Fd(o){for(let e=1;e<Ct.length;e+=2)if(Ct[e]>o)return Ct[e-1]<=o;return!1}function Ql(o){return o>=127462&&o<=127487}const Gl=8205;function Ke(o,e,t=!0,i=!0){return(t?Yl:$d)(o,e,i)}function Yl(o,e,t){if(e==o.length)return e;e&&Xl(o.charCodeAt(e))&&Jl(o.charCodeAt(e-1))&&e--;let i=un(o,e);for(e+=Zl(i);e<o.length;){let l=un(o,e);if(i==Gl||l==Gl||t&&Fd(l))e+=Zl(l),i=l;else if(Ql(l)){let s=0,a=e-2;for(;a>=0&&Ql(un(o,a));)s++,a-=2;if(s%2==0)break;e+=2}else break}return e}function $d(o,e,t){for(;e>0;){let i=Yl(o,e-2,t);if(i<e)return i;e--}return 0}function Xl(o){return o>=56320&&o<57344}function Jl(o){return o>=55296&&o<56320}function un(o,e){let t=o.charCodeAt(e);if(!Jl(t)||e+1==o.length)return t;let i=o.charCodeAt(e+1);return Xl(i)?(t-55296<<10)+(i-56320)+65536:t}function Zl(o){return o<65536?1:2}const pn=/\r\n?|\n/;var Be=function(o){return o[o.Simple=0]="Simple",o[o.TrackDel=1]="TrackDel",o[o.TrackBefore=2]="TrackBefore",o[o.TrackAfter=3]="TrackAfter",o}(Be||(Be={}));class Qe{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,l=0;t<this.sections.length;){let s=this.sections[t++],a=this.sections[t++];a<0?(e(i,l,s),l+=s):l+=a,i+=s}}iterChangedRanges(e,t=!1){mn(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],l=this.sections[t++];l<0?e.push(i,l):e.push(l,i)}return new Qe(e)}composeDesc(e){return this.empty?e:e.empty?this:es(this,e)}mapDesc(e,t=!1){return e.empty?this:gn(this,e,t)}mapPos(e,t=-1,i=Be.Simple){let l=0,s=0;for(let a=0;a<this.sections.length;){let r=this.sections[a++],d=this.sections[a++],c=l+r;if(d<0){if(c>e)return s+(e-l);s+=r}else{if(i!=Be.Simple&&c>=e&&(i==Be.TrackDel&&l<e&&c>e||i==Be.TrackBefore&&l<e||i==Be.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!r)return e==l||t<0?s:s+d;s+=d}l=c}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return s}touchesRange(e,t=e){for(let i=0,l=0;i<this.sections.length&&l<=t;){let s=this.sections[i++],a=this.sections[i++],r=l+s;if(a>=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 i=this.sections[t++],l=this.sections[t++];e+=(e?" ":"")+i+(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 Qe(e)}static create(e){return new Qe(e)}}class ue extends Qe{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 mn(this,(t,i,l,s,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return gn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,s=0;l<t.length;l+=2){let a=t[l],r=t[l+1];if(r>=0){t[l]=r,t[l+1]=a;let d=l>>1;for(;i.length<d;)i.push(X.empty);i.push(a?e.slice(s,s+a):X.empty)}s+=a}return new ue(t,i)}compose(e){return this.empty?e:e.empty?this:es(this,e,!0)}map(e,t=!1){return e.empty?this:gn(this,e,t,!0)}iterChanges(e,t=!1){mn(this,e,t)}get desc(){return Qe.create(this.sections)}filter(e){let t=[],i=[],l=[],s=new Wt(this);e:for(let a=0,r=0;;){let d=a==e.length?1e9:e[a++];for(;r<d||r==d&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,d-r);ke(l,h,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;ke(t,h,f),f>0&&nt(i,t,s.text),s.forward(h),r+=h}let c=e[a++];for(;r<c;){if(s.done)break e;let h=Math.min(s.len,c-r);ke(t,h,-1),ke(l,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),r+=h}}return{changes:new ue(t,i),filtered:Qe.create(l)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],l=this.sections[t+1];l<0?e.push(i):l==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let l=[],s=[],a=0,r=null;function d(h=!1){if(!h&&!l.length)return;a<t&&ke(l,t-a,-1);let f=new ue(l,s);r=r?r.compose(f.map(r)):f,l=[],s=[],a=0}function c(h){if(Array.isArray(h))for(let f of h)c(f);else if(h instanceof ue){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);d(),r=r?r.compose(h.map(r)):h}else{let{from:f,to:p=f,insert:u}=h;if(f>p||f<0||p>t)throw new RangeError(`Invalid change range ${f} to ${p} (in doc of length ${t})`);let y=u?typeof u=="string"?X.of(u.split(i||pn)):u:X.empty,k=y.length;if(f==p&&k==0)return;f<a&&d(),f>a&&ke(l,f-a,-1),ke(l,p-f,k),nt(s,l,y),a=p}}return c(e),d(!r),r}static empty(e){return new ue(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;l<e.length;l++){let s=e[l];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,r)=>r&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<l;)i.push(X.empty);i[l]=X.of(s.slice(1)),t.push(s[0],i[l].length)}}}return new ue(t,i)}static createSet(e,t){return new ue(e,t)}}function ke(o,e,t,i=!1){if(e==0&&t<=0)return;let l=o.length-2;l>=0&&t<=0&&t==o[l+1]?o[l]+=e:e==0&&o[l]==0?o[l+1]+=t:i?(o[l]+=e,o[l+1]+=t):o.push(e,t)}function nt(o,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<o.length)o[o.length-1]=o[o.length-1].append(t);else{for(;o.length<i;)o.push(X.empty);o.push(t)}}function mn(o,e,t){let i=o.inserted;for(let l=0,s=0,a=0;a<o.sections.length;){let r=o.sections[a++],d=o.sections[a++];if(d<0)l+=r,s+=r;else{let c=l,h=s,f=X.empty;for(;c+=r,h+=d,d&&i&&(f=f.append(i[a-2>>1])),!(t||a==o.sections.length||o.sections[a+1]<0);)r=o.sections[a++],d=o.sections[a++];e(l,c,s,h,f),l=c,s=h}}}function gn(o,e,t,i=!1){let l=[],s=i?[]:null,a=new Wt(o),r=new Wt(e);for(let d=-1;;)if(a.ins==-1&&r.ins==-1){let c=Math.min(a.len,r.len);ke(l,c,-1),a.forward(c),r.forward(c)}else if(r.ins>=0&&(a.ins<0||d==a.i||a.off==0&&(r.len<a.len||r.len==a.len&&!t))){let c=r.len;for(ke(l,r.ins,-1);c;){let h=Math.min(a.len,c);a.ins>=0&&d<a.i&&a.len<=h&&(ke(l,0,a.ins),s&&nt(s,l,a.text),d=a.i),a.forward(h),c-=h}r.next()}else if(a.ins>=0){let c=0,h=a.len;for(;h;)if(r.ins==-1){let f=Math.min(h,r.len);c+=f,h-=f,r.forward(f)}else if(r.ins==0&&r.len<h)h-=r.len,r.next();else break;ke(l,c,d<a.i?a.ins:0),s&&d<a.i&&nt(s,l,a.text),d=a.i,a.forward(a.len-h)}else{if(a.done&&r.done)return s?ue.createSet(l,s):Qe.create(l);throw new Error("Mismatched change set lengths")}}function es(o,e,t=!1){let i=[],l=t?[]:null,s=new Wt(o),a=new Wt(e);for(let r=!1;;){if(s.done&&a.done)return l?ue.createSet(i,l):Qe.create(i);if(s.ins==0)ke(i,s.len,0,r),s.next();else if(a.len==0&&!a.done)ke(i,0,a.ins,r),l&&nt(l,i,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let d=Math.min(s.len2,a.len),c=i.length;if(s.ins==-1){let h=a.ins==-1?-1:a.off?0:a.ins;ke(i,d,h,r),l&&h&&nt(l,i,a.text)}else a.ins==-1?(ke(i,s.off?0:s.len,d,r),l&&nt(l,i,s.textBit(d))):(ke(i,s.off?0:s.len,a.off?0:a.ins,r),l&&!a.off&&nt(l,i,a.text));r=(s.ins>d||a.ins>=0&&a.len>d)&&(r||i.length>c),s.forward2(d),a.forward(d)}}}}class Wt{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?X.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?X.empty:t[i].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 ut{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}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 i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new ut(i,l,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,i)}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,i){return new ut(e,t,i)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],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 i=this.ranges.slice();return i[t]=e,H.create(i,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=>ut.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 i=0,l=0;l<e.length;l++){let s=e[l];if(s.empty?s.from<=i:s.from<i)return H.normalized(e.slice(),t);i=s.to}return new H(e,t)}static cursor(e,t=0,i,l){return ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(l??16777215)<<6)}static range(e,t,i,l){let s=(i??16777215)<<6|(l==null?7:Math.min(6,l));return t<e?ut.create(t,e,48|s):ut.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((l,s)=>l.from-s.from),t=e.indexOf(i);for(let l=1;l<e.length;l++){let s=e[l],a=e[l-1];if(s.empty?s.from<=a.to:s.from<a.to){let r=a.from,d=Math.max(s.to,a.to);l<=t&&t--,e.splice(--l,2,s.anchor>s.head?H.range(d,r):H.range(r,d))}}return new H(e,t)}}function ts(o,e){for(let t of o.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let kn=0;class Q{constructor(e,t,i,l,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=kn++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Q(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:bn),!!e.static,e.enables)}of(e){return new Ci([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ci(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function bn(o,e){return o==e||o.length==e.length&&o.every((t,i)=>t===e[i])}class Ci{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=kn++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,s=this.id,a=e[s]>>1,r=this.type==2,d=!1,c=!1,h=[];for(let f of this.dependencies)f=="doc"?d=!0:f=="selection"?c=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||h.push(e[f.id]);return{create(f){return f.values[a]=i(f),1},update(f,p){if(d&&p.docChanged||c&&(p.docChanged||p.selection)||yn(f,h)){let u=i(f);if(r?!is(u,f.values[a],l):!l(u,f.values[a]))return f.values[a]=u,1}return 0},reconfigure:(f,p)=>{let u,y=p.config.address[s];if(y!=null){let k=Bi(p,y);if(this.dependencies.every(x=>x instanceof Q?p.facet(x)===f.facet(x):x instanceof pt?p.field(x,!1)==f.field(x,!1):!0)||(r?is(u=i(f),k,l):l(u=i(f),k)))return f.values[a]=k,0}else u=i(f);return f.values[a]=u,1}}}}function is(o,e,t){if(o.length!=e.length)return!1;for(let i=0;i<o.length;i++)if(!t(o[i],e[i]))return!1;return!0}function yn(o,e){let t=!1;for(let i of e)Kt(o,i)&1&&(t=!0);return t}function Rd(o,e,t){let i=t.map(d=>o[d.id]),l=t.map(d=>d.type),s=i.filter(d=>!(d&1)),a=o[e.id]>>1;function r(d){let c=[];for(let h=0;h<i.length;h++){let f=Bi(d,i[h]);if(l[h]==2)for(let p of f)c.push(p);else c.push(f)}return e.combine(c)}return{create(d){for(let c of i)Kt(d,c);return d.values[a]=r(d),1},update(d,c){if(!yn(d,s))return 0;let h=r(d);return e.compare(h,d.values[a])?0:(d.values[a]=h,1)},reconfigure(d,c){let h=yn(d,i),f=c.config.facets[e.id],p=c.facet(e);if(f&&!h&&bn(t,f))return d.values[a]=p,0;let u=r(d);return e.compare(u,p)?(d.values[a]=p,0):(d.values[a]=u,1)}}}const ns=Q.define({static:!0});class pt{constructor(e,t,i,l,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=l,this.spec=s,this.provides=void 0}static define(e){let t=new pt(kn++,e.create,e.update,e.compare||((i,l)=>i===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ns).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let s=i.values[t],a=this.updateF(s,l);return this.compareF(s,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,ns.of({field:this,create:e})]}get extension(){return this}}const mt={lowest:4,low:3,default:2,high:1,highest:0};function Ht(o){return e=>new ls(e,o)}const Ld={highest:Ht(mt.highest),high:Ht(mt.high),default:Ht(mt.default),low:Ht(mt.low),lowest:Ht(mt.lowest)};class ls{constructor(e,t){this.inner=e,this.prec=t}}class Si{of(e){return new wn(this,e)}reconfigure(e){return Si.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class wn{constructor(e,t){this.compartment=e,this.inner=t}}class Ni{constructor(e,t,i,l,s,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<i.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,i){let l=[],s=Object.create(null),a=new Map;for(let p of jd(e,t,a))p instanceof pt?l.push(p):(s[p.facet.id]||(s[p.facet.id]=[])).push(p);let r=Object.create(null),d=[],c=[];for(let p of l)r[p.id]=c.length<<1,c.push(u=>p.slot(u));let h=i?.config.facets;for(let p in s){let u=s[p],y=u[0].facet,k=h&&h[p]||[];if(u.every(x=>x.type==0))if(r[y.id]=d.length<<1|1,bn(k,u))d.push(i.facet(y));else{let x=y.combine(u.map(w=>w.value));d.push(i&&y.compare(x,i.facet(y))?i.facet(y):x)}else{for(let x of u)x.type==0?(r[x.id]=d.length<<1|1,d.push(x.value)):(r[x.id]=c.length<<1,c.push(w=>x.dynamicSlot(w)));r[y.id]=c.length<<1,c.push(x=>Rd(x,y,u))}}let f=c.map(p=>p(r));return new Ni(e,a,f,r,d,s)}}function jd(o,e,t){let i=[[],[],[],[],[]],l=new Map;function s(a,r){let d=l.get(a);if(d!=null){if(d<=r)return;let c=i[d].indexOf(a);c>-1&&i[d].splice(c,1),a instanceof wn&&t.delete(a.compartment)}if(l.set(a,r),Array.isArray(a))for(let c of a)s(c,r);else if(a instanceof wn){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(a.compartment)||a.inner;t.set(a.compartment,c),s(c,r)}else if(a instanceof ls)s(a.inner,a.prec);else if(a instanceof pt)i[r].push(a),a.provides&&s(a.provides,r);else if(a instanceof Ci)i[r].push(a),a.facet.extensions&&s(a.facet.extensions,mt.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,r)}}return s(o,mt.default),i.reduce((a,r)=>a.concat(r))}function Kt(o,e){if(e&1)return 2;let t=e>>1,i=o.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;o.status[t]=4;let l=o.computeSlot(o,o.config.dynamicSlots[t]);return o.status[t]=2|l}function Bi(o,e){return e&1?o.config.staticValues[e>>1]:o.values[e>>1]}const ss=Q.define(),xn=Q.define({combine:o=>o.some(e=>e),static:!0}),os=Q.define({combine:o=>o.length?o[0]:void 0,static:!0}),as=Q.define(),rs=Q.define(),ds=Q.define(),cs=Q.define({combine:o=>o.length?o[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new zd}}class zd{of(e){return new St(this,e)}}class qd{constructor(e){this.map=e}of(e){return new ce(this,e)}}class ce{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 ce(this.type,t)}is(e){return this.type==e}static define(e={}){return new qd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let s=l.map(t);s&&i.push(s)}return i}}ce.reconfigure=ce.define(),ce.appendConfig=ce.define();class be{constructor(e,t,i,l,s,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,i&&ts(i,t.newLength),s.some(r=>r.type==be.time)||(this.annotations=s.concat(be.time.of(Date.now())))}static create(e,t,i,l,s,a){return new be(e,t,i,l,s,a)}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(be.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}be.time=St.define(),be.userEvent=St.define(),be.addToHistory=St.define(),be.remote=St.define();function Ud(o,e){let t=[];for(let i=0,l=0;;){let s,a;if(i<o.length&&(l==e.length||e[l]>=o[i]))s=o[i++],a=o[i++];else if(l<e.length)s=e[l++],a=e[l++];else return t;!t.length||t[t.length-1]<s?t.push(s,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function hs(o,e,t){var i;let l,s,a;return t?(l=e.changes,s=ue.empty(e.changes.length),a=o.changes.compose(e.changes)):(l=e.changes.map(o.changes),s=o.changes.mapDesc(e.changes,!0),a=o.changes.compose(l)),{changes:a,selection:e.selection?e.selection.map(s):(i=o.selection)===null||i===void 0?void 0:i.map(l),effects:ce.mapEffects(o.effects,l).concat(ce.mapEffects(e.effects,s)),annotations:o.annotations.length?o.annotations.concat(e.annotations):e.annotations,scrollIntoView:o.scrollIntoView||e.scrollIntoView}}function vn(o,e,t){let i=e.selection,l=Nt(e.annotations);return e.userEvent&&(l=l.concat(be.userEvent.of(e.userEvent))),{changes:e.changes instanceof ue?e.changes:ue.of(e.changes||[],t,o.facet(os)),selection:i&&(i instanceof H?i:H.single(i.anchor,i.head)),effects:Nt(e.effects),annotations:l,scrollIntoView:!!e.scrollIntoView}}function fs(o,e,t){let i=vn(o,e.length?e[0]:{},o.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let a=!!e[s].sequential;i=hs(i,vn(o,e[s],a?i.changes.newLength:o.doc.length),a)}let l=be.create(o,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Hd(t?Wd(l):l)}function Wd(o){let e=o.startState,t=!0;for(let l of e.facet(as)){let s=l(o);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Ud(t,s))}if(t!==!0){let l,s;if(t===!1)s=o.changes.invertedDesc,l=ue.empty(e.doc.length);else{let a=o.changes.filter(t);l=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}o=be.create(e,l,o.selection&&o.selection.map(s),ce.mapEffects(o.effects,s),o.annotations,o.scrollIntoView)}let i=e.facet(rs);for(let l=i.length-1;l>=0;l--){let s=i[l](o);s instanceof be?o=s:Array.isArray(s)&&s.length==1&&s[0]instanceof be?o=s[0]:o=fs(e,Nt(s),!1)}return o}function Hd(o){let e=o.startState,t=e.facet(ds),i=o;for(let l=t.length-1;l>=0;l--){let s=t[l](o);s&&Object.keys(s).length&&(i=hs(i,vn(e,s,o.changes.newLength),!0))}return i==o?o:be.create(e,o.changes,o.selection,i.effects,i.annotations,i.scrollIntoView)}const Kd=[];function Nt(o){return o==null?Kd:Array.isArray(o)?o:[o]}var Ge=function(o){return o[o.Word=0]="Word",o[o.Space=1]="Space",o[o.Other=2]="Other",o}(Ge||(Ge={}));const Qd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cn;try{Cn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Gd(o){if(Cn)return Cn.test(o);for(let e=0;e<o.length;e++){let t=o[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Qd.test(t)))return!0}return!1}function Yd(o){return e=>{if(!/\S/.test(e))return Ge.Space;if(Gd(e))return Ge.Word;for(let t=0;t<o.length;t++)if(e.indexOf(o[t])>-1)return Ge.Word;return Ge.Other}}class te{constructor(e,t,i,l,s,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let r=0;r<this.config.dynamicSlots.length;r++)Kt(this,r<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Kt(this,i),Bi(this,i)}update(...e){return fs(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:l}=t;for(let r of e.effects)r.is(Si.reconfigure)?(t&&(l=new Map,t.compartments.forEach((d,c)=>l.set(c,d)),t=null),l.set(r.value.compartment,r.value.extension)):r.is(ce.reconfigure)?(t=null,i=r.value):r.is(ce.appendConfig)&&(t=null,i=Nt(i).concat(r.value));let s;t?s=e.startState.values.slice():(t=Ni.resolve(i,l,this),s=new te(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(d,c)=>c.reconfigure(d,this),null).values);let a=e.startState.facet(xn)?e.newSelection:e.newSelection.asSingle();new te(t,e.newDoc,a,s,(r,d)=>d.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,i=e(t.ranges[0]),l=this.changes(i.changes),s=[i.range],a=Nt(i.effects);for(let r=1;r<t.ranges.length;r++){let d=e(t.ranges[r]),c=this.changes(d.changes),h=c.map(l);for(let p=0;p<r;p++)s[p]=s[p].map(h);let f=l.mapDesc(c,!0);s.push(d.range.map(f)),l=l.compose(h),a=ce.mapEffects(a,h).concat(ce.mapEffects(Nt(d.effects),f))}return{changes:l,selection:H.create(s,t.mainIndex),effects:a}}changes(e=[]){return e instanceof ue?e:ue.of(e,this.doc.length,this.facet(te.lineSeparator))}toText(e){return X.of(e.split(this.facet(te.lineSeparator)||pn))}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:(Kt(this,t),Bi(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let l=e[i];l instanceof pt&&this.config.address[l.id]!=null&&(t[i]=l.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let l=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let a=i[s],r=e[s];l.push(a.init(d=>a.spec.fromJSON(r,d)))}}return te.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=Ni.resolve(e.extensions||[],new Map),i=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(te.lineSeparator)||pn)),l=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return ts(l,i.length),t.staticFacet(xn)||(l=l.asSingle()),new te(t,i,l,t.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(te.tabSize)}get lineBreak(){return this.facet(te.lineSeparator)||`
5
+ `}get readOnly(){return this.facet(cs)}phrase(e,...t){for(let i of this.facet(te.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let s=+(l||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let s of this.facet(ss))for(let a of s(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){return Yd(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),s=this.charCategorizer(e),a=e-i,r=e-i;for(;a>0;){let d=Ke(t,a,!1);if(s(t.slice(d,a))!=Ge.Word)break;a=d}for(;r<l;){let d=Ke(t,r);if(s(t.slice(r,d))!=Ge.Word)break;r=d}return a==r?null:H.range(a+i,r+i)}}te.allowMultipleSelections=xn,te.tabSize=Q.define({combine:o=>o.length?o[0]:4}),te.lineSeparator=os,te.readOnly=cs,te.phrases=Q.define({compare(o,e){let t=Object.keys(o),i=Object.keys(e);return t.length==i.length&&t.every(l=>o[l]==e[l])}}),te.languageData=ss,te.changeFilter=as,te.transactionFilter=rs,te.transactionExtender=ds,Si.reconfigure=ce.define();class Bt{eq(e){return this==e}range(e,t=e){return Qt.create(e,t,this)}}Bt.prototype.startSide=Bt.prototype.endSide=0,Bt.prototype.point=!1,Bt.prototype.mapMode=Be.TrackDel;class Qt{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Qt(e,t,i)}}function Sn(o,e){return o.from-e.from||o.value.startSide-e.value.startSide}class Nn{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,l=0){let s=i?this.to:this.from;for(let a=l,r=s.length;;){if(a==r)return a;let d=a+r>>1,c=s[d]-e||(i?this.value[d].endSide:this.value[d].startSide)-t;if(d==a)return c>=0?a:r;c>=0?r=d:a=d+1}}between(e,t,i,l){for(let s=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,s);s<a;s++)if(l(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let i=[],l=[],s=[],a=-1,r=-1;for(let d=0;d<this.value.length;d++){let c=this.value[d],h=this.from[d]+e,f=this.to[d]+e,p,u;if(h==f){let y=t.mapPos(h,c.startSide,c.mapMode);if(y==null||(p=u=y,c.startSide!=c.endSide&&(u=t.mapPos(h,c.endSide),u<p)))continue}else if(p=t.mapPos(h,c.startSide),u=t.mapPos(f,c.endSide),p>u||p==u&&c.startSide>0&&c.endSide<=0)continue;(u-p||c.endSide-c.startSide)<0||(a<0&&(a=p),c.point&&(r=Math.max(r,u-p)),i.push(c),l.push(p-a),s.push(u-a))}return{mapped:i.length?new Nn(l,s,i,r):null,pos:a}}}class se{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new se(e,t,i,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:i=!1,filterFrom:l=0,filterTo:s=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Sn)),this.isEmpty)return t.length?se.of(t):this;let r=new ps(this,null,-1).goto(0),d=0,c=[],h=new Oi;for(;r.value||d<t.length;)if(d<t.length&&(r.from-t[d].from||r.startSide-t[d].value.startSide)>=0){let f=t[d++];h.addInner(f.from,f.to,f.value)||c.push(f)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(d==t.length||this.chunkEnd(r.chunkIndex)<t[d].from)&&(!a||l>this.chunkEnd(r.chunkIndex)||s<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!a||l>r.to||s<r.from||a(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||c.push(Qt.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?se.empty:this.nextLayer.update({add:c,filter:a,filterFrom:l,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],l=-1;for(let a=0;a<this.chunk.length;a++){let r=this.chunkPos[a],d=this.chunk[a],c=e.touchesRange(r,r+d.length);if(c===!1)l=Math.max(l,d.maxPoint),t.push(d),i.push(e.mapPos(r));else if(c===!0){let{mapped:h,pos:f}=d.map(r,e);h&&(l=Math.max(l,h.maxPoint),t.push(h),i.push(f))}}let s=this.nextLayer.map(e);return t.length==0?s:new se(i,t,s||se.empty,l)}between(e,t,i){if(!this.isEmpty){for(let l=0;l<this.chunk.length;l++){let s=this.chunkPos[l],a=this.chunk[l];if(t>=s&&e<=s+a.length&&a.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Gt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Gt.from(e).goto(t)}static compare(e,t,i,l,s=-1){let a=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),r=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),d=us(a,r,i),c=new Yt(a,d,s),h=new Yt(r,d,s);i.iterGaps((f,p,u)=>ms(c,f,h,p,u,l)),i.empty&&i.length==0&&ms(c,0,h,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let s=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),a=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let r=us(s,a),d=new Yt(s,r,0).goto(i),c=new Yt(a,r,0).goto(i);for(;;){if(d.to!=c.to||!On(d.active,c.active)||d.point&&(!c.point||!d.point.eq(c.point)))return!1;if(d.to>l)return!0;d.next(),c.next()}}static spans(e,t,i,l,s=-1){let a=new Yt(e,null,s).goto(t),r=t,d=a.openStart;for(;;){let c=Math.min(a.to,i);if(a.point){let h=a.activeForPoint(a.to),f=a.pointFrom<t?h.length+1:a.point.startSide<0?h.length:Math.min(h.length,d);l.point(r,c,a.point,h,f,a.pointRank),d=Math.min(a.openEnd(c),h.length)}else c>r&&(l.span(r,c,a.active,d),d=a.openEnd(c));if(a.to>i)return d+(a.point&&a.to>i?1:0);r=a.to,a.next()}}static of(e,t=!1){let i=new Oi;for(let l of e instanceof Qt?[e]:t?Xd(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return se.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=se.empty;l=l.nextLayer)t=new se(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}se.empty=new se([],[],null,-1);function Xd(o){if(o.length>1)for(let e=o[0],t=1;t<o.length;t++){let i=o[t];if(Sn(e,i)>0)return o.slice().sort(Sn);e=i}return o}se.empty.nextLayer=se.empty;class Oi{finishChunk(e){this.chunks.push(new Nn(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,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Oi)).add(e,t,i)}addInner(e,t,i){let l=e-this.lastTo||i.startSide-this.last.endSide;if(l<=0&&(e-this.lastFrom||i.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=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(se.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=se.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function us(o,e,t){let i=new Map;for(let s of o)for(let a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&i.set(s.chunk[a],s.chunkPos[a]);let l=new Set;for(let s of e)for(let a=0;a<s.chunk.length;a++){let r=i.get(s.chunk[a]);r!=null&&(t?t.mapPos(r):r)==s.chunkPos[a]&&!t?.touchesRange(r,r+s.chunk[a].length)&&l.add(s.chunk[a])}return l}class ps{constructor(e,t,i,l=0){this.layer=e,this.skip=t,this.minPoint=i,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,i){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++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let l=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||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],i=e+t.from[this.rangeIndex];if(this.from=i,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 Gt{constructor(e){this.heap=e}static from(e,t=null,i=-1){let l=[];for(let s=0;s<e.length;s++)for(let a=e[s];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&l.push(new ps(a,t,i,s));return l.length==1?l[0]:new Gt(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Bn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Bn(this.heap,i);(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(),Bn(this.heap,0)}}}function Bn(o,e){for(let t=o[e];;){let i=(e<<1)+1;if(i>=o.length)break;let l=o[i];if(i+1<o.length&&l.compare(o[i+1])>=0&&(l=o[i+1],i++),t.compare(l)<0)break;o[i]=t,o[e]=l,e=i}}class Yt{constructor(e,t,i){this.minPoint=i,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=Gt.from(e,t,i)}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){Vi(this.active,e),Vi(this.activeTo,e),Vi(this.activeRank,e),this.minActive=gs(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||l-this.activeTo[t])>0;)t++;_i(this.active,t,i),_i(this.activeTo,t,l),_i(this.activeRank,t,s),e&&_i(e,t,this.cursor.from),this.minActive=gs(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=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),i&&Vi(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let l=i.length-1;l>=0&&i[l]<e;l--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function ms(o,e,t,i,l,s){o.goto(e),t.goto(i);let a=i+l,r=i,d=i-e;for(;;){let c=o.to+d-t.to||o.endSide-t.endSide,h=c<0?o.to+d:t.to,f=Math.min(h,a);if(o.point||t.point?o.point&&t.point&&(o.point==t.point||o.point.eq(t.point))&&On(o.activeForPoint(o.to),t.activeForPoint(t.to))||s.comparePoint(r,f,o.point,t.point):f>r&&!On(o.active,t.active)&&s.compareRange(r,f,o.active,t.active),h>a)break;r=h,c<=0&&o.next(),c>=0&&t.next()}}function On(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++)if(o[t]!=e[t]&&!o[t].eq(e[t]))return!1;return!0}function Vi(o,e){for(let t=e,i=o.length-1;t<i;t++)o[t]=o[t+1];o.pop()}function _i(o,e,t){for(let i=o.length-1;i>=e;i--)o[i+1]=o[i];o[e]=t}function gs(o,e){let t=-1,i=1e9;for(let l=0;l<e.length;l++)(e[l]-i||o[l].endSide-o[t].endSide)<0&&(t=l,i=e[l]);return t}function Jd(o,e,t,i){for(let l=0,s=0;;){if(s>=e)return l;if(l==o.length)break;s+=o.charCodeAt(l)==9?t-s%t:1,l=Ke(o,l)}return i===!0?-1:o.length}const Vn="ͼ",ks=typeof Symbol>"u"?"__"+Vn:Symbol.for(Vn),_n=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class lt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,r,d,c){let h=[],f=/^@(\w+)\b/.exec(a[0]),p=f&&f[1]=="keyframes";if(f&&r==null)return d.push(a[0]+";");for(let u in r){let y=r[u];if(/&/.test(u))s(u.split(/,\s*/).map(k=>a.map(x=>k.replace(/&/,x))).reduce((k,x)=>k.concat(x)),y,d);else if(y&&typeof y=="object"){if(!f)throw new RangeError("The value of a property ("+u+") should be a primitive value.");s(l(u),y,h,p)}else y!=null&&h.push(u.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+y+";")}(h.length||p)&&d.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+h.join(" ")+"}")}for(let a in e)s(l(a),e[a],this.rules)}getRules(){return this.rules.join(`
6
6
  `)}static newName(){let e=bs[ks]||1;return bs[ks]=e+1,Vn+e.toString(36)}static mount(e,t,i){let l=e[_n],s=i&&i.nonce;l?s&&l.setNonce(s):l=new Zd(e,s),l.mount(Array.isArray(t)?t:[t],e)}}let ys=new Map;class Zd{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let s=ys.get(i);if(s)return e[_n]=s;this.sheet=new l.CSSStyleSheet,ys.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[_n]=this}mount(e,t){let i=this.sheet,l=0,s=0;for(let a=0;a<e.length;a++){let r=e[a],d=this.modules.indexOf(r);if(d<s&&d>-1&&(this.modules.splice(d,1),s--,d=-1),d==-1){if(this.modules.splice(s++,0,r),i)for(let c=0;c<r.rules.length;c++)i.insertRule(r.rules[c],l++)}else{for(;s<d;)l+=this.modules[s++].rules.length;l+=r.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let a="";for(let d=0;d<this.modules.length;d++)a+=this.modules[d].getRules()+`
7
- `;this.styleTag.textContent=a;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 Ot={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:"'"},Mn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Ot[48+pe]=Ot[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Ot[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Ot[pe]=String.fromCharCode(pe+32),Mn[pe]=String.fromCharCode(pe);for(var Tn in Ot)Mn.hasOwnProperty(Tn)||(Mn[Tn]=Ot[Tn]);function Xt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function An(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function ec(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Mi(o,e){if(!e.anchorNode)return!1;try{return An(o,e.anchorNode)}catch{return!1}}function Jt(o){return o.nodeType==3?kt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function Zt(o,e,t,i){return t?ws(o,e,t,i,-1)||ws(o,e,t,i,1):!1}function gt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ti(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function ws(o,e,t,i,l){for(;;){if(o==t&&e==i)return!0;if(e==(l<0?0:Ye(o))){if(o.nodeName=="DIV")return!1;let s=o.parentNode;if(!s||s.nodeType!=1)return!1;e=gt(o)+(l<0?0:1),o=s}else if(o.nodeType==1){if(o=o.childNodes[e+(l<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=l<0?Ye(o):0}else return!1}}function Ye(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Ai(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function tc(o){let e=o.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function xs(o,e){let t=e.width/o.offsetWidth,i=e.height/o.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-o.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-o.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ic(o,e,t,i,l,s,a,r){let d=o.ownerDocument,c=d.defaultView||window;for(let h=o,f=!1;h&&!f;)if(h.nodeType==1){let u,m=h==d.body,y=1,k=1;if(m)u=tc(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let v=h.getBoundingClientRect();({scaleX:y,scaleY:k}=xs(h,v)),u={left:v.left,right:v.left+h.clientWidth*y,top:v.top,bottom:v.top+h.clientHeight*k}}let x=0,w=0;if(l=="nearest")e.top<u.top?(w=-(u.top-e.top+a),t>0&&e.bottom>u.bottom+w&&(w=e.bottom-u.bottom+w+a)):e.bottom>u.bottom&&(w=e.bottom-u.bottom+a,t<0&&e.top-w<u.top&&(w=-(u.top+w-e.top+a)));else{let v=e.bottom-e.top,O=u.bottom-u.top;w=(l=="center"&&v<=O?e.top+v/2-O/2:l=="start"||l=="center"&&t<0?e.top-a:e.bottom-O+a)-u.top}if(i=="nearest"?e.left<u.left?(x=-(u.left-e.left+s),t>0&&e.right>u.right+x&&(x=e.right-u.right+x+s)):e.right>u.right&&(x=e.right-u.right+s,t<0&&e.left<u.left+x&&(x=-(u.left+x-e.left+s))):x=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==r?e.left-s:e.right-(u.right-u.left)+s)-u.left,x||w)if(m)c.scrollBy(x,w);else{let v=0,O=0;if(w){let g=h.scrollTop;h.scrollTop+=w/k,O=(h.scrollTop-g)*k}if(x){let g=h.scrollLeft;h.scrollLeft+=x/y,v=(h.scrollLeft-g)*y}e={left:e.left-v,top:e.top-O,right:e.right-v,bottom:e.bottom-O},v&&Math.abs(v-x)<1&&(i="nearest"),O&&Math.abs(O-w)<1&&(l="nearest")}if(m)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function nc(o){let e=o.ownerDocument,t,i;for(let l=o.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=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:i}}class lc{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:i}=e;this.set(t,Math.min(e.anchorOffset,t?Ye(t):0),i,Math.min(e.focusOffset,i?Ye(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let Vt=null;function vs(o){if(o.setActive)return o.setActive();if(Vt)return o.focus(Vt);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(Vt==null?{get preventScroll(){return Vt={preventScroll:!0},!0}}:void 0),!Vt){Vt=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Cs;function kt(o,e,t=e){let i=Cs||(Cs=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function _t(o,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,o.dispatchEvent(s);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,o.dispatchEvent(a),s.defaultPrevented||a.defaultPrevented}function sc(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function Ss(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function oc(o,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ye(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Ye(t))}else{if(t==o)return!0;i=gt(t),t=t.parentNode}}function Ns(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Bs(o,e){for(let t=o,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Ye(t)}else if(t.parentNode&&!Ti(t))i=gt(t),t=t.parentNode;else return null}}function Os(o,e){for(let t=o,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!Ti(t))i=gt(t)+1,t=t.parentNode;else return null}}class ye{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ye(e.parentNode,gt(e),t)}static after(e,t){return new ye(e.parentNode,gt(e)+1,t)}}const En=[];class ne{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 i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let a of this.children){if(a.flags&7){if(!a.dom&&(s=l?l.nextSibling:i.firstChild)){let r=ne.get(s);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(s)}a.sync(e,t),a.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=Vs(s);else i.insertBefore(a.dom,s);l=a.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=Vs(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Ye(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ne.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let a=this.children[l];if(a.dom==i)return s;s+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,a=-1,r=-1;for(let d=0,c=i,h=i;d<this.children.length;d++){let f=this.children[d],u=c+f.length;if(c<e&&u>t)return f.domBoundsAround(e,t,c);if(u>=e&&l==-1&&(l=d,s=c),c>t&&f.dom.parentNode==this.dom){a=d,r=h;break}h=u,c=u+f.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&a>=0?this.children[a].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,i=En){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new _s(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,i,l,s,a){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}}ne.prototype.breakAfter=0;function Vs(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class _s{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,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 i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ms(o,e,t,i,l,s,a,r,d){let{children:c}=o,h=c.length?c[e]:null,f=s.length?s[s.length-1]:null,u=f?f.breakAfter:a;if(!(e==i&&h&&!a&&!u&&s.length<2&&h.merge(t,l,s.length?f:null,t==0,r,d))){if(i<c.length){let m=c[i];m&&(l<m.length||m.breakAfter&&f?.breakAfter)?(e==i&&(m=m.split(l),l=0),!u&&f&&m.merge(0,l,f,!0,0,d)?s[s.length-1]=m:((l||m.children.length&&!m.children[0].length)&&m.merge(0,l,null,!1,0,d),s.push(m))):m?.breakAfter&&(f?f.breakAfter=1:a=1),i++}for(h&&(h.breakAfter=a,t>0&&(!a&&s.length&&h.merge(t,h.length,s[0],!1,r,0)?h.breakAfter=s.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,r,0),e++));e<i&&s.length;)if(c[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(c[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<c.length&&!c[e-1].breakAfter&&c[i].merge(0,0,c[e-1],!1,r,d)&&e--,(e<i||s.length)&&o.replaceChildren(e,i,s)}}function Ts(o,e,t,i,l,s){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:c,off:h}=a.findPos(e,-1),f=e-t;for(let u of i)f+=u.length;o.length+=f,Ms(o,c,h,r,d,i,0,l,s)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},In=typeof document<"u"?document:{documentElement:{style:{}}};const Dn=/Edge\/(\d+)/.exec(Se.userAgent),As=/MSIE \d/.test(Se.userAgent),Pn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ei=!!(As||Pn||Dn),Es=!Ei&&/gecko\/(\d+)/i.test(Se.userAgent),Fn=!Ei&&/Chrome\/(\d+)/.exec(Se.userAgent),Is="webkitFontSmoothing"in In.documentElement.style,Ds=!Ei&&/Apple Computer/.test(Se.vendor),Ps=Ds&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var q={mac:Ps||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ei,ie_version:As?In.documentMode||6:Pn?+Pn[1]:Dn?+Dn[1]:0,gecko:Es,gecko_version:Es?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!Fn,chrome_version:Fn?+Fn[1]:0,ios:Ps,android:/Android\b/.test(Se.userAgent),webkit:Is,safari:Ds,webkit_version:Is?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:In.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const ac=256;class Ee extends ne{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,i){return this.flags&8||i&&(!(i instanceof Ee)||this.length-(t-e)+i.length>ac||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ee(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 ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return rc(this.dom,e,t)}}class Xe extends ne{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ss(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,i,l,s,a){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&a<=0)?!1:(Ts(this,e,t,i?i.children.slice():[],s-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let a=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Xe(this.mark,t,a)}domAtPos(e){return Fs(this,e)}coordsAt(e,t){return Rs(this,e,t)}}function rc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let l=e,s=e,a=0;e==0&&t<0||e==i&&t>=0?q.chrome||q.gecko||(e?(l--,a=1):s<i&&(s++,a=-1)):t<0?l--:s<i&&s++;let r=kt(o,l,s).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return q.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,c=>c.width)||d),a?Ai(d,a<0):d||null}class bt extends ne{static create(e,t,i){return new bt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=bt.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,i,l,s,a){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof bt&&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 X.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let l=this.dom.getClientRects(),s=null;if(!l.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=a?-1:1);return Ai(s,!a)}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 Mt extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Mt&&e.side==this.side}split(){return new Mt(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?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}}Ee.prototype.children=bt.prototype.children=Mt.prototype.children=En;function Fs(o,e){let t=o.dom,{children:i}=o,l=0;for(let s=0;l<i.length;l++){let a=i[l],r=s+a.length;if(!(r==s&&a.getSide()<=0)){if(e>s&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let a=i[s-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let s=l;s<i.length;s++){let a=i[s];if(a.dom.parentNode==t)return a.domAtPos(0)}return new ye(t,0)}function $s(o,e,t){let i,{children:l}=o;t>0&&e instanceof Xe&&l.length&&(i=l[l.length-1])instanceof Xe&&i.mark.eq(e.mark)?$s(i,e.children[0],t-1):(l.push(e),e.setParent(o)),o.length+=e.length}function Rs(o,e,t){let i=null,l=-1,s=null,a=-1;function r(c,h){for(let f=0,u=0;f<c.children.length&&u<=h;f++){let m=c.children[f],y=u+m.length;y>=h&&(m.children.length?r(m,h-u):(!s||s.isHidden&&t>0)&&(y>h||u==y&&m.getSide()>0)?(s=m,a=h-u):(u<h||u==y&&m.getSide()<0&&!m.isHidden)&&(i=m,l=h-u)),u=y}}r(o,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:a),t):dc(o)}function dc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Jt(e);return t[t.length-1]||null}function $n(o,e){for(let t in o)t=="class"&&e.class?e.class+=" "+o.class:t=="style"&&e.style?e.style+=";"+o.style:e[t]=o[t];return e}const Ls=Object.create(null);function Ii(o,e,t){if(o==e)return!0;o||(o=Ls),e||(e=Ls);let i=Object.keys(o),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||o[s]!==e[s]))return!1;return!0}function Rn(o,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?o.style.cssText="":o.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?o.style.cssText=t[l]:o.setAttribute(l,t[l]));return i}function cc(o){let e=Object.create(null);for(let t=0;t<o.attributes.length;t++){let i=o.attributes[t];e[i.name]=i.value}return e}class Ln{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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Le=function(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(Le||(Le={}));class we extends Bt{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ei(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new st(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:a}=js(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new st(e,i,l,t,e.widget||null,!0)}static line(e){return new ti(e)}static set(e,t=!1){return se.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=se.empty;class ei extends we{constructor(e){let{start:t,end:i}=js(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ei&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Ii(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)}}ei.prototype.point=!1;class ti extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ti&&this.spec.class==e.spec.class&&Ii(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)}}ti.prototype.mapMode=Be.TrackBefore,ti.prototype.point=!0;class st extends we{constructor(e,t,i,l,s,a){super(t,i,s,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Be.TrackBefore:Be.TrackAfter:Be.TrackDel}get type(){return this.startSide!=this.endSide?Le.WidgetRange:this.startSide<=0?Le.WidgetBefore:Le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof st&&hc(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)}}st.prototype.point=!0;function js(o,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=o;return t==null&&(t=o.inclusive),i==null&&(i=o.inclusive),{start:t??e,end:i??e}}function hc(o,e){return o==e||!!(o&&e&&o.compare(e))}function jn(o,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=o?t[l]=Math.max(t[l],e):t.push(o,e)}class de extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,a){if(i){if(!(i instanceof de))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),Ts(this,e,t,i?i.children.slice():[],s,a),!0}split(e){let t=new de;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,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){Ii(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){$s(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=$n(t,this.attrs||{})),i&&(this.attrs=$n({class:i},this.attrs||{}))}domAtPos(e){return Fs(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ss(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&&(Rn(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&&ne.get(l)instanceof Xe;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=ne.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!q.ios||!this.children.some(s=>s instanceof Ee))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ee)||/[^ -~]/.test(i.text))return null;let l=Jt(i.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 i=Rs(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let a=(s-l.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof de&&this.children.length==0&&e.children.length==0&&Ii(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],a=l+s.length;if(a>=t){if(s instanceof de)return s;if(a>t)break}l=a+s.breakAfter}return null}}class Je extends ne{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,a){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ye.before(this.dom):ye.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new Je(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return En}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):X.empty}domBoundsAround(){return null}become(e){return e instanceof Je&&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 i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof zn?null:Ai(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:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class zn extends Ln{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 ii{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,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 Je&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new de),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Di(new Mt(-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 Je)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:a,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(a){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=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Di(new Ee(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,a){if(this.disallowBlockEffectsFor[a]&&i instanceof st){if(i.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(i instanceof st)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||Tt.block,r,i));else{let d=bt.create(i.widget||Tt.inline,r,r?0:i.startSide),c=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),h=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),c&&(f.append(Di(new Mt(1),l),s),s=l.length+Math.max(0,s-l.length)),f.append(Di(d,l),s),this.atCursorPos=h,this.pendingBuffer=h?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);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=s)}static build(e,t,i,l,s){let a=new ii(e,t,i,s);return a.openEnd=se.spans(l,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Di(o,e){for(let t of e)o=new Xe(t,[o],o.length);return o}class Tt extends Ln{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}}Tt.inline=new Tt("span"),Tt.block=new Tt("div");var me=function(o){return o[o.LTR=0]="LTR",o[o.RTL=1]="RTL",o}(me||(me={}));const yt=me.LTR,qn=me.RTL;function zs(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const fc=zs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),uc=zs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Un=Object.create(null),je=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Un[e]=t,Un[t]=-e}function qs(o){return o<=247?fc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?uc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const pc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?qn:yt}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let s=-1;for(let a=0;a<e.length;a++){let r=e[a];if(r.from<=t&&r.to>=t){if(r.level==i)return a;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function Us(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Us(i.inner,l.inner))return!1}return!0}const le=[];function mc(o,e,t,i,l){for(let s=0;s<=i.length;s++){let a=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let c=a,h=d,f=d;c<r;c++){let u=qs(o.charCodeAt(c));u==512?u=h:u==8&&f==4&&(u=16),le[c]=u==4?2:u,u&7&&(f=u),h=u}for(let c=a,h=d,f=d;c<r;c++){let u=le[c];if(u==128)c<r-1&&h==le[c+1]&&h&24?u=le[c]=h:le[c]=256;else if(u==64){let m=c+1;for(;m<r&&le[m]==64;)m++;let y=c&&h==8||m<t&&le[m]==8?f==1?1:8:256;for(let k=c;k<m;k++)le[k]=y;c=m-1}else u==8&&f==1&&(le[c]=1);h=u,u&7&&(f=u)}}}function gc(o,e,t,i,l){let s=l==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let c=a?i[a-1].to:e,h=a<i.length?i[a].from:t;for(let f=c,u,m,y;f<h;f++)if(m=Un[u=o.charCodeAt(f)])if(m<0){for(let k=r-3;k>=0;k-=3)if(je[k+1]==-m){let x=je[k+2],w=x&2?l:x&4?x&1?s:l:0;w&&(le[f]=le[je[k]]=w),r=k;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=u,je[r++]=d}else if((y=le[f])==2||y==1){let k=y==l;d=k?0:1;for(let x=r-3;x>=0;x-=3){let w=je[x+2];if(w&2)break;if(k)je[x+2]|=2;else{if(w&4)break;je[x+2]|=4}}}}}function kc(o,e,t,i){for(let l=0,s=i;l<=t.length;l++){let a=l?t[l-1].to:o,r=l<t.length?t[l].from:e;for(let d=a;d<r;){let c=le[d];if(c==256){let h=d+1;for(;;)if(h==r){if(l==t.length)break;h=t[l++].to,r=l<t.length?t[l].from:e}else if(le[h]==256)h++;else break;let f=s==1,u=(h<e?le[h]:i)==1,m=f==u?f?1:2:i;for(let y=h,k=l,x=k?t[k-1].to:o;y>d;)y==x&&(y=t[--k].from,x=k?t[k-1].to:o),le[--y]=m;d=h}else s=c,d++}}}function Wn(o,e,t,i,l,s,a){let r=i%2?2:1;if(i%2==l%2)for(let d=e,c=0;d<t;){let h=!0,f=!1;if(c==s.length||d<s[c].from){let k=le[d];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,y=d;e:for(;;)if(c<s.length&&y==s[c].from){if(f)break e;let k=s[c];if(!h)for(let x=k.to,w=c+1;;){if(x==t)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(le[x]==r)break e;break}}if(c++,u)u.push(k);else{k.from>d&&a.push(new ot(d,k.from,m));let x=k.direction==yt!=!(m%2);Hn(o,x?i+1:i,l,k.inner,k.from,k.to,a),d=k.to}y=k.to}else{if(y==t||(h?le[y]!=r:le[y]==r))break;y++}u?Wn(o,d,y,i+1,l,u,a):d<y&&a.push(new ot(d,y,m)),d=y}else for(let d=t,c=s.length;d>e;){let h=!0,f=!1;if(!c||d>s[c-1].to){let k=le[d-1];k!=r&&(h=!1,f=k==16)}let u=!h&&r==1?[]:null,m=h?i:i+1,y=d;e:for(;;)if(c&&y==s[c-1].to){if(f)break e;let k=s[--c];if(!h)for(let x=k.from,w=c;;){if(x==e)break e;if(w&&s[w-1].to==x)x=s[--w].from;else{if(le[x-1]==r)break e;break}}if(u)u.push(k);else{k.to<d&&a.push(new ot(k.to,d,m));let x=k.direction==yt!=!(m%2);Hn(o,x?i+1:i,l,k.inner,k.from,k.to,a),d=k.from}y=k.from}else{if(y==e||(h?le[y-1]!=r:le[y-1]==r))break;y--}u?Wn(o,y,d,i+1,l,u,a):y<d&&a.push(new ot(y,d,m)),d=y}}function Hn(o,e,t,i,l,s,a){let r=e%2?2:1;mc(o,l,s,i,r),gc(o,l,s,i,r),kc(l,s,i,r),Wn(o,l,s,e,t,i,a)}function bc(o,e,t){if(!o)return[new ot(0,0,e==qn?1:0)];if(e==yt&&!t.length&&!pc.test(o))return Ws(o.length);if(t.length)for(;o.length>le.length;)le[le.length]=256;let i=[],l=e==yt?0:1;return Hn(o,l,l,t,0,o.length,i),i}function Ws(o){return[new ot(0,o,0)]}let Hs="";function yc(o,e,t,i,l){var s;let a=i.head-o.from,r=ot.find(e,a,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],c=d.side(l,t);if(a==c){let u=r+=l?1:-1;if(u<0||u>=e.length)return null;d=e[r=u],a=d.side(!l,t),c=d.side(l,t)}let h=Ke(o.text,a,d.forward(l,t));(h<d.from||h>d.to)&&(h=c),Hs=o.text.slice(Math.min(a,h),Math.max(a,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==c&&f.level+(l?0:1)<d.level?U.cursor(f.side(!l,t)+o.from,f.forward(l,t)?1:-1,f.level):U.cursor(h+o.from,d.forward(l,t)?-1:1,d.level)}function wc(o,e,t){for(let i=e;i<t;i++){let l=qs(o.charCodeAt(i));if(l==1)return yt;if(l==2||l==4)return qn}return yt}const Ks=Q.define(),Qs=Q.define(),Gs=Q.define(),Ys=Q.define(),Kn=Q.define(),Xs=Q.define(),Js=Q.define(),Qn=Q.define(),Gn=Q.define(),Zs=Q.define({combine:o=>o.some(e=>e)}),xc=Q.define({combine:o=>o.some(e=>e)}),eo=Q.define();class At{constructor(e,t="nearest",i="nearest",l=5,s=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new At(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 At(U.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pi=ce.define({map:(o,e)=>o.map(e)}),to=ce.define();function ze(o,e,t){let i=o.facet(Ys);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const at=Q.define({combine:o=>o.length?o[0]:!0});let vc=0;const ni=Q.define();class Et{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:a}=t||{};return new Et(vc++,e,i,l,r=>{let d=[ni.of(r)];return a&&d.push(li.of(c=>{let h=c.plugin(r);return h?a(h):we.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return Et.define(i=>new e(i),t)}}class Yn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}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(i){if(ze(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ze(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(i){ze(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const io=Q.define(),Xn=Q.define(),li=Q.define(),no=Q.define(),Jn=Q.define(),lo=Q.define();function so(o,e){let t=o.state.facet(lo);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(o):s),l=[];return se.spans(i,e.from,e.to,{point(){},span(s,a,r,d){let c=s-e.from,h=a-e.from,f=l;for(let u=r.length-1;u>=0;u--,d--){let m=r[u].spec.bidiIsolate,y;if(m==null&&(m=wc(e.text,c,h)),d>0&&f.length&&(y=f[f.length-1]).to==c&&y.direction==m)y.to=h,f=y.inner;else{let k={from:c,to:h,direction:m,inner:[]};f.push(k),f=k.inner}}}}),l}const oo=Q.define();function ao(o){let e=0,t=0,i=0,l=0;for(let s of o.state.facet(oo)){let a=s(o);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(l=Math.max(l,a.bottom)))}return{left:e,right:t,top:i,bottom:l}}const si=Q.define();class Me{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new Me(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,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,a=0,r=0;;l++){let d=l==e.length?null:e[l],c=a-r,h=d?d.fromB:1e9;for(;s<t.length&&t[s]<h;){let f=t[s],u=t[s+1],m=Math.max(r,f),y=Math.min(h,u);if(m<=y&&new Me(m+c,y+c,m,y).addToSet(i),u>h)break;s+=2}if(!d)return i;new Me(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),a=d.toA,r=d.toB}}}class Fi{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ue.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,a,r,d)=>l.push(new Me(s,a,r,d))),this.changedRanges=l}static create(e,t,i){return new Fi(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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 ro extends ne{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=we.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 de],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Me(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>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:!_c(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Sc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;i=new Me(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(q.ie||q.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=Oc(a,r,e.changes);return i=Me.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);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 a=q.chrome||q.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||l.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof Je&&a.widget instanceof zn&&s.push(a.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let a=l.length-1;;a--){let r=a>=0?l[a]:null;if(!r)break;let{fromA:d,toA:c,fromB:h,toB:f}=r,u,m,y,k;if(i&&i.range.fromB<f&&i.range.toB>h){let g=ii.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),p=ii.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);m=g.breakAtStart,y=g.openStart,k=p.openEnd;let S=this.compositionView(i);p.breakAtStart?S.breakAfter=1:p.content.length&&S.merge(S.length,S.length,p.content[0],!1,p.openStart,0)&&(S.breakAfter=p.content[0].breakAfter,p.content.shift()),g.content.length&&S.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),u=g.content.concat(S).concat(p.content)}else({content:u,breakAtStart:m,openStart:y,openEnd:k}=ii.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:x,off:w}=s.findPos(c,1),{i:v,off:O}=s.findPos(d,-1);Ms(this,v,O,x,w,u,m,y,k)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(to)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Xe(l,[t],t.length);let i=new de;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=ne.get(s);r&&r!=a&&(r.dom=null),a.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Mi(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),c=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(q.gecko&&r.empty&&!this.hasComposition&&Cc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=c=new ye(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Zt(d.node,d.offset,h.anchorNode,h.anchorOffset)||!Zt(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&this.dom.contains(h.focusNode)&&Vc(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Xt(this.view.root);if(f)if(r.empty){if(q.gecko){let u=Nc(d.node,d.offset);if(u&&u!=3){let m=(u==1?Bs:Os)(d.node,d.offset);m&&(d=new ye(m.node,m.offset))}}f.collapse(d.node,d.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(c.node,c.offset)}catch{}}else{let u=document.createRange();r.anchor>r.head&&([d,c]=[c,d]),u.setEnd(c.node,c.offset),u.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,c)),this.impreciseAnchor=d.precise?null:new ye(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new ye(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zt(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,i=Xt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=de.find(this,t.head);if(!a)return;let r=a.posAtStart;if(t.head==r||t.head==r+a.length)return;let d=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!d||!c||d.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=ne.get(t.childNodes[l]);s instanceof de&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=ne.get(t.childNodes[l]);s instanceof de&&(i=s.domAtPos(s.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=ne.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof de)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=s-r.breakAfter,c=d-r.length;if(d<e)break;if(c<=e&&(c<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof de&&!(i instanceof de&&t>=0)))i=r,l=c;else if(i&&c==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}s=c}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof de))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof Ee))return null;let s=Ke(l.text,i);if(s==i)return null;let a=kt(l.dom,i,s).getClientRects();for(let r=0;r<a.length;r++){let d=a[r];if(r==a.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,s=this.view.contentDOM.clientWidth,a=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let c=0,h=0;h<this.children.length;h++){let f=this.children[h],u=c+f.length;if(u>l)break;if(c>=i){let m=f.dom.getBoundingClientRect();if(t.push(m.height),a){let y=f.dom.lastChild,k=y?Jt(y):[];if(k.length){let x=k[k.length-1],w=d?x.right-m.left:m.right-x.left;w>r&&(r=w,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=u)}}}c=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof de){let a=s.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,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 s=Jt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new _s(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],a=s?s.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(we.replace({widget:new zn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!s)break;i=s.to+1}return we.set(e)}updateDeco(){let e=1,t=this.view.state.facet(li).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(no).map((s,a)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(se.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 c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(eo))try{if(c(this.view,e.range,e))return!0}catch(h){ze(this.view.state,h,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ao(this.view),a={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;ic(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,d),-d),this.view.textDirection==me.LTR)}}function Cc(o){return o.node.nodeType==1&&o.node.firstChild&&(o.offset==0||o.node.childNodes[o.offset-1].contentEditable=="false")&&(o.offset==o.node.childNodes.length||o.node.childNodes[o.offset].contentEditable=="false")}function co(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Bs(t.focusNode,t.focusOffset),l=Os(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=ne.get(l.node);if(!r||r instanceof Ee&&r.text!=l.node.nodeValue)s=l;else if(o.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(s=l)}}if(o.docView.lastCompositionAfterCursor=s!=i,!s)return null;let a=e-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function Sc(o,e,t){let i=co(o,t);if(!i)return null;let{node:l,from:s,to:a}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,c=new Me(d.mapPos(s),d.mapPos(a),s,a),h=[];for(let f=l.parentNode;;f=f.parentNode){let u=ne.get(f);if(u instanceof Xe)h.push({node:f,deco:u.mark});else{if(u instanceof de||f.nodeName=="DIV"&&f.parentNode==o.contentDOM)return{range:c,text:l,marks:h,line:f};if(f!=o.contentDOM)h.push({node:f,deco:new ei({inclusive:!0,attributes:cc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Nc(o,e){return o.nodeType!=1?0:(e&&o.childNodes[e-1].contentEditable=="false"?1:0)|(e<o.childNodes.length&&o.childNodes[e].contentEditable=="false"?2:0)}let Bc=class{constructor(){this.changes=[]}compareRange(e,t){jn(e,t,this.changes)}comparePoint(e,t){jn(e,t,this.changes)}};function Oc(o,e,t){let i=new Bc;return se.compare(o,e,t,i),i.changes}function Vc(o,e){for(let t=o;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function _c(o,e){let t=!1;return e&&o.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Mc(o,e,t=1){let i=o.charCategorizer(e),l=o.doc.lineAt(e),s=e-l.from;if(l.length==0)return U.cursor(e);s==0?t=1:s==l.length&&(t=-1);let a=s,r=s;t<0?a=Ke(l.text,s,!1):r=Ke(l.text,s);let d=i(l.text.slice(a,r));for(;a>0;){let c=Ke(l.text,a,!1);if(i(l.text.slice(c,a))!=d)break;a=c}for(;r<l.length;){let c=Ke(l.text,r);if(i(l.text.slice(r,c))!=d)break;r=c}return U.range(a+l.from,r+l.from)}function Tc(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Ac(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function Zn(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function ho(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function fo(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function el(o,e,t){let i,l,s,a,r=!1,d,c,h,f;for(let y=o.firstChild;y;y=y.nextSibling){let k=Jt(y);for(let x=0;x<k.length;x++){let w=k[x];l&&Zn(l,w)&&(w=ho(fo(w,l.bottom),l.top));let v=Tc(e,w),O=Ac(t,w);if(v==0&&O==0)return y.nodeType==3?uo(y,e,t):el(y,e,t);if(!i||a>O||a==O&&s>v){i=y,l=w,s=v,a=O;let g=O?t<w.top?-1:1:v?e<w.left?-1:1:0;r=!g||(g>0?x<k.length-1:x>0)}v==0?t>w.bottom&&(!h||h.bottom<w.bottom)?(d=y,h=w):t<w.top&&(!f||f.top>w.top)&&(c=y,f=w):h&&Zn(h,w)?h=fo(h,w.bottom):f&&Zn(f,w)&&(f=ho(f,w.top))}}if(h&&h.bottom>=t?(i=d,l=h):f&&f.top<=t&&(i=c,l=f),!i)return{node:o,offset:0};let u=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return uo(i,u,t);if(r&&i.contentEditable!="false")return el(i,u,t);let m=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:o,offset:m}}function uo(o,e,t){let i=o.nodeValue.length,l=-1,s=1e9,a=0;for(let r=0;r<i;r++){let d=kt(o,r,r+1).getClientRects();for(let c=0;c<d.length;c++){let h=d[c];if(h.top==h.bottom)continue;a||(a=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<s){let u=e>=(h.left+h.right)/2,m=u;if((q.chrome||q.gecko)&&kt(o,r).getBoundingClientRect().left==h.right&&(m=!u),f<=0)return{node:o,offset:r+(m?1:0)};l=r+(m?1:0),s=f}}}return{node:o,offset:l>-1?l:a>0?o.nodeValue.length:0}}function po(o,e,t,i=-1){var l,s;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:c}=o.viewState,{x:h,y:f}=e,u=f-r;if(u<0)return 0;if(u>c)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,p=!1;d=o.elementAtHeight(u),d.type!=Le.Text;)for(;u=i>0?d.bottom+g:d.top-g,!(u>=0&&u<=c);){if(p)return t?null:0;p=!0,i=-i}f=r+u;let m=d.from;if(m<o.viewport.from)return o.viewport.from==0?0:t?null:mo(o,a,d,h,f);if(m>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:mo(o,a,d,h,f);let y=o.dom.ownerDocument,k=o.root.elementFromPoint?o.root:y,x=k.elementFromPoint(h,f);x&&!o.contentDOM.contains(x)&&(x=null),x||(h=Math.max(a.left+1,Math.min(a.right-1,h)),x=k.elementFromPoint(h,f),x&&!o.contentDOM.contains(x)&&(x=null));let w,v=-1;if(x&&((l=o.docView.nearest(x))===null||l===void 0?void 0:l.isEditable)!=!1){if(y.caretPositionFromPoint){let g=y.caretPositionFromPoint(h,f);g&&({offsetNode:w,offset:v}=g)}else if(y.caretRangeFromPoint){let g=y.caretRangeFromPoint(h,f);g&&({startContainer:w,startOffset:v}=g,(!o.contentDOM.contains(w)||q.safari&&Ec(w,v,h)||q.chrome&&Ic(w,v,h))&&(w=void 0))}}if(!w||!o.docView.dom.contains(w)){let g=de.find(o.docView,m);if(!g)return u>d.top+d.height/2?d.to:d.from;({node:w,offset:v}=el(g.dom,h,f))}let O=o.docView.nearest(w);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let g=O.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(w,v)+O.posAtStart}function mo(o,e,t,i,l){let s=Math.round((i-e.left)*o.defaultCharacterWidth);if(o.lineWrapping&&t.height>o.defaultLineHeight*1.5){let r=o.viewState.heightOracle.textHeight,d=Math.floor((l-t.top-(o.defaultLineHeight-r)*.5)/r);s+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+Jd(a,s,o.state.tabSize)}function Ec(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let l=o.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return kt(o,i-1,i).getBoundingClientRect().left>t}function Ic(o,e,t){if(e!=0)return!1;for(let l=o;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=o.nodeType==1?o.getBoundingClientRect():kt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Dc(o,e){let t=o.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==Le.Text))return i}return t}function Pc(o,e,t,i){let l=Dc(o,e.head),s=!i||l.type!=Le.Text||!(o.lineWrapping||l.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(l.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(d!=null)return U.cursor(d,t?-1:1)}return U.cursor(t?l.to:l.from,t?-1:1)}function go(o,e,t,i){let l=o.state.doc.lineAt(e.head),s=o.bidiSpans(l),a=o.textDirectionAt(l.from);for(let r=e,d=null;;){let c=yc(l,s,a,r,t),h=Hs;if(!c){if(l.number==(t?o.state.doc.lines:1))return r;h=`
8
- `,l=o.state.doc.line(l.number+(t?1:-1)),s=o.bidiSpans(l),c=o.visualLineSide(l,!t)}if(d){if(!d(h))return r}else{if(!i)return c;d=i(h)}r=c}}function Fc(o,e,t){let i=o.state.charCategorizer(e),l=i(t);return s=>{let a=i(s);return l==Ge.Space&&(l=a),l==a}}function $c(o,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?o.state.doc.length:0))return U.cursor(l,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),c=o.coordsAtPos(l,e.assoc||-1),h=o.documentTop;if(c)a==null&&(a=c.left-d.left),r=s<0?c.top:c.bottom;else{let m=o.viewState.lineBlockAt(l);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(l-m.from))),r=(s<0?m.top:m.bottom)+h}let f=d.left+a,u=i??o.viewState.heightOracle.textHeight>>1;for(let m=0;;m+=10){let y=r+(u+m)*s,k=po(o,{x:f,y},!1,s);if(y<d.top||y>d.bottom||(s<0?k<l:k>l)){let x=o.docView.coordsForChar(k),w=!x||y<x.top?-1:1;return U.cursor(k,w,void 0,a)}}}function $i(o,e,t){for(;;){let i=0;for(let l of o)l.between(e-1,e+1,(s,a,r)=>{if(e>s&&e<a){let d=i||t||(e-s<a-e?-1:1);e=d<0?s:a,i=d}});if(!i)return e}}function tl(o,e,t){let i=$i(o.state.facet(Jn).map(l=>l(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:U.cursor(i,i<t.from?1:-1)}const oi="￿";class Rc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(te.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=oi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let s=this.text.length;this.readNode(l);let a=l.nextSibling;if(a==t)break;let r=ne.get(l),d=ne.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ti(l))||Ti(a)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>s)&&this.lineBreak(),l=a}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,r;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=l.exec(t))&&(s=r.index,a=r[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=a-1);i=s+a}}readNode(e){if(e.cmIgnore)return;let t=ne.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.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 i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Lc(e,i.node,i.offset)?t:0))}}function Lc(o,e,t){for(;;){if(!e||t<Ye(e))return!1;if(e==o)return!0;t=gt(e)+1,e=e.parentNode}}class ko{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class jc{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let r=s||a?[]:Uc(e),d=new Rc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Wc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=s&&s.node==r.focusNode&&s.offset==r.focusOffset||!An(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),c=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!An(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((q.ios||q.chrome)&&e.state.selection.main.empty&&d!=c&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(d,c),u=Math.max(d,c),m=h.from-f,y=h.to-u;(m==0||m==1||f==0)&&(y==0||y==-1||u==e.state.doc.length)&&(d=0,c=e.state.doc.length)}this.newSel=U.single(c,d)}}}function bo(o,e){let t,{newSel:i}=e,l=o.state.selection.main,s=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=l.from,c=null;(s===8||q.android&&e.text.length<r-a)&&(d=l.to,c="end");let h=qc(o.state.doc.sliceString(a,r,oi),e.text,d-a,c);h&&(q.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==oi+oi&&h.toB--,t={from:a+h.from,to:a+h.toA,insert:X.of(e.text.slice(h.from,h.toB).split(oi))})}else i&&(!o.hasFocus&&o.state.facet(at)||i.main.eq(l))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!l.empty&&i&&i.main.empty?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,l.to)}: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:o.state.doc.slice(l.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,l.to))}:(q.mac||q.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}):q.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
9
- `&&o.lineWrapping&&(i&&(i=U.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}),t)return il(o,t,i,s);if(i&&!i.main.eq(l)){let a=!1,r="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(a=!0),r=o.inputState.lastSelectionOrigin),o.dispatch({selection:i,scrollIntoView:a,userEvent:r}),!0}else return!1}function il(o,e,t,i=-1){if(q.ios&&o.inputState.flushIOSKey(e))return!0;let l=o.state.selection.main;if(q.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&o.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&_t(o.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&_t(o.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&_t(o.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=zc(o,e,t));return o.state.facet(Xs).some(d=>d(o,e.from,e.to,s,r))||o.dispatch(r()),!0}function zc(o,e,t){let i,l=o.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=o.state.sliceDoc(e.from,e.to),h,f=t&&co(o,t.main.head);if(f){let y=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-y}}else h=o.state.doc.lineAt(s.head);let u=s.to-e.to,m=s.to-s.from;i=l.changeByRange(y=>{if(y.from==s.from&&y.to==s.to)return{changes:r,range:d||y.map(r)};let k=y.to-u,x=k-c.length;if(y.to-y.from!=m||o.state.sliceDoc(x,k)!=c||y.to>=h.from&&y.from<=h.to)return{range:y};let w=l.changes({from:x,to:k,insert:e.insert}),v=y.to-s.to;return{changes:w,range:d?U.range(Math.max(0,d.anchor+v),Math.max(0,d.head+v)):y.map(w)}})}else i={changes:r,selection:d&&l.selection.replaceRange(d)}}let a="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,a+=".compose",o.inputState.compositionFirstChange&&(a+=".start",o.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:a,scrollIntoView:!0})}function qc(o,e,t,i){let l=Math.min(o.length,e.length),s=0;for(;s<l&&o.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&o.length==e.length)return null;let a=o.length,r=e.length;for(;a>0&&r>0&&o.charCodeAt(a-1)==e.charCodeAt(r-1);)a--,r--;if(i=="end"){let d=Math.max(0,s-Math.min(a,r));t-=a+d-s}if(a<s&&o.length<e.length){let d=t<=s&&t>=a?s-t:0;s-=d,r=s+(r-a),a=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,a=s+(a-r),r=s}return{from:s,toA:a,toB:r}}function Uc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=o.observer.selectionRange;return t&&(e.push(new ko(t,i)),(l!=t||s!=i)&&e.push(new ko(l,s))),e}function Wc(o,e){if(o.length==0)return null;let t=o[0].pos,i=o.length==2?o[1].pos:t;return t>-1&&i>-1?U.single(t+e,i+e):null}class Hc{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,q.safari&&e.contentDOM.addEventListener("input",()=>null),q.gecko&&dh(e.contentDOM.ownerDocument)}handleEvent(e){!th(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Kc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let a=!t[s].handlers.length,r=i[s];r&&a!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:a})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,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&&Gc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=wo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Qc.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,_t(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:q.safari&&!q.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 yo(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(l){ze(t.state,l)}}}function Kc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let a=l.domEventHandlers[s];a&&t(s).handlers.push(yo(i.value,a))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let a=l.domEventObservers[s];a&&t(s).observers.push(yo(i.value,a))}}for(let i in Ie)t(i).handlers.push(Ie[i]);for(let i in Te)t(i).observers.push(Te[i]);return e}const wo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Qc="dthko",Gc=[16,17,18,20,91,92,224,225],Ri=6;function Li(o){return Math.max(0,o)*.7+8}function Yc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class Xc{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=nc(e.contentDOM),this.atoms=e.state.facet(Jn).map(a=>a(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(te.allowMultipleSelections)&&Jc(e,t),this.dragging=eh(e,t)&&_o(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&&Yc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ao(this.view);e.clientX-d.left<=l+Ri?t=-Li(l-e.clientX):e.clientX+d.right>=a-Ri&&(t=Li(e.clientX-a)),e.clientY-d.top<=s+Ri?i=-Li(s-e.clientY):e.clientY+d.bottom>=r-Ri&&(i=Li(e.clientY-r)),this.setScrollSpeed(t,i)}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 i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let a=$i(this.atoms,l.from,0);a!=l.from&&(s=U.cursor(a,-1))}else{let a=$i(this.atoms,l.from,-1),r=$i(this.atoms,l.to,1);(a!=l.from||r!=l.to)&&(s=U.range(l.from==l.anchor?a:r,l.from==l.head?a:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?U.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,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 Jc(o,e){let t=o.state.facet(Ks);return t.length?t[0](e):q.mac?e.metaKey:e.ctrlKey}function Zc(o,e){let t=o.state.facet(Qs);return t.length?t[0](e):q.mac?!e.altKey:!e.ctrlKey}function eh(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Xt(o.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let a=l[s];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function th(o,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=o.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ne.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ie=Object.create(null),Te=Object.create(null),xo=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function ih(o){let e=o.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{o.focus(),t.remove(),vo(o,t.value)},50)}function ji(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function vo(o,e){e=ji(o.state,Qn,e);let{state:t}=o,i,l=1,s=t.toText(e),a=s.lines==t.selection.ranges.length;if(nl!=null&&t.selection.ranges.every(d=>d.empty)&&nl==s.toString()){let d=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==d)return{range:c};d=h.from;let f=t.toText((a?s.line(l++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:U.cursor(c.from+f.length)}})}else a?i=t.changeByRange(d=>{let c=s.line(l++);return{changes:{from:d.from,to:d.to,insert:c.text},range:U.cursor(d.from+c.length)}}):i=t.replaceSelection(s);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},Ie.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(o,e)=>{if(o.observer.flush(),o.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of o.state.facet(Gs))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=sh(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new Xc(o,e,t,i)),i&&o.observer.ignore(()=>{vs(o.contentDOM);let s=o.root.activeElement;s&&!s.contains(o.contentDOM)&&s.blur()});let l=o.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function Co(o,e,t,i){if(i==1)return U.cursor(e,t);if(i==2)return Mc(o.state,e,t);{let l=de.find(o.docView,e),s=o.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<o.state.doc.length&&r==s.to&&r++,U.range(a,r)}}let So=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function nh(o,e,t,i){let l=de.find(o.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let a=l.coordsAt(s,-1);if(a&&So(t,i,a))return-1;let r=l.coordsAt(s,1);return r&&So(t,i,r)?1:a&&a.bottom>=i?-1:1}function No(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:nh(o,t,e.clientX,e.clientY)}}const lh=q.ie&&q.ie_version<=11;let Bo=null,Oo=0,Vo=0;function _o(o){if(!lh)return o.detail;let e=Bo,t=Vo;return Bo=o,Vo=Date.now(),Oo=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(Oo+1)%3:1}function sh(o,e){let t=No(o,e),i=_o(e),l=o.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,a,r){let d=No(o,s),c,h=Co(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let f=Co(o,t.pos,t.bias,i),u=Math.min(f.from,h.from),m=Math.max(f.to,h.to);h=u<h.from?U.range(u,m):U.range(m,u)}return a?l.replaceRange(l.main.extend(h.from,h.to)):r&&i==1&&l.ranges.length>1&&(c=oh(l,d.pos))?c:r?l.addRange(h):U.create([h])}}}function oh(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:l}=o.ranges[t];if(i<=e&&l>=e)return U.create(o.ranges.slice(0,t).concat(o.ranges.slice(t+1)),o.mainIndex==t?0:o.mainIndex-(o.mainIndex>t?1:0))}return null}Ie.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let l=o.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,a=s+l.length;(s>=t.to||a<=t.from)&&(t=U.range(s,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ji(o.state,Gn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=o=>(o.inputState.draggedContent=null,!1);function Mo(o,e,t,i){if(t=ji(o.state,Qn,t),!t)return;let l=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=o.inputState,a=i&&s&&Zc(o,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}Ie.drop=(o,e)=>{if(!e.dataTransfer)return!1;if(o.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,s=()=>{++l==t.length&&Mo(o,e,i.filter(a=>a!=null).join(o.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let r=new FileReader;r.onerror=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),s()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Mo(o,e,i,!0),!0}return!1},Ie.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=xo?null:e.clipboardData;return t?(vo(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(ih(o),!1)};function ah(o,e){let t=o.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),o.focus()},50)}function rh(o){let e=[],t=[],i=!1;for(let l of o.selection.ranges)l.empty||(e.push(o.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of o.selection.ranges){let a=o.doc.lineAt(s);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),l=a.number}i=!0}return{text:ji(o,Gn,e.join(o.lineBreak)),ranges:t,linewise:i}}let nl=null;Ie.copy=Ie.cut=(o,e)=>{let{text:t,ranges:i,linewise:l}=rh(o.state);if(!t&&!l)return!1;nl=l?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=xo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(ah(o,t),!1)};const To=St.define();function Ao(o,e){let t=[];for(let i of o.facet(Js)){let l=i(o,e);l&&t.push(l)}return t?o.update({effects:t,annotations:To.of(!0)}):null}function Eo(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Ao(o.state,e);t?o.dispatch(t):o.update([])}},10)}Te.focus=o=>{o.inputState.lastFocusTime=Date.now(),!o.scrollDOM.scrollTop&&(o.inputState.lastScrollTop||o.inputState.lastScrollLeft)&&(o.scrollDOM.scrollTop=o.inputState.lastScrollTop,o.scrollDOM.scrollLeft=o.inputState.lastScrollLeft),Eo(o)},Te.blur=o=>{o.observer.clearSelectionRange(),Eo(o)},Te.compositionstart=Te.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Te.compositionend=o=>{o.observer.editContext||(o.inputState.composing=-1,o.inputState.compositionEndedAt=Date.now(),o.inputState.compositionPendingKey=!0,o.inputState.compositionPendingChange=o.observer.pendingRecords().length>0,o.inputState.compositionFirstChange=null,q.chrome&&q.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Te.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(s&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),c=o.posAtDOM(r.endContainer,r.endOffset);return il(o,{from:d,to:c,insert:o.state.toText(s)},null),!0}}let l;if(q.chrome&&q.android&&(l=wo.find(s=>s.inputType==e.inputType))&&(o.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return q.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),q.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Te.compositionend(o,e),20),!1};const Io=new Set;function dh(o){Io.has(o)||(Io.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Do=["pre-wrap","normal","pre-line","break-spaces"];let It=!1;function Po(){It=!1}class ch{constructor(e){this.lineWrapping=e,this.doc=X.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Do.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,a){let r=Do.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let c=0;c<a.length;c++){let h=a[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return d}}class hh{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class qe{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?Le.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 st?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 qe(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var oe=function(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(oe||(oe={}));const zi=.001;class ve{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>zi&&(It=!0),this.height=e)}replace(e,t,i){return ve.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,a=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:c,fromB:h,toB:f}=l[r],u=s.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),m=u.to>=c?u:s.lineAt(c,oe.ByPosNoHeight,i,0,0);for(f+=m.to-c,c=m.to;r>0&&u.from<=l[r-1].toA;)d=l[r-1].fromA,h=l[r-1].fromB,r--,d<u.from&&(u=s.lineAt(d,oe.ByPosNoHeight,i,0,0));h+=u.from-d,d=u.from;let y=ll.build(i.setDoc(a),e,h,f);s=qi(s,s.replace(d,c,y))}return s.updateHeight(i,0)}static empty(){return new Oe(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*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),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new fh(ve.of(e.slice(0,t)),a,ve.of(e.slice(i)))}}function qi(o,e){return o==e?o:(o.constructor!=e.constructor&&(It=!0),e)}ve.prototype.size=1;class Fo extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,a){e<=s+this.length&&t>=s&&a(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!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 Oe extends Fo{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oe||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Oe(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):ve.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||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 ge extends ve{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);a=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else a=this.height/s;return{firstLine:i,lastLine:l,perLine:a,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let c=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=t.doc.lineAt(c),f=r+h.length*d,u=Math.max(i,e-f/2);return new qe(h.from,h.length,u,f,0)}else{let c=Math.max(0,Math.min(a-s,Math.floor((e-i)/r))),{from:h,length:f}=t.doc.line(s+c);return new qe(h,f,i+r*c,r,0)}}lineAt(e,t,i,l,s){if(t==oe.ByHeight)return this.blockAt(e,i,l,s);if(t==oe.ByPosNoHeight){let{from:m,to:y}=i.doc.lineAt(e);return new qe(m,y-m,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,s),c=i.doc.lineAt(e),h=r+c.length*d,f=c.number-a,u=l+r*f+d*(c.from-s-f);return new qe(c.from,c.length,Math.max(l,Math.min(u,l+this.height-h)),h,0)}forEachLine(e,t,i,l,s,a){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:c}=this.heightMetrics(i,s);for(let h=e,f=l;h<=t;){let u=i.doc.lineAt(h);if(h==e){let y=u.number-r;f+=d*y+c*(e-s-y)}let m=d+c*u.length;a(new qe(u.from,u.length,f,m,0)),f+=m,h=u.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return ve.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&a.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let h=e.doc.lineAt(r).length;a.length&&a.push(null);let f=l.heights[l.index++];d==-1?d=f:Math.abs(f-d)>=zi&&(d=-2);let u=new Oe(h,f);u.outdated=!1,a.push(u),r+=h+1}r<=s&&a.push(null,new ge(s-r).updateHeight(e,r));let c=ve.of(a);return(d<0||Math.abs(c.height-this.height)>=zi||Math.abs(d-this.heightMetrics(e,t).perLine)>=zi)&&(It=!0),qi(this,c)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class fh extends ve{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let a=l+this.left.height,r=s+this.left.length+this.break,d=t==oe.ByHeight?e<a:e<r,c=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,a,r);if(this.break||(d?c.to<r:c.from>r))return c;let h=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?c.join(this.right.lineAt(r,h,i,a,r)):this.left.lineAt(r,h,i,l,s).join(c)}forEachLine(e,t,i,l,s,a){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let c=this.lineAt(d,oe.ByPos,i,l,s);e<c.from&&this.left.forEachLine(e,c.from-1,i,l,s,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,r,d,a)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let r of i)s.push(r);if(e>0&&$o(s,a-1),t<this.length){let r=s.length;this.decomposeRight(t,s),$o(s,r)}return ve.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&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?ve.of(this.break?[e,null,t]:[e,t]):(this.left=qi(this.left,e),this.right=qi(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,i=!1,l){let{left:s,right:a}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+a.length&&l.more?d=a=a.updateHeight(e,r,i,l):a.updateHeight(e,r,i),d?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function $o(o,e){let t,i;o[e]==null&&(t=o[e-1])instanceof ge&&(i=o[e+1])instanceof ge&&o.splice(e-1,3,new ge(t.length+1+i.length))}const uh=5;class ll{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oe?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new Fo(a,l,i)):(a||s||l>=uh)&&this.addLineDeco(l,s,a)}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 Oe(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oe)return e;let t=new Oe(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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Oe&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new ll(i,e);return se.spans(t,i,l,s,0),s.finish(i)}}function ph(o,e,t){let i=new mh;return se.compare(o,e,t,i,0),i.changes}class mh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&jn(e,t,this.changes,5)}}function gh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),a=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let c=o.parentNode;c&&c!=i.body;)if(c.nodeType==1){let h=c,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let u=h.getBoundingClientRect();s=Math.max(s,u.left),a=Math.min(a,u.right),r=Math.max(r,u.top),d=Math.min(c==o.parentNode?l.innerHeight:d,u.bottom)}c=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function kh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class sl{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new bh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class bh extends Ln{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 Ro{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=Lo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Xn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new ch(t),this.stateDeco=e.facet(li).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new Me(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:a})=>l>=s&&l<=a)){let{from:s,to:a}=this.lineBlockAt(l);e.push(new Ui(s,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Lo:new ol(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(ai(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(li).filter(h=>typeof h!="function");let l=e.changedRanges,s=Me.extendWithRanges(l,ph(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Po(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||It)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let c=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(c||!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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(xc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let c=0,h=0;if(r.width&&r.height){let{scaleX:g,scaleY:p}=xs(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||p>.005&&Math.abs(this.scaleY-p)>.005)&&(this.scaleX=g,this.scaleY=p,c|=8,a=d=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let m=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=Ns(e.scrollDOM);let y=(this.printing?kh:gh)(t,this.paddingTop),k=y.top-this.pixelViewport.top,x=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let v=r.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(g)&&(a=!0),a||l.lineWrapping&&Math.abs(v-this.contentDOMWidth)>l.charWidth){let{lineHeight:p,charWidth:S,textHeight:_}=e.docView.measureTextSize();a=p>0&&l.refresh(s,p,S,_,v/S,g),a&&(e.docView.minWidth=0,c|=8)}k>0&&x>0?h=Math.max(k,x):k<0&&x<0&&(h=Math.min(k,x)),Po();for(let p of this.viewports){let S=p.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(p);this.heightMap=(a?ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new Me(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new hh(p.from,S))}It&&(c|=2)}let O=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Ui(l.lineAt(a-i*1e3,oe.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,oe.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<d.from||c>d.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(c,oe.ByPos,s,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<d.from?u=f.top:u=f.bottom-h,d=new Ui(l.lineAt(u-1e3/2,oe.ByHeight,s,0,0).from,l.lineAt(u+h+1e3/2,oe.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Ui(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||l<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new sl(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,a=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(h,f,u,m)=>{if(f-h<s)return;let y=this.state.selection.main,k=[y.from];y.empty||k.push(y.to);for(let w of k)if(w>h&&w<f){d(h,w-10,u,m),d(w+10,f,u,m);return}let x=wh(e,w=>w.from>=u.from&&w.to<=u.to&&Math.abs(w.from-h)<s&&Math.abs(w.to-f)<s&&!k.some(v=>w.from<v&&w.to>v));if(!x){if(f<u.to&&t&&i&&t.visibleRanges.some(w=>w.from<=f&&w.to>=f)){let w=t.moveToLineBoundary(U.cursor(f),!1,!0).head;w>h&&(f=w)}x=new sl(h,f,this.gapSize(u,h,f,m))}r.push(x)},c=h=>{if(h.length<a||h.type!=Le.Text)return;let f=yh(h.from,h.to,this.stateDeco);if(f.total<a)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,m,y;if(i){let k=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,w;if(u!=null){let v=Hi(f,u),O=((this.visibleBottom-this.visibleTop)/2+k)/h.height;x=v-O,w=v+O}else x=(this.visibleTop-h.top-k)/h.height,w=(this.visibleBottom-h.top+k)/h.height;m=Wi(f,x),y=Wi(f,w)}else{let k=f.total*this.heightOracle.charWidth,x=l*this.heightOracle.charWidth,w,v;if(u!=null){let O=Hi(f,u),g=((this.pixelViewport.right-this.pixelViewport.left)/2+x)/k;w=O-g,v=O+g}else w=(this.pixelViewport.left-x)/k,v=(this.pixelViewport.right+x)/k;m=Wi(f,w),y=Wi(f,v)}m>h.from&&d(h.from,m,h,f),y<h.to&&d(y,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return r}gapSize(e,t,i,l){let s=Hi(l,i)-Hi(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){sl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];se.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ai(this.heightMap.lineAt(e,oe.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)||ai(this.heightMap.lineAt(this.scaler.fromDOM(e),oe.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 ai(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 Ui{constructor(e,t){this.from=e,this.to=t}}function yh(o,e,t){let i=[],l=o,s=0;return se.spans(t,o,e,{span(){},point(a,r){a>l&&(i.push({from:l,to:a}),s+=a-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Wi({total:o,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(o*t);for(let l=0;;l++){let{from:s,to:a}=e[l],r=a-s;if(i<=r)return s+i;i-=r}}function Hi(o,e){let t=0;for(let{from:i,to:l}of o.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/o.total}function wh(o,e){for(let t of o)if(e(t))return t}const Lo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class ol{constructor(e,t,i){let l=0,s=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let c=t.lineAt(r,oe.ByPos,e,0,0).top,h=t.lineAt(d,oe.ByPos,e,0,0).bottom;return l+=h-c,{from:r,to:d,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=a+(r.top-s)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof ol?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ai(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new qe(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(l=>ai(l,e)):o._content)}const Ki=Q.define({combine:o=>o.join(" ")}),al=Q.define({combine:o=>o.indexOf(!0)>-1}),rl=lt.newName(),jo=lt.newName(),zo=lt.newName(),qo={"&light":"."+jo,"&dark":"."+zo};function dl(o,e,t){return new lt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return o;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):o+" "+i}})}const xh=dl("."+rl,{"&":{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:"#444"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},qo),vh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cl=q.ie&&q.ie_version<=11;class Ch{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new lc,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 i of t)this.queue.push(i);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new Nh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),cl&&(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,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Mi(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Zt(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Xt(e.root);if(!t)return!1;let i=q.safari&&e.root.nodeType==11&&ec(this.dom.ownerDocument)==this.dom&&Sh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Mi(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&oc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),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 i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,vh),cl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),cl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_t(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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,i=-1,l=!1;for(let s of e){let a=this.readMutation(s);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Mi(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 s=new jc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}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 i=this.view.state,l=bo(this.view,t);return this.view.state==i&&(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 i=Uo(t,e.previousSibling||e.target.previousSibling,-1),l=Uo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):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(at)!=e.state.facet(at)&&(e.view.contentDOM.editContext=e.state.facet(at)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.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 Uo(o,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==o)return i;let l=e.parentNode;e=l!=o.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Wo(o,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return Zt(a.node,a.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Sh(o,e){if(e.getComposedRanges){let l=e.getComposedRanges(o.root)[0];if(l)return Wo(o,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?Wo(o,t):null}class Nh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(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=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
10
- `))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||il(e,s,U.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let a=s.underlineStyle,r=s.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(we.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:to.of(we.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Xt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,a,r,d,c)=>{if(i)return;let h=c.length-(a-s);if(l&&a>=l.to)if(l.from==s&&l.to==a&&l.insert.eq(c)){l=this.pendingContextChange=null,t+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(s+=t,a+=t,a<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),c.toString()),this.to+=h}t+=h}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(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)}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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,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){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class J{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.composing>0}get compositionStarted(){return 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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||sc(e.parent)||document,this.viewState=new Ro(e.state||te.create(e)),e.scrollTo&&e.scrollTo.is(Pi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ni).map(l=>new Yn(l));for(let l of this.plugins)l.update(this);this.observer=new Ch(this),this.inputState=new Hc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ro(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 be?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,i=!1,l,s=this.state;for(let u of e){if(u.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=u.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,r=0,d=null;e.some(u=>u.annotation(To))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Ao(s,a),d||(r=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(te.phrases)!=this.state.facet(te.phrases))return this.setState(s);l=Fi.create(this,s,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:m}=u.state.selection;f=new At(m.empty?m:U.cursor(m.head,m.head>m.anchor?-1:1))}for(let m of u.effects)m.is(Pi)&&(f=m.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=Qi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(si)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Ki)!=l.state.facet(Ki)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let u of this.state.facet(Kn))try{u(l)}catch(m){ze(this.state,m,"update listener")}(d||h)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),h&&!bo(this,h)&&c.force&&_t(this.contentDOM,c.key,c.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 i of this.plugins)i.destroy(this);this.viewState=new Ro(e),this.plugins=e.facet(ni).map(i=>new Yn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new ro(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(ni),i=e.state.facet(ni);if(t!=i){let l=[];for(let s of i){let a=t.indexOf(s);if(a<0)l.push(new Yn(s));else{let r=this.plugins[a];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.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!=i&&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(i){ze(this.state,i,"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,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Ns(i))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(l);s=m.from,a=m.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!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 c=[];d&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(m=>{try{return m.read(this)}catch(y){return ze(this.state,y),Ho}}),f=Fi.create(this,this.state,[]),u=!1;f.flags|=d,t?t.flags|=d:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(h[m]!=Ho)try{let y=c[m];y.write&&y.write(h[m],this)}catch(y){ze(this.state,y)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let y=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(y>1||y<-1){l=l+y,i.scrollTop=l/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Kn))r(t)}get themeClasses(){return rl+" "+(this.state.facet(al)?zo:jo)+" "+this.state.facet(Ki)}updateAttrs(){let e=Ko(this,io,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(at)?"true":"false",class:"cm-content",style:`${q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ko(this,Xn,t);let i=this.observer.ignore(()=>{let l=Rn(this.contentDOM,this.contentAttrs,t),s=Rn(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(J.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(si);let e=this.state.facet(J.cspNonce);lt.mount(this.root,this.styleModules.concat(xh).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.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==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,i){return tl(this,e,go(this,e,t,i))}moveByGroup(e,t){return tl(this,e,go(this,e,t,i=>Fc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return U.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return Pc(this,e,t,i)}moveVertically(e,t,i){return tl(this,e,$c(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),po(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),a=s[ot.find(s,e-l.from,-1,t)];return Ai(i,a.dir==me.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(Zs)||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>Bh)return Ws(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Us(s.isolates,i=so(this,e))))return s.order;i||(i=so(this,e));let l=bc(e.text,t,i);return this.bidiCache.push(new Qi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{vs(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 Pi.of(new At(typeof e=="number"?U.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Pi.of(new At(U.cursor(i.from),"start","start",i.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 Et.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Et.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=lt.newName(),l=[Ki.of(i),si.of(dl(`.${i}`,e))];return t&&t.dark&&l.push(al.of(!0)),l}static baseTheme(e){return Ld.lowest(si.of(dl("."+rl,e,qo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&ne.get(i)||ne.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}J.styleModule=si,J.inputHandler=Xs,J.clipboardInputFilter=Qn,J.clipboardOutputFilter=Gn,J.scrollHandler=eo,J.focusChangeEffect=Js,J.perLineTextDirection=Zs,J.exceptionSink=Ys,J.updateListener=Kn,J.editable=at,J.mouseSelectionStyle=Gs,J.dragMovesSelection=Qs,J.clickAddsSelectionRange=Ks,J.decorations=li,J.outerDecorations=no,J.atomicRanges=Jn,J.bidiIsolatedRanges=lo,J.scrollMargins=oo,J.darkTheme=al,J.cspNonce=Q.define({combine:o=>o.length?o[0]:""}),J.contentAttributes=Xn,J.editorAttributes=io,J.lineWrapping=J.contentAttributes.of({class:"cm-lineWrapping"}),J.announce=ce.define();const Bh=4096,Ho={};class Qi{constructor(e,t,i,l,s,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=a}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let a=e[s];a.dir==l&&!t.touchesRange(a.from,a.to)&&i.push(new Qi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Ko(o,e,t){for(let i=o.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],a=typeof s=="function"?s(o):s;a&&$n(a,t)}return t}const Oh=!q.ios,Qo={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Oh&&(Qo[".cm-line"].caretColor=Qo[".cm-content"].caretColor="transparent !important");class Dt extends Bt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Dt.prototype.elementClass="",Dt.prototype.toDOM=void 0,Dt.prototype.mapMode=Be.TrackBefore,Dt.prototype.startSide=Dt.prototype.endSide=-1,Dt.prototype.point=!0;var hl;const Pt=new Y;function Vh(o){return Q.define({combine:o?e=>e.concat(o):void 0})}const _h=new Y;class De{constructor(e,t,i=[],l=""){this.data=e,this.name=l,te.prototype.hasOwnProperty("tree")||Object.defineProperty(te.prototype,"tree",{get(){return fl(this)}}),this.parser=t,this.extension=[$t.of(this),te.languageData.of((s,a,r)=>{let d=Go(s,a,r),c=d.type.prop(Pt);if(!c)return[];let h=s.facet(c),f=d.type.prop(_h);if(f){let u=d.resolve(a-d.from,r);for(let m of f)if(m.test(u,s)){let y=s.facet(m.facet);return m.type=="replace"?y:y.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return Go(e,t,i).type.prop(Pt)==this.data}findRegions(e){let t=e.facet($t);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,a)=>{if(s.prop(Pt)==this.data){i.push({from:a,to:a+s.length});return}let r=s.prop(Y.mounted);if(r){if(r.tree.prop(Pt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+a,to:d.to+a});else i.push({from:a,to:a+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<s.children.length;d++){let c=s.children[d];c instanceof re&&l(c,s.positions[d]+a)}};return l(fl(e),0),i}get allowsNesting(){return!0}}De.setState=ce.define();function Go(o,e,t){let i=o.facet($t),l=fl(o).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Gi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Vh(e.languageData);return new Gi(t,e.parser.configure({props:[Pt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Gi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fl(o){let e=o.field(De.state,!1);return e?e.tree:re.empty}class Mh{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 i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let ri=null;class Yi{constructor(e,t,i=[],l,s,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Yi(e,t,[],re.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Mh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=re.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;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(ht.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i: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(ht.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ri;ri=this;try{return e()}finally{ri=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Yo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((c,h,f,u)=>d.push({fromA:c,toA:h,fromB:f,toB:u})),i=ht.applyChanges(i,d),l=re.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);h<f&&r.push({from:h,to:f})}}}return new Yi(this.parser,t,i,l,s,a,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 i=0;i<this.skipped.length;i++){let{from:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Yo(this.fragments,l,s),this.skipped.splice(i--,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 Il{createParse(t,i,l){let s=l[0].from,a=l[l.length-1].to;return{parsedPos:s,advance(){let d=ri;if(d){for(let c of l)d.tempSkipped.push(c);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new re(Ce.none,[],[],a-s)},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 ri}}function Yo(o,e,t){return ht.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ft{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ft(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Yi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ft(i)}}De.state=pt.define({create:Ft.init,update(o,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Ft.init(e.state):o.apply(e)}});let Xo=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Xo=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ul=typeof navigator<"u"&&(!((hl=navigator.scheduling)===null||hl===void 0)&&hl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Th=Et.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(De.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(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Xo(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:i,viewport:{to:l}}=this.view,s=i.field(De.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!ul?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>ul&&ul()||Date.now()>a,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Ft(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ze(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()}}}),$t=Q.define({combine(o){return o.length?o[0]:null},enables:o=>[De.state,Th,J.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Ah{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Eh=new Y;function Jo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ih=new Y;function Dh(o){let e=o.firstChild,t=o.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?o.to:t.from}:null}class pl{constructor(e,t){this.specs=e;let i;function l(r){let d=lt.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof De?r=>r.prop(Pt)==a.data:a?r=>r==a:void 0,this.style=zl(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new lt(i):null,this.themeType=t.themeType}static define(e,t){return new pl(e,t||{})}}$.meta,$.link,$.heading,$.emphasis,$.strong,$.strikethrough,$.keyword,$.atom,$.bool,$.url,$.contentSeparator,$.labelName,$.literal,$.inserted,$.string,$.deleted,$.regexp,$.escape,$.string,$.variableName,$.variableName,$.typeName,$.namespace,$.className,$.variableName,$.macroName,$.propertyName,$.comment,$.invalid;const Ph=Object.create(null),Zo=[Ce.none],ea=[],ta=Object.create(null),Fh=Object.create(null);for(let[o,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"]])Fh[o]=$h(Ph,e);function ml(o,e){ea.indexOf(o)>-1||(ea.push(o),console.warn(e))}function $h(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let c of r.split(".")){let h=o[c]||$[c];h?typeof h=="function"?d.length?d=d.map(h):ml(c,`Modifier ${c} used at start of tag`):d.length?ml(c,`Tag ${c} used as modifier`):d=Array.isArray(h)?h:[h]:ml(c,`Unknown highlighting tag ${c}`)}for(let c of d)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ta[l];if(s)return s.id;let a=ta[l]=Ce.define({id:Zo.length,name:i,props:[jl({[i]:t})]});return Zo.push(a),a.id}me.RTL,me.LTR;const Rh=Gi.define({name:"json",parser:Id.configure({props:[Eh.add({Object:Jo({except:/^\s*\}/}),Array:Jo({except:/^\s*\]/})}),Ih.add({"Object Array":Dh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Lh(){return new Ah(Rh)}const gl=[{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 jh(){const o=Ae();if(o.formRules?.length){const e={};gl.forEach(i=>{e[i.name]=i});const t=[...gl];return o.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return gl}const zh={loadAdvances:jh},qh={class:"unione-props-setting data-field-setting"},Uh={key:0},Wh=["onClick"],Hh={class:"field-txt"},Kh=["onClick"],Qh={key:1,class:"field-txt"},Gh=["onClick"],Yh={key:0,class:"field-txt"},Xh={key:3,class:"edit-field"},Jh=["onClick"],Zh=ee(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([Lh()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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"}]),i=n.useModel(o,"modelValue"),l={mounted:g=>g.focus()},s=n.ref({});function a(){const g=Object.keys(s.value);if(g.length)for(let p in g){const S=i.value.filter(_=>_.name==p);if(S&&S[0]){let _=s.value[p];Object.keys(_).forEach(C=>{C=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[C]):S[0][C]=_[C]})}}s.value={}}function r(g,p){a();const S={};p=="convertName"?(g.convert||(g.convert={}),S[p]=g.convert?.type):S[p]=g[p]||"",s.value[g.name]=S}function d(g,p){{s.value={};return}}function c(g,p){switch(p){case"query":return g.configs?.query?.enable;case"form":return g.configs?.show?.form?.enable;case"view":return g.configs?.show?.view?.enable;case"list":return g.configs?.show?.list?.enable;case"sort":return g.configs?.sort?.enable}}function h(g,p){switch(p){case"query":g.configs=H.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=H.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=H.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=H.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=H.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function u(g,p){switch(f.value.prop=p,f.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),p){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),f.value.show=g.configs.query,f.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),f.value.show=g.configs.show.form,f.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),f.value.show=g.configs.show.view,f.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),f.value.show=g.configs.show.list,f.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),f.value.show=g.configs.sort,f.value.title=`排序设置/${g.title}(${g.name})`;break}f.value.visible=!0}const m=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:g=>{const p=m.value.options.filter(S=>S.value==g);return p[0]?p[0].label:g}}),y=n.ref({visible:!1,field:{},props:{},advances:zh.loadAdvances(),showInfo:g=>{let p=0;if(g.configs?.rule){const S=g.configs.rule;S.advance&&p++,typeof S.rangeMin<"u"&&p++,typeof S.rangeMax<"u"&&p++,typeof S.regExpress<"u"&&p++}if(p>0)return"("+p+")"},toSetting:()=>{const g=y.value.props;y.value.field.configs=H.utils.obj.ext(y.value.field.configs,{rule:{...g}}),y.value.visible=!1,y.value.props={}}});function k(g){y.value.visible=!0,y.value.field=g,y.value.props=g.configs?.rule||{}}const x=n.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:g=>{const p=g.configs?.widget?.name,S=x.value.widgets.filter(_=>_.value==p);return S[0]?S[0].label:p},toSetting:(g,p)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=p},toclose:()=>{x.value.visible=!1}});function w(g){x.value.field=g,g.configs=H.utils.obj.ext(g.configs,{widget:{props:{}}}),x.value.widget=g.configs.widget,x.value.visible=!0}const v=n.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:(g,p="--")=>v.value.types.filter(S=>S.value==g)[0]?.label||p,toAddOption:()=>{v.value.convert.options||(v.value.convert.options=[]),v.value.convert.options.push({label:"",value:""})},toDelOption:(g,p)=>{v.value.convert.options.splice(g,1)},toSetting:()=>{v.value.visible=!1}});function O(g){v.value.visible=!0,v.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),v.value.convert=g.configs.convert}return(g,p)=>{const S=n.resolveComponent("ToolOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),b=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table"),A=n.resolveComponent("a-switch"),V=n.resolveComponent("a-form-item"),F=n.resolveComponent("a-select-option"),E=n.resolveComponent("a-input-number"),M=n.resolveComponent("a-form"),P=n.resolveComponent("a-modal"),T=n.resolveComponent("a-input"),D=n.resolveComponent("unione-select-box"),W=n.resolveComponent("a-checkbox-group"),R=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",qh,[n.createVNode(B,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:N})=>[["widget","queryType","rules","convertName"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",Uh,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:K,record:I})=>[["rules"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!y.value.showInfo(I)&&"empty"]),onClick:z=>k(I)},[n.createElementVNode("span",Hh,n.toDisplayString(y.value.showInfo(I)),1),y.value.showInfo(I)?(n.openBlock(),n.createBlock(_,{key:0,type:"link"},{default:n.withCtx(()=>p[50]||(p[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Wh)):["widget"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(N.dataIndex))&&!K&&"empty"]),onClick:z=>r(I,N.dataIndex)},[s.value[I.name]&&Object.keys(s.value[I.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:I.configs?.widget?.name,allowClear:!0,options:x.value.widgets,onChange:z=>x.value.toSetting(I,z),onBlur:p[0]||(p[0]=z=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Qh,n.toDisplayString(x.value.widgetName(I)),1)),n.createVNode(_,{type:"link",onClick:n.withModifiers(z=>w(I),["stop"])},{default:n.withCtx(()=>p[51]||(p[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Kh)):["convertName"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(N.dataIndex))&&!I.convert?.type&&"empty"]),onClick:z=>O(I)},[I.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Yh,n.toDisplayString(v.value.getTypes(I.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Gh)):["query","form","view","list","sort"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",Xh,[n.createVNode(b,{checked:c(I,N.dataIndex),onClick:z=>h(I,N.dataIndex)},null,8,["checked","onClick"]),n.createVNode(_,{type:"link",onClick:z=>u(I,N.dataIndex)},{default:n.withCtx(()=>p[52]||(p[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(P,{visible:f.value.visible,"onUpdate:visible":p[14]||(p[14]=N=>f.value.visible=N),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:n.withCtx(()=>[n.createVNode(V,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.enable,"onUpdate:checked":p[1]||(p[1]=N=>f.value.show.enable=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":p[2]||(p[2]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.asc,"onUpdate:checked":p[3]||(p[3]=N=>f.value.show.asc=N),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(V,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.defoult,"onUpdate:checked":p[4]||(p[4]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.show.visible,"onUpdate:checked":p[5]||(p[5]=N=>f.value.show.visible=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.types,"onUpdate:value":p[6]||(p[6]=N=>f.value.show.types=N)},{default:n.withCtx(()=>[n.createVNode(F,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>p[53]||(p[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(F,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>p[54]||(p[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(F,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>p[55]||(p[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(F,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>p[56]||(p[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(F,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>p[57]||(p[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(F,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>p[58]||(p[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(E,{value:f.value.show.index,"onUpdate:value":p[7]||(p[7]=N=>f.value.show.index=N)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(E,{min:0,max:24,value:f.value.show.width,"onUpdate:value":p[8]||(p[8]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(E,{min:0,value:f.value.show.width,"onUpdate:value":p[9]||(p[9]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(E,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":p[10]||(p[10]=N=>f.value.show.labelWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(E,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":p[11]||(p[11]=N=>f.value.show.valueWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":p[12]||(p[12]=N=>f.value.show.fixed=N),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.align,"onUpdate:value":p[13]||(p[13]=N=>f.value.show.align=N),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(P,{visible:v.value.visible,"onUpdate:visible":p[33]||(p[33]=N=>v.value.visible=N),width:600,title:v.value.getTypes(v.value.convert.types,"转换")+"设置",onOk:v.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:v.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:v.value.convert.types,"onUpdate:value":p[15]||(p[15]=N=>v.value.convert.types=N),allowClear:!0,options:v.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(A,{checked:f.value.convert.search,"onUpdate:checked":p[16]||(p[16]=N=>f.value.convert.search=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="option"?(n.openBlock(),n.createBlock(V,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:v.value.toAddOption},{default:n.withCtx(()=>p[59]||(p[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(B,{columns:v.value.optionColumn,"data-source":v.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:N,record:K,index:I})=>[N.dataIndex==="label"?(n.openBlock(),n.createBlock(T,{key:0,value:K.label,"onUpdate:value":z=>K.label=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="value"?(n.openBlock(),n.createBlock(T,{key:1,value:K.value,"onUpdate:value":z=>K.value=z,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:z=>v.value.toDelOption(I,K)},"删除",8,Jh)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(D,{value:v.value.convert.dsId,"onUpdate:value":p[17]||(p[17]=N=>v.value.convert.dsId=N),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableName,"onUpdate:value":p[18]||(p[18]=N=>v.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableName,"onUpdate:value":p[19]||(p[19]=N=>v.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.idField,"onUpdate:value":p[20]||(p[20]=N=>v.value.convert.idField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.pidField,"onUpdate:value":p[21]||(p[21]=N=>v.value.convert.pidField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.valueField,"onUpdate:value":p[22]||(p[22]=N=>v.value.convert.valueField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.labelField,"onUpdate:value":p[23]||(p[23]=N=>v.value.convert.labelField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableField,"onUpdate:value":p[24]||(p[24]=N=>v.value.convert.tableField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableWhere,"onUpdate:value":p[25]||(p[25]=N=>v.value.convert.tableWhere=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableOrder,"onUpdate:value":p[26]||(p[26]=N=>v.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.tableOrder,"onUpdate:value":p[27]||(p[27]=N=>v.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:v.value.convert.isAsync,"onUpdate:checked":p[28]||(p[28]=N=>v.value.convert.isAsync=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(A,{checked:v.value.convert.isPaging,"onUpdate:checked":p[29]||(p[29]=N=>v.value.convert.isPaging=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dict"?(n.openBlock(),n.createBlock(V,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.dictName,"onUpdate:value":p[30]||(p[30]=N=>v.value.convert.dictName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(T,{value:v.value.convert.url,"onUpdate:value":p[31]||(p[31]=N=>v.value.convert.url=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:v.value.convert.params,"onUpdate:modelValue":p[32]||(p[32]=N=>v.value.convert.params=N),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})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(P,{visible:x.value.visible,"onUpdate:visible":p[40]||(p[40]=N=>x.value.visible=N),width:600,title:"控件设置",onOk:x.value.toclose},{default:n.withCtx(()=>[n.createVNode(M,{model:x.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:x.value.widget.name,"onUpdate:value":p[34]||(p[34]=N=>x.value.widget.name=N),allowClear:!0,options:x.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(V,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(T,{value:x.value.widget.placeholder,"onUpdate:value":p[35]||(p[35]=N=>x.value.widget.placeholder=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(T,{value:x.value.widget.help,"onUpdate:value":p[36]||(p[36]=N=>x.value.widget.help=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(T,{value:x.value.widget.tooltip,"onUpdate:value":p[37]||(p[37]=N=>x.value.widget.tooltip=N)},null,8,["value"])]),_:1}),["a-date-picker"].includes(x.value.widget.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(T,{value:x.value.field.dataFormat,"onUpdate:value":p[38]||(p[38]=N=>x.value.field.dataFormat=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(V,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:x.value.widget.props.mode,"onUpdate:value":p[39]||(p[39]=N=>x.value.widget.props.mode=N),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(F,{value:"multiple"},{default:n.withCtx(()=>p[60]||(p[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(F,{value:"tags"},{default:n.withCtx(()=>p[61]||(p[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(P,{visible:y.value.visible,"onUpdate:visible":p[49]||(p[49]=N=>y.value.visible=N),width:600,title:"规则设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[n.createVNode(M,{model:y.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(R,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(W,{value:y.value.props.trigger,"onUpdate:value":p[41]||(p[41]=N=>y.value.props.trigger=N),options:["change","blur"]},null,8,["value"])]),_:1}),y.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(b,{checked:y.value.props.whitespace,"onUpdate:checked":p[42]||(p[42]=N=>y.value.props.whitespace=N)},{default:n.withCtx(()=>p[62]||(p[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(V,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:y.value.advances,fieldNames:{label:"title",value:"name"},value:y.value.props.advance,"onUpdate:value":p[43]||(p[43]=N=>y.value.props.advance=N)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(y.value.field.dataType)?(n.openBlock(),n.createBlock(R,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(E,{value:y.value.props.rangeMin,"onUpdate:value":p[44]||(p[44]=N=>y.value.props.rangeMin=N)},null,8,["value"]),p[63]||(p[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(E,{value:y.value.props.rangeMax,"onUpdate:value":p[45]||(p[45]=N=>y.value.props.rangeMax=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(T,{value:y.value.props.rangeMessage,"onUpdate:value":p[46]||(p[46]=N=>y.value.props.rangeMessage=N)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode(R,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(T,{value:y.value.props.regExpress,"onUpdate:value":p[47]||(p[47]=N=>y.value.props.regExpress=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(T,{value:y.value.props.regMessage,"onUpdate:value":p[48]||(p[48]=N=>y.value.props.regMessage=N)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),ef={class:"unione-props-setting data-field-fkey"},tf={key:0},nf=["onClick"],lf=["onClick"],sf=["onClick"],of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=ee(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=H.useDialog(),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"35px",fixed:"left",align:"center",customRender:({index:u})=>u+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"}]),i=n.useModel(o,"modelValue"),l=n.computed(()=>i.value.filter(u=>u.configs?.fkey?.enable)||[]),s=n.ref({});function a(){s.value={}}function r(u,m){a();const y={};y[m]=u.configs.fkey[m]||"",s.value[u.name]=y}function d(u,m,y){u.configs.fkey.dsn=m,u.configs.fkey.dsnName=y.name,u.configs.fkey.dsnTitle=y.title,u.configs.fkey.dsnId=y.id}function c(u,m,y,k){u.configs.fkey[m]=y,m=="fieldName"&&(u.configs.fkey.fieldTitle=k.title),m=="labelName"&&(u.configs.fkey.labelTitle=k.title)}function h(u){f.value.record=u,f.value.visible=!0,f.value.fields=u.configs?.fkey?.fields||[]}const f=n.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:(u,m)=>{f.value.editField[u]=m},onShowFieldChange:(u,m,y)=>{u.name=y.name,u.title=y.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:u=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(u,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=H.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(u,m)=>{const y=n.resolveComponent("FormOutlined"),k=n.resolveComponent("unione-select-box"),x=n.resolveComponent("a-button"),w=n.resolveComponent("a-table"),v=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",ef,[n.createVNode(w,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(n.openBlock(),n.createElementBlock("span",tf,[n.createVNode(y),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:p})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":S=>s.value[p.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(S,_)=>d(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnName),1)],64))],10,nf)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(p,g.dataIndex)},[s.value[p.name]&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":S=>s.value[p.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(S,_)=>d(p,S,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.dsnTitle),1)],64))],10,lf)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":S=>s.value[p.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(p,"fieldName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.fieldTitle),1)],64))],10,sf)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[p.name]||!Object.keys(s.value[p.name]).includes(g.dataIndex))&&!p.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(p,g.dataIndex)},[s.value[p.name]&&p.configs?.fkey?.dsn&&Object.keys(s.value[p.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[p.name][g.dataIndex],"onUpdate:value":S=>s.value[p.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:p.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(p,"labelName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(p.configs?.fkey?.labelTitle)+" ",1),p.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(x,{key:0,type:"link",onClick:n.withModifiers(S=>h(p),["stop"])},{default:n.withCtx(()=>m[4]||(m[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,of)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:f.value.visible,"onUpdate:visible":m[3]||(m[3]=g=>f.value.visible=g),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(x,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:n.withCtx(()=>m[5]||(m[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(w,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:p,index:S,text:_})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="title"?(n.openBlock(),n.createBlock(k,{key:0,value:p[p.dataIndex],"onUpdate:value":C=>p[p.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:m[0]||(m[0]=C=>f.value.editField={}),onSelect:(C,b)=>f.value.onShowFieldChange(p,C,b)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,af)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="width"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:m[1]||(m[1]=C=>f.value.editField={}),value:p.width,"onUpdate:value":C=>p.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,rf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="index"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:m[2]||(m[2]=C=>f.value.editField={}),value:p.index,"onUpdate:value":C=>p.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,df)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(S)},"删除",8,cf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),ff={class:"unione-props-setting data-filter"},uf={class:"title"},pf={class:"name"},mf={class:"action"},gf=ee(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=H.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(c){r.value.visible=!0,r.value.filter={...c},r.value.name=c.name}function s(c){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(c,1)}})}const a=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{a.value.validate().then(c=>{if(r.value.name){const h=t.value.filter(f=>f.name==r.value.name)[0];if(!h){e.error({content:"过滤记录未找到"});return}if(r.value.name!=r.value.filter.name&&t.value.filter(u=>u.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}Object.keys(c).forEach(f=>{h[f]=c[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(c)}r.value.visible=!1})}});function d(){const c=[];r.value.filter.filter||(r.value.filter.filter=""),c.push("-- @if(isNotEmpty(params."),c.push(r.value.filter.name||"xxx"),c.push(") && !isBlank(params."),c.push(r.value.filter.name||"xxx"),c.push(`)
7
+ `;this.styleTag.textContent=a;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 Ot={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:"'"},Mn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pe=0;pe<10;pe++)Ot[48+pe]=Ot[96+pe]=String(pe);for(var pe=1;pe<=24;pe++)Ot[pe+111]="F"+pe;for(var pe=65;pe<=90;pe++)Ot[pe]=String.fromCharCode(pe+32),Mn[pe]=String.fromCharCode(pe);for(var Tn in Ot)Mn.hasOwnProperty(Tn)||(Mn[Tn]=Ot[Tn]);function Xt(o){let e;return o.nodeType==11?e=o.getSelection?o:o.ownerDocument:e=o,e.getSelection()}function An(o,e){return e?o==e||o.contains(e.nodeType!=1?e.parentNode:e):!1}function ec(o){let e=o.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Mi(o,e){if(!e.anchorNode)return!1;try{return An(o,e.anchorNode)}catch{return!1}}function Jt(o){return o.nodeType==3?kt(o,0,o.nodeValue.length).getClientRects():o.nodeType==1?o.getClientRects():[]}function Zt(o,e,t,i){return t?ws(o,e,t,i,-1)||ws(o,e,t,i,1):!1}function gt(o){for(var e=0;;e++)if(o=o.previousSibling,!o)return e}function Ti(o){return o.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(o.nodeName)}function ws(o,e,t,i,l){for(;;){if(o==t&&e==i)return!0;if(e==(l<0?0:Ye(o))){if(o.nodeName=="DIV")return!1;let s=o.parentNode;if(!s||s.nodeType!=1)return!1;e=gt(o)+(l<0?0:1),o=s}else if(o.nodeType==1){if(o=o.childNodes[e+(l<0?-1:0)],o.nodeType==1&&o.contentEditable=="false")return!1;e=l<0?Ye(o):0}else return!1}}function Ye(o){return o.nodeType==3?o.nodeValue.length:o.childNodes.length}function Ai(o,e){let t=e?o.left:o.right;return{left:t,right:t,top:o.top,bottom:o.bottom}}function tc(o){let e=o.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:o.innerWidth,top:0,bottom:o.innerHeight}}function xs(o,e){let t=e.width/o.offsetWidth,i=e.height/o.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-o.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-o.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function ic(o,e,t,i,l,s,a,r){let d=o.ownerDocument,c=d.defaultView||window;for(let h=o,f=!1;h&&!f;)if(h.nodeType==1){let p,u=h==d.body,y=1,k=1;if(u)p=tc(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(f=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let v=h.getBoundingClientRect();({scaleX:y,scaleY:k}=xs(h,v)),p={left:v.left,right:v.left+h.clientWidth*y,top:v.top,bottom:v.top+h.clientHeight*k}}let x=0,w=0;if(l=="nearest")e.top<p.top?(w=-(p.top-e.top+a),t>0&&e.bottom>p.bottom+w&&(w=e.bottom-p.bottom+w+a)):e.bottom>p.bottom&&(w=e.bottom-p.bottom+a,t<0&&e.top-w<p.top&&(w=-(p.top+w-e.top+a)));else{let v=e.bottom-e.top,O=p.bottom-p.top;w=(l=="center"&&v<=O?e.top+v/2-O/2:l=="start"||l=="center"&&t<0?e.top-a:e.bottom-O+a)-p.top}if(i=="nearest"?e.left<p.left?(x=-(p.left-e.left+s),t>0&&e.right>p.right+x&&(x=e.right-p.right+x+s)):e.right>p.right&&(x=e.right-p.right+s,t<0&&e.left<p.left+x&&(x=-(p.left+x-e.left+s))):x=(i=="center"?e.left+(e.right-e.left)/2-(p.right-p.left)/2:i=="start"==r?e.left-s:e.right-(p.right-p.left)+s)-p.left,x||w)if(u)c.scrollBy(x,w);else{let v=0,O=0;if(w){let g=h.scrollTop;h.scrollTop+=w/k,O=(h.scrollTop-g)*k}if(x){let g=h.scrollLeft;h.scrollLeft+=x/y,v=(h.scrollLeft-g)*y}e={left:e.left-v,top:e.top-O,right:e.right-v,bottom:e.bottom-O},v&&Math.abs(v-x)<1&&(i="nearest"),O&&Math.abs(O-w)<1&&(l="nearest")}if(u)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function nc(o){let e=o.ownerDocument,t,i;for(let l=o.parentNode;l&&!(l==e.body||t&&i);)if(l.nodeType==1)!i&&l.scrollHeight>l.clientHeight&&(i=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:i}}class lc{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:i}=e;this.set(t,Math.min(e.anchorOffset,t?Ye(t):0),i,Math.min(e.focusOffset,i?Ye(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}let Vt=null;function vs(o){if(o.setActive)return o.setActive();if(Vt)return o.focus(Vt);let e=[];for(let t=o;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(o.focus(Vt==null?{get preventScroll(){return Vt={preventScroll:!0},!0}}:void 0),!Vt){Vt=!1;for(let t=0;t<e.length;){let i=e[t++],l=e[t++],s=e[t++];i.scrollTop!=l&&(i.scrollTop=l),i.scrollLeft!=s&&(i.scrollLeft=s)}}}let Cs;function kt(o,e,t=e){let i=Cs||(Cs=document.createRange());return i.setEnd(o,t),i.setStart(o,e),i}function _t(o,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let s=new KeyboardEvent("keydown",l);s.synthetic=!0,o.dispatchEvent(s);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,o.dispatchEvent(a),s.defaultPrevented||a.defaultPrevented}function sc(o){for(;o;){if(o&&(o.nodeType==9||o.nodeType==11&&o.host))return o;o=o.assignedSlot||o.parentNode}return null}function Ss(o){for(;o.attributes.length;)o.removeAttributeNode(o.attributes[0])}function oc(o,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Ye(t));;)if(i){if(t.nodeType!=1)return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=Ye(t))}else{if(t==o)return!0;i=gt(t),t=t.parentNode}}function Ns(o){return o.scrollTop>Math.max(1,o.scrollHeight-o.clientHeight-4)}function Bs(o,e){for(let t=o,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Ye(t)}else if(t.parentNode&&!Ti(t))i=gt(t),t=t.parentNode;else return null}}function Os(o,e){for(let t=o,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!Ti(t))i=gt(t)+1,t=t.parentNode;else return null}}class ye{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ye(e.parentNode,gt(e),t)}static after(e,t){return new ye(e.parentNode,gt(e)+1,t)}}const En=[];class ne{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 i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,l=null,s;for(let a of this.children){if(a.flags&7){if(!a.dom&&(s=l?l.nextSibling:i.firstChild)){let r=ne.get(s);(!r||!r.parent&&r.canReuseDOM(a))&&a.reuseDOM(s)}a.sync(e,t),a.flags&=-8}if(s=l?l.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&s!=a.dom&&(t.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=Vs(s);else i.insertBefore(a.dom,s);l=a.dom}for(s=l?l.nextSibling:i.firstChild,s&&t&&t.node==i&&(t.written=!0);s;)s=Vs(s)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let l=Ye(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;l==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?l=-1:l=1),e=s}l<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ne.get(i);)i=i.nextSibling;if(!i)return this.length;for(let l=0,s=0;;l++){let a=this.children[l];if(a.dom==i)return s;s+=a.length+a.breakAfter}}domBoundsAround(e,t,i=0){let l=-1,s=-1,a=-1,r=-1;for(let d=0,c=i,h=i;d<this.children.length;d++){let f=this.children[d],p=c+f.length;if(c<e&&p>t)return f.domBoundsAround(e,t,c);if(p>=e&&l==-1&&(l=d,s=c),c>t&&f.dom.parentNode==this.dom){a=d,r=h;break}h=p,c=p+f.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(l?this.children[l-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a<this.children.length&&a>=0?this.children[a].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,i=En){this.markDirty();for(let l=e;l<t;l++){let s=this.children[l];s.parent==this&&i.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...i);for(let l=0;l<i.length;l++)i[l].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new _s(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,i,l,s,a){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}}ne.prototype.breakAfter=0;function Vs(o){let e=o.nextSibling;return o.parentNode.removeChild(o),e}class _s{constructor(e,t,i){this.children=e,this.pos=t,this.i=i,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 i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function Ms(o,e,t,i,l,s,a,r,d){let{children:c}=o,h=c.length?c[e]:null,f=s.length?s[s.length-1]:null,p=f?f.breakAfter:a;if(!(e==i&&h&&!a&&!p&&s.length<2&&h.merge(t,l,s.length?f:null,t==0,r,d))){if(i<c.length){let u=c[i];u&&(l<u.length||u.breakAfter&&f?.breakAfter)?(e==i&&(u=u.split(l),l=0),!p&&f&&u.merge(0,l,f,!0,0,d)?s[s.length-1]=u:((l||u.children.length&&!u.children[0].length)&&u.merge(0,l,null,!1,0,d),s.push(u))):u?.breakAfter&&(f?f.breakAfter=1:a=1),i++}for(h&&(h.breakAfter=a,t>0&&(!a&&s.length&&h.merge(t,h.length,s[0],!1,r,0)?h.breakAfter=s.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,r,0),e++));e<i&&s.length;)if(c[i-1].become(s[s.length-1]))i--,s.pop(),d=s.length?0:r;else if(c[e].become(s[0]))e++,s.shift(),r=s.length?0:d;else break;!s.length&&e&&i<c.length&&!c[e-1].breakAfter&&c[i].merge(0,0,c[e-1],!1,r,d)&&e--,(e<i||s.length)&&o.replaceChildren(e,i,s)}}function Ts(o,e,t,i,l,s){let a=o.childCursor(),{i:r,off:d}=a.findPos(t,1),{i:c,off:h}=a.findPos(e,-1),f=e-t;for(let p of i)f+=p.length;o.length+=f,Ms(o,c,h,r,d,i,0,l,s)}let Se=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},In=typeof document<"u"?document:{documentElement:{style:{}}};const Dn=/Edge\/(\d+)/.exec(Se.userAgent),As=/MSIE \d/.test(Se.userAgent),Pn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Se.userAgent),Ei=!!(As||Pn||Dn),Es=!Ei&&/gecko\/(\d+)/i.test(Se.userAgent),Fn=!Ei&&/Chrome\/(\d+)/.exec(Se.userAgent),Is="webkitFontSmoothing"in In.documentElement.style,Ds=!Ei&&/Apple Computer/.test(Se.vendor),Ps=Ds&&(/Mobile\/\w+/.test(Se.userAgent)||Se.maxTouchPoints>2);var U={mac:Ps||/Mac/.test(Se.platform),windows:/Win/.test(Se.platform),linux:/Linux|X11/.test(Se.platform),ie:Ei,ie_version:As?In.documentMode||6:Pn?+Pn[1]:Dn?+Dn[1]:0,gecko:Es,gecko_version:Es?+(/Firefox\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,chrome:!!Fn,chrome_version:Fn?+Fn[1]:0,ios:Ps,android:/Android\b/.test(Se.userAgent),webkit:Is,safari:Ds,webkit_version:Is?+(/\bAppleWebKit\/(\d+)/.exec(Se.userAgent)||[0,0])[1]:0,tabSize:In.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const ac=256;class Ee extends ne{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,i){return this.flags&8||i&&(!(i instanceof Ee)||this.length-(t-e)+i.length>ac||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ee(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 ye(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return rc(this.dom,e,t)}}class Xe extends ne{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let l of t)l.setParent(this)}setAttrs(e){if(Ss(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,i,l,s,a){return i&&(!(i instanceof Xe&&i.mark.eq(this.mark))||e&&s<=0||t<this.length&&a<=0)?!1:(Ts(this,e,t,i?i.children.slice():[],s-1,a-1),this.markDirty(),!0)}split(e){let t=[],i=0,l=-1,s=0;for(let r of this.children){let d=i+r.length;d>e&&t.push(i<e?r.split(e-i):r),l<0&&i>=e&&(l=s),i=d,s++}let a=this.length-e;return this.length=e,l>-1&&(this.children.length=l,this.markDirty()),new Xe(this.mark,t,a)}domAtPos(e){return Fs(this,e)}coordsAt(e,t){return Rs(this,e,t)}}function rc(o,e,t){let i=o.nodeValue.length;e>i&&(e=i);let l=e,s=e,a=0;e==0&&t<0||e==i&&t>=0?U.chrome||U.gecko||(e?(l--,a=1):s<i&&(s++,a=-1)):t<0?l--:s<i&&s++;let r=kt(o,l,s).getClientRects();if(!r.length)return null;let d=r[(a?a<0:t>=0)?0:r.length-1];return U.safari&&!a&&d.width==0&&(d=Array.prototype.find.call(r,c=>c.width)||d),a?Ai(d,a<0):d||null}class bt extends ne{static create(e,t,i){return new bt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=bt.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,i,l,s,a){return i&&(!(i instanceof bt)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}become(e){return e instanceof bt&&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 X.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,i=t&&t.state.doc,l=this.posAtStart;return i?i.slice(l,l+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?ye.before(this.dom):ye.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let l=this.dom.getClientRects(),s=null;if(!l.length)return null;let a=this.side?this.side<0:e>0;for(let r=a?l.length-1:0;s=l[r],!(e>0?r==0:r==l.length-1||s.top<s.bottom);r+=a?-1:1);return Ai(s,!a)}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 Mt extends ne{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof Mt&&e.side==this.side}split(){return new Mt(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?ye.before(this.dom):ye.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}}Ee.prototype.children=bt.prototype.children=Mt.prototype.children=En;function Fs(o,e){let t=o.dom,{children:i}=o,l=0;for(let s=0;l<i.length;l++){let a=i[l],r=s+a.length;if(!(r==s&&a.getSide()<=0)){if(e>s&&e<r&&a.dom.parentNode==t)return a.domAtPos(e-s);if(e<=s)break;s=r}}for(let s=l;s>0;s--){let a=i[s-1];if(a.dom.parentNode==t)return a.domAtPos(a.length)}for(let s=l;s<i.length;s++){let a=i[s];if(a.dom.parentNode==t)return a.domAtPos(0)}return new ye(t,0)}function $s(o,e,t){let i,{children:l}=o;t>0&&e instanceof Xe&&l.length&&(i=l[l.length-1])instanceof Xe&&i.mark.eq(e.mark)?$s(i,e.children[0],t-1):(l.push(e),e.setParent(o)),o.length+=e.length}function Rs(o,e,t){let i=null,l=-1,s=null,a=-1;function r(c,h){for(let f=0,p=0;f<c.children.length&&p<=h;f++){let u=c.children[f],y=p+u.length;y>=h&&(u.children.length?r(u,h-p):(!s||s.isHidden&&t>0)&&(y>h||p==y&&u.getSide()>0)?(s=u,a=h-p):(p<h||p==y&&u.getSide()<0&&!u.isHidden)&&(i=u,l=h-p)),p=y}}r(o,e);let d=(t<0?i:s)||i||s;return d?d.coordsAt(Math.max(0,d==i?l:a),t):dc(o)}function dc(o){let e=o.dom.lastChild;if(!e)return o.dom.getBoundingClientRect();let t=Jt(e);return t[t.length-1]||null}function $n(o,e){for(let t in o)t=="class"&&e.class?e.class+=" "+o.class:t=="style"&&e.style?e.style+=";"+o.style:e[t]=o[t];return e}const Ls=Object.create(null);function Ii(o,e,t){if(o==e)return!0;o||(o=Ls),e||(e=Ls);let i=Object.keys(o),l=Object.keys(e);if(i.length-(t&&i.indexOf(t)>-1?1:0)!=l.length-(t&&l.indexOf(t)>-1?1:0))return!1;for(let s of i)if(s!=t&&(l.indexOf(s)==-1||o[s]!==e[s]))return!1;return!0}function Rn(o,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?o.style.cssText="":o.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?o.style.cssText=t[l]:o.setAttribute(l,t[l]));return i}function cc(o){let e=Object.create(null);for(let t=0;t<o.attributes.length;t++){let i=o.attributes[t];e[i.name]=i.value}return e}class Ln{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,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Le=function(o){return o[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o}(Le||(Le={}));class we extends Bt{constructor(e,t,i,l){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=l}get heightRelevant(){return!1}static mark(e){return new ei(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new st(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:s,end:a}=js(e,t);i=(s?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new st(e,i,l,t,e.widget||null,!0)}static line(e){return new ti(e)}static set(e,t=!1){return se.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=se.empty;class ei extends we{constructor(e){let{start:t,end:i}=js(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof ei&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&Ii(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)}}ei.prototype.point=!1;class ti extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ti&&this.spec.class==e.spec.class&&Ii(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)}}ti.prototype.mapMode=Be.TrackBefore,ti.prototype.point=!0;class st extends we{constructor(e,t,i,l,s,a){super(t,i,s,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Be.TrackBefore:Be.TrackAfter:Be.TrackDel}get type(){return this.startSide!=this.endSide?Le.WidgetRange:this.startSide<=0?Le.WidgetBefore:Le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof st&&hc(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)}}st.prototype.point=!0;function js(o,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=o;return t==null&&(t=o.inclusive),i==null&&(i=o.inclusive),{start:t??e,end:i??e}}function hc(o,e){return o==e||!!(o&&e&&o.compare(e))}function jn(o,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=o?t[l]=Math.max(t[l],e):t.push(o,e)}class de extends ne{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,l,s,a){if(i){if(!(i instanceof de))return!1;this.dom||i.transferDOM(this)}return l&&this.setDeco(i?i.attrs:null),Ts(this,e,t,i?i.children.slice():[],s,a),!0}split(e){let t=new de;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:l}=this.childPos(e);l&&(t.append(this.children[i].split(l),0),this.children[i].merge(l,this.children[i].length,null,!1,0,0),i++);for(let s=i;s<this.children.length;s++)t.append(this.children[s],0);for(;i>0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,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){Ii(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){$s(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=$n(t,this.attrs||{})),i&&(this.attrs=$n({class:i},this.attrs||{}))}domAtPos(e){return Fs(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Ss(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&&(Rn(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&&ne.get(l)instanceof Xe;)l=l.lastChild;if(!l||!this.length||l.nodeName!="BR"&&((i=ne.get(l))===null||i===void 0?void 0:i.isEditable)==!1&&(!U.ios||!this.children.some(s=>s instanceof Ee))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ee)||/[^ -~]/.test(i.text))return null;let l=Jt(i.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 i=Rs(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:l}=this.parent.view.viewState,s=i.bottom-i.top;if(Math.abs(s-l.lineHeight)<2&&l.textHeight<s){let a=(s-l.textHeight)/2;return{top:i.top+a,bottom:i.bottom-a,left:i.left,right:i.left}}}return i}become(e){return e instanceof de&&this.children.length==0&&e.children.length==0&&Ii(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let i=0,l=0;i<e.children.length;i++){let s=e.children[i],a=l+s.length;if(a>=t){if(s instanceof de)return s;if(a>t)break}l=a+s.breakAfter}return null}}class Je extends ne{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,l,s,a){return i&&(!(i instanceof Je)||!this.widget.compare(i.widget)||e>0&&s<=0||t<this.length&&a<=0)?!1:(this.length=e+(i?i.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?ye.before(this.dom):ye.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let i=new Je(this.widget,t,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return En}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):X.empty}domBoundsAround(){return null}become(e){return e instanceof Je&&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 i=this.widget.coordsAt(this.dom,e,t);return i||(this.widget instanceof zn?null:Ai(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:i}=this.deco;return t==i?!1:e<0?t<0:i>0}}class zn extends Ln{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 ii{constructor(e,t,i,l){this.doc=e,this.pos=t,this.end=i,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 Je&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new de),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Di(new Mt(-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 Je)&&this.getLine()}buildText(e,t,i){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:a,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(a){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=s,this.textOff=0}let l=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Di(new Ee(this.text.slice(this.textOff,this.textOff+l)),t),i),this.atCursorPos=!0,this.textOff+=l,e-=l,i=0}}span(e,t,i,l){this.buildText(t-e,i,l),this.pos=t,this.openStart<0&&(this.openStart=l)}point(e,t,i,l,s,a){if(this.disallowBlockEffectsFor[a]&&i instanceof st){if(i.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(i instanceof st)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Je(i.widget||Tt.block,r,i));else{let d=bt.create(i.widget||Tt.inline,r,r?0:i.startSide),c=this.atCursorPos&&!d.isEditable&&s<=l.length&&(e<t||i.startSide>0),h=!d.isEditable&&(e<t||s>l.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!c&&!d.isEditable&&(this.pendingBuffer=0),this.flushBuffer(l),c&&(f.append(Di(new Mt(1),l),s),s=l.length+Math.max(0,s-l.length)),f.append(Di(d,l),s),this.atCursorPos=h,this.pendingBuffer=h?e<t||s>l.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=l.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);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=s)}static build(e,t,i,l,s){let a=new ii(e,t,i,s);return a.openEnd=se.spans(l,t,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Di(o,e){for(let t of e)o=new Xe(t,[o],o.length);return o}class Tt extends Ln{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}}Tt.inline=new Tt("span"),Tt.block=new Tt("div");var me=function(o){return o[o.LTR=0]="LTR",o[o.RTL=1]="RTL",o}(me||(me={}));const yt=me.LTR,qn=me.RTL;function zs(o){let e=[];for(let t=0;t<o.length;t++)e.push(1<<+o[t]);return e}const fc=zs("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),uc=zs("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Un=Object.create(null),je=[];for(let o of["()","[]","{}"]){let e=o.charCodeAt(0),t=o.charCodeAt(1);Un[e]=t,Un[t]=-e}function qs(o){return o<=247?fc[o]:1424<=o&&o<=1524?2:1536<=o&&o<=1785?uc[o-1536]:1774<=o&&o<=2220?4:8192<=o&&o<=8204?256:64336<=o&&o<=65023?4:1}const pc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ot{get dir(){return this.level%2?qn:yt}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,l){let s=-1;for(let a=0;a<e.length;a++){let r=e[a];if(r.from<=t&&r.to>=t){if(r.level==i)return a;(s<0||(l!=0?l<0?r.from<t:r.to>t:e[s].level>r.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function Us(o,e){if(o.length!=e.length)return!1;for(let t=0;t<o.length;t++){let i=o[t],l=e[t];if(i.from!=l.from||i.to!=l.to||i.direction!=l.direction||!Us(i.inner,l.inner))return!1}return!0}const le=[];function mc(o,e,t,i,l){for(let s=0;s<=i.length;s++){let a=s?i[s-1].to:e,r=s<i.length?i[s].from:t,d=s?256:l;for(let c=a,h=d,f=d;c<r;c++){let p=qs(o.charCodeAt(c));p==512?p=h:p==8&&f==4&&(p=16),le[c]=p==4?2:p,p&7&&(f=p),h=p}for(let c=a,h=d,f=d;c<r;c++){let p=le[c];if(p==128)c<r-1&&h==le[c+1]&&h&24?p=le[c]=h:le[c]=256;else if(p==64){let u=c+1;for(;u<r&&le[u]==64;)u++;let y=c&&h==8||u<t&&le[u]==8?f==1?1:8:256;for(let k=c;k<u;k++)le[k]=y;c=u-1}else p==8&&f==1&&(le[c]=1);h=p,p&7&&(f=p)}}}function gc(o,e,t,i,l){let s=l==1?2:1;for(let a=0,r=0,d=0;a<=i.length;a++){let c=a?i[a-1].to:e,h=a<i.length?i[a].from:t;for(let f=c,p,u,y;f<h;f++)if(u=Un[p=o.charCodeAt(f)])if(u<0){for(let k=r-3;k>=0;k-=3)if(je[k+1]==-u){let x=je[k+2],w=x&2?l:x&4?x&1?s:l:0;w&&(le[f]=le[je[k]]=w),r=k;break}}else{if(je.length==189)break;je[r++]=f,je[r++]=p,je[r++]=d}else if((y=le[f])==2||y==1){let k=y==l;d=k?0:1;for(let x=r-3;x>=0;x-=3){let w=je[x+2];if(w&2)break;if(k)je[x+2]|=2;else{if(w&4)break;je[x+2]|=4}}}}}function kc(o,e,t,i){for(let l=0,s=i;l<=t.length;l++){let a=l?t[l-1].to:o,r=l<t.length?t[l].from:e;for(let d=a;d<r;){let c=le[d];if(c==256){let h=d+1;for(;;)if(h==r){if(l==t.length)break;h=t[l++].to,r=l<t.length?t[l].from:e}else if(le[h]==256)h++;else break;let f=s==1,p=(h<e?le[h]:i)==1,u=f==p?f?1:2:i;for(let y=h,k=l,x=k?t[k-1].to:o;y>d;)y==x&&(y=t[--k].from,x=k?t[k-1].to:o),le[--y]=u;d=h}else s=c,d++}}}function Wn(o,e,t,i,l,s,a){let r=i%2?2:1;if(i%2==l%2)for(let d=e,c=0;d<t;){let h=!0,f=!1;if(c==s.length||d<s[c].from){let k=le[d];k!=r&&(h=!1,f=k==16)}let p=!h&&r==1?[]:null,u=h?i:i+1,y=d;e:for(;;)if(c<s.length&&y==s[c].from){if(f)break e;let k=s[c];if(!h)for(let x=k.to,w=c+1;;){if(x==t)break e;if(w<s.length&&s[w].from==x)x=s[w++].to;else{if(le[x]==r)break e;break}}if(c++,p)p.push(k);else{k.from>d&&a.push(new ot(d,k.from,u));let x=k.direction==yt!=!(u%2);Hn(o,x?i+1:i,l,k.inner,k.from,k.to,a),d=k.to}y=k.to}else{if(y==t||(h?le[y]!=r:le[y]==r))break;y++}p?Wn(o,d,y,i+1,l,p,a):d<y&&a.push(new ot(d,y,u)),d=y}else for(let d=t,c=s.length;d>e;){let h=!0,f=!1;if(!c||d>s[c-1].to){let k=le[d-1];k!=r&&(h=!1,f=k==16)}let p=!h&&r==1?[]:null,u=h?i:i+1,y=d;e:for(;;)if(c&&y==s[c-1].to){if(f)break e;let k=s[--c];if(!h)for(let x=k.from,w=c;;){if(x==e)break e;if(w&&s[w-1].to==x)x=s[--w].from;else{if(le[x-1]==r)break e;break}}if(p)p.push(k);else{k.to<d&&a.push(new ot(k.to,d,u));let x=k.direction==yt!=!(u%2);Hn(o,x?i+1:i,l,k.inner,k.from,k.to,a),d=k.from}y=k.from}else{if(y==e||(h?le[y-1]!=r:le[y-1]==r))break;y--}p?Wn(o,y,d,i+1,l,p,a):y<d&&a.push(new ot(y,d,u)),d=y}}function Hn(o,e,t,i,l,s,a){let r=e%2?2:1;mc(o,l,s,i,r),gc(o,l,s,i,r),kc(l,s,i,r),Wn(o,l,s,e,t,i,a)}function bc(o,e,t){if(!o)return[new ot(0,0,e==qn?1:0)];if(e==yt&&!t.length&&!pc.test(o))return Ws(o.length);if(t.length)for(;o.length>le.length;)le[le.length]=256;let i=[],l=e==yt?0:1;return Hn(o,l,l,t,0,o.length,i),i}function Ws(o){return[new ot(0,o,0)]}let Hs="";function yc(o,e,t,i,l){var s;let a=i.head-o.from,r=ot.find(e,a,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),d=e[r],c=d.side(l,t);if(a==c){let p=r+=l?1:-1;if(p<0||p>=e.length)return null;d=e[r=p],a=d.side(!l,t),c=d.side(l,t)}let h=Ke(o.text,a,d.forward(l,t));(h<d.from||h>d.to)&&(h=c),Hs=o.text.slice(Math.min(a,h),Math.max(a,h));let f=r==(l?e.length-1:0)?null:e[r+(l?1:-1)];return f&&h==c&&f.level+(l?0:1)<d.level?H.cursor(f.side(!l,t)+o.from,f.forward(l,t)?1:-1,f.level):H.cursor(h+o.from,d.forward(l,t)?-1:1,d.level)}function wc(o,e,t){for(let i=e;i<t;i++){let l=qs(o.charCodeAt(i));if(l==1)return yt;if(l==2||l==4)return qn}return yt}const Ks=Q.define(),Qs=Q.define(),Gs=Q.define(),Ys=Q.define(),Kn=Q.define(),Xs=Q.define(),Js=Q.define(),Qn=Q.define(),Gn=Q.define(),Zs=Q.define({combine:o=>o.some(e=>e)}),xc=Q.define({combine:o=>o.some(e=>e)}),eo=Q.define();class At{constructor(e,t="nearest",i="nearest",l=5,s=5,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=s,this.isSnapshot=a}map(e){return e.empty?this:new At(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 At(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pi=ce.define({map:(o,e)=>o.map(e)}),to=ce.define();function ze(o,e,t){let i=o.facet(Ys);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const at=Q.define({combine:o=>o.length?o[0]:!0});let vc=0;const ni=Q.define();class Et{constructor(e,t,i,l,s){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=l,this.extension=s(this)}static define(e,t){const{eventHandlers:i,eventObservers:l,provide:s,decorations:a}=t||{};return new Et(vc++,e,i,l,r=>{let d=[ni.of(r)];return a&&d.push(li.of(c=>{let h=c.plugin(r);return h?a(h):we.none})),s&&d.push(s(r)),d})}static fromClass(e,t){return Et.define(i=>new e(i),t)}}class Yn{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}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(i){if(ze(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ze(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(i){ze(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const io=Q.define(),Xn=Q.define(),li=Q.define(),no=Q.define(),Jn=Q.define(),lo=Q.define();function so(o,e){let t=o.state.facet(lo);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(o):s),l=[];return se.spans(i,e.from,e.to,{point(){},span(s,a,r,d){let c=s-e.from,h=a-e.from,f=l;for(let p=r.length-1;p>=0;p--,d--){let u=r[p].spec.bidiIsolate,y;if(u==null&&(u=wc(e.text,c,h)),d>0&&f.length&&(y=f[f.length-1]).to==c&&y.direction==u)y.to=h,f=y.inner;else{let k={from:c,to:h,direction:u,inner:[]};f.push(k),f=k.inner}}}}),l}const oo=Q.define();function ao(o){let e=0,t=0,i=0,l=0;for(let s of o.state.facet(oo)){let a=s(o);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(l=Math.max(l,a.bottom)))}return{left:e,right:t,top:i,bottom:l}}const si=Q.define();class Me{constructor(e,t,i,l){this.fromA=e,this.toA=t,this.fromB=i,this.toB=l}join(e){return new Me(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,i=this;for(;t>0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toA<i.fromA)break;i=i.join(l),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let l=0,s=0,a=0,r=0;;l++){let d=l==e.length?null:e[l],c=a-r,h=d?d.fromB:1e9;for(;s<t.length&&t[s]<h;){let f=t[s],p=t[s+1],u=Math.max(r,f),y=Math.min(h,p);if(u<=y&&new Me(u+c,y+c,u,y).addToSet(i),p>h)break;s+=2}if(!d)return i;new Me(d.fromA,d.toA,d.fromB,d.toB).addToSet(i),a=d.toA,r=d.toB}}}class Fi{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ue.empty(this.startState.doc.length);for(let s of i)this.changes=this.changes.compose(s.changes);let l=[];this.changes.iterChangedRanges((s,a,r,d)=>l.push(new Me(s,a,r,d))),this.changedRanges=l}static create(e,t,i){return new Fi(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>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 ro extends ne{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=we.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 de],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Me(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>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:!_c(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let s=l>-1?Sc(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;i=new Me(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(U.ie||U.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,r=this.updateDeco(),d=Oc(a,r,e.changes);return i=Me.extendWithRanges(i,d),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);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 a=U.chrome||U.ios?{node:l.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||l.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.children)a instanceof Je&&a.widget instanceof zn&&s.push(a.dom);l.updateGaps(s)}updateChildren(e,t,i){let l=i?i.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let a=l.length-1;;a--){let r=a>=0?l[a]:null;if(!r)break;let{fromA:d,toA:c,fromB:h,toB:f}=r,p,u,y,k;if(i&&i.range.fromB<f&&i.range.toB>h){let g=ii.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),m=ii.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);u=g.breakAtStart,y=g.openStart,k=m.openEnd;let S=this.compositionView(i);m.breakAtStart?S.breakAfter=1:m.content.length&&S.merge(S.length,S.length,m.content[0],!1,m.openStart,0)&&(S.breakAfter=m.content[0].breakAfter,m.content.shift()),g.content.length&&S.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),p=g.content.concat(S).concat(m.content)}else({content:p,breakAtStart:u,openStart:y,openEnd:k}=ii.build(this.view.state.doc,h,f,this.decorations,this.dynamicDecorationMap));let{i:x,off:w}=s.findPos(c,1),{i:v,off:O}=s.findPos(d,-1);Ms(this,v,O,x,w,p,u,y,k)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(to)&&(this.editContextFormatting=i.value)}compositionView(e){let t=new Ee(e.text.nodeValue);t.flags|=8;for(let{deco:l}of e.marks)t=new Xe(l,[t],t.length);let i=new de;return i.append(t,0),i}fixCompositionDOM(e){let t=(s,a)=>{a.flags|=8|(a.children.some(d=>d.flags&7)?1:0),this.markedForComposition.add(a);let r=ne.get(s);r&&r!=a&&(r.dom=null),a.setDOM(s)},i=this.childPos(e.range.fromB,1),l=this.children[i.i];t(e.line,l);for(let s=e.marks.length-1;s>=-1;s--)i=l.childPos(i.off,1),l=l.children[i.i],t(s>=0?e.marks[s].node:e.text,l)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,l=i==this.dom,s=!l&&Mi(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(l||t||s))return;let a=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,d=this.moveToLine(this.domAtPos(r.anchor)),c=r.empty?d:this.moveToLine(this.domAtPos(r.head));if(U.gecko&&r.empty&&!this.hasComposition&&Cc(d)){let f=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(f,d.node.childNodes[d.offset]||null)),d=c=new ye(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!Zt(d.node,d.offset,h.anchorNode,h.anchorOffset)||!Zt(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,r))&&(this.view.observer.ignore(()=>{U.android&&U.chrome&&this.dom.contains(h.focusNode)&&Vc(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Xt(this.view.root);if(f)if(r.empty){if(U.gecko){let p=Nc(d.node,d.offset);if(p&&p!=3){let u=(p==1?Bs:Os)(d.node,d.offset);u&&(d=new ye(u.node,u.offset))}}f.collapse(d.node,d.offset),r.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=r.bidiLevel)}else if(f.extend){f.collapse(d.node,d.offset);try{f.extend(c.node,c.offset)}catch{}}else{let p=document.createRange();r.anchor>r.head&&([d,c]=[c,d]),p.setEnd(c.node,c.offset),p.setStart(d.node,d.offset),f.removeAllRanges(),f.addRange(p)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(d,c)),this.impreciseAnchor=d.precise?null:new ye(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new ye(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zt(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,i=Xt(e.root),{anchorNode:l,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=de.find(this,t.head);if(!a)return;let r=a.posAtStart;if(t.head==r||t.head==r+a.length)return;let d=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!d||!c||d.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(l,s)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let l=e.offset;!i&&l<t.childNodes.length;l++){let s=ne.get(t.childNodes[l]);s instanceof de&&(i=s.domAtPos(0))}for(let l=e.offset-1;!i&&l>=0;l--){let s=ne.get(t.childNodes[l]);s instanceof de&&(i=s.domAtPos(s.length))}return i?new ye(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=ne.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let l=this.children[t];if(i<l.length||l instanceof de)break;t++,i=0}return this.children[t].domAtPos(i)}coordsAt(e,t){let i=null,l=0;for(let s=this.length,a=this.children.length-1;a>=0;a--){let r=this.children[a],d=s-r.breakAfter,c=d-r.length;if(d<e)break;if(c<=e&&(c<e||r.covers(-1))&&(d>e||r.covers(1))&&(!i||r instanceof de&&!(i instanceof de&&t>=0)))i=r,l=c;else if(i&&c==e&&d==e&&r instanceof Je&&Math.abs(t)<2){if(r.deco.startSide<0)break;a&&(i=null)}s=c}return i?i.coordsAt(e-l,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),l=this.children[t];if(!(l instanceof de))return null;for(;l.children.length;){let{i:r,off:d}=l.childPos(i,1);for(;;r++){if(r==l.children.length)return null;if((l=l.children[r]).length)break}i=d}if(!(l instanceof Ee))return null;let s=Ke(l.text,i);if(s==i)return null;let a=kt(l.dom,i,s).getClientRects();for(let r=0;r<a.length;r++){let d=a[r];if(r==a.length-1||d.top<d.bottom&&d.left<d.right)return d}return null}measureVisibleLineHeights(e){let t=[],{from:i,to:l}=e,s=this.view.contentDOM.clientWidth,a=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,d=this.view.textDirection==me.LTR;for(let c=0,h=0;h<this.children.length;h++){let f=this.children[h],p=c+f.length;if(p>l)break;if(c>=i){let u=f.dom.getBoundingClientRect();if(t.push(u.height),a){let y=f.dom.lastChild,k=y?Jt(y):[];if(k.length){let x=k[k.length-1],w=d?x.right-u.left:u.right-x.left;w>r&&(r=w,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=p)}}}c=p+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?me.RTL:me.LTR}measureTextSize(){for(let s of this.children)if(s instanceof de){let a=s.measureTextSize();if(a)return a}let e=document.createElement("div"),t,i,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 s=Jt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,l=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:l}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new _s(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let s=l==t.viewports.length?null:t.viewports[l],a=s?s.from-1:this.length;if(a>i){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(we.replace({widget:new zn(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!s)break;i=s.to+1}return we.set(e)}updateDeco(){let e=1,t=this.view.state.facet(li).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,l=this.view.state.facet(no).map((s,a)=>{let r=typeof s=="function";return r&&(i=!0),r?s(this.view):s});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(se.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 c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(eo))try{if(c(this.view,e.range,e))return!0}catch(h){ze(this.view.state,h,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let s=ao(this.view),a={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:r,offsetHeight:d}=this.view.scrollDOM;ic(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,r),-r),Math.max(Math.min(e.yMargin,d),-d),this.view.textDirection==me.LTR)}}function Cc(o){return o.node.nodeType==1&&o.node.firstChild&&(o.offset==0||o.node.childNodes[o.offset-1].contentEditable=="false")&&(o.offset==o.node.childNodes.length||o.node.childNodes[o.offset].contentEditable=="false")}function co(o,e){let t=o.observer.selectionRange;if(!t.focusNode)return null;let i=Bs(t.focusNode,t.focusOffset),l=Os(t.focusNode,t.focusOffset),s=i||l;if(l&&i&&l.node!=i.node){let r=ne.get(l.node);if(!r||r instanceof Ee&&r.text!=l.node.nodeValue)s=l;else if(o.docView.lastCompositionAfterCursor){let d=ne.get(i.node);!d||d instanceof Ee&&d.text!=i.node.nodeValue||(s=l)}}if(o.docView.lastCompositionAfterCursor=s!=i,!s)return null;let a=e-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function Sc(o,e,t){let i=co(o,t);if(!i)return null;let{node:l,from:s,to:a}=i,r=l.nodeValue;if(/[\n\r]/.test(r)||o.state.doc.sliceString(i.from,i.to)!=r)return null;let d=e.invertedDesc,c=new Me(d.mapPos(s),d.mapPos(a),s,a),h=[];for(let f=l.parentNode;;f=f.parentNode){let p=ne.get(f);if(p instanceof Xe)h.push({node:f,deco:p.mark});else{if(p instanceof de||f.nodeName=="DIV"&&f.parentNode==o.contentDOM)return{range:c,text:l,marks:h,line:f};if(f!=o.contentDOM)h.push({node:f,deco:new ei({inclusive:!0,attributes:cc(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Nc(o,e){return o.nodeType!=1?0:(e&&o.childNodes[e-1].contentEditable=="false"?1:0)|(e<o.childNodes.length&&o.childNodes[e].contentEditable=="false"?2:0)}let Bc=class{constructor(){this.changes=[]}compareRange(e,t){jn(e,t,this.changes)}comparePoint(e,t){jn(e,t,this.changes)}};function Oc(o,e,t){let i=new Bc;return se.compare(o,e,t,i),i.changes}function Vc(o,e){for(let t=o;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function _c(o,e){let t=!1;return e&&o.iterChangedRanges((i,l)=>{i<e.to&&l>e.from&&(t=!0)}),t}function Mc(o,e,t=1){let i=o.charCategorizer(e),l=o.doc.lineAt(e),s=e-l.from;if(l.length==0)return H.cursor(e);s==0?t=1:s==l.length&&(t=-1);let a=s,r=s;t<0?a=Ke(l.text,s,!1):r=Ke(l.text,s);let d=i(l.text.slice(a,r));for(;a>0;){let c=Ke(l.text,a,!1);if(i(l.text.slice(c,a))!=d)break;a=c}for(;r<l.length;){let c=Ke(l.text,r);if(i(l.text.slice(r,c))!=d)break;r=c}return H.range(a+l.from,r+l.from)}function Tc(o,e){return e.left>o?e.left-o:Math.max(0,o-e.right)}function Ac(o,e){return e.top>o?e.top-o:Math.max(0,o-e.bottom)}function Zn(o,e){return o.top<e.bottom-1&&o.bottom>e.top+1}function ho(o,e){return e<o.top?{top:e,left:o.left,right:o.right,bottom:o.bottom}:o}function fo(o,e){return e>o.bottom?{top:o.top,left:o.left,right:o.right,bottom:e}:o}function el(o,e,t){let i,l,s,a,r=!1,d,c,h,f;for(let y=o.firstChild;y;y=y.nextSibling){let k=Jt(y);for(let x=0;x<k.length;x++){let w=k[x];l&&Zn(l,w)&&(w=ho(fo(w,l.bottom),l.top));let v=Tc(e,w),O=Ac(t,w);if(v==0&&O==0)return y.nodeType==3?uo(y,e,t):el(y,e,t);if(!i||a>O||a==O&&s>v){i=y,l=w,s=v,a=O;let g=O?t<w.top?-1:1:v?e<w.left?-1:1:0;r=!g||(g>0?x<k.length-1:x>0)}v==0?t>w.bottom&&(!h||h.bottom<w.bottom)?(d=y,h=w):t<w.top&&(!f||f.top>w.top)&&(c=y,f=w):h&&Zn(h,w)?h=fo(h,w.bottom):f&&Zn(f,w)&&(f=ho(f,w.top))}}if(h&&h.bottom>=t?(i=d,l=h):f&&f.top<=t&&(i=c,l=f),!i)return{node:o,offset:0};let p=Math.max(l.left,Math.min(l.right,e));if(i.nodeType==3)return uo(i,p,t);if(r&&i.contentEditable!="false")return el(i,p,t);let u=Array.prototype.indexOf.call(o.childNodes,i)+(e>=(l.left+l.right)/2?1:0);return{node:o,offset:u}}function uo(o,e,t){let i=o.nodeValue.length,l=-1,s=1e9,a=0;for(let r=0;r<i;r++){let d=kt(o,r,r+1).getClientRects();for(let c=0;c<d.length;c++){let h=d[c];if(h.top==h.bottom)continue;a||(a=e-h.left);let f=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&f<s){let p=e>=(h.left+h.right)/2,u=p;if((U.chrome||U.gecko)&&kt(o,r).getBoundingClientRect().left==h.right&&(u=!p),f<=0)return{node:o,offset:r+(u?1:0)};l=r+(u?1:0),s=f}}}return{node:o,offset:l>-1?l:a>0?o.nodeValue.length:0}}function po(o,e,t,i=-1){var l,s;let a=o.contentDOM.getBoundingClientRect(),r=a.top+o.viewState.paddingTop,d,{docHeight:c}=o.viewState,{x:h,y:f}=e,p=f-r;if(p<0)return 0;if(p>c)return o.state.doc.length;for(let g=o.viewState.heightOracle.textHeight/2,m=!1;d=o.elementAtHeight(p),d.type!=Le.Text;)for(;p=i>0?d.bottom+g:d.top-g,!(p>=0&&p<=c);){if(m)return t?null:0;m=!0,i=-i}f=r+p;let u=d.from;if(u<o.viewport.from)return o.viewport.from==0?0:t?null:mo(o,a,d,h,f);if(u>o.viewport.to)return o.viewport.to==o.state.doc.length?o.state.doc.length:t?null:mo(o,a,d,h,f);let y=o.dom.ownerDocument,k=o.root.elementFromPoint?o.root:y,x=k.elementFromPoint(h,f);x&&!o.contentDOM.contains(x)&&(x=null),x||(h=Math.max(a.left+1,Math.min(a.right-1,h)),x=k.elementFromPoint(h,f),x&&!o.contentDOM.contains(x)&&(x=null));let w,v=-1;if(x&&((l=o.docView.nearest(x))===null||l===void 0?void 0:l.isEditable)!=!1){if(y.caretPositionFromPoint){let g=y.caretPositionFromPoint(h,f);g&&({offsetNode:w,offset:v}=g)}else if(y.caretRangeFromPoint){let g=y.caretRangeFromPoint(h,f);g&&({startContainer:w,startOffset:v}=g,(!o.contentDOM.contains(w)||U.safari&&Ec(w,v,h)||U.chrome&&Ic(w,v,h))&&(w=void 0))}}if(!w||!o.docView.dom.contains(w)){let g=de.find(o.docView,u);if(!g)return p>d.top+d.height/2?d.to:d.from;({node:w,offset:v}=el(g.dom,h,f))}let O=o.docView.nearest(w);if(!O)return null;if(O.isWidget&&((s=O.dom)===null||s===void 0?void 0:s.nodeType)==1){let g=O.dom.getBoundingClientRect();return e.y<g.top||e.y<=g.bottom&&e.x<=(g.left+g.right)/2?O.posAtStart:O.posAtEnd}else return O.localPosFromDOM(w,v)+O.posAtStart}function mo(o,e,t,i,l){let s=Math.round((i-e.left)*o.defaultCharacterWidth);if(o.lineWrapping&&t.height>o.defaultLineHeight*1.5){let r=o.viewState.heightOracle.textHeight,d=Math.floor((l-t.top-(o.defaultLineHeight-r)*.5)/r);s+=d*o.viewState.heightOracle.lineLength}let a=o.state.sliceDoc(t.from,t.to);return t.from+Jd(a,s,o.state.tabSize)}function Ec(o,e,t){let i;if(o.nodeType!=3||e!=(i=o.nodeValue.length))return!1;for(let l=o.nextSibling;l;l=l.nextSibling)if(l.nodeType!=1||l.nodeName!="BR")return!1;return kt(o,i-1,i).getBoundingClientRect().left>t}function Ic(o,e,t){if(e!=0)return!1;for(let l=o;;){let s=l.parentNode;if(!s||s.nodeType!=1||s.firstChild!=l)return!1;if(s.classList.contains("cm-line"))break;l=s}let i=o.nodeType==1?o.getBoundingClientRect():kt(o,0,Math.max(o.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Dc(o,e){let t=o.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==Le.Text))return i}return t}function Pc(o,e,t,i){let l=Dc(o,e.head),s=!i||l.type!=Le.Text||!(o.lineWrapping||l.widgetLineBreaks)?null:o.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(s){let a=o.dom.getBoundingClientRect(),r=o.textDirectionAt(l.from),d=o.posAtCoords({x:t==(r==me.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(d!=null)return H.cursor(d,t?-1:1)}return H.cursor(t?l.to:l.from,t?-1:1)}function go(o,e,t,i){let l=o.state.doc.lineAt(e.head),s=o.bidiSpans(l),a=o.textDirectionAt(l.from);for(let r=e,d=null;;){let c=yc(l,s,a,r,t),h=Hs;if(!c){if(l.number==(t?o.state.doc.lines:1))return r;h=`
8
+ `,l=o.state.doc.line(l.number+(t?1:-1)),s=o.bidiSpans(l),c=o.visualLineSide(l,!t)}if(d){if(!d(h))return r}else{if(!i)return c;d=i(h)}r=c}}function Fc(o,e,t){let i=o.state.charCategorizer(e),l=i(t);return s=>{let a=i(s);return l==Ge.Space&&(l=a),l==a}}function $c(o,e,t,i){let l=e.head,s=t?1:-1;if(l==(t?o.state.doc.length:0))return H.cursor(l,e.assoc);let a=e.goalColumn,r,d=o.contentDOM.getBoundingClientRect(),c=o.coordsAtPos(l,e.assoc||-1),h=o.documentTop;if(c)a==null&&(a=c.left-d.left),r=s<0?c.top:c.bottom;else{let u=o.viewState.lineBlockAt(l);a==null&&(a=Math.min(d.right-d.left,o.defaultCharacterWidth*(l-u.from))),r=(s<0?u.top:u.bottom)+h}let f=d.left+a,p=i??o.viewState.heightOracle.textHeight>>1;for(let u=0;;u+=10){let y=r+(p+u)*s,k=po(o,{x:f,y},!1,s);if(y<d.top||y>d.bottom||(s<0?k<l:k>l)){let x=o.docView.coordsForChar(k),w=!x||y<x.top?-1:1;return H.cursor(k,w,void 0,a)}}}function $i(o,e,t){for(;;){let i=0;for(let l of o)l.between(e-1,e+1,(s,a,r)=>{if(e>s&&e<a){let d=i||t||(e-s<a-e?-1:1);e=d<0?s:a,i=d}});if(!i)return e}}function tl(o,e,t){let i=$i(o.state.facet(Jn).map(l=>l(o)),t.from,e.head>t.from?-1:1);return i==t.from?t:H.cursor(i,i<t.from?1:-1)}const oi="￿";class Rc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(te.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=oi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let s=this.text.length;this.readNode(l);let a=l.nextSibling;if(a==t)break;let r=ne.get(l),d=ne.get(a);(r&&d?r.breakAfter:(r?r.breakAfter:Ti(l))||Ti(a)&&(l.nodeName!="BR"||l.cmIgnore)&&this.text.length>s)&&this.lineBreak(),l=a}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,r;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(r=l.exec(t))&&(s=r.index,a=r[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let d of this.points)d.node==e&&d.pos>this.text.length&&(d.pos-=a-1);i=s+a}}readNode(e){if(e.cmIgnore)return;let t=ne.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.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 i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Lc(e,i.node,i.offset)?t:0))}}function Lc(o,e,t){for(;;){if(!e||t<Ye(e))return!1;if(e==o)return!0;t=gt(e)+1,e=e.parentNode}}class ko{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class jc{constructor(e,t,i,l){this.typeOver=l,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let r=s||a?[]:Uc(e),d=new Rc(r,e.state);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Wc(r,this.bounds.from)}else{let r=e.observer.selectionRange,d=s&&s.node==r.focusNode&&s.offset==r.focusOffset||!An(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),c=a&&a.node==r.anchorNode&&a.offset==r.anchorOffset||!An(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((U.ios||U.chrome)&&e.state.selection.main.empty&&d!=c&&(h.from>0||h.to<e.state.doc.length)){let f=Math.min(d,c),p=Math.max(d,c),u=h.from-f,y=h.to-p;(u==0||u==1||f==0)&&(y==0||y==-1||p==e.state.doc.length)&&(d=0,c=e.state.doc.length)}this.newSel=H.single(c,d)}}}function bo(o,e){let t,{newSel:i}=e,l=o.state.selection.main,s=o.inputState.lastKeyTime>Date.now()-100?o.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:r}=e.bounds,d=l.from,c=null;(s===8||U.android&&e.text.length<r-a)&&(d=l.to,c="end");let h=qc(o.state.doc.sliceString(a,r,oi),e.text,d-a,c);h&&(U.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==oi+oi&&h.toB--,t={from:a+h.from,to:a+h.toA,insert:X.of(e.text.slice(h.from,h.toB).split(oi))})}else i&&(!o.hasFocus&&o.state.facet(at)||i.main.eq(l))&&(i=null);if(!t&&!i)return!1;if(!t&&e.typeOver&&!l.empty&&i&&i.main.empty?t={from:l.from,to:l.to,insert:o.state.doc.slice(l.from,l.to)}: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:o.state.doc.slice(l.from,t.from).append(t.insert).append(o.state.doc.slice(t.to,l.to))}:(U.mac||U.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&o.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}):U.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
9
+ `&&o.lineWrapping&&(i&&(i=H.single(i.main.anchor-1,i.main.head-1)),t={from:l.from,to:l.to,insert:X.of([" "])}),t)return il(o,t,i,s);if(i&&!i.main.eq(l)){let a=!1,r="select";return o.inputState.lastSelectionTime>Date.now()-50&&(o.inputState.lastSelectionOrigin=="select"&&(a=!0),r=o.inputState.lastSelectionOrigin),o.dispatch({selection:i,scrollIntoView:a,userEvent:r}),!0}else return!1}function il(o,e,t,i=-1){if(U.ios&&o.inputState.flushIOSKey(e))return!0;let l=o.state.selection.main;if(U.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&o.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&_t(o.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>l.head)&&_t(o.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&_t(o.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();o.inputState.composing>=0&&o.inputState.composing++;let a,r=()=>a||(a=zc(o,e,t));return o.state.facet(Xs).some(d=>d(o,e.from,e.to,s,r))||o.dispatch(r()),!0}function zc(o,e,t){let i,l=o.state,s=l.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&o.inputState.composing<0){let r=s.from<e.from?l.sliceDoc(s.from,e.from):"",d=s.to>e.to?l.sliceDoc(e.to,s.to):"";i=l.replaceSelection(o.state.toText(r+e.insert.sliceString(0,void 0,o.state.lineBreak)+d))}else{let r=l.changes(e),d=t&&t.main.to<=r.newLength?t.main:void 0;if(l.selection.ranges.length>1&&o.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=o.state.sliceDoc(e.from,e.to),h,f=t&&co(o,t.main.head);if(f){let y=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-y}}else h=o.state.doc.lineAt(s.head);let p=s.to-e.to,u=s.to-s.from;i=l.changeByRange(y=>{if(y.from==s.from&&y.to==s.to)return{changes:r,range:d||y.map(r)};let k=y.to-p,x=k-c.length;if(y.to-y.from!=u||o.state.sliceDoc(x,k)!=c||y.to>=h.from&&y.from<=h.to)return{range:y};let w=l.changes({from:x,to:k,insert:e.insert}),v=y.to-s.to;return{changes:w,range:d?H.range(Math.max(0,d.anchor+v),Math.max(0,d.head+v)):y.map(w)}})}else i={changes:r,selection:d&&l.selection.replaceRange(d)}}let a="input.type";return(o.composing||o.inputState.compositionPendingChange&&o.inputState.compositionEndedAt>Date.now()-50)&&(o.inputState.compositionPendingChange=!1,a+=".compose",o.inputState.compositionFirstChange&&(a+=".start",o.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:a,scrollIntoView:!0})}function qc(o,e,t,i){let l=Math.min(o.length,e.length),s=0;for(;s<l&&o.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==l&&o.length==e.length)return null;let a=o.length,r=e.length;for(;a>0&&r>0&&o.charCodeAt(a-1)==e.charCodeAt(r-1);)a--,r--;if(i=="end"){let d=Math.max(0,s-Math.min(a,r));t-=a+d-s}if(a<s&&o.length<e.length){let d=t<=s&&t>=a?s-t:0;s-=d,r=s+(r-a),a=s}else if(r<s){let d=t<=s&&t>=r?s-t:0;s-=d,a=s+(a-r),r=s}return{from:s,toA:a,toB:r}}function Uc(o){let e=[];if(o.root.activeElement!=o.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}=o.observer.selectionRange;return t&&(e.push(new ko(t,i)),(l!=t||s!=i)&&e.push(new ko(l,s))),e}function Wc(o,e){if(o.length==0)return null;let t=o[0].pos,i=o.length==2?o[1].pos:t;return t>-1&&i>-1?H.single(t+e,i+e):null}class Hc{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,U.safari&&e.contentDOM.addEventListener("input",()=>null),U.gecko&&dh(e.contentDOM.ownerDocument)}handleEvent(e){!th(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Kc(e),i=this.handlers,l=this.view.contentDOM;for(let s in t)if(s!="scroll"){let a=!t[s].handlers.length,r=i[s];r&&a!=!r.handlers.length&&(l.removeEventListener(s,this.handleEvent),r=null),r||l.addEventListener(s,this.handleEvent,{passive:a})}for(let s in i)s!="scroll"&&!t[s]&&l.removeEventListener(s,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&&Gc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),U.android&&U.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return U.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=wo.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Qc.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,_t(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:U.safari&&!U.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 yo(o,e){return(t,i)=>{try{return e.call(o,i,t)}catch(l){ze(t.state,l)}}}function Kc(o){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of o){let l=i.spec;if(l&&l.domEventHandlers)for(let s in l.domEventHandlers){let a=l.domEventHandlers[s];a&&t(s).handlers.push(yo(i.value,a))}if(l&&l.domEventObservers)for(let s in l.domEventObservers){let a=l.domEventObservers[s];a&&t(s).observers.push(yo(i.value,a))}}for(let i in Ie)t(i).handlers.push(Ie[i]);for(let i in Te)t(i).observers.push(Te[i]);return e}const wo=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Qc="dthko",Gc=[16,17,18,20,91,92,224,225],Ri=6;function Li(o){return Math.max(0,o)*.7+8}function Yc(o,e){return Math.max(Math.abs(o.clientX-e.clientX),Math.abs(o.clientY-e.clientY))}class Xc{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=nc(e.contentDOM),this.atoms=e.state.facet(Jn).map(a=>a(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(te.allowMultipleSelections)&&Jc(e,t),this.dragging=eh(e,t)&&_o(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&&Yc(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,s=0,a=this.view.win.innerWidth,r=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:r}=this.scrollParents.y.getBoundingClientRect());let d=ao(this.view);e.clientX-d.left<=l+Ri?t=-Li(l-e.clientX):e.clientX+d.right>=a-Ri&&(t=Li(e.clientX-a)),e.clientY-d.top<=s+Ri?i=-Li(s-e.clientY):e.clientY+d.bottom>=r-Ri&&(i=Li(e.clientY-r)),this.setScrollSpeed(t,i)}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 i=0;i<e.ranges.length;i++){let l=e.ranges[i],s=null;if(l.empty){let a=$i(this.atoms,l.from,0);a!=l.from&&(s=H.cursor(a,-1))}else{let a=$i(this.atoms,l.from,-1),r=$i(this.atoms,l.to,1);(a!=l.from||r!=l.to)&&(s=H.range(l.from==l.anchor?a:r,l.from==l.head?a:r))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?H.create(t,e.mainIndex):e}select(e){let{view:t}=this,i=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,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 Jc(o,e){let t=o.state.facet(Ks);return t.length?t[0](e):U.mac?e.metaKey:e.ctrlKey}function Zc(o,e){let t=o.state.facet(Qs);return t.length?t[0](e):U.mac?!e.altKey:!e.ctrlKey}function eh(o,e){let{main:t}=o.state.selection;if(t.empty)return!1;let i=Xt(o.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let s=0;s<l.length;s++){let a=l[s];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function th(o,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=o.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ne.get(t))&&i.ignoreEvent(e))return!1;return!0}const Ie=Object.create(null),Te=Object.create(null),xo=U.ie&&U.ie_version<15||U.ios&&U.webkit_version<604;function ih(o){let e=o.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{o.focus(),t.remove(),vo(o,t.value)},50)}function ji(o,e,t){for(let i of o.facet(e))t=i(t,o);return t}function vo(o,e){e=ji(o.state,Qn,e);let{state:t}=o,i,l=1,s=t.toText(e),a=s.lines==t.selection.ranges.length;if(nl!=null&&t.selection.ranges.every(d=>d.empty)&&nl==s.toString()){let d=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==d)return{range:c};d=h.from;let f=t.toText((a?s.line(l++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:f},range:H.cursor(c.from+f.length)}})}else a?i=t.changeByRange(d=>{let c=s.line(l++);return{changes:{from:d.from,to:d.to,insert:c.text},range:H.cursor(d.from+c.length)}}):i=t.replaceSelection(s);o.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Te.scroll=o=>{o.inputState.lastScrollTop=o.scrollDOM.scrollTop,o.inputState.lastScrollLeft=o.scrollDOM.scrollLeft},Ie.keydown=(o,e)=>(o.inputState.setSelectionOrigin("select"),e.keyCode==27&&o.inputState.tabFocusMode!=0&&(o.inputState.tabFocusMode=Date.now()+2e3),!1),Te.touchstart=(o,e)=>{o.inputState.lastTouchTime=Date.now(),o.inputState.setSelectionOrigin("select.pointer")},Te.touchmove=o=>{o.inputState.setSelectionOrigin("select.pointer")},Ie.mousedown=(o,e)=>{if(o.observer.flush(),o.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of o.state.facet(Gs))if(t=i(o,e),t)break;if(!t&&e.button==0&&(t=sh(o,e)),t){let i=!o.hasFocus;o.inputState.startMouseSelection(new Xc(o,e,t,i)),i&&o.observer.ignore(()=>{vs(o.contentDOM);let s=o.root.activeElement;s&&!s.contains(o.contentDOM)&&s.blur()});let l=o.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}return!1};function Co(o,e,t,i){if(i==1)return H.cursor(e,t);if(i==2)return Mc(o.state,e,t);{let l=de.find(o.docView,e),s=o.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:s.from,r=l?l.posAtEnd:s.to;return r<o.state.doc.length&&r==s.to&&r++,H.range(a,r)}}let So=(o,e,t)=>e>=t.top&&e<=t.bottom&&o>=t.left&&o<=t.right;function nh(o,e,t,i){let l=de.find(o.docView,e);if(!l)return 1;let s=e-l.posAtStart;if(s==0)return 1;if(s==l.length)return-1;let a=l.coordsAt(s,-1);if(a&&So(t,i,a))return-1;let r=l.coordsAt(s,1);return r&&So(t,i,r)?1:a&&a.bottom>=i?-1:1}function No(o,e){let t=o.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:nh(o,t,e.clientX,e.clientY)}}const lh=U.ie&&U.ie_version<=11;let Bo=null,Oo=0,Vo=0;function _o(o){if(!lh)return o.detail;let e=Bo,t=Vo;return Bo=o,Vo=Date.now(),Oo=!e||t>Date.now()-400&&Math.abs(e.clientX-o.clientX)<2&&Math.abs(e.clientY-o.clientY)<2?(Oo+1)%3:1}function sh(o,e){let t=No(o,e),i=_o(e),l=o.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),l=l.map(s.changes))},get(s,a,r){let d=No(o,s),c,h=Co(o,d.pos,d.bias,i);if(t.pos!=d.pos&&!a){let f=Co(o,t.pos,t.bias,i),p=Math.min(f.from,h.from),u=Math.max(f.to,h.to);h=p<h.from?H.range(p,u):H.range(u,p)}return a?l.replaceRange(l.main.extend(h.from,h.to)):r&&i==1&&l.ranges.length>1&&(c=oh(l,d.pos))?c:r?l.addRange(h):H.create([h])}}}function oh(o,e){for(let t=0;t<o.ranges.length;t++){let{from:i,to:l}=o.ranges[t];if(i<=e&&l>=e)return H.create(o.ranges.slice(0,t).concat(o.ranges.slice(t+1)),o.mainIndex==t?0:o.mainIndex-(o.mainIndex>t?1:0))}return null}Ie.dragstart=(o,e)=>{let{selection:{main:t}}=o.state;if(e.target.draggable){let l=o.docView.nearest(e.target);if(l&&l.isWidget){let s=l.posAtStart,a=s+l.length;(s>=t.to||a<=t.from)&&(t=H.range(s,a))}}let{inputState:i}=o;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",ji(o.state,Gn,o.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ie.dragend=o=>(o.inputState.draggedContent=null,!1);function Mo(o,e,t,i){if(t=ji(o.state,Qn,t),!t)return;let l=o.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=o.inputState,a=i&&s&&Zc(o,e)?{from:s.from,to:s.to}:null,r={from:l,insert:t},d=o.state.changes(a?[a,r]:r);o.focus(),o.dispatch({changes:d,selection:{anchor:d.mapPos(l,-1),head:d.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),o.inputState.draggedContent=null}Ie.drop=(o,e)=>{if(!e.dataTransfer)return!1;if(o.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,s=()=>{++l==t.length&&Mo(o,e,i.filter(a=>a!=null).join(o.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let r=new FileReader;r.onerror=s,r.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(i[a]=r.result),s()},r.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Mo(o,e,i,!0),!0}return!1},Ie.paste=(o,e)=>{if(o.state.readOnly)return!0;o.observer.flush();let t=xo?null:e.clipboardData;return t?(vo(o,t.getData("text/plain")||t.getData("text/uri-list")),!0):(ih(o),!1)};function ah(o,e){let t=o.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),o.focus()},50)}function rh(o){let e=[],t=[],i=!1;for(let l of o.selection.ranges)l.empty||(e.push(o.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:s}of o.selection.ranges){let a=o.doc.lineAt(s);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(o.doc.length,a.to+1)})),l=a.number}i=!0}return{text:ji(o,Gn,e.join(o.lineBreak)),ranges:t,linewise:i}}let nl=null;Ie.copy=Ie.cut=(o,e)=>{let{text:t,ranges:i,linewise:l}=rh(o.state);if(!t&&!l)return!1;nl=l?t:null,e.type=="cut"&&!o.state.readOnly&&o.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=xo?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(ah(o,t),!1)};const To=St.define();function Ao(o,e){let t=[];for(let i of o.facet(Js)){let l=i(o,e);l&&t.push(l)}return t?o.update({effects:t,annotations:To.of(!0)}):null}function Eo(o){setTimeout(()=>{let e=o.hasFocus;if(e!=o.inputState.notifiedFocused){let t=Ao(o.state,e);t?o.dispatch(t):o.update([])}},10)}Te.focus=o=>{o.inputState.lastFocusTime=Date.now(),!o.scrollDOM.scrollTop&&(o.inputState.lastScrollTop||o.inputState.lastScrollLeft)&&(o.scrollDOM.scrollTop=o.inputState.lastScrollTop,o.scrollDOM.scrollLeft=o.inputState.lastScrollLeft),Eo(o)},Te.blur=o=>{o.observer.clearSelectionRange(),Eo(o)},Te.compositionstart=Te.compositionupdate=o=>{o.observer.editContext||(o.inputState.compositionFirstChange==null&&(o.inputState.compositionFirstChange=!0),o.inputState.composing<0&&(o.inputState.composing=0))},Te.compositionend=o=>{o.observer.editContext||(o.inputState.composing=-1,o.inputState.compositionEndedAt=Date.now(),o.inputState.compositionPendingKey=!0,o.inputState.compositionPendingChange=o.observer.pendingRecords().length>0,o.inputState.compositionFirstChange=null,U.chrome&&U.android?o.observer.flushSoon():o.inputState.compositionPendingChange?Promise.resolve().then(()=>o.observer.flush()):setTimeout(()=>{o.inputState.composing<0&&o.docView.hasComposition&&o.update([])},50))},Te.contextmenu=o=>{o.inputState.lastContextMenu=Date.now()},Ie.beforeinput=(o,e)=>{var t,i;if(e.inputType=="insertReplacementText"&&o.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(s&&a.length){let r=a[0],d=o.posAtDOM(r.startContainer,r.startOffset),c=o.posAtDOM(r.endContainer,r.endOffset);return il(o,{from:d,to:c,insert:o.state.toText(s)},null),!0}}let l;if(U.chrome&&U.android&&(l=wo.find(s=>s.inputType==e.inputType))&&(o.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&o.hasFocus&&(o.contentDOM.blur(),o.focus())},100)}return U.ios&&e.inputType=="deleteContentForward"&&o.observer.flushSoon(),U.safari&&e.inputType=="insertText"&&o.inputState.composing>=0&&setTimeout(()=>Te.compositionend(o,e),20),!1};const Io=new Set;function dh(o){Io.has(o)||(Io.add(o),o.addEventListener("copy",()=>{}),o.addEventListener("cut",()=>{}))}const Do=["pre-wrap","normal","pre-line","break-spaces"];let It=!1;function Po(){It=!1}class ch{constructor(e){this.lineWrapping=e,this.doc=X.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Do.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let l=e[i];l<0?i++:this.heightSamples[Math.floor(l*10)]||(t=!0,this.heightSamples[Math.floor(l*10)]=!0)}return t}refresh(e,t,i,l,s,a){let r=Do.indexOf(e)>-1,d=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=s,d){this.heightSamples={};for(let c=0;c<a.length;c++){let h=a[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return d}}class hh{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class qe{constructor(e,t,i,l,s){this.from=e,this.length=t,this.top=i,this.height=l,this._content=s}get type(){return typeof this._content=="number"?Le.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 st?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 qe(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var oe=function(o){return o[o.ByPos=0]="ByPos",o[o.ByHeight=1]="ByHeight",o[o.ByPosNoHeight=2]="ByPosNoHeight",o}(oe||(oe={}));const zi=.001;class ve{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>zi&&(It=!0),this.height=e)}replace(e,t,i){return ve.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let s=this,a=i.doc;for(let r=l.length-1;r>=0;r--){let{fromA:d,toA:c,fromB:h,toB:f}=l[r],p=s.lineAt(d,oe.ByPosNoHeight,i.setDoc(t),0,0),u=p.to>=c?p:s.lineAt(c,oe.ByPosNoHeight,i,0,0);for(f+=u.to-c,c=u.to;r>0&&p.from<=l[r-1].toA;)d=l[r-1].fromA,h=l[r-1].fromB,r--,d<p.from&&(p=s.lineAt(d,oe.ByPosNoHeight,i,0,0));h+=p.from-d,d=p.from;let y=ll.build(i.setDoc(a),e,h,f);s=qi(s,s.replace(d,c,y))}return s.updateHeight(i,0)}static empty(){return new Oe(0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,l=0,s=0;for(;;)if(t==i)if(l>s*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),i+=1+r.break,l-=r.size}else if(s>l*2){let r=e[i];r.break?e.splice(i,1,r.left,null,r.right):e.splice(i,1,r.left,r.right),i+=2+r.break,s-=r.size}else break;else if(l<s){let r=e[t++];r&&(l+=r.size)}else{let r=e[--i];r&&(s+=r.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new fh(ve.of(e.slice(0,t)),a,ve.of(e.slice(i)))}}function qi(o,e){return o==e?o:(o.constructor!=e.constructor&&(It=!0),e)}ve.prototype.size=1;class Fo extends ve{constructor(e,t,i){super(e,t),this.deco=i}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.deco||0)}lineAt(e,t,i,l,s){return this.blockAt(0,i,l,s)}forEachLine(e,t,i,l,s,a){e<=s+this.length&&t>=s&&a(this.blockAt(0,i,l,s))}updateHeight(e,t=0,i=!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 Oe extends Fo{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,l){return new qe(l,this.length,i,this.height,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Oe||l instanceof ge&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof ge?l=new Oe(l.length,this.height):l.height=this.height,this.outdated||(l.outdated=!1),l):ve.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setHeight(l.heights[l.index++]):(i||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 ge extends ve{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,s=l-i+1,a,r=0;if(e.lineWrapping){let d=Math.min(this.height,e.lineHeight*s);a=d/s,this.length>s+1&&(r=(this.height-d)/(this.length-s-1))}else a=this.height/s;return{firstLine:i,lastLine:l,perLine:a,perChar:r}}blockAt(e,t,i,l){let{firstLine:s,lastLine:a,perLine:r,perChar:d}=this.heightMetrics(t,l);if(t.lineWrapping){let c=l+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),h=t.doc.lineAt(c),f=r+h.length*d,p=Math.max(i,e-f/2);return new qe(h.from,h.length,p,f,0)}else{let c=Math.max(0,Math.min(a-s,Math.floor((e-i)/r))),{from:h,length:f}=t.doc.line(s+c);return new qe(h,f,i+r*c,r,0)}}lineAt(e,t,i,l,s){if(t==oe.ByHeight)return this.blockAt(e,i,l,s);if(t==oe.ByPosNoHeight){let{from:u,to:y}=i.doc.lineAt(e);return new qe(u,y-u,0,0,0)}let{firstLine:a,perLine:r,perChar:d}=this.heightMetrics(i,s),c=i.doc.lineAt(e),h=r+c.length*d,f=c.number-a,p=l+r*f+d*(c.from-s-f);return new qe(c.from,c.length,Math.max(l,Math.min(p,l+this.height-h)),h,0)}forEachLine(e,t,i,l,s,a){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:r,perLine:d,perChar:c}=this.heightMetrics(i,s);for(let h=e,f=l;h<=t;){let p=i.doc.lineAt(h);if(h==e){let y=p.number-r;f+=d*y+c*(e-s-y)}let u=d+c*p.length;a(new qe(p.from,p.length,f,u,0)),f+=u,h=p.to+1}}replace(e,t,i){let l=this.length-t;if(l>0){let s=i[i.length-1];s instanceof ge?i[i.length-1]=new ge(s.length+l):i.push(null,new ge(l-1))}if(e>0){let s=i[0];s instanceof ge?i[0]=new ge(e+s.length):i.unshift(new ge(e-1),null)}return ve.of(i)}decomposeLeft(e,t){t.push(new ge(e-1),null)}decomposeRight(e,t){t.push(null,new ge(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let s=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],r=Math.max(t,l.from),d=-1;for(l.from>t&&a.push(new ge(l.from-t-1).updateHeight(e,t));r<=s&&l.more;){let h=e.doc.lineAt(r).length;a.length&&a.push(null);let f=l.heights[l.index++];d==-1?d=f:Math.abs(f-d)>=zi&&(d=-2);let p=new Oe(h,f);p.outdated=!1,a.push(p),r+=h+1}r<=s&&a.push(null,new ge(s-r).updateHeight(e,r));let c=ve.of(a);return(d<0||Math.abs(c.height-this.height)>=zi||Math.abs(d-this.heightMetrics(e,t).perLine)>=zi)&&(It=!0),qi(this,c)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class fh extends ve{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let s=i+this.left.height;return e<s?this.left.blockAt(e,t,i,l):this.right.blockAt(e,t,s,l+this.left.length+this.break)}lineAt(e,t,i,l,s){let a=l+this.left.height,r=s+this.left.length+this.break,d=t==oe.ByHeight?e<a:e<r,c=d?this.left.lineAt(e,t,i,l,s):this.right.lineAt(e,t,i,a,r);if(this.break||(d?c.to<r:c.from>r))return c;let h=t==oe.ByPosNoHeight?oe.ByPosNoHeight:oe.ByPos;return d?c.join(this.right.lineAt(r,h,i,a,r)):this.left.lineAt(r,h,i,l,s).join(c)}forEachLine(e,t,i,l,s,a){let r=l+this.left.height,d=s+this.left.length+this.break;if(this.break)e<d&&this.left.forEachLine(e,t,i,l,s,a),t>=d&&this.right.forEachLine(e,t,i,r,d,a);else{let c=this.lineAt(d,oe.ByPos,i,l,s);e<c.from&&this.left.forEachLine(e,c.from-1,i,l,s,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,r,d,a)}}replace(e,t,i){let l=this.left.length+this.break;if(t<l)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let s=[];e>0&&this.decomposeLeft(e,s);let a=s.length;for(let r of i)s.push(r);if(e>0&&$o(s,a-1),t<this.length){let r=s.length;this.decomposeRight(t,s),$o(s,r)}return ve.of(s)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e<i&&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?ve.of(this.break?[e,null,t]:[e,t]):(this.left=qi(this.left,e),this.right=qi(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,i=!1,l){let{left:s,right:a}=this,r=t+s.length+this.break,d=null;return l&&l.from<=t+s.length&&l.more?d=s=s.updateHeight(e,t,i,l):s.updateHeight(e,t,i),l&&l.from<=r+a.length&&l.more?d=a=a.updateHeight(e,r,i,l):a.updateHeight(e,r,i),d?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function $o(o,e){let t,i;o[e]==null&&(t=o[e-1])instanceof ge&&(i=o[e+1])instanceof ge&&o.splice(e-1,3,new ge(t.length+1+i.length))}const uh=5;class ll{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Oe?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Oe(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let l=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;l<0&&(l=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new Fo(a,l,i)):(a||s||l>=uh)&&this.addLineDeco(l,s,a)}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 Oe(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ge(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oe)return e;let t=new Oe(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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Oe)&&!this.isCovered?this.nodes.push(new Oe(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let l of this.nodes)l instanceof Oe&&l.updateHeight(this.oracle,i),i+=l?l.length:1;return this.nodes}static build(e,t,i,l){let s=new ll(i,e);return se.spans(t,i,l,s,0),s.finish(i)}}function ph(o,e,t){let i=new mh;return se.compare(o,e,t,i,0),i.changes}class mh{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,l){(e<t||i&&i.heightRelevant||l&&l.heightRelevant)&&jn(e,t,this.changes,5)}}function gh(o,e){let t=o.getBoundingClientRect(),i=o.ownerDocument,l=i.defaultView||window,s=Math.max(0,t.left),a=Math.min(l.innerWidth,t.right),r=Math.max(0,t.top),d=Math.min(l.innerHeight,t.bottom);for(let c=o.parentNode;c&&c!=i.body;)if(c.nodeType==1){let h=c,f=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&f.overflow!="visible"){let p=h.getBoundingClientRect();s=Math.max(s,p.left),a=Math.min(a,p.right),r=Math.max(r,p.top),d=Math.min(c==o.parentNode?l.innerHeight:d,p.bottom)}c=f.position=="absolute"||f.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,a)-t.left,top:r-(t.top+e),bottom:Math.max(r,d)-(t.top+e)}}function kh(o,e){let t=o.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class sl{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let l=e[i],s=t[i];if(l.from!=s.from||l.to!=s.to||l.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new bh(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class bh extends Ln{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 Ro{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=Lo,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=me.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Xn).some(i=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new ch(t),this.stateDeco=e.facet(li).filter(i=>typeof i!="function"),this.heightMap=ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new Me(0,0,0,e.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:s,to:a})=>l>=s&&l<=a)){let{from:s,to:a}=this.lineBlockAt(l);e.push(new Ui(s,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Lo:new ol(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(ai(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(li).filter(h=>typeof h!="function");let l=e.changedRanges,s=Me.extendWithRanges(l,ph(i,this.stateDeco,e?e.changes:ue.empty(this.state.doc.length))),a=this.heightMap.height,r=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Po(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||It)&&(e.flags|=2),r?(this.scrollAnchorPos=e.changes.mapPos(r.from,-1),this.scrollAnchorHeight=r.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let d=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<d.from||t.range.head>d.to)||!this.viewportIsAppropriate(d))&&(d=this.getViewport(0,t));let c=d.from!=this.viewport.from||d.to!=this.viewport.to;this.viewport=d,e.flags|=this.updateForViewport(),(c||!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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(xc)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?me.RTL:me.LTR;let a=this.heightOracle.mustRefreshForWrapping(s),r=t.getBoundingClientRect(),d=a||this.mustMeasureContent||this.contentDOMHeight!=r.height;this.contentDOMHeight=r.height,this.mustMeasureContent=!1;let c=0,h=0;if(r.width&&r.height){let{scaleX:g,scaleY:m}=xs(t,r);(g>.005&&Math.abs(this.scaleX-g)>.005||m>.005&&Math.abs(this.scaleY-m)>.005)&&(this.scaleX=g,this.scaleY=m,c|=8,a=d=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,p=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=p)&&(this.paddingTop=f,this.paddingBottom=p,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(d=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let u=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=u&&(this.scrollAnchorHeight=-1,this.scrollTop=u),this.scrolledToBottom=Ns(e.scrollDOM);let y=(this.printing?kh:gh)(t,this.paddingTop),k=y.top-this.pixelViewport.top,x=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(d=!0)),!this.inView&&!this.scrollTarget)return 0;let v=r.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=r.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),d){let g=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(g)&&(a=!0),a||l.lineWrapping&&Math.abs(v-this.contentDOMWidth)>l.charWidth){let{lineHeight:m,charWidth:S,textHeight:_}=e.docView.measureTextSize();a=m>0&&l.refresh(s,m,S,_,v/S,g),a&&(e.docView.minWidth=0,c|=8)}k>0&&x>0?h=Math.max(k,x):k<0&&x<0&&(h=Math.min(k,x)),Po();for(let m of this.viewports){let S=m.from==this.viewport.from?g:e.docView.measureVisibleLineHeights(m);this.heightMap=(a?ve.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new Me(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new hh(m.from,S))}It&&(c|=2)}let O=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:r}=this,d=new Ui(l.lineAt(a-i*1e3,oe.ByHeight,s,0,0).from,l.lineAt(r+(1-i)*1e3,oe.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<d.from||c>d.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=l.lineAt(c,oe.ByPos,s,0,0),p;t.y=="center"?p=(f.top+f.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<d.from?p=f.top:p=f.bottom-h,d=new Ui(l.lineAt(p-1e3/2,oe.ByHeight,s,0,0).from,l.lineAt(p+h+1e3/2,oe.ByHeight,s,0,0).to)}}return d}mapViewport(e,t){let i=t.mapPos(e.from,-1),l=t.mapPos(e.to,1);return new Ui(this.heightMap.lineAt(i,oe.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(l,oe.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:l}=this.heightMap.lineAt(e,oe.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,oe.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:r}=this;return(e==0||l<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&s<r+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let l of e)t.touchesRange(l.from,l.to)||i.push(new sl(t.mapPos(l.from),t.mapPos(l.to),l.size));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,l=i?1e4:2e3,s=l>>1,a=l<<1;if(this.defaultTextDirection!=me.LTR&&!i)return[];let r=[],d=(h,f,p,u)=>{if(f-h<s)return;let y=this.state.selection.main,k=[y.from];y.empty||k.push(y.to);for(let w of k)if(w>h&&w<f){d(h,w-10,p,u),d(w+10,f,p,u);return}let x=wh(e,w=>w.from>=p.from&&w.to<=p.to&&Math.abs(w.from-h)<s&&Math.abs(w.to-f)<s&&!k.some(v=>w.from<v&&w.to>v));if(!x){if(f<p.to&&t&&i&&t.visibleRanges.some(w=>w.from<=f&&w.to>=f)){let w=t.moveToLineBoundary(H.cursor(f),!1,!0).head;w>h&&(f=w)}x=new sl(h,f,this.gapSize(p,h,f,u))}r.push(x)},c=h=>{if(h.length<a||h.type!=Le.Text)return;let f=yh(h.from,h.to,this.stateDeco);if(f.total<a)return;let p=this.scrollTarget?this.scrollTarget.range.head:null,u,y;if(i){let k=l/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,w;if(p!=null){let v=Hi(f,p),O=((this.visibleBottom-this.visibleTop)/2+k)/h.height;x=v-O,w=v+O}else x=(this.visibleTop-h.top-k)/h.height,w=(this.visibleBottom-h.top+k)/h.height;u=Wi(f,x),y=Wi(f,w)}else{let k=f.total*this.heightOracle.charWidth,x=l*this.heightOracle.charWidth,w,v;if(p!=null){let O=Hi(f,p),g=((this.pixelViewport.right-this.pixelViewport.left)/2+x)/k;w=O-g,v=O+g}else w=(this.pixelViewport.left-x)/k,v=(this.pixelViewport.right+x)/k;u=Wi(f,w),y=Wi(f,v)}u>h.from&&d(h.from,u,h,f),y<h.to&&d(y,h.to,h,f)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return r}gapSize(e,t,i,l){let s=Hi(l,i)-Hi(l,t);return this.heightOracle.lineWrapping?e.height*s:l.total*this.heightOracle.charWidth*s}updateLineGaps(e){sl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];se.spans(e,this.viewport.from,this.viewport.to,{span(l,s){t.push({from:l,to:s})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((l,s)=>l.from!=t[s].from||l.to!=t[s].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||ai(this.heightMap.lineAt(e,oe.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)||ai(this.heightMap.lineAt(this.scaler.fromDOM(e),oe.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 ai(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 Ui{constructor(e,t){this.from=e,this.to=t}}function yh(o,e,t){let i=[],l=o,s=0;return se.spans(t,o,e,{span(){},point(a,r){a>l&&(i.push({from:l,to:a}),s+=a-l),l=r}},20),l<e&&(i.push({from:l,to:e}),s+=e-l),{total:s,ranges:i}}function Wi({total:o,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(o*t);for(let l=0;;l++){let{from:s,to:a}=e[l],r=a-s;if(i<=r)return s+i;i-=r}}function Hi(o,e){let t=0;for(let{from:i,to:l}of o.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/o.total}function wh(o,e){for(let t of o)if(e(t))return t}const Lo={toDOM(o){return o},fromDOM(o){return o},scale:1,eq(o){return o==this}};class ol{constructor(e,t,i){let l=0,s=0,a=0;this.viewports=i.map(({from:r,to:d})=>{let c=t.lineAt(r,oe.ByPos,e,0,0).top,h=t.lineAt(d,oe.ByPos,e,0,0).bottom;return l+=h-c,{from:r,to:d,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-l)/(t.height-l);for(let r of this.viewports)r.domTop=a+(r.top-s)*this.scale,a=r.domBottom=r.domTop+(r.bottom-r.top),s=r.bottom}toDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return l+(e-i)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);i=s.bottom,l=s.domBottom}}fromDOM(e){for(let t=0,i=0,l=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return i+(e-l)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);i=s.bottom,l=s.domBottom}}eq(e){return e instanceof ol?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function ai(o,e){if(e.scale==1)return o;let t=e.toDOM(o.top),i=e.toDOM(o.bottom);return new qe(o.from,o.length,t,i-t,Array.isArray(o._content)?o._content.map(l=>ai(l,e)):o._content)}const Ki=Q.define({combine:o=>o.join(" ")}),al=Q.define({combine:o=>o.indexOf(!0)>-1}),rl=lt.newName(),jo=lt.newName(),zo=lt.newName(),qo={"&light":"."+jo,"&dark":"."+zo};function dl(o,e,t){return new lt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return o;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):o+" "+i}})}const xh=dl("."+rl,{"&":{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:"#444"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},qo),vh={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},cl=U.ie&&U.ie_version<=11;class Ch{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new lc,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 i of t)this.queue.push(i);(U.ie&&U.ie_version<=11||U.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(U.chrome&&U.chrome_version<126)&&(this.editContext=new Nh(e),e.state.facet(at)&&(e.contentDOM.editContext=this.editContext.editContext)),cl&&(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,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(at)?i.root.activeElement!=this.dom:!Mi(i.dom,l))return;let s=l.anchorNode&&i.docView.nearest(l.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(U.ie&&U.ie_version<=11||U.android&&U.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Zt(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Xt(e.root);if(!t)return!1;let i=U.safari&&e.root.nodeType==11&&ec(this.dom.ownerDocument)==this.dom&&Sh(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Mi(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&oc(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),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 i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,vh),cl&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),cl&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let l=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_t(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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,i=-1,l=!1;for(let s of e){let a=this.readMutation(s);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Mi(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 s=new jc(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}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 i=this.view.state,l=bo(this.view,t);return this.view.state==i&&(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 i=Uo(t,e.previousSibling||e.target.previousSibling,-1),l=Uo(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):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(at)!=e.state.facet(at)&&(e.view.contentDOM.editContext=e.state.facet(at)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.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 Uo(o,e,t){for(;e;){let i=ne.get(e);if(i&&i.parent==o)return i;let l=e.parentNode;e=l!=o.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function Wo(o,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,s=e.endOffset,a=o.docView.domAtPos(o.state.selection.main.anchor);return Zt(a.node,a.offset,l,s)&&([t,i,l,s]=[l,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:s}}function Sh(o,e){if(e.getComposedRanges){let l=e.getComposedRanges(o.root)[0];if(l)return Wo(o,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return o.contentDOM.addEventListener("beforeinput",i,!0),o.dom.ownerDocument.execCommand("indent"),o.contentDOM.removeEventListener("beforeinput",i,!0),t?Wo(o,t):null}class Nh{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(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=i=>{let{anchor:l}=e.state.selection.main,s={from:this.toEditorPos(i.updateRangeStart),to:this.toEditorPos(i.updateRangeEnd),insert:X.of(i.text.split(`
10
+ `))};s.from==this.from&&l<this.from?s.from=l:s.to==this.to&&l>this.to&&(s.to=l),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||il(e,s,H.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=i=>{let l=[],s=null;for(let a=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);a<r;a++){let d=e.coordsForChar(a);s=d&&new DOMRect(d.left,d.top,d.right-d.left,d.bottom-d.top)||s||new DOMRect,l.push(s)}t.updateCharacterBounds(i.rangeStart,l)},this.handlers.textformatupdate=i=>{let l=[];for(let s of i.getTextFormats()){let a=s.underlineStyle,r=s.underlineThickness;if(a!="None"&&r!="None"){let d=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${r=="Thin"?1:2}px`;l.push(we.mark({attributes:{style:d}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:to.of(we.set(l))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let l=Xt(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((s,a,r,d,c)=>{if(i)return;let h=c.length-(a-s);if(l&&a>=l.to)if(l.from==s&&l.to==a&&l.insert.eq(c)){l=this.pendingContextChange=null,t+=h,this.to+=h;return}else l=null,this.revertPending(e.state);if(s+=t,a+=t,a<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+c.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),c.toString()),this.to+=h}t+=h}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange;!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(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)}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,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,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){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class J{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.composing>0}get compositionStarted(){return 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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(s=>i(s,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||sc(e.parent)||document,this.viewState=new Ro(e.state||te.create(e)),e.scrollTo&&e.scrollTo.is(Pi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ni).map(l=>new Yn(l));for(let l of this.plugins)l.update(this);this.observer=new Ch(this),this.inputState=new Hc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ro(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 be?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,i=!1,l,s=this.state;for(let p of e){if(p.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=p.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,r=0,d=null;e.some(p=>p.annotation(To))?(this.inputState.notifiedFocused=a,r=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,d=Ao(s,a),d||(r=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(te.phrases)!=this.state.facet(te.phrases))return this.setState(s);l=Fi.create(this,s,e),l.flags|=r;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let p of e){if(f&&(f=f.map(p.changes)),p.scrollIntoView){let{main:u}=p.state.selection;f=new At(u.empty?u:H.cursor(u.head,u.head>u.anchor?-1:1))}for(let u of p.effects)u.is(Pi)&&(f=u.value.clip(this.state))}this.viewState.update(l,f),this.bidiCache=Qi.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(si)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(p=>p.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Ki)!=l.state.facet(Ki)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let p of this.state.facet(Kn))try{p(l)}catch(u){ze(this.state,u,"update listener")}(d||h)&&Promise.resolve().then(()=>{d&&this.state==d.startState&&this.dispatch(d),h&&!bo(this,h)&&c.force&&_t(this.contentDOM,c.key,c.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 i of this.plugins)i.destroy(this);this.viewState=new Ro(e),this.plugins=e.facet(ni).map(i=>new Yn(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new ro(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(ni),i=e.state.facet(ni);if(t!=i){let l=[];for(let s of i){let a=t.indexOf(s);if(a<0)l.push(new Yn(s));else{let r=this.plugins[a];r.mustUpdate=e,l.push(r)}}for(let s of this.plugins)s.mustUpdate!=e&&s.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!=i&&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(i){ze(this.state,i,"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,i=this.scrollDOM,l=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(l-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let r=0;;r++){if(a<0)if(Ns(i))s=-1,a=this.viewState.heightMap.height;else{let u=this.viewState.scrollAnchorAt(l);s=u.from,a=u.top}this.updateState=1;let d=this.viewState.measure(this);if(!d&&!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 c=[];d&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(u=>{try{return u.read(this)}catch(y){return ze(this.state,y),Ho}}),f=Fi.create(this,this.state,[]),p=!1;f.flags|=d,t?t.flags|=d:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),p=this.docView.update(f),p&&this.docViewUpdate());for(let u=0;u<c.length;u++)if(h[u]!=Ho)try{let y=c[u];y.write&&y.write(h[u],this)}catch(y){ze(this.state,y)}if(p&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let y=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(y>1||y<-1){l=l+y,i.scrollTop=l/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let r of this.state.facet(Kn))r(t)}get themeClasses(){return rl+" "+(this.state.facet(al)?zo:jo)+" "+this.state.facet(Ki)}updateAttrs(){let e=Ko(this,io,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(at)?"true":"false",class:"cm-content",style:`${U.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ko(this,Xn,t);let i=this.observer.ignore(()=>{let l=Rn(this.contentDOM,this.contentAttrs,t),s=Rn(this.dom,this.editorAttrs,e);return l||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(J.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(si);let e=this.state.facet(J.cspNonce);lt.mount(this.root,this.styleModules.concat(xh).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.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.spec==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,i){return tl(this,e,go(this,e,t,i))}moveByGroup(e,t){return tl(this,e,go(this,e,t,i=>Fc(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),l=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return H.cursor(s.side(t,l)+e.from,s.forward(!t,l)?1:-1)}moveToLineBoundary(e,t,i=!0){return Pc(this,e,t,i)}moveVertically(e,t,i){return tl(this,e,$c(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),po(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let l=this.state.doc.lineAt(e),s=this.bidiSpans(l),a=s[ot.find(s,e-l.from,-1,t)];return Ai(i,a.dir==me.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(Zs)||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>Bh)return Ws(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||Us(s.isolates,i=so(this,e))))return s.order;i||(i=so(this,e));let l=bc(e.text,t,i);return this.bidiCache.push(new Qi(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||U.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{vs(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 Pi.of(new At(typeof e=="number"?H.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Pi.of(new At(H.cursor(i.from),"start","start",i.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 Et.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Et.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=lt.newName(),l=[Ki.of(i),si.of(dl(`.${i}`,e))];return t&&t.dark&&l.push(al.of(!0)),l}static baseTheme(e){return Ld.lowest(si.of(dl("."+rl,e,qo)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&ne.get(i)||ne.get(e);return((t=l?.rootView)===null||t===void 0?void 0:t.view)||null}}J.styleModule=si,J.inputHandler=Xs,J.clipboardInputFilter=Qn,J.clipboardOutputFilter=Gn,J.scrollHandler=eo,J.focusChangeEffect=Js,J.perLineTextDirection=Zs,J.exceptionSink=Ys,J.updateListener=Kn,J.editable=at,J.mouseSelectionStyle=Gs,J.dragMovesSelection=Qs,J.clickAddsSelectionRange=Ks,J.decorations=li,J.outerDecorations=no,J.atomicRanges=Jn,J.bidiIsolatedRanges=lo,J.scrollMargins=oo,J.darkTheme=al,J.cspNonce=Q.define({combine:o=>o.length?o[0]:""}),J.contentAttributes=Xn,J.editorAttributes=io,J.lineWrapping=J.contentAttributes.of({class:"cm-lineWrapping"}),J.announce=ce.define();const Bh=4096,Ho={};class Qi{constructor(e,t,i,l,s,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=s,this.order=a}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:me.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let a=e[s];a.dir==l&&!t.touchesRange(a.from,a.to)&&i.push(new Qi(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Ko(o,e,t){for(let i=o.state.facet(e),l=i.length-1;l>=0;l--){let s=i[l],a=typeof s=="function"?s(o):s;a&&$n(a,t)}return t}const Oh=!U.ios,Qo={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Oh&&(Qo[".cm-line"].caretColor=Qo[".cm-content"].caretColor="transparent !important");class Dt extends Bt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Dt.prototype.elementClass="",Dt.prototype.toDOM=void 0,Dt.prototype.mapMode=Be.TrackBefore,Dt.prototype.startSide=Dt.prototype.endSide=-1,Dt.prototype.point=!0;var hl;const Pt=new Y;function Vh(o){return Q.define({combine:o?e=>e.concat(o):void 0})}const _h=new Y;class De{constructor(e,t,i=[],l=""){this.data=e,this.name=l,te.prototype.hasOwnProperty("tree")||Object.defineProperty(te.prototype,"tree",{get(){return fl(this)}}),this.parser=t,this.extension=[$t.of(this),te.languageData.of((s,a,r)=>{let d=Go(s,a,r),c=d.type.prop(Pt);if(!c)return[];let h=s.facet(c),f=d.type.prop(_h);if(f){let p=d.resolve(a-d.from,r);for(let u of f)if(u.test(p,s)){let y=s.facet(u.facet);return u.type=="replace"?y:y.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return Go(e,t,i).type.prop(Pt)==this.data}findRegions(e){let t=e.facet($t);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(s,a)=>{if(s.prop(Pt)==this.data){i.push({from:a,to:a+s.length});return}let r=s.prop(Y.mounted);if(r){if(r.tree.prop(Pt)==this.data){if(r.overlay)for(let d of r.overlay)i.push({from:d.from+a,to:d.to+a});else i.push({from:a,to:a+s.length});return}else if(r.overlay){let d=i.length;if(l(r.tree,r.overlay[0].from+a),i.length>d)return}}for(let d=0;d<s.children.length;d++){let c=s.children[d];c instanceof re&&l(c,s.positions[d]+a)}};return l(fl(e),0),i}get allowsNesting(){return!0}}De.setState=ce.define();function Go(o,e,t){let i=o.facet($t),l=fl(o).topNode;if(!i||i.allowsNesting)for(let s=l;s;s=s.enter(e,t,fe.ExcludeBuffers))s.type.isTop&&(l=s);return l}class Gi extends De{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Vh(e.languageData);return new Gi(t,e.parser.configure({props:[Pt.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Gi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fl(o){let e=o.field(De.state,!1);return e?e.tree:re.empty}class Mh{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 i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let ri=null;class Yi{constructor(e,t,i=[],l,s,a,r,d){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=s,this.viewport=a,this.skipped=r,this.scheduleOn=d,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Yi(e,t,[],re.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Mh(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=re.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;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(ht.addTree(l,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i: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(ht.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ri;ri=this;try{return e()}finally{ri=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Yo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:s,viewport:a,skipped:r}=this;if(this.takeTree(),!e.empty){let d=[];if(e.iterChangedRanges((c,h,f,p)=>d.push({fromA:c,toA:h,fromB:f,toB:p})),i=ht.applyChanges(i,d),l=re.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){r=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),f=e.mapPos(c.to,-1);h<f&&r.push({from:h,to:f})}}}return new Yi(this.parser,t,i,l,s,a,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 i=0;i<this.skipped.length;i++){let{from:l,to:s}=this.skipped[i];l<e.to&&s>e.from&&(this.fragments=Yo(this.fragments,l,s),this.skipped.splice(i--,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 Il{createParse(t,i,l){let s=l[0].from,a=l[l.length-1].to;return{parsedPos:s,advance(){let d=ri;if(d){for(let c of l)d.tempSkipped.push(c);e&&(d.scheduleOn=d.scheduleOn?Promise.all([d.scheduleOn,e]):e)}return this.parsedPos=a,new re(Ce.none,[],[],a-s)},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 ri}}function Yo(o,e,t){return ht.applyChanges(o,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ft{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ft(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Yi.create(e.facet($t).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ft(i)}}De.state=pt.define({create:Ft.init,update(o,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet($t)!=e.state.facet($t)?Ft.init(e.state):o.apply(e)}});let Xo=o=>{let e=setTimeout(()=>o(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Xo=o=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(o,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ul=typeof navigator<"u"&&(!((hl=navigator.scheduling)===null||hl===void 0)&&hl.isInputPending)?()=>navigator.scheduling.isInputPending():null,Th=Et.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(De.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(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Xo(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:i,viewport:{to:l}}=this.view,s=i.field(De.state);if(s.tree==s.context.tree&&s.context.isDone(l+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!ul?Math.max(25,e.timeRemaining()-5):1e9),r=s.context.treeLen<l&&i.doc.length>l+1e3,d=s.context.work(()=>ul&&ul()||Date.now()>a,l+(r?0:1e5));this.chunkBudget-=Date.now()-t,(d||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Ft(s.context))})),this.chunkBudget>0&&!(d&&!r)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ze(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()}}}),$t=Q.define({combine(o){return o.length?o[0]:null},enables:o=>[De.state,Th,J.contentAttributes.compute([o],e=>{let t=e.facet(o);return t&&t.name?{"data-language":t.name}:{}})]});class Ah{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Eh=new Y;function Jo({except:o,units:e=1}={}){return t=>{let i=o&&o.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Ih=new Y;function Dh(o){let e=o.firstChild,t=o.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?o.to:t.from}:null}class pl{constructor(e,t){this.specs=e;let i;function l(r){let d=lt.newName();return(i||(i=Object.create(null)))["."+d]=r,d}const s=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof De?r=>r.prop(Pt)==a.data:a?r=>r==a:void 0,this.style=zl(e.map(r=>({tag:r.tag,class:r.class||l(Object.assign({},r,{tag:null}))})),{all:s}).style,this.module=i?new lt(i):null,this.themeType=t.themeType}static define(e,t){return new pl(e,t||{})}}R.meta,R.link,R.heading,R.emphasis,R.strong,R.strikethrough,R.keyword,R.atom,R.bool,R.url,R.contentSeparator,R.labelName,R.literal,R.inserted,R.string,R.deleted,R.regexp,R.escape,R.string,R.variableName,R.variableName,R.typeName,R.namespace,R.className,R.variableName,R.macroName,R.propertyName,R.comment,R.invalid;const Ph=Object.create(null),Zo=[Ce.none],ea=[],ta=Object.create(null),Fh=Object.create(null);for(let[o,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"]])Fh[o]=$h(Ph,e);function ml(o,e){ea.indexOf(o)>-1||(ea.push(o),console.warn(e))}function $h(o,e){let t=[];for(let r of e.split(" ")){let d=[];for(let c of r.split(".")){let h=o[c]||R[c];h?typeof h=="function"?d.length?d=d.map(h):ml(c,`Modifier ${c} used at start of tag`):d.length?ml(c,`Tag ${c} used as modifier`):d=Array.isArray(h)?h:[h]:ml(c,`Unknown highlighting tag ${c}`)}for(let c of d)t.push(c)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(r=>r.id),s=ta[l];if(s)return s.id;let a=ta[l]=Ce.define({id:Zo.length,name:i,props:[jl({[i]:t})]});return Zo.push(a),a.id}me.RTL,me.LTR;const Rh=Gi.define({name:"json",parser:Id.configure({props:[Eh.add({Object:Jo({except:/^\s*\}/}),Array:Jo({except:/^\s*\]/})}),Ih.add({"Object Array":Dh})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Lh(){return new Ah(Rh)}const gl=[{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 jh(){const o=Ae();if(o.formRules?.length){const e={};gl.forEach(i=>{e[i.name]=i});const t=[...gl];return o.formRules.forEach(i=>{const l=e[i.name];l?Object.assign(l,i):t.push(l)}),t}return gl}const zh={loadAdvances:jh},qh={class:"unione-props-setting data-field-setting"},Uh={key:0},Wh=["onClick"],Hh={class:"field-txt"},Kh=["onClick"],Qh={key:1,class:"field-txt"},Gh=["onClick"],Yh={key:0,class:"field-txt"},Xh={key:3,class:"edit-field"},Jh=["onClick"],Zh=ee(n.defineComponent({__name:"dataFieldSetting",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=n.ref([Lh()]),t=n.ref([{title:"序号",dataIndex:"index",key:"index",width:"30px",fixed:"left",align:"center",customRender:({index:g})=>g+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"}]),i=n.useModel(o,"modelValue"),l={mounted:g=>g.focus()},s=n.ref({});function a(){const g=Object.keys(s.value);if(g.length)for(let m in g){const S=i.value.filter(_=>_.name==m);if(S&&S[0]){let _=s.value[m];Object.keys(_).forEach(C=>{C=="convertName"?(S[0].convert||(S[0].convert={}),S[0].convert.type=_[C]):S[0][C]=_[C]})}}s.value={}}function r(g,m){a();const S={};m=="convertName"?(g.convert||(g.convert={}),S[m]=g.convert?.type):S[m]=g[m]||"",s.value[g.name]=S}function d(g,m){{s.value={};return}}function c(g,m){switch(m){case"query":return g.configs?.query?.enable;case"form":return g.configs?.show?.form?.enable;case"view":return g.configs?.show?.view?.enable;case"list":return g.configs?.show?.list?.enable;case"sort":return g.configs?.sort?.enable}}function h(g,m){switch(m){case"query":g.configs=K.utils.obj.ext(g.configs,{query:{enable:!1}}),g.configs.query.enable=!g.configs.query.enable;break;case"form":g.configs=K.utils.obj.ext(g.configs,{show:{form:{enable:!1}}}),g.configs.show.form.enable=!g.configs.show.form.enable;break;case"view":g.configs=K.utils.obj.ext(g.configs,{show:{view:{enable:!1}}}),g.configs.show.view.enable=!g.configs.show.view.enable;break;case"list":g.configs=K.utils.obj.ext(g.configs,{show:{list:{enable:!1}}}),g.configs.show.list.enable=!g.configs.show.list.enable;break;case"sort":g.configs=K.utils.obj.ext(g.configs,{sort:{enable:!1}}),g.configs.sort.enable=!g.configs.sort.enable;break}console.log("record.configs",g.configs)}const f=n.ref({title:"列头设置",prop:"list",visible:!1,field:{},show:{},toSetting:()=>{f.value.visible=!1}});function p(g,m){switch(f.value.prop=m,f.value.field=g,g.configs||(g.configs={}),g.configs.show||(g.configs.show={}),m){case"query":g.configs.query||(g.configs.query={}),g.configs.query.types||(g.configs.query.types="EQ"),f.value.show=g.configs.query,f.value.title=`查询设置/${g.title}(${g.name})`;break;case"form":g.configs.show.form||(g.configs.show.form={}),f.value.show=g.configs.show.form,f.value.title=`表单设置/${g.title}(${g.name})`;break;case"view":g.configs.show.view||(g.configs.show.view={}),f.value.show=g.configs.show.view,f.value.title=`详情设置/${g.title}(${g.name})`;break;case"list":g.configs.show.list||(g.configs.show.list={}),f.value.show=g.configs.show.list,f.value.title=`列头设置/${g.title}(${g.name})`;break;case"sort":g.configs.sort||(g.configs.sort={}),f.value.show=g.configs.sort,f.value.title=`排序设置/${g.title}(${g.name})`;break}f.value.visible=!0}const u=n.ref({options:[{value:"keywords",label:"关键字"},{value:"equle",label:"精确"},{value:"like",label:"模糊"},{value:"like-right",label:"右模糊"},{value:"like-left",label:"左模糊"},{value:"range",label:"范围"}],showLabel:g=>{const m=u.value.options.filter(S=>S.value==g);return m[0]?m[0].label:g}}),y=n.ref({visible:!1,field:{},props:{},advances:zh.loadAdvances(),showInfo:g=>{let m=0;if(g.configs?.rule){const S=g.configs.rule;S.advance&&m++,typeof S.rangeMin<"u"&&m++,typeof S.rangeMax<"u"&&m++,typeof S.regExpress<"u"&&m++}if(m>0)return"("+m+")"},toSetting:()=>{const g=y.value.props;y.value.field.configs=K.utils.obj.ext(y.value.field.configs,{rule:{...g}}),y.value.visible=!1,y.value.props={}}});function k(g){y.value.visible=!0,y.value.field=g,y.value.props=g.configs?.rule||{}}const x=n.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:g=>{const m=g.configs?.widget?.name,S=x.value.widgets.filter(_=>_.value==m);return S[0]?S[0].label:m},toSetting:(g,m)=>{g.configs||(g.configs={}),g.configs.widget||(g.configs.widget={}),g.configs.widget.name=m},toclose:()=>{x.value.visible=!1}});function w(g){x.value.field=g,g.configs=K.utils.obj.ext(g.configs,{widget:{props:{}}}),x.value.widget=g.configs.widget,x.value.visible=!0}const v=n.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:(g,m="--")=>v.value.types.filter(S=>S.value==g)[0]?.label||m,toAddOption:()=>{v.value.convert.options||(v.value.convert.options=[]),v.value.convert.options.push({label:"",value:""})},toDelOption:(g,m)=>{v.value.convert.options.splice(g,1)},toSetting:()=>{v.value.visible=!1}});function O(g){v.value.visible=!0,v.value.field=g,g.configs||(g.configs={}),g.configs.convert||(g.configs.convert={}),v.value.convert=g.configs.convert}return(g,m)=>{const S=n.resolveComponent("ToolOutlined"),_=n.resolveComponent("a-button"),C=n.resolveComponent("a-select"),b=n.resolveComponent("a-checkbox"),B=n.resolveComponent("a-table"),T=n.resolveComponent("a-switch"),V=n.resolveComponent("a-form-item"),F=n.resolveComponent("a-select-option"),D=n.resolveComponent("a-input-number"),P=n.resolveComponent("a-form"),E=n.resolveComponent("a-modal"),A=n.resolveComponent("a-input"),M=n.resolveComponent("unione-select-box"),z=n.resolveComponent("a-checkbox-group"),$=n.resolveComponent("unione-section");return n.openBlock(),n.createElementBlock("div",qh,[n.createVNode(B,{columns:t.value,"data-source":i.value,bordered:"",scroll:{x:1e3},pagination:!0,"row-key":"name",size:"small"},{headerCell:n.withCtx(({column:N})=>[["widget","queryType","rules","convertName"].includes(N.key)?(n.openBlock(),n.createElementBlock("span",Uh,[n.createVNode(S),n.createTextVNode(" "+n.toDisplayString(N.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:N,text:W,record:I})=>[["rules"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",!y.value.showInfo(I)&&"empty"]),onClick:q=>k(I)},[n.createElementVNode("span",Hh,n.toDisplayString(y.value.showInfo(I)),1),y.value.showInfo(I)?(n.openBlock(),n.createBlock(_,{key:0,type:"link"},{default:n.withCtx(()=>m[50]||(m[50]=[n.createTextVNode("设置")])),_:1})):n.createCommentVNode("",!0)],10,Wh)):["widget"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(N.dataIndex))&&!W&&"empty"]),onClick:q=>r(I,N.dataIndex)},[s.value[I.name]&&Object.keys(s.value[I.name]).includes(N.dataIndex)?n.withDirectives((n.openBlock(),n.createBlock(C,{key:0,value:I.configs?.widget?.name,allowClear:!0,options:x.value.widgets,onChange:q=>x.value.toSetting(I,q),onBlur:m[0]||(m[0]=q=>d())},null,8,["value","options","onChange"])),[[l]]):(n.openBlock(),n.createElementBlock("span",Qh,n.toDisplayString(x.value.widgetName(I)),1)),n.createVNode(_,{type:"link",onClick:n.withModifiers(q=>w(I),["stop"])},{default:n.withCtx(()=>m[51]||(m[51]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])],10,Kh)):["convertName"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[I.name]||!Object.keys(s.value[I.name]).includes(N.dataIndex))&&!I.convert?.type&&"empty"]),onClick:q=>O(I)},[I.configs?.convert?.types?(n.openBlock(),n.createElementBlock("span",Yh,n.toDisplayString(v.value.getTypes(I.configs.convert.types)),1)):n.createCommentVNode("",!0)],10,Gh)):["query","form","view","list","sort"].includes(N.dataIndex)?(n.openBlock(),n.createElementBlock("div",Xh,[n.createVNode(b,{checked:c(I,N.dataIndex),onClick:q=>h(I,N.dataIndex)},null,8,["checked","onClick"]),n.createVNode(_,{type:"link",onClick:q=>p(I,N.dataIndex)},{default:n.withCtx(()=>m[52]||(m[52]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])])):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(E,{visible:f.value.visible,"onUpdate:visible":m[14]||(m[14]=N=>f.value.visible=N),width:600,title:f.value.title,onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(P,{model:f.value.show,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:n.normalizeClass(["field-setting-form","form-mix",f.value.prop])},{default:n.withCtx(()=>[n.createVNode(V,{label:"启用状态"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.show.enable,"onUpdate:checked":m[1]||(m[1]=N=>f.value.show.enable=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1}),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:0,label:"默认排序"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.show.defoult,"onUpdate:checked":m[2]||(m[2]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="sort"?(n.openBlock(),n.createBlock(V,{key:1,label:"排序方式"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.show.asc,"onUpdate:checked":m[3]||(m[3]=N=>f.value.show.asc=N),checkedChildren:"升序",unCheckedChildren:"降序"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"&&f.value.show.types=="ADVANCE"?(n.openBlock(),n.createBlock(V,{key:2,label:"高级查询"})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:3,label:"默认查询",tooltip:"开启后该字段加入关键字查询"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.show.defoult,"onUpdate:checked":m[4]||(m[4]=N=>f.value.show.defoult=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:4,label:"默认显示",tooltip:"开启后,在查询表单中默认显示该查询字段"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.show.visible,"onUpdate:checked":m[5]||(m[5]=N=>f.value.show.visible=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),f.value.prop=="query"?(n.openBlock(),n.createBlock(V,{key:5,label:"查询方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.types,"onUpdate:value":m[6]||(m[6]=N=>f.value.show.types=N)},{default:n.withCtx(()=>[n.createVNode(F,{key:"EQ",value:"EQ"},{default:n.withCtx(()=>m[53]||(m[53]=[n.createTextVNode("精确查询")])),_:1}),n.createVNode(F,{key:"LIKE",value:"LIKE"},{default:n.withCtx(()=>m[54]||(m[54]=[n.createTextVNode("模糊查询")])),_:1}),n.createVNode(F,{key:"LLIKE",value:"LLIKE"},{default:n.withCtx(()=>m[55]||(m[55]=[n.createTextVNode("左模糊")])),_:1}),n.createVNode(F,{key:"RLIKE",value:"RLIKE"},{default:n.withCtx(()=>m[56]||(m[56]=[n.createTextVNode("右模糊")])),_:1}),n.createVNode(F,{key:"RANGE",value:"RANGE"},{default:n.withCtx(()=>m[57]||(m[57]=[n.createTextVNode("范围查询")])),_:1}),n.createVNode(F,{key:"ADVANCE",value:"ADVANCE"},{default:n.withCtx(()=>m[58]||(m[58]=[n.createTextVNode("高级查询")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0),["query","sort"].includes(f.value.prop)?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:6,label:"显示顺序",tooltip:"默认根据字段顺序显示,若需调整字段显示顺序,可以通过这里设置!"},{default:n.withCtx(()=>[n.createVNode(D,{value:f.value.show.index,"onUpdate:value":m[7]||(m[7]=N=>f.value.show.index=N)},null,8,["value"])]),_:1})),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:7,label:"显示宽度",tooltip:"字段显示宽度,0-24,设置成0,根据表单默认配置"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.width,"onUpdate:value":m[8]||(m[8]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:8,label:"显示宽度",tooltip:"字段显示宽度"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,value:f.value.show.width,"onUpdate:value":m[9]||(m[9]=N=>f.value.show.width=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:9,label:"标题宽度",tooltip:"表单title部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.labelWidth,"onUpdate:value":m[10]||(m[10]=N=>f.value.show.labelWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["form","view"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:10,label:"控件宽度",tooltip:"表单组件部分显示宽度,0-24"},{default:n.withCtx(()=>[n.createVNode(D,{min:0,max:24,value:f.value.show.valueWidth,"onUpdate:value":m[11]||(m[11]=N=>f.value.show.valueWidth=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:11,label:"固定位置"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.fixed,"onUpdate:value":m[12]||(m[12]=N=>f.value.show.fixed=N),allowClear:"",options:[{value:"left",label:"靠左"},{value:"right",label:"靠右"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["list"].includes(f.value.prop)?(n.openBlock(),n.createBlock(V,{key:12,label:"对齐方式"},{default:n.withCtx(()=>[n.createVNode(C,{value:f.value.show.align,"onUpdate:value":m[13]||(m[13]=N=>f.value.show.align=N),options:[{value:"left",label:"左对齐"},{value:"center",label:"居中"},{value:"right",label:"右对齐"}]},null,8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model","class"])]),_:1},8,["visible","title","onOk"]),n.createVNode(E,{visible:v.value.visible,"onUpdate:visible":m[33]||(m[33]=N=>v.value.visible=N),width:600,title:v.value.getTypes(v.value.convert.types,"转换")+"设置",onOk:v.value.toSetting},{default:n.withCtx(()=>[n.createVNode(P,{model:v.value.convert,name:"basic","label-col":{span:5},"wrapper-col":{span:17},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"转换类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:v.value.convert.types,"onUpdate:value":m[15]||(m[15]=N=>v.value.convert.types=N),allowClear:!0,options:v.value.types},null,8,["value","options"])]),_:1}),["unione-select-box","unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"是否搜索"},{default:n.withCtx(()=>[n.createVNode(T,{checked:f.value.convert.search,"onUpdate:checked":m[16]||(m[16]=N=>f.value.convert.search=N),checkedChildren:"启用",unCheckedChildren:"停用"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="option"?(n.openBlock(),n.createBlock(V,{key:1,label:"选项设置"},{default:n.withCtx(()=>[n.createVNode(_,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:v.value.toAddOption},{default:n.withCtx(()=>m[59]||(m[59]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(B,{columns:v.value.optionColumn,"data-source":v.value.convert.options,size:"small"},{bodyCell:n.withCtx(({column:N,record:W,index:I})=>[N.dataIndex==="label"?(n.openBlock(),n.createBlock(A,{key:0,value:W.label,"onUpdate:value":q=>W.label=q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="value"?(n.openBlock(),n.createBlock(A,{key:1,value:W.value,"onUpdate:value":q=>W.value=q,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):n.createCommentVNode("",!0),N.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:2,onClick:q=>v.value.toDelOption(I,W)},"删除",8,Jh)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1})):n.createCommentVNode("",!0),["dbtable","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:2,label:"数据源"},{default:n.withCtx(()=>[n.createVNode(M,{value:v.value.convert.dsId,"onUpdate:value":m[17]||(m[17]=N=>v.value.convert.dsId=N),convert:{types:"local",url:"/api/data/source/find",search:!0}},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:3,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableName,"onUpdate:value":m[18]||(m[18]=N=>v.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:4,label:"table名称"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableName,"onUpdate:value":m[19]||(m[19]=N=>v.value.convert.tableName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:5,label:"主键字段"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.idField,"onUpdate:value":m[20]||(m[20]=N=>v.value.convert.idField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"&&["unione-tree-box"].includes(v.value.field.widget?.name)?(n.openBlock(),n.createBlock(V,{key:6,label:"父级字段"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.pidField,"onUpdate:value":m[21]||(m[21]=N=>v.value.convert.pidField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:7,label:"value字段"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.valueField,"onUpdate:value":m[22]||(m[22]=N=>v.value.convert.valueField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:8,label:"label字段"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.labelField,"onUpdate:value":m[23]||(m[23]=N=>v.value.convert.labelField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:9,label:"扩展字段",tooltip:"默认只加载value,label字段,可以通过该属性加载其他更多字段,多个字段用逗号分隔"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableField,"onUpdate:value":m[24]||(m[24]=N=>v.value.convert.tableField=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:10,label:"数据过滤",tooltip:"支持数据条件过滤,eg:sex=1"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableWhere,"onUpdate:value":m[25]||(m[25]=N=>v.value.convert.tableWhere=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:11,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableOrder,"onUpdate:value":m[26]||(m[26]=N=>v.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:12,label:"数据排序",tooltip:"设置数据进行排序方式,eg:age desc"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.tableOrder,"onUpdate:value":m[27]||(m[27]=N=>v.value.convert.tableOrder=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:13,label:"异步加载"},{default:n.withCtx(()=>[n.createVNode(T,{checked:v.value.convert.isAsync,"onUpdate:checked":m[28]||(m[28]=N=>v.value.convert.isAsync=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dbtable"?(n.openBlock(),n.createBlock(V,{key:14,label:"分页加载"},{default:n.withCtx(()=>[n.createVNode(T,{checked:v.value.convert.isPaging,"onUpdate:checked":m[29]||(m[29]=N=>v.value.convert.isPaging=N),checkedChildren:"是",unCheckedChildren:"否"},null,8,["checked"])]),_:1})):n.createCommentVNode("",!0),v.value.convert.types=="dict"?(n.openBlock(),n.createBlock(V,{key:15,label:"字典名称"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.dictName,"onUpdate:value":m[30]||(m[30]=N=>v.value.convert.dictName=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:16,label:"接口地址",tooltip:"统一使用POST请求,json提交,标准结构:{body:{参数}}"},{default:n.withCtx(()=>[n.createVNode(A,{value:v.value.convert.url,"onUpdate:value":m[31]||(m[31]=N=>v.value.convert.url=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),["local","remote"].includes(v.value.convert.types)?(n.openBlock(),n.createBlock(V,{key:17,label:"接口参数",tooltip:"标准json对象/数组,直接使用该参数进行接口请求,请求确保结构和接口匹配!"},{default:n.withCtx(()=>[n.createVNode(n.unref(Rt.Codemirror),{modelValue:v.value.convert.params,"onUpdate:modelValue":m[32]||(m[32]=N=>v.value.convert.params=N),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})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","title","onOk"]),n.createVNode(E,{visible:x.value.visible,"onUpdate:visible":m[40]||(m[40]=N=>x.value.visible=N),width:600,title:"控件设置",onOk:x.value.toclose},{default:n.withCtx(()=>[n.createVNode(P,{model:x.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(V,{label:"组件类型"},{default:n.withCtx(()=>[n.withDirectives(n.createVNode(C,{value:x.value.widget.name,"onUpdate:value":m[34]||(m[34]=N=>x.value.widget.name=N),allowClear:!0,options:x.value.widgets},null,8,["value","options"]),[[l]])]),_:1}),n.createVNode(V,{label:"输入提示"},{default:n.withCtx(()=>[n.createVNode(A,{value:x.value.widget.placeholder,"onUpdate:value":m[35]||(m[35]=N=>x.value.widget.placeholder=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"帮助说明"},{default:n.withCtx(()=>[n.createVNode(A,{value:x.value.widget.help,"onUpdate:value":m[36]||(m[36]=N=>x.value.widget.help=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"提示文本"},{default:n.withCtx(()=>[n.createVNode(A,{value:x.value.widget.tooltip,"onUpdate:value":m[37]||(m[37]=N=>x.value.widget.tooltip=N)},null,8,["value"])]),_:1}),["a-date-picker"].includes(x.value.widget.name)?(n.openBlock(),n.createBlock(V,{key:0,label:"显示格式"},{default:n.withCtx(()=>[n.createVNode(A,{value:x.value.field.dataFormat,"onUpdate:value":m[38]||(m[38]=N=>x.value.field.dataFormat=N)},null,8,["value"])]),_:1})):n.createCommentVNode("",!0),x.value.widget.name=="unione-select-box"?(n.openBlock(),n.createBlock(V,{key:1,label:"下拉框类型"},{default:n.withCtx(()=>[n.createVNode(C,{value:x.value.widget.props.mode,"onUpdate:value":m[39]||(m[39]=N=>x.value.widget.props.mode=N),allowClear:!0},{default:n.withCtx(()=>[n.createVNode(F,{value:"multiple"},{default:n.withCtx(()=>m[60]||(m[60]=[n.createTextVNode("多选")])),_:1}),n.createVNode(F,{value:"tags"},{default:n.withCtx(()=>m[61]||(m[61]=[n.createTextVNode("标签")])),_:1})]),_:1},8,["value"])]),_:1})):n.createCommentVNode("",!0)]),_:1},8,["model"])]),_:1},8,["visible","onOk"]),n.createVNode(E,{visible:y.value.visible,"onUpdate:visible":m[49]||(m[49]=N=>y.value.visible=N),width:600,title:"规则设置",onOk:y.value.toSetting},{default:n.withCtx(()=>[n.createVNode(P,{model:y.value.props,name:"basic","label-col":{span:6},"wrapper-col":{span:18},autocomplete:"off",class:"form-mix"},{default:n.withCtx(()=>[n.createVNode($,{title:"基本设置",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"触发时机"},{default:n.withCtx(()=>[n.createVNode(z,{value:y.value.props.trigger,"onUpdate:value":m[41]||(m[41]=N=>y.value.props.trigger=N),options:["change","blur"]},null,8,["value"])]),_:1}),y.value.field.isNull?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(V,{key:0,label:"忽略空格",class:"checkbox-tips"},{default:n.withCtx(()=>[n.createVNode(b,{checked:y.value.props.whitespace,"onUpdate:checked":m[42]||(m[42]=N=>y.value.props.whitespace=N)},{default:n.withCtx(()=>m[62]||(m[62]=[n.createTextVNode(" 必填验证开启时,是否忽略空格 ")])),_:1},8,["checked"])]),_:1})),n.createVNode(V,{label:"预设类型"},{default:n.withCtx(()=>[n.createVNode(C,{options:y.value.advances,fieldNames:{label:"title",value:"name"},value:y.value.props.advance,"onUpdate:value":m[43]||(m[43]=N=>y.value.props.advance=N)},null,8,["options","value"])]),_:1})]),_:1}),["Long","Short","Integer","Float","Double"].includes(y.value.field.dataType)?(n.openBlock(),n.createBlock($,{key:0,title:"数值验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"有效区间"},{default:n.withCtx(()=>[n.createVNode(D,{value:y.value.props.rangeMin,"onUpdate:value":m[44]||(m[44]=N=>y.value.props.rangeMin=N)},null,8,["value"]),m[63]||(m[63]=n.createElementVNode("span",{style:{margin:"auto 5px"}},null,-1)),n.createVNode(D,{value:y.value.props.rangeMax,"onUpdate:value":m[45]||(m[45]=N=>y.value.props.rangeMax=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(A,{value:y.value.props.rangeMessage,"onUpdate:value":m[46]||(m[46]=N=>y.value.props.rangeMessage=N)},null,8,["value"])]),_:1})]),_:1})):n.createCommentVNode("",!0),n.createVNode($,{title:"正则验证",type:"line"},{default:n.withCtx(()=>[n.createVNode(V,{label:"表达式"},{default:n.withCtx(()=>[n.createVNode(A,{value:y.value.props.regExpress,"onUpdate:value":m[47]||(m[47]=N=>y.value.props.regExpress=N)},null,8,["value"])]),_:1}),n.createVNode(V,{label:"错误提示"},{default:n.withCtx(()=>[n.createVNode(A,{value:y.value.props.regMessage,"onUpdate:value":m[48]||(m[48]=N=>y.value.props.regMessage=N)},null,8,["value"])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-d5938ab8"]]),ef={class:"unione-props-setting data-field-fkey"},tf={key:0},nf=["onClick"],lf=["onClick"],sf=["onClick"],of=["onClick"],af=["onClick"],rf=["onClick"],df=["onClick"],cf=["onClick"],hf=ee(n.defineComponent({__name:"dataFieldFKeys",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.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"}]),i=n.useModel(o,"modelValue"),l=n.computed(()=>i.value.filter(p=>p.configs?.fkey?.enable)||[]),s=n.ref({});function a(){s.value={}}function r(p,u){a();const y={};y[u]=p.configs.fkey[u]||"",s.value[p.name]=y}function d(p,u,y){p.configs.fkey.dsn=u,p.configs.fkey.dsnName=y.name,p.configs.fkey.dsnTitle=y.title,p.configs.fkey.dsnId=y.id}function c(p,u,y,k){p.configs.fkey[u]=y,u=="fieldName"&&(p.configs.fkey.fieldTitle=k.title),u=="labelName"&&(p.configs.fkey.labelTitle=k.title)}function h(p){f.value.record=p,f.value.visible=!0,f.value.fields=p.configs?.fkey?.fields||[]}const f=n.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,u)=>{f.value.editField[p]=u},onShowFieldChange:(p,u,y)=>{p.name=y.name,p.title=y.title},toAddField:()=>{f.value.fields.push({name:"",title:""}),f.value.editField[f.value.fields.length-1]="title"},toDelField:p=>{e.confirm({content:"确定要删除该字段么?",onOk:()=>{f.value.fields.splice(p,1)}})},toSetting:()=>{f.value.visible=!1,f.value.record.configs=K.utils.obj.ext(f.value.record.configs,{fkey:{fields:f.value.fields}})}});return(p,u)=>{const y=n.resolveComponent("FormOutlined"),k=n.resolveComponent("unione-select-box"),x=n.resolveComponent("a-button"),w=n.resolveComponent("a-table"),v=n.resolveComponent("a-input-number"),O=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",ef,[n.createVNode(w,{columns:t.value,"data-source":l.value,bordered:"","row-key":"name",size:"small",pagination:!1},{headerCell:n.withCtx(({column:g})=>[["dsnName","dsnTitle","fieldName","labelName"].includes(g.key)?(n.openBlock(),n.createElementBlock("span",tf,[n.createVNode(y),n.createTextVNode(" "+n.toDisplayString(g.title),1)])):n.createCommentVNode("",!0)]),bodyCell:n.withCtx(({column:g,record:m})=>[["dsnName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[s.value[m.name]&&Object.keys(s.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[m.name][g.dataIndex],"onUpdate:value":S=>s.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"name",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.dsnName),1)],64))],10,nf)):["dsnTitle"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.dsnTitle&&"empty"]),onClick:S=>r(m,g.dataIndex)},[s.value[m.name]&&Object.keys(s.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[m.name][g.dataIndex],"onUpdate:value":S=>s.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/define/find",valueField:"sn",labelField:"title",search:!0},onBlur:a,onSelect:(S,_)=>d(m,S,_)},null,8,["value","onUpdate:value","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.dsnTitle),1)],64))],10,lf)):n.createCommentVNode("",!0),["fieldName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.fieldName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[s.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(s.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[m.name][g.dataIndex],"onUpdate:value":S=>s.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"fieldName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.fieldTitle),1)],64))],10,sf)):["labelName"].includes(g.dataIndex)?(n.openBlock(),n.createElementBlock("div",{key:3,class:n.normalizeClass(["edit-field",(!s.value[m.name]||!Object.keys(s.value[m.name]).includes(g.dataIndex))&&!m.configs?.fkey?.labelName&&"empty"]),onClick:S=>r(m,g.dataIndex)},[s.value[m.name]&&m.configs?.fkey?.dsn&&Object.keys(s.value[m.name]).includes(g.dataIndex)?(n.openBlock(),n.createBlock(k,{key:0,value:s.value[m.name][g.dataIndex],"onUpdate:value":S=>s.value[m.name][g.dataIndex]=S,convert:{types:"local",url:"/api/data/field/find",params:{body:{defineId:m.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:a,onSelect:(S,_)=>c(m,"labelName",S,_)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(m.configs?.fkey?.labelTitle)+" ",1),m.configs?.fkey?.labelName?(n.openBlock(),n.createBlock(x,{key:0,type:"link",onClick:n.withModifiers(S=>h(m),["stop"])},{default:n.withCtx(()=>u[4]||(u[4]=[n.createTextVNode("设置")])),_:2},1032,["onClick"])):n.createCommentVNode("",!0)],64))],10,of)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"]),n.createVNode(O,{visible:f.value.visible,"onUpdate:visible":u[3]||(u[3]=g=>f.value.visible=g),width:600,title:"更多显示字段",class:"data-field-fkey",onOk:f.value.toSetting},{default:n.withCtx(()=>[n.createVNode(x,{class:"editable-add-btn",style:{"margin-bottom":"8px"},onClick:f.value.toAddField},{default:n.withCtx(()=>u[5]||(u[5]=[n.createTextVNode("新增")])),_:1},8,["onClick"]),n.createVNode(w,{columns:f.value.columns,"data-source":f.value.fields,size:"small"},{bodyCell:n.withCtx(({column:g,record:m,index:S,text:_})=>[g.dataIndex==="title"?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["edit-field",f.value.editField!="title"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="title"?(n.openBlock(),n.createBlock(k,{key:0,value:m[m.dataIndex],"onUpdate:value":C=>m[m.dataIndex]=C,convert:{types:"local",url:"/api/data/field/find",search:!0,params:{body:{defineId:f.value.record.configs.fkey.dsnId},pageSize:1e3},valueField:"name",labelField:"title"},onBlur:u[0]||(u[0]=C=>f.value.editField={}),onSelect:(C,b)=>f.value.onShowFieldChange(m,C,b)},null,8,["value","onUpdate:value","convert","onSelect"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,af)):n.createCommentVNode("",!0),g.dataIndex==="width"?(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["edit-field",f.value.editField!="width"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="width"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:u[1]||(u[1]=C=>f.value.editField={}),value:m.width,"onUpdate:value":C=>m.width=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,rf)):n.createCommentVNode("",!0),g.dataIndex==="index"?(n.openBlock(),n.createElementBlock("div",{key:2,class:n.normalizeClass(["edit-field",f.value.editField!="wiindexdth"&&!_&&"empty"]),onClick:C=>f.value.toEditField(S,g.dataIndex)},[f.value.editField[S]=="index"?(n.openBlock(),n.createBlock(v,{key:0,onBlur:u[2]||(u[2]=C=>f.value.editField={}),value:m.index,"onUpdate:value":C=>m.index=C,style:{margin:"-5px 0"}},null,8,["value","onUpdate:value"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(_),1)],64))],10,df)):n.createCommentVNode("",!0),g.dataIndex==="action"?(n.openBlock(),n.createElementBlock("a",{key:3,onClick:C=>f.value.toDelField(S)},"删除",8,cf)):n.createCommentVNode("",!0)]),_:1},8,["columns","data-source"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-84143692"]]),ff={class:"unione-props-setting data-filter"},uf={class:"title"},pf={class:"name"},mf={class:"action"},gf=ee(n.defineComponent({__name:"dataFilters",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=K.useDialog(),t=n.useModel(o,"modelValue");function i(){r.value.visible=!0,r.value.filter={},r.value.name=null}function l(c){r.value.visible=!0,r.value.filter={...c},r.value.name=c.name}function s(c){e.confirm({content:"确定要删除该过滤对象么?",onOk:()=>{t.value.splice(c,1)}})}const a=n.ref(),r=n.ref({visible:!1,name:null,filter:{},rules:{title:[{required:!0,message:"过滤标题不能为空"}],name:[{required:!0,message:"过滤名称不能为空"}],filter:[{required:!0,message:"过滤脚本不能为空"}]},toSetting:()=>{a.value.validate().then(c=>{if(r.value.name){const h=t.value.filter(f=>f.name==r.value.name)[0];if(!h){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(c).forEach(f=>{h[f]=c[f]})}else{if(t.value.filter(f=>f.name==r.value.filter.name).length){e.error({content:"过滤名称已存在!"});return}t.value.push(c)}r.value.visible=!1})}});function d(){const c=[];r.value.filter.filter||(r.value.filter.filter=""),c.push("-- @if(isNotEmpty(params."),c.push(r.value.filter.name||"xxx"),c.push(") && !isBlank(params."),c.push(r.value.filter.name||"xxx"),c.push(`)
11
11
  `),c.push(" AND XXX=#{params."),c.push(r.value.filter.name||"xxx"),c.push(`}
12
12
  `),c.push(`-- @}
13
- `),r.value.filter.filter=r.value.filter.filter+c.join("")}return(c,h)=>{const f=n.resolveComponent("a-button"),u=n.resolveComponent("a-card"),m=n.resolveComponent("PlusOutlined"),y=n.resolveComponent("a-empty"),k=n.resolveComponent("a-input"),x=n.resolveComponent("a-form-item"),w=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-tag"),O=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",ff,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(p,S)=>(n.openBlock(),n.createBlock(u,{class:"filter-box",size:"small",key:S},{default:n.withCtx(()=>[n.createElementVNode("div",uf,"过滤标题:"+n.toDisplayString(p.title),1),n.createElementVNode("div",pf,"过滤名称:"+n.toDisplayString(p.name),1),n.createElementVNode("div",mf,[n.createVNode(f,{size:"small",onClick:_=>l(p)},{default:n.withCtx(()=>h[4]||(h[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(f,{danger:"",size:"small",onClick:_=>s(S)},{default:n.withCtx(()=>h[5]||(h[5]=[n.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),n.createVNode(u,{class:"filter-box btn-add",size:"small",onClick:i},{default:n.withCtx(()=>[n.createVNode(m,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=p=>r.value.visible=p),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(O,{ref_key:"filterForm",ref:a,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(x,{label:"过滤标题",name:"title"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=p=>r.value.filter.title=p)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=p=>r.value.filter.name=p)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:n.withCtx(()=>[n.createVNode(w,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=p=>r.value.filter.filter=p),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(v,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>h[6]||(h[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),kf={class:"unione-page form-page data-define-edit"},bf={class:"actions"},yf=ee(n.defineComponent({__name:"edit",setup(o){const e=H.useDialog(),t=n.inject("route"),i=n.inject("router"),l=n.ref(),s=n.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}}),a=n.ref(),r=n.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}}),d=n.ref({configs:{fields:[],filters:[]}}),c=n.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([d.value.id]).then(k=>{k.success?(e.success({title:"发布成功",content:k.body}),y(d.value.id)):e.error({title:"发布失败",content:k.body})})}})}async function u(){const k=await l.value.validate(),x={...d.value,...k};x.configs.show=await a.value.getValue(),console.log("formData",x),G.message.loading({content:"提交中..."}),c.value=!0,ct.save(x).then(w=>{G.message.destroy(),w.success?(d.value=w.body,l.value.setValue(w.body),a.value.setValue(w.body.configs?.show||{}),G.message.success("保存成功!")):G.message.error(w.message)}).finally(()=>{c.value=!1})}const m=n.ref(!1);n.onMounted(()=>{t.query.id&&y(t.query.id)});function y(k){G.message.loading({content:"加载中..."}),ct.detail(k).then(x=>{x.success?(d.value=x.body,l.value.setValue(x.body),a.value.setValue(x.body.configs?.show||{}),G.message.destroy()):G.message.error(x.message)})}return(k,x)=>{const w=n.resolveComponent("unione-form"),v=n.resolveComponent("unione-section"),O=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),p=n.resolveComponent("ToolOutlined"),S=n.resolveComponent("ApiOutlined"),_=n.resolveComponent("FunnelPlotOutlined"),C=n.resolveComponent("a-tabs"),b=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",kf,[n.createVNode(v,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(w,{form:s.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),n.createVNode(v,{class:"page-setting-section",title:"页面配置",type:m.value&&"line",location:m.value?"left":"right",reactive:"",modelValue:m.value,"onUpdate:modelValue":x[0]||(x[0]=B=>m.value=B)},{default:n.withCtx(()=>[n.createVNode(w,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(C,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(O),x[5]||(x[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(hd,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[1]||(x[1]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(p),x[6]||(x[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Zh,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[2]||(x[2]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(S),x[7]||(x[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(hf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[3]||(x[3]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(_),x[8]||(x[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(gf,{modelValue:d.value.configs.filters,"onUpdate:modelValue":x[4]||(x[4]=B=>d.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",bf,[n.createVNode(b,{type:"primary",onClick:u,loading:c.value},{default:n.withCtx(()=>x[9]||(x[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(b,{key:0,danger:"",onClick:f,loading:c.value},{default:n.withCtx(()=>x[10]||(x[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(b,{onClick:h},{default:n.withCtx(()=>x[11]||(x[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),wf={UnioneEditor:wt,locales:Zi,loadConfig:Ae,install(o,e){const t=Ae(e);t.axios&&H.axios.create(t.axios),o.component("UnioneBtn",ya),o.component("UnioneTabs",xa),o.component("UnioneSection",Oa),o.component("UnioneQuery",xl),o.component("UnioneTable",vl),o.component("UnioneFormItem",Ua),o.component("UnioneForm",ja),o.component("UnioneSelectBox",Wa),o.component("UnioneSwitchBox",Ha),o.component("UnioneRadioBox",Ka),o.component("UnioneCheckBox",Qa),o.component("UnionePageEditor",Cl),o.component("UnionePageForm",Sl),o.component("UnionePageTree",Nl),o.component("UnionePageList",Bl)}};Z.UnioneDataDefineEdit=yf,Z.UnioneDataDefineList=nd,Z.UnioneEditor=wt,Z.UnionePage=Lt,Z.UnionePageEditor=Cl,Z.UnionePageForm=Sl,Z.UnionePageList=Bl,Z.UnionePageSetting=jt,Z.UnionePageTree=Nl,Z.UnioneQueryForm=xl,Z.UnioneTableList=vl,Z.default=wf,Z.loadConfig=Ae,Z.locales=Zi,Z.utils=pr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
13
+ `),r.value.filter.filter=r.value.filter.filter+c.join("")}return(c,h)=>{const f=n.resolveComponent("a-button"),p=n.resolveComponent("a-card"),u=n.resolveComponent("PlusOutlined"),y=n.resolveComponent("a-empty"),k=n.resolveComponent("a-input"),x=n.resolveComponent("a-form-item"),w=n.resolveComponent("a-textarea"),v=n.resolveComponent("a-tag"),O=n.resolveComponent("a-form"),g=n.resolveComponent("a-modal");return n.openBlock(),n.createElementBlock("div",ff,[(t.value.length,n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.value,(m,S)=>(n.openBlock(),n.createBlock(p,{class:"filter-box",size:"small",key:S},{default:n.withCtx(()=>[n.createElementVNode("div",uf,"过滤标题:"+n.toDisplayString(m.title),1),n.createElementVNode("div",pf,"过滤名称:"+n.toDisplayString(m.name),1),n.createElementVNode("div",mf,[n.createVNode(f,{size:"small",onClick:_=>l(m)},{default:n.withCtx(()=>h[4]||(h[4]=[n.createTextVNode("编辑")])),_:2},1032,["onClick"]),n.createVNode(f,{danger:"",size:"small",onClick:_=>s(S)},{default:n.withCtx(()=>h[5]||(h[5]=[n.createTextVNode("删除")])),_:2},1032,["onClick"])])]),_:2},1024))),128)),n.createVNode(p,{class:"filter-box btn-add",size:"small",onClick:i},{default:n.withCtx(()=>[n.createVNode(u,{class:"btn"})]),_:1})],64)),n.createVNode(g,{visible:r.value.visible,"onUpdate:visible":h[3]||(h[3]=m=>r.value.visible=m),width:600,title:"设置数据过滤",class:"data-filter",onOk:r.value.toSetting},{default:n.withCtx(()=>[n.createVNode(O,{ref_key:"filterForm",ref:a,model:r.value.filter,rules:r.value.rules,name:"basic","label-col":{span:4},"wrapper-col":{span:18},class:"form-mix"},{default:n.withCtx(()=>[n.createVNode(x,{label:"过滤标题",name:"title"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.title,"onUpdate:value":h[0]||(h[0]=m=>r.value.filter.title=m)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"过滤名称",name:"name"},{default:n.withCtx(()=>[n.createVNode(k,{value:r.value.filter.name,"onUpdate:value":h[1]||(h[1]=m=>r.value.filter.name=m)},null,8,["value"])]),_:1}),n.createVNode(x,{label:"过滤脚本",name:"filter",tooltip:"使用beetsql语法,参数获取方式params.xxx,判断参数是否为空isNotEmpty(params.xxx) && !isBlank(params.xxx)"},{default:n.withCtx(()=>[n.createVNode(w,{value:r.value.filter.filter,"onUpdate:value":h[2]||(h[2]=m=>r.value.filter.filter=m),autosize:{minRows:10},style:{"padding-top":"20px"}},null,8,["value"]),n.createVNode(v,{class:"btn-tmpl",color:"blue",onClick:d},{default:n.withCtx(()=>h[6]||(h[6]=[n.createTextVNode("插入模版")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["visible","onOk"])])}}}),[["__scopeId","data-v-a600b93f"]]),kf={class:"unione-page form-page data-define-edit"},bf={class:"actions"},yf=ee(n.defineComponent({__name:"edit",setup(o){const e=K.useDialog(),t=n.inject("route"),i=n.inject("router"),l=n.ref(),s=n.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}}),a=n.ref(),r=n.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}}),d=n.ref({configs:{fields:[],filters:[]}}),c=n.ref(!1);function h(){i.back()}function f(){e.confirm({content:"确定要发布当前数据么?",onOk:()=>{ct.release([d.value.id]).then(k=>{k.success?(e.success({title:"发布成功",content:k.body}),y(d.value.id)):e.error({title:"发布失败",content:k.body})})}})}async function p(){const k=await l.value.validate(),x={...d.value,...k};x.configs.show=await a.value.getValue(),console.log("formData",x),G.message.loading({content:"提交中..."}),c.value=!0,ct.save(x).then(w=>{G.message.destroy(),w.success?(d.value=w.body,l.value.setValue(w.body),a.value.setValue(w.body.configs?.show||{}),G.message.success("保存成功!")):G.message.error(w.message)}).finally(()=>{c.value=!1})}const u=n.ref(!1);n.onMounted(()=>{t.query.id&&y(t.query.id)});function y(k){G.message.loading({content:"加载中..."}),ct.detail(k).then(x=>{x.success?(d.value=x.body,l.value.setValue(x.body),a.value.setValue(x.body.configs?.show||{}),G.message.destroy()):G.message.error(x.message)})}return(k,x)=>{const w=n.resolveComponent("unione-form"),v=n.resolveComponent("unione-section"),O=n.resolveComponent("OrderedListOutlined"),g=n.resolveComponent("a-tab-pane"),m=n.resolveComponent("ToolOutlined"),S=n.resolveComponent("ApiOutlined"),_=n.resolveComponent("FunnelPlotOutlined"),C=n.resolveComponent("a-tabs"),b=n.resolveComponent("a-button");return n.openBlock(),n.createElementBlock("div",kf,[n.createVNode(v,{title:"基础信息",type:"line"},{default:n.withCtx(()=>[n.createVNode(w,{form:s.value,ref_key:"formBaseObj",ref:l},null,8,["form"])]),_:1}),n.createVNode(v,{class:"page-setting-section",title:"页面配置",type:u.value&&"line",location:u.value?"left":"right",reactive:"",modelValue:u.value,"onUpdate:modelValue":x[0]||(x[0]=B=>u.value=B)},{default:n.withCtx(()=>[n.createVNode(w,{form:r.value,ref_key:"pageSettingObj",ref:a},null,8,["form"])]),_:1},8,["type","location","modelValue"]),n.createVNode(C,null,{default:n.withCtx(()=>[n.createVNode(g,{key:"field-mange"},{tab:n.withCtx(()=>[n.createVNode(O),x[5]||(x[5]=n.createTextVNode("字段管理 "))]),default:n.withCtx(()=>[n.createVNode(hd,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[1]||(x[1]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-setting"},{tab:n.withCtx(()=>[n.createVNode(m),x[6]||(x[6]=n.createTextVNode("字段设置 "))]),default:n.withCtx(()=>[n.createVNode(Zh,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[2]||(x[2]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"field-fkeys"},{tab:n.withCtx(()=>[n.createVNode(S),x[7]||(x[7]=n.createTextVNode("外键设置 "))]),default:n.withCtx(()=>[n.createVNode(hf,{modelValue:d.value.configs.fields,"onUpdate:modelValue":x[3]||(x[3]=B=>d.value.configs.fields=B)},null,8,["modelValue"])]),_:1}),n.createVNode(g,{key:"data-filter"},{tab:n.withCtx(()=>[n.createVNode(_),x[8]||(x[8]=n.createTextVNode("数据过滤 "))]),default:n.withCtx(()=>[n.createVNode(gf,{modelValue:d.value.configs.filters,"onUpdate:modelValue":x[4]||(x[4]=B=>d.value.configs.filters=B)},null,8,["modelValue"])]),_:1})]),_:1}),n.createElementVNode("div",bf,[n.createVNode(b,{type:"primary",onClick:p,loading:c.value},{default:n.withCtx(()=>x[9]||(x[9]=[n.createTextVNode("保存")])),_:1},8,["loading"]),d.value.id?(n.openBlock(),n.createBlock(b,{key:0,danger:"",onClick:f,loading:c.value},{default:n.withCtx(()=>x[10]||(x[10]=[n.createTextVNode("发布")])),_:1},8,["loading"])):n.createCommentVNode("",!0),n.createVNode(b,{onClick:h},{default:n.withCtx(()=>x[11]||(x[11]=[n.createTextVNode("返回")])),_:1})])])}}}),[["__scopeId","data-v-3eeab6e6"]]),wf={UnioneEditor:wt,locales:Zi,loadConfig:Ae,install(o,e){const t=Ae(e);t.axios&&K.axios.create(t.axios),o.component("UnioneBtn",ya),o.component("UnioneTabs",xa),o.component("UnioneSection",Oa),o.component("UnioneQuery",xl),o.component("UnioneTable",vl),o.component("UnioneFormItem",Ua),o.component("UnioneForm",ja),o.component("UnioneSelectBox",Wa),o.component("UnioneSwitchBox",Ha),o.component("UnioneRadioBox",Ka),o.component("UnioneCheckBox",Qa),o.component("UnionePageEditor",Cl),o.component("UnionePageForm",Sl),o.component("UnionePageTree",Nl),o.component("UnionePageList",Bl)}};Z.UnioneDataDefineEdit=yf,Z.UnioneDataDefineList=nd,Z.UnioneEditor=wt,Z.UnionePage=Lt,Z.UnionePageEditor=Cl,Z.UnionePageForm=Sl,Z.UnionePageList=Bl,Z.UnionePageSetting=jt,Z.UnionePageTree=Nl,Z.UnioneQueryForm=xl,Z.UnioneTableList=vl,Z.default=wf,Z.loadConfig=Ae,Z.locales=Zi,Z.utils=pr,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});