@steedos-labs/plugin-workflow 3.0.38 → 3.0.40
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/designer/dist/amis-renderer/amis-renderer.css +1 -1
- package/designer/dist/amis-renderer/amis-renderer.js +1 -1
- package/designer/dist/assets/index-BIbXABqz.css +1 -0
- package/designer/dist/assets/index-DRUi3eGk.js +943 -0
- package/designer/dist/index.html +2 -2
- package/main/default/manager/instance_number_rules.js +1 -1
- package/main/default/manager/uuflow_manager.js +20 -2
- package/main/default/objects/instance_tasks/listviews/inbox.listview.yml +1 -1
- package/main/default/objects/instance_tasks/listviews/outbox.listview.yml +1 -1
- package/main/default/objects/instances/listviews/completed.listview.yml +1 -1
- package/main/default/objects/instances/listviews/draft.listview.yml +1 -1
- package/main/default/objects/instances/listviews/monitor.listview.yml +1 -1
- package/main/default/objects/instances/listviews/pending.listview.yml +1 -1
- package/main/default/pages/flow_selector.page.amis.json +2 -2
- package/main/default/pages/flow_selector_mobile.page.amis.json +2 -2
- package/main/default/pages/page_instance_print.page.amis.json +11 -1
- package/main/default/routes/am.router.js +3 -1
- package/main/default/routes/api_auto_number.router.js +166 -23
- package/main/default/routes/api_workflow_ai_form_design.router.js +116 -16
- package/main/default/routes/api_workflow_ai_form_design_stream.router.js +115 -17
- package/main/default/routes/api_workflow_box_filter.router.js +2 -2
- package/main/default/routes/flow_form_design.ejs +28 -5
- package/main/default/services/flows.service.js +20 -24
- package/main/default/services/instance.service.js +6 -4
- package/main/default/test/test_formula_compat.js +89 -2
- package/main/default/utils/formula-compat.js +24 -2
- package/package.json +1 -1
- package/package.service.js +14 -0
- package/public/amis-renderer/amis-renderer.css +1 -1
- package/public/amis-renderer/amis-renderer.js +1 -1
- package/public/workflow/index.css +10 -3
- package/designer/dist/assets/index-BVsRCpLO.css +0 -1
- package/designer/dist/assets/index-Qp1zkbew.js +0 -757
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"use strict";function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const n=r(e);var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i,s={exports:{}};function l(){return i||(i=1,s.exports=function(){var e=1e3,t=6e4,r=36e5,n="millisecond",a="second",o="minute",i="hour",s="day",l="week",c="month",u="quarter",f="year",d="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},y=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},b={s:y,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),a=r%60;return(t<=0?"+":"-")+y(n,2,"0")+":"+y(a,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),a=t.clone().add(n,c),o=r-a<0,i=t.clone().add(n+(o?-1:1),c);return+(-(n+(r-a)/(o?a-i:i-a))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:f,w:l,d:s,D:d,h:i,m:o,s:a,ms:n,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",x={};x[v]=g;var w="$isDayjsObject",_=function(e){return e instanceof R||!(!e||!e[w])},E=function e(t,r,n){var a;if(!t)return v;if("string"==typeof t){var o=t.toLowerCase();x[o]&&(a=o),r&&(x[o]=r,a=o);var i=t.split("-");if(!a&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,a=s}return!n&&a&&(v=a),a||!n&&v},k=function(e,t){if(_(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new R(r)},S=b;S.l=E,S.i=_,S.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var R=function(){function g(e){this.$L=E(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var y=g.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(S.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(m);if(n){var a=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],a,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return S},y.isValid=function(){return!(this.$d.toString()===p)},y.isSame=function(e,t){var r=k(e);return this.startOf(t)<=r&&r<=this.endOf(t)},y.isAfter=function(e,t){return k(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<k(e)},y.$g=function(e,t,r){return S.u(e)?this[t]:this.set(r,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var r=this,n=!!S.u(t)||t,u=S.p(e),p=function(e,t){var a=S.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return n?a:a.endOf(s)},m=function(e,t){return S.w(r.toDate()[e].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},h=this.$W,g=this.$M,y=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case f:return n?p(1,0):p(31,11);case c:return n?p(1,g):p(0,g+1);case l:var v=this.$locale().weekStart||0,x=(h<v?h+7:h)-v;return p(n?y-x:y+(6-x),g);case s:case d:return m(b+"Hours",0);case i:return m(b+"Minutes",1);case o:return m(b+"Seconds",2);case a:return m(b+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var r,l=S.p(e),u="set"+(this.$u?"UTC":""),p=(r={},r[s]=u+"Date",r[d]=u+"Date",r[c]=u+"Month",r[f]=u+"FullYear",r[i]=u+"Hours",r[o]=u+"Minutes",r[a]=u+"Seconds",r[n]=u+"Milliseconds",r)[l],m=l===s?this.$D+(t-this.$W):t;if(l===c||l===f){var h=this.clone().set(d,1);h.$d[p](m),h.init(),this.$d=h.set(d,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[S.p(e)]()},y.add=function(n,u){var d,p=this;n=Number(n);var m=S.p(u),h=function(e){var t=k(p);return S.w(t.date(t.date()+Math.round(e*n)),p)};if(m===c)return this.set(c,this.$M+n);if(m===f)return this.set(f,this.$y+n);if(m===s)return h(1);if(m===l)return h(7);var g=(d={},d[o]=t,d[i]=r,d[a]=e,d)[m]||1,y=this.$d.getTime()+n*g;return S.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=e||"YYYY-MM-DDTHH:mm:ssZ",a=S.z(this),o=this.$H,i=this.$m,s=this.$M,l=r.weekdays,c=r.months,u=r.meridiem,f=function(e,r,a,o){return e&&(e[r]||e(t,n))||a[r].slice(0,o)},d=function(e){return S.s(o%12||12,e,"0")},m=u||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(h,function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return S.s(t.$y,4,"0");case"M":return s+1;case"MM":return S.s(s+1,2,"0");case"MMM":return f(r.monthsShort,s,c,3);case"MMMM":return f(c,s);case"D":return t.$D;case"DD":return S.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return f(r.weekdaysMin,t.$W,l,2);case"ddd":return f(r.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(o);case"HH":return S.s(o,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return m(o,i,!0);case"A":return m(o,i,!1);case"m":return String(i);case"mm":return S.s(i,2,"0");case"s":return String(t.$s);case"ss":return S.s(t.$s,2,"0");case"SSS":return S.s(t.$ms,3,"0");case"Z":return a}return null}(e)||a.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(n,d,p){var m,h=this,g=S.p(d),y=k(n),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,x=function(){return S.m(h,y)};switch(g){case f:m=x()/12;break;case c:m=x();break;case u:m=x()/3;break;case l:m=(v-b)/6048e5;break;case s:m=(v-b)/864e5;break;case i:m=v/r;break;case o:m=v/t;break;case a:m=v/e;break;default:m=v}return p?m:S.a(m)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return x[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=E(e,t,!0);return n&&(r.$L=n),r},y.clone=function(){return S.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},g}(),C=R.prototype;return k.prototype=C,[["$ms",n],["$s",a],["$m",o],["$H",i],["$W",s],["$M",c],["$y",f],["$D",d]].forEach(function(e){C[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),k.extend=function(e,t){return e.$i||(e(t,R,k),e.$i=!0),k},k.locale=E,k.isDayjs=_,k.unix=function(e){return k(1e3*e)},k.en=x[v],k.Ls=x,k.p={},k}()),s.exports}const c=o(l());var u,f={exports:{}};const d=o((u||(u=1,f.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,r=this.$W,n=(r<t?r+7:r)-t;return this.$utils().u(e)?n:this.subtract(n,"day").add(e,"day")}}),f.exports));var p,m={exports:{}};const h=o((p||(p=1,m.exports=function(e,t,r){var n=t.prototype,a=function(e){return e&&(e.indexOf?e:e.s)},o=function(e,t,r,n,o){var i=e.name?e:e.$locale(),s=a(i[t]),l=a(i[r]),c=s||l.map(function(e){return e.slice(0,n)});if(!o)return c;var u=i.weekStart;return c.map(function(e,t){return c[(t+(u||0))%7]})},i=function(){return r.Ls[r.locale()]},s=function(e,t){return e.formats[t]||e.formats[t.toUpperCase()].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,r){return t||r.slice(1)})},l=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):o(e,"months")},monthsShort:function(t){return t?t.format("MMM"):o(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):o(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):o(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):o(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return s(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};n.localeData=function(){return l.bind(this)()},r.localeData=function(){var e=i();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return r.weekdays()},weekdaysShort:function(){return r.weekdaysShort()},weekdaysMin:function(){return r.weekdaysMin()},months:function(){return r.months()},monthsShort:function(){return r.monthsShort()},longDateFormat:function(t){return s(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},r.months=function(){return o(i(),"months")},r.monthsShort=function(){return o(i(),"monthsShort","months",3)},r.weekdays=function(e){return o(i(),"weekdays",null,null,e)},r.weekdaysShort=function(e){return o(i(),"weekdaysShort","weekdays",3,e)},r.weekdaysMin=function(e){return o(i(),"weekdaysMin","weekdays",2,e)}}),m.exports));var g,y={exports:{}};const b=o((g||(g=1,y.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,n=/\d\d/,a=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,i={},s=function(e){return(e=+e)+(e>68?1900:2e3)},l=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),r=60*t[1]+(+t[2]||0);return 0===r?0:"+"===t[0]?-r:r}(e)}],u=function(e){var t=i[e];return t&&(t.indexOf?t:t.s.concat(t.f))},f=function(e,t){var r,n=i.meridiem;if(n){for(var a=1;a<=24;a+=1)if(e.indexOf(n(a,0,t))>-1){r=a>12;break}}else r=e===(t?"pm":"PM");return r},d={A:[o,function(e){this.afternoon=f(e,!1)}],a:[o,function(e){this.afternoon=f(e,!0)}],Q:[r,function(e){this.month=3*(e-1)+1}],S:[r,function(e){this.milliseconds=100*+e}],SS:[n,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[a,l("seconds")],ss:[a,l("seconds")],m:[a,l("minutes")],mm:[a,l("minutes")],H:[a,l("hours")],h:[a,l("hours")],HH:[a,l("hours")],hh:[a,l("hours")],D:[a,l("day")],DD:[n,l("day")],Do:[o,function(e){var t=i.ordinal,r=e.match(/\d+/);if(this.day=r[0],t)for(var n=1;n<=31;n+=1)t(n).replace(/\[|\]/g,"")===e&&(this.day=n)}],w:[a,l("week")],ww:[n,l("week")],M:[a,l("month")],MM:[n,l("month")],MMM:[o,function(e){var t=u("months"),r=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(r<1)throw new Error;this.month=r%12||r}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(e){this.year=s(e)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function p(r){var n,a;n=r,a=i&&i.formats;for(var o=(r=n.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,r,n){var o=n&&n.toUpperCase();return r||a[n]||e[n]||a[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,r){return t||r.slice(1)})})).match(t),s=o.length,l=0;l<s;l+=1){var c=o[l],u=d[c],f=u&&u[0],p=u&&u[1];o[l]=p?{regex:f,parser:p}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},r=0,n=0;r<s;r+=1){var a=o[r];if("string"==typeof a)n+=a.length;else{var i=a.regex,l=a.parser,c=e.slice(n),u=i.exec(c)[0];l.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var r=e.hours;t?r<12&&(e.hours+=12):12===r&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,r){r.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var n=t.prototype,a=n.parse;n.parse=function(e){var t=e.date,n=e.utc,o=e.args;this.$u=n;var s=o[1];if("string"==typeof s){var l=!0===o[2],c=!0===o[3],u=l||c,f=o[2];c&&(f=o[2]),i=this.$locale(),!l&&f&&(i=r.Ls[f]),this.$d=function(e,t,r,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var a=p(t)(e),o=a.year,i=a.month,s=a.day,l=a.hours,c=a.minutes,u=a.seconds,f=a.milliseconds,d=a.zone,m=a.week,h=new Date,g=s||(o||i?1:h.getDate()),y=o||h.getFullYear(),b=0;o&&!i||(b=i>0?i-1:h.getMonth());var v,x=l||0,w=c||0,_=u||0,E=f||0;return d?new Date(Date.UTC(y,b,g,x,w,_,E+60*d.offset*1e3)):r?new Date(Date.UTC(y,b,g,x,w,_,E)):(v=new Date(y,b,g,x,w,_,E),m&&(v=n(v).week(m).toDate()),v)}catch(k){return new Date("")}}(t,s,n,r),this.init(),f&&!0!==f&&(this.$L=this.locale(f).$L),u&&t!=this.format(s)&&(this.$d=new Date("")),i={}}else if(s instanceof Array)for(var d=s.length,m=1;m<=d;m+=1){o[1]=s[m-1];var h=r.apply(this,o);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}m===d&&(this.$d=new Date(""))}else a.call(this,e)}}}()),y.exports));var v,x={exports:{}};v||(v=1,x.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e),n={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1100?"上午":r<1300?"中午":r<1800?"下午":"晚上"}};return r.default.locale(n,null,!0),n}(l()));var w,_,E,k={exports:{}};function S(e,t,r){e&&Object.isFrozen(e)&&(e=function(e,t=!0){const r=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach(t=>r[t]=e[t]),r}(e));const n=e?Object.create(e,{...r,__super:{value:e,writable:!1,enumerable:!1}}):Object.create(Object.prototype,r);return t&&function(e){const t=typeof e;return e&&"string"!==t&&"number"!==t&&"boolean"!==t&&"function"!==t&&!Array.isArray(e)}(t)&&Object.keys(t).forEach(e=>n[e]=t[e]),n}w||(w=1,_=k,E=k.exports,function(){var e,t="Expected a function",r="__lodash_hash_undefined__",n="__lodash_placeholder__",o=32,i=128,s=256,l=1/0,c=9007199254740991,u=NaN,f=4294967295,d=[["ary",i],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",s]],p="[object Arguments]",m="[object Array]",h="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",v="[object GeneratorFunction]",x="[object Map]",w="[object Number]",k="[object Object]",S="[object Promise]",R="[object RegExp]",C="[object Set]",N="[object String]",O="[object Symbol]",M="[object WeakMap]",j="[object ArrayBuffer]",T="[object DataView]",$="[object Float32Array]",A="[object Float64Array]",D="[object Int8Array]",z="[object Int16Array]",F="[object Int32Array]",L="[object Uint8Array]",P="[object Uint8ClampedArray]",I="[object Uint16Array]",U="[object Uint32Array]",B=/\b__p \+= '';/g,Y=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,V=RegExp(W.source),J=RegExp(q.source),G=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,ae=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,he=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,xe=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",_e="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ee="\\u2700-\\u27bf",ke="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Re="\\ufe0e\\ufe0f",Ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ne="['’]",Oe="["+we+"]",Me="["+Ce+"]",je="["+_e+"]",Te="\\d+",$e="["+Ee+"]",Ae="["+ke+"]",De="[^"+we+Ce+Te+Ee+ke+Se+"]",ze="\\ud83c[\\udffb-\\udfff]",Fe="[^"+we+"]",Le="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Ie="["+Se+"]",Ue="\\u200d",Be="(?:"+Ae+"|"+De+")",Ye="(?:"+Ie+"|"+De+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",qe="(?:"+je+"|"+ze+")?",Ve="["+Re+"]?",Je=Ve+qe+"(?:"+Ue+"(?:"+[Fe,Le,Pe].join("|")+")"+Ve+qe+")*",Ge="(?:"+[$e,Le,Pe].join("|")+")"+Je,Ke="(?:"+[Fe+je+"?",je,Le,Pe,Oe].join("|")+")",Ze=RegExp(Ne,"g"),Qe=RegExp(je,"g"),Xe=RegExp(ze+"(?="+ze+")|"+Ke+Je,"g"),et=RegExp([Ie+"?"+Ae+"+"+He+"(?="+[Me,Ie,"$"].join("|")+")",Ye+"+"+We+"(?="+[Me,Ie+Be,"$"].join("|")+")",Ie+"?"+Be+"+"+He,Ie+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Te,Ge].join("|"),"g"),tt=RegExp("["+Ue+we+_e+Re+"]"),rt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],at=-1,ot={};ot[$]=ot[A]=ot[D]=ot[z]=ot[F]=ot[L]=ot[P]=ot[I]=ot[U]=!0,ot[p]=ot[m]=ot[j]=ot[h]=ot[T]=ot[g]=ot[y]=ot[b]=ot[x]=ot[w]=ot[k]=ot[R]=ot[C]=ot[N]=ot[M]=!1;var it={};it[p]=it[m]=it[j]=it[T]=it[h]=it[g]=it[$]=it[A]=it[D]=it[z]=it[F]=it[x]=it[w]=it[k]=it[R]=it[C]=it[N]=it[O]=it[L]=it[P]=it[I]=it[U]=!0,it[y]=it[b]=it[M]=!1;var st={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ct=parseInt,ut="object"==typeof a&&a&&a.Object===Object&&a,ft="object"==typeof self&&self&&self.Object===Object&&self,dt=ut||ft||Function("return this")(),pt=E&&!E.nodeType&&E,mt=pt&&_&&!_.nodeType&&_,ht=mt&&mt.exports===pt,gt=ht&&ut.process,yt=function(){try{var e=mt&&mt.require&&mt.require("util").types;return e||gt&>.binding&>.binding("util")}catch(t){}}(),bt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,xt=yt&&yt.isMap,wt=yt&&yt.isRegExp,_t=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function kt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function St(e,t,r,n){for(var a=-1,o=null==e?0:e.length;++a<o;){var i=e[a];t(n,i,r(i),e)}return n}function Rt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function Ct(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Nt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function Ot(e,t){for(var r=-1,n=null==e?0:e.length,a=0,o=[];++r<n;){var i=e[r];t(i,r,e)&&(o[a++]=i)}return o}function Mt(e,t){return!(null==e||!e.length)&&It(e,t,0)>-1}function jt(e,t,r){for(var n=-1,a=null==e?0:e.length;++n<a;)if(r(t,e[n]))return!0;return!1}function Tt(e,t){for(var r=-1,n=null==e?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}function $t(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function At(e,t,r,n){var a=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function Dt(e,t,r,n){var a=null==e?0:e.length;for(n&&a&&(r=e[--a]);a--;)r=t(r,e[a],a,e);return r}function zt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Ft=Ht("length");function Lt(e,t,r){var n;return r(e,function(e,r,a){if(t(e,r,a))return n=r,!1}),n}function Pt(e,t,r,n){for(var a=e.length,o=r+(n?1:-1);n?o--:++o<a;)if(t(e[o],o,e))return o;return-1}function It(e,t,r){return t==t?function(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}(e,t,r):Pt(e,Bt,r)}function Ut(e,t,r,n){for(var a=r-1,o=e.length;++a<o;)if(n(e[a],t))return a;return-1}function Bt(e){return e!=e}function Yt(e,t){var r=null==e?0:e.length;return r?Vt(e,t)/r:u}function Ht(t){return function(r){return null==r?e:r[t]}}function Wt(t){return function(r){return null==t?e:t[r]}}function qt(e,t,r,n,a){return a(e,function(e,a,o){r=n?(n=!1,e):t(r,e,a,o)}),r}function Vt(t,r){for(var n,a=-1,o=t.length;++a<o;){var i=r(t[a]);i!==e&&(n=n===e?i:n+i)}return n}function Jt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Gt(e){return e?e.slice(0,fr(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function Zt(e,t){return Tt(t,function(t){return e[t]})}function Qt(e,t){return e.has(t)}function Xt(e,t){for(var r=-1,n=e.length;++r<n&&It(t,e[r],0)>-1;);return r}function er(e,t){for(var r=e.length;r--&&It(t,e[r],0)>-1;);return r}var tr=Wt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),rr=Wt({"&":"&","<":"<",">":">",'"':""","'":"'"});function nr(e){return"\\"+st[e]}function ar(e){return tt.test(e)}function or(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function ir(e,t){return function(r){return e(t(r))}}function sr(e,t){for(var r=-1,a=e.length,o=0,i=[];++r<a;){var s=e[r];s!==t&&s!==n||(e[r]=n,i[o++]=r)}return i}function lr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function cr(e){return ar(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):Ft(e)}function ur(e){return ar(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function fr(e){for(var t=e.length;t--&&ae.test(e.charAt(t)););return t}var dr=Wt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pr=function a(_){var E,ae=(_=null==_?dt:pr.defaults(dt.Object(),_,pr.pick(dt,nt))).Array,we=_.Date,_e=_.Error,Ee=_.Function,ke=_.Math,Se=_.Object,Re=_.RegExp,Ce=_.String,Ne=_.TypeError,Oe=ae.prototype,Me=Ee.prototype,je=Se.prototype,Te=_["__core-js_shared__"],$e=Me.toString,Ae=je.hasOwnProperty,De=0,ze=(E=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",Fe=je.toString,Le=$e.call(Se),Pe=dt._,Ie=Re("^"+$e.call(Ae).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=ht?_.Buffer:e,Be=_.Symbol,Ye=_.Uint8Array,He=Ue?Ue.allocUnsafe:e,We=ir(Se.getPrototypeOf,Se),qe=Se.create,Ve=je.propertyIsEnumerable,Je=Oe.splice,Ge=Be?Be.isConcatSpreadable:e,Ke=Be?Be.iterator:e,Xe=Be?Be.toStringTag:e,tt=function(){try{var e=co(Se,"defineProperty");return e({},"",{}),e}catch(t){}}(),st=_.clearTimeout!==dt.clearTimeout&&_.clearTimeout,ut=we&&we.now!==dt.Date.now&&we.now,ft=_.setTimeout!==dt.setTimeout&&_.setTimeout,pt=ke.ceil,mt=ke.floor,gt=Se.getOwnPropertySymbols,yt=Ue?Ue.isBuffer:e,Ft=_.isFinite,Wt=Oe.join,mr=ir(Se.keys,Se),hr=ke.max,gr=ke.min,yr=we.now,br=_.parseInt,vr=ke.random,xr=Oe.reverse,wr=co(_,"DataView"),_r=co(_,"Map"),Er=co(_,"Promise"),kr=co(_,"Set"),Sr=co(_,"WeakMap"),Rr=co(Se,"create"),Cr=Sr&&new Sr,Nr={},Or=Po(wr),Mr=Po(_r),jr=Po(Er),Tr=Po(kr),$r=Po(Sr),Ar=Be?Be.prototype:e,Dr=Ar?Ar.valueOf:e,zr=Ar?Ar.toString:e;function Fr(e){if(rs(e)&&!Wi(e)&&!(e instanceof Ur)){if(e instanceof Ir)return e;if(Ae.call(e,"__wrapped__"))return Io(e)}return new Ir(e)}var Lr=function(){function t(){}return function(r){if(!ts(r))return{};if(qe)return qe(r);t.prototype=r;var n=new t;return t.prototype=e,n}}();function Pr(){}function Ir(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=e}function Ur(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Br(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Yr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Hr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Wr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Hr;++t<r;)this.add(e[t])}function qr(e){var t=this.__data__=new Yr(e);this.size=t.size}function Vr(e,t){var r=Wi(e),n=!r&&Hi(e),a=!r&&!n&&Gi(e),o=!r&&!n&&!a&&us(e),i=r||n||a||o,s=i?Jt(e.length,Ce):[],l=s.length;for(var c in e)!t&&!Ae.call(e,c)||i&&("length"==c||a&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yo(c,l))||s.push(c);return s}function Jr(t){var r=t.length;return r?t[qn(0,r-1)]:e}function Gr(e,t){return $o(Ca(e),an(t,0,e.length))}function Kr(e){return $o(Ca(e))}function Zr(t,r,n){(n!==e&&!Ui(t[r],n)||n===e&&!(r in t))&&rn(t,r,n)}function Qr(t,r,n){var a=t[r];Ae.call(t,r)&&Ui(a,n)&&(n!==e||r in t)||rn(t,r,n)}function Xr(e,t){for(var r=e.length;r--;)if(Ui(e[r][0],t))return r;return-1}function en(e,t,r,n){return un(e,function(e,a,o){t(n,e,r(e),o)}),n}function tn(e,t){return e&&Na(t,Ts(t),e)}function rn(e,t,r){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function nn(t,r){for(var n=-1,a=r.length,o=ae(a),i=null==t;++n<a;)o[n]=i?e:Cs(t,r[n]);return o}function an(t,r,n){return t==t&&(n!==e&&(t=t<=n?t:n),r!==e&&(t=t>=r?t:r)),t}function on(t,r,n,a,o,i){var s,l=1&r,c=2&r,u=4&r;if(n&&(s=o?n(t,a,o,i):n(t)),s!==e)return s;if(!ts(t))return t;var f=Wi(t);if(f){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ae.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!l)return Ca(t,s)}else{var d=po(t),m=d==b||d==v;if(Gi(t))return wa(t,l);if(d==k||d==p||m&&!o){if(s=c||m?{}:ho(t),!l)return c?function(e,t){return Na(e,fo(e),t)}(t,function(e,t){return e&&Na(t,$s(t),e)}(s,t)):function(e,t){return Na(e,uo(e),t)}(t,tn(s,t))}else{if(!it[d])return o?t:{};s=function(e,t,r){var n,a=e.constructor;switch(t){case j:return _a(e);case h:case g:return new a(+e);case T:return function(e,t){var r=t?_a(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case $:case A:case D:case z:case F:case L:case P:case I:case U:return Ea(e,r);case x:return new a;case w:case N:return new a(e);case R:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case C:return new a;case O:return n=e,Dr?Se(Dr.call(n)):{}}}(t,d,l)}}i||(i=new qr);var y=i.get(t);if(y)return y;i.set(t,s),ss(t)?t.forEach(function(e){s.add(on(e,r,n,e,t,i))}):ns(t)&&t.forEach(function(e,a){s.set(a,on(e,r,n,a,t,i))});var _=f?e:(u?c?ro:to:c?$s:Ts)(t);return Rt(_||t,function(e,a){_&&(e=t[a=e]),Qr(s,a,on(e,r,n,a,t,i))}),s}function sn(t,r,n){var a=n.length;if(null==t)return!a;for(t=Se(t);a--;){var o=n[a],i=r[o],s=t[o];if(s===e&&!(o in t)||!i(s))return!1}return!0}function ln(r,n,a){if("function"!=typeof r)throw new Ne(t);return Oo(function(){r.apply(e,a)},n)}function cn(e,t,r,n){var a=-1,o=Mt,i=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=Tt(t,Kt(r))),n?(o=jt,i=!1):t.length>=200&&(o=Qt,i=!1,t=new Wr(t));e:for(;++a<s;){var u=e[a],f=null==r?u:r(u);if(u=n||0!==u?u:0,i&&f==f){for(var d=c;d--;)if(t[d]===f)continue e;l.push(u)}else o(t,f,n)||l.push(u)}return l}Fr.templateSettings={escape:G,evaluate:K,interpolate:Z,variable:"",imports:{_:Fr}},Fr.prototype=Pr.prototype,Fr.prototype.constructor=Fr,Ir.prototype=Lr(Pr.prototype),Ir.prototype.constructor=Ir,Ur.prototype=Lr(Pr.prototype),Ur.prototype.constructor=Ur,Br.prototype.clear=function(){this.__data__=Rr?Rr(null):{},this.size=0},Br.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Br.prototype.get=function(t){var n=this.__data__;if(Rr){var a=n[t];return a===r?e:a}return Ae.call(n,t)?n[t]:e},Br.prototype.has=function(t){var r=this.__data__;return Rr?r[t]!==e:Ae.call(r,t)},Br.prototype.set=function(t,n){var a=this.__data__;return this.size+=this.has(t)?0:1,a[t]=Rr&&n===e?r:n,this},Yr.prototype.clear=function(){this.__data__=[],this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=Xr(t,e);return!(r<0||(r==t.length-1?t.pop():Je.call(t,r,1),--this.size,0))},Yr.prototype.get=function(t){var r=this.__data__,n=Xr(r,t);return n<0?e:r[n][1]},Yr.prototype.has=function(e){return Xr(this.__data__,e)>-1},Yr.prototype.set=function(e,t){var r=this.__data__,n=Xr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Hr.prototype.clear=function(){this.size=0,this.__data__={hash:new Br,map:new(_r||Yr),string:new Br}},Hr.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Hr.prototype.get=function(e){return so(this,e).get(e)},Hr.prototype.has=function(e){return so(this,e).has(e)},Hr.prototype.set=function(e,t){var r=so(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Wr.prototype.add=Wr.prototype.push=function(e){return this.__data__.set(e,r),this},Wr.prototype.has=function(e){return this.__data__.has(e)},qr.prototype.clear=function(){this.__data__=new Yr,this.size=0},qr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},qr.prototype.get=function(e){return this.__data__.get(e)},qr.prototype.has=function(e){return this.__data__.has(e)},qr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Yr){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Hr(n)}return r.set(e,t),this.size=r.size,this};var un=ja(bn),fn=ja(vn,!0);function dn(e,t){var r=!0;return un(e,function(e,n,a){return r=!!t(e,n,a)}),r}function pn(t,r,n){for(var a=-1,o=t.length;++a<o;){var i=t[a],s=r(i);if(null!=s&&(l===e?s==s&&!cs(s):n(s,l)))var l=s,c=i}return c}function mn(e,t){var r=[];return un(e,function(e,n,a){t(e,n,a)&&r.push(e)}),r}function hn(e,t,r,n,a){var o=-1,i=e.length;for(r||(r=go),a||(a=[]);++o<i;){var s=e[o];t>0&&r(s)?t>1?hn(s,t-1,r,n,a):$t(a,s):n||(a[a.length]=s)}return a}var gn=Ta(),yn=Ta(!0);function bn(e,t){return e&&gn(e,t,Ts)}function vn(e,t){return e&&yn(e,t,Ts)}function xn(e,t){return Ot(t,function(t){return Qi(e[t])})}function wn(t,r){for(var n=0,a=(r=ya(r,t)).length;null!=t&&n<a;)t=t[Lo(r[n++])];return n&&n==a?t:e}function _n(e,t,r){var n=t(e);return Wi(e)?n:$t(n,r(e))}function En(t){return null==t?t===e?"[object Undefined]":"[object Null]":Xe&&Xe in Se(t)?function(t){var r=Ae.call(t,Xe),n=t[Xe];try{t[Xe]=e;var a=!0}catch(i){}var o=Fe.call(t);return a&&(r?t[Xe]=n:delete t[Xe]),o}(t):function(e){return Fe.call(e)}(t)}function kn(e,t){return e>t}function Sn(e,t){return null!=e&&Ae.call(e,t)}function Rn(e,t){return null!=e&&t in Se(e)}function Cn(t,r,n){for(var a=n?jt:Mt,o=t[0].length,i=t.length,s=i,l=ae(i),c=1/0,u=[];s--;){var f=t[s];s&&r&&(f=Tt(f,Kt(r))),c=gr(f.length,c),l[s]=!n&&(r||o>=120&&f.length>=120)?new Wr(s&&f):e}f=t[0];var d=-1,p=l[0];e:for(;++d<o&&u.length<c;){var m=f[d],h=r?r(m):m;if(m=n||0!==m?m:0,!(p?Qt(p,h):a(u,h,n))){for(s=i;--s;){var g=l[s];if(!(g?Qt(g,h):a(t[s],h,n)))continue e}p&&p.push(h),u.push(m)}}return u}function Nn(t,r,n){var a=null==(t=Ro(t,r=ya(r,t)))?t:t[Lo(Zo(r))];return null==a?e:kt(a,t,n)}function On(e){return rs(e)&&En(e)==p}function Mn(t,r,n,a,o){return t===r||(null==t||null==r||!rs(t)&&!rs(r)?t!=t&&r!=r:function(t,r,n,a,o,i){var s=Wi(t),l=Wi(r),c=s?m:po(t),u=l?m:po(r),f=(c=c==p?k:c)==k,d=(u=u==p?k:u)==k,b=c==u;if(b&&Gi(t)){if(!Gi(r))return!1;s=!0,f=!1}if(b&&!f)return i||(i=new qr),s||us(t)?Xa(t,r,n,a,o,i):function(e,t,r,n,a,o,i){switch(r){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case j:return!(e.byteLength!=t.byteLength||!o(new Ye(e),new Ye(t)));case h:case g:case w:return Ui(+e,+t);case y:return e.name==t.name&&e.message==t.message;case R:case N:return e==t+"";case x:var s=or;case C:var l=1&n;if(s||(s=lr),e.size!=t.size&&!l)return!1;var c=i.get(e);if(c)return c==t;n|=2,i.set(e,t);var u=Xa(s(e),s(t),n,a,o,i);return i.delete(e),u;case O:if(Dr)return Dr.call(e)==Dr.call(t)}return!1}(t,r,c,n,a,o,i);if(!(1&n)){var v=f&&Ae.call(t,"__wrapped__"),_=d&&Ae.call(r,"__wrapped__");if(v||_){var E=v?t.value():t,S=_?r.value():r;return i||(i=new qr),o(E,S,n,a,i)}}return!!b&&(i||(i=new qr),function(t,r,n,a,o,i){var s=1&n,l=to(t),c=l.length,u=to(r),f=u.length;if(c!=f&&!s)return!1;for(var d=c;d--;){var p=l[d];if(!(s?p in r:Ae.call(r,p)))return!1}var m=i.get(t),h=i.get(r);if(m&&h)return m==r&&h==t;var g=!0;i.set(t,r),i.set(r,t);for(var y=s;++d<c;){var b=t[p=l[d]],v=r[p];if(a)var x=s?a(v,b,p,r,t,i):a(b,v,p,t,r,i);if(!(x===e?b===v||o(b,v,n,a,i):x)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var w=t.constructor,_=r.constructor;w==_||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(g=!1)}return i.delete(t),i.delete(r),g}(t,r,n,a,o,i))}(t,r,n,a,Mn,o))}function jn(t,r,n,a){var o=n.length,i=o,s=!a;if(null==t)return!i;for(t=Se(t);o--;){var l=n[o];if(s&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++o<i;){var c=(l=n[o])[0],u=t[c],f=l[1];if(s&&l[2]){if(u===e&&!(c in t))return!1}else{var d=new qr;if(a)var p=a(u,f,c,t,r,d);if(!(p===e?Mn(f,u,3,a,d):p))return!1}}return!0}function Tn(e){return!(!ts(e)||(t=e,ze&&ze in t))&&(Qi(e)?Ie:he).test(Po(e));var t}function $n(e){return"function"==typeof e?e:null==e?al:"object"==typeof e?Wi(e)?Pn(e[0],e[1]):Ln(e):pl(e)}function An(e){if(!_o(e))return mr(e);var t=[];for(var r in Se(e))Ae.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Dn(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var r in Se(e))t.push(r);return t}(e);var t=_o(e),r=[];for(var n in e)("constructor"!=n||!t&&Ae.call(e,n))&&r.push(n);return r}function zn(e,t){return e<t}function Fn(e,t){var r=-1,n=Vi(e)?ae(e.length):[];return un(e,function(e,a,o){n[++r]=t(e,a,o)}),n}function Ln(e){var t=lo(e);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(r){return r===e||jn(r,e,t)}}function Pn(t,r){return vo(t)&&Eo(r)?ko(Lo(t),r):function(n){var a=Cs(n,t);return a===e&&a===r?Ns(n,t):Mn(r,a,3)}}function In(t,r,n,a,o){t!==r&&gn(r,function(i,s){if(o||(o=new qr),ts(i))!function(t,r,n,a,o,i,s){var l=Co(t,n),c=Co(r,n),u=s.get(c);if(u)Zr(t,n,u);else{var f=i?i(l,c,n+"",t,r,s):e,d=f===e;if(d){var p=Wi(c),m=!p&&Gi(c),h=!p&&!m&&us(c);f=c,p||m||h?Wi(l)?f=l:Ji(l)?f=Ca(l):m?(d=!1,f=wa(c,!0)):h?(d=!1,f=Ea(c,!0)):f=[]:os(c)||Hi(c)?(f=l,Hi(l)?f=bs(l):ts(l)&&!Qi(l)||(f=ho(c))):d=!1}d&&(s.set(c,f),o(f,c,a,i,s),s.delete(c)),Zr(t,n,f)}}(t,r,s,n,In,a,o);else{var l=a?a(Co(t,s),i,s+"",t,r,o):e;l===e&&(l=i),Zr(t,s,l)}},$s)}function Un(t,r){var n=t.length;if(n)return yo(r+=r<0?n:0,n)?t[r]:e}function Bn(e,t,r){t=t.length?Tt(t,function(e){return Wi(e)?function(t){return wn(t,1===e.length?e[0]:e)}:e}):[al];var n=-1;return t=Tt(t,Kt(io())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(Fn(e,function(e,r,a){return{criteria:Tt(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return function(e,t,r){for(var n=-1,a=e.criteria,o=t.criteria,i=a.length,s=r.length;++n<i;){var l=ka(a[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function Yn(e,t,r){for(var n=-1,a=t.length,o={};++n<a;){var i=t[n],s=wn(e,i);r(s,i)&&Zn(o,ya(i,e),s)}return o}function Hn(e,t,r,n){var a=n?Ut:It,o=-1,i=t.length,s=e;for(e===t&&(t=Ca(t)),r&&(s=Tt(e,Kt(r)));++o<i;)for(var l=0,c=t[o],u=r?r(c):c;(l=a(s,u,l,n))>-1;)s!==e&&Je.call(s,l,1),Je.call(e,l,1);return e}function Wn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var a=t[r];if(r==n||a!==o){var o=a;yo(a)?Je.call(e,a,1):ca(e,a)}}return e}function qn(e,t){return e+mt(vr()*(t-e+1))}function Vn(e,t){var r="";if(!e||t<1||t>c)return r;do{t%2&&(r+=e),(t=mt(t/2))&&(e+=e)}while(t);return r}function Jn(e,t){return Mo(So(e,t,al),e+"")}function Gn(e){return Jr(Us(e))}function Kn(e,t){var r=Us(e);return $o(r,an(t,0,r.length))}function Zn(t,r,n,a){if(!ts(t))return t;for(var o=-1,i=(r=ya(r,t)).length,s=i-1,l=t;null!=l&&++o<i;){var c=Lo(r[o]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var f=l[c];(u=a?a(f,c,l):e)===e&&(u=ts(f)?f:yo(r[o+1])?[]:{})}Qr(l,c,u),l=l[c]}return t}var Qn=Cr?function(e,t){return Cr.set(e,t),e}:al,Xn=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:tl(t),writable:!0})}:al;function ea(e){return $o(Us(e))}function ta(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var o=ae(a);++n<a;)o[n]=e[n+t];return o}function ra(e,t){var r;return un(e,function(e,n,a){return!(r=t(e,n,a))}),!!r}function na(e,t,r){var n=0,a=null==e?n:e.length;if("number"==typeof t&&t==t&&a<=2147483647){for(;n<a;){var o=n+a>>>1,i=e[o];null!==i&&!cs(i)&&(r?i<=t:i<t)?n=o+1:a=o}return a}return aa(e,t,al,r)}function aa(t,r,n,a){var o=0,i=null==t?0:t.length;if(0===i)return 0;for(var s=(r=n(r))!=r,l=null===r,c=cs(r),u=r===e;o<i;){var f=mt((o+i)/2),d=n(t[f]),p=d!==e,m=null===d,h=d==d,g=cs(d);if(s)var y=a||h;else y=u?h&&(a||p):l?h&&p&&(a||!m):c?h&&p&&!m&&(a||!g):!m&&!g&&(a?d<=r:d<r);y?o=f+1:i=f}return gr(i,4294967294)}function oa(e,t){for(var r=-1,n=e.length,a=0,o=[];++r<n;){var i=e[r],s=t?t(i):i;if(!r||!Ui(s,l)){var l=s;o[a++]=0===i?0:i}}return o}function ia(e){return"number"==typeof e?e:cs(e)?u:+e}function sa(e){if("string"==typeof e)return e;if(Wi(e))return Tt(e,sa)+"";if(cs(e))return zr?zr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function la(e,t,r){var n=-1,a=Mt,o=e.length,i=!0,s=[],l=s;if(r)i=!1,a=jt;else if(o>=200){var c=t?null:Va(e);if(c)return lr(c);i=!1,a=Qt,l=new Wr}else l=t?[]:s;e:for(;++n<o;){var u=e[n],f=t?t(u):u;if(u=r||0!==u?u:0,i&&f==f){for(var d=l.length;d--;)if(l[d]===f)continue e;t&&l.push(f),s.push(u)}else a(l,f,r)||(l!==s&&l.push(f),s.push(u))}return s}function ca(e,t){var r=-1,n=(t=ya(t,e)).length;if(!n)return!0;for(var a=null==e||"object"!=typeof e&&"function"!=typeof e;++r<n;){var o=t[r];if("string"==typeof o){if("__proto__"===o&&!Ae.call(e,"__proto__"))return!1;if("constructor"===o&&r+1<n&&"string"==typeof t[r+1]&&"prototype"===t[r+1]){if(a&&0===r)continue;return!1}}}var i=Ro(e,t);return null==i||delete i[Lo(Zo(t))]}function ua(e,t,r,n){return Zn(e,t,r(wn(e,t)),n)}function fa(e,t,r,n){for(var a=e.length,o=n?a:-1;(n?o--:++o<a)&&t(e[o],o,e););return r?ta(e,n?0:o,n?o+1:a):ta(e,n?o+1:0,n?a:o)}function da(e,t){var r=e;return r instanceof Ur&&(r=r.value()),At(t,function(e,t){return t.func.apply(t.thisArg,$t([e],t.args))},r)}function pa(e,t,r){var n=e.length;if(n<2)return n?la(e[0]):[];for(var a=-1,o=ae(n);++a<n;)for(var i=e[a],s=-1;++s<n;)s!=a&&(o[a]=cn(o[a]||i,e[s],t,r));return la(hn(o,1),t,r)}function ma(t,r,n){for(var a=-1,o=t.length,i=r.length,s={};++a<o;){var l=a<i?r[a]:e;n(s,t[a],l)}return s}function ha(e){return Ji(e)?e:[]}function ga(e){return"function"==typeof e?e:al}function ya(e,t){return Wi(e)?e:vo(e,t)?[e]:Fo(vs(e))}var ba=Jn;function va(t,r,n){var a=t.length;return n=n===e?a:n,!r&&n>=a?t:ta(t,r,n)}var xa=st||function(e){return dt.clearTimeout(e)};function wa(e,t){if(t)return e.slice();var r=e.length,n=He?He(r):new e.constructor(r);return e.copy(n),n}function _a(e){var t=new e.constructor(e.byteLength);return new Ye(t).set(new Ye(e)),t}function Ea(e,t){var r=t?_a(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ka(t,r){if(t!==r){var n=t!==e,a=null===t,o=t==t,i=cs(t),s=r!==e,l=null===r,c=r==r,u=cs(r);if(!l&&!u&&!i&&t>r||i&&s&&c&&!l&&!u||a&&s&&c||!n&&c||!o)return 1;if(!a&&!i&&!u&&t<r||u&&n&&o&&!a&&!i||l&&n&&o||!s&&o||!c)return-1}return 0}function Sa(e,t,r,n){for(var a=-1,o=e.length,i=r.length,s=-1,l=t.length,c=hr(o-i,0),u=ae(l+c),f=!n;++s<l;)u[s]=t[s];for(;++a<i;)(f||a<o)&&(u[r[a]]=e[a]);for(;c--;)u[s++]=e[a++];return u}function Ra(e,t,r,n){for(var a=-1,o=e.length,i=-1,s=r.length,l=-1,c=t.length,u=hr(o-s,0),f=ae(u+c),d=!n;++a<u;)f[a]=e[a];for(var p=a;++l<c;)f[p+l]=t[l];for(;++i<s;)(d||a<o)&&(f[p+r[i]]=e[a++]);return f}function Ca(e,t){var r=-1,n=e.length;for(t||(t=ae(n));++r<n;)t[r]=e[r];return t}function Na(t,r,n,a){var o=!n;n||(n={});for(var i=-1,s=r.length;++i<s;){var l=r[i],c=a?a(n[l],t[l],l,n,t):e;c===e&&(c=t[l]),o?rn(n,l,c):Qr(n,l,c)}return n}function Oa(e,t){return function(r,n){var a=Wi(r)?St:en,o=t?t():{};return a(r,e,io(n,2),o)}}function Ma(t){return Jn(function(r,n){var a=-1,o=n.length,i=o>1?n[o-1]:e,s=o>2?n[2]:e;for(i=t.length>3&&"function"==typeof i?(o--,i):e,s&&bo(n[0],n[1],s)&&(i=o<3?e:i,o=1),r=Se(r);++a<o;){var l=n[a];l&&t(r,l,a,i)}return r})}function ja(e,t){return function(r,n){if(null==r)return r;if(!Vi(r))return e(r,n);for(var a=r.length,o=t?a:-1,i=Se(r);(t?o--:++o<a)&&!1!==n(i[o],o,i););return r}}function Ta(e){return function(t,r,n){for(var a=-1,o=Se(t),i=n(t),s=i.length;s--;){var l=i[e?s:++a];if(!1===r(o[l],l,o))break}return t}}function $a(t){return function(r){var n=ar(r=vs(r))?ur(r):e,a=n?n[0]:r.charAt(0),o=n?va(n,1).join(""):r.slice(1);return a[t]()+o}}function Aa(e){return function(t){return At(Qs(Hs(t).replace(Ze,"")),e,"")}}function Da(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Lr(e.prototype),n=e.apply(r,t);return ts(n)?n:r}}function za(t){return function(r,n,a){var o=Se(r);if(!Vi(r)){var i=io(n,3);r=Ts(r),n=function(e){return i(o[e],e,o)}}var s=t(r,n,a);return s>-1?o[i?r[s]:s]:e}}function Fa(r){return eo(function(n){var a=n.length,o=a,i=Ir.prototype.thru;for(r&&n.reverse();o--;){var s=n[o];if("function"!=typeof s)throw new Ne(t);if(i&&!l&&"wrapper"==ao(s))var l=new Ir([],!0)}for(o=l?o:a;++o<a;){var c=ao(s=n[o]),u="wrapper"==c?no(s):e;l=u&&xo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[ao(u[0])].apply(l,u[3]):1==s.length&&xo(s)?l[c]():l.thru(s)}return function(){var e=arguments,t=e[0];if(l&&1==e.length&&Wi(t))return l.plant(t).value();for(var r=0,o=a?n[r].apply(this,e):t;++r<a;)o=n[r].call(this,o);return o}})}function La(t,r,n,a,o,s,l,c,u,f){var d=r&i,p=1&r,m=2&r,h=24&r,g=512&r,y=m?e:Da(t);return function i(){for(var b=arguments.length,v=ae(b),x=b;x--;)v[x]=arguments[x];if(h)var w=oo(i),_=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(v,w);if(a&&(v=Sa(v,a,o,h)),s&&(v=Ra(v,s,l,h)),b-=_,h&&b<f){var E=sr(v,w);return Wa(t,r,La,i.placeholder,n,v,E,c,u,f-b)}var k=p?n:this,S=m?k[t]:t;return b=v.length,c?v=function(t,r){for(var n=t.length,a=gr(r.length,n),o=Ca(t);a--;){var i=r[a];t[a]=yo(i,n)?o[i]:e}return t}(v,c):g&&b>1&&v.reverse(),d&&u<b&&(v.length=u),this&&this!==dt&&this instanceof i&&(S=y||Da(S)),S.apply(k,v)}}function Pa(e,t){return function(r,n){return function(e,t,r,n){return bn(e,function(e,a,o){t(n,r(e),a,o)}),n}(r,e,t(n),{})}}function Ia(t,r){return function(n,a){var o;if(n===e&&a===e)return r;if(n!==e&&(o=n),a!==e){if(o===e)return a;"string"==typeof n||"string"==typeof a?(n=sa(n),a=sa(a)):(n=ia(n),a=ia(a)),o=t(n,a)}return o}}function Ua(e){return eo(function(t){return t=Tt(t,Kt(io())),Jn(function(r){var n=this;return e(t,function(e){return kt(e,n,r)})})})}function Ba(t,r){var n=(r=r===e?" ":sa(r)).length;if(n<2)return n?Vn(r,t):r;var a=Vn(r,pt(t/cr(r)));return ar(r)?va(ur(a),0,t).join(""):a.slice(0,t)}function Ya(t){return function(r,n,a){return a&&"number"!=typeof a&&bo(r,n,a)&&(n=a=e),r=ms(r),n===e?(n=r,r=0):n=ms(n),function(e,t,r,n){for(var a=-1,o=hr(pt((t-e)/(r||1)),0),i=ae(o);o--;)i[n?o:++a]=e,e+=r;return i}(r,n,a=a===e?r<n?1:-1:ms(a),t)}}function Ha(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ys(t),r=ys(r)),e(t,r)}}function Wa(t,r,n,a,i,s,l,c,u,f){var d=8&r;r|=d?o:64,4&(r&=~(d?64:o))||(r&=-4);var p=[t,r,i,d?s:e,d?l:e,d?e:s,d?e:l,c,u,f],m=n.apply(e,p);return xo(t)&&No(m,p),m.placeholder=a,jo(m,t,r)}function qa(e){var t=ke[e];return function(e,r){if(e=ys(e),(r=null==r?0:gr(hs(r),292))&&Ft(e)){var n=(vs(e)+"e").split("e");return+((n=(vs(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Va=kr&&1/lr(new kr([,-0]))[1]==l?function(e){return new kr(e)}:cl;function Ja(e){return function(t){var r=po(t);return r==x?or(t):r==C?function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}(t):function(e,t){return Tt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ga(r,a,l,c,u,f,d,p){var m=2&a;if(!m&&"function"!=typeof r)throw new Ne(t);var h=c?c.length:0;if(h||(a&=-97,c=u=e),d=d===e?d:hr(hs(d),0),p=p===e?p:hs(p),h-=u?u.length:0,64&a){var g=c,y=u;c=u=e}var b=m?e:no(r),v=[r,a,l,c,u,g,y,f,d,p];if(b&&function(e,t){var r=e[1],a=t[1],o=r|a,l=o<131,c=a==i&&8==r||a==i&&r==s&&e[7].length<=t[8]||384==a&&t[7].length<=t[8]&&8==r;if(!l&&!c)return e;1&a&&(e[2]=t[2],o|=1&r?0:4);var u=t[3];if(u){var f=e[3];e[3]=f?Sa(f,u,t[4]):u,e[4]=f?sr(e[3],n):t[4]}(u=t[5])&&(f=e[5],e[5]=f?Ra(f,u,t[6]):u,e[6]=f?sr(e[5],n):t[6]),(u=t[7])&&(e[7]=u),a&i&&(e[8]=null==e[8]?t[8]:gr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(v,b),r=v[0],a=v[1],l=v[2],c=v[3],u=v[4],!(p=v[9]=v[9]===e?m?0:r.length:hr(v[9]-h,0))&&24&a&&(a&=-25),a&&1!=a)x=8==a||16==a?function(t,r,n){var a=Da(t);return function o(){for(var i=arguments.length,s=ae(i),l=i,c=oo(o);l--;)s[l]=arguments[l];var u=i<3&&s[0]!==c&&s[i-1]!==c?[]:sr(s,c);return(i-=u.length)<n?Wa(t,r,La,o.placeholder,e,s,u,e,e,n-i):kt(this&&this!==dt&&this instanceof o?a:t,this,s)}}(r,a,p):a!=o&&33!=a||u.length?La.apply(e,v):function(e,t,r,n){var a=1&t,o=Da(e);return function t(){for(var i=-1,s=arguments.length,l=-1,c=n.length,u=ae(c+s),f=this&&this!==dt&&this instanceof t?o:e;++l<c;)u[l]=n[l];for(;s--;)u[l++]=arguments[++i];return kt(f,a?r:this,u)}}(r,a,l,c);else var x=function(e,t,r){var n=1&t,a=Da(e);return function t(){return(this&&this!==dt&&this instanceof t?a:e).apply(n?r:this,arguments)}}(r,a,l);return jo((b?Qn:No)(x,v),r,a)}function Ka(t,r,n,a){return t===e||Ui(t,je[n])&&!Ae.call(a,n)?r:t}function Za(t,r,n,a,o,i){return ts(t)&&ts(r)&&(i.set(r,t),In(t,r,e,Za,i),i.delete(r)),t}function Qa(t){return os(t)?e:t}function Xa(t,r,n,a,o,i){var s=1&n,l=t.length,c=r.length;if(l!=c&&!(s&&c>l))return!1;var u=i.get(t),f=i.get(r);if(u&&f)return u==r&&f==t;var d=-1,p=!0,m=2&n?new Wr:e;for(i.set(t,r),i.set(r,t);++d<l;){var h=t[d],g=r[d];if(a)var y=s?a(g,h,d,r,t,i):a(h,g,d,t,r,i);if(y!==e){if(y)continue;p=!1;break}if(m){if(!zt(r,function(e,t){if(!Qt(m,t)&&(h===e||o(h,e,n,a,i)))return m.push(t)})){p=!1;break}}else if(h!==g&&!o(h,g,n,a,i)){p=!1;break}}return i.delete(t),i.delete(r),p}function eo(t){return Mo(So(t,e,qo),t+"")}function to(e){return _n(e,Ts,uo)}function ro(e){return _n(e,$s,fo)}var no=Cr?function(e){return Cr.get(e)}:cl;function ao(e){for(var t=e.name+"",r=Nr[t],n=Ae.call(Nr,t)?r.length:0;n--;){var a=r[n],o=a.func;if(null==o||o==e)return a.name}return t}function oo(e){return(Ae.call(Fr,"placeholder")?Fr:e).placeholder}function io(){var e=Fr.iteratee||ol;return e=e===ol?$n:e,arguments.length?e(arguments[0],arguments[1]):e}function so(e,t){var r,n,a=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?a["string"==typeof t?"string":"hash"]:a.map}function lo(e){for(var t=Ts(e),r=t.length;r--;){var n=t[r],a=e[n];t[r]=[n,a,Eo(a)]}return t}function co(t,r){var n=function(t,r){return null==t?e:t[r]}(t,r);return Tn(n)?n:e}var uo=gt?function(e){return null==e?[]:(e=Se(e),Ot(gt(e),function(t){return Ve.call(e,t)}))}:gl,fo=gt?function(e){for(var t=[];e;)$t(t,uo(e)),e=We(e);return t}:gl,po=En;function mo(e,t,r){for(var n=-1,a=(t=ya(t,e)).length,o=!1;++n<a;){var i=Lo(t[n]);if(!(o=null!=e&&r(e,i)))break;e=e[i]}return o||++n!=a?o:!!(a=null==e?0:e.length)&&es(a)&&yo(i,a)&&(Wi(e)||Hi(e))}function ho(e){return"function"!=typeof e.constructor||_o(e)?{}:Lr(We(e))}function go(e){return Wi(e)||Hi(e)||!!(Ge&&e&&e[Ge])}function yo(e,t){var r=typeof e;return!!(t=null==t?c:t)&&("number"==r||"symbol"!=r&&ye.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,r){if(!ts(r))return!1;var n=typeof t;return!!("number"==n?Vi(r)&&yo(t,r.length):"string"==n&&t in r)&&Ui(r[t],e)}function vo(e,t){if(Wi(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!cs(e))||X.test(e)||!Q.test(e)||null!=t&&e in Se(t)}function xo(e){var t=ao(e),r=Fr[t];if("function"!=typeof r||!(t in Ur.prototype))return!1;if(e===r)return!0;var n=no(r);return!!n&&e===n[0]}(wr&&po(new wr(new ArrayBuffer(1)))!=T||_r&&po(new _r)!=x||Er&&po(Er.resolve())!=S||kr&&po(new kr)!=C||Sr&&po(new Sr)!=M)&&(po=function(t){var r=En(t),n=r==k?t.constructor:e,a=n?Po(n):"";if(a)switch(a){case Or:return T;case Mr:return x;case jr:return S;case Tr:return C;case $r:return M}return r});var wo=Te?Qi:yl;function _o(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function Eo(e){return e==e&&!ts(e)}function ko(t,r){return function(n){return null!=n&&n[t]===r&&(r!==e||t in Se(n))}}function So(t,r,n){return r=hr(r===e?t.length-1:r,0),function(){for(var e=arguments,a=-1,o=hr(e.length-r,0),i=ae(o);++a<o;)i[a]=e[r+a];a=-1;for(var s=ae(r+1);++a<r;)s[a]=e[a];return s[r]=n(i),kt(t,this,s)}}function Ro(e,t){return t.length<2?e:wn(e,ta(t,0,-1))}function Co(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var No=To(Qn),Oo=ft||function(e,t){return dt.setTimeout(e,t)},Mo=To(Xn);function jo(e,t,r){var n=t+"";return Mo(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Rt(d,function(r){var n="_."+r[0];t&r[1]&&!Mt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(se):[]}(n),r)))}function To(t){var r=0,n=0;return function(){var a=yr(),o=16-(a-n);if(n=a,o>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(e,arguments)}}function $o(t,r){var n=-1,a=t.length,o=a-1;for(r=r===e?a:r;++n<r;){var i=qn(n,o),s=t[i];t[i]=t[n],t[n]=s}return t.length=r,t}var Ao,Do,zo,Fo=(Ao=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,function(e,r,n,a){t.push(n?a.replace(ue,"$1"):r||e)}),t},Do=Di(Ao,function(e){return 500===zo.size&&zo.clear(),e}),zo=Do.cache,Do);function Lo(e){if("string"==typeof e||cs(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Po(e){if(null!=e){try{return $e.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Io(e){if(e instanceof Ur)return e.clone();var t=new Ir(e.__wrapped__,e.__chain__);return t.__actions__=Ca(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Uo=Jn(function(e,t){return Ji(e)?cn(e,hn(t,1,Ji,!0)):[]}),Bo=Jn(function(t,r){var n=Zo(r);return Ji(n)&&(n=e),Ji(t)?cn(t,hn(r,1,Ji,!0),io(n,2)):[]}),Yo=Jn(function(t,r){var n=Zo(r);return Ji(n)&&(n=e),Ji(t)?cn(t,hn(r,1,Ji,!0),e,n):[]});function Ho(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=null==r?0:hs(r);return a<0&&(a=hr(n+a,0)),Pt(e,io(t,3),a)}function Wo(t,r,n){var a=null==t?0:t.length;if(!a)return-1;var o=a-1;return n!==e&&(o=hs(n),o=n<0?hr(a+o,0):gr(o,a-1)),Pt(t,io(r,3),o,!0)}function qo(e){return null!=e&&e.length?hn(e,1):[]}function Vo(t){return t&&t.length?t[0]:e}var Jo=Jn(function(e){var t=Tt(e,ha);return t.length&&t[0]===e[0]?Cn(t):[]}),Go=Jn(function(t){var r=Zo(t),n=Tt(t,ha);return r===Zo(n)?r=e:n.pop(),n.length&&n[0]===t[0]?Cn(n,io(r,2)):[]}),Ko=Jn(function(t){var r=Zo(t),n=Tt(t,ha);return(r="function"==typeof r?r:e)&&n.pop(),n.length&&n[0]===t[0]?Cn(n,e,r):[]});function Zo(t){var r=null==t?0:t.length;return r?t[r-1]:e}var Qo=Jn(Xo);function Xo(e,t){return e&&e.length&&t&&t.length?Hn(e,t):e}var ei=eo(function(e,t){var r=null==e?0:e.length,n=nn(e,t);return Wn(e,Tt(t,function(e){return yo(e,r)?+e:e}).sort(ka)),n});function ti(e){return null==e?e:xr.call(e)}var ri=Jn(function(e){return la(hn(e,1,Ji,!0))}),ni=Jn(function(t){var r=Zo(t);return Ji(r)&&(r=e),la(hn(t,1,Ji,!0),io(r,2))}),ai=Jn(function(t){var r=Zo(t);return r="function"==typeof r?r:e,la(hn(t,1,Ji,!0),e,r)});function oi(e){if(!e||!e.length)return[];var t=0;return e=Ot(e,function(e){if(Ji(e))return t=hr(e.length,t),!0}),Jt(t,function(t){return Tt(e,Ht(t))})}function ii(t,r){if(!t||!t.length)return[];var n=oi(t);return null==r?n:Tt(n,function(t){return kt(r,e,t)})}var si=Jn(function(e,t){return Ji(e)?cn(e,t):[]}),li=Jn(function(e){return pa(Ot(e,Ji))}),ci=Jn(function(t){var r=Zo(t);return Ji(r)&&(r=e),pa(Ot(t,Ji),io(r,2))}),ui=Jn(function(t){var r=Zo(t);return r="function"==typeof r?r:e,pa(Ot(t,Ji),e,r)}),fi=Jn(oi),di=Jn(function(t){var r=t.length,n=r>1?t[r-1]:e;return n="function"==typeof n?(t.pop(),n):e,ii(t,n)});function pi(e){var t=Fr(e);return t.__chain__=!0,t}function mi(e,t){return t(e)}var hi=eo(function(t){var r=t.length,n=r?t[0]:0,a=this.__wrapped__,o=function(e){return nn(e,t)};return!(r>1||this.__actions__.length)&&a instanceof Ur&&yo(n)?((a=a.slice(n,+n+(r?1:0))).__actions__.push({func:mi,args:[o],thisArg:e}),new Ir(a,this.__chain__).thru(function(t){return r&&!t.length&&t.push(e),t})):this.thru(o)}),gi=Oa(function(e,t,r){Ae.call(e,r)?++e[r]:rn(e,r,1)}),yi=za(Ho),bi=za(Wo);function vi(e,t){return(Wi(e)?Rt:un)(e,io(t,3))}function xi(e,t){return(Wi(e)?Ct:fn)(e,io(t,3))}var wi=Oa(function(e,t,r){Ae.call(e,r)?e[r].push(t):rn(e,r,[t])}),_i=Jn(function(e,t,r){var n=-1,a="function"==typeof t,o=Vi(e)?ae(e.length):[];return un(e,function(e){o[++n]=a?kt(t,e,r):Nn(e,t,r)}),o}),Ei=Oa(function(e,t,r){rn(e,r,t)});function ki(e,t){return(Wi(e)?Tt:Fn)(e,io(t,3))}var Si=Oa(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),Ri=Jn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&bo(e,t[0],t[1])?t=[]:r>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),Bn(e,hn(t,1),[])}),Ci=ut||function(){return dt.Date.now()};function Ni(t,r,n){return r=n?e:r,r=t&&null==r?t.length:r,Ga(t,i,e,e,e,e,r)}function Oi(r,n){var a;if("function"!=typeof n)throw new Ne(t);return r=hs(r),function(){return--r>0&&(a=n.apply(this,arguments)),r<=1&&(n=e),a}}var Mi=Jn(function(e,t,r){var n=1;if(r.length){var a=sr(r,oo(Mi));n|=o}return Ga(e,n,t,r,a)}),ji=Jn(function(e,t,r){var n=3;if(r.length){var a=sr(r,oo(ji));n|=o}return Ga(t,n,e,r,a)});function Ti(r,n,a){var o,i,s,l,c,u,f=0,d=!1,p=!1,m=!0;if("function"!=typeof r)throw new Ne(t);function h(t){var n=o,a=i;return o=i=e,f=t,l=r.apply(a,n)}function g(t){var r=t-u;return u===e||r>=n||r<0||p&&t-f>=s}function y(){var e=Ci();if(g(e))return b(e);c=Oo(y,function(e){var t=n-(e-u);return p?gr(t,s-(e-f)):t}(e))}function b(t){return c=e,m&&o?h(t):(o=i=e,l)}function v(){var t=Ci(),r=g(t);if(o=arguments,i=this,u=t,r){if(c===e)return function(e){return f=e,c=Oo(y,n),d?h(e):l}(u);if(p)return xa(c),c=Oo(y,n),h(u)}return c===e&&(c=Oo(y,n)),l}return n=ys(n)||0,ts(a)&&(d=!!a.leading,s=(p="maxWait"in a)?hr(ys(a.maxWait)||0,n):s,m="trailing"in a?!!a.trailing:m),v.cancel=function(){c!==e&&xa(c),f=0,o=u=i=c=e},v.flush=function(){return c===e?l:b(Ci())},v}var $i=Jn(function(e,t){return ln(e,1,t)}),Ai=Jn(function(e,t,r){return ln(e,ys(t)||0,r)});function Di(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new Ne(t);var n=function(){var t=arguments,a=r?r.apply(this,t):t[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,t);return n.cache=o.set(a,i)||o,i};return n.cache=new(Di.Cache||Hr),n}function zi(e){if("function"!=typeof e)throw new Ne(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Di.Cache=Hr;var Fi=ba(function(e,t){var r=(t=1==t.length&&Wi(t[0])?Tt(t[0],Kt(io())):Tt(hn(t,1),Kt(io()))).length;return Jn(function(n){for(var a=-1,o=gr(n.length,r);++a<o;)n[a]=t[a].call(this,n[a]);return kt(e,this,n)})}),Li=Jn(function(t,r){var n=sr(r,oo(Li));return Ga(t,o,e,r,n)}),Pi=Jn(function(t,r){var n=sr(r,oo(Pi));return Ga(t,64,e,r,n)}),Ii=eo(function(t,r){return Ga(t,s,e,e,e,r)});function Ui(e,t){return e===t||e!=e&&t!=t}var Bi=Ha(kn),Yi=Ha(function(e,t){return e>=t}),Hi=On(function(){return arguments}())?On:function(e){return rs(e)&&Ae.call(e,"callee")&&!Ve.call(e,"callee")},Wi=ae.isArray,qi=bt?Kt(bt):function(e){return rs(e)&&En(e)==j};function Vi(e){return null!=e&&es(e.length)&&!Qi(e)}function Ji(e){return rs(e)&&Vi(e)}var Gi=yt||yl,Ki=vt?Kt(vt):function(e){return rs(e)&&En(e)==g};function Zi(e){if(!rs(e))return!1;var t=En(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!os(e)}function Qi(e){if(!ts(e))return!1;var t=En(e);return t==b||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xi(e){return"number"==typeof e&&e==hs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function rs(e){return null!=e&&"object"==typeof e}var ns=xt?Kt(xt):function(e){return rs(e)&&po(e)==x};function as(e){return"number"==typeof e||rs(e)&&En(e)==w}function os(e){if(!rs(e)||En(e)!=k)return!1;var t=We(e);if(null===t)return!0;var r=Ae.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&$e.call(r)==Le}var is=wt?Kt(wt):function(e){return rs(e)&&En(e)==R},ss=_t?Kt(_t):function(e){return rs(e)&&po(e)==C};function ls(e){return"string"==typeof e||!Wi(e)&&rs(e)&&En(e)==N}function cs(e){return"symbol"==typeof e||rs(e)&&En(e)==O}var us=Et?Kt(Et):function(e){return rs(e)&&es(e.length)&&!!ot[En(e)]},fs=Ha(zn),ds=Ha(function(e,t){return e<=t});function ps(e){if(!e)return[];if(Vi(e))return ls(e)?ur(e):Ca(e);if(Ke&&e[Ke])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ke]());var t=po(e);return(t==x?or:t==C?lr:Us)(e)}function ms(e){return e?(e=ys(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=ms(e),r=t%1;return t==t?r?t-r:t:0}function gs(e){return e?an(hs(e),0,f):0}function ys(e){if("number"==typeof e)return e;if(cs(e))return u;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var r=me.test(e);return r||ge.test(e)?ct(e.slice(2),r?2:8):pe.test(e)?u:+e}function bs(e){return Na(e,$s(e))}function vs(e){return null==e?"":sa(e)}var xs=Ma(function(e,t){if(_o(t)||Vi(t))Na(t,Ts(t),e);else for(var r in t)Ae.call(t,r)&&Qr(e,r,t[r])}),ws=Ma(function(e,t){Na(t,$s(t),e)}),_s=Ma(function(e,t,r,n){Na(t,$s(t),e,n)}),Es=Ma(function(e,t,r,n){Na(t,Ts(t),e,n)}),ks=eo(nn),Ss=Jn(function(t,r){t=Se(t);var n=-1,a=r.length,o=a>2?r[2]:e;for(o&&bo(r[0],r[1],o)&&(a=1);++n<a;)for(var i=r[n],s=$s(i),l=-1,c=s.length;++l<c;){var u=s[l],f=t[u];(f===e||Ui(f,je[u])&&!Ae.call(t,u))&&(t[u]=i[u])}return t}),Rs=Jn(function(t){return t.push(e,Za),kt(Ds,e,t)});function Cs(t,r,n){var a=null==t?e:wn(t,r);return a===e?n:a}function Ns(e,t){return null!=e&&mo(e,t,Rn)}var Os=Pa(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Fe.call(t)),e[t]=r},tl(al)),Ms=Pa(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=Fe.call(t)),Ae.call(e,t)?e[t].push(r):e[t]=[r]},io),js=Jn(Nn);function Ts(e){return Vi(e)?Vr(e):An(e)}function $s(e){return Vi(e)?Vr(e,!0):Dn(e)}var As=Ma(function(e,t,r){In(e,t,r)}),Ds=Ma(function(e,t,r,n){In(e,t,r,n)}),zs=eo(function(e,t){var r={};if(null==e)return r;var n=!1;t=Tt(t,function(t){return t=ya(t,e),n||(n=t.length>1),t}),Na(e,ro(e),r),n&&(r=on(r,7,Qa));for(var a=t.length;a--;)ca(r,t[a]);return r}),Fs=eo(function(e,t){return null==e?{}:function(e,t){return Yn(e,t,function(t,r){return Ns(e,r)})}(e,t)});function Ls(e,t){if(null==e)return{};var r=Tt(ro(e),function(e){return[e]});return t=io(t),Yn(e,r,function(e,r){return t(e,r[0])})}var Ps=Ja(Ts),Is=Ja($s);function Us(e){return null==e?[]:Zt(e,Ts(e))}var Bs=Aa(function(e,t,r){return t=t.toLowerCase(),e+(r?Ys(t):t)});function Ys(e){return Zs(vs(e).toLowerCase())}function Hs(e){return(e=vs(e))&&e.replace(be,tr).replace(Qe,"")}var Ws=Aa(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),qs=Aa(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),Vs=$a("toLowerCase"),Js=Aa(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Gs=Aa(function(e,t,r){return e+(r?" ":"")+Zs(t)}),Ks=Aa(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),Zs=$a("toUpperCase");function Qs(t,r,n){return t=vs(t),(r=n?e:r)===e?function(e){return rt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(r)||[]}var Xs=Jn(function(t,r){try{return kt(t,e,r)}catch(n){return Zi(n)?n:new _e(n)}}),el=eo(function(e,t){return Rt(t,function(t){t=Lo(t),rn(e,t,Mi(e[t],e))}),e});function tl(e){return function(){return e}}var rl=Fa(),nl=Fa(!0);function al(e){return e}function ol(e){return $n("function"==typeof e?e:on(e,1))}var il=Jn(function(e,t){return function(r){return Nn(r,e,t)}}),sl=Jn(function(e,t){return function(r){return Nn(e,r,t)}});function ll(e,t,r){var n=Ts(t),a=xn(t,n);null!=r||ts(t)&&(a.length||!n.length)||(r=t,t=e,e=this,a=xn(t,Ts(t)));var o=!(ts(r)&&"chain"in r&&!r.chain),i=Qi(e);return Rt(a,function(r){var n=t[r];e[r]=n,i&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ca(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,$t([this.value()],arguments))})}),e}function cl(){}var ul=Ua(Tt),fl=Ua(Nt),dl=Ua(zt);function pl(e){return vo(e)?Ht(Lo(e)):function(e){return function(t){return wn(t,e)}}(e)}var ml=Ya(),hl=Ya(!0);function gl(){return[]}function yl(){return!1}var bl,vl=Ia(function(e,t){return e+t},0),xl=qa("ceil"),wl=Ia(function(e,t){return e/t},1),_l=qa("floor"),El=Ia(function(e,t){return e*t},1),kl=qa("round"),Sl=Ia(function(e,t){return e-t},0);return Fr.after=function(e,r){if("function"!=typeof r)throw new Ne(t);return e=hs(e),function(){if(--e<1)return r.apply(this,arguments)}},Fr.ary=Ni,Fr.assign=xs,Fr.assignIn=ws,Fr.assignInWith=_s,Fr.assignWith=Es,Fr.at=ks,Fr.before=Oi,Fr.bind=Mi,Fr.bindAll=el,Fr.bindKey=ji,Fr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wi(e)?e:[e]},Fr.chain=pi,Fr.chunk=function(t,r,n){r=(n?bo(t,r,n):r===e)?1:hr(hs(r),0);var a=null==t?0:t.length;if(!a||r<1)return[];for(var o=0,i=0,s=ae(pt(a/r));o<a;)s[i++]=ta(t,o,o+=r);return s},Fr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,a=[];++t<r;){var o=e[t];o&&(a[n++]=o)}return a},Fr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ae(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return $t(Wi(r)?Ca(r):[r],hn(t,1))},Fr.cond=function(e){var r=null==e?0:e.length,n=io();return e=r?Tt(e,function(e){if("function"!=typeof e[1])throw new Ne(t);return[n(e[0]),e[1]]}):[],Jn(function(t){for(var n=-1;++n<r;){var a=e[n];if(kt(a[0],this,t))return kt(a[1],this,t)}})},Fr.conforms=function(e){return function(e){var t=Ts(e);return function(r){return sn(r,e,t)}}(on(e,1))},Fr.constant=tl,Fr.countBy=gi,Fr.create=function(e,t){var r=Lr(e);return null==t?r:tn(r,t)},Fr.curry=function t(r,n,a){var o=Ga(r,8,e,e,e,e,e,n=a?e:n);return o.placeholder=t.placeholder,o},Fr.curryRight=function t(r,n,a){var o=Ga(r,16,e,e,e,e,e,n=a?e:n);return o.placeholder=t.placeholder,o},Fr.debounce=Ti,Fr.defaults=Ss,Fr.defaultsDeep=Rs,Fr.defer=$i,Fr.delay=Ai,Fr.difference=Uo,Fr.differenceBy=Bo,Fr.differenceWith=Yo,Fr.drop=function(t,r,n){var a=null==t?0:t.length;return a?ta(t,(r=n||r===e?1:hs(r))<0?0:r,a):[]},Fr.dropRight=function(t,r,n){var a=null==t?0:t.length;return a?ta(t,0,(r=a-(r=n||r===e?1:hs(r)))<0?0:r):[]},Fr.dropRightWhile=function(e,t){return e&&e.length?fa(e,io(t,3),!0,!0):[]},Fr.dropWhile=function(e,t){return e&&e.length?fa(e,io(t,3),!0):[]},Fr.fill=function(t,r,n,a){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&bo(t,r,n)&&(n=0,a=o),function(t,r,n,a){var o=t.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(a=a===e||a>o?o:hs(a))<0&&(a+=o),a=n>a?0:gs(a);n<a;)t[n++]=r;return t}(t,r,n,a)):[]},Fr.filter=function(e,t){return(Wi(e)?Ot:mn)(e,io(t,3))},Fr.flatMap=function(e,t){return hn(ki(e,t),1)},Fr.flatMapDeep=function(e,t){return hn(ki(e,t),l)},Fr.flatMapDepth=function(t,r,n){return n=n===e?1:hs(n),hn(ki(t,r),n)},Fr.flatten=qo,Fr.flattenDeep=function(e){return null!=e&&e.length?hn(e,l):[]},Fr.flattenDepth=function(t,r){return null!=t&&t.length?hn(t,r=r===e?1:hs(r)):[]},Fr.flip=function(e){return Ga(e,512)},Fr.flow=rl,Fr.flowRight=nl,Fr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var a=e[t];n[a[0]]=a[1]}return n},Fr.functions=function(e){return null==e?[]:xn(e,Ts(e))},Fr.functionsIn=function(e){return null==e?[]:xn(e,$s(e))},Fr.groupBy=wi,Fr.initial=function(e){return null!=e&&e.length?ta(e,0,-1):[]},Fr.intersection=Jo,Fr.intersectionBy=Go,Fr.intersectionWith=Ko,Fr.invert=Os,Fr.invertBy=Ms,Fr.invokeMap=_i,Fr.iteratee=ol,Fr.keyBy=Ei,Fr.keys=Ts,Fr.keysIn=$s,Fr.map=ki,Fr.mapKeys=function(e,t){var r={};return t=io(t,3),bn(e,function(e,n,a){rn(r,t(e,n,a),e)}),r},Fr.mapValues=function(e,t){var r={};return t=io(t,3),bn(e,function(e,n,a){rn(r,n,t(e,n,a))}),r},Fr.matches=function(e){return Ln(on(e,1))},Fr.matchesProperty=function(e,t){return Pn(e,on(t,1))},Fr.memoize=Di,Fr.merge=As,Fr.mergeWith=Ds,Fr.method=il,Fr.methodOf=sl,Fr.mixin=ll,Fr.negate=zi,Fr.nthArg=function(e){return e=hs(e),Jn(function(t){return Un(t,e)})},Fr.omit=zs,Fr.omitBy=function(e,t){return Ls(e,zi(io(t)))},Fr.once=function(e){return Oi(2,e)},Fr.orderBy=function(t,r,n,a){return null==t?[]:(Wi(r)||(r=null==r?[]:[r]),Wi(n=a?e:n)||(n=null==n?[]:[n]),Bn(t,r,n))},Fr.over=ul,Fr.overArgs=Fi,Fr.overEvery=fl,Fr.overSome=dl,Fr.partial=Li,Fr.partialRight=Pi,Fr.partition=Si,Fr.pick=Fs,Fr.pickBy=Ls,Fr.property=pl,Fr.propertyOf=function(t){return function(r){return null==t?e:wn(t,r)}},Fr.pull=Qo,Fr.pullAll=Xo,Fr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Hn(e,t,io(r,2)):e},Fr.pullAllWith=function(t,r,n){return t&&t.length&&r&&r.length?Hn(t,r,e,n):t},Fr.pullAt=ei,Fr.range=ml,Fr.rangeRight=hl,Fr.rearg=Ii,Fr.reject=function(e,t){return(Wi(e)?Ot:mn)(e,zi(io(t,3)))},Fr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,a=[],o=e.length;for(t=io(t,3);++n<o;){var i=e[n];t(i,n,e)&&(r.push(i),a.push(n))}return Wn(e,a),r},Fr.rest=function(r,n){if("function"!=typeof r)throw new Ne(t);return Jn(r,n=n===e?n:hs(n))},Fr.reverse=ti,Fr.sampleSize=function(t,r,n){return r=(n?bo(t,r,n):r===e)?1:hs(r),(Wi(t)?Gr:Kn)(t,r)},Fr.set=function(e,t,r){return null==e?e:Zn(e,t,r)},Fr.setWith=function(t,r,n,a){return a="function"==typeof a?a:e,null==t?t:Zn(t,r,n,a)},Fr.shuffle=function(e){return(Wi(e)?Kr:ea)(e)},Fr.slice=function(t,r,n){var a=null==t?0:t.length;return a?(n&&"number"!=typeof n&&bo(t,r,n)?(r=0,n=a):(r=null==r?0:hs(r),n=n===e?a:hs(n)),ta(t,r,n)):[]},Fr.sortBy=Ri,Fr.sortedUniq=function(e){return e&&e.length?oa(e):[]},Fr.sortedUniqBy=function(e,t){return e&&e.length?oa(e,io(t,2)):[]},Fr.split=function(t,r,n){return n&&"number"!=typeof n&&bo(t,r,n)&&(r=n=e),(n=n===e?f:n>>>0)?(t=vs(t))&&("string"==typeof r||null!=r&&!is(r))&&!(r=sa(r))&&ar(t)?va(ur(t),0,n):t.split(r,n):[]},Fr.spread=function(e,r){if("function"!=typeof e)throw new Ne(t);return r=null==r?0:hr(hs(r),0),Jn(function(t){var n=t[r],a=va(t,0,r);return n&&$t(a,n),kt(e,this,a)})},Fr.tail=function(e){var t=null==e?0:e.length;return t?ta(e,1,t):[]},Fr.take=function(t,r,n){return t&&t.length?ta(t,0,(r=n||r===e?1:hs(r))<0?0:r):[]},Fr.takeRight=function(t,r,n){var a=null==t?0:t.length;return a?ta(t,(r=a-(r=n||r===e?1:hs(r)))<0?0:r,a):[]},Fr.takeRightWhile=function(e,t){return e&&e.length?fa(e,io(t,3),!1,!0):[]},Fr.takeWhile=function(e,t){return e&&e.length?fa(e,io(t,3)):[]},Fr.tap=function(e,t){return t(e),e},Fr.throttle=function(e,r,n){var a=!0,o=!0;if("function"!=typeof e)throw new Ne(t);return ts(n)&&(a="leading"in n?!!n.leading:a,o="trailing"in n?!!n.trailing:o),Ti(e,r,{leading:a,maxWait:r,trailing:o})},Fr.thru=mi,Fr.toArray=ps,Fr.toPairs=Ps,Fr.toPairsIn=Is,Fr.toPath=function(e){return Wi(e)?Tt(e,Lo):cs(e)?[e]:Ca(Fo(vs(e)))},Fr.toPlainObject=bs,Fr.transform=function(e,t,r){var n=Wi(e),a=n||Gi(e)||us(e);if(t=io(t,4),null==r){var o=e&&e.constructor;r=a?n?new o:[]:ts(e)&&Qi(o)?Lr(We(e)):{}}return(a?Rt:bn)(e,function(e,n,a){return t(r,e,n,a)}),r},Fr.unary=function(e){return Ni(e,1)},Fr.union=ri,Fr.unionBy=ni,Fr.unionWith=ai,Fr.uniq=function(e){return e&&e.length?la(e):[]},Fr.uniqBy=function(e,t){return e&&e.length?la(e,io(t,2)):[]},Fr.uniqWith=function(t,r){return r="function"==typeof r?r:e,t&&t.length?la(t,e,r):[]},Fr.unset=function(e,t){return null==e||ca(e,t)},Fr.unzip=oi,Fr.unzipWith=ii,Fr.update=function(e,t,r){return null==e?e:ua(e,t,ga(r))},Fr.updateWith=function(t,r,n,a){return a="function"==typeof a?a:e,null==t?t:ua(t,r,ga(n),a)},Fr.values=Us,Fr.valuesIn=function(e){return null==e?[]:Zt(e,$s(e))},Fr.without=si,Fr.words=Qs,Fr.wrap=function(e,t){return Li(ga(t),e)},Fr.xor=li,Fr.xorBy=ci,Fr.xorWith=ui,Fr.zip=fi,Fr.zipObject=function(e,t){return ma(e||[],t||[],Qr)},Fr.zipObjectDeep=function(e,t){return ma(e||[],t||[],Zn)},Fr.zipWith=di,Fr.entries=Ps,Fr.entriesIn=Is,Fr.extend=ws,Fr.extendWith=_s,ll(Fr,Fr),Fr.add=vl,Fr.attempt=Xs,Fr.camelCase=Bs,Fr.capitalize=Ys,Fr.ceil=xl,Fr.clamp=function(t,r,n){return n===e&&(n=r,r=e),n!==e&&(n=(n=ys(n))==n?n:0),r!==e&&(r=(r=ys(r))==r?r:0),an(ys(t),r,n)},Fr.clone=function(e){return on(e,4)},Fr.cloneDeep=function(e){return on(e,5)},Fr.cloneDeepWith=function(t,r){return on(t,5,r="function"==typeof r?r:e)},Fr.cloneWith=function(t,r){return on(t,4,r="function"==typeof r?r:e)},Fr.conformsTo=function(e,t){return null==t||sn(e,t,Ts(t))},Fr.deburr=Hs,Fr.defaultTo=function(e,t){return null==e||e!=e?t:e},Fr.divide=wl,Fr.endsWith=function(t,r,n){t=vs(t),r=sa(r);var a=t.length,o=n=n===e?a:an(hs(n),0,a);return(n-=r.length)>=0&&t.slice(n,o)==r},Fr.eq=Ui,Fr.escape=function(e){return(e=vs(e))&&J.test(e)?e.replace(q,rr):e},Fr.escapeRegExp=function(e){return(e=vs(e))&&re.test(e)?e.replace(te,"\\$&"):e},Fr.every=function(t,r,n){var a=Wi(t)?Nt:dn;return n&&bo(t,r,n)&&(r=e),a(t,io(r,3))},Fr.find=yi,Fr.findIndex=Ho,Fr.findKey=function(e,t){return Lt(e,io(t,3),bn)},Fr.findLast=bi,Fr.findLastIndex=Wo,Fr.findLastKey=function(e,t){return Lt(e,io(t,3),vn)},Fr.floor=_l,Fr.forEach=vi,Fr.forEachRight=xi,Fr.forIn=function(e,t){return null==e?e:gn(e,io(t,3),$s)},Fr.forInRight=function(e,t){return null==e?e:yn(e,io(t,3),$s)},Fr.forOwn=function(e,t){return e&&bn(e,io(t,3))},Fr.forOwnRight=function(e,t){return e&&vn(e,io(t,3))},Fr.get=Cs,Fr.gt=Bi,Fr.gte=Yi,Fr.has=function(e,t){return null!=e&&mo(e,t,Sn)},Fr.hasIn=Ns,Fr.head=Vo,Fr.identity=al,Fr.includes=function(e,t,r,n){e=Vi(e)?e:Us(e),r=r&&!n?hs(r):0;var a=e.length;return r<0&&(r=hr(a+r,0)),ls(e)?r<=a&&e.indexOf(t,r)>-1:!!a&&It(e,t,r)>-1},Fr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var a=null==r?0:hs(r);return a<0&&(a=hr(n+a,0)),It(e,t,a)},Fr.inRange=function(t,r,n){return r=ms(r),n===e?(n=r,r=0):n=ms(n),function(e,t,r){return e>=gr(t,r)&&e<hr(t,r)}(t=ys(t),r,n)},Fr.invoke=js,Fr.isArguments=Hi,Fr.isArray=Wi,Fr.isArrayBuffer=qi,Fr.isArrayLike=Vi,Fr.isArrayLikeObject=Ji,Fr.isBoolean=function(e){return!0===e||!1===e||rs(e)&&En(e)==h},Fr.isBuffer=Gi,Fr.isDate=Ki,Fr.isElement=function(e){return rs(e)&&1===e.nodeType&&!os(e)},Fr.isEmpty=function(e){if(null==e)return!0;if(Vi(e)&&(Wi(e)||"string"==typeof e||"function"==typeof e.splice||Gi(e)||us(e)||Hi(e)))return!e.length;var t=po(e);if(t==x||t==C)return!e.size;if(_o(e))return!An(e).length;for(var r in e)if(Ae.call(e,r))return!1;return!0},Fr.isEqual=function(e,t){return Mn(e,t)},Fr.isEqualWith=function(t,r,n){var a=(n="function"==typeof n?n:e)?n(t,r):e;return a===e?Mn(t,r,e,n):!!a},Fr.isError=Zi,Fr.isFinite=function(e){return"number"==typeof e&&Ft(e)},Fr.isFunction=Qi,Fr.isInteger=Xi,Fr.isLength=es,Fr.isMap=ns,Fr.isMatch=function(e,t){return e===t||jn(e,t,lo(t))},Fr.isMatchWith=function(t,r,n){return n="function"==typeof n?n:e,jn(t,r,lo(r),n)},Fr.isNaN=function(e){return as(e)&&e!=+e},Fr.isNative=function(e){if(wo(e))throw new _e("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tn(e)},Fr.isNil=function(e){return null==e},Fr.isNull=function(e){return null===e},Fr.isNumber=as,Fr.isObject=ts,Fr.isObjectLike=rs,Fr.isPlainObject=os,Fr.isRegExp=is,Fr.isSafeInteger=function(e){return Xi(e)&&e>=-9007199254740991&&e<=c},Fr.isSet=ss,Fr.isString=ls,Fr.isSymbol=cs,Fr.isTypedArray=us,Fr.isUndefined=function(t){return t===e},Fr.isWeakMap=function(e){return rs(e)&&po(e)==M},Fr.isWeakSet=function(e){return rs(e)&&"[object WeakSet]"==En(e)},Fr.join=function(e,t){return null==e?"":Wt.call(e,t)},Fr.kebabCase=Ws,Fr.last=Zo,Fr.lastIndexOf=function(t,r,n){var a=null==t?0:t.length;if(!a)return-1;var o=a;return n!==e&&(o=(o=hs(n))<0?hr(a+o,0):gr(o,a-1)),r==r?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(t,r,o):Pt(t,Bt,o,!0)},Fr.lowerCase=qs,Fr.lowerFirst=Vs,Fr.lt=fs,Fr.lte=ds,Fr.max=function(t){return t&&t.length?pn(t,al,kn):e},Fr.maxBy=function(t,r){return t&&t.length?pn(t,io(r,2),kn):e},Fr.mean=function(e){return Yt(e,al)},Fr.meanBy=function(e,t){return Yt(e,io(t,2))},Fr.min=function(t){return t&&t.length?pn(t,al,zn):e},Fr.minBy=function(t,r){return t&&t.length?pn(t,io(r,2),zn):e},Fr.stubArray=gl,Fr.stubFalse=yl,Fr.stubObject=function(){return{}},Fr.stubString=function(){return""},Fr.stubTrue=function(){return!0},Fr.multiply=El,Fr.nth=function(t,r){return t&&t.length?Un(t,hs(r)):e},Fr.noConflict=function(){return dt._===this&&(dt._=Pe),this},Fr.noop=cl,Fr.now=Ci,Fr.pad=function(e,t,r){e=vs(e);var n=(t=hs(t))?cr(e):0;if(!t||n>=t)return e;var a=(t-n)/2;return Ba(mt(a),r)+e+Ba(pt(a),r)},Fr.padEnd=function(e,t,r){e=vs(e);var n=(t=hs(t))?cr(e):0;return t&&n<t?e+Ba(t-n,r):e},Fr.padStart=function(e,t,r){e=vs(e);var n=(t=hs(t))?cr(e):0;return t&&n<t?Ba(t-n,r)+e:e},Fr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),br(vs(e).replace(ne,""),t||0)},Fr.random=function(t,r,n){if(n&&"boolean"!=typeof n&&bo(t,r,n)&&(r=n=e),n===e&&("boolean"==typeof r?(n=r,r=e):"boolean"==typeof t&&(n=t,t=e)),t===e&&r===e?(t=0,r=1):(t=ms(t),r===e?(r=t,t=0):r=ms(r)),t>r){var a=t;t=r,r=a}if(n||t%1||r%1){var o=vr();return gr(t+o*(r-t+lt("1e-"+((o+"").length-1))),r)}return qn(t,r)},Fr.reduce=function(e,t,r){var n=Wi(e)?At:qt,a=arguments.length<3;return n(e,io(t,4),r,a,un)},Fr.reduceRight=function(e,t,r){var n=Wi(e)?Dt:qt,a=arguments.length<3;return n(e,io(t,4),r,a,fn)},Fr.repeat=function(t,r,n){return r=(n?bo(t,r,n):r===e)?1:hs(r),Vn(vs(t),r)},Fr.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Fr.result=function(t,r,n){var a=-1,o=(r=ya(r,t)).length;for(o||(o=1,t=e);++a<o;){var i=null==t?e:t[Lo(r[a])];i===e&&(a=o,i=n),t=Qi(i)?i.call(t):i}return t},Fr.round=kl,Fr.runInContext=a,Fr.sample=function(e){return(Wi(e)?Jr:Gn)(e)},Fr.size=function(e){if(null==e)return 0;if(Vi(e))return ls(e)?cr(e):e.length;var t=po(e);return t==x||t==C?e.size:An(e).length},Fr.snakeCase=Js,Fr.some=function(t,r,n){var a=Wi(t)?zt:ra;return n&&bo(t,r,n)&&(r=e),a(t,io(r,3))},Fr.sortedIndex=function(e,t){return na(e,t)},Fr.sortedIndexBy=function(e,t,r){return aa(e,t,io(r,2))},Fr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=na(e,t);if(n<r&&Ui(e[n],t))return n}return-1},Fr.sortedLastIndex=function(e,t){return na(e,t,!0)},Fr.sortedLastIndexBy=function(e,t,r){return aa(e,t,io(r,2),!0)},Fr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=na(e,t,!0)-1;if(Ui(e[r],t))return r}return-1},Fr.startCase=Gs,Fr.startsWith=function(e,t,r){return e=vs(e),r=null==r?0:an(hs(r),0,e.length),t=sa(t),e.slice(r,r+t.length)==t},Fr.subtract=Sl,Fr.sum=function(e){return e&&e.length?Vt(e,al):0},Fr.sumBy=function(e,t){return e&&e.length?Vt(e,io(t,2)):0},Fr.template=function(t,r,n){var a=Fr.templateSettings;n&&bo(t,r,n)&&(r=e),t=vs(t),r=_s({},r,a,Ka);var o,i,s=_s({},r.imports,a.imports,Ka),l=Ts(s),c=Zt(s,l),u=0,f=r.interpolate||ve,d="__p += '",p=Re((r.escape||ve).source+"|"+f.source+"|"+(f===Z?fe:ve).source+"|"+(r.evaluate||ve).source+"|$","g"),m="//# sourceURL="+(Ae.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++at+"]")+"\n";t.replace(p,function(e,r,n,a,s,l){return n||(n=a),d+=t.slice(u,l).replace(xe,nr),r&&(o=!0,d+="' +\n__e("+r+") +\n'"),s&&(i=!0,d+="';\n"+s+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),d+="';\n";var h=Ae.call(r,"variable")&&r.variable;if(h){if(ce.test(h))throw new _e("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(i?d.replace(B,""):d).replace(Y,"$1").replace(H,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Xs(function(){return Ee(l,m+"return "+d).apply(e,c)});if(g.source=d,Zi(g))throw g;return g},Fr.times=function(e,t){if((e=hs(e))<1||e>c)return[];var r=f,n=gr(e,f);t=io(t),e-=f;for(var a=Jt(n,t);++r<e;)t(r);return a},Fr.toFinite=ms,Fr.toInteger=hs,Fr.toLength=gs,Fr.toLower=function(e){return vs(e).toLowerCase()},Fr.toNumber=ys,Fr.toSafeInteger=function(e){return e?an(hs(e),-9007199254740991,c):0===e?e:0},Fr.toString=vs,Fr.toUpper=function(e){return vs(e).toUpperCase()},Fr.trim=function(t,r,n){if((t=vs(t))&&(n||r===e))return Gt(t);if(!t||!(r=sa(r)))return t;var a=ur(t),o=ur(r);return va(a,Xt(a,o),er(a,o)+1).join("")},Fr.trimEnd=function(t,r,n){if((t=vs(t))&&(n||r===e))return t.slice(0,fr(t)+1);if(!t||!(r=sa(r)))return t;var a=ur(t);return va(a,0,er(a,ur(r))+1).join("")},Fr.trimStart=function(t,r,n){if((t=vs(t))&&(n||r===e))return t.replace(ne,"");if(!t||!(r=sa(r)))return t;var a=ur(t);return va(a,Xt(a,ur(r))).join("")},Fr.truncate=function(t,r){var n=30,a="...";if(ts(r)){var o="separator"in r?r.separator:o;n="length"in r?hs(r.length):n,a="omission"in r?sa(r.omission):a}var i=(t=vs(t)).length;if(ar(t)){var s=ur(t);i=s.length}if(n>=i)return t;var l=n-cr(a);if(l<1)return a;var c=s?va(s,0,l).join(""):t.slice(0,l);if(o===e)return c+a;if(s&&(l+=c.length-l),is(o)){if(t.slice(l).search(o)){var u,f=c;for(o.global||(o=Re(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(f);)var d=u.index;c=c.slice(0,d===e?l:d)}}else if(t.indexOf(sa(o),l)!=l){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+a},Fr.unescape=function(e){return(e=vs(e))&&V.test(e)?e.replace(W,dr):e},Fr.uniqueId=function(e){var t=++De;return vs(e)+t},Fr.upperCase=Ks,Fr.upperFirst=Zs,Fr.each=vi,Fr.eachRight=xi,Fr.first=Vo,ll(Fr,(bl={},bn(Fr,function(e,t){Ae.call(Fr.prototype,t)||(bl[t]=e)}),bl),{chain:!1}),Fr.VERSION="4.17.23",Rt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Fr[e].placeholder=Fr}),Rt(["drop","take"],function(t,r){Ur.prototype[t]=function(n){n=n===e?1:hr(hs(n),0);var a=this.__filtered__&&!r?new Ur(this):this.clone();return a.__filtered__?a.__takeCount__=gr(n,a.__takeCount__):a.__views__.push({size:gr(n,f),type:t+(a.__dir__<0?"Right":"")}),a},Ur.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Rt(["filter","map","takeWhile"],function(e,t){var r=t+1,n=1==r||3==r;Ur.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:io(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),Rt(["head","last"],function(e,t){var r="take"+(t?"Right":"");Ur.prototype[e]=function(){return this[r](1).value()[0]}}),Rt(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Ur.prototype[e]=function(){return this.__filtered__?new Ur(this):this[r](1)}}),Ur.prototype.compact=function(){return this.filter(al)},Ur.prototype.find=function(e){return this.filter(e).head()},Ur.prototype.findLast=function(e){return this.reverse().find(e)},Ur.prototype.invokeMap=Jn(function(e,t){return"function"==typeof e?new Ur(this):this.map(function(r){return Nn(r,e,t)})}),Ur.prototype.reject=function(e){return this.filter(zi(io(e)))},Ur.prototype.slice=function(t,r){t=hs(t);var n=this;return n.__filtered__&&(t>0||r<0)?new Ur(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),r!==e&&(n=(r=hs(r))<0?n.dropRight(-r):n.take(r-t)),n)},Ur.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Ur.prototype.toArray=function(){return this.take(f)},bn(Ur.prototype,function(t,r){var n=/^(?:filter|find|map|reject)|While$/.test(r),a=/^(?:head|last)$/.test(r),o=Fr[a?"take"+("last"==r?"Right":""):r],i=a||/^find/.test(r);o&&(Fr.prototype[r]=function(){var r=this.__wrapped__,s=a?[1]:arguments,l=r instanceof Ur,c=s[0],u=l||Wi(r),f=function(e){var t=o.apply(Fr,$t([e],s));return a&&d?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,p=!!this.__actions__.length,m=i&&!d,h=l&&!p;if(!i&&u){r=h?r:new Ur(this);var g=t.apply(r,s);return g.__actions__.push({func:mi,args:[f],thisArg:e}),new Ir(g,d)}return m&&h?t.apply(this,s):(g=this.thru(f),m?a?g.value()[0]:g.value():g)})}),Rt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Oe[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Fr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var a=this.value();return t.apply(Wi(a)?a:[],e)}return this[r](function(r){return t.apply(Wi(r)?r:[],e)})}}),bn(Ur.prototype,function(e,t){var r=Fr[t];if(r){var n=r.name+"";Ae.call(Nr,n)||(Nr[n]=[]),Nr[n].push({name:t,func:r})}}),Nr[La(e,2).name]=[{name:"wrapper",func:e}],Ur.prototype.clone=function(){var e=new Ur(this.__wrapped__);return e.__actions__=Ca(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ca(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ca(this.__views__),e},Ur.prototype.reverse=function(){if(this.__filtered__){var e=new Ur(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Ur.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Wi(e),n=t<0,a=r?e.length:0,o=function(e,t,r){for(var n=-1,a=r.length;++n<a;){var o=r[n],i=o.size;switch(o.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=gr(t,e+i);break;case"takeRight":e=hr(e,t-i)}}return{start:e,end:t}}(0,a,this.__views__),i=o.start,s=o.end,l=s-i,c=n?s:i-1,u=this.__iteratees__,f=u.length,d=0,p=gr(l,this.__takeCount__);if(!r||!n&&a==l&&p==l)return da(e,this.__actions__);var m=[];e:for(;l--&&d<p;){for(var h=-1,g=e[c+=t];++h<f;){var y=u[h],b=y.iteratee,v=y.type,x=b(g);if(2==v)g=x;else if(!x){if(1==v)continue e;break e}}m[d++]=g}return m},Fr.prototype.at=hi,Fr.prototype.chain=function(){return pi(this)},Fr.prototype.commit=function(){return new Ir(this.value(),this.__chain__)},Fr.prototype.next=function(){this.__values__===e&&(this.__values__=ps(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},Fr.prototype.plant=function(t){for(var r,n=this;n instanceof Pr;){var a=Io(n);a.__index__=0,a.__values__=e,r?o.__wrapped__=a:r=a;var o=a;n=n.__wrapped__}return o.__wrapped__=t,r},Fr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Ur){var r=t;return this.__actions__.length&&(r=new Ur(this)),(r=r.reverse()).__actions__.push({func:mi,args:[ti],thisArg:e}),new Ir(r,this.__chain__)}return this.thru(ti)},Fr.prototype.toJSON=Fr.prototype.valueOf=Fr.prototype.value=function(){return da(this.__wrapped__,this.__actions__)},Fr.prototype.first=Fr.prototype.head,Ke&&(Fr.prototype[Ke]=function(){return this}),Fr}();mt?((mt.exports=pr)._=pr,pt._=pr):dt._=pr}.call(k.exports));const R=(...e)=>e.filter((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),C=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)};var N={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const O=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},M=e.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:i,iconNode:s,...l},c)=>e.createElement("svg",{ref:c,...N,width:r,height:r,stroke:t,strokeWidth:a?24*Number(n)/Number(r):n,className:R("lucide",o),...!i&&!O(l)&&{"aria-hidden":"true"},...l},[...s.map(([t,r])=>e.createElement(t,r)),...Array.isArray(i)?i:[i]])),j=(t,r)=>{const n=e.forwardRef(({className:n,...a},o)=>{return e.createElement(M,{ref:o,iconNode:r,className:R(`lucide-${i=C(t),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,n),...a});var i});return n.displayName=C(t),n},T=j("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),$=j("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),A=j("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),D=j("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),z=j("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),F=j("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),L=j("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),P=j("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),I=j("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]),U=j("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),B=j("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),Y=j("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function H(e){if(Array.isArray(e))return e;if("string"==typeof e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}return[]}function W(e,t,r,n,a,o){const i=e=>{for(const t of r){if(t.name===e)return t;if(t.children){const r=t.children.find(t=>t.name===e);if(r)return r}}};return{getFieldValue(t){const r=i(t),n=e[t];return"table"===r?.type?H(n):n??""},setFieldValue(e,r){Array.isArray(r)?t(e,JSON.stringify(r)):t(e,null==r?"":String(r))},setFieldVisible(e,t){const r=i(e);r&&n&&n(r._id,{hidden:!t})},setFieldRequired(e,t){const r=i(e);r&&n&&n(r._id,{required:t})},setFieldReadonly(e,t){const r=i(e);r&&n&&n(r._id,{readonly:t})},getFieldOptions(e){const t=i(e);return t?.options||[]},setFieldOptions(e,t){const r=i(e);r&&n&&n(r._id,{options:t})},getTableRows:t=>H(e[t]),setTableRows(e,r){t(e,JSON.stringify(Array.isArray(r)?r:[]))},addTableRow(r,n={}){const a=H(e[r]);a.push(n),t(r,JSON.stringify(a))},removeTableRow(r,n){const a=H(e[r]);n>=0&&n<a.length&&(a.splice(n,1),t(r,JSON.stringify(a)))},message:{success:e=>a?.success(e),error:e=>a?.error(e),warning:e=>a?.warning(e),info:e=>a?.info(e),loading:e=>a?.loading(e)},context:o||{}}}async function q(e,t){if(!e||!e.trim())return;let r;if(t.values&&t.form){if(r={...t.values},t.fields)r=function(e,t){const r={...e};for(const n of t)"table"===n.type&&(r[n.name]=H(r[n.name]));return r}(t.values,t.fields);else for(const[o,i]of Object.entries(r))if("string"==typeof i&&i.startsWith("["))try{const e=JSON.parse(i);Array.isArray(e)&&(r[o]=e)}catch{}}else r=t.values;let n=t.value;"table"===t.field?.type&&"string"==typeof t.value&&(n=H(t.value));try{const a=new Function("form","field","value","oldValue","values","fields","fetch",`return (async () => { ${e} })();`);return await a(t.form,t.field,n,t.oldValue,r,t.fields,fetch.bind(window))}catch(a){throw console.error("[fieldDataService] executeFormEvent error:",a),a}}function V(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=V(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}const J=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),G="-",K=[],Z=e=>{const t=ee(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return X(e);const r=e.split(G),n=""===r[0]&&r.length>1?1:0;return Q(r,n,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],a=r[e];return t?a?((e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(a,t):t:a||K}return r[e]||K}}},Q=(e,t,r)=>{if(0===e.length-t)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const r=Q(e,t+1,a);if(r)return r}const o=r.validators;if(null===o)return;const i=0===t?e.join(G):e.slice(t).join(G),s=o.length;for(let l=0;l<s;l++){const e=o[l];if(e.validator(i))return e.classGroupId}},X=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),ee=e=>{const{theme:t,classGroups:r}=e;return te(r,t)},te=(e,t)=>{const r=J();for(const n in e){const a=e[n];re(a,r,n,t)}return r},re=(e,t,r,n)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];ne(a,t,r,n)}},ne=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?ie(e,t,r,n):oe(e,t,r,n):ae(e,t,r)},ae=(e,t,r)=>{(""===e?t:se(t,e)).classGroupId=r},oe=(e,t,r,n)=>{le(e)?re(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},ie=(e,t,r,n)=>{const a=Object.entries(e),o=a.length;for(let i=0;i<o;i++){const[e,o]=a[i];re(o,se(t,e),r,n)}},se=(e,t)=>{let r=e;const n=t.split(G),a=n.length;for(let o=0;o<a;o++){const e=n[o];let t=r.nextPart.get(e);t||(t=J(),r.nextPart.set(e,t)),r=t}return r},le=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,ce=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(a,o)=>{r[a]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}},ue=[],fe=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),de=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,a=0,o=0;const i=e.length;for(let u=0;u<i;u++){const i=e[u];if(0===n&&0===a){if(":"===i){t.push(e.slice(o,u)),o=u+1;continue}if("/"===i){r=u;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}const s=0===t.length?e:e.slice(o);let l=s,c=!1;s.endsWith("!")?(l=s.slice(0,-1),c=!0):s.startsWith("!")&&(l=s.slice(1),c=!0);return fe(t,c,l,r&&r>o?r-o:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):fe(ue,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},pe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let a=0;a<e.length;a++){const o=e[a],i="["===o[0],s=t.has(o);i||s?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(o)):n.push(o)}return n.length>0&&(n.sort(),r.push(...n)),r}},me=/\s+/,he=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=he(e[n]))&&(r&&(r+=" "),r+=t);return r},ge=[],ye=e=>{const t=t=>t[e]||ge;return t.isThemeGetter=!0,t},be=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ve=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xe=/^\d+\/\d+$/,we=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_e=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ke=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Se=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Re=e=>xe.test(e),Ce=e=>!!e&&!Number.isNaN(Number(e)),Ne=e=>!!e&&Number.isInteger(Number(e)),Oe=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),Me=e=>we.test(e),je=()=>!0,Te=e=>_e.test(e)&&!Ee.test(e),$e=()=>!1,Ae=e=>ke.test(e),De=e=>Se.test(e),ze=e=>!Le(e)&&!He(e),Fe=e=>Ze(e,tt,$e),Le=e=>be.test(e),Pe=e=>Ze(e,rt,Te),Ie=e=>Ze(e,nt,Ce),Ue=e=>Ze(e,Xe,$e),Be=e=>Ze(e,et,De),Ye=e=>Ze(e,ot,Ae),He=e=>ve.test(e),We=e=>Qe(e,rt),qe=e=>Qe(e,at),Ve=e=>Qe(e,Xe),Je=e=>Qe(e,tt),Ge=e=>Qe(e,et),Ke=e=>Qe(e,ot,!0),Ze=(e,t,r)=>{const n=be.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},Qe=(e,t,r=!1)=>{const n=ve.exec(e);return!!n&&(n[1]?t(n[1]):r)},Xe=e=>"position"===e||"percentage"===e,et=e=>"image"===e||"url"===e,tt=e=>"length"===e||"size"===e||"bg-size"===e,rt=e=>"length"===e,nt=e=>"number"===e,at=e=>"family-name"===e,ot=e=>"shadow"===e,it=((e,...t)=>{let r,n,a,o;const i=e=>{const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:o}=t,i=[],s=e.trim().split(me);let l="";for(let c=s.length-1;c>=0;c-=1){const e=s[c],{isExternal:t,modifiers:u,hasImportantModifier:f,baseClassName:d,maybePostfixModifierPosition:p}=r(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m=!!p,h=n(m?d.substring(0,p):d);if(!h){if(!m){l=e+(l.length>0?" "+l:l);continue}if(h=n(d),!h){l=e+(l.length>0?" "+l:l);continue}m=!1}const g=0===u.length?"":1===u.length?u[0]:o(u).join(":"),y=f?g+"!":g,b=y+h;if(i.indexOf(b)>-1)continue;i.push(b);const v=a(h,m);for(let r=0;r<v.length;++r){const e=v[r];i.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,r);return a(e,o),o};return o=s=>{const l=t.reduce((e,t)=>t(e),e());return r=(e=>({cache:ce(e.cacheSize),parseClassName:de(e),sortModifiers:pe(e),...Z(e)}))(l),n=r.cache.get,a=r.cache.set,o=i,i(s)},(...e)=>o(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=he(t))&&(a&&(a+=" "),a+=r);return a})(...e))})(()=>{const e=ye("color"),t=ye("font"),r=ye("text"),n=ye("font-weight"),a=ye("tracking"),o=ye("leading"),i=ye("breakpoint"),s=ye("container"),l=ye("spacing"),c=ye("radius"),u=ye("shadow"),f=ye("inset-shadow"),d=ye("text-shadow"),p=ye("drop-shadow"),m=ye("blur"),h=ye("perspective"),g=ye("aspect"),y=ye("ease"),b=ye("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",He,Le],x=()=>[He,Le,l],w=()=>[Re,"full","auto",...x()],_=()=>[Ne,"none","subgrid",He,Le],E=()=>["auto",{span:["full",Ne,He,Le]},Ne,He,Le],k=()=>[Ne,"auto",He,Le],S=()=>["auto","min","max","fr",He,Le],R=()=>["auto",...x()],C=()=>[Re,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],N=()=>[e,He,Le],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ve,Ue,{position:[He,Le]}],M=()=>["auto","cover","contain",Je,Fe,{size:[He,Le]}],j=()=>[Oe,We,Pe],T=()=>["","none","full",c,He,Le],$=()=>["",Ce,We,Pe],A=()=>[Ce,Oe,Ve,Ue],D=()=>["","none",m,He,Le],z=()=>["none",Ce,He,Le],F=()=>["none",Ce,He,Le],L=()=>[Ce,He,Le],P=()=>[Re,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Me],breakpoint:[Me],color:[je],container:[Me],"drop-shadow":[Me],ease:["in","out","in-out"],font:[ze],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Me],shadow:[Me],spacing:["px",Ce],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Re,Le,He,g]}],container:["container"],columns:[{columns:[Ce,Le,He,s]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[Ne,"auto",He,Le]}],basis:[{basis:[Re,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,Re,"auto","initial","none",Le]}],grow:[{grow:["",Ce,He,Le]}],shrink:[{shrink:["",Ce,He,Le]}],order:[{order:[Ne,"first","last","none",He,Le]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":S()}],"auto-rows":[{"auto-rows":S()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[s,"screen",...C()]}],"min-w":[{"min-w":[s,"screen","none",...C()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[i]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",r,We,Pe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,He,Ie]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Oe,Le]}],"font-family":[{font:[qe,Le,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,He,Le]}],"line-clamp":[{"line-clamp":[Ce,"none",He,Ie]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",He,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",He,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",He,Pe]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Ce,"auto",He,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",He,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",He,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:O()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ne,He,Le],radial:["",He,Le],conic:[Ne,He,Le]},Ge,Be]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,He,Le]}],"outline-w":[{outline:["",Ce,We,Pe]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",u,Ke,Ye]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",f,Ke,Ye]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Ce,Pe]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",d,Ke,Ye]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Ce,He,Le]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":A()}],"mask-image-linear-to-pos":[{"mask-linear-to":A()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":A()}],"mask-image-t-to-pos":[{"mask-t-to":A()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":A()}],"mask-image-r-to-pos":[{"mask-r-to":A()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":A()}],"mask-image-b-to-pos":[{"mask-b-to":A()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":A()}],"mask-image-l-to-pos":[{"mask-l-to":A()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":A()}],"mask-image-x-to-pos":[{"mask-x-to":A()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":A()}],"mask-image-y-to-pos":[{"mask-y-to":A()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[He,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":A()}],"mask-image-radial-to-pos":[{"mask-radial-to":A()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":A()}],"mask-image-conic-to-pos":[{"mask-conic-to":A()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:O()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",He,Le]}],filter:[{filter:["","none",He,Le]}],blur:[{blur:D()}],brightness:[{brightness:[Ce,He,Le]}],contrast:[{contrast:[Ce,He,Le]}],"drop-shadow":[{"drop-shadow":["","none",p,Ke,Ye]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",Ce,He,Le]}],"hue-rotate":[{"hue-rotate":[Ce,He,Le]}],invert:[{invert:["",Ce,He,Le]}],saturate:[{saturate:[Ce,He,Le]}],sepia:[{sepia:["",Ce,He,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",He,Le]}],"backdrop-blur":[{"backdrop-blur":D()}],"backdrop-brightness":[{"backdrop-brightness":[Ce,He,Le]}],"backdrop-contrast":[{"backdrop-contrast":[Ce,He,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ce,He,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ce,He,Le]}],"backdrop-invert":[{"backdrop-invert":["",Ce,He,Le]}],"backdrop-opacity":[{"backdrop-opacity":[Ce,He,Le]}],"backdrop-saturate":[{"backdrop-saturate":[Ce,He,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",Ce,He,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",He,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ce,"initial",He,Le]}],ease:[{ease:["linear","initial",y,He,Le]}],delay:[{delay:[Ce,He,Le]}],animate:[{animate:["none",b,He,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,He,Le]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:z()}],"rotate-x":[{"rotate-x":z()}],"rotate-y":[{"rotate-y":z()}],"rotate-z":[{"rotate-z":z()}],scale:[{scale:F()}],"scale-x":[{"scale-x":F()}],"scale-y":[{"scale-y":F()}],"scale-z":[{"scale-z":F()}],"scale-3d":["scale-3d"],skew:[{skew:L()}],"skew-x":[{"skew-x":L()}],"skew-y":[{"skew-y":L()}],transform:[{transform:[He,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:P()}],"translate-x":[{"translate-x":P()}],"translate-y":[{"translate-y":P()}],"translate-z":[{"translate-z":P()}],"translate-none":["translate-none"],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",He,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",He,Le]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[Ce,We,Pe,Ie]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function st(...e){return it(function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=V(e))&&(n&&(n+=" "),n+=t);return n}(e))}var lt,ct={},ut={exports:{}};function ft(){return lt||(lt=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(ut)),ut.exports}var dt,pt={};var mt,ht={},gt={},yt={},bt={exports:{}},vt={exports:{}},xt={exports:{}},wt={exports:{}};function _t(){return mt||(mt=1,function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(wt)),wt.exports}var Et,kt,St,Rt,Ct={exports:{}};function Nt(){return kt||(kt=1,function(e){var t=_t().default,r=(Et||(Et=1,function(e){var t=_t().default;e.exports=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,r||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(Ct)),Ct.exports);e.exports=function(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""},e.exports.__esModule=!0,e.exports.default=e.exports}(xt)),xt.exports}function Ot(){return Rt||(Rt=1,function(e){var t=(St||(St=1,function(e){var t=Nt();e.exports=function(e,r,n){return(r=t(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports}(vt)),vt.exports);function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}e.exports=function(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?r(Object(a),!0).forEach(function(r){t(e,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e},e.exports.__esModule=!0,e.exports.default=e.exports}(bt)),bt.exports}var Mt,jt,Tt={};function $t(){if(jt)return yt;jt=1;var e=ft().default;Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=void 0;var t=e(Ot()),r=(Mt||(Mt=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.commonLocale=void 0,Tt.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Tt),n=(0,t.default)((0,t.default)({},r.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return yt.default=n,yt}var At,Dt,zt,Ft,Lt,Pt,It={};function Ut(){if(At)return It;At=1,Object.defineProperty(It,"__esModule",{value:!0}),It.default=void 0;return It.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},It}function Bt(){if(Dt)return gt;Dt=1;var e=ft().default;Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=void 0;var t=e($t()),r=e(Ut());const n={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},r.default)};return n.lang.ok="确定",gt.default=n,gt}function Yt(){if(zt)return ht;zt=1;var e=ft().default;Object.defineProperty(ht,"__esModule",{value:!0}),ht.default=void 0;var t=e(Bt());return ht.default=t.default,ht}function Ht(){if(Ft)return ct;Ft=1;var e=ft().default;Object.defineProperty(ct,"__esModule",{value:!0}),ct.default=void 0;var t=e((dt||(dt=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.default=void 0,pt.default={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"}),pt)),r=e(Yt()),n=e(Bt()),a=e(Ut());const o="${label}不是一个有效的${type}",i={locale:"zh-cn",Pagination:t.default,DatePicker:n.default,TimePicker:a.default,Calendar:r.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:o,method:o,array:o,object:o,number:o,date:o,boolean:o,integer:o,float:o,regexp:o,email:o,url:o,hex:o},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return ct.default=i,ct}function Wt(){return Pt?Lt:(Pt=1,Lt=Ht())}const qt=o(Wt());function Vt({files:e,onRemove:t}){return 0===e.length?null:React.createElement("div",{className:"flex flex-wrap gap-1.5 mt-1.5"},e.map(e=>React.createElement("span",{key:e.id,className:"inline-flex items-center gap-1 text-[11px] bg-gray-100 text-gray-600 rounded px-2 py-0.5"},e.name,React.createElement(Y,{className:"w-3 h-3 cursor-pointer text-gray-400 hover:text-red-500",onClick:()=>t(e.id)}))))}function Jt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Gt}=Object.prototype,{getPrototypeOf:Kt}=Object,{iterator:Zt,toStringTag:Qt}=Symbol,Xt=(e=>t=>{const r=Gt.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),er=e=>(e=e.toLowerCase(),t=>Xt(t)===e),tr=e=>t=>typeof t===e,{isArray:rr}=Array,nr=tr("undefined");function ar(e){return null!==e&&!nr(e)&&null!==e.constructor&&!nr(e.constructor)&&sr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const or=er("ArrayBuffer");const ir=tr("string"),sr=tr("function"),lr=tr("number"),cr=e=>null!==e&&"object"==typeof e,ur=e=>{if("object"!==Xt(e))return!1;const t=Kt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Qt in e||Zt in e)},fr=er("Date"),dr=er("File"),pr=er("Blob"),mr=er("FileList"),hr=er("URLSearchParams"),[gr,yr,br,vr]=["ReadableStream","Request","Response","Headers"].map(er);function xr(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,a;if("object"!=typeof e&&(e=[e]),rr(e))for(n=0,a=e.length;n<a;n++)t.call(null,e[n],n,e);else{if(ar(e))return;const a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length;let i;for(n=0;n<o;n++)i=a[n],t.call(null,e[i],i,e)}}function wr(e,t){if(ar(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,a=r.length;for(;a-- >0;)if(n=r[a],t===n.toLowerCase())return n;return null}const _r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Er=e=>!nr(e)&&e!==_r;const kr=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Kt(Uint8Array)),Sr=er("HTMLFormElement"),Rr=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Cr=er("RegExp"),Nr=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};xr(r,(r,a)=>{let o;!1!==(o=t(r,a,e))&&(n[a]=o||r)}),Object.defineProperties(e,n)};const Or=er("AsyncFunction"),Mr=(jr="function"==typeof setImmediate,Tr=sr(_r.postMessage),jr?setImmediate:Tr?($r=`axios@${Math.random()}`,Ar=[],_r.addEventListener("message",({source:e,data:t})=>{e===_r&&t===$r&&Ar.length&&Ar.shift()()},!1),e=>{Ar.push(e),_r.postMessage($r,"*")}):e=>setTimeout(e));var jr,Tr,$r,Ar;const Dr="undefined"!=typeof queueMicrotask?queueMicrotask.bind(_r):"undefined"!=typeof process&&process.nextTick||Mr,zr={isArray:rr,isArrayBuffer:or,isBuffer:ar,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||sr(e.append)&&("formdata"===(t=Xt(e))||"object"===t&&sr(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&or(e.buffer),t},isString:ir,isNumber:lr,isBoolean:e=>!0===e||!1===e,isObject:cr,isPlainObject:ur,isEmptyObject:e=>{if(!cr(e)||ar(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:gr,isRequest:yr,isResponse:br,isHeaders:vr,isUndefined:nr,isDate:fr,isFile:dr,isBlob:pr,isRegExp:Cr,isFunction:sr,isStream:e=>cr(e)&&sr(e.pipe),isURLSearchParams:hr,isTypedArray:kr,isFileList:mr,forEach:xr,merge:function e(){const{caseless:t,skipUndefined:r}=Er(this)&&this||{},n={},a=(a,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&wr(n,o)||o;ur(n[i])&&ur(a)?n[i]=e(n[i],a):ur(a)?n[i]=e({},a):rr(a)?n[i]=a.slice():r&&nr(a)||(n[i]=a)};for(let o=0,i=arguments.length;o<i;o++)arguments[o]&&xr(arguments[o],a);return n},extend:(e,t,r,{allOwnKeys:n}={})=>(xr(t,(t,n)=>{r&&sr(t)?Object.defineProperty(e,n,{value:Jt(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let a,o,i;const s={};if(t=t||{},null==e)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)i=a[o],n&&!n(i,e,t)||s[i]||(t[i]=e[i],s[i]=!0);e=!1!==r&&Kt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Xt,kindOfTest:er,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(rr(e))return e;let t=e.length;if(!lr(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Zt]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Sr,hasOwnProperty:Rr,hasOwnProp:Rr,reduceDescriptors:Nr,freezeMethods:e=>{Nr(e,(t,r)=>{if(sr(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];sr(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach(e=>{r[e]=!0})};return rr(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,r){return t.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:wr,global:_r,isContextDefined:Er,isSpecCompliantForm:function(e){return!!(e&&sr(e.append)&&"FormData"===e[Qt]&&e[Zt])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(cr(e)){if(t.indexOf(e)>=0)return;if(ar(e))return e;if(!("toJSON"in e)){t[n]=e;const a=rr(e)?[]:{};return xr(e,(e,t)=>{const o=r(e,n+1);!nr(o)&&(a[t]=o)}),t[n]=void 0,a}}return e};return r(e,0)},isAsyncFn:Or,isThenable:e=>e&&(cr(e)||sr(e))&&sr(e.then)&&sr(e.catch),setImmediate:Mr,asap:Dr,isIterable:e=>null!=e&&sr(e[Zt])};let Fr=class e extends Error{static from(t,r,n,a,o,i){const s=new e(t.message,r||t.code,n,a,o);return s.cause=t,s.name=t.name,i&&Object.assign(s,i),s}constructor(e,t,r,n,a){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:zr.toJSONObject(this.config),code:this.code,status:this.status}}};Fr.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Fr.ERR_BAD_OPTION="ERR_BAD_OPTION",Fr.ECONNABORTED="ECONNABORTED",Fr.ETIMEDOUT="ETIMEDOUT",Fr.ERR_NETWORK="ERR_NETWORK",Fr.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Fr.ERR_DEPRECATED="ERR_DEPRECATED",Fr.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Fr.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Fr.ERR_CANCELED="ERR_CANCELED",Fr.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Fr.ERR_INVALID_URL="ERR_INVALID_URL";function Lr(e){return zr.isPlainObject(e)||zr.isArray(e)}function Pr(e){return zr.endsWith(e,"[]")?e.slice(0,-2):e}function Ir(e,t,r){return e?e.concat(t).map(function(e,t){return e=Pr(e),!r&&t?"["+e+"]":e}).join(r?".":""):t}const Ur=zr.toFlatObject(zr,{},null,function(e){return/^is[A-Z]/.test(e)});function Br(e,t,r){if(!zr.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=zr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!zr.isUndefined(t[e])})).metaTokens,a=r.visitor||c,o=r.dots,i=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&zr.isSpecCompliantForm(t);if(!zr.isFunction(a))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(zr.isDate(e))return e.toISOString();if(zr.isBoolean(e))return e.toString();if(!s&&zr.isBlob(e))throw new Fr("Blob is not supported. Use a Buffer instead.");return zr.isArrayBuffer(e)||zr.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,a){let s=e;if(e&&!a&&"object"==typeof e)if(zr.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(zr.isArray(e)&&function(e){return zr.isArray(e)&&!e.some(Lr)}(e)||(zr.isFileList(e)||zr.endsWith(r,"[]"))&&(s=zr.toArray(e)))return r=Pr(r),s.forEach(function(e,n){!zr.isUndefined(e)&&null!==e&&t.append(!0===i?Ir([r],n,o):null===i?r:r+"[]",l(e))}),!1;return!!Lr(e)||(t.append(Ir(a,r,o),l(e)),!1)}const u=[],f=Object.assign(Ur,{defaultVisitor:c,convertValue:l,isVisitable:Lr});if(!zr.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!zr.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),zr.forEach(r,function(r,o){!0===(!(zr.isUndefined(r)||null===r)&&a.call(t,r,zr.isString(o)?o.trim():o,n,f))&&e(r,n?n.concat(o):[o])}),u.pop()}}(e),t}function Yr(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Hr(e,t){this._pairs=[],e&&Br(e,this,t)}const Wr=Hr.prototype;function qr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vr(e,t,r){if(!t)return e;const n=r&&r.encode||qr,a=zr.isFunction(r)?{serialize:r}:r,o=a&&a.serialize;let i;if(i=o?o(t,a):zr.isURLSearchParams(t)?t.toString():new Hr(t,a).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Wr.append=function(e,t){this._pairs.push([e,t])},Wr.toString=function(e){const t=e?function(t){return e.call(this,t,Yr)}:Yr;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Jr{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){zr.forEach(this.handlers,function(t){null!==t&&e(t)})}}const Gr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Kr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Hr,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Zr="undefined"!=typeof window&&"undefined"!=typeof document,Qr="object"==typeof navigator&&navigator||void 0,Xr=Zr&&(!Qr||["ReactNative","NativeScript","NS"].indexOf(Qr.product)<0),en="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,tn=Zr&&window.location.href||"http://localhost",rn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Zr,hasStandardBrowserEnv:Xr,hasStandardBrowserWebWorkerEnv:en,navigator:Qr,origin:tn},Symbol.toStringTag,{value:"Module"})),...Kr};function nn(e){function t(e,r,n,a){let o=e[a++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),s=a>=e.length;if(o=!o&&zr.isArray(n)?n.length:o,s)return zr.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!i;n[o]&&zr.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],a)&&zr.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const a=r.length;let o;for(n=0;n<a;n++)o=r[n],t[o]=e[o];return t}(n[o])),!i}if(zr.isFormData(e)&&zr.isFunction(e.entries)){const r={};return zr.forEachEntry(e,(e,n)=>{t(function(e){return zr.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),n,r,0)}),r}return null}const an={transitional:Gr,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,a=zr.isObject(e);a&&zr.isHTMLForm(e)&&(e=new FormData(e));if(zr.isFormData(e))return n?JSON.stringify(nn(e)):e;if(zr.isArrayBuffer(e)||zr.isBuffer(e)||zr.isStream(e)||zr.isFile(e)||zr.isBlob(e)||zr.isReadableStream(e))return e;if(zr.isArrayBufferView(e))return e.buffer;if(zr.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Br(e,new rn.classes.URLSearchParams,{visitor:function(e,t,r,n){return rn.isNode&&zr.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=zr.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Br(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return a||n?(t.setContentType("application/json",!1),function(e,t,r){if(zr.isString(e))try{return(t||JSON.parse)(e),zr.trim(e)}catch(n){if("SyntaxError"!==n.name)throw n}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||an.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(zr.isResponse(e)||zr.isReadableStream(e))return e;if(e&&zr.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(a){if(r){if("SyntaxError"===a.name)throw Fr.from(a,Fr.ERR_BAD_RESPONSE,this,null,this.response);throw a}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:rn.classes.FormData,Blob:rn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};zr.forEach(["delete","get","head","post","put","patch"],e=>{an.headers[e]={}});const on=zr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sn=Symbol("internals");function ln(e){return e&&String(e).trim().toLowerCase()}function cn(e){return!1===e||null==e?e:zr.isArray(e)?e.map(cn):String(e)}function un(e,t,r,n,a){return zr.isFunction(n)?n.call(this,t,r):(a&&(t=r),zr.isString(t)?zr.isString(n)?-1!==t.indexOf(n):zr.isRegExp(n)?n.test(t):void 0:void 0)}let fn=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function a(e,t,r){const a=ln(t);if(!a)throw new Error("header name must be a non-empty string");const o=zr.findKey(n,a);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=cn(e))}const o=(e,t)=>zr.forEach(e,(e,r)=>a(e,r,t));if(zr.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(zr.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,a;return e&&e.split("\n").forEach(function(e){a=e.indexOf(":"),r=e.substring(0,a).trim().toLowerCase(),n=e.substring(a+1).trim(),!r||t[r]&&on[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t})(e),t);else if(zr.isObject(e)&&zr.isIterable(e)){let r,n,a={};for(const t of e){if(!zr.isArray(t))throw TypeError("Object iterator must return a key-value pair");a[n=t[0]]=(r=a[n])?zr.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(a,t)}else null!=e&&a(t,e,r);return this}get(e,t){if(e=ln(e)){const r=zr.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(zr.isFunction(t))return t.call(this,e,r);if(zr.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ln(e)){const r=zr.findKey(this,e);return!(!r||void 0===this[r]||t&&!un(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function a(e){if(e=ln(e)){const a=zr.findKey(r,e);!a||t&&!un(0,r[a],a,t)||(delete r[a],n=!0)}}return zr.isArray(e)?e.forEach(a):a(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const a=t[r];e&&!un(0,this[a],a,e,!0)||(delete this[a],n=!0)}return n}normalize(e){const t=this,r={};return zr.forEach(this,(n,a)=>{const o=zr.findKey(r,a);if(o)return t[o]=cn(n),void delete t[a];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}(a):String(a).trim();i!==a&&delete t[a],t[i]=cn(n),r[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return zr.forEach(this,(r,n)=>{null!=r&&!1!==r&&(t[n]=e&&zr.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(e=>r.set(e)),r}static accessor(e){const t=(this[sn]=this[sn]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ln(e);t[n]||(!function(e,t){const r=zr.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(e,r,a){return this[n].call(this,t,e,r,a)},configurable:!0})})}(r,e),t[n]=!0)}return zr.isArray(e)?e.forEach(n):n(e),this}};function dn(e,t){const r=this||an,n=t||r,a=fn.from(n.headers);let o=n.data;return zr.forEach(e,function(e){o=e.call(r,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function pn(e){return!(!e||!e.__CANCEL__)}fn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),zr.reduceDescriptors(fn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}}),zr.freezeMethods(fn);let mn=class extends Fr{constructor(e,t,r){super(null==e?"canceled":e,Fr.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function hn(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Fr("Request failed with status code "+r.status,[Fr.ERR_BAD_REQUEST,Fr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const gn=(e,t,r=3)=>{let n=0;const a=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let a,o=0,i=0;return t=void 0!==t?t:1e3,function(s){const l=Date.now(),c=n[i];a||(a=l),r[o]=s,n[o]=l;let u=i,f=0;for(;u!==o;)f+=r[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),l-a<t)return;const d=c&&l-c;return d?Math.round(1e3*f/d):void 0}}(50,250);return function(e,t){let r,n,a=0,o=1e3/t;const i=(t,o=Date.now())=>{a=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-a;s>=o?i(e,t):(r=e,n||(n=setTimeout(()=>{n=null,i(r)},o-s)))},()=>r&&i(r)]}(r=>{const o=r.loaded,i=r.lengthComputable?r.total:void 0,s=o-n,l=a(s);n=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:l||void 0,estimated:l&&i&&o<=i?(i-o)/l:void 0,event:r,lengthComputable:null!=i,[t?"download":"upload"]:!0})},r)},yn=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},bn=e=>(...t)=>zr.asap(()=>e(...t)),vn=rn.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,rn.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(rn.origin),rn.navigator&&/(msie|trident)/i.test(rn.navigator.userAgent)):()=>!0,xn=rn.hasStandardBrowserEnv?{write(e,t,r,n,a,o,i){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];zr.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),zr.isString(n)&&s.push(`path=${n}`),zr.isString(a)&&s.push(`domain=${a}`),!0===o&&s.push("secure"),zr.isString(i)&&s.push(`SameSite=${i}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function wn(e,t,r){let n=!("string"==typeof(a=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a));var a;return e&&(n||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const _n=e=>e instanceof fn?{...e}:e;function En(e,t){t=t||{};const r={};function n(e,t,r,n){return zr.isPlainObject(e)&&zr.isPlainObject(t)?zr.merge.call({caseless:n},e,t):zr.isPlainObject(t)?zr.merge({},t):zr.isArray(t)?t.slice():t}function a(e,t,r,a){return zr.isUndefined(t)?zr.isUndefined(e)?void 0:n(void 0,e,0,a):n(e,t,0,a)}function o(e,t){if(!zr.isUndefined(t))return n(void 0,t)}function i(e,t){return zr.isUndefined(t)?zr.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,a,o){return o in t?n(r,a):o in e?n(void 0,r):void 0}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(e,t,r)=>a(_n(e),_n(t),0,!0)};return zr.forEach(Object.keys({...e,...t}),function(n){if("__proto__"===n||"constructor"===n||"prototype"===n)return;const o=zr.hasOwnProp(l,n)?l[n]:a,i=o(e[n],t[n],n);zr.isUndefined(i)&&o!==s||(r[n]=i)}),r}const kn=e=>{const t=En({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:o,headers:i,auth:s}=t;if(t.headers=i=fn.from(i),t.url=Vr(wn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&i.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),zr.isFormData(r))if(rn.hasStandardBrowserEnv||rn.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(zr.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,r])=>{t.includes(e.toLowerCase())&&i.set(e,r)})}if(rn.hasStandardBrowserEnv&&(n&&zr.isFunction(n)&&(n=n(t)),n||!1!==n&&vn(t.url))){const e=a&&o&&xn.read(o);e&&i.set(a,e)}return t},Sn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,r){const n=kn(e);let a=n.data;const o=fn.from(n.headers).normalize();let i,s,l,c,u,{responseType:f,onUploadProgress:d,onDownloadProgress:p}=n;function m(){c&&c(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(i),n.signal&&n.signal.removeEventListener("abort",i)}let h=new XMLHttpRequest;function g(){if(!h)return;const n=fn.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders());hn(function(e){t(e),m()},function(e){r(e),m()},{data:f&&"text"!==f&&"json"!==f?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:e,request:h}),h=null}h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout,"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(g)},h.onabort=function(){h&&(r(new Fr("Request aborted",Fr.ECONNABORTED,e,h)),h=null)},h.onerror=function(t){const n=t&&t.message?t.message:"Network Error",a=new Fr(n,Fr.ERR_NETWORK,e,h);a.event=t||null,r(a),h=null},h.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const a=n.transitional||Gr;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Fr(t,a.clarifyTimeoutError?Fr.ETIMEDOUT:Fr.ECONNABORTED,e,h)),h=null},void 0===a&&o.setContentType(null),"setRequestHeader"in h&&zr.forEach(o.toJSON(),function(e,t){h.setRequestHeader(t,e)}),zr.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),f&&"json"!==f&&(h.responseType=n.responseType),p&&([l,u]=gn(p,!0),h.addEventListener("progress",l)),d&&h.upload&&([s,c]=gn(d),h.upload.addEventListener("progress",s),h.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(i=t=>{h&&(r(!t||t.type?new mn(null,e,h):t),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(i),n.signal&&(n.signal.aborted?i():n.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);y&&-1===rn.protocols.indexOf(y)?r(new Fr("Unsupported protocol "+y+":",Fr.ERR_BAD_REQUEST,e)):h.send(a||null)})},Rn=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const a=function(e){if(!r){r=!0,i();const t=e instanceof Error?e:this.reason;n.abort(t instanceof Fr?t:new mn(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,a(new Fr(`timeout of ${t}ms exceeded`,Fr.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}),e=null)};e.forEach(e=>e.addEventListener("abort",a));const{signal:s}=n;return s.unsubscribe=()=>zr.asap(i),s}},Cn=function*(e,t){let r=e.byteLength;if(r<t)return void(yield e);let n,a=0;for(;a<r;)n=a+t,yield e.slice(a,n),a=n},Nn=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},On=(e,t,r,n)=>{const a=async function*(e,t){for await(const r of Nn(e))yield*Cn(r,t)}(e,t);let o,i=0,s=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await a.next();if(t)return s(),void e.close();let o=n.byteLength;if(r){let e=i+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(t){throw s(t),t}},cancel:e=>(s(e),a.return())},{highWaterMark:2})},{isFunction:Mn}=zr,jn=(({Request:e,Response:t})=>({Request:e,Response:t}))(zr.global),{ReadableStream:Tn,TextEncoder:$n}=zr.global,An=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},Dn=e=>{e=zr.merge.call({skipUndefined:!0},jn,e);const{fetch:t,Request:r,Response:n}=e,a=t?Mn(t):"function"==typeof fetch,o=Mn(r),i=Mn(n);if(!a)return!1;const s=a&&Mn(Tn),l=a&&("function"==typeof $n?(e=>t=>e.encode(t))(new $n):async e=>new Uint8Array(await new r(e).arrayBuffer())),c=o&&s&&An(()=>{let e=!1;const t=new r(rn.origin,{body:new Tn,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=i&&s&&An(()=>zr.isReadableStream(new n("").body)),f={stream:u&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Fr(`Response type '${e}' is not supported`,Fr.ERR_NOT_SUPPORT,r)})});const d=async(e,t)=>{const n=zr.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(zr.isBlob(e))return e.size;if(zr.isSpecCompliantForm(e)){const t=new r(rn.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return zr.isArrayBufferView(e)||zr.isArrayBuffer(e)?e.byteLength:(zr.isURLSearchParams(e)&&(e+=""),zr.isString(e)?(await l(e)).byteLength:void 0)})(t):n};return async e=>{let{url:a,method:i,data:s,signal:l,cancelToken:p,timeout:m,onDownloadProgress:h,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:x}=kn(e),w=t||fetch;y=y?(y+"").toLowerCase():"text";let _=Rn([l,p&&p.toAbortSignal()],m),E=null;const k=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let S;try{if(g&&c&&"get"!==i&&"head"!==i&&0!==(S=await d(b,s))){let e,t=new r(a,{method:"POST",body:s,duplex:"half"});if(zr.isFormData(s)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,r]=yn(S,gn(bn(g)));s=On(t.body,65536,e,r)}}zr.isString(v)||(v=v?"include":"omit");const t=o&&"credentials"in r.prototype,l={...x,signal:_,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:s,duplex:"half",credentials:t?v:void 0};E=o&&new r(a,l);let p=await(o?w(E,x):w(a,l));const m=u&&("stream"===y||"response"===y);if(u&&(h||m&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=zr.toFiniteNumber(p.headers.get("content-length")),[r,a]=h&&yn(t,gn(bn(h),!0))||[];p=new n(On(p.body,65536,r,()=>{a&&a(),k&&k()}),e)}y=y||"text";let R=await f[zr.findKey(f,y)||"text"](p,e);return!m&&k&&k(),await new Promise((t,r)=>{hn(t,r,{data:R,headers:fn.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:E})})}catch(R){if(k&&k(),R&&"TypeError"===R.name&&/Load failed|fetch/i.test(R.message))throw Object.assign(new Fr("Network Error",Fr.ERR_NETWORK,e,E,R&&R.response),{cause:R.cause||R});throw Fr.from(R,R&&R.code,e,E,R&&R.response)}}},zn=new Map,Fn=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:a}=t,o=[n,a,r];let i,s,l=o.length,c=zn;for(;l--;)i=o[l],s=c.get(i),void 0===s&&c.set(i,s=l?new Map:Dn(t)),c=s;return s};Fn();const Ln={http:null,xhr:Sn,fetch:{get:Fn}};zr.forEach(Ln,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});const Pn=e=>`- ${e}`,In=e=>zr.isFunction(e)||null===e||!1===e;const Un={getAdapter:function(e,t){e=zr.isArray(e)?e:[e];const{length:r}=e;let n,a;const o={};for(let i=0;i<r;i++){let r;if(n=e[i],a=n,!In(n)&&(a=Ln[(r=String(n)).toLowerCase()],void 0===a))throw new Fr(`Unknown adapter '${r}'`);if(a&&(zr.isFunction(a)||(a=a.get(t))))break;o[r||"#"+i]=a}if(!a){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=r?e.length>1?"since :\n"+e.map(Pn).join("\n"):" "+Pn(e[0]):"as no adapter specified";throw new Fr("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return a},adapters:Ln};function Bn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new mn(null,e)}function Yn(e){Bn(e),e.headers=fn.from(e.headers),e.data=dn.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Un.getAdapter(e.adapter||an.adapter,e)(e).then(function(t){return Bn(e),t.data=dn.call(e,e.transformResponse,t),t.headers=fn.from(t.headers),t},function(t){return pn(t)||(Bn(e),t&&t.response&&(t.response.data=dn.call(e,e.transformResponse,t.response),t.response.headers=fn.from(t.response.headers))),Promise.reject(t)})}const Hn="1.13.5",Wn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Wn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const qn={};Wn.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Hn+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,a,o)=>{if(!1===e)throw new Fr(n(a," has been removed"+(t?" in "+t:"")),Fr.ERR_DEPRECATED);return t&&!qn[a]&&(qn[a]=!0,console.warn(n(a," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,a,o)}},Wn.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};const Vn={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Fr("options must be an object",Fr.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let a=n.length;for(;a-- >0;){const o=n[a],i=t[o];if(i){const t=e[o],r=void 0===t||i(t,o,e);if(!0!==r)throw new Fr("option "+o+" must be "+r,Fr.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Fr("Unknown option "+o,Fr.ERR_BAD_OPTION)}},validators:Wn},Jn=Vn.validators;let Gn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Jr,response:new Jr}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{r.stack?t&&!String(r.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+t):r.stack=t}catch(n){}}throw r}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=En(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:a}=t;void 0!==r&&Vn.assertOptions(r,{silentJSONParsing:Jn.transitional(Jn.boolean),forcedJSONParsing:Jn.transitional(Jn.boolean),clarifyTimeoutError:Jn.transitional(Jn.boolean),legacyInterceptorReqResOrdering:Jn.transitional(Jn.boolean)},!1),null!=n&&(zr.isFunction(n)?t.paramsSerializer={serialize:n}:Vn.assertOptions(n,{encode:Jn.function,serialize:Jn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Vn.assertOptions(t,{baseUrl:Jn.spelling("baseURL"),withXsrfToken:Jn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=a&&zr.merge(a.common,a[t.method]);a&&zr.forEach(["delete","get","head","post","put","patch","common"],e=>{delete a[e]}),t.headers=fn.concat(o,a);const i=[];let s=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;s=s&&e.synchronous;const r=t.transitional||Gr;r&&r.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,f=0;if(!s){const e=[Yn.bind(this),void 0];for(e.unshift(...i),e.push(...l),u=e.length,c=Promise.resolve(t);f<u;)c=c.then(e[f++],e[f++]);return c}u=i.length;let d=t;for(;f<u;){const e=i[f++],t=i[f++];try{d=e(d)}catch(p){t.call(this,p);break}}try{c=Yn.call(this,d)}catch(p){return Promise.reject(p)}for(f=0,u=l.length;f<u;)c=c.then(l[f++],l[f++]);return c}getUri(e){return Vr(wn((e=En(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};zr.forEach(["delete","get","head","options"],function(e){Gn.prototype[e]=function(t,r){return this.request(En(r||{},{method:e,url:t,data:(r||{}).data}))}}),zr.forEach(["post","put","patch"],function(e){function t(t){return function(r,n,a){return this.request(En(a||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Gn.prototype[e]=t(),Gn.prototype[e+"Form"]=t(!0)});const Kn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Kn).forEach(([e,t])=>{Kn[t]=e});const Zn=function e(t){const r=new Gn(t),n=Jt(Gn.prototype.request,r);return zr.extend(n,Gn.prototype,r,{allOwnKeys:!0}),zr.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(En(t,r))},n}(an);Zn.Axios=Gn,Zn.CanceledError=mn,Zn.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const r=this;this.promise.then(e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null}),this.promise.then=e=>{let t;const n=new Promise(e=>{r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e(function(e,n,a){r.reason||(r.reason=new mn(e,n,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Zn.isCancel=pn,Zn.VERSION=Hn,Zn.toFormData=Br,Zn.AxiosError=Fr,Zn.Cancel=Zn.CanceledError,Zn.all=function(e){return Promise.all(e)},Zn.spread=function(e){return function(t){return e.apply(null,t)}},Zn.isAxiosError=function(e){return zr.isObject(e)&&!0===e.isAxiosError},Zn.mergeConfig=En,Zn.AxiosHeaders=fn,Zn.formToJSON=e=>nn(zr.isHTMLForm(e)?new FormData(e):e),Zn.getAdapter=Un.getAdapter,Zn.HttpStatusCode=Kn,Zn.default=Zn;const{Axios:Qn,AxiosError:Xn,CanceledError:ea,isCancel:ta,CancelToken:ra,VERSION:na,all:aa,Cancel:oa,isAxiosError:ia,spread:sa,toFormData:la,AxiosHeaders:ca,HttpStatusCode:ua,formToJSON:fa,getAdapter:da,mergeConfig:pa}=Zn;const ma=Zn.create({baseURL:"/api/v6",timeout:3e5});async function ha(e,t){const r=await ma.get(`/data/${e}`,{params:{...t,top:t.top??20,skip:t.skip??0}}),n=r.data?.data||[];return{data:n,total:r.data?.totalCount??r.data?.total??n.length}}ma.interceptors.request.use(e=>e);const ga=new Map,ya=new Map;function ba(e,t){return 0===e.length?"":t?e.join(","):e[0]}function va({field:t,value:r,onChange:n,onFillFields:a,isTableMode:o=!1,hasError:i=!1,formValues:s}){const[l,c]=e.useState(!1),u=t.reference_to||"",f=!!t.pickerMultiple,d=t.lookupDisplayFields||["name"],p=d[0]||"name",m=e.useMemo(()=>!f&&t.lookupFillRules||[],[f,t.lookupFillRules]),h=e.useMemo(()=>{return e=t.lookupFilters,r=s||{},e?e.replace(/\{(\w+)\}/g,(e,t)=>r[t]??""):e;var e,r},[t.lookupFilters,s]),g=e.useMemo(()=>function(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("object"==typeof t&&null!==t&&"_id"in t)return[t._id]}catch{}return e.split(",").map(e=>e.trim()).filter(Boolean)}(r),[r]),[y,b]=e.useState(new Map);e.useEffect(()=>{if(!u||0===g.length)return;const e=g.filter(e=>!y.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);ha(u,{filters:t,fields:`_id,${p}`,top:e.length}).then(({data:e})=>{b(t=>{const r=new Map(t);for(const n of e)r.set(n._id,n[p]||n._id);return r})})},[u,g.join(","),p]);const v=e.useCallback(e=>{const t=g.filter(t=>t!==e);n(ba(t,f))},[g,n,f]),x=e.useCallback((e,t,r)=>{if(n(ba(e,f)),b(e=>{const r=new Map(e);for(const[n,a]of t)r.set(n,a);return r}),c(!1),!f&&m.length>0&&1===e.length&&a){const t=e=>{const t={};for(const r of m)r.sourceField&&r.targetField&&null!=e[r.sourceField]&&(t[r.targetField]=String(e[r.sourceField]));Object.keys(t).length>0&&a(t)};if(r){const n=m.map(e=>e.sourceField).filter(Boolean);if(n.every(e=>e in r))t(r);else{const r=JSON.stringify(["_id","=",e[0]]),a=["_id",...n].join(",");ha(u,{filters:r,fields:a,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const r=m.map(e=>e.sourceField).filter(Boolean),n=JSON.stringify(["_id","=",e[0]]),a=["_id",...r].join(",");ha(u,{filters:n,fields:a,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[n,f,m,a,u]);return t.readonly?React.createElement("div",{className:(o?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-2")+" bg-gray-50/60 min-h-[34px]"},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},y.get(e)||e))):React.createElement("span",{className:"text-[13px] text-gray-400"},"—")):React.createElement(React.Fragment,null,React.createElement("div",{onClick:()=>u&&c(!0),className:"cursor-pointer smooth-transition "+(o?"w-full px-2.5 py-1.5 min-h-[34px] "+(i?"bg-red-100/90":"bg-amber-50/80 hover:bg-amber-50"):"border rounded-md px-3 py-2 min-h-[38px] "+(i?"border-red-200 bg-red-50":"border-gray-300 bg-white hover:border-indigo-300"))},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] bg-indigo-50 text-indigo-700 border border-indigo-200 rounded-md px-2 py-0.5 max-w-[200px]"},React.createElement("span",{className:"truncate"},y.get(e)||e),React.createElement(Y,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),v(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement($,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement(T,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(xa,{objectName:u,displayFields:d,multiple:f,selectedIds:g,filters:h,onConfirm:x,onClose:()=>c(!1)}))}function xa({objectName:r,displayFields:n,multiple:a,selectedIds:o,filters:i,onConfirm:s,onClose:l}){const[c,u]=e.useState([]),[f,d]=e.useState(0),[p,m]=e.useState(!1),[h,g]=e.useState(1),[y,b]=e.useState(""),[v,x]=e.useState(new Set(o)),[w,_]=e.useState([]),E=e.useRef(void 0),k=n[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=ga.get(e);if(t)return t;const r=ya.get(e);if(r)return r;const n=(async()=>{try{let t="";const r={},n=await fetch(`${t}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:r}),a=await n.json(),o=a?.data?.options??[];return ga.set(e,o),o}catch{return[]}finally{ya.delete(e)}})();return ya.set(e,n),n})(r).then(_)},[r]);const S=e.useMemo(()=>{const e=new Map;for(const t of w)e.set(t.value,t.label);return e},[w]),R=e.useCallback(async(e,t)=>{m(!0);try{const a=[];let o;i&&a.push(i),t&&a.push(JSON.stringify([k,"contains",t])),2===a.length?o=JSON.stringify([JSON.parse(a[0]),"and",JSON.parse(a[1])]):1===a.length&&(o=a[0]);const s=["_id",...n].join(","),l=await ha(r,{filters:o,fields:s,top:10,skip:10*(e-1),sort:`${k} asc`});u(l.data),d(l.total)}finally{m(!1)}},[r,n,k,i]);e.useEffect(()=>{R(h,y)},[h]);const C=e.useCallback(e=>{b(e),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{g(1),R(1,e)},300)},[R]),N=e.useMemo(()=>n.map(e=>({title:S.get(e)||e,dataIndex:e,key:e,ellipsis:!0,render:e=>null!=e?String(e):"-"})),[n,S]),O=e.useMemo(()=>({type:a?"checkbox":"radio",selectedRowKeys:[...v],onChange:e=>{if(x(new Set(e)),!a&&e.length>0){const t=e[0],r=c.find(e=>e._id===t),n=new Map;r&&n.set(t,r[k]||t),s([t],n,r)}}}),[a,v,c,k,s]);return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement($,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:l,onOk:a?()=>{const e=new Map;for(const t of c){const r=t._id;v.has(r)&&e.set(r,t[k]||r)}s([...v],e)}:void 0,okText:a?"确定"+(v.size>0?` (${v.size})`:""):void 0,cancelText:"取消",footer:a?void 0:null,destroyOnClose:!0,styles:{body:{padding:"12px 0"}}},React.createElement("div",{style:{padding:"0 0 12px"}},React.createElement(t.Input.Search,{placeholder:`搜索 ${S.get(k)||k}...`,allowClear:!0,onChange:e=>C(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:N,dataSource:c,loading:p,rowSelection:O,pagination:{current:h,pageSize:10,total:f,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>g(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(a)x(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r});else{const r=new Map;r.set(t,e[k]||t),s([t],r,e)}},style:{cursor:"pointer"}})})))}var wa=e.createContext({});function _a(){return _a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_a.apply(null,arguments)}function Ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ka(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(u){c=!0,a=u}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ea(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ea(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sa(e){return(Sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ra(e){var t=function(e,t){if("object"!=Sa(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=Sa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Sa(t)?t:t+""}function Ca(e,t,r){return(t=Ra(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Na(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var Oa,Ma={exports:{}};var ja=(Oa||(Oa=1,function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=a(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var o in e)t.call(e,o)&&e[o]&&(n=a(n,o));return n}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(Ma)),Ma.exports);const Ta=o(ja),$a=Math.round;function Aa(e,t){const r=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],n=r.map(e=>parseFloat(e));for(let a=0;a<3;a+=1)n[a]=t(n[a]||0,r[a]||"",a);return r[3]?n[3]=r[3].includes("%")?n[3]/100:n[3]:n[3]=1,n}const Da=(e,t,r)=>0===r?e:e/100;function za(e,t){const r=t||255;return e>r?r:e<0?0:e}class Fa{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(Ca(this,"isValid",!0),Ca(this,"r",0),Ca(this,"g",0),Ca(this,"b",0),Ca(this,"a",1),Ca(this,"_h",void 0),Ca(this,"_s",void 0),Ca(this,"_l",void 0),Ca(this,"_v",void 0),Ca(this,"_max",void 0),Ca(this,"_min",void 0),Ca(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return r.startsWith(e)};const r=e.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):t("rgb")?this.fromRgbString(r):t("hsl")?this.fromHslString(r):(t("hsv")||t("hsb"))&&this.fromHsvString(r)}else if(e instanceof Fa)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=za(e.r),this.g=za(e.g),this.b=za(e.b),this.a="number"==typeof e.a?za(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:$a(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),r=this.getSaturation();let n=this.getLightness()-e/100;return n<0&&(n=0),this._c({h:t,s:r,l:n,a:this.a})}lighten(e=10){const t=this.getHue(),r=this.getSaturation();let n=this.getLightness()+e/100;return n>1&&(n=1),this._c({h:t,s:r,l:n,a:this.a})}mix(e,t=50){const r=this._c(e),n=t/100,a=e=>(r[e]-this[e])*n+this[e],o={r:$a(a("r")),g:$a(a("g")),b:$a(a("b")),a:$a(100*a("a"))/100};return this._c(o)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),r=this.a+t.a*(1-this.a),n=e=>$a((this[e]*this.a+t[e]*t.a*(1-this.a))/r);return this._c({r:n("r"),g:n("g"),b:n("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const r=(this.g||0).toString(16);e+=2===r.length?r:"0"+r;const n=(this.b||0).toString(16);if(e+=2===n.length?n:"0"+n,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=$a(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=$a(100*this.getSaturation()),r=$a(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${r}%,${this.a})`:`hsl(${e},${t}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,r){const n=this.clone();return n[e]=za(t,r),n}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function r(e,r){return parseInt(t[e]+t[r||e],16)}t.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=t[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=t[6]?r(6,7)/255:1)}fromHsl({h:e,s:t,l:r,a:n}){if(this._h=e%360,this._s=t,this._l=r,this.a="number"==typeof n?n:1,t<=0){const e=$a(255*r);this.r=e,this.g=e,this.b=e}let a=0,o=0,i=0;const s=e/60,l=(1-Math.abs(2*r-1))*t,c=l*(1-Math.abs(s%2-1));s>=0&&s<1?(a=l,o=c):s>=1&&s<2?(a=c,o=l):s>=2&&s<3?(o=l,i=c):s>=3&&s<4?(o=c,i=l):s>=4&&s<5?(a=c,i=l):s>=5&&s<6&&(a=l,i=c);const u=r-l/2;this.r=$a(255*(a+u)),this.g=$a(255*(o+u)),this.b=$a(255*(i+u))}fromHsv({h:e,s:t,v:r,a:n}){this._h=e%360,this._s=t,this._v=r,this.a="number"==typeof n?n:1;const a=$a(255*r);if(this.r=a,this.g=a,this.b=a,t<=0)return;const o=e/60,i=Math.floor(o),s=o-i,l=$a(r*(1-t)*255),c=$a(r*(1-t*s)*255),u=$a(r*(1-t*(1-s))*255);switch(i){case 0:this.g=u,this.b=l;break;case 1:this.r=c,this.b=l;break;case 2:this.r=l,this.b=u;break;case 3:this.r=l,this.g=c;break;case 4:this.r=u,this.g=l;break;default:this.g=l,this.b=c}}fromHsvString(e){const t=Aa(e,Da);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Aa(e,Da);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Aa(e,(e,t)=>t.includes("%")?$a(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var La=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Pa(e,t,r){var n;return(n=Math.round(e.h)>=60&&Math.round(e.h)<=240?r?Math.round(e.h)-2*t:Math.round(e.h)+2*t:r?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?n+=360:n>=360&&(n-=360),n}function Ia(e,t,r){return 0===e.h&&0===e.s?e.s:((n=r?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(n=1),r&&5===t&&n>.1&&(n=.1),n<.06&&(n=.06),Math.round(100*n)/100);var n}function Ua(e,t,r){var n;return n=r?e.v+.05*t:e.v-.15*t,n=Math.max(0,Math.min(1,n)),Math.round(100*n)/100}var Ba=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function Ya(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ha(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ya(Object(r),!0).forEach(function(t){Ca(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ya(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}Ba.primary=Ba[5];var Wa="data-rc-order",qa="data-rc-priority",Va=new Map;function Ja(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function Ga(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Ka(e){return Array.from((Va.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function Za(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var r=t.csp,n=t.prepend,a=t.priority,o=void 0===a?0:a,i=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(n),s="prependQueue"===i,l=document.createElement("style");l.setAttribute(Wa,i),s&&o&&l.setAttribute(qa,"".concat(o)),null!=r&&r.nonce&&(l.nonce=null==r?void 0:r.nonce),l.innerHTML=e;var c=Ga(t),u=c.firstChild;if(n){if(s){var f=(t.styles||Ka(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(Wa)))return!1;var t=Number(e.getAttribute(qa)||0);return o>=t});if(f.length)return c.insertBefore(l,f[f.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function Qa(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=Ga(r),a=Ka(n),o=Ha(Ha({},r),{},{styles:a});!function(e,t){var r=Va.get(e);if(!r||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var r=t;r;){if(r===e)return!0;r=r.parentNode}return!1}(document,r)){var n=Za("",t),a=n.parentNode;Va.set(e,a),e.removeChild(n)}}(n,o);var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Ga(t);return(t.styles||Ka(r)).find(function(r){return r.getAttribute(Ja(t))===e})}(t,o);if(i){var s,l,c;if(null!==(s=o.csp)&&void 0!==s&&s.nonce&&i.nonce!==(null===(l=o.csp)||void 0===l?void 0:l.nonce))i.nonce=null===(c=o.csp)||void 0===c?void 0:c.nonce;return i.innerHTML!==e&&(i.innerHTML=e),i}var u=Za(e,o);return u.setAttribute(Ja(o),t),u}function Xa(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function eo(e){return function(e){return Xa(e)instanceof ShadowRoot}(e)?Xa(e):null}var to={};function ro(e,t){}function no(e,t){}function ao(e,t,r){t||to[r]||(e(!1,r),to[r]=!0)}function oo(e,t){ao(ro,e,t)}function io(e){return"object"===Sa(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===Sa(e.icon)||"function"==typeof e.icon)}function so(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,r){var n,a=e[r];if("class"===r)t.className=a,delete t.class;else delete t[r],t[(n=r,n.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=a;return t},{})}function lo(t,r,n){return n?e.createElement(t.tag,Ha(Ha({key:r},so(t.attrs)),n),(t.children||[]).map(function(e,n){return lo(e,"".concat(r,"-").concat(t.tag,"-").concat(n))})):e.createElement(t.tag,Ha({key:r},so(t.attrs)),(t.children||[]).map(function(e,n){return lo(e,"".concat(r,"-").concat(t.tag,"-").concat(n))}))}function co(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[],n=new Fa(e),a=n.toHsv(),o=5;o>0;o-=1){var i=new Fa({h:Pa(a,o,!0),s:Ia(a,o,!0),v:Ua(a,o,!0)});r.push(i)}r.push(n);for(var s=1;s<=4;s+=1){var l=new Fa({h:Pa(a,s),s:Ia(a,s),v:Ua(a,s)});r.push(l)}return"dark"===t.theme?La.map(function(e){var n=e.index,a=e.amount;return new Fa(t.backgroundColor||"#141414").mix(r[n],a).toHexString()}):r.map(function(e){return e.toHexString()})}(e)[0]}function uo(e){return e?Array.isArray(e)?e:[e]:[]}oo.preMessage=function(e){},oo.resetWarned=function(){to={}},oo.noteOnce=function(e,t){ao(no,e,t)};var fo=["icon","className","onClick","style","primaryColor","secondaryColor"],po={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var mo=function(t){var r,a,o,i,s,l,c,u,f=t.icon,d=t.className,p=t.onClick,m=t.style,h=t.primaryColor,g=t.secondaryColor,y=Na(t,fo),b=n.useRef(),v=po;if(h&&(v={primaryColor:h,secondaryColor:g||co(h)}),r=b,a=e.useContext(wa),o=a.csp,i=a.prefixCls,s=a.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",i&&(l=l.replace(/anticon/g,i)),s&&(l="@layer ".concat(s," {\n").concat(l,"\n}")),e.useEffect(function(){var e=eo(r.current);Qa(l,"@ant-design-icons",{prepend:!s,csp:o,attachTo:e})},[]),c=io(f),u="icon should be icon definiton, but got ".concat(f),oo(c,"[@ant-design/icons] ".concat(u)),!io(f))return null;var x=f;return x&&"function"==typeof x.icon&&(x=Ha(Ha({},x),{},{icon:x.icon(v.primaryColor,v.secondaryColor)})),lo(x.icon,"svg-".concat(x.name),Ha(Ha({className:d,onClick:p,style:m,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function ho(e){var t=ka(uo(e),2),r=t[0],n=t[1];return mo.setTwoToneColors({primaryColor:r,secondaryColor:n})}mo.displayName="IconReact",mo.getTwoToneColors=function(){return Ha({},po)},mo.setTwoToneColors=function(e){var t=e.primaryColor,r=e.secondaryColor;po.primaryColor=t,po.secondaryColor=r||co(t),po.calculated=!!r};var go=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];ho(Ba.primary);var yo=n.forwardRef(function(e,t){var r=e.className,a=e.icon,o=e.spin,i=e.rotate,s=e.tabIndex,l=e.onClick,c=e.twoToneColor,u=Na(e,go),f=n.useContext(wa),d=f.prefixCls,p=void 0===d?"anticon":d,m=f.rootClassName,h=Ta(m,p,Ca(Ca({},"".concat(p,"-").concat(a.name),!!a.name),"".concat(p,"-spin"),!!o||"loading"===a.name),r),g=s;void 0===g&&l&&(g=-1);var y=i?{msTransform:"rotate(".concat(i,"deg)"),transform:"rotate(".concat(i,"deg)")}:void 0,b=ka(uo(c),2),v=b[0],x=b[1];return n.createElement("span",_a({role:"img","aria-label":a.name},u,{ref:t,tabIndex:g,onClick:l,className:h}),n.createElement(mo,{icon:a,primaryColor:v,secondaryColor:x,style:y}))});yo.displayName="AntdIcon",yo.getTwoToneColor=function(){var e=mo.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},yo.setTwoToneColor=ho;var bo={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z"}}]},name:"apartment",theme:"outlined"},vo=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:bo}))},xo=n.forwardRef(vo),wo={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},_o=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:wo}))},Eo=n.forwardRef(_o),ko={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},So=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:ko}))},Ro=n.forwardRef(So),Co={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},No=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:Co}))},Oo=n.forwardRef(No),Mo={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},jo=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:Mo}))},To=n.forwardRef(jo),$o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},Ao=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:$o}))},Do=n.forwardRef(Ao),zo={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},Fo=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:zo}))},Lo=n.forwardRef(Fo),Po={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},Io=function(e,t){return n.createElement(yo,_a({},e,{ref:t,icon:Po}))},Uo=n.forwardRef(Io);const Bo=r=>{const{visible:n,multiple:a,loading:o,users:i,searchKeyword:s,searchInputValue:l,tempSelectedUsers:c,clearable:u,rootDeptInfo:f,deptPath:d,currentLevelDepts:p,showSelectedPanel:m,onDrillDown:h,onMobileBack:g,onDrillBack:y,onBackToRoot:b,onToggleSelectedPanel:v,onUserSearch:x,onAddUser:w,onRemoveUser:_,onToggleUser:E,onToggleSelectAll:k,onReorderUsers:S,onOk:R,onCancel:C,onClearAll:N}=r,O=i.length>0&&i.every(e=>c.find(t=>t._id===e._id)),M=!!s,{visibleCount:j,scrollContainerRef:T}=function(t,r=50,n=[]){const[a,o]=e.useState(r),i=e.useRef(null),[s,l]=e.useState(!1);e.useEffect(()=>{e.startTransition(()=>o(r)),i.current&&(i.current.scrollTop=0)},[...n,t,r]);const c=e.useCallback(e=>{i.current=e,l(!!e)},[]);return e.useEffect(()=>{const e=i.current;if(!e)return;const n=()=>{o(n=>n>=t?n:e.scrollHeight-e.scrollTop-e.clientHeight<120?Math.min(n+r,t):n)};e.addEventListener("scroll",n,{passive:!0});const a=requestAnimationFrame(()=>n());return()=>{e.removeEventListener("scroll",n),cancelAnimationFrame(a)}},[t,r,s]),{visibleCount:a,scrollContainerRef:c}}(i.length,50,[d.length,s]),$=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),A=e.useRef(null),[D,z]=e.useState(null),[F,L]=e.useState(null),P=e.useCallback((e,t)=>{if(e.target.closest(".steedos-selected-remove-btn"))return;const r=e.touches[0],n=e.currentTarget,a=n.getBoundingClientRect(),o=n.cloneNode(!0);o.style.position="fixed",o.style.left=`${a.left}px`,o.style.top=`${a.top}px`,o.style.width=`${a.width}px`,o.style.zIndex="9999",o.style.boxShadow="0 8px 24px rgba(0,0,0,0.15)",o.style.borderRadius="8px",o.style.opacity="0.92",o.style.transition="box-shadow 0.2s",o.style.pointerEvents="none",document.body.appendChild(o),$.current={dragging:!0,startIndex:t,currentIndex:t,startY:r.clientY,itemHeight:a.height,clone:o,listEl:A.current},z(t),L(t),navigator.vibrate&&navigator.vibrate(20)},[]),I=e.useCallback(e=>{const t=$.current;if(!t.dragging||!t.clone)return;e.preventDefault();const r=e.touches[0].clientY-t.startY;t.clone.style.transform=`translateY(${r}px) scale(1.02)`;const n=Math.round(r/t.itemHeight)+t.startIndex,a=Math.max(0,Math.min(n,c.length-1));a!==t.currentIndex&&(t.currentIndex=a,L(a),navigator.vibrate&&navigator.vibrate(10))},[c.length]),U=e.useCallback(()=>{const e=$.current;if(!e.dragging)return;e.clone&&(e.clone.remove(),e.clone=null);const t=e.startIndex,r=e.currentIndex;e.dragging=!1,z(null),L(null),t!==r&&t>=0&&r>=0&&S(t,r)},[S]);return e.createElement(t.Drawer,{open:n,placement:"bottom",height:"100vh",closable:!1,destroyOnClose:!0,rootClassName:"steedos-mobile-drawer",onClose:C,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}}},e.createElement("style",null,"\n.steedos-mobile-drawer .ant-drawer-content-wrapper {\n border-radius: 0 !important;\n overflow: hidden;\n}\n.steedos-mobile-drawer .ant-drawer-header {\n padding: 12px 16px;\n border-bottom: none;\n}\n.steedos-mobile-drawer .ant-drawer-body {\n padding: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n.steedos-mobile-dept-card {\n display: flex;\n align-items: center;\n padding: 14px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-dept-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-user-card {\n display: flex;\n align-items: center;\n padding: 12px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-user-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-bottom-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 16px;\n padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));\n border-top: 1px solid #f0f0f0;\n background: #fff;\n}\n.steedos-mobile-selected-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #fff;\n z-index: 20;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n"),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px 8px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},d.length>0&&e.createElement("span",{onClick:g,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(To,null)),e.createElement("span",{onClick:C,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Ro,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},a&&i.length>0&&!M&&d.length>0&&e.createElement("span",{onClick:k,style:{fontSize:14,color:"#1890ff",cursor:"pointer",WebkitTapHighlightColor:"transparent"}},O?"取消全选":"全选"))),e.createElement("div",{style:{padding:"4px 16px 8px",flexShrink:0}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Lo,null),value:l,onChange:e=>x(e.target.value),allowClear:!0,size:"large"})),d.length>0&&!M&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),d.length>0&&!M&&(()=>{const t=d.length>2,r=d.length>2?d.slice(-2):d,n=d.length>2?d.length-2:0,a=e=>e.length>8?e.slice(0,8)+"…":e;return e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",fontSize:13,color:"#999",overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{onClick:b,style:{color:"#1890ff",cursor:"pointer",flexShrink:0,WebkitTapHighlightColor:"transparent"}},"联系人"),t&&e.createElement(e.Fragment,null,e.createElement(Do,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),e.createElement("span",{style:{color:"#999",flexShrink:0,display:"flex",alignItems:"center",lineHeight:1}},"···")),r.map((t,r)=>{const o=n+r,i=o===d.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement(Do,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),i?e.createElement("span",{style:{color:"#999",overflow:"hidden",textOverflow:"ellipsis"}},a(t.name)):e.createElement("span",{onClick:()=>y(o),style:{color:"#1890ff",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",WebkitTapHighlightColor:"transparent"}},a(t.name)))}))})(),e.createElement("div",{ref:T,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},e.createElement(t.Spin,{spinning:o},M||d.length>0||!f?null:e.createElement(e.Fragment,null,e.createElement("div",{className:"steedos-mobile-dept-card",onClick:()=>h(f.id,f.name)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(xo,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement(Do,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),i.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),M||0===d.length||0===p.length?null:e.createElement(e.Fragment,null,p.map(t=>e.createElement("div",{key:t._id||t.id||t.key||t.value,className:"steedos-mobile-dept-card",onClick:()=>h(t._id||t.id||t.key||t.value,t.title||t.name||t.label)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(xo,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.title||t.name||t.label)),e.createElement(Do,{style:{color:"#ccc",fontSize:14,flexShrink:0}}))),i.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),e.createElement(e.Fragment,null,i.length>0?e.createElement(e.Fragment,null,i.slice(0,j).map(r=>{const n=!!c.find(e=>e._id===r._id);return e.createElement("div",{key:r._id,className:"steedos-mobile-user-card",onClick:()=>E(r)},a&&e.createElement("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:n?"#1890ff":"transparent",border:n?"none":"1.5px solid #d9d9d9"}},n&&e.createElement(Eo,{style:{color:"#fff",fontSize:11}})),e.createElement(t.Avatar,{src:r.avatar?`/api/v6/users/${r.user}/avatar`:void 0,size:40,style:{backgroundColor:r.avatar?void 0:"#1890ff",flexShrink:0}},!r.avatar&&r.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2}},r.organization?.name,r.position?` · ${r.position}`:""),(r.email||r.mobile||r.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},r.email||r.mobile||r.username)))}),j<i.length&&e.createElement("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13}},"加载更多...")):o?null:e.createElement(t.Empty,{description:s?"未找到匹配的人员":"暂无人员",style:{marginTop:60}})))),m&&e.createElement("div",{className:"steedos-mobile-selected-overlay"},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{style:{fontWeight:600,fontSize:16}},"已选中 (",c.length,")"),e.createElement(t.Button,{type:"text",onClick:v,style:{padding:0,color:"#666"}},"返回")),u&&c.length>0&&e.createElement("div",{style:{padding:"4px 16px",display:"flex",justifyContent:"flex-end"}},e.createElement(t.Button,{type:"link",danger:!0,size:"small",onClick:N,style:{padding:0}},"清空全部")),a&&c.length>1&&e.createElement("div",{style:{padding:"0 16px 6px",fontSize:12,color:"#999"}},"长按拖拽可调整顺序"),e.createElement("div",{ref:A,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},c.length>0?c.map((r,n)=>{const o=D===n,i=F===n&&null!==D&&D!==n;return e.createElement("div",{key:r._id,onTouchStart:a?e=>P(e,n):void 0,onTouchMove:a?I:void 0,onTouchEnd:a?U:void 0,style:{display:"flex",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid #f5f5f5",gap:10,opacity:o?.3:1,background:i?"#e6f7ff":"#fff",borderTop:i?"2px solid #1890ff":"2px solid transparent",transition:"background 0.15s, border-top 0.15s, opacity 0.15s",touchAction:"none",userSelect:"none"}},a&&e.createElement(Oo,{style:{color:"#bbb",fontSize:16,flexShrink:0,cursor:"grab"}}),e.createElement(t.Avatar,{src:r.avatar?`/api/v6/users/${r.user}/avatar`:void 0,size:36,style:{backgroundColor:r.avatar?void 0:"#1890ff",flexShrink:0}},!r.avatar&&r.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.name),(r.email||r.mobile||r.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},r.email||r.mobile||r.username)),u&&e.createElement(Ro,{className:"steedos-selected-remove-btn",onClick:()=>_(r._id),style:{fontSize:14,color:"#ff4d4f",padding:8,flexShrink:0}}))}):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE}))),a?e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:c.length>0?"#1890ff":"#666",cursor:"pointer"},onClick:c.length>0?v:void 0},"已选 ",c.length," 人 ",c.length>0&&!m?"▲":c.length>0&&m?"▼":""),e.createElement(t.Button,{type:"primary",onClick:R},"确定")):e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:"#666"}},c.length>0?`已选: ${c[0]?.name}`:"请选择人员"),e.createElement(t.Button,{type:"primary",onClick:R,disabled:0===c.length},"确定")))};function Yo(e={}){return{...e}}async function Ho(e){const t=`{rows:space_users(filters: [${[[["user_accepted","=",!0]],"and",[["organization","=",e]]].map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}}}`,r=await fetch("/graphql",{method:"POST",headers:Yo({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),n=await r.json();return(n.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function Wo(e,t){if(!e&&!t)return[];const r=[];r.push([["user_accepted","=",!0]]),r.push("and"),t?r.push([[["name","contains",t],"or",["email","contains",t]],"or",["username","contains",t]]):e&&r.push([["organizations_parents","in",[e]]]);const n=`{rows:space_users(filters: [${r.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}},count:space_users__count(filters:[${r.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}])}`,a=await fetch("/graphql",{method:"POST",headers:Yo({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await a.json();return(o.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function qo(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 1000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Yo({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await r.json();return(n.data?.rows||[]).map(e=>({title:e.fullname||e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,sort_no,parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Yo({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),n=await r.json();return(n.data?.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}{const e=await fetch("/service/api/organizations/root",{headers:Yo()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}}const Vo=r=>{const{value:n,onChange:a,multiple:o=!1,placeholder:i="请选择人员",fetchUsers:s=Wo,fetchDeptTree:l=qo,style:c,dispatchEvent:u,clearable:f=!0,isTableMode:d=!1,hasError:p=!1,formalTableMode:m=!1,minimal:h=!1}=r,[g,y]=e.useState(!1),[b,v]=e.useState([]),[x,w]=e.useState([]),[_,E]=e.useState(null),[k,S]=e.useState([]),[R,C]=e.useState([]),[N,O]=e.useState(!1),[M,j]=e.useState(""),[T,$]=e.useState(""),[A,D]=e.useState(""),[z,F]=e.useState(null),[L,P]=e.useState([]),[I,U]=e.useState(null),[B,Y]=e.useState(!1),[H,W]=e.useState(0),[q,V]=e.useState(null),J=e.useRef(null),G=e.useRef(null),K=e.useRef(0),Z=e.useRef(null),Q=function(){const[t,r]=e.useState(()=>"undefined"!=typeof window&&window.innerWidth<768);return e.useEffect(()=>{const e=()=>r(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t}(),[,X]=e.useState("dept"),[,ee]=e.useState(""),[te,re]=e.useState([]),[ne,ae]=e.useState([]),[oe,ie]=e.useState(!1),[se,le]=e.useState(null),{visibleCount:ce,sentinelRef:ue}=function(t,r=50,n=[]){const[a,o]=e.useState(r),i=e.useRef(null),s=e.useRef(null);return e.useEffect(()=>{o(r)},[...n,t,r]),e.useEffect(()=>{if(s.current&&s.current.disconnect(),i.current&&!(a>=t))return s.current=new IntersectionObserver(e=>{e[0]?.isIntersecting&&o(e=>Math.min(e+r,t))},{threshold:.1}),s.current.observe(i.current),()=>{s.current&&s.current.disconnect()}},[t,r,a]),{visibleCount:a,sentinelRef:i}}(x.length,50,[_,M]);e.useEffect(()=>{Z.current={props:r}}),e.useEffect(()=>{const e=Array.isArray(n)?n.map(String):n?[String(n)]:[];if(e.length>0){const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,email,mobile,position,username,avatar,organization}}`;fetch("/graphql",{method:"POST",headers:Yo({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{let r=(t.data?.rows||[]).map(e=>({_id:e._id,name:e.name,user:e.user,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}));r=e.map(e=>r.find(t=>t.user===e)).filter(e=>!!e),S(r)})}else S([])},[n]),e.useEffect(()=>()=>{J.current&&clearTimeout(J.current),G.current&&clearTimeout(G.current)},[]),e.useEffect(()=>{if(g){O(!0),W(e=>e+1),ee(""),v([]),P([]),E(null),D(""),j(""),$("");let e=!1;l().then(t=>{const r=t;v(r);const n=r.map(e=>e.key);if(P(n),n.length>0)if(Q&&r[0]){ee(String(r[0].title||""));const t=String(r[0].key),n=String(r[0].title||"");le({id:t,name:n}),re([]),E(t),e=!0,s(t).then(e=>{w(e)}).catch(()=>{w([])}).finally(()=>{O(!1)})}else E(String(n[0]));r.forEach(e=>{e.isLeaf||l(String(e.key)).then(t=>{v(r=>{const n=(e,t,r)=>e.map(e=>e.key===t?{...e,children:r}:e.children?{...e,children:n(e.children,t,r)}:e);return n(r,e.key,t)})})})}).finally(()=>{e||O(!1)})}},[g,l,s,Q]),e.useEffect(()=>{Q||(_||M?(O(!0),s(_||void 0,M||void 0).then(e=>w(e)).finally(()=>O(!1))):w([]))},[_,M,s,Q]);const fe=(e,t,r)=>e.map(e=>e.key===t?{...e,children:r}:e.children?{...e,children:fe(e.children,t,r)}:e),de=e=>{$(e),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{j(e),e?(E(null),ee(""),Q&&(O(!0),s(void 0,e).then(e=>w(e)).finally(()=>O(!1)))):Q?se&&(re([]),ae([]),E(se.id),O(!0),s(se.id).then(e=>{w(e)}).catch(()=>{w([])}).finally(()=>O(!1))):b.length>0&&E(String(b[0].key))},300)},pe=e=>{if(o){if(!R.find(t=>t._id===e._id)){const t=[...R,e];C(t)}}else C([e]),Q?setTimeout(()=>{ye([e])},0):(V(e._id),setTimeout(()=>{V(null),ye([e])},300))},me=e=>{C(R.filter(t=>t._id!==e))},he=()=>{F(null)},ge=()=>{if(x.length>0&&x.every(e=>R.find(t=>t._id===e._id))){const e=new Set(x.map(e=>e._id));C(R.filter(t=>!e.has(t._id)))}else{const e=[...R];x.forEach(t=>{e.find(e=>e._id===t._id)||e.push(t)}),C(e)}},ye=async e=>{if(S(e),a||u){const t=e.map(e=>e.user),r=o?t:t[0]||"";u&&await u("change",{value:r},Z.current),a&&a(r)}y(!1)},be=async()=>{await ye(R)},ve=()=>{C([...k]),y(!1)},xe=e.useCallback(async(e,t)=>{re(r=>[...r,{id:e,name:t}]),E(e),j(""),$(""),O(!0);try{const[t,r]=await Promise.all([l(e),Ho(e)]);ae(t),w(r)}catch{ae([]),w([])}finally{O(!1)}},[l]),we=e.useCallback(async e=>{if(e<0)return;const t=te.slice(0,e+1);re(t);const r=t[t.length-1];E(r.id),j(""),$(""),O(!0);try{const[e,t]=await Promise.all([l(r.id),Ho(r.id)]);ae(e),w(t)}catch{ae([]),w([])}finally{O(!1)}},[te,l]),_e=e.useCallback(async()=>{if(se){re([]),E(se.id),j(""),$(""),ae([]),O(!0);try{const e=await s(se.id);w(e)}catch{w([])}finally{O(!1)}}},[se,s]),Ee=e.useCallback(async()=>{if(!(te.length<=0))if(1===te.length)await _e();else{const e=te.slice(0,-1);re(e);const t=e[e.length-1];E(t.id),j(""),$(""),O(!0);try{const[e,r]=await Promise.all([l(t.id),Ho(t.id)]);ae(e),w(r)}catch{ae([]),w([])}finally{O(!1)}}},[te,_e,l]),ke=e.useCallback((e,t)=>{if(e<0||t<0||e>=R.length||t>=R.length)return;const r=[...R],[n]=r.splice(e,1);r.splice(t,0,n),C(r)},[R]),Se=e.useCallback(e=>{R.find(t=>t._id===e._id)?me(e._id):pe(e)},[R,o,pe,me]),Re=f&&k.length>0&&(Q||B);return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:i,value:k.map(e=>e.name).join(", "),onClick:()=>{y(!0),C([...k]),Q&&(X("users"),ee(""),ie(!1),re([]),ae([]),le(null))},onMouseEnter:()=>!Q&&Y(!0),onMouseLeave:()=>!Q&&Y(!1),variant:d||h?"borderless":"outlined",className:d?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...d?{backgroundColor:p?"rgba(254,226,226,0.9)":m?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{}},suffix:h?null:Re?e.createElement(Ro,{style:{color:"#ff4d4f",cursor:"pointer",padding:Q?4:0},onMouseEnter:()=>!Q&&Y(!0),onMouseLeave:()=>!Q&&Y(!1),onClick:async e=>{e.stopPropagation(),S([]);const t=o?[]:"";u&&await u("change",{value:t},Z.current),a&&a(t),Y(!1)}}):e.createElement(Uo,{style:{color:"#999"},onMouseEnter:()=>!Q&&k.length>0&&Y(!0),onMouseLeave:()=>!Q&&Y(!1)})}),!Q&&e.createElement(t.Modal,{title:o?"选择人员 (多选)":"选择人员",open:g,onOk:o?be:void 0,onCancel:ve,okText:"确定",cancelText:"取消",footer:o?void 0:null,width:1200,destroyOnClose:!0,bodyStyle:{height:600,overflow:"hidden",padding:0}},e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{width:240,borderRight:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement(t.Input,{placeholder:"搜索部门",prefix:e.createElement(Lo,null),value:A,onChange:e=>(e=>{if(G.current&&clearTimeout(G.current),D(e),!e)return O(!0),void l().then(e=>{const t=e.map(e=>({...e,children:void 0}));v(t),W(e=>e+1);const r=t.map(e=>e.key);P(r),r.length>0&&E(String(r[0]))}).finally(()=>O(!1));G.current=setTimeout(()=>{O(!0),l(void 0,e).then(e=>v(e)).finally(()=>O(!1))},300)})(e.target.value),allowClear:!0,style:{marginBottom:12},size:"small"}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:N&&!_&&!M},e.createElement(t.Tree,{key:H,treeData:b,onSelect:(e,t)=>{e.length>0?(E(String(e[0])),j(""),$(""),Q&&t?.node&&(ee(String(t.node.title||"")),X("users"))):b.length>0&&E(String(b[0].key))},loadData:A?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const r=await l(String(e));v(t=>fe(t,e,r))},showLine:!0,selectedKeys:_?[_]:[],expandedKeys:L,onExpand:P})))),e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column"}},e.createElement("style",null,"\n .steedos-user-selector-item:hover {\n background-color: #f0f7ff !important;\n border-color: #1890ff !important;\n }\n "),e.createElement("div",{style:{display:"flex",gap:8,marginBottom:12}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Lo,null),value:T,onChange:e=>de(e.target.value),allowClear:!0,style:{flex:1}}),o&&x.length>0&&e.createElement(t.Button,{onClick:ge},x.every(e=>R.find(t=>t._id===e._id))?"取消":"全选")),e.createElement("div",{style:{flex:1,overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:4,position:"relative"}},e.createElement(t.Spin,{spinning:N},x.length>0?e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"4px",padding:"0 8px"}},x.slice(0,ce).map(r=>{const n=!!R.find(e=>e._id===r._id);return e.createElement("div",{key:r._id,className:n&&o?"":"steedos-user-selector-item",onClick:()=>{o&&n||pe(r)},style:{padding:"10px 12px",borderRadius:4,cursor:"pointer",backgroundColor:q===r._id?"#e6f7ff":n&&o?"#f5f5f5":"transparent",borderColor:q===r._id||n&&o?"#1890ff":"transparent",borderWidth:1,borderStyle:"solid",transition:"all 0.2s",opacity:n&&o?.6:1,display:"flex",alignItems:"center",gap:12,minWidth:0}},e.createElement(t.Avatar,{src:r.avatar?`/api/v6/users/${r.user}/avatar`:r.avatar,size:40,style:{backgroundColor:r.avatar?void 0:"#1890ff",flexShrink:0}},!r.avatar&&r.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,marginBottom:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.organization?.name&&e.createElement("span",null,r.organization.name),r.position&&e.createElement("span",null," · ",r.position)),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.email||r.mobile||r.username)),n&&e.createElement(Eo,{style:{color:"#1890ff",flexShrink:0}}))})),ce<x.length&&e.createElement("div",{ref:ue,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!_&&!M||N?N?null:e.createElement(t.Empty,{description:"请选择部门或搜索",style:{marginTop:60}}):e.createElement(t.Empty,{description:"暂无人员",style:{marginTop:60}})))),e.createElement("div",{style:{width:240,borderLeft:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",R.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},R.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},R.map((r,n)=>e.createElement("div",{key:r._id,draggable:o,onDragStart:()=>(e=>{F(e)})(n),onDragEnd:he,onDragOver:e=>((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===z||z===t)return;const r=Date.now();if(r-K.current<100)return;K.current=r;const n=[...R],a=n[z];n.splice(z,1),n.splice(t,0,a),C(n),F(t)})(e,n),onMouseEnter:()=>U(r._id),onMouseLeave:()=>U(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:z===n?"#e6f7ff":"#f5f5f5",borderRadius:4,position:"relative",cursor:o?"grab":"default",transition:"all 0.3s ease",opacity:z===n?.5:1,border:z===n?"1px dashed #1890ff":"1px solid transparent",transform:z===n?"scale(0.98)":"scale(1)",boxShadow:z===n?"0 2px 8px rgba(0,0,0,0.1)":"none"}},e.createElement(t.Avatar,{src:r.avatar?`/api/v6/users/${r.user}/avatar`:r.avatar,size:32,style:{backgroundColor:r.avatar?void 0:"#1890ff",flexShrink:0}},!r.avatar&&r.name?.charAt(0)),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},r.name),f&&I===r._id&&e.createElement(Ro,{onClick:()=>me(r._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),f&&R.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>C([]),style:{marginTop:8,padding:0}},"清空全部")))),Q&&g&&e.createElement(Bo,{visible:g,multiple:o,loading:N,users:x,searchKeyword:M,searchInputValue:T,tempSelectedUsers:R,clearable:f,rootDeptInfo:se,deptPath:te,currentLevelDepts:ne,showSelectedPanel:oe,onDrillDown:xe,onMobileBack:Ee,onDrillBack:we,onBackToRoot:_e,onToggleSelectedPanel:()=>ie(e=>!e),onUserSearch:de,onAddUser:pe,onRemoveUser:me,onToggleUser:Se,onToggleSelectAll:ge,onReorderUsers:ke,onOk:be,onCancel:ve,onClearAll:()=>C([])}))};function Jo(e={}){return{...e}}async function Go(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Jo({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await r.json();return(n.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Jo({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),n=await r.json();return(n.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:Jo()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}}function Ko(e,t){for(const r of e){if(r.key===t)return r;if(r.children){const e=Ko(r.children,t);if(e)return e}}return null}async function Zo(e,t){try{const r=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,n=await fetch("/graphql",{method:"POST",headers:Jo({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),a=await n.json(),o=a.data?.node?.[0];if(!o)return t;if(o.fullname)return o.fullname;const i=[o.name];let s=o.parent;for(;s;)i.unshift(s.name),s=s.parent;return i.join(" / ")}catch{return t}}const Qo=r=>{const{value:n,onChange:a,multiple:o=!1,placeholder:i="请选择部门/分组",fetchDeptTree:s=Go,style:l,dispatchEvent:c,data:u,isTableMode:f=!1,hasError:d=!1,formalTableMode:p=!1}=r,[m,h]=e.useState([]),g=e.useRef(null),[y,b]=e.useState(!1),[v,x]=e.useState(new Map),[w,_]=e.useState([]),E=e.useRef(null);e.useEffect(()=>{g.current={props:r}}),e.useEffect(()=>{e.startTransition(()=>b(!0)),s().then(e=>{h(e);const t=e.map(e=>String(e.key));_(t);const r=(e,t="")=>e.map(e=>{const n=e.fullname||(t?`${t} / ${e.title}`:e.title);return{...e,pathLabel:n,children:e.children?r(e.children,n):void 0}}),n=r(e);h(n);const a=new Map,o=e=>{e.forEach(e=>{a.set(e.key,e.pathLabel),e.children&&o(e.children)})};o(n),x(a)}).finally(()=>b(!1))},[s]),e.useEffect(()=>{const e=Array.isArray(n)?n:n?[String(n)]:[];if(0===e.length)return;const t=(e,r)=>{for(const n of e){if(n.key===r)return!0;if(n.children&&t(n.children,r))return!0}return!1},r=e.filter(e=>!t(m,String(e)));if(r.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(r)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Jo({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(async e=>{const t=(e.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!0,pathLabel:e.fullname||e.name,isExtra:!0}));t.length>0&&(h(e=>{const r=new Set,n=e=>{e.forEach(e=>{r.add(e.key),e.children&&n(e.children)})};n(e);const a=t.filter(e=>!r.has(e.key));return 0===a.length?e:[...e,...a]}),x(e=>{const r=new Map(e);return t.forEach(e=>r.set(e.key,e.pathLabel)),r}))})}},[n,m]);const k=(e,t,r)=>e.map(e=>e.key===t?{...e,children:r}:e.children?{...e,children:k(e.children,t,r)}:e);return e.createElement(t.Spin,{spinning:y,className:"steedos-org-selector"},e.createElement(t.TreeSelect,{treeData:m,className:"w-full "+(f?"picker-table-mode":""),value:o?(Array.isArray(n)?n:n?[n]:[]).map(e=>({value:String(e),label:v.get(String(e))||e})):n,onChange:async(e,t,r)=>{let n=e;if(o&&e&&(Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&"value"in e[0]?n=e.map(e=>e.value):Array.isArray(e)?n=e:"object"==typeof e&&"value"in e&&(n=e.value)),a||c){const e=async e=>{const t=await(c?.("change",e?S(u,{value:e}):u,g.current));t?.prevented||a?.(e)};if(Array.isArray(n))Promise.all(n.map(async e=>{const t=v.get(String(e));if(!t||!t.includes("/")){const t=Ko(m,String(e));if(t){const r=await Zo(String(e),t.title),n=new Map(v);return n.set(String(e),r),x(n),r}}return t})).then(t=>{e(n)});else if(n){const t=v.get(String(n));if(t&&t.includes("/"))e(n);else{const t=Ko(m,String(n));t?Zo(String(n),t.title).then(t=>{const r=new Map(v);r.set(String(n),t),x(r),e(n)}):e(n)}}else await e(n)}},treeCheckable:o,showCheckedStrategy:o?void 0:t.TreeSelect.SHOW_PARENT,placeholder:i,variant:f?"borderless":"outlined",style:{minWidth:196,...l,...f?{backgroundColor:d?"rgba(254,226,226,0.9)":p?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,width:"100%",fontSize:13}:{}},loadData:async e=>{if(e.children)return;b(!0);const t=await s(String(e.key));h(r=>{const n=new Set(t.map(e=>e.key)),a=r.filter(e=>!(e.isExtra&&n.has(e.key))),o=e.pathLabel||e.title,i=t.map(e=>({...e,pathLabel:e.fullname||`${o} / ${e.title}`})),s=k(a,String(e.key),i),l=new Map(v);return i.forEach(e=>{l.set(e.key,e.pathLabel)}),x(l),s}),b(!1)},treeDefaultExpandAll:!1,treeExpandedKeys:w,onTreeExpand:e=>{_(e.map(e=>String(e)))},allowClear:!0,multiple:o,treeCheckStrictly:o,treeLine:!0,styles:{popup:{root:{minWidth:400,maxWidth:450,maxHeight:700,overflow:"auto",zIndex:3e3}}},treeNodeLabelProp:"pathLabel",showSearch:!0,onSearch:e=>{if(E.current&&clearTimeout(E.current),!e)return b(!0),void s().then(e=>{const t=(e,r="")=>e.map(e=>{const n=r?`${r} / ${e.title}`:e.title;return{...e,pathLabel:n,children:e.children?t(e.children,n):void 0}}),r=t(e);h(r);const n=new Map,a=e=>{e.forEach(e=>{n.set(e.key,e.pathLabel),e.children&&a(e.children)})};a(r),x(n)}).finally(()=>b(!1));b(!0),E.current=setTimeout(async()=>{const t=(await s(void 0,e)).map(e=>({...e,title:e.fullname||e.title,pathLabel:e.fullname||e.title}));h(t);const r=new Map;t.forEach(e=>{r.set(e.key,e.pathLabel)}),x(r),b(!1)},300)},filterTreeNode:!1,maxTagCount:"responsive",listHeight:600}))};function Xo(e={}){return{...e}}function ei({value:t,isTableMode:r=!1}){const[n,a]=e.useState(new Map),o=t?t.split(",").map(e=>e.trim()).filter(Boolean):[];e.useEffect(()=>{if(0===o.length)return;const e=o.filter(e=>!n.has(e));if(0===e.length)return;const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name}}`;fetch("/graphql",{method:"POST",headers:Xo({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];a(e=>{const r=new Map(e);for(const n of t)n.user&&n.name&&r.set(n.user,n.name);return r})}).catch(()=>{})},[t]);const i=r?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 bg-gray-50/60 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 bg-gray-50 min-h-[38px]";return 0===o.length?React.createElement("div",{className:i},React.createElement("span",{className:"text-gray-400"},"—")):React.createElement("div",{className:i},React.createElement("div",{className:"flex flex-wrap gap-1.5"},o.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},n.get(e)||e))))}function ti(e={}){return{...e}}function ri({value:t,isTableMode:r=!1}){const[n,a]=e.useState(new Map),o=t?t.split(",").map(e=>e.trim()).filter(Boolean):[];e.useEffect(()=>{if(0===o.length)return;const e=o.filter(e=>!n.has(e));if(0===e.length)return;const t=`{rows:organizations(filters: [["_id","in",${JSON.stringify(e)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:ti({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];a(e=>{const r=new Map(e);for(const n of t)n._id&&r.set(n._id,n.fullname||n.name||n._id);return r})}).catch(()=>{})},[t]);const i=r?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 bg-gray-50/60 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 bg-gray-50 min-h-[38px]";return 0===o.length?React.createElement("div",{className:i},React.createElement("span",{className:"text-gray-400"},"—")):React.createElement("div",{className:i},React.createElement("div",{className:"flex flex-wrap gap-1.5"},o.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},n.get(e)||e))))}function ni({field:r,value:n,onChange:a,isTableMode:o=!1,hasError:i=!1,minimal:s=!1,onFillFields:l,formValues:u,formalTableMode:f=!1}){const d=e.useRef(null),[p,m]=e.useState([]),h=o?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${f?i?"bg-red-100/90 focus:bg-red-50":"bg-transparent focus:bg-blue-50/30":i?"bg-red-100/90 focus:bg-red-50":"bg-amber-50/80 focus:bg-amber-50"}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(i?"border-red-200 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),g=r.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"";if(r.readonly){const e=o?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 bg-gray-50/60 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 bg-gray-50 min-h-[38px]";if("formula"===r.type||"approvalComments"===r.type);else{if("checkbox"===r.type)return React.createElement("label",{className:"flex items-center gap-2 py-1 "+(o?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===n,disabled:!0,readOnly:!0,className:"w-4 h-4 rounded border-gray-300 text-indigo-600"}),React.createElement("span",{className:"text-[13px] text-gray-500"},r.label));if("radio"===r.type)return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(o?"px-2.5 py-2":"px-1")},(r.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-default text-[13px] "+(e.value===n?"text-gray-700":"text-gray-400")},React.createElement("input",{type:"radio",name:r._id,checked:n===e.value,disabled:!0,readOnly:!0,className:"w-4 h-4 text-indigo-600 border-gray-300"}),e.label)));if("select"===r.type){const t=(r.options||[]).find(e=>e.value===n);return React.createElement("div",{className:e},t?.label||n||"")}if("file"===r.type||"image"===r.type){if(0===p.length)return React.createElement("div",{className:e})}else{if("member"===r.type||"memberMulti"===r.type)return React.createElement(ei,{value:n,isTableMode:o});if("org"===r.type||"orgMulti"===r.type)return React.createElement(ri,{value:n,isTableMode:o});if("lookup"!==r.type)return React.createElement("div",{className:e},n||"")}}}const y=e=>a(Array.isArray(e)?e.join(","):e);switch(r.type){case"text":return React.createElement("input",{type:"text",value:n,onChange:e=>a(e.target.value),placeholder:r.placeholder||"请输入",readOnly:r.readonly,maxLength:r.maxLength,className:`${h} ${g}`});case"textarea":return React.createElement("textarea",{value:n,onChange:e=>a(e.target.value),placeholder:r.placeholder||"请输入内容...",readOnly:r.readonly,maxLength:r.maxLength,rows:3,className:`${h} ${g} resize-none`});case"number":{const e=e=>{if(!r.thousandSeparator||""===e||void 0===e)return e;const t=Number(e);return isNaN(t)?e:null!=r.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:r.precision,maximumFractionDigits:r.precision}):t.toLocaleString("zh-CN")};return r.thousandSeparator&&!r.readonly?React.createElement("input",{type:"text",defaultValue:e(n),key:`num-${r._id}-${n}`,onFocus:e=>{e.target.value=n},onBlur:t=>{const r=t.target.value.replace(/,/g,"");a(r),t.target.value=e(r)},placeholder:r.placeholder||"请输入数字",className:`${h}`}):React.createElement("input",{type:"number",value:n,onChange:e=>a(e.target.value),placeholder:r.placeholder||"请输入数字",readOnly:r.readonly,min:r.min,max:r.max,step:r.precision?Math.pow(10,-r.precision):void 0,className:`${h} ${g}`})}case"date":return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.DatePicker,{value:n?c(n):null,onChange:(e,t)=>a("string"==typeof t?t:""),disabled:r.readonly,placeholder:"选择日期",className:"!w-full "+(o?"picker-table-mode":""),variant:o?"borderless":"outlined",style:{width:"100%",fontSize:13,...o?{backgroundColor:i?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...i?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:n?c(n):null,onChange:(e,t)=>a("string"==typeof t?t:""),disabled:r.readonly,placeholder:"选择日期时间",className:"!w-full "+(o?"picker-table-mode":""),variant:o?"borderless":"outlined",style:{width:"100%",fontSize:13,...o?{backgroundColor:i?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...i?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.TimePicker,{value:n?c(n,"HH:mm"):null,onChange:(e,t)=>a("string"==typeof t?t:""),format:"HH:mm",disabled:r.readonly,placeholder:"选择时间",className:"!w-full "+(o?"picker-table-mode":""),variant:o?"borderless":"outlined",style:{width:"100%",fontSize:13,...o?{backgroundColor:i?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...i?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.Select,{value:n||void 0,onChange:e=>a(e??""),disabled:r.readonly,placeholder:"请选择",className:"!w-full "+(o?"picker-table-mode":""),variant:o?"borderless":"outlined",style:{width:"100%",fontSize:13,...o?{backgroundColor:i?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...i?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(r.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:qt},React.createElement(t.Select,{mode:"multiple",value:n?Array.isArray(n)?n:String(n).split(",").filter(Boolean):[],onChange:e=>a(e.join(",")),disabled:r.readonly,placeholder:"请选择(多选)",className:"!w-full "+(o?"picker-table-mode":""),variant:o?"borderless":"outlined",style:{width:"100%",fontSize:13,minHeight:34,...o?{backgroundColor:i?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...i?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(r.options||[]).map(e=>({label:e.label,value:e.value}))}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(o?"px-2.5 py-2":"px-1")},(r.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-pointer text-[13px] text-gray-700"},React.createElement("input",{type:"radio",name:r._id,value:e.value,checked:n===e.value,onChange:e=>a(e.target.value),disabled:r.readonly,className:"w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-200"}),e.label)),(!r.options||0===r.options.length)&&React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"));case"checkbox":return React.createElement("label",{className:"flex items-center gap-2 cursor-pointer py-1 "+(o?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===n,onChange:e=>a(e.target.checked?"true":"false"),disabled:r.readonly,className:"w-4 h-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-200"}),React.createElement("span",{className:"text-[13px] text-gray-700"},r.label));case"file":return React.createElement(React.Fragment,null,React.createElement("input",{ref:d,type:"file",className:"hidden",accept:r.accept||void 0,multiple:!!r.multiple,onChange:e=>{const t=e.target.files;if(!t||0===t.length)return;const n=Array.from(t).map(e=>({name:e.name,id:`local_${Date.now()}_${Math.random().toString(36).slice(2,6)}`})),o=r.multiple?[...p,...n]:n;m(o),a(o.map(e=>e.name).join(", ")),e.target.value=""}}),React.createElement("div",{onClick:()=>!r.readonly&&d.current?.click(),className:`${o?`w-full h-full flex flex-col items-center justify-center text-center ${f?"bg-transparent":"bg-amber-50/80"} px-2 py-2`:"border border-dashed border-gray-300 rounded-md px-4 py-3 text-center"} ${r.readonly?"bg-gray-50":o?"cursor-pointer":"hover:border-indigo-400 hover:bg-indigo-50/30 cursor-pointer"} smooth-transition`},p.length>0?React.createElement("div",{className:"text-left w-full"},React.createElement(Vt,{files:p,onRemove:e=>{const t=p.filter(t=>t.id!==e);m(t),a(t.map(e=>e.name).join(", "))}})):React.createElement(React.Fragment,null,React.createElement(B,{className:"w-5 h-5 text-gray-400 mx-auto mb-1"}),React.createElement("p",{className:"text-[12px] text-gray-500"},r.readonly?"仅读模式":"点击上传文件"),r.accept&&React.createElement("p",{className:"text-[10px] text-gray-400 mt-0.5"},"支持格式: ",r.accept))));case"image":return React.createElement(React.Fragment,null,React.createElement("input",{ref:d,type:"file",className:"hidden",accept:"image/*",multiple:!!r.pickerMultiple,onChange:e=>{const t=e.target.files;if(!t||0===t.length)return;const n=Array.from(t).map(e=>({name:e.name,id:`local_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,url:URL.createObjectURL(e)})),o=r.pickerMultiple?[...p,...n]:n;r.pickerMultiple||p.forEach(e=>e.url&&URL.revokeObjectURL(e.url)),m(o),a(o.map(e=>e.name).join(", ")),e.target.value=""}}),React.createElement("div",{className:`${o?`w-full h-full flex flex-col items-center justify-center text-center ${f?"bg-transparent":"bg-amber-50/80"} px-2 py-2`:"border border-dashed border-gray-300 rounded-md px-4 py-3 text-center"} ${r.readonly?"bg-gray-50":o?"cursor-pointer":"hover:border-rose-400 hover:bg-rose-50/30 cursor-pointer"} smooth-transition`},p.length>0?React.createElement("div",{className:"w-full"},React.createElement("div",{className:"flex flex-wrap gap-2"},p.map(e=>React.createElement("div",{key:e.id,className:"relative group"},React.createElement("img",{src:e.url,alt:e.name,className:"w-20 h-20 object-cover rounded-md border border-gray-200"}),!r.readonly&&React.createElement("button",{onClick:t=>{t.stopPropagation(),e.url&&URL.revokeObjectURL(e.url);const r=p.filter(t=>t.id!==e.id);m(r),a(r.map(e=>e.name).join(", "))},className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-red-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 smooth-transition"},React.createElement(Y,{className:"w-2.5 h-2.5"})))),!r.readonly&&React.createElement("div",{onClick:()=>d.current?.click(),className:"w-20 h-20 rounded-md border-2 border-dashed border-gray-300 flex flex-col items-center justify-center text-gray-400 hover:border-rose-400 hover:text-rose-400 cursor-pointer smooth-transition"},React.createElement(P,{className:"w-5 h-5"}),React.createElement("span",{className:"text-[10px] mt-0.5"},"添加")))):React.createElement("div",{onClick:()=>!r.readonly&&d.current?.click()},React.createElement(D,{className:"w-5 h-5 text-gray-400 mx-auto mb-1"}),React.createElement("p",{className:"text-[12px] text-gray-500"},r.readonly?"仅读模式":r.pickerMultiple?"点击上传图片(多选)":"点击上传图片"),React.createElement("p",{className:"text-[10px] text-gray-400 mt-0.5"},"支持 JPG、PNG、GIF 等图片格式"))));case"member":return React.createElement(Vo,{value:n,onChange:y,multiple:!1,isTableMode:o,hasError:i,formalTableMode:f,minimal:s});case"memberMulti":return React.createElement(Vo,{value:n,onChange:y,multiple:!0,isTableMode:o,hasError:i,formalTableMode:f,minimal:s});case"org":return React.createElement(Qo,{value:n,onChange:y,multiple:!1,isTableMode:o,hasError:i,formalTableMode:f});case"orgMulti":return React.createElement(Qo,{value:n,onChange:y,multiple:!0,isTableMode:o,hasError:i,formalTableMode:f});case"lookup":return React.createElement(va,{field:r,value:n,onChange:a,onFillFields:l,isTableMode:o,hasError:i,formValues:u});case"formula":return React.createElement("div",{className:`${o?"overflow-hidden":"border border-gray-200 rounded-md bg-gray-50"} px-3 py-2 text-[13px] font-mono ${n.startsWith("#ERR")?"text-red-400 text-[11px]":n?"text-gray-800":"text-gray-400"} truncate`,title:n.startsWith("#ERR")?n:r.formula?`= ${r.formula}`:""},o?n.startsWith("#ERR")?n:n||"—":n||(r.formula?`= ${r.formula}`:"(自动计算)"));case"approvalComments":{const e=r.approvalCommentSteps||[];return 0===e.length?React.createElement("div",{className:(o?"px-2.5 py-2":"border border-dashed border-purple-300 rounded-md px-4 py-3")+" flex items-center gap-2 text-gray-400"},React.createElement(L,{className:"w-4 h-4 shrink-0 text-purple-400"}),React.createElement("span",{className:"text-[12px]"},"审批意见(未绑定步骤)")):React.createElement("div",{className:(o?"":"border border-purple-200 rounded-md")+" bg-white overflow-hidden"},e.map((e,t)=>React.createElement("div",{key:e.stepId||t,className:(t>0?"border-t border-purple-100":"")+" px-3 py-2.5"},React.createElement("div",{className:"flex items-center gap-1.5 mb-2"},React.createElement(L,{className:"w-3.5 h-3.5 text-purple-500 shrink-0"}),React.createElement("span",{className:"text-[12px] font-medium text-gray-700"},e.stepLabel||e.stepId||"步骤"),React.createElement("div",{className:"flex gap-1 ml-auto"},e.showCirculateComments&&React.createElement("span",{className:"text-[9px] bg-blue-100 text-blue-600 rounded px-1 py-0.5"},"传阅意见"),e.showHandlerComments&&React.createElement("span",{className:"text-[9px] bg-green-100 text-green-600 rounded px-1 py-0.5"},"处理意见"),e.showSignature&&React.createElement("span",{className:"text-[9px] bg-amber-100 text-amber-600 rounded px-1 py-0.5"},"图片签名"))),React.createElement("div",{className:"space-y-1.5"},React.createElement("div",{className:"flex items-start gap-2 bg-purple-50/60 border border-purple-100 rounded-md px-2.5 py-2"},React.createElement("div",{className:"w-6 h-6 rounded-full bg-purple-200 flex items-center justify-center shrink-0 mt-0.5"},React.createElement("span",{className:"text-[9px] font-medium text-purple-700"},"张")),React.createElement("div",{className:"flex-1 min-w-0"},React.createElement("div",{className:"flex items-center gap-2 mb-0.5"},React.createElement("span",{className:"text-[11px] font-medium text-gray-700"},"张三"),React.createElement("span",{className:"text-[10px] text-gray-400"},"2026-01-15 14:30"),React.createElement("span",{className:"text-[9px] bg-green-100 text-green-700 rounded px-1"},"核准")),React.createElement("p",{className:"text-[12px] text-gray-600 leading-relaxed"},e.defaultComment||"已审阅,同意。"),e.showSignature&&React.createElement("div",{className:"mt-1 border border-dashed border-purple-200 rounded px-2 py-1 text-[10px] text-gray-400 inline-block"},"[签名图片]")))))))}default:return React.createElement("input",{type:"text",value:n,onChange:e=>a(e.target.value),placeholder:"请输入",className:h})}}function ai(e){const t=Number(e);if(isNaN(t)||!isFinite(t))return"";if(0===t)return"零元整";const r=t<0,n=Math.abs(t),a=Math.floor(n),o=Math.round(100*(n-a)),i=Math.floor(o/10),s=o%10,l=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],c=["","拾","佰","仟"],u=["","万","亿","兆"];function f(e){if(0===e)return"";let t="",r=!1;for(let n=3;n>=0;n--){const a=Math.floor(e/Math.pow(10,n))%10;0===a?t.length>0&&(r=!0):(r&&(t+="零",r=!1),t+=l[a]+c[n])}return t}let d=(function(e){if(0===e)return"";const t=[];let r=e;for(;r>0;)t.push(r%1e4),r=Math.floor(r/1e4);let n="";for(let a=t.length-1;a>=0;a--){const e=t[a];if(0===e)n.length>0&&!n.endsWith("零")&&(n+="零");else{const t=f(e);n.length>0&&e<1e3&&!n.endsWith("零")&&(n+="零"),n+=t+u[a]}}return n.replace(/零+$/,"")}(a)||"零")+"元";return 0===i&&0===s?d+="整":0===i?d+="零"+l[s]+"分":(d+=l[i]+"角",d+=s>0?l[s]+"分":"整"),(r?"负":"")+d}c.extend(d),c.extend(h),c.extend(b),c.locale("zh-cn");const oi={SUM:(...e)=>e.reduce((e,t)=>e+(Number(t)||0),0),AVG:(...e)=>e.length?e.reduce((e,t)=>e+(Number(t)||0),0)/e.length:0,AVERAGE:(...e)=>e.length?e.reduce((e,t)=>e+(Number(t)||0),0)/e.length:0,MAX:(...e)=>Math.max(...e.map(Number)),MIN:(...e)=>Math.min(...e.map(Number)),COUNT:(...e)=>e.filter(e=>0!==e&&""!==e&&null!=e).length,ABS:e=>Math.abs(Number(e)),ROUND:(e,t=0)=>{const r=Math.pow(10,Number(t));return Math.round(Number(e)*r)/r},FLOOR:e=>Math.floor(Number(e)),CEIL:e=>Math.ceil(Number(e)),INT:e=>Math.trunc(Number(e)),MOD:(e,t)=>Number(e)%Number(t),POWER:(e,t)=>Math.pow(Number(e),Number(t)),SQRT:e=>Math.sqrt(Number(e)),IF:(e,t,r)=>e?t:r,AND:(...e)=>e.every(e=>!!e),OR:(...e)=>e.some(e=>!!e),NOT:e=>!e,ISNULL:e=>null==e||""===e,ISBLANK:e=>null==e||""===e,TODAY:()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},NOW:()=>(new Date).toISOString(),DATE:(e,t,r)=>new Date(Number(e),Number(t)-1,Number(r)).toISOString().split("T")[0],YEAR:e=>(e?new Date(e):new Date).getFullYear(),MONTH:e=>(e?new Date(e):new Date).getMonth()+1,DAY:e=>(e?new Date(e):new Date).getDate(),DATEDIF:(e,t,r)=>{if(!e||!t)return 0;const n=new Date(e),a=new Date(t),o=a.getTime()-n.getTime(),i=String(r).toUpperCase();return"D"===i?Math.floor(o/864e5):"M"===i?12*(a.getFullYear()-n.getFullYear())+(a.getMonth()-n.getMonth()):"Y"===i?a.getFullYear()-n.getFullYear():Math.floor(o/864e5)},DAYS:(e,t)=>t&&e?Math.floor((new Date(e).getTime()-new Date(t).getTime())/864e5):0,CONCAT:(...e)=>e.join(""),LEFT:(e,t)=>String(e).substring(0,Number(t)),RIGHT:(e,t)=>{const r=String(e);return r.substring(r.length-Number(t))},MID:(e,t,r)=>String(e).substring(Number(t)-1,Number(t)-1+Number(r)),LEN:e=>String(e).length,UPPER:e=>String(e).toUpperCase(),LOWER:e=>String(e).toLowerCase(),TRIM:e=>String(e).trim(),REPLACE:(e,t,r)=>String(e).split(String(t)).join(String(r)),FIND:(e,t)=>{const r=String(t).indexOf(String(e));return r>=0?r+1:0},TEXT:(e,t)=>{const r=String(t||"");if("rmb"===r.toLowerCase()||r.includes("[DBNum2]")||r.includes("DBNum2"))return ai(e);const n=Number(e);if(isNaN(n))return String(e);if(r.includes(".")){const e=r.split(".")[1]?.length||0;return n.toFixed(e)}return String(n)},RMB:e=>ai(e),CNY:e=>ai(e)},ii=Object.keys(oi),si=Object.values(oi);function li(e,t){if(!e)return"";const r=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),n=e.map(e=>{const r=t[e];if(null==r||""===r)return 0;const n=Number(r);return isNaN(n)?r:n});return r.replace(/\$\{([^}]+)\}/g,(t,r)=>{try{const t=[],a=[],o=new Set([...ii,...e]),i=r.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const e of i)o.has(e)||(o.add(e),t.push(e),a.push(0));const s=new Function(...ii,...e,...t,`return (${r});`)(...si,...n,...a);return null==s?"":"number"==typeof s?isNaN(s)?"":isFinite(s)?String(Math.round(1e4*s)/1e4):"#ERR: 除以零":String(s)}catch(a){return`#ERR: ${a instanceof Error?a.message:String(a)}`}})}catch(n){const t=n instanceof Error?n.message:String(n);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function ci(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function ui({field:r,isTableMode:n=!1,searchUsersFn:a,searchOrgsFn:o,searchObjectFn:i,value:s,onChange:l,fieldPermissions:c}){const u=r.children||[];console.log("SubTablePreview fieldPermissions",c);const f=e.useMemo(()=>c?u.filter(e=>"hidden"!==c[e.name]).map(e=>{const t=c[e.name];return console.log("SubTablePreview perm",t,e.name),"editable"===t?e:"readonly"===t?{...e,readonly:!0}:e}):u,[u,c]),d=void 0!==l,[p,m]=e.useState([{}]),h=d?ci(s).length>0?ci(s):[{}]:p,[g,y]=e.useState(s);d&&s!==g&&y(s);const b=e=>{d?l(JSON.stringify(e)):m(e)},v=f.filter(e=>"formula"===e.type&&e.formula),x=e=>{if(0===v.length)return e;let t={...e};for(const r of v){const e=li(r.formula,t);t[r.name]!==e&&(t={...t,[r.name]:e})}return t},w=e.useMemo(()=>0===v.length?h:h.map(x),[h,v.map(e=>e.name+":"+e.formula).join(",")]),[_,E]=e.useState(null),[k,S]=e.useState({}),R=e.useCallback(e=>{E(e),S({...h[e]||{}})},[h]),C=e.useCallback((e,t)=>{S(r=>{const n={...r,[e]:t};return x(n)})},[x]),N=e.useCallback(()=>{if(null===_)return;const e=[...h];e[_]=x(k),b(e),E(null)},[_,k,h,b,x]),O=e.useCallback(()=>{E(null)},[]);if(0===f.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const M=n?"border-black":"border-gray-200",j=!!r.readonly,T=e.useMemo(()=>0===v.length?k:x(k),[k,v.map(e=>e.name+":"+e.formula).join(",")]),$=null!==_&&React.createElement(t.Modal,{open:!0,title:`${r.label} - 第 ${_+1} 行`,onCancel:O,onOk:N,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:O},"取消"),React.createElement(t.Button,{type:"primary",onClick:N},"确认")),width:"min(780px, 95vw)",destroyOnClose:!0,styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:"16px 0 24px"}}},React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-5"},f.map(e=>{const t="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:t?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&!j&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(ni,{field:j?{...e,readonly:!0}:e,value:T[e.name]||"",onChange:t=>C(e.name,t),isTableMode:!1,searchUsersFn:a,searchOrgsFn:o,searchObjectFn:i}))})));return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?"border-t border-black overflow-hidden":"border border-gray-300 rounded-md overflow-hidden"},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"w-full text-[13px]",style:{minWidth:f.length>3?120*f.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${M}`},React.createElement("th",{className:`w-10 px-2 py-2 text-center text-gray-500 font-medium border-r ${M} sticky left-0 bg-gray-50 z-[1]`},"#"),f.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${M} last:border-r-0 whitespace-nowrap`},e.label,e.required&&!e.readonly&&!j&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*"))),!j&&React.createElement("th",{className:"w-16 px-2 py-2 text-center text-gray-500 font-medium sticky right-0 bg-gray-50 z-[1]"},"操作"))),React.createElement("tbody",null,w.map((e,t)=>React.createElement("tr",{key:t,className:`border-b ${n?"border-black":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`},React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-400 text-[12px] border-r ${M} sticky left-0 bg-white z-[1]`},t+1),f.map(r=>React.createElement("td",{key:r._id,className:`${n?"p-0":"px-2 py-1.5"} border-r ${M} last:border-r-0 ${!n||r.readonly||j?"":"bg-amber-50/80"}`},React.createElement(ni,{field:j?{...r,readonly:!0}:r,value:e[r.name]||"",onChange:e=>((e,t,r)=>{const n=[...h];n[e]={...n[e],[t]:r},n[e]=x(n[e]),b(n)})(t,r.name,e),isTableMode:n,formalTableMode:!0,searchUsersFn:a,searchOrgsFn:o,searchObjectFn:i}))),!j&&React.createElement("td",{className:"px-1 py-1.5 text-center sticky right-0 bg-white z-[1]"},React.createElement("div",{className:"flex items-center justify-center gap-0.5"},React.createElement("button",{onClick:()=>R(t),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(F,{className:"w-3 h-3"})),h.length>1&&React.createElement("button",{onClick:()=>{return e=t,b(h.filter((t,r)=>r!==e)),void(_===e?E(null):null!==_&&_>e&&E(_-1));var e},className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(U,{className:"w-3 h-3"}))))))))),React.createElement("div",{className:n?"border-t border-black":"border-t border-gray-100"},!j&&React.createElement("button",{onClick:()=>b([...h,{}]),className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition px-3 py-1.5"},React.createElement(P,{className:"w-3.5 h-3.5"})," 添加一行"))),$)}function fi(e,t){return`${e}_${t}`}function di({field:t,isTableMode:r=!1,formValues:n,onUpdateValue:a,onFillFields:o,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:l,fieldPermissions:c,formMode:u="editable"}){const f=t.gridRows||3,d=t.gridCols||4,p=t.gridData||[],m=t.children||[],h=e.useMemo(()=>"editable"!==u?m.map(e=>({...e,readonly:!0})):c?m.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):m,[m,c,u]),g=e.useMemo(()=>{const e=new Map;for(const t of h)e.set(t._id,t);return e},[h]),y=e.useMemo(()=>function(e){const t=new Set;for(const r of e){const e=r.rowspan||1,n=r.colspan||1;for(let a=0;a<e;a++)for(let e=0;e<n;e++)0===a&&0===e||t.add(fi(r.row+a,r.col+e))}return t}(p),[p]),b=e.useMemo(()=>{const e=p.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const r of e){t[fi(r.row,r.col)]=li(r.value,n)}return t},[n,p]),v=r?"border-black":"border-gray-300",x=t.gridColumnWidths,w=!!t.gridScrollable;return React.createElement("div",{className:r?"":"mt-1"},React.createElement("div",{className:r?"border-t border-black":`border ${v}`,style:r?{overflow:"hidden"}:void 0},React.createElement("div",{className:w?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(w?"table-fixed":""),style:{minWidth:w&&d>4?100*d+"px":void 0,...r?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:d},(e,t)=>React.createElement("col",{key:t,style:x?.[t]?{width:`${x[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:f},(e,t)=>React.createElement("tr",{key:t,className:""+(t<f-1?`border-b ${v}`:"")},Array.from({length:d},(e,u)=>{const f=fi(t,u);if(y.has(f))return null;const m=function(e,t,r){return e.find(e=>e.row===t&&e.col===r)}(p,t,u),h=m?.rowspan||1,x=m?.colspan||1,_=u+x>=d,E=m?.cellType||"input",k={textAlign:m?.align||("label"===E?"center":"left")};if(m?.color&&(k.color=m.color),m?.backgroundColor&&(k.backgroundColor=m.backgroundColor),m?.fontWeight&&(k.fontWeight=m.fontWeight),m?.borderStyle&&(k.borderStyle=m.borderStyle),"label"===E)return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${_?"":`border-r ${v}`} ${m?.backgroundColor?"":"bg-white"} ${m?.color?"":"text-gray-600"} ${m?.fontWeight?"":"font-medium"}`,style:k},m?.value||"");if("formula"===E){const e=b[f]||"";return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${_?"":`border-r ${v}`} ${m?.backgroundColor?"":r?"bg-amber-50/50":""} ${m?.color?"":"text-gray-700"}`,style:w?{...k,maxWidth:0}:k},React.createElement("div",{className:w?"truncate":"",title:e},e))}const S=m?.fieldId?g.get(m.fieldId):null;if(!S&&!m?.fieldType)return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(_?"":`border-r ${v}`),style:k}," ");if(S){if(S.hidden)return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(_?"":`border-r ${v}`),style:k}," ");const e=S.name,t=n[e]||"";if("table"===S.type)return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(_?"":`border-r ${v}`),style:k},React.createElement(ui,{field:S,isTableMode:r,value:t,onChange:t=>a(e,t),searchUsersFn:i,searchOrgsFn:s,searchObjectFn:l,fieldPermissions:c}));const f=!S.readonly&&r?"bg-amber-50/80":"";return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:`p-0 ${_?"":`border-r ${v}`} ${f} ${w?"overflow-hidden":""}`,style:w?{...k,maxWidth:0}:k},React.createElement(ni,{field:S,value:t,onChange:t=>a(e,t),isTableMode:!0,formalTableMode:!0,searchUsersFn:i,searchOrgsFn:s,onFillFields:o,formValues:n}))}return React.createElement("td",{key:u,rowSpan:h>1?h:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(_?"":`border-r ${v}`),style:k},React.createElement("input",{type:"number"===m?.fieldType?"number":"text",className:"w-full h-full px-3 py-2 text-[13px] bg-transparent outline-none focus:bg-blue-50/50",value:n[f]||"",onChange:e=>a(f,e.target.value),placeholder:m?.fieldLabel||m?.value||""}))}))))))))}const pi=e=>(e.colspan??6)>=12,mi=e=>"section"===e||"table"===e||"grid"===e;const hi=[{name:"indigo",label:"靛蓝",primary:"#6366f1",title:"#4338ca",bg:"#eef2ff",border:"#818cf8",desc:"#818cf8"},{name:"emerald",label:"翡翠绿",primary:"#10b981",title:"#047857",bg:"#ecfdf5",border:"#34d399",desc:"#6ee7b7"},{name:"amber",label:"琥珀",primary:"#f59e0b",title:"#92400e",bg:"#fffbeb",border:"#fbbf24",desc:"#fbbf24"},{name:"rose",label:"玫瑰红",primary:"#f43f5e",title:"#be123c",bg:"#fff1f2",border:"#fb7185",desc:"#fda4af"},{name:"sky",label:"天蓝",primary:"#0ea5e9",title:"#0369a1",bg:"#f0f9ff",border:"#38bdf8",desc:"#7dd3fc"},{name:"violet",label:"紫罗兰",primary:"#8b5cf6",title:"#6d28d9",bg:"#f5f3ff",border:"#a78bfa",desc:"#c4b5fd"},{name:"slate",label:"石板灰",primary:"#64748b",title:"#334155",bg:"#f8fafc",border:"#94a3b8",desc:"#94a3b8"},{name:"orange",label:"橙色",primary:"#f97316",title:"#c2410c",bg:"#fff7ed",border:"#fb923c",desc:"#fdba74"},{name:"teal",label:"青色",primary:"#14b8a6",title:"#0f766e",bg:"#f0fdfa",border:"#2dd4bf",desc:"#5eead4"}];function gi(e){const t=e.replace("#","");return 3===t.length?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:6===t.length?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:null}function yi(e,t,r){return"#"+[e,t,r].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function bi(e,t){const r=gi(e);return r?yi(r.r+(255-r.r)*t,r.g+(255-r.g)*t,r.b+(255-r.b)*t):e}function vi(e,t){const r=gi(e);return r?yi(r.r*(1-t),r.g*(1-t),r.b*(1-t)):e}function xi(e){if(e.sectionColor){const r={name:"custom",label:"自定义",primary:t=e.sectionColor,title:vi(t,.35),bg:bi(t,.92),border:bi(t,.35),desc:bi(t,.35)};return{...r,title:e.titleColor||r.title}}var t;const r=hi.find(t=>t.name===e.colorScheme)||hi[0];return{...r,title:e.titleColor||r.title}}function wi(e,t,r){if(!e?.length)return!1;const n=e.map(e=>function(e,t){const r=String(t[e.field]??"");switch(e.operator){case"eq":return r===e.value;case"neq":return r!==e.value;case"contains":return r.includes(e.value||"");case"notContains":return!r.includes(e.value||"");case"empty":return""===r;case"notEmpty":return""!==r;default:return!1}}(e,r));return"or"===(t||"and")?n.some(Boolean):n.every(Boolean)}function _i({fields:e,columns:t=2,formValues:r,updateValue:n,fieldErrors:a,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,labelClassName:l,onFillFields:c,fieldPermissions:u,formMode:f="editable"}){console.log("TableModePreview fieldPermissions",u);const d=[];let p=0,m=0;if(e.forEach(e=>{const r=mi(e.type),n=pi(e),a=r||n?t:Math.min(e.tableColspan||1,t);if(p>0&&(r||n||p+a>t)){const e=t-p;e>0&&d.push({type:"empty",cs:e,key:"empty-"+m++}),p=0}d.push({type:"field",field:e}),r||n?p=0:(p+=a,p>=t&&(p=0))}),p>0){const e=t-p;e>0&&d.push({type:"empty",cs:e,key:"empty-"+m++})}const h={minWidth:0,backgroundColor:"#fff"};return React.createElement("div",{className:"border-2 border-black overflow-hidden",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:"#000"}},d.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...h,gridColumn:`span ${e.cs}`}});const{field:d}=e,p=mi(d.type),m=pi(d),g={gridColumn:`span ${p||m?t:Math.min(d.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===d.type){const e=xi(d);return React.createElement("div",{key:d._id,style:{...g,backgroundColor:e.bg},"data-field-cell":"","data-field-type":d.type,"data-field-name":d.name,className:`field-cell field-cell-${d.type} px-3 py-2`},React.createElement("div",{className:"flex items-center gap-2"},React.createElement(z,{className:"w-3.5 h-3.5 shrink-0",style:{color:e.primary}}),React.createElement("span",{className:"text-[13px] font-semibold",style:{color:e.title}},d.label)),d.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc},dangerouslySetInnerHTML:{__html:d.description}}))}if("table"===d.type)return React.createElement("div",{key:d._id,style:g,"data-field-cell":"","data-field-type":d.type,"data-field-name":d.name,className:`field-cell field-cell-${d.type} p-0`},React.createElement("div",{className:"flex items-center gap-2 px-3 py-2 bg-indigo-50/60"},React.createElement(I,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}),React.createElement("span",{className:"text-[13px] font-semibold table-label text-gray-700"},d.label),d.required&&!d.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),d.description&&React.createElement("div",{className:"text-[11px] text-gray-400 pl-[34px] pr-3 pb-1 bg-indigo-50/60",dangerouslySetInnerHTML:{__html:d.description}}),React.createElement(ui,{field:d,isTableMode:!0,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:r[d.name],onChange:e=>n(d.name,e),fieldPermissions:u}));if("grid"===d.type)return React.createElement("div",{key:d._id,style:g,"data-field-cell":"","data-field-type":d.type,"data-field-name":d.name,className:`field-cell field-cell-${d.type} p-0`},React.createElement("div",{className:"flex items-center gap-2 px-3 py-2 bg-teal-50/60"},React.createElement(A,{className:"w-3.5 h-3.5 text-teal-500 shrink-0"}),React.createElement("span",{className:"text-[13px] grid-label font-semibold text-gray-700"},d.label)),d.description&&React.createElement("div",{className:"text-[11px] text-gray-400 pl-[34px] pr-3 pb-1 bg-teal-50/60",dangerouslySetInnerHTML:{__html:d.description}}),React.createElement(di,{field:d,isTableMode:!0,formValues:r,onUpdateValue:n,onFillFields:c,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,fieldPermissions:u,formMode:f}));const y=!!a?.[d.name];return React.createElement("div",{key:d._id,style:g,"data-field-cell":"","data-field-type":d.type,"data-field-name":d.name,className:`field-cell field-cell-${d.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==d.showLabel&&React.createElement("div",{"data-field-label":"",className:st("field-label w-28 lg:w-32 shrink-0 border-r border-black px-2.5 py-2 flex items-center justify-center",y?"bg-red-50":"bg-gray-50/30",d.labelClassName||l)},React.createElement("span",{className:st("text-[13px] font-medium break-words text-center leading-snug",y?"text-red-700":"text-gray-600",d.labelClassName||l)},d.label),d.required&&!d.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:"field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center"},React.createElement(ni,{field:d,value:ki(r[d.name]||d.defaultValue||""),onChange:e=>n(d.name,e),isTableMode:!0,hasError:y,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,onFillFields:c,formValues:r}),y&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},a[d.name]))))}))}function Ei(e){return e?e.includes("${")?li(e,{}):e:""}function ki(e){return e&&e.includes("${")?Ei(e):e}function Si(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0");return`${r}-${n}-${String(t.getDate()).padStart(2,"0")}`}catch{return e}}const Ri=e.forwardRef(({fields:r,values:n,onChange:a,onSubmit:o,formName:i,viewMode:s="form",readOnly:l=!1,formMode:c="editable",fieldPermissions:u,formEvents:f,showButtons:d=!0,searchUsersFn:p,searchOrgsFn:m,tableColumns:h=2,searchObjectFn:g,className:y,labelClassName:b,onUpdateField:v,compact:x=!1,showFormName:w=!0,currentUser:_,state:E="draft",submitDate:k,context:S,formColumns:R=2},C)=>{const[N,O]=t.message.useMessage(),M=e.useMemo(()=>r.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:Ei(e.defaultValue)}:e),[r.map(e=>`${e.name}:${e.defaultValue??""}`).join("|")]),j=l||"readonly"===c||"print"===c,T=e.useMemo(()=>M.map(e=>{if(j)return{...e,readonly:!0};if(!u)return e;const t=u[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}),[M,u,j]);console.log("FormRenderer fieldPermissions",u),console.log("FormRenderer externalValues",n),console.log("FormRenderer state",E),console.log("FormRenderer submitDate",k);const $=e.useMemo(()=>{console.log("FormRenderer __applicant__system currentUser",_);const e={_id:"__applicant__system",name:"__applicant",label:"申请人",type:"member",required:!1,readonly:"draft"!==E,hidden:!1,pickerMultiple:!1,defaultValue:_?.user};return T.some(e=>"__applicant"===e.name)?T:[...T,e]},[T,_,E]),[D,F]=e.useState(()=>{const e={};for(const t of r)t.defaultValue&&(e[t.name]=Ei(t.defaultValue));return{...e,...n||{}}}),[L,P]=e.useState({}),U=e.useRef(D);e.useEffect(()=>{U.current=D},[D]),e.useEffect(()=>{F(e=>{const t={};for(const r of M)r.defaultValue&&!e[r.name]&&(t[r.name]=r.defaultValue);return Object.keys(t).length>0?{...e,...t}:e})},[M]),e.useEffect(()=>{n&&F(e=>{const t={...e};let r=!1;for(const[a,o]of Object.entries(n)){const e=ki(o);t[a]!==e&&(t[a]=e,r=!0)}return r?t:e})},[n]);const B=$.filter(e=>!e.hidden&&(!e.visibilityRules?.length||wi(e.visibilityRules,e.visibilityLogic,D))).map(e=>{if(!e.requiredRules?.length)return e;const t=wi(e.requiredRules,e.requiredLogic,D);return t!==e.required?{...e,required:e.required||t}:e}),Y=function(e,t=2){const r=[];let n=[],a=0;for(const o of e)if(!o.hidden)if(pi(o)||mi(o.type))n.length&&(r.push(n),n=[],a=0),r.push([o]);else{const e=Math.min(o.tableColspan||1,t);a+e>t&&(n.length&&(r.push(n),n=[]),a=0),n.push(o),a+=e,a>=t&&(r.push(n),n=[],a=0)}return n.length&&r.push(n),r}(B,"table"===s?h:R),H=[...$.filter(e=>"formula"===e.type&&e.formula),...$.filter(e=>["grid","table"].includes(e.type)&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...D};for(const r of H){const n=li(r.formula,D);t[r.name]!==n&&(t[r.name]=n,e=!0)}e&&(F(t),a?.(t))},[D,H.map(e=>e.name+":"+e.formula).join(",")]);const V=e.useRef(!1);e.useEffect(()=>{if(V.current)return;if(!f?.onInit)return;V.current=!0;const e=W(U.current,(e,t)=>{F(r=>{const n={...r,[e]:t};return a?.(n),n})},$,v,N,S);q(f.onInit,{form:e,fields:$,values:U.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[f?.onInit]);const J=e.useMemo(()=>{const e=[];for(const t of B)"grid"===t.type&&t.children?.length?e.push(...t.children):e.push(t);return e},[B]);e.useImperativeHandle(C,()=>({getValues:()=>{const e={};return J.forEach(t=>{e[t.name]=D[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={};if(J.forEach(r=>{const n=D[r.name]??r.defaultValue??"";if(r.required&&!r.readonly&&!n){const n=`${r.label} 不能为空`;e.push(n),t[r.name]=n}}),P(t),e.length>0){const e=J.find(e=>t[e.name]);e&&setTimeout(()=>{const t=document.querySelector(`[data-field-name="${e.name}"]`);t?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}}}),[D,J,P]);const G=e.useCallback((e,t)=>{P(t=>{if(!t[e])return t;const r={...t};return delete r[e],r}),F(r=>{const n={...r,[e]:t};return a?.(n),n})},[a]),K=e.useCallback((e,t)=>{const r=U.current[e]||"";if(G(e,t),f?.onValueChange){let n=$.find(t=>t.name===e);if(!n)for(const t of $)if(t.children){const r=t.children.find(t=>t.name===e);if(r){n=r;break}}const a={...U.current,[e]:t},o=W(a,G,$,v,N,S);q(f.onValueChange,{field:n?{name:n.name,label:n.label,type:n.type}:{name:e},value:t,oldValue:r,form:o,values:a,fields:$}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[f?.onValueChange,$,G,v,N,S]),Z=e.useCallback(e=>{for(const[t,r]of Object.entries(e))G(t,r)},[G]),Q=e.useCallback(async()=>{if(f?.onSubmit){const t=W(U.current,G,$,v,N,S);try{if(!1===await q(f.onSubmit,{form:t,values:{...U.current},fields:$}))return}catch(e){return void console.error("[FormRenderer] onSubmit error:",e)}}o?.(U.current)},[f?.onSubmit,$,G,v,N,S,o]);if(0===$.length)return React.createElement("div",{className:`h-full flex items-center justify-center ${y||""}`},O,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===s){const e=B.filter(e=>"__applicant__system"!==e._id),t=B.find(e=>"__applicant__system"===e._id),r=t?L[t.name]:void 0;return React.createElement("div",{className:`p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===c?"workflow-form-print":""} ${y||""}`},O,React.createElement("div",{className:"mx-auto"},w&&i&&React.createElement("div",{className:"mb-4 text-center"},React.createElement("h2",{className:"text-xl font-bold text-gray-800"},i)),React.createElement(_i,{fields:e,columns:h,formValues:D,updateValue:K,fieldErrors:L,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,labelClassName:b,onFillFields:Z,fieldPermissions:u,formMode:c}),t&&React.createElement("div",{className:"flex items-center","data-field-name":t.name},React.createElement("div",{className:"flex items-center",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},t.label,t.required&&!t.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(ni,{field:t,value:ki(D[t.name]||t.defaultValue||""),onChange:e=>K(t.name,e),hasError:!!r,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,onFillFields:Z,formValues:D,minimal:!0})),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 ml-2 flex items-center gap-1"},React.createElement("span",null,"⚠"),r)),"draft"!==E&&k&&React.createElement("div",{className:"flex items-center justify-end ml-4",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Si(k))))))}return React.createElement("div",{className:`h-full overflow-y-auto custom-scrollbar ${x?"bg-white":"bg-gray-50/50"} ${"print"===c?"workflow-form-print":""} ${y||""}`},O,React.createElement("div",{className:x?"px-3 py-3":"p-6 max-w-3xl mx-auto"},w&&i&&React.createElement("div",{className:x?"mb-3 text-center":"mb-6 text-center"},React.createElement("h2",{className:x?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},i)),React.createElement("div",{className:x?"":"bg-white rounded-xl border border-gray-200 shadow-sm p-6"},React.createElement("div",{className:x?"space-y-3":"grid gap-x-6 gap-y-5",style:x?void 0:{gridTemplateColumns:`repeat(${R}, minmax(0, 1fr))`}},Y.map((e,t)=>{const r=e[0];if("section"===r.type){const e=xi(r);return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${R}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement(z,{className:"w-4 h-4",style:{color:e.primary}}),React.createElement("h3",{className:(x?"text-[13px]":"text-[15px]")+" font-semibold",style:{color:r.titleColor||e.title}},r.label)),r.description&&React.createElement("div",{className:"text-[12px] ml-6",style:{color:e.desc},dangerouslySetInnerHTML:{__html:r.description}}),React.createElement("div",{className:x?"mt-1 mb-1":"mt-2 mb-1",style:{borderBottom:`2px solid ${e.border}`}}))}return"table"===r.type?React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${R}`}},React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement(I,{className:"w-4 h-4 text-emerald-500"}),React.createElement("label",{className:"text-[13px] font-medium text-gray-700"},r.label),r.required&&!r.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),r.description&&React.createElement("div",{className:"text-[11px] text-gray-400 mb-1",dangerouslySetInnerHTML:{__html:r.description}}),React.createElement(ui,{field:r,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,value:D[r.name],onChange:e=>K(r.name,e),fieldPermissions:u})):"grid"===r.type?React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${R}`}},React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement(A,{className:"w-4 h-4 text-teal-500"}),React.createElement("label",{className:"text-[13px] font-medium text-gray-700"},r.label)),r.description&&React.createElement("div",{className:"text-[11px] text-gray-400 mb-1",dangerouslySetInnerHTML:{__html:r.description}}),React.createElement(di,{field:r,formValues:D,onUpdateValue:K,onFillFields:Z,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,fieldPermissions:u,formMode:c})):e.map(e=>{const t=pi(e)||mi(e.type),r=!1!==e.showLabel&&"checkbox"!==e.type,n=L[e.name],a="__applicant__system"===e._id;return React.createElement("div",{key:e._id,"data-field-name":e.name,className:"",style:x?void 0:t?{gridColumn:`span ${R}`}:void 0},a&&x?React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(ni,{field:e,value:ki(D[e.name]||e.defaultValue||""),onChange:t=>K(e.name,t),hasError:!!n,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,onFillFields:Z,formValues:D,minimal:!0})),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),n),"draft"!==E&&k&&React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1 mt-3"},"提交日期"),React.createElement("span",{className:"block text-[13px] text-gray-800"},Si(k)))):a?React.createElement("div",{className:"flex items-center gap-2",style:{gridColumn:`span ${R}`}},React.createElement("div",{className:"flex items-center flex-1 min-w-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(ni,{field:e,value:ki(D[e.name]||e.defaultValue||""),onChange:t=>K(e.name,t),hasError:!!n,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,onFillFields:Z,formValues:D,minimal:!0}))),"draft"!==E&&k&&React.createElement("div",{className:"flex items-center shrink-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Si(k))),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 flex items-center gap-1 w-full"},React.createElement("span",null,"⚠"),n)):React.createElement(React.Fragment,null,r&&React.createElement("label",{className:`block text-[13px] font-medium ${n?"text-red-600":"text-gray-700"} ${x?"mb-1":"mb-1.5"}`},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),r&&e.description&&React.createElement("p",{className:"text-[11px] text-gray-400 "+(x?"mb-1":"mb-1.5")},e.description),React.createElement(ni,{field:e,value:ki(D[e.name]||e.defaultValue||""),onChange:t=>K(e.name,t),hasError:!!n,searchUsersFn:p,searchOrgsFn:m,searchObjectFn:g,onFillFields:Z,formValues:D}),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),n)))})})),d&&"editable"===c&&React.createElement("div",{className:(x?"mt-4 pt-3":"mt-8 pt-5")+" border-t border-gray-100 flex justify-end gap-3"},React.createElement("button",{className:`rounded-md border border-gray-300 bg-white ${x?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition`},"取消"),React.createElement("button",{onClick:Q,className:`rounded-md bg-indigo-600 ${x?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition`},"提交")))))}),Ci={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:(e,t)=>"W"===t?e+"周":e+"日",weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:(e,t)=>{const r=100*e+t;return r<600?"凌晨":r<900?"早上":r<1100?"上午":r<1300?"中午":r<1800?"下午":"晚上"}};function Ni(e,t){const r={...e};for(const n of t)if("table"===n.type){const e=r[n.name];if("string"==typeof e)if(""===e)r[n.name]=[];else try{const t=JSON.parse(e);r[n.name]=Array.isArray(t)?t:[]}catch{r[n.name]=[]}else Array.isArray(e)||(r[n.name]=[])}return r}!function(){const e=window.dayjs;e&&"function"==typeof e.extend&&(e.extend(d),e.extend(h),e.extend(b),e.locale(Ci,null,!0),e.locale("zh-cn")),c.extend(d),c.extend(h),c.extend(b),c.locale("zh-cn")}(),function(){if("undefined"==typeof amisRequire)return void console.error("[workflow-form-v2] amisRequire is not defined. Make sure the amis SDK is loaded first.");const e=amisRequire("react"),t=amisRequire("amis");t?.Renderer?(t.Renderer({type:"workflow-form-v2",autoVar:!0})(function(r){const{$schema:n,data:a,dispatchEvent:o,currentUser:i,state:s,submit_date:l}=r,c=t.ScopedContext,u=e.useContext(c),f=e.useRef(null),d={getValues:()=>Ni(f.current?.getValues()||g,m),validate:async()=>{const e=await(f.current?f.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid}},p=e.useRef(null);null===p.current?p.current={...d}:Object.assign(p.current,d),Object.defineProperty(p.current,"props",{get:()=>r,configurable:!0}),e.useEffect(()=>{if(u&&(n.id||r.id))return u.registerComponent(p.current),()=>{u.unRegisterComponent(p.current)}},[n.id||r.id]);let m=[];Array.isArray(n.fields)?m=n.fields:"string"==typeof n.fields&&a&&(m=a[n.fields.replace(/^\$\{|\}$/g,"")]||[]),!m.length&&Array.isArray(a?.fields)&&(m=a.fields);let h={};n.values&&"object"==typeof n.values?h=n.values:"string"==typeof n.values&&a&&(h=a[n.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(h).length&&a?.values&&"object"==typeof a.values&&(h=a.values);const g=function(e){const t={};for(const[r,n]of Object.entries(e))Array.isArray(n)?t[r]=JSON.stringify(n):t[r]=null==n?"":String(n);return t}(h),[y,b]=e.useState(!1);e.useEffect(()=>{const e=()=>{b(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const v=y?"form":n.viewMode||"form",x=y?1:n.tableColumns||2,w=n.layout??n.formColumns,_=y||"single"===w?1:"double"===w?2:Math.min(Math.max(Number(w)||2,1),3),E=n.readOnly??n.static??!1,k=n.formMode||"editable",R=n.formName||a?.formName||"",C=n.showButtons??!0,N=!!y||(n.compact??!1),O=n.showFormName??!0,M=n.formEvents;let j;"editable"===k&&(n.fieldPermissions&&"object"==typeof n.fieldPermissions?j=n.fieldPermissions:"string"==typeof n.fieldPermissions&&a&&(j=a[n.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!j&&a?.fieldPermissions&&(j=a.fieldPermissions));const T=n.apiBaseUrl||a?.context?.rootUrl||a?.rootUrl||"",$=n.authToken||a?.context?.authToken||a?.authToken||"",A=n.spaceId||a?.context?.spaceId||a?.spaceId||"",D=e.useCallback(async e=>{if(!T)return[];try{const t=`${T}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,r=await fetch(t,{headers:{Authorization:`Bearer ${A},${$}`}}),n=await r.json();return(n?.value||n?.data||n||[]).map(e=>({_id:e.user||e._id,label:e.name||e.label||"",description:e.mobile||""}))}catch(t){return console.warn("[workflow-form-v2] searchUsers error:",t),[]}},[T,$,A]),z=e.useCallback(async e=>{if(!T)return[];try{const t=`${T}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,r=await fetch(t,{headers:{Authorization:`Bearer ${A},${$}`}}),n=await r.json();return(n?.value||n?.data||n||[]).map(e=>({_id:e._id,label:e.name||e.label||"",description:e.fullname||""}))}catch(t){return console.warn("[workflow-form-v2] searchOrgs error:",t),[]}},[T,$,A]),F=e.useCallback((e,t)=>async r=>{if(!T||!e)return[];try{const n=r?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(r)}')`:"",a=`${T}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${n}`,o=await fetch(a,{headers:{Authorization:`Bearer ${A},${$}`}}),i=await o.json();return(i?.value||i?.data||i||[]).map(e=>({_id:e._id,label:e[t]||e.name||e._id,description:""}))}catch(n){return console.warn("[workflow-form-v2] searchObject error:",n),[]}},[T,$,A]),L={props:r,getValues:d.getValues,validate:d.validate};return console.log("[workflow-form-v2] render with props",r,R,O),e.createElement(Ri,{fields:m,values:g,ref:f,onChange:e=>{console.log("[workflow-form-v2] handleChange",e);const t=Ni(e,m);o?.("change",t?S(a,{value:t}):a,L)},onSubmit:e=>{const t=Ni(e,m);o?.("submit",t?S(a,{value:t}):a,L)},formName:R,viewMode:v,tableColumns:x,formColumns:_,readOnly:E,formMode:k,fieldPermissions:j,formEvents:M,showButtons:C,compact:N,showFormName:O,searchUsersFn:D,searchOrgsFn:z,searchObjectFn:F,currentUser:i,state:s,submitDate:l,className:["workflow-form-v2",r.className].filter(Boolean).join(" ")})}),console.log("[workflow-form-v2] amis Renderer registered successfully.")):console.error("[workflow-form-v2] amis.Renderer not found.")}()}(amisRequire("react"),antd);
|
|
1
|
+
!function(e,t,n){"use strict";function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const o=r(e);var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a,l={exports:{}};function c(){return a||(a=1,l.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",s="hour",a="day",l="week",c="month",u="quarter",d="year",h="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},y=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:y,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+y(r,2,"0")+":"+y(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,s=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-s:s-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:a,D:h,h:s,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},v="en",w={};w[v]=g;var x="$isDayjsObject",k=function(e){return e instanceof C||!(!e||!e[x])},S=function e(t,n,r){var o;if(!t)return v;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var s=t.split("-");if(!o&&s.length>1)return e(s[0])}else{var a=t.name;w[a]=t,o=a}return!r&&o&&(v=o),o||!r&&v},E=function(e,t){if(k(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new C(n)},M=b;M.l=S,M.i=k,M.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var C=function(){function g(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var y=g.prototype;return y.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(M.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(f);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},y.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},y.$utils=function(){return M},y.isValid=function(){return!(this.$d.toString()===p)},y.isSame=function(e,t){var n=E(e);return this.startOf(t)<=n&&n<=this.endOf(t)},y.isAfter=function(e,t){return E(e)<this.startOf(t)},y.isBefore=function(e,t){return this.endOf(t)<E(e)},y.$g=function(e,t,n){return M.u(e)?this[t]:this.set(n,e)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(e,t){var n=this,r=!!M.u(t)||t,u=M.p(e),p=function(e,t){var o=M.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(a)},f=function(e,t){return M.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,g=this.$M,y=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case d:return r?p(1,0):p(31,11);case c:return r?p(1,g):p(0,g+1);case l:var v=this.$locale().weekStart||0,w=(m<v?m+7:m)-v;return p(r?y-w:y+(6-w),g);case a:case h:return f(b+"Hours",0);case s:return f(b+"Minutes",1);case i:return f(b+"Seconds",2);case o:return f(b+"Milliseconds",3);default:return this.clone()}},y.endOf=function(e){return this.startOf(e,!1)},y.$set=function(e,t){var n,l=M.p(e),u="set"+(this.$u?"UTC":""),p=(n={},n[a]=u+"Date",n[h]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[s]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],f=l===a?this.$D+(t-this.$W):t;if(l===c||l===d){var m=this.clone().set(h,1);m.$d[p](f),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},y.set=function(e,t){return this.clone().$set(e,t)},y.get=function(e){return this[M.p(e)]()},y.add=function(r,u){var h,p=this;r=Number(r);var f=M.p(u),m=function(e){var t=E(p);return M.w(t.date(t.date()+Math.round(e*r)),p)};if(f===c)return this.set(c,this.$M+r);if(f===d)return this.set(d,this.$y+r);if(f===a)return m(1);if(f===l)return m(7);var g=(h={},h[i]=t,h[s]=n,h[o]=e,h)[f]||1,y=this.$d.getTime()+r*g;return M.w(y,this)},y.subtract=function(e,t){return this.add(-1*e,t)},y.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=M.z(this),i=this.$H,s=this.$m,a=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},h=function(e){return M.s(i%12||12,e,"0")},f=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return M.s(t.$y,4,"0");case"M":return a+1;case"MM":return M.s(a+1,2,"0");case"MMM":return d(n.monthsShort,a,c,3);case"MMMM":return d(c,a);case"D":return t.$D;case"DD":return M.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(i);case"HH":return M.s(i,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return f(i,s,!0);case"A":return f(i,s,!1);case"m":return String(s);case"mm":return M.s(s,2,"0");case"s":return String(t.$s);case"ss":return M.s(t.$s,2,"0");case"SSS":return M.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,h,p){var f,m=this,g=M.p(h),y=E(r),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,w=function(){return M.m(m,y)};switch(g){case d:f=w()/12;break;case c:f=w();break;case u:f=w()/3;break;case l:f=(v-b)/6048e5;break;case a:f=(v-b)/864e5;break;case s:f=v/n;break;case i:f=v/t;break;case o:f=v/e;break;default:f=v}return p?f:M.a(f)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return w[this.$L]},y.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=S(e,t,!0);return r&&(n.$L=r),n},y.clone=function(){return M.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},g}(),R=C.prototype;return E.prototype=R,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",d],["$D",h]].forEach(function(e){R[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),E.extend=function(e,t){return e.$i||(e(t,C,E),e.$i=!0),E},E.locale=S,E.isDayjs=k,E.unix=function(e){return E(1e3*e)},E.en=w[v],E.Ls=w,E.p={},E}()),l.exports}const u=s(c());var d,h={exports:{}};const p=s((d||(d=1,h.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}}),h.exports));var f,m={exports:{}};const g=s((f||(f=1,m.exports=function(e,t,n){var r=t.prototype,o=function(e){return e&&(e.indexOf?e:e.s)},i=function(e,t,n,r,i){var s=e.name?e:e.$locale(),a=o(s[t]),l=o(s[n]),c=a||l.map(function(e){return e.slice(0,r)});if(!i)return c;var u=s.weekStart;return c.map(function(e,t){return c[(t+(u||0))%7]})},s=function(){return n.Ls[n.locale()]},a=function(e,t){return e.formats[t]||e.formats[t.toUpperCase()].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})},l=function(){var e=this;return{months:function(t){return t?t.format("MMMM"):i(e,"months")},monthsShort:function(t){return t?t.format("MMM"):i(e,"monthsShort","months",3)},firstDayOfWeek:function(){return e.$locale().weekStart||0},weekdays:function(t){return t?t.format("dddd"):i(e,"weekdays")},weekdaysMin:function(t){return t?t.format("dd"):i(e,"weekdaysMin","weekdays",2)},weekdaysShort:function(t){return t?t.format("ddd"):i(e,"weekdaysShort","weekdays",3)},longDateFormat:function(t){return a(e.$locale(),t)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return l.bind(this)()},n.localeData=function(){var e=s();return{firstDayOfWeek:function(){return e.weekStart||0},weekdays:function(){return n.weekdays()},weekdaysShort:function(){return n.weekdaysShort()},weekdaysMin:function(){return n.weekdaysMin()},months:function(){return n.months()},monthsShort:function(){return n.monthsShort()},longDateFormat:function(t){return a(e,t)},meridiem:e.meridiem,ordinal:e.ordinal}},n.months=function(){return i(s(),"months")},n.monthsShort=function(){return i(s(),"monthsShort","months",3)},n.weekdays=function(e){return i(s(),"weekdays",null,null,e)},n.weekdaysShort=function(e){return i(s(),"weekdaysShort","weekdays",3,e)},n.weekdaysMin=function(e){return i(s(),"weekdaysMin","weekdays",2,e)}}),m.exports));var y,b={exports:{}};const v=s((y||(y=1,b.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return(e=+e)+(e>68?1900:2e3)},l=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var o=1;o<=24;o+=1)if(e.indexOf(r(o,0,t))>-1){n=o>12;break}}else n=e===(t?"pm":"PM");return n},h={A:[i,function(e){this.afternoon=d(e,!1)}],a:[i,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[o,l("seconds")],ss:[o,l("seconds")],m:[o,l("minutes")],mm:[o,l("minutes")],H:[o,l("hours")],h:[o,l("hours")],HH:[o,l("hours")],hh:[o,l("hours")],D:[o,l("day")],DD:[r,l("day")],Do:[i,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[o,l("week")],ww:[r,l("week")],M:[o,l("month")],MM:[r,l("month")],MMM:[i,function(e){var t=u("months"),n=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,l("year")],YY:[r,function(e){this.year=a(e)}],YYYY:[/\d{4}/,l("year")],Z:c,ZZ:c};function p(n){var r,o;r=n,o=s&&s.formats;for(var i=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),a=i.length,l=0;l<a;l+=1){var c=i[l],u=h[c],d=u&&u[0],p=u&&u[1];i[l]=p?{regex:d,parser:p}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var o=i[n];if("string"==typeof o)r+=o.length;else{var s=o.regex,l=o.parser,c=e.slice(r),u=s.exec(c)[0];l.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,o=r.parse;r.parse=function(e){var t=e.date,r=e.utc,i=e.args;this.$u=r;var a=i[1];if("string"==typeof a){var l=!0===i[2],c=!0===i[3],u=l||c,d=i[2];c&&(d=i[2]),s=this.$locale(),!l&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var o=p(t)(e),i=o.year,s=o.month,a=o.day,l=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,h=o.zone,f=o.week,m=new Date,g=a||(i||s?1:m.getDate()),y=i||m.getFullYear(),b=0;i&&!s||(b=s>0?s-1:m.getMonth());var v,w=l||0,x=c||0,k=u||0,S=d||0;return h?new Date(Date.UTC(y,b,g,w,x,k,S+60*h.offset*1e3)):n?new Date(Date.UTC(y,b,g,w,x,k,S)):(v=new Date(y,b,g,w,x,k,S),f&&(v=r(v).week(f).toDate()),v)}catch(E){return new Date("")}}(t,a,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var h=a.length,f=1;f<=h;f+=1){i[1]=a[f-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}f===h&&(this.$d=new Date(""))}else o.call(this,e)}}}()),b.exports));var w,x={exports:{}};w||(w=1,x.exports=function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(e,t){return"W"===t?e+"周":e+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(e,t){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r}(c()));var k,S,E,M={exports:{}};function C(e,t,n){e&&Object.isFrozen(e)&&(e=function(e,t=!0){const n=e&&e.__super?Object.create(e.__super,{__super:{value:e.__super,writable:!1,enumerable:!1}}):Object.create(Object.prototype);return t&&e&&Object.keys(e).forEach(t=>n[t]=e[t]),n}(e));const r=e?Object.create(e,{...n,__super:{value:e,writable:!1,enumerable:!1}}):Object.create(Object.prototype,n);return t&&function(e){const t=typeof e;return e&&"string"!==t&&"number"!==t&&"boolean"!==t&&"function"!==t&&!Array.isArray(e)}(t)&&Object.keys(t).forEach(e=>r[e]=t[e]),r}function R(e){if(Array.isArray(e))return e;if("string"==typeof e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}return[]}function O(e,t,n,r,o,i,s){const a=e=>{for(const t of n){if(t.name===e)return t;if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n}}};return{getFieldValue(t){const n=a(t),r=e[t];return"table"===n?.type?R(r):r??""},setFieldValue(e,n){t(e,n&&"object"==typeof n?n:null==n?"":String(n))},setFieldVisible(e,t){const n=a(e);n&&r&&r(n._id,{hidden:!t})},setFieldHidden(e,t){const n=a(e);n&&r&&r(n._id,{hidden:t})},setFieldRequired(e,t){const n=a(e);n&&r&&r(n._id,{required:t})},setFieldReadonly(e,t){const n=a(e);n&&r&&r(n._id,{readonly:t})},getFieldOptions(e){const t=a(e);return t?.options||[]},setFieldOptions(e,t){const n=a(e);n&&r&&r(n._id,{options:t})},getTableRows:t=>R(e[t]),setTableRows(e,n){t(e,JSON.stringify(Array.isArray(n)?n:[]))},addTableRow(n,r={}){const o=R(e[n]);o.push(r),t(n,JSON.stringify(o))},removeTableRow(n,r){const o=R(e[n]);r>=0&&r<o.length&&(o.splice(r,1),t(n,JSON.stringify(o)))},message:{success:e=>o?.success(e),error:e=>o?.error(e),warning:e=>o?.warning(e),info:e=>o?.info(e),loading:e=>o?.loading(e)},context:i||{},currentStep:s||{}}}async function T(e,t){if(!e||!e.trim())return;let n;if(t.values&&t.form){if(n={...t.values},t.fields)n=function(e,t){const n={...e};for(const r of t)"table"===r.type&&(n[r.name]=R(n[r.name]));return n}(t.values,t.fields);else for(const[i,s]of Object.entries(n))if("string"==typeof s&&s.startsWith("["))try{const e=JSON.parse(s);Array.isArray(e)&&(n[i]=e)}catch{}}else n=t.values;let r=t.value;"table"===t.field?.type&&"string"==typeof t.value&&(r=R(t.value));try{const o=new Function("form","field","value","oldValue","values","fields","fetch","currentStep",`return (async () => { ${e} })();`);return await o(t.form,t.field,r,t.oldValue,n,t.fields,fetch.bind(window),t.form?.currentStep)}catch(o){throw console.error("[fieldDataService] executeFormEvent error:",o),o}}function _(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=_(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}k||(k=1,S=M,E=M.exports,function(){var e,t="Expected a function",n="__lodash_hash_undefined__",r="__lodash_placeholder__",o=32,s=128,a=256,l=1/0,c=9007199254740991,u=NaN,d=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",a]],p="[object Arguments]",f="[object Array]",m="[object Boolean]",g="[object Date]",y="[object Error]",b="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",k="[object Object]",M="[object Promise]",C="[object RegExp]",R="[object Set]",O="[object String]",T="[object Symbol]",_="[object WeakMap]",N="[object ArrayBuffer]",A="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",L="[object Int8Array]",I="[object Int16Array]",j="[object Int32Array]",z="[object Uint8Array]",P="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",H=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(q.source),J=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,G=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,oe=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,he=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,we=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",ke="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Se="\\u2700-\\u27bf",Ee="a-z\\xdf-\\xf6\\xf8-\\xff",Me="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Re="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="['’]",Te="["+xe+"]",_e="["+Re+"]",Ne="["+ke+"]",Ae="\\d+",De="["+Se+"]",$e="["+Ee+"]",Le="[^"+xe+Re+Ae+Se+Ee+Me+"]",Ie="\\ud83c[\\udffb-\\udfff]",je="[^"+xe+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Me+"]",Be="\\u200d",He="(?:"+$e+"|"+Le+")",Ve="(?:"+Fe+"|"+Le+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Ne+"|"+Ie+")?",Ye="["+Ce+"]?",Je=Ye+We+"(?:"+Be+"(?:"+[je,ze,Pe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,ze,Pe].join("|")+")"+Je,Ge="(?:"+[je+Ne+"?",Ne,ze,Pe,Te].join("|")+")",Ze=RegExp(Oe,"g"),Qe=RegExp(Ne,"g"),Xe=RegExp(Ie+"(?="+Ie+")|"+Ge+Je,"g"),et=RegExp([Fe+"?"+$e+"+"+Ue+"(?="+[_e,Fe,"$"].join("|")+")",Ve+"+"+qe+"(?="+[_e,Fe+He,"$"].join("|")+")",Fe+"?"+He+"+"+Ue,Fe+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ae,Ke].join("|"),"g"),tt=RegExp("["+Be+xe+ke+Ce+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,it={};it[D]=it[$]=it[L]=it[I]=it[j]=it[z]=it[P]=it[F]=it[B]=!0,it[p]=it[f]=it[N]=it[m]=it[A]=it[g]=it[y]=it[b]=it[w]=it[x]=it[k]=it[C]=it[R]=it[O]=it[_]=!1;var st={};st[p]=st[f]=st[N]=st[A]=st[m]=st[g]=st[D]=st[$]=st[L]=st[I]=st[j]=st[w]=st[x]=st[k]=st[C]=st[R]=st[O]=st[T]=st[z]=st[P]=st[F]=st[B]=!0,st[y]=st[b]=st[_]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ct=parseInt,ut="object"==typeof i&&i&&i.Object===Object&&i,dt="object"==typeof self&&self&&self.Object===Object&&self,ht=ut||dt||Function("return this")(),pt=E&&!E.nodeType&&E,ft=pt&&S&&!S.nodeType&&S,mt=ft&&ft.exports===pt,gt=mt&&ut.process,yt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&>.binding&>.binding("util")}catch(t){}}(),bt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,wt=yt&&yt.isMap,xt=yt&&yt.isRegExp,kt=yt&&yt.isSet,St=yt&&yt.isTypedArray;function Et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Mt(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}function Ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Rt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Ot(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Tt(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function _t(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function Nt(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function At(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function Dt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function $t(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function Lt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var jt=Ut("length");function zt(e,t,n){var r;return n(e,function(e,n,o){if(t(e,n,o))return r=n,!1}),r}function Pt(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function Ft(e,t,n){return t==t?function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):Pt(e,Ht,n)}function Bt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Ht(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?Yt(e,t)/n:u}function Ut(t){return function(n){return null==n?e:n[t]}}function qt(t){return function(n){return null==t?e:t[n]}}function Wt(e,t,n,r,o){return o(e,function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)}),n}function Yt(t,n){for(var r,o=-1,i=t.length;++o<i;){var s=n(t[o]);s!==e&&(r=r===e?s:r+s)}return r}function Jt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Kt(e){return e?e.slice(0,hn(e)+1).replace(re,""):e}function Gt(e){return function(t){return e(t)}}function Zt(e,t){return At(t,function(t){return e[t]})}function Qt(e,t){return e.has(t)}function Xt(e,t){for(var n=-1,r=e.length;++n<r&&Ft(t,e[n],0)>-1;);return n}function en(e,t){for(var n=e.length;n--&&Ft(t,e[n],0)>-1;);return n}var tn=qt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nn=qt({"&":"&","<":"<",">":">",'"':""","'":"'"});function rn(e){return"\\"+at[e]}function on(e){return tt.test(e)}function sn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function an(e,t){return function(n){return e(t(n))}}function ln(e,t){for(var n=-1,o=e.length,i=0,s=[];++n<o;){var a=e[n];a!==t&&a!==r||(e[n]=r,s[i++]=n)}return s}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function un(e){return on(e)?function(e){for(var t=Xe.lastIndex=0;Xe.test(e);)++t;return t}(e):jt(e)}function dn(e){return on(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function hn(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pn=qt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function i(S){var E,oe=(S=null==S?ht:fn.defaults(ht.Object(),S,fn.pick(ht,rt))).Array,xe=S.Date,ke=S.Error,Se=S.Function,Ee=S.Math,Me=S.Object,Ce=S.RegExp,Re=S.String,Oe=S.TypeError,Te=oe.prototype,_e=Se.prototype,Ne=Me.prototype,Ae=S["__core-js_shared__"],De=_e.toString,$e=Ne.hasOwnProperty,Le=0,Ie=(E=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",je=Ne.toString,ze=De.call(Me),Pe=ht._,Fe=Ce("^"+De.call($e).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=mt?S.Buffer:e,He=S.Symbol,Ve=S.Uint8Array,Ue=Be?Be.allocUnsafe:e,qe=an(Me.getPrototypeOf,Me),We=Me.create,Ye=Ne.propertyIsEnumerable,Je=Te.splice,Ke=He?He.isConcatSpreadable:e,Ge=He?He.iterator:e,Xe=He?He.toStringTag:e,tt=function(){try{var e=ui(Me,"defineProperty");return e({},"",{}),e}catch(t){}}(),at=S.clearTimeout!==ht.clearTimeout&&S.clearTimeout,ut=xe&&xe.now!==ht.Date.now&&xe.now,dt=S.setTimeout!==ht.setTimeout&&S.setTimeout,pt=Ee.ceil,ft=Ee.floor,gt=Me.getOwnPropertySymbols,yt=Be?Be.isBuffer:e,jt=S.isFinite,qt=Te.join,mn=an(Me.keys,Me),gn=Ee.max,yn=Ee.min,bn=xe.now,vn=S.parseInt,wn=Ee.random,xn=Te.reverse,kn=ui(S,"DataView"),Sn=ui(S,"Map"),En=ui(S,"Promise"),Mn=ui(S,"Set"),Cn=ui(S,"WeakMap"),Rn=ui(Me,"create"),On=Cn&&new Cn,Tn={},_n=Pi(kn),Nn=Pi(Sn),An=Pi(En),Dn=Pi(Mn),$n=Pi(Cn),Ln=He?He.prototype:e,In=Ln?Ln.valueOf:e,jn=Ln?Ln.toString:e;function zn(e){if(na(e)&&!qs(e)&&!(e instanceof Hn)){if(e instanceof Bn)return e;if($e.call(e,"__wrapped__"))return Fi(e)}return new Bn(e)}var Pn=function(){function t(){}return function(n){if(!ta(n))return{};if(We)return We(n);t.prototype=n;var r=new t;return t.prototype=e,r}}();function Fn(){}function Bn(t,n){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=e}function Hn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new Un(e);this.size=t.size}function Jn(e,t){var n=qs(e),r=!n&&Us(e),o=!n&&!r&&Ks(e),i=!n&&!r&&!o&&ua(e),s=n||r||o||i,a=s?Jt(e.length,Re):[],l=a.length;for(var c in e)!t&&!$e.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yi(c,l))||a.push(c);return a}function Kn(t){var n=t.length;return n?t[Wr(0,n-1)]:e}function Gn(e,t){return Di(Oo(e),ir(t,0,e.length))}function Zn(e){return Di(Oo(e))}function Qn(t,n,r){(r!==e&&!Bs(t[n],r)||r===e&&!(n in t))&&rr(t,n,r)}function Xn(t,n,r){var o=t[n];$e.call(t,n)&&Bs(o,r)&&(r!==e||n in t)||rr(t,n,r)}function er(e,t){for(var n=e.length;n--;)if(Bs(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,o,i){t(r,e,n(e),i)}),r}function nr(e,t){return e&&To(t,Aa(t),e)}function rr(e,t,n){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(t,n){for(var r=-1,o=n.length,i=oe(o),s=null==t;++r<o;)i[r]=s?e:Ra(t,n[r]);return i}function ir(t,n,r){return t==t&&(r!==e&&(t=t<=r?t:r),n!==e&&(t=t>=n?t:n)),t}function sr(t,n,r,o,i,s){var a,l=1&n,c=2&n,u=4&n;if(r&&(a=i?r(t,o,i,s):r(t)),a!==e)return a;if(!ta(t))return t;var d=qs(t);if(d){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(t),!l)return Oo(t,a)}else{var h=pi(t),f=h==b||h==v;if(Ks(t))return ko(t,l);if(h==k||h==p||f&&!i){if(a=c||f?{}:mi(t),!l)return c?function(e,t){return To(e,hi(e),t)}(t,function(e,t){return e&&To(t,Da(t),e)}(a,t)):function(e,t){return To(e,di(e),t)}(t,nr(a,t))}else{if(!st[h])return i?t:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case N:return So(e);case m:case g:return new o(+e);case A:return function(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case $:case L:case I:case j:case z:case P:case F:case B:return Eo(e,n);case w:return new o;case x:case O:return new o(e);case C:return function(e){var t=new e.constructor(e.source,he.exec(e));return t.lastIndex=e.lastIndex,t}(e);case R:return new o;case T:return r=e,In?Me(In.call(r)):{}}}(t,h,l)}}s||(s=new Yn);var y=s.get(t);if(y)return y;s.set(t,a),aa(t)?t.forEach(function(e){a.add(sr(e,n,r,e,t,s))}):ra(t)&&t.forEach(function(e,o){a.set(o,sr(e,n,r,o,t,s))});var S=d?e:(u?c?ri:ni:c?Da:Aa)(t);return Ct(S||t,function(e,o){S&&(e=t[o=e]),Xn(a,o,sr(e,n,r,o,t,s))}),a}function ar(t,n,r){var o=r.length;if(null==t)return!o;for(t=Me(t);o--;){var i=r[o],s=n[i],a=t[i];if(a===e&&!(i in t)||!s(a))return!1}return!0}function lr(n,r,o){if("function"!=typeof n)throw new Oe(t);return Ti(function(){n.apply(e,o)},r)}function cr(e,t,n,r){var o=-1,i=_t,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=At(t,Gt(n))),r?(i=Nt,s=!1):t.length>=200&&(i=Qt,s=!1,t=new Wn(t));e:for(;++o<a;){var u=e[o],d=null==n?u:n(u);if(u=r||0!==u?u:0,s&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else i(t,d,r)||l.push(u)}return l}zn.templateSettings={escape:K,evaluate:G,interpolate:Z,variable:"",imports:{_:zn}},zn.prototype=Fn.prototype,zn.prototype.constructor=zn,Bn.prototype=Pn(Fn.prototype),Bn.prototype.constructor=Bn,Hn.prototype=Pn(Fn.prototype),Hn.prototype.constructor=Hn,Vn.prototype.clear=function(){this.__data__=Rn?Rn(null):{},this.size=0},Vn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vn.prototype.get=function(t){var r=this.__data__;if(Rn){var o=r[t];return o===n?e:o}return $e.call(r,t)?r[t]:e},Vn.prototype.has=function(t){var n=this.__data__;return Rn?n[t]!==e:$e.call(n,t)},Vn.prototype.set=function(t,r){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=Rn&&r===e?n:r,this},Un.prototype.clear=function(){this.__data__=[],this.size=0},Un.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Je.call(t,n,1),--this.size,0))},Un.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},Un.prototype.has=function(e){return er(this.__data__,e)>-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(Sn||Un),string:new Vn}},qn.prototype.delete=function(e){var t=li(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return li(this,e).get(e)},qn.prototype.has=function(e){return li(this,e).has(e)},qn.prototype.set=function(e,t){var n=li(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,n),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.clear=function(){this.__data__=new Un,this.size=0},Yn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Yn.prototype.get=function(e){return this.__data__.get(e)},Yn.prototype.has=function(e){return this.__data__.has(e)},Yn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ao(br),dr=Ao(vr,!0);function hr(e,t){var n=!0;return ur(e,function(e,r,o){return n=!!t(e,r,o)}),n}function pr(t,n,r){for(var o=-1,i=t.length;++o<i;){var s=t[o],a=n(s);if(null!=a&&(l===e?a==a&&!ca(a):r(a,l)))var l=a,c=s}return c}function fr(e,t){var n=[];return ur(e,function(e,r,o){t(e,r,o)&&n.push(e)}),n}function mr(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=gi),o||(o=[]);++i<s;){var a=e[i];t>0&&n(a)?t>1?mr(a,t-1,n,r,o):Dt(o,a):r||(o[o.length]=a)}return o}var gr=Do(),yr=Do(!0);function br(e,t){return e&&gr(e,t,Aa)}function vr(e,t){return e&&yr(e,t,Aa)}function wr(e,t){return Tt(t,function(t){return Qs(e[t])})}function xr(t,n){for(var r=0,o=(n=bo(n,t)).length;null!=t&&r<o;)t=t[zi(n[r++])];return r&&r==o?t:e}function kr(e,t,n){var r=t(e);return qs(e)?r:Dt(r,n(e))}function Sr(t){return null==t?t===e?"[object Undefined]":"[object Null]":Xe&&Xe in Me(t)?function(t){var n=$e.call(t,Xe),r=t[Xe];try{t[Xe]=e;var o=!0}catch(s){}var i=je.call(t);return o&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return je.call(e)}(t)}function Er(e,t){return e>t}function Mr(e,t){return null!=e&&$e.call(e,t)}function Cr(e,t){return null!=e&&t in Me(e)}function Rr(t,n,r){for(var o=r?Nt:_t,i=t[0].length,s=t.length,a=s,l=oe(s),c=1/0,u=[];a--;){var d=t[a];a&&n&&(d=At(d,Gt(n))),c=yn(d.length,c),l[a]=!r&&(n||i>=120&&d.length>=120)?new Wn(a&&d):e}d=t[0];var h=-1,p=l[0];e:for(;++h<i&&u.length<c;){var f=d[h],m=n?n(f):f;if(f=r||0!==f?f:0,!(p?Qt(p,m):o(u,m,r))){for(a=s;--a;){var g=l[a];if(!(g?Qt(g,m):o(t[a],m,r)))continue e}p&&p.push(m),u.push(f)}}return u}function Or(t,n,r){var o=null==(t=Ci(t,n=bo(n,t)))?t:t[zi(Zi(n))];return null==o?e:Et(o,t,r)}function Tr(e){return na(e)&&Sr(e)==p}function _r(t,n,r,o,i){return t===n||(null==t||null==n||!na(t)&&!na(n)?t!=t&&n!=n:function(t,n,r,o,i,s){var a=qs(t),l=qs(n),c=a?f:pi(t),u=l?f:pi(n),d=(c=c==p?k:c)==k,h=(u=u==p?k:u)==k,b=c==u;if(b&&Ks(t)){if(!Ks(n))return!1;a=!0,d=!1}if(b&&!d)return s||(s=new Yn),a||ua(t)?ei(t,n,r,o,i,s):function(e,t,n,r,o,i,s){switch(n){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case N:return!(e.byteLength!=t.byteLength||!i(new Ve(e),new Ve(t)));case m:case g:case x:return Bs(+e,+t);case y:return e.name==t.name&&e.message==t.message;case C:case O:return e==t+"";case w:var a=sn;case R:var l=1&r;if(a||(a=cn),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=2,s.set(e,t);var u=ei(a(e),a(t),r,o,i,s);return s.delete(e),u;case T:if(In)return In.call(e)==In.call(t)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var v=d&&$e.call(t,"__wrapped__"),S=h&&$e.call(n,"__wrapped__");if(v||S){var E=v?t.value():t,M=S?n.value():n;return s||(s=new Yn),i(E,M,r,o,s)}}return!!b&&(s||(s=new Yn),function(t,n,r,o,i,s){var a=1&r,l=ni(t),c=l.length,u=ni(n),d=u.length;if(c!=d&&!a)return!1;for(var h=c;h--;){var p=l[h];if(!(a?p in n:$e.call(n,p)))return!1}var f=s.get(t),m=s.get(n);if(f&&m)return f==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++h<c;){var b=t[p=l[h]],v=n[p];if(o)var w=a?o(v,b,p,n,t,s):o(b,v,p,t,n,s);if(!(w===e?b===v||i(b,v,r,o,s):w)){g=!1;break}y||(y="constructor"==p)}if(g&&!y){var x=t.constructor,k=n.constructor;x==k||!("constructor"in t)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof k&&k instanceof k||(g=!1)}return s.delete(t),s.delete(n),g}(t,n,r,o,i,s))}(t,n,r,o,_r,i))}function Nr(t,n,r,o){var i=r.length,s=i,a=!o;if(null==t)return!s;for(t=Me(t);i--;){var l=r[i];if(a&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++i<s;){var c=(l=r[i])[0],u=t[c],d=l[1];if(a&&l[2]){if(u===e&&!(c in t))return!1}else{var h=new Yn;if(o)var p=o(u,d,c,t,n,h);if(!(p===e?_r(d,u,3,o,h):p))return!1}}return!0}function Ar(e){return!(!ta(e)||(t=e,Ie&&Ie in t))&&(Qs(e)?Fe:me).test(Pi(e));var t}function Dr(e){return"function"==typeof e?e:null==e?ol:"object"==typeof e?qs(e)?Pr(e[0],e[1]):zr(e):pl(e)}function $r(e){if(!ki(e))return mn(e);var t=[];for(var n in Me(e))$e.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e){if(!ta(e))return function(e){var t=[];if(null!=e)for(var n in Me(e))t.push(n);return t}(e);var t=ki(e),n=[];for(var r in e)("constructor"!=r||!t&&$e.call(e,r))&&n.push(r);return n}function Ir(e,t){return e<t}function jr(e,t){var n=-1,r=Ys(e)?oe(e.length):[];return ur(e,function(e,o,i){r[++n]=t(e,o,i)}),r}function zr(e){var t=ci(e);return 1==t.length&&t[0][2]?Ei(t[0][0],t[0][1]):function(n){return n===e||Nr(n,e,t)}}function Pr(t,n){return vi(t)&&Si(n)?Ei(zi(t),n):function(r){var o=Ra(r,t);return o===e&&o===n?Oa(r,t):_r(n,o,3)}}function Fr(t,n,r,o,i){t!==n&&gr(n,function(s,a){if(i||(i=new Yn),ta(s))!function(t,n,r,o,i,s,a){var l=Ri(t,r),c=Ri(n,r),u=a.get(c);if(u)Qn(t,r,u);else{var d=s?s(l,c,r+"",t,n,a):e,h=d===e;if(h){var p=qs(c),f=!p&&Ks(c),m=!p&&!f&&ua(c);d=c,p||f||m?qs(l)?d=l:Js(l)?d=Oo(l):f?(h=!1,d=ko(c,!0)):m?(h=!1,d=Eo(c,!0)):d=[]:ia(c)||Us(c)?(d=l,Us(l)?d=ba(l):ta(l)&&!Qs(l)||(d=mi(c))):h=!1}h&&(a.set(c,d),i(d,c,o,s,a),a.delete(c)),Qn(t,r,d)}}(t,n,a,r,Fr,o,i);else{var l=o?o(Ri(t,a),s,a+"",t,n,i):e;l===e&&(l=s),Qn(t,a,l)}},Da)}function Br(t,n){var r=t.length;if(r)return yi(n+=n<0?r:0,r)?t[n]:e}function Hr(e,t,n){t=t.length?At(t,function(e){return qs(e)?function(t){return xr(t,1===e.length?e[0]:e)}:e}):[ol];var r=-1;return t=At(t,Gt(ai())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(jr(e,function(e,n,o){return{criteria:At(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return function(e,t,n){for(var r=-1,o=e.criteria,i=t.criteria,s=o.length,a=n.length;++r<s;){var l=Mo(o[r],i[r]);if(l)return r>=a?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function Vr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],a=xr(e,s);n(a,s)&&Zr(i,bo(s,e),a)}return i}function Ur(e,t,n,r){var o=r?Bt:Ft,i=-1,s=t.length,a=e;for(e===t&&(t=Oo(t)),n&&(a=At(e,Gt(n)));++i<s;)for(var l=0,c=t[i],u=n?n(c):c;(l=o(a,u,l,r))>-1;)a!==e&&Je.call(a,l,1),Je.call(e,l,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;yi(o)?Je.call(e,o,1):co(e,o)}}return e}function Wr(e,t){return e+ft(wn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return _i(Mi(e,t,ol),e+"")}function Kr(e){return Kn(Ba(e))}function Gr(e,t){var n=Ba(e);return Di(n,ir(t,0,n.length))}function Zr(t,n,r,o){if(!ta(t))return t;for(var i=-1,s=(n=bo(n,t)).length,a=s-1,l=t;null!=l&&++i<s;){var c=zi(n[i]),u=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=a){var d=l[c];(u=o?o(d,c,l):e)===e&&(u=ta(d)?d:yi(n[i+1])?[]:{})}Xn(l,c,u),l=l[c]}return t}var Qr=On?function(e,t){return On.set(e,t),e}:ol,Xr=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:tl(t),writable:!0})}:ol;function eo(e){return Di(Ba(e))}function to(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=oe(o);++r<o;)i[r]=e[r+t];return i}function no(e,t){var n;return ur(e,function(e,r,o){return!(n=t(e,r,o))}),!!n}function ro(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=e[i];null!==s&&!ca(s)&&(n?s<=t:s<t)?r=i+1:o=i}return o}return oo(e,t,ol,n)}function oo(t,n,r,o){var i=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(n=r(n))!=n,l=null===n,c=ca(n),u=n===e;i<s;){var d=ft((i+s)/2),h=r(t[d]),p=h!==e,f=null===h,m=h==h,g=ca(h);if(a)var y=o||m;else y=u?m&&(o||p):l?m&&p&&(o||!f):c?m&&p&&!f&&(o||!g):!f&&!g&&(o?h<=n:h<n);y?i=d+1:s=d}return yn(s,4294967294)}function io(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!Bs(a,l)){var l=a;i[o++]=0===s?0:s}}return i}function so(e){return"number"==typeof e?e:ca(e)?u:+e}function ao(e){if("string"==typeof e)return e;if(qs(e))return At(e,ao)+"";if(ca(e))return jn?jn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function lo(e,t,n){var r=-1,o=_t,i=e.length,s=!0,a=[],l=a;if(n)s=!1,o=Nt;else if(i>=200){var c=t?null:Jo(e);if(c)return cn(c);s=!1,o=Qt,l=new Wn}else l=t?[]:a;e:for(;++r<i;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,s&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),a.push(u)}else o(l,d,n)||(l!==a&&l.push(d),a.push(u))}return a}function co(e,t){var n=-1,r=(t=bo(t,e)).length;if(!r)return!0;for(var o=null==e||"object"!=typeof e&&"function"!=typeof e;++n<r;){var i=t[n];if("string"==typeof i){if("__proto__"===i&&!$e.call(e,"__proto__"))return!1;if("constructor"===i&&n+1<r&&"string"==typeof t[n+1]&&"prototype"===t[n+1]){if(o&&0===n)continue;return!1}}}var s=Ci(e,t);return null==s||delete s[zi(Zi(t))]}function uo(e,t,n,r){return Zr(e,t,n(xr(e,t)),r)}function ho(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?to(e,r?0:i,r?i+1:o):to(e,r?i+1:0,r?o:i)}function po(e,t){var n=e;return n instanceof Hn&&(n=n.value()),$t(t,function(e,t){return t.func.apply(t.thisArg,Dt([e],t.args))},n)}function fo(e,t,n){var r=e.length;if(r<2)return r?lo(e[0]):[];for(var o=-1,i=oe(r);++o<r;)for(var s=e[o],a=-1;++a<r;)a!=o&&(i[o]=cr(i[o]||s,e[a],t,n));return lo(mr(i,1),t,n)}function mo(t,n,r){for(var o=-1,i=t.length,s=n.length,a={};++o<i;){var l=o<s?n[o]:e;r(a,t[o],l)}return a}function go(e){return Js(e)?e:[]}function yo(e){return"function"==typeof e?e:ol}function bo(e,t){return qs(e)?e:vi(e,t)?[e]:ji(va(e))}var vo=Jr;function wo(t,n,r){var o=t.length;return r=r===e?o:r,!n&&r>=o?t:to(t,n,r)}var xo=at||function(e){return ht.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function So(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function Eo(e,t){var n=t?So(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Mo(t,n){if(t!==n){var r=t!==e,o=null===t,i=t==t,s=ca(t),a=n!==e,l=null===n,c=n==n,u=ca(n);if(!l&&!u&&!s&&t>n||s&&a&&c&&!l&&!u||o&&a&&c||!r&&c||!i)return 1;if(!o&&!s&&!u&&t<n||u&&r&&i&&!o&&!s||l&&r&&i||!a&&i||!c)return-1}return 0}function Co(e,t,n,r){for(var o=-1,i=e.length,s=n.length,a=-1,l=t.length,c=gn(i-s,0),u=oe(l+c),d=!r;++a<l;)u[a]=t[a];for(;++o<s;)(d||o<i)&&(u[n[o]]=e[o]);for(;c--;)u[a++]=e[o++];return u}function Ro(e,t,n,r){for(var o=-1,i=e.length,s=-1,a=n.length,l=-1,c=t.length,u=gn(i-a,0),d=oe(u+c),h=!r;++o<u;)d[o]=e[o];for(var p=o;++l<c;)d[p+l]=t[l];for(;++s<a;)(h||o<i)&&(d[p+n[s]]=e[o++]);return d}function Oo(e,t){var n=-1,r=e.length;for(t||(t=oe(r));++n<r;)t[n]=e[n];return t}function To(t,n,r,o){var i=!r;r||(r={});for(var s=-1,a=n.length;++s<a;){var l=n[s],c=o?o(r[l],t[l],l,r,t):e;c===e&&(c=t[l]),i?rr(r,l,c):Xn(r,l,c)}return r}function _o(e,t){return function(n,r){var o=qs(n)?Mt:tr,i=t?t():{};return o(n,e,ai(r,2),i)}}function No(t){return Jr(function(n,r){var o=-1,i=r.length,s=i>1?r[i-1]:e,a=i>2?r[2]:e;for(s=t.length>3&&"function"==typeof s?(i--,s):e,a&&bi(r[0],r[1],a)&&(s=i<3?e:s,i=1),n=Me(n);++o<i;){var l=r[o];l&&t(n,l,o,s)}return n})}function Ao(e,t){return function(n,r){if(null==n)return n;if(!Ys(n))return e(n,r);for(var o=n.length,i=t?o:-1,s=Me(n);(t?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function Do(e){return function(t,n,r){for(var o=-1,i=Me(t),s=r(t),a=s.length;a--;){var l=s[e?a:++o];if(!1===n(i[l],l,i))break}return t}}function $o(t){return function(n){var r=on(n=va(n))?dn(n):e,o=r?r[0]:n.charAt(0),i=r?wo(r,1).join(""):n.slice(1);return o[t]()+i}}function Lo(e){return function(t){return $t(Qa(Ua(t).replace(Ze,"")),e,"")}}function Io(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Pn(e.prototype),r=e.apply(n,t);return ta(r)?r:n}}function jo(t){return function(n,r,o){var i=Me(n);if(!Ys(n)){var s=ai(r,3);n=Aa(n),r=function(e){return s(i[e],e,i)}}var a=t(n,r,o);return a>-1?i[s?n[a]:a]:e}}function zo(n){return ti(function(r){var o=r.length,i=o,s=Bn.prototype.thru;for(n&&r.reverse();i--;){var a=r[i];if("function"!=typeof a)throw new Oe(t);if(s&&!l&&"wrapper"==ii(a))var l=new Bn([],!0)}for(i=l?i:o;++i<o;){var c=ii(a=r[i]),u="wrapper"==c?oi(a):e;l=u&&wi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[ii(u[0])].apply(l,u[3]):1==a.length&&wi(a)?l[c]():l.thru(a)}return function(){var e=arguments,t=e[0];if(l&&1==e.length&&qs(t))return l.plant(t).value();for(var n=0,i=o?r[n].apply(this,e):t;++n<o;)i=r[n].call(this,i);return i}})}function Po(t,n,r,o,i,a,l,c,u,d){var h=n&s,p=1&n,f=2&n,m=24&n,g=512&n,y=f?e:Io(t);return function s(){for(var b=arguments.length,v=oe(b),w=b;w--;)v[w]=arguments[w];if(m)var x=si(s),k=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(v,x);if(o&&(v=Co(v,o,i,m)),a&&(v=Ro(v,a,l,m)),b-=k,m&&b<d){var S=ln(v,x);return Wo(t,n,Po,s.placeholder,r,v,S,c,u,d-b)}var E=p?r:this,M=f?E[t]:t;return b=v.length,c?v=function(t,n){for(var r=t.length,o=yn(n.length,r),i=Oo(t);o--;){var s=n[o];t[o]=yi(s,r)?i[s]:e}return t}(v,c):g&&b>1&&v.reverse(),h&&u<b&&(v.length=u),this&&this!==ht&&this instanceof s&&(M=y||Io(M)),M.apply(E,v)}}function Fo(e,t){return function(n,r){return function(e,t,n,r){return br(e,function(e,o,i){t(r,n(e),o,i)}),r}(n,e,t(r),{})}}function Bo(t,n){return function(r,o){var i;if(r===e&&o===e)return n;if(r!==e&&(i=r),o!==e){if(i===e)return o;"string"==typeof r||"string"==typeof o?(r=ao(r),o=ao(o)):(r=so(r),o=so(o)),i=t(r,o)}return i}}function Ho(e){return ti(function(t){return t=At(t,Gt(ai())),Jr(function(n){var r=this;return e(t,function(e){return Et(e,r,n)})})})}function Vo(t,n){var r=(n=n===e?" ":ao(n)).length;if(r<2)return r?Yr(n,t):n;var o=Yr(n,pt(t/un(n)));return on(n)?wo(dn(o),0,t).join(""):o.slice(0,t)}function Uo(t){return function(n,r,o){return o&&"number"!=typeof o&&bi(n,r,o)&&(r=o=e),n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n,r){for(var o=-1,i=gn(pt((t-e)/(n||1)),0),s=oe(i);i--;)s[r?i:++o]=e,e+=n;return s}(n,r,o=o===e?n<r?1:-1:fa(o),t)}}function qo(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ya(t),n=ya(n)),e(t,n)}}function Wo(t,n,r,i,s,a,l,c,u,d){var h=8&n;n|=h?o:64,4&(n&=~(h?64:o))||(n&=-4);var p=[t,n,s,h?a:e,h?l:e,h?e:a,h?e:l,c,u,d],f=r.apply(e,p);return wi(t)&&Oi(f,p),f.placeholder=i,Ni(f,t,n)}function Yo(e){var t=Ee[e];return function(e,n){if(e=ya(e),(n=null==n?0:yn(ma(n),292))&&jt(e)){var r=(va(e)+"e").split("e");return+((r=(va(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Jo=Mn&&1/cn(new Mn([,-0]))[1]==l?function(e){return new Mn(e)}:cl;function Ko(e){return function(t){var n=pi(t);return n==w?sn(t):n==R?function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}(t):function(e,t){return At(t,function(t){return[t,e[t]]})}(t,e(t))}}function Go(n,i,l,c,u,d,h,p){var f=2&i;if(!f&&"function"!=typeof n)throw new Oe(t);var m=c?c.length:0;if(m||(i&=-97,c=u=e),h=h===e?h:gn(ma(h),0),p=p===e?p:ma(p),m-=u?u.length:0,64&i){var g=c,y=u;c=u=e}var b=f?e:oi(n),v=[n,i,l,c,u,g,y,d,h,p];if(b&&function(e,t){var n=e[1],o=t[1],i=n|o,l=i<131,c=o==s&&8==n||o==s&&n==a&&e[7].length<=t[8]||384==o&&t[7].length<=t[8]&&8==n;if(!l&&!c)return e;1&o&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Co(d,u,t[4]):u,e[4]=d?ln(e[3],r):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ro(d,u,t[6]):u,e[6]=d?ln(e[5],r):t[6]),(u=t[7])&&(e[7]=u),o&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),n=v[0],i=v[1],l=v[2],c=v[3],u=v[4],!(p=v[9]=v[9]===e?f?0:n.length:gn(v[9]-m,0))&&24&i&&(i&=-25),i&&1!=i)w=8==i||16==i?function(t,n,r){var o=Io(t);return function i(){for(var s=arguments.length,a=oe(s),l=s,c=si(i);l--;)a[l]=arguments[l];var u=s<3&&a[0]!==c&&a[s-1]!==c?[]:ln(a,c);return(s-=u.length)<r?Wo(t,n,Po,i.placeholder,e,a,u,e,e,r-s):Et(this&&this!==ht&&this instanceof i?o:t,this,a)}}(n,i,p):i!=o&&33!=i||u.length?Po.apply(e,v):function(e,t,n,r){var o=1&t,i=Io(e);return function t(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=oe(c+a),d=this&&this!==ht&&this instanceof t?i:e;++l<c;)u[l]=r[l];for(;a--;)u[l++]=arguments[++s];return Et(d,o?n:this,u)}}(n,i,l,c);else var w=function(e,t,n){var r=1&t,o=Io(e);return function t(){return(this&&this!==ht&&this instanceof t?o:e).apply(r?n:this,arguments)}}(n,i,l);return Ni((b?Qr:Oi)(w,v),n,i)}function Zo(t,n,r,o){return t===e||Bs(t,Ne[r])&&!$e.call(o,r)?n:t}function Qo(t,n,r,o,i,s){return ta(t)&&ta(n)&&(s.set(n,t),Fr(t,n,e,Qo,s),s.delete(n)),t}function Xo(t){return ia(t)?e:t}function ei(t,n,r,o,i,s){var a=1&r,l=t.length,c=n.length;if(l!=c&&!(a&&c>l))return!1;var u=s.get(t),d=s.get(n);if(u&&d)return u==n&&d==t;var h=-1,p=!0,f=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++h<l;){var m=t[h],g=n[h];if(o)var y=a?o(g,m,h,n,t,s):o(m,g,h,t,n,s);if(y!==e){if(y)continue;p=!1;break}if(f){if(!It(n,function(e,t){if(!Qt(f,t)&&(m===e||i(m,e,r,o,s)))return f.push(t)})){p=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){p=!1;break}}return s.delete(t),s.delete(n),p}function ti(t){return _i(Mi(t,e,Wi),t+"")}function ni(e){return kr(e,Aa,di)}function ri(e){return kr(e,Da,hi)}var oi=On?function(e){return On.get(e)}:cl;function ii(e){for(var t=e.name+"",n=Tn[t],r=$e.call(Tn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function si(e){return($e.call(zn,"placeholder")?zn:e).placeholder}function ai(){var e=zn.iteratee||il;return e=e===il?Dr:e,arguments.length?e(arguments[0],arguments[1]):e}function li(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ci(e){for(var t=Aa(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Si(o)]}return t}function ui(t,n){var r=function(t,n){return null==t?e:t[n]}(t,n);return Ar(r)?r:e}var di=gt?function(e){return null==e?[]:(e=Me(e),Tt(gt(e),function(t){return Ye.call(e,t)}))}:gl,hi=gt?function(e){for(var t=[];e;)Dt(t,di(e)),e=qe(e);return t}:gl,pi=Sr;function fi(e,t,n){for(var r=-1,o=(t=bo(t,e)).length,i=!1;++r<o;){var s=zi(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&ea(o)&&yi(s,o)&&(qs(e)||Us(e))}function mi(e){return"function"!=typeof e.constructor||ki(e)?{}:Pn(qe(e))}function gi(e){return qs(e)||Us(e)||!!(Ke&&e&&e[Ke])}function yi(e,t){var n=typeof e;return!!(t=null==t?c:t)&&("number"==n||"symbol"!=n&&ye.test(e))&&e>-1&&e%1==0&&e<t}function bi(e,t,n){if(!ta(n))return!1;var r=typeof t;return!!("number"==r?Ys(n)&&yi(t,n.length):"string"==r&&t in n)&&Bs(n[t],e)}function vi(e,t){if(qs(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ca(e))||X.test(e)||!Q.test(e)||null!=t&&e in Me(t)}function wi(e){var t=ii(e),n=zn[t];if("function"!=typeof n||!(t in Hn.prototype))return!1;if(e===n)return!0;var r=oi(n);return!!r&&e===r[0]}(kn&&pi(new kn(new ArrayBuffer(1)))!=A||Sn&&pi(new Sn)!=w||En&&pi(En.resolve())!=M||Mn&&pi(new Mn)!=R||Cn&&pi(new Cn)!=_)&&(pi=function(t){var n=Sr(t),r=n==k?t.constructor:e,o=r?Pi(r):"";if(o)switch(o){case _n:return A;case Nn:return w;case An:return M;case Dn:return R;case $n:return _}return n});var xi=Ae?Qs:yl;function ki(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function Si(e){return e==e&&!ta(e)}function Ei(t,n){return function(r){return null!=r&&r[t]===n&&(n!==e||t in Me(r))}}function Mi(t,n,r){return n=gn(n===e?t.length-1:n,0),function(){for(var e=arguments,o=-1,i=gn(e.length-n,0),s=oe(i);++o<i;)s[o]=e[n+o];o=-1;for(var a=oe(n+1);++o<n;)a[o]=e[o];return a[n]=r(s),Et(t,this,a)}}function Ci(e,t){return t.length<2?e:xr(e,to(t,0,-1))}function Ri(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Oi=Ai(Qr),Ti=dt||function(e,t){return ht.setTimeout(e,t)},_i=Ai(Xr);function Ni(e,t,n){var r=t+"";return _i(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ct(h,function(n){var r="_."+n[0];t&n[1]&&!_t(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(ae):[]}(r),n)))}function Ai(t){var n=0,r=0;return function(){var o=bn(),i=16-(o-r);if(r=o,i>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(e,arguments)}}function Di(t,n){var r=-1,o=t.length,i=o-1;for(n=n===e?o:n;++r<n;){var s=Wr(r,i),a=t[s];t[s]=t[r],t[r]=a}return t.length=n,t}var $i,Li,Ii,ji=($i=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,function(e,n,r,o){t.push(r?o.replace(ue,"$1"):n||e)}),t},Li=Ls($i,function(e){return 500===Ii.size&&Ii.clear(),e}),Ii=Li.cache,Li);function zi(e){if("string"==typeof e||ca(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pi(e){if(null!=e){try{return De.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Fi(e){if(e instanceof Hn)return e.clone();var t=new Bn(e.__wrapped__,e.__chain__);return t.__actions__=Oo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Bi=Jr(function(e,t){return Js(e)?cr(e,mr(t,1,Js,!0)):[]}),Hi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),ai(r,2)):[]}),Vi=Jr(function(t,n){var r=Zi(n);return Js(r)&&(r=e),Js(t)?cr(t,mr(n,1,Js,!0),e,r):[]});function Ui(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Pt(e,ai(t,3),o)}function qi(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o-1;return r!==e&&(i=ma(r),i=r<0?gn(o+i,0):yn(i,o-1)),Pt(t,ai(n,3),i,!0)}function Wi(e){return null!=e&&e.length?mr(e,1):[]}function Yi(t){return t&&t.length?t[0]:e}var Ji=Jr(function(e){var t=At(e,go);return t.length&&t[0]===e[0]?Rr(t):[]}),Ki=Jr(function(t){var n=Zi(t),r=At(t,go);return n===Zi(r)?n=e:r.pop(),r.length&&r[0]===t[0]?Rr(r,ai(n,2)):[]}),Gi=Jr(function(t){var n=Zi(t),r=At(t,go);return(n="function"==typeof n?n:e)&&r.pop(),r.length&&r[0]===t[0]?Rr(r,e,n):[]});function Zi(t){var n=null==t?0:t.length;return n?t[n-1]:e}var Qi=Jr(Xi);function Xi(e,t){return e&&e.length&&t&&t.length?Ur(e,t):e}var es=ti(function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,At(t,function(e){return yi(e,n)?+e:e}).sort(Mo)),r});function ts(e){return null==e?e:xn.call(e)}var ns=Jr(function(e){return lo(mr(e,1,Js,!0))}),rs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),lo(mr(t,1,Js,!0),ai(n,2))}),os=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,lo(mr(t,1,Js,!0),e,n)});function is(e){if(!e||!e.length)return[];var t=0;return e=Tt(e,function(e){if(Js(e))return t=gn(e.length,t),!0}),Jt(t,function(t){return At(e,Ut(t))})}function ss(t,n){if(!t||!t.length)return[];var r=is(t);return null==n?r:At(r,function(t){return Et(n,e,t)})}var as=Jr(function(e,t){return Js(e)?cr(e,t):[]}),ls=Jr(function(e){return fo(Tt(e,Js))}),cs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),fo(Tt(t,Js),ai(n,2))}),us=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,fo(Tt(t,Js),e,n)}),ds=Jr(is),hs=Jr(function(t){var n=t.length,r=n>1?t[n-1]:e;return r="function"==typeof r?(t.pop(),r):e,ss(t,r)});function ps(e){var t=zn(e);return t.__chain__=!0,t}function fs(e,t){return t(e)}var ms=ti(function(t){var n=t.length,r=n?t[0]:0,o=this.__wrapped__,i=function(e){return or(e,t)};return!(n>1||this.__actions__.length)&&o instanceof Hn&&yi(r)?((o=o.slice(r,+r+(n?1:0))).__actions__.push({func:fs,args:[i],thisArg:e}),new Bn(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(e),t})):this.thru(i)}),gs=_o(function(e,t,n){$e.call(e,n)?++e[n]:rr(e,n,1)}),ys=jo(Ui),bs=jo(qi);function vs(e,t){return(qs(e)?Ct:ur)(e,ai(t,3))}function ws(e,t){return(qs(e)?Rt:dr)(e,ai(t,3))}var xs=_o(function(e,t,n){$e.call(e,n)?e[n].push(t):rr(e,n,[t])}),ks=Jr(function(e,t,n){var r=-1,o="function"==typeof t,i=Ys(e)?oe(e.length):[];return ur(e,function(e){i[++r]=o?Et(t,e,n):Or(e,t,n)}),i}),Ss=_o(function(e,t,n){rr(e,n,t)});function Es(e,t){return(qs(e)?At:jr)(e,ai(t,3))}var Ms=_o(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Cs=Jr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,mr(t,1),[])}),Rs=ut||function(){return ht.Date.now()};function Os(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Go(t,s,e,e,e,e,n)}function Ts(n,r){var o;if("function"!=typeof r)throw new Oe(t);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=e),o}}var _s=Jr(function(e,t,n){var r=1;if(n.length){var i=ln(n,si(_s));r|=o}return Go(e,r,t,n,i)}),Ns=Jr(function(e,t,n){var r=3;if(n.length){var i=ln(n,si(Ns));r|=o}return Go(t,r,e,n,i)});function As(n,r,o){var i,s,a,l,c,u,d=0,h=!1,p=!1,f=!0;if("function"!=typeof n)throw new Oe(t);function m(t){var r=i,o=s;return i=s=e,d=t,l=n.apply(o,r)}function g(t){var n=t-u;return u===e||n>=r||n<0||p&&t-d>=a}function y(){var e=Rs();if(g(e))return b(e);c=Ti(y,function(e){var t=r-(e-u);return p?yn(t,a-(e-d)):t}(e))}function b(t){return c=e,f&&i?m(t):(i=s=e,l)}function v(){var t=Rs(),n=g(t);if(i=arguments,s=this,u=t,n){if(c===e)return function(e){return d=e,c=Ti(y,r),h?m(e):l}(u);if(p)return xo(c),c=Ti(y,r),m(u)}return c===e&&(c=Ti(y,r)),l}return r=ya(r)||0,ta(o)&&(h=!!o.leading,a=(p="maxWait"in o)?gn(ya(o.maxWait)||0,r):a,f="trailing"in o?!!o.trailing:f),v.cancel=function(){c!==e&&xo(c),d=0,i=u=s=c=e},v.flush=function(){return c===e?l:b(Rs())},v}var Ds=Jr(function(e,t){return lr(e,1,t)}),$s=Jr(function(e,t,n){return lr(e,ya(t)||0,n)});function Ls(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new Oe(t);var r=function(){var t=arguments,o=n?n.apply(this,t):t[0],i=r.cache;if(i.has(o))return i.get(o);var s=e.apply(this,t);return r.cache=i.set(o,s)||i,s};return r.cache=new(Ls.Cache||qn),r}function Is(e){if("function"!=typeof e)throw new Oe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ls.Cache=qn;var js=vo(function(e,t){var n=(t=1==t.length&&qs(t[0])?At(t[0],Gt(ai())):At(mr(t,1),Gt(ai()))).length;return Jr(function(r){for(var o=-1,i=yn(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return Et(e,this,r)})}),zs=Jr(function(t,n){var r=ln(n,si(zs));return Go(t,o,e,n,r)}),Ps=Jr(function(t,n){var r=ln(n,si(Ps));return Go(t,64,e,n,r)}),Fs=ti(function(t,n){return Go(t,a,e,e,e,n)});function Bs(e,t){return e===t||e!=e&&t!=t}var Hs=qo(Er),Vs=qo(function(e,t){return e>=t}),Us=Tr(function(){return arguments}())?Tr:function(e){return na(e)&&$e.call(e,"callee")&&!Ye.call(e,"callee")},qs=oe.isArray,Ws=bt?Gt(bt):function(e){return na(e)&&Sr(e)==N};function Ys(e){return null!=e&&ea(e.length)&&!Qs(e)}function Js(e){return na(e)&&Ys(e)}var Ks=yt||yl,Gs=vt?Gt(vt):function(e){return na(e)&&Sr(e)==g};function Zs(e){if(!na(e))return!1;var t=Sr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ia(e)}function Qs(e){if(!ta(e))return!1;var t=Sr(e);return t==b||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xs(e){return"number"==typeof e&&e==ma(e)}function ea(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function ta(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ra=wt?Gt(wt):function(e){return na(e)&&pi(e)==w};function oa(e){return"number"==typeof e||na(e)&&Sr(e)==x}function ia(e){if(!na(e)||Sr(e)!=k)return!1;var t=qe(e);if(null===t)return!0;var n=$e.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==ze}var sa=xt?Gt(xt):function(e){return na(e)&&Sr(e)==C},aa=kt?Gt(kt):function(e){return na(e)&&pi(e)==R};function la(e){return"string"==typeof e||!qs(e)&&na(e)&&Sr(e)==O}function ca(e){return"symbol"==typeof e||na(e)&&Sr(e)==T}var ua=St?Gt(St):function(e){return na(e)&&ea(e.length)&&!!it[Sr(e)]},da=qo(Ir),ha=qo(function(e,t){return e<=t});function pa(e){if(!e)return[];if(Ys(e))return la(e)?dn(e):Oo(e);if(Ge&&e[Ge])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ge]());var t=pi(e);return(t==w?sn:t==R?cn:Ba)(e)}function fa(e){return e?(e=ya(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ma(e){var t=fa(e),n=t%1;return t==t?n?t-n:t:0}function ga(e){return e?ir(ma(e),0,d):0}function ya(e){if("number"==typeof e)return e;if(ca(e))return u;if(ta(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ta(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Kt(e);var n=fe.test(e);return n||ge.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?u:+e}function ba(e){return To(e,Da(e))}function va(e){return null==e?"":ao(e)}var wa=No(function(e,t){if(ki(t)||Ys(t))To(t,Aa(t),e);else for(var n in t)$e.call(t,n)&&Xn(e,n,t[n])}),xa=No(function(e,t){To(t,Da(t),e)}),ka=No(function(e,t,n,r){To(t,Da(t),e,r)}),Sa=No(function(e,t,n,r){To(t,Aa(t),e,r)}),Ea=ti(or),Ma=Jr(function(t,n){t=Me(t);var r=-1,o=n.length,i=o>2?n[2]:e;for(i&&bi(n[0],n[1],i)&&(o=1);++r<o;)for(var s=n[r],a=Da(s),l=-1,c=a.length;++l<c;){var u=a[l],d=t[u];(d===e||Bs(d,Ne[u])&&!$e.call(t,u))&&(t[u]=s[u])}return t}),Ca=Jr(function(t){return t.push(e,Qo),Et(La,e,t)});function Ra(t,n,r){var o=null==t?e:xr(t,n);return o===e?r:o}function Oa(e,t){return null!=e&&fi(e,t,Cr)}var Ta=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=n},tl(ol)),_a=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),$e.call(e,t)?e[t].push(n):e[t]=[n]},ai),Na=Jr(Or);function Aa(e){return Ys(e)?Jn(e):$r(e)}function Da(e){return Ys(e)?Jn(e,!0):Lr(e)}var $a=No(function(e,t,n){Fr(e,t,n)}),La=No(function(e,t,n,r){Fr(e,t,n,r)}),Ia=ti(function(e,t){var n={};if(null==e)return n;var r=!1;t=At(t,function(t){return t=bo(t,e),r||(r=t.length>1),t}),To(e,ri(e),n),r&&(n=sr(n,7,Xo));for(var o=t.length;o--;)co(n,t[o]);return n}),ja=ti(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Oa(e,n)})}(e,t)});function za(e,t){if(null==e)return{};var n=At(ri(e),function(e){return[e]});return t=ai(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Pa=Ko(Aa),Fa=Ko(Da);function Ba(e){return null==e?[]:Zt(e,Aa(e))}var Ha=Lo(function(e,t,n){return t=t.toLowerCase(),e+(n?Va(t):t)});function Va(e){return Za(va(e).toLowerCase())}function Ua(e){return(e=va(e))&&e.replace(be,tn).replace(Qe,"")}var qa=Lo(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Wa=Lo(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ya=$o("toLowerCase"),Ja=Lo(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Ka=Lo(function(e,t,n){return e+(n?" ":"")+Za(t)}),Ga=Lo(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Za=$o("toUpperCase");function Qa(t,n,r){return t=va(t),(n=r?e:n)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(et)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(n)||[]}var Xa=Jr(function(t,n){try{return Et(t,e,n)}catch(r){return Zs(r)?r:new ke(r)}}),el=ti(function(e,t){return Ct(t,function(t){t=zi(t),rr(e,t,_s(e[t],e))}),e});function tl(e){return function(){return e}}var nl=zo(),rl=zo(!0);function ol(e){return e}function il(e){return Dr("function"==typeof e?e:sr(e,1))}var sl=Jr(function(e,t){return function(n){return Or(n,e,t)}}),al=Jr(function(e,t){return function(n){return Or(e,n,t)}});function ll(e,t,n){var r=Aa(t),o=wr(t,r);null!=n||ta(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=wr(t,Aa(t)));var i=!(ta(n)&&"chain"in n&&!n.chain),s=Qs(e);return Ct(o,function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__);return(n.__actions__=Oo(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Dt([this.value()],arguments))})}),e}function cl(){}var ul=Ho(At),dl=Ho(Ot),hl=Ho(It);function pl(e){return vi(e)?Ut(zi(e)):function(e){return function(t){return xr(t,e)}}(e)}var fl=Uo(),ml=Uo(!0);function gl(){return[]}function yl(){return!1}var bl,vl=Bo(function(e,t){return e+t},0),wl=Yo("ceil"),xl=Bo(function(e,t){return e/t},1),kl=Yo("floor"),Sl=Bo(function(e,t){return e*t},1),El=Yo("round"),Ml=Bo(function(e,t){return e-t},0);return zn.after=function(e,n){if("function"!=typeof n)throw new Oe(t);return e=ma(e),function(){if(--e<1)return n.apply(this,arguments)}},zn.ary=Os,zn.assign=wa,zn.assignIn=xa,zn.assignInWith=ka,zn.assignWith=Sa,zn.at=Ea,zn.before=Ts,zn.bind=_s,zn.bindAll=el,zn.bindKey=Ns,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qs(e)?e:[e]},zn.chain=ps,zn.chunk=function(t,n,r){n=(r?bi(t,n,r):n===e)?1:gn(ma(n),0);var o=null==t?0:t.length;if(!o||n<1)return[];for(var i=0,s=0,a=oe(pt(o/n));i<o;)a[s++]=to(t,i,i+=n);return a},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=oe(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Dt(qs(n)?Oo(n):[n],mr(t,1))},zn.cond=function(e){var n=null==e?0:e.length,r=ai();return e=n?At(e,function(e){if("function"!=typeof e[1])throw new Oe(t);return[r(e[0]),e[1]]}):[],Jr(function(t){for(var r=-1;++r<n;){var o=e[r];if(Et(o[0],this,t))return Et(o[1],this,t)}})},zn.conforms=function(e){return function(e){var t=Aa(e);return function(n){return ar(n,e,t)}}(sr(e,1))},zn.constant=tl,zn.countBy=gs,zn.create=function(e,t){var n=Pn(e);return null==t?n:nr(n,t)},zn.curry=function t(n,r,o){var i=Go(n,8,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.curryRight=function t(n,r,o){var i=Go(n,16,e,e,e,e,e,r=o?e:r);return i.placeholder=t.placeholder,i},zn.debounce=As,zn.defaults=Ma,zn.defaultsDeep=Ca,zn.defer=Ds,zn.delay=$s,zn.difference=Bi,zn.differenceBy=Hi,zn.differenceWith=Vi,zn.drop=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=r||n===e?1:ma(n))<0?0:n,o):[]},zn.dropRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,0,(n=o-(n=r||n===e?1:ma(n)))<0?0:n):[]},zn.dropRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!0):[]},zn.fill=function(t,n,r,o){var i=null==t?0:t.length;return i?(r&&"number"!=typeof r&&bi(t,n,r)&&(r=0,o=i),function(t,n,r,o){var i=t.length;for((r=ma(r))<0&&(r=-r>i?0:i+r),(o=o===e||o>i?i:ma(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)t[r++]=n;return t}(t,n,r,o)):[]},zn.filter=function(e,t){return(qs(e)?Tt:fr)(e,ai(t,3))},zn.flatMap=function(e,t){return mr(Es(e,t),1)},zn.flatMapDeep=function(e,t){return mr(Es(e,t),l)},zn.flatMapDepth=function(t,n,r){return r=r===e?1:ma(r),mr(Es(t,n),r)},zn.flatten=Wi,zn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},zn.flattenDepth=function(t,n){return null!=t&&t.length?mr(t,n=n===e?1:ma(n)):[]},zn.flip=function(e){return Go(e,512)},zn.flow=nl,zn.flowRight=rl,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},zn.functions=function(e){return null==e?[]:wr(e,Aa(e))},zn.functionsIn=function(e){return null==e?[]:wr(e,Da(e))},zn.groupBy=xs,zn.initial=function(e){return null!=e&&e.length?to(e,0,-1):[]},zn.intersection=Ji,zn.intersectionBy=Ki,zn.intersectionWith=Gi,zn.invert=Ta,zn.invertBy=_a,zn.invokeMap=ks,zn.iteratee=il,zn.keyBy=Ss,zn.keys=Aa,zn.keysIn=Da,zn.map=Es,zn.mapKeys=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,t(e,r,o),e)}),n},zn.mapValues=function(e,t){var n={};return t=ai(t,3),br(e,function(e,r,o){rr(n,r,t(e,r,o))}),n},zn.matches=function(e){return zr(sr(e,1))},zn.matchesProperty=function(e,t){return Pr(e,sr(t,1))},zn.memoize=Ls,zn.merge=$a,zn.mergeWith=La,zn.method=sl,zn.methodOf=al,zn.mixin=ll,zn.negate=Is,zn.nthArg=function(e){return e=ma(e),Jr(function(t){return Br(t,e)})},zn.omit=Ia,zn.omitBy=function(e,t){return za(e,Is(ai(t)))},zn.once=function(e){return Ts(2,e)},zn.orderBy=function(t,n,r,o){return null==t?[]:(qs(n)||(n=null==n?[]:[n]),qs(r=o?e:r)||(r=null==r?[]:[r]),Hr(t,n,r))},zn.over=ul,zn.overArgs=js,zn.overEvery=dl,zn.overSome=hl,zn.partial=zs,zn.partialRight=Ps,zn.partition=Ms,zn.pick=ja,zn.pickBy=za,zn.property=pl,zn.propertyOf=function(t){return function(n){return null==t?e:xr(t,n)}},zn.pull=Qi,zn.pullAll=Xi,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Ur(e,t,ai(n,2)):e},zn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?Ur(t,n,e,r):t},zn.pullAt=es,zn.range=fl,zn.rangeRight=ml,zn.rearg=Fs,zn.reject=function(e,t){return(qs(e)?Tt:fr)(e,Is(ai(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=ai(t,3);++r<i;){var s=e[r];t(s,r,e)&&(n.push(s),o.push(r))}return qr(e,o),n},zn.rest=function(n,r){if("function"!=typeof n)throw new Oe(t);return Jr(n,r=r===e?r:ma(r))},zn.reverse=ts,zn.sampleSize=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),(qs(t)?Gn:Gr)(t,n)},zn.set=function(e,t,n){return null==e?e:Zr(e,t,n)},zn.setWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:Zr(t,n,r,o)},zn.shuffle=function(e){return(qs(e)?Zn:eo)(e)},zn.slice=function(t,n,r){var o=null==t?0:t.length;return o?(r&&"number"!=typeof r&&bi(t,n,r)?(n=0,r=o):(n=null==n?0:ma(n),r=r===e?o:ma(r)),to(t,n,r)):[]},zn.sortBy=Cs,zn.sortedUniq=function(e){return e&&e.length?io(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?io(e,ai(t,2)):[]},zn.split=function(t,n,r){return r&&"number"!=typeof r&&bi(t,n,r)&&(n=r=e),(r=r===e?d:r>>>0)?(t=va(t))&&("string"==typeof n||null!=n&&!sa(n))&&!(n=ao(n))&&on(t)?wo(dn(t),0,r):t.split(n,r):[]},zn.spread=function(e,n){if("function"!=typeof e)throw new Oe(t);return n=null==n?0:gn(ma(n),0),Jr(function(t){var r=t[n],o=wo(t,0,n);return r&&Dt(o,r),Et(e,this,o)})},zn.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},zn.take=function(t,n,r){return t&&t.length?to(t,0,(n=r||n===e?1:ma(n))<0?0:n):[]},zn.takeRight=function(t,n,r){var o=null==t?0:t.length;return o?to(t,(n=o-(n=r||n===e?1:ma(n)))<0?0:n,o):[]},zn.takeRightWhile=function(e,t){return e&&e.length?ho(e,ai(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?ho(e,ai(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,n,r){var o=!0,i=!0;if("function"!=typeof e)throw new Oe(t);return ta(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),As(e,n,{leading:o,maxWait:n,trailing:i})},zn.thru=fs,zn.toArray=pa,zn.toPairs=Pa,zn.toPairsIn=Fa,zn.toPath=function(e){return qs(e)?At(e,zi):ca(e)?[e]:Oo(ji(va(e)))},zn.toPlainObject=ba,zn.transform=function(e,t,n){var r=qs(e),o=r||Ks(e)||ua(e);if(t=ai(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:ta(e)&&Qs(i)?Pn(qe(e)):{}}return(o?Ct:br)(e,function(e,r,o){return t(n,e,r,o)}),n},zn.unary=function(e){return Os(e,1)},zn.union=ns,zn.unionBy=rs,zn.unionWith=os,zn.uniq=function(e){return e&&e.length?lo(e):[]},zn.uniqBy=function(e,t){return e&&e.length?lo(e,ai(t,2)):[]},zn.uniqWith=function(t,n){return n="function"==typeof n?n:e,t&&t.length?lo(t,e,n):[]},zn.unset=function(e,t){return null==e||co(e,t)},zn.unzip=is,zn.unzipWith=ss,zn.update=function(e,t,n){return null==e?e:uo(e,t,yo(n))},zn.updateWith=function(t,n,r,o){return o="function"==typeof o?o:e,null==t?t:uo(t,n,yo(r),o)},zn.values=Ba,zn.valuesIn=function(e){return null==e?[]:Zt(e,Da(e))},zn.without=as,zn.words=Qa,zn.wrap=function(e,t){return zs(yo(t),e)},zn.xor=ls,zn.xorBy=cs,zn.xorWith=us,zn.zip=ds,zn.zipObject=function(e,t){return mo(e||[],t||[],Xn)},zn.zipObjectDeep=function(e,t){return mo(e||[],t||[],Zr)},zn.zipWith=hs,zn.entries=Pa,zn.entriesIn=Fa,zn.extend=xa,zn.extendWith=ka,ll(zn,zn),zn.add=vl,zn.attempt=Xa,zn.camelCase=Ha,zn.capitalize=Va,zn.ceil=wl,zn.clamp=function(t,n,r){return r===e&&(r=n,n=e),r!==e&&(r=(r=ya(r))==r?r:0),n!==e&&(n=(n=ya(n))==n?n:0),ir(ya(t),n,r)},zn.clone=function(e){return sr(e,4)},zn.cloneDeep=function(e){return sr(e,5)},zn.cloneDeepWith=function(t,n){return sr(t,5,n="function"==typeof n?n:e)},zn.cloneWith=function(t,n){return sr(t,4,n="function"==typeof n?n:e)},zn.conformsTo=function(e,t){return null==t||ar(e,t,Aa(t))},zn.deburr=Ua,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=xl,zn.endsWith=function(t,n,r){t=va(t),n=ao(n);var o=t.length,i=r=r===e?o:ir(ma(r),0,o);return(r-=n.length)>=0&&t.slice(r,i)==n},zn.eq=Bs,zn.escape=function(e){return(e=va(e))&&J.test(e)?e.replace(W,nn):e},zn.escapeRegExp=function(e){return(e=va(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(t,n,r){var o=qs(t)?Ot:hr;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.find=ys,zn.findIndex=Ui,zn.findKey=function(e,t){return zt(e,ai(t,3),br)},zn.findLast=bs,zn.findLastIndex=qi,zn.findLastKey=function(e,t){return zt(e,ai(t,3),vr)},zn.floor=kl,zn.forEach=vs,zn.forEachRight=ws,zn.forIn=function(e,t){return null==e?e:gr(e,ai(t,3),Da)},zn.forInRight=function(e,t){return null==e?e:yr(e,ai(t,3),Da)},zn.forOwn=function(e,t){return e&&br(e,ai(t,3))},zn.forOwnRight=function(e,t){return e&&vr(e,ai(t,3))},zn.get=Ra,zn.gt=Hs,zn.gte=Vs,zn.has=function(e,t){return null!=e&&fi(e,t,Mr)},zn.hasIn=Oa,zn.head=Yi,zn.identity=ol,zn.includes=function(e,t,n,r){e=Ys(e)?e:Ba(e),n=n&&!r?ma(n):0;var o=e.length;return n<0&&(n=gn(o+n,0)),la(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Ft(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ma(n);return o<0&&(o=gn(r+o,0)),Ft(e,t,o)},zn.inRange=function(t,n,r){return n=fa(n),r===e?(r=n,n=0):r=fa(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(t=ya(t),n,r)},zn.invoke=Na,zn.isArguments=Us,zn.isArray=qs,zn.isArrayBuffer=Ws,zn.isArrayLike=Ys,zn.isArrayLikeObject=Js,zn.isBoolean=function(e){return!0===e||!1===e||na(e)&&Sr(e)==m},zn.isBuffer=Ks,zn.isDate=Gs,zn.isElement=function(e){return na(e)&&1===e.nodeType&&!ia(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Ys(e)&&(qs(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ua(e)||Us(e)))return!e.length;var t=pi(e);if(t==w||t==R)return!e.size;if(ki(e))return!$r(e).length;for(var n in e)if($e.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return _r(e,t)},zn.isEqualWith=function(t,n,r){var o=(r="function"==typeof r?r:e)?r(t,n):e;return o===e?_r(t,n,e,r):!!o},zn.isError=Zs,zn.isFinite=function(e){return"number"==typeof e&&jt(e)},zn.isFunction=Qs,zn.isInteger=Xs,zn.isLength=ea,zn.isMap=ra,zn.isMatch=function(e,t){return e===t||Nr(e,t,ci(t))},zn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Nr(t,n,ci(n),r)},zn.isNaN=function(e){return oa(e)&&e!=+e},zn.isNative=function(e){if(xi(e))throw new ke("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Ar(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=oa,zn.isObject=ta,zn.isObjectLike=na,zn.isPlainObject=ia,zn.isRegExp=sa,zn.isSafeInteger=function(e){return Xs(e)&&e>=-9007199254740991&&e<=c},zn.isSet=aa,zn.isString=la,zn.isSymbol=ca,zn.isTypedArray=ua,zn.isUndefined=function(t){return t===e},zn.isWeakMap=function(e){return na(e)&&pi(e)==_},zn.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":qt.call(e,t)},zn.kebabCase=qa,zn.last=Zi,zn.lastIndexOf=function(t,n,r){var o=null==t?0:t.length;if(!o)return-1;var i=o;return r!==e&&(i=(i=ma(r))<0?gn(o+i,0):yn(i,o-1)),n==n?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(t,n,i):Pt(t,Ht,i,!0)},zn.lowerCase=Wa,zn.lowerFirst=Ya,zn.lt=da,zn.lte=ha,zn.max=function(t){return t&&t.length?pr(t,ol,Er):e},zn.maxBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Er):e},zn.mean=function(e){return Vt(e,ol)},zn.meanBy=function(e,t){return Vt(e,ai(t,2))},zn.min=function(t){return t&&t.length?pr(t,ol,Ir):e},zn.minBy=function(t,n){return t&&t.length?pr(t,ai(n,2),Ir):e},zn.stubArray=gl,zn.stubFalse=yl,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Sl,zn.nth=function(t,n){return t&&t.length?Br(t,ma(n)):e},zn.noConflict=function(){return ht._===this&&(ht._=Pe),this},zn.noop=cl,zn.now=Rs,zn.pad=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Vo(ft(o),n)+e+Vo(pt(o),n)},zn.padEnd=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?e+Vo(t-r,n):e},zn.padStart=function(e,t,n){e=va(e);var r=(t=ma(t))?un(e):0;return t&&r<t?Vo(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),vn(va(e).replace(re,""),t||0)},zn.random=function(t,n,r){if(r&&"boolean"!=typeof r&&bi(t,n,r)&&(n=r=e),r===e&&("boolean"==typeof n?(r=n,n=e):"boolean"==typeof t&&(r=t,t=e)),t===e&&n===e?(t=0,n=1):(t=fa(t),n===e?(n=t,t=0):n=fa(n)),t>n){var o=t;t=n,n=o}if(r||t%1||n%1){var i=wn();return yn(t+i*(n-t+lt("1e-"+((i+"").length-1))),n)}return Wr(t,n)},zn.reduce=function(e,t,n){var r=qs(e)?$t:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,ur)},zn.reduceRight=function(e,t,n){var r=qs(e)?Lt:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,dr)},zn.repeat=function(t,n,r){return n=(r?bi(t,n,r):n===e)?1:ma(n),Yr(va(t),n)},zn.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(t,n,r){var o=-1,i=(n=bo(n,t)).length;for(i||(i=1,t=e);++o<i;){var s=null==t?e:t[zi(n[o])];s===e&&(o=i,s=r),t=Qs(s)?s.call(t):s}return t},zn.round=El,zn.runInContext=i,zn.sample=function(e){return(qs(e)?Kn:Kr)(e)},zn.size=function(e){if(null==e)return 0;if(Ys(e))return la(e)?un(e):e.length;var t=pi(e);return t==w||t==R?e.size:$r(e).length},zn.snakeCase=Ja,zn.some=function(t,n,r){var o=qs(t)?It:no;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.sortedIndex=function(e,t){return ro(e,t)},zn.sortedIndexBy=function(e,t,n){return oo(e,t,ai(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ro(e,t);if(r<n&&Bs(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ro(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oo(e,t,ai(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ro(e,t,!0)-1;if(Bs(e[n],t))return n}return-1},zn.startCase=Ka,zn.startsWith=function(e,t,n){return e=va(e),n=null==n?0:ir(ma(n),0,e.length),t=ao(t),e.slice(n,n+t.length)==t},zn.subtract=Ml,zn.sum=function(e){return e&&e.length?Yt(e,ol):0},zn.sumBy=function(e,t){return e&&e.length?Yt(e,ai(t,2)):0},zn.template=function(t,n,r){var o=zn.templateSettings;r&&bi(t,n,r)&&(n=e),t=va(t),n=ka({},n,o,Zo);var i,s,a=ka({},n.imports,o.imports,Zo),l=Aa(a),c=Zt(a,l),u=0,d=n.interpolate||ve,h="__p += '",p=Ce((n.escape||ve).source+"|"+d.source+"|"+(d===Z?de:ve).source+"|"+(n.evaluate||ve).source+"|$","g"),f="//# sourceURL="+($e.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(p,function(e,n,r,o,a,l){return r||(r=o),h+=t.slice(u,l).replace(we,rn),n&&(i=!0,h+="' +\n__e("+n+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),h+="';\n";var m=$e.call(n,"variable")&&n.variable;if(m){if(ce.test(m))throw new ke("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(H,""):h).replace(V,"$1").replace(U,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Xa(function(){return Se(l,f+"return "+h).apply(e,c)});if(g.source=h,Zs(g))throw g;return g},zn.times=function(e,t){if((e=ma(e))<1||e>c)return[];var n=d,r=yn(e,d);t=ai(t),e-=d;for(var o=Jt(r,t);++n<e;)t(n);return o},zn.toFinite=fa,zn.toInteger=ma,zn.toLength=ga,zn.toLower=function(e){return va(e).toLowerCase()},zn.toNumber=ya,zn.toSafeInteger=function(e){return e?ir(ma(e),-9007199254740991,c):0===e?e:0},zn.toString=va,zn.toUpper=function(e){return va(e).toUpperCase()},zn.trim=function(t,n,r){if((t=va(t))&&(r||n===e))return Kt(t);if(!t||!(n=ao(n)))return t;var o=dn(t),i=dn(n);return wo(o,Xt(o,i),en(o,i)+1).join("")},zn.trimEnd=function(t,n,r){if((t=va(t))&&(r||n===e))return t.slice(0,hn(t)+1);if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,0,en(o,dn(n))+1).join("")},zn.trimStart=function(t,n,r){if((t=va(t))&&(r||n===e))return t.replace(re,"");if(!t||!(n=ao(n)))return t;var o=dn(t);return wo(o,Xt(o,dn(n))).join("")},zn.truncate=function(t,n){var r=30,o="...";if(ta(n)){var i="separator"in n?n.separator:i;r="length"in n?ma(n.length):r,o="omission"in n?ao(n.omission):o}var s=(t=va(t)).length;if(on(t)){var a=dn(t);s=a.length}if(r>=s)return t;var l=r-un(o);if(l<1)return o;var c=a?wo(a,0,l).join(""):t.slice(0,l);if(i===e)return c+o;if(a&&(l+=c.length-l),sa(i)){if(t.slice(l).search(i)){var u,d=c;for(i.global||(i=Ce(i.source,va(he.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var h=u.index;c=c.slice(0,h===e?l:h)}}else if(t.indexOf(ao(i),l)!=l){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+o},zn.unescape=function(e){return(e=va(e))&&Y.test(e)?e.replace(q,pn):e},zn.uniqueId=function(e){var t=++Le;return va(e)+t},zn.upperCase=Ga,zn.upperFirst=Za,zn.each=vs,zn.eachRight=ws,zn.first=Yi,ll(zn,(bl={},br(zn,function(e,t){$e.call(zn.prototype,t)||(bl[t]=e)}),bl),{chain:!1}),zn.VERSION="4.17.23",Ct(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){zn[e].placeholder=zn}),Ct(["drop","take"],function(t,n){Hn.prototype[t]=function(r){r=r===e?1:gn(ma(r),0);var o=this.__filtered__&&!n?new Hn(this):this.clone();return o.__filtered__?o.__takeCount__=yn(r,o.__takeCount__):o.__views__.push({size:yn(r,d),type:t+(o.__dir__<0?"Right":"")}),o},Hn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ct(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Hn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ai(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),Ct(["head","last"],function(e,t){var n="take"+(t?"Right":"");Hn.prototype[e]=function(){return this[n](1).value()[0]}}),Ct(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Hn.prototype[e]=function(){return this.__filtered__?new Hn(this):this[n](1)}}),Hn.prototype.compact=function(){return this.filter(ol)},Hn.prototype.find=function(e){return this.filter(e).head()},Hn.prototype.findLast=function(e){return this.reverse().find(e)},Hn.prototype.invokeMap=Jr(function(e,t){return"function"==typeof e?new Hn(this):this.map(function(n){return Or(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(Is(ai(e)))},Hn.prototype.slice=function(t,n){t=ma(t);var r=this;return r.__filtered__&&(t>0||n<0)?new Hn(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==e&&(r=(n=ma(n))<0?r.dropRight(-n):r.take(n-t)),r)},Hn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hn.prototype.toArray=function(){return this.take(d)},br(Hn.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),o=/^(?:head|last)$/.test(n),i=zn[o?"take"+("last"==n?"Right":""):n],s=o||/^find/.test(n);i&&(zn.prototype[n]=function(){var n=this.__wrapped__,a=o?[1]:arguments,l=n instanceof Hn,c=a[0],u=l||qs(n),d=function(e){var t=i.apply(zn,Dt([e],a));return o&&h?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,m=l&&!p;if(!s&&u){n=m?n:new Hn(this);var g=t.apply(n,a);return g.__actions__.push({func:fs,args:[d],thisArg:e}),new Bn(g,h)}return f&&m?t.apply(this,a):(g=this.thru(d),f?o?g.value()[0]:g.value():g)})}),Ct(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(qs(o)?o:[],e)}return this[n](function(n){return t.apply(qs(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";$e.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}}),Tn[Po(e,2).name]=[{name:"wrapper",func:e}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Oo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oo(this.__views__),e},Hn.prototype.reverse=function(){if(this.__filtered__){var e=new Hn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){for(var r=-1,o=n.length;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=yn(t,e+s);break;case"takeRight":e=gn(e,t-s)}}return{start:e,end:t}}(0,o,this.__views__),s=i.start,a=i.end,l=a-s,c=r?a:s-1,u=this.__iteratees__,d=u.length,h=0,p=yn(l,this.__takeCount__);if(!n||!r&&o==l&&p==l)return po(e,this.__actions__);var f=[];e:for(;l--&&h<p;){for(var m=-1,g=e[c+=t];++m<d;){var y=u[m],b=y.iteratee,v=y.type,w=b(g);if(2==v)g=w;else if(!w){if(1==v)continue e;break e}}f[h++]=g}return f},zn.prototype.at=ms,zn.prototype.chain=function(){return ps(this)},zn.prototype.commit=function(){return new Bn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===e&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},zn.prototype.plant=function(t){for(var n,r=this;r instanceof Fn;){var o=Fi(r);o.__index__=0,o.__values__=e,n?i.__wrapped__=o:n=o;var i=o;r=r.__wrapped__}return i.__wrapped__=t,n},zn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hn){var n=t;return this.__actions__.length&&(n=new Hn(this)),(n=n.reverse()).__actions__.push({func:fs,args:[ts],thisArg:e}),new Bn(n,this.__chain__)}return this.thru(ts)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return po(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Ge&&(zn.prototype[Ge]=function(){return this}),zn}();ft?((ft.exports=fn)._=fn,pt._=fn):ht._=fn}.call(M.exports));const N=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),A="-",D=[],$=e=>{const t=j(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return I(e);const n=e.split(A),r=""===n[0]&&n.length>1?1:0;return L(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],o=n[e];return t?o?((e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(o,t):t:o||D}return n[e]||D}}},L=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=L(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(A):e.slice(t).join(A),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},I=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),j=e=>{const{theme:t,classGroups:n}=e;return z(n,t)},z=(e,t)=>{const n=N();for(const r in e){const o=e[r];P(o,n,r,t)}return n},P=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];F(o,t,n,r)}},F=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?V(e,t,n,r):H(e,t,n,r):B(e,t,n)},B=(e,t,n)=>{(""===e?t:U(t,e)).classGroupId=n},H=(e,t,n,r)=>{q(e)?P(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},V=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];P(i,U(t,e),n,r)}},U=(e,t)=>{let n=e;const r=t.split(A),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=N(),n.nextPart.set(e,t)),n=t}return n},q=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,W=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set(e,t){e in n?n[e]=t:o(e,t)}}},Y=[],J=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),K=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,o=0,i=0;const s=e.length;for(let u=0;u<s;u++){const s=e[u];if(0===r&&0===o){if(":"===s){t.push(e.slice(i,u)),i=u+1;continue}if("/"===s){n=u;continue}}"["===s?r++:"]"===s?r--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let l=a,c=!1;a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0);return J(t,c,l,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):J(Y,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},G=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(i)):r.push(i)}return r.length>0&&(r.sort(),n.push(...r)),n}},Z=/\s+/,Q=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Q(e[r]))&&(n&&(n+=" "),n+=t);return n},X=[],ee=e=>{const t=t=>t[e]||X;return t.isThemeGetter=!0,t},te=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,re=/^\d+\/\d+$/,oe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,se=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,le=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=e=>re.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),de=e=>!!e&&Number.isInteger(Number(e)),he=e=>e.endsWith("%")&&ue(e.slice(0,-1)),pe=e=>oe.test(e),fe=()=>!0,me=e=>ie.test(e)&&!se.test(e),ge=()=>!1,ye=e=>ae.test(e),be=e=>le.test(e),ve=e=>!xe(e)&&!Re(e),we=e=>$e(e,ze,ge),xe=e=>te.test(e),ke=e=>$e(e,Pe,me),Se=e=>$e(e,Fe,ue),Ee=e=>$e(e,Ie,ge),Me=e=>$e(e,je,be),Ce=e=>$e(e,He,ye),Re=e=>ne.test(e),Oe=e=>Le(e,Pe),Te=e=>Le(e,Be),_e=e=>Le(e,Ie),Ne=e=>Le(e,ze),Ae=e=>Le(e,je),De=e=>Le(e,He,!0),$e=(e,t,n)=>{const r=te.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Le=(e,t,n=!1)=>{const r=ne.exec(e);return!!r&&(r[1]?t(r[1]):n)},Ie=e=>"position"===e||"percentage"===e,je=e=>"image"===e||"url"===e,ze=e=>"length"===e||"size"===e||"bg-size"===e,Pe=e=>"length"===e,Fe=e=>"number"===e,Be=e=>"family-name"===e,He=e=>"shadow"===e,Ve=((e,...t)=>{let n,r,o,i;const s=e=>{const t=r(e);if(t)return t;const i=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(Z);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let f=!!p,m=r(f?h.substring(0,p):h);if(!m){if(!f){l=e+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=e+(l.length>0?" "+l:l);continue}f=!1}const g=0===u.length?"":1===u.length?u[0]:i(u).join(":"),y=d?g+"!":g,b=y+m;if(s.indexOf(b)>-1)continue;s.push(b);const v=o(m,f);for(let n=0;n<v.length;++n){const e=v[n];s.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>{const l=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:W(e.cacheSize),parseClassName:K(e),sortModifiers:G(e),...$(e)}))(l),r=n.cache.get,o=n.cache.set,i=s,s(a)},(...e)=>i(((...e)=>{let t,n,r=0,o="";for(;r<e.length;)(t=e[r++])&&(n=Q(t))&&(o&&(o+=" "),o+=n);return o})(...e))})(()=>{const e=ee("color"),t=ee("font"),n=ee("text"),r=ee("font-weight"),o=ee("tracking"),i=ee("leading"),s=ee("breakpoint"),a=ee("container"),l=ee("spacing"),c=ee("radius"),u=ee("shadow"),d=ee("inset-shadow"),h=ee("text-shadow"),p=ee("drop-shadow"),f=ee("blur"),m=ee("perspective"),g=ee("aspect"),y=ee("ease"),b=ee("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Re,xe],w=()=>[Re,xe,l],x=()=>[ce,"full","auto",...w()],k=()=>[de,"none","subgrid",Re,xe],S=()=>["auto",{span:["full",de,Re,xe]},de,Re,xe],E=()=>[de,"auto",Re,xe],M=()=>["auto","min","max","fr",Re,xe],C=()=>["auto",...w()],R=()=>[ce,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],O=()=>[e,Re,xe],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",_e,Ee,{position:[Re,xe]}],_=()=>["auto","cover","contain",Ne,we,{size:[Re,xe]}],N=()=>[he,Oe,ke],A=()=>["","none","full",c,Re,xe],D=()=>["",ue,Oe,ke],$=()=>[ue,he,_e,Ee],L=()=>["","none",f,Re,xe],I=()=>["none",ue,Re,xe],j=()=>["none",ue,Re,xe],z=()=>[ue,Re,xe],P=()=>[ce,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pe],breakpoint:[pe],color:[fe],container:[pe],"drop-shadow":[pe],ease:["in","out","in-out"],font:[ve],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pe],shadow:[pe],spacing:["px",ue],text:[pe],"text-shadow":[pe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ce,xe,Re,g]}],container:["container"],columns:[{columns:[ue,xe,Re,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[de,"auto",Re,xe]}],basis:[{basis:[ce,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,ce,"auto","initial","none",xe]}],grow:[{grow:["",ue,Re,xe]}],shrink:[{shrink:["",ue,Re,xe]}],order:[{order:[de,"first","last","none",Re,xe]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:S()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:S()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[a,"screen",...R()]}],"min-w":[{"min-w":[a,"screen","none",...R()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,Oe,ke]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Re,Se]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",he,xe]}],"font-family":[{font:[Te,xe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Re,xe]}],"line-clamp":[{"line-clamp":[ue,"none",Re,Se]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Re,xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Re,xe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",Re,ke]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[ue,"auto",Re,xe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re,xe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re,xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},de,Re,xe],radial:["",Re,xe],conic:[de,Re,xe]},Ae,Me]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:N()}],"gradient-via-pos":[{via:N()}],"gradient-to-pos":[{to:N()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[ue,Re,xe]}],"outline-w":[{outline:["",ue,Oe,ke]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,De,Ce]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,De,Ce]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[ue,ke]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,De,Ce]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[ue,Re,xe]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Re,xe]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Re,xe]}],filter:[{filter:["","none",Re,xe]}],blur:[{blur:L()}],brightness:[{brightness:[ue,Re,xe]}],contrast:[{contrast:[ue,Re,xe]}],"drop-shadow":[{"drop-shadow":["","none",p,De,Ce]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",ue,Re,xe]}],"hue-rotate":[{"hue-rotate":[ue,Re,xe]}],invert:[{invert:["",ue,Re,xe]}],saturate:[{saturate:[ue,Re,xe]}],sepia:[{sepia:["",ue,Re,xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Re,xe]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[ue,Re,xe]}],"backdrop-contrast":[{"backdrop-contrast":[ue,Re,xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,Re,xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,Re,xe]}],"backdrop-invert":[{"backdrop-invert":["",ue,Re,xe]}],"backdrop-opacity":[{"backdrop-opacity":[ue,Re,xe]}],"backdrop-saturate":[{"backdrop-saturate":[ue,Re,xe]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,Re,xe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Re,xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",Re,xe]}],ease:[{ease:["linear","initial",y,Re,xe]}],delay:[{delay:[ue,Re,xe]}],animate:[{animate:["none",b,Re,xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Re,xe]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:I()}],"rotate-x":[{"rotate-x":I()}],"rotate-y":[{"rotate-y":I()}],"rotate-z":[{"rotate-z":I()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:z()}],"skew-x":[{"skew-x":z()}],"skew-y":[{"skew-y":z()}],transform:[{transform:[Re,xe,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:P()}],"translate-x":[{"translate-x":P()}],"translate-y":[{"translate-y":P()}],"translate-z":[{"translate-z":P()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re,xe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re,xe]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[ue,Oe,ke,Se]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Ue(...e){return Ve(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=_(e))&&(r&&(r+=" "),r+=t);return r}(e))}const qe=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),We=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ye={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Je=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},Ke=e.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:s,iconNode:a,...l},c)=>e.createElement("svg",{ref:c,...Ye,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:qe("lucide",i),...!s&&!Je(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,n])=>e.createElement(t,n)),...Array.isArray(s)?s:[s]])),Ge=(t,n)=>{const r=e.forwardRef(({className:r,...o},i)=>{return e.createElement(Ke,{ref:i,iconNode:n,className:qe(`lucide-${s=We(t),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var s});return r.displayName=We(t),r},Ze=Ge("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),Qe=Ge("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Xe=Ge("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),et=Ge("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),tt=Ge("highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]),nt=Ge("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),rt=Ge("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),ot=Ge("list-indent-decrease",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]),it=Ge("list-indent-increase",[["path",{d:"M21 5H11",key:"us1j55"}],["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 19H11",key:"saa85w"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]),st=Ge("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),at=Ge("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),lt=Ge("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),ct=Ge("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),ut=Ge("paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]),dt=Ge("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ht=Ge("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),pt=Ge("remove-formatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]),ft=Ge("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),mt=Ge("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),gt=Ge("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),yt=Ge("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),bt=Ge("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),vt=Ge("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),wt=Ge("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),xt=Ge("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),kt=Ge("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var St=e.createContext({});function Et(){return Et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Et.apply(null,arguments)}function Mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ct(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(u){c=!0,o=u}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Mt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rt(e){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ot(e){var t=function(e,t){if("object"!=Rt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Rt(t)?t:t+""}function Tt(e,t,n){return(t=Ot(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _t(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Nt,At={exports:{}};var Dt=(Nt||(Nt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var i in e)t.call(e,i)&&e[i]&&(r=o(r,i));return r}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(At)),At.exports);const $t=s(Dt),Lt=Math.round;function It(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const jt=(e,t,n)=>0===n?e:e/100;function zt(e,t){const n=t||255;return e>n?n:e<0?0:e}class Pt{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(Tt(this,"isValid",!0),Tt(this,"r",0),Tt(this,"g",0),Tt(this,"b",0),Tt(this,"a",1),Tt(this,"_h",void 0),Tt(this,"_s",void 0),Tt(this,"_l",void 0),Tt(this,"_v",void 0),Tt(this,"_max",void 0),Tt(this,"_min",void 0),Tt(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof Pt)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=zt(e.r),this.g=zt(e.g),this.b=zt(e.b),this.a="number"==typeof e.a?zt(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:Lt(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,o=e=>(n[e]-this[e])*r+this[e],i={r:Lt(o("r")),g:Lt(o("g")),b:Lt(o("b")),a:Lt(100*o("a"))/100};return this._c(i)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>Lt((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=Lt(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=Lt(100*this.getSaturation()),n=Lt(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=zt(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=Lt(255*n);this.r=e,this.g=e,this.b=e}let o=0,i=0,s=0;const a=e/60,l=(1-Math.abs(2*n-1))*t,c=l*(1-Math.abs(a%2-1));a>=0&&a<1?(o=l,i=c):a>=1&&a<2?(o=c,i=l):a>=2&&a<3?(i=l,s=c):a>=3&&a<4?(i=c,s=l):a>=4&&a<5?(o=c,s=l):a>=5&&a<6&&(o=l,s=c);const u=n-l/2;this.r=Lt(255*(o+u)),this.g=Lt(255*(i+u)),this.b=Lt(255*(s+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const o=Lt(255*n);if(this.r=o,this.g=o,this.b=o,t<=0)return;const i=e/60,s=Math.floor(i),a=i-s,l=Lt(n*(1-t)*255),c=Lt(n*(1-t*a)*255),u=Lt(n*(1-t*(1-a))*255);switch(s){case 0:this.g=u,this.b=l;break;case 1:this.r=c,this.b=l;break;case 2:this.r=l,this.b=u;break;case 3:this.r=l,this.g=c;break;case 4:this.r=u,this.g=l;break;default:this.g=l,this.b=c}}fromHsvString(e){const t=It(e,jt);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=It(e,jt);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=It(e,(e,t)=>t.includes("%")?Lt(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var Ft=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Bt(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function Ht(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function Vt(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var Ut=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qt(Object(n),!0).forEach(function(t){Tt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Ut.primary=Ut[5];var Yt="data-rc-order",Jt="data-rc-priority",Kt=new Map;function Gt(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function Zt(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Qt(e){return Array.from((Kt.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function Xt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,o=t.priority,i=void 0===o?0:o,s=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),a="prependQueue"===s,l=document.createElement("style");l.setAttribute(Yt,s),a&&i&&l.setAttribute(Jt,"".concat(i)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=Zt(t),u=c.firstChild;if(r){if(a){var d=(t.styles||Qt(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(Yt)))return!1;var t=Number(e.getAttribute(Jt)||0);return i>=t});if(d.length)return c.insertBefore(l,d[d.length-1].nextSibling),l}c.insertBefore(l,u)}else c.appendChild(l);return l}function en(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Zt(n),o=Qt(r),i=Wt(Wt({},n),{},{styles:o});!function(e,t){var n=Kt.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=Xt("",t),o=r.parentNode;Kt.set(e,o),e.removeChild(r)}}(r,i);var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Zt(t);return(t.styles||Qt(n)).find(function(n){return n.getAttribute(Gt(t))===e})}(t,i);if(s){var a,l,c;if(null!==(a=i.csp)&&void 0!==a&&a.nonce&&s.nonce!==(null===(l=i.csp)||void 0===l?void 0:l.nonce))s.nonce=null===(c=i.csp)||void 0===c?void 0:c.nonce;return s.innerHTML!==e&&(s.innerHTML=e),s}var u=Xt(e,i);return u.setAttribute(Gt(i),t),u}function tn(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function nn(e){return function(e){return tn(e)instanceof ShadowRoot}(e)?tn(e):null}var rn={};function on(e,t){}function sn(e,t){}function an(e,t,n){t||rn[n]||(e(!1,n),rn[n]=!0)}function ln(e,t){an(on,e,t)}function cn(e){return"object"===Rt(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===Rt(e.icon)||"function"==typeof e.icon)}function un(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,o=e[n];if("class"===n)t.className=o,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=o;return t},{})}function dn(t,n,r){return r?e.createElement(t.tag,Wt(Wt({key:n},un(t.attrs)),r),(t.children||[]).map(function(e,r){return dn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))})):e.createElement(t.tag,Wt({key:n},un(t.attrs)),(t.children||[]).map(function(e,r){return dn(e,"".concat(n,"-").concat(t.tag,"-").concat(r))}))}function hn(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Pt(e),o=r.toHsv(),i=5;i>0;i-=1){var s=new Pt({h:Bt(o,i,!0),s:Ht(o,i,!0),v:Vt(o,i,!0)});n.push(s)}n.push(r);for(var a=1;a<=4;a+=1){var l=new Pt({h:Bt(o,a),s:Ht(o,a),v:Vt(o,a)});n.push(l)}return"dark"===t.theme?Ft.map(function(e){var r=e.index,o=e.amount;return new Pt(t.backgroundColor||"#141414").mix(n[r],o).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function pn(e){return e?Array.isArray(e)?e:[e]:[]}ln.preMessage=function(e){},ln.resetWarned=function(){rn={}},ln.noteOnce=function(e,t){an(sn,e,t)};var fn=["icon","className","onClick","style","primaryColor","secondaryColor"],mn={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var gn=function(t){var n,r,i,s,a,l,c,u,d=t.icon,h=t.className,p=t.onClick,f=t.style,m=t.primaryColor,g=t.secondaryColor,y=_t(t,fn),b=o.useRef(),v=mn;if(m&&(v={primaryColor:m,secondaryColor:g||hn(m)}),n=b,r=e.useContext(St),i=r.csp,s=r.prefixCls,a=r.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",s&&(l=l.replace(/anticon/g,s)),a&&(l="@layer ".concat(a," {\n").concat(l,"\n}")),e.useEffect(function(){var e=nn(n.current);en(l,"@ant-design-icons",{prepend:!a,csp:i,attachTo:e})},[]),c=cn(d),u="icon should be icon definiton, but got ".concat(d),ln(c,"[@ant-design/icons] ".concat(u)),!cn(d))return null;var w=d;return w&&"function"==typeof w.icon&&(w=Wt(Wt({},w),{},{icon:w.icon(v.primaryColor,v.secondaryColor)})),dn(w.icon,"svg-".concat(w.name),Wt(Wt({className:h,onClick:p,style:f,"data-icon":w.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function yn(e){var t=Ct(pn(e),2),n=t[0],r=t[1];return gn.setTwoToneColors({primaryColor:n,secondaryColor:r})}gn.displayName="IconReact",gn.getTwoToneColors=function(){return Wt({},mn)},gn.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;mn.primaryColor=t,mn.secondaryColor=n||hn(t),mn.calculated=!!n};var bn=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];yn(Ut.primary);var vn=o.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,a=e.tabIndex,l=e.onClick,c=e.twoToneColor,u=_t(e,bn),d=o.useContext(St),h=d.prefixCls,p=void 0===h?"anticon":h,f=d.rootClassName,m=$t(f,p,Tt(Tt({},"".concat(p,"-").concat(r.name),!!r.name),"".concat(p,"-spin"),!!i||"loading"===r.name),n),g=a;void 0===g&&l&&(g=-1);var y=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,b=Ct(pn(c),2),v=b[0],w=b[1];return o.createElement("span",Et({role:"img","aria-label":r.name},u,{ref:t,tabIndex:g,onClick:l,className:m}),o.createElement(gn,{icon:r,primaryColor:v,secondaryColor:w,style:y}))});vn.displayName="AntdIcon",vn.getTwoToneColor=function(){var e=gn.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},vn.setTwoToneColor=yn;var wn,xn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z"}}]},name:"apartment",theme:"outlined"},kn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:xn}))},Sn=o.forwardRef(kn),En={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"},Mn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:En}))},Cn=o.forwardRef(Mn),Rn={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"}}]},name:"close",theme:"outlined"},On=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Rn}))},Tn=o.forwardRef(On),_n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z"}}]},name:"holder",theme:"outlined"},Nn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:_n}))},An=o.forwardRef(Nn),Dn={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"},$n=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Dn}))},Ln=o.forwardRef($n),In={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},jn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:In}))},zn=o.forwardRef(jn),Pn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},Fn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Pn}))},Bn=o.forwardRef(Fn),Hn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},Vn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Hn}))},Un=o.forwardRef(Vn),qn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z"}}]},name:"search",theme:"outlined"},Wn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:qn}))},Yn=o.forwardRef(Wn),Jn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},Kn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Jn}))},Gn=o.forwardRef(Kn),Zn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"},Qn=function(e,t){return o.createElement(vn,Et({},e,{ref:t,icon:Zn}))},Xn=o.forwardRef(Qn),er={},tr={exports:{}};function nr(){return wn||(wn=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(tr)),tr.exports}var rr,or={};var ir,sr={},ar={},lr={},cr={exports:{}},ur={exports:{}},dr={exports:{}},hr={exports:{}};function pr(){return ir||(ir=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(hr)),hr.exports}var fr,mr,gr,yr,br={exports:{}};function vr(){return mr||(mr=1,function(e){var t=pr().default,n=(fr||(fr=1,function(e){var t=pr().default;e.exports=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(br)),br.exports);e.exports=function(e){var r=n(e,"string");return"symbol"==t(r)?r:r+""},e.exports.__esModule=!0,e.exports.default=e.exports}(dr)),dr.exports}function wr(){return yr||(yr=1,function(e){var t=(gr||(gr=1,function(e){var t=vr();e.exports=function(e,n,r){return(n=t(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}(ur)),ur.exports);function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}e.exports=function(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(n){t(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e},e.exports.__esModule=!0,e.exports.default=e.exports}(cr)),cr.exports}var xr,kr,Sr={};function Er(){if(kr)return lr;kr=1;var e=nr().default;Object.defineProperty(lr,"__esModule",{value:!0}),lr.default=void 0;var t=e(wr()),n=(xr||(xr=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.commonLocale=void 0,Sr.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),Sr),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return lr.default=r,lr}var Mr,Cr,Rr,Or,Tr,_r,Nr={};function Ar(){if(Mr)return Nr;Mr=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.default=void 0;return Nr.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Nr}function Dr(){if(Cr)return ar;Cr=1;var e=nr().default;Object.defineProperty(ar,"__esModule",{value:!0}),ar.default=void 0;var t=e(Er()),n=e(Ar());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",ar.default=r,ar}function $r(){if(Rr)return sr;Rr=1;var e=nr().default;Object.defineProperty(sr,"__esModule",{value:!0}),sr.default=void 0;var t=e(Dr());return sr.default=t.default,sr}function Lr(){if(Or)return er;Or=1;var e=nr().default;Object.defineProperty(er,"__esModule",{value:!0}),er.default=void 0;var t=e((rr||(rr=1,Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0,or.default={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"}),or)),n=e($r()),r=e(Dr()),o=e(Ar());const i="${label}不是一个有效的${type}",s={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:o.default,Calendar:n.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:i,method:i,array:i,object:i,number:i,date:i,boolean:i,integer:i,float:i,regexp:i,email:i,url:i,hex:i},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return er.default=s,er}function Ir(){return _r?Tr:(_r=1,Tr=Lr())}const jr=s(Ir());function zr(e,t){return function(){return e.apply(t,arguments)}}const{toString:Pr}=Object.prototype,{getPrototypeOf:Fr}=Object,{iterator:Br,toStringTag:Hr}=Symbol,Vr=(e=>t=>{const n=Pr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ur=e=>(e=e.toLowerCase(),t=>Vr(t)===e),qr=e=>t=>typeof t===e,{isArray:Wr}=Array,Yr=qr("undefined");function Jr(e){return null!==e&&!Yr(e)&&null!==e.constructor&&!Yr(e.constructor)&&Zr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Kr=Ur("ArrayBuffer");const Gr=qr("string"),Zr=qr("function"),Qr=qr("number"),Xr=e=>null!==e&&"object"==typeof e,eo=e=>{if("object"!==Vr(e))return!1;const t=Fr(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Hr in e||Br in e)},to=Ur("Date"),no=Ur("File"),ro=Ur("Blob"),oo=Ur("FileList"),io=Ur("URLSearchParams"),[so,ao,lo,co]=["ReadableStream","Request","Response","Headers"].map(Ur);function uo(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Wr(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Jr(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function ho(e,t){if(Jr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const po="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,fo=e=>!Yr(e)&&e!==po;const mo=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&Fr(Uint8Array)),go=Ur("HTMLFormElement"),yo=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),bo=Ur("RegExp"),vo=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};uo(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const wo=Ur("AsyncFunction"),xo=(ko="function"==typeof setImmediate,So=Zr(po.postMessage),ko?setImmediate:So?(Eo=`axios@${Math.random()}`,Mo=[],po.addEventListener("message",({source:e,data:t})=>{e===po&&t===Eo&&Mo.length&&Mo.shift()()},!1),e=>{Mo.push(e),po.postMessage(Eo,"*")}):e=>setTimeout(e));var ko,So,Eo,Mo;const Co="undefined"!=typeof queueMicrotask?queueMicrotask.bind(po):"undefined"!=typeof process&&process.nextTick||xo,Ro={isArray:Wr,isArrayBuffer:Kr,isBuffer:Jr,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Zr(e.append)&&("formdata"===(t=Vr(e))||"object"===t&&Zr(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Kr(e.buffer),t},isString:Gr,isNumber:Qr,isBoolean:e=>!0===e||!1===e,isObject:Xr,isPlainObject:eo,isEmptyObject:e=>{if(!Xr(e)||Jr(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:so,isRequest:ao,isResponse:lo,isHeaders:co,isUndefined:Yr,isDate:to,isFile:no,isBlob:ro,isRegExp:bo,isFunction:Zr,isStream:e=>Xr(e)&&Zr(e.pipe),isURLSearchParams:io,isTypedArray:mo,isFileList:oo,forEach:uo,merge:function e(){const{caseless:t,skipUndefined:n}=fo(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t&&ho(r,i)||i;eo(r[s])&&eo(o)?r[s]=e(r[s],o):eo(o)?r[s]=e({},o):Wr(o)?r[s]=o.slice():n&&Yr(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&uo(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(uo(t,(t,r)=>{n&&Zr(t)?Object.defineProperty(e,r,{value:zr(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,s;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],r&&!r(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&Fr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Vr,kindOfTest:Ur,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Wr(e))return e;let t=e.length;if(!Qr(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Br]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:go,hasOwnProperty:yo,hasOwnProp:yo,reduceDescriptors:vo,freezeMethods:e=>{vo(e,(t,n)=>{if(Zr(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Zr(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Wr(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ho,global:po,isContextDefined:fo,isSpecCompliantForm:function(e){return!!(e&&Zr(e.append)&&"FormData"===e[Hr]&&e[Br])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Xr(e)){if(t.indexOf(e)>=0)return;if(Jr(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Wr(e)?[]:{};return uo(e,(e,t)=>{const i=n(e,r+1);!Yr(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:wo,isThenable:e=>e&&(Xr(e)||Zr(e))&&Zr(e.then)&&Zr(e.catch),setImmediate:xo,asap:Co,isIterable:e=>null!=e&&Zr(e[Br])};let Oo=class e extends Error{static from(t,n,r,o,i,s){const a=new e(t.message,n||t.code,r,o,i);return a.cause=t,a.name=t.name,s&&Object.assign(a,s),a}constructor(e,t,n,r,o){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ro.toJSONObject(this.config),code:this.code,status:this.status}}};Oo.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Oo.ERR_BAD_OPTION="ERR_BAD_OPTION",Oo.ECONNABORTED="ECONNABORTED",Oo.ETIMEDOUT="ETIMEDOUT",Oo.ERR_NETWORK="ERR_NETWORK",Oo.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Oo.ERR_DEPRECATED="ERR_DEPRECATED",Oo.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Oo.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Oo.ERR_CANCELED="ERR_CANCELED",Oo.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Oo.ERR_INVALID_URL="ERR_INVALID_URL";function To(e){return Ro.isPlainObject(e)||Ro.isArray(e)}function _o(e){return Ro.endsWith(e,"[]")?e.slice(0,-2):e}function No(e,t,n){return e?e.concat(t).map(function(e,t){return e=_o(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ao=Ro.toFlatObject(Ro,{},null,function(e){return/^is[A-Z]/.test(e)});function Do(e,t,n){if(!Ro.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Ro.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ro.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Ro.isSpecCompliantForm(t);if(!Ro.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Ro.isDate(e))return e.toISOString();if(Ro.isBoolean(e))return e.toString();if(!a&&Ro.isBlob(e))throw new Oo("Blob is not supported. Use a Buffer instead.");return Ro.isArrayBuffer(e)||Ro.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(Ro.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Ro.isArray(e)&&function(e){return Ro.isArray(e)&&!e.some(To)}(e)||(Ro.isFileList(e)||Ro.endsWith(n,"[]"))&&(a=Ro.toArray(e)))return n=_o(n),a.forEach(function(e,r){!Ro.isUndefined(e)&&null!==e&&t.append(!0===s?No([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!To(e)||(t.append(No(o,n,i),l(e)),!1)}const u=[],d=Object.assign(Ao,{defaultVisitor:c,convertValue:l,isVisitable:To});if(!Ro.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Ro.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Ro.forEach(n,function(n,i){!0===(!(Ro.isUndefined(n)||null===n)&&o.call(t,n,Ro.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function $o(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Lo(e,t){this._pairs=[],e&&Do(e,this,t)}const Io=Lo.prototype;function jo(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zo(e,t,n){if(!t)return e;const r=n&&n.encode||jo,o=Ro.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let s;if(s=i?i(t,o):Ro.isURLSearchParams(t)?t.toString():new Lo(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}Io.append=function(e,t){this._pairs.push([e,t])},Io.toString=function(e){const t=e?function(t){return e.call(this,t,$o)}:$o;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Po{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ro.forEach(this.handlers,function(t){null!==t&&e(t)})}}const Fo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Bo={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Lo,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ho="undefined"!=typeof window&&"undefined"!=typeof document,Vo="object"==typeof navigator&&navigator||void 0,Uo=Ho&&(!Vo||["ReactNative","NativeScript","NS"].indexOf(Vo.product)<0),qo="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Wo=Ho&&window.location.href||"http://localhost",Yo={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ho,hasStandardBrowserEnv:Uo,hasStandardBrowserWebWorkerEnv:qo,navigator:Vo,origin:Wo},Symbol.toStringTag,{value:"Module"})),...Bo};function Jo(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&Ro.isArray(r)?r.length:i,a)return Ro.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&Ro.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Ro.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(Ro.isFormData(e)&&Ro.isFunction(e.entries)){const n={};return Ro.forEachEntry(e,(e,r)=>{t(function(e){return Ro.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Ko={transitional:Fo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Ro.isObject(e);o&&Ro.isHTMLForm(e)&&(e=new FormData(e));if(Ro.isFormData(e))return r?JSON.stringify(Jo(e)):e;if(Ro.isArrayBuffer(e)||Ro.isBuffer(e)||Ro.isStream(e)||Ro.isFile(e)||Ro.isBlob(e)||Ro.isReadableStream(e))return e;if(Ro.isArrayBufferView(e))return e.buffer;if(Ro.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Do(e,new Yo.classes.URLSearchParams,{visitor:function(e,t,n,r){return Yo.isNode&&Ro.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Ro.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Do(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Ro.isString(e))try{return(t||JSON.parse)(e),Ro.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ko.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Ro.isResponse(e)||Ro.isReadableStream(e))return e;if(e&&Ro.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(n){if("SyntaxError"===o.name)throw Oo.from(o,Oo.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yo.classes.FormData,Blob:Yo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ro.forEach(["delete","get","head","post","put","patch"],e=>{Ko.headers[e]={}});const Go=Ro.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Zo=Symbol("internals");function Qo(e){return e&&String(e).trim().toLowerCase()}function Xo(e){return!1===e||null==e?e:Ro.isArray(e)?e.map(Xo):String(e)}function ei(e,t,n,r,o){return Ro.isFunction(r)?r.call(this,t,n):(o&&(t=n),Ro.isString(t)?Ro.isString(r)?-1!==t.indexOf(r):Ro.isRegExp(r)?r.test(t):void 0:void 0)}let ti=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Qo(t);if(!o)throw new Error("header name must be a non-empty string");const i=Ro.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Xo(e))}const i=(e,t)=>Ro.forEach(e,(e,n)=>o(e,n,t));if(Ro.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Ro.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Go[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Ro.isObject(e)&&Ro.isIterable(e)){let n,r,o={};for(const t of e){if(!Ro.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Ro.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=Qo(e)){const n=Ro.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Ro.isFunction(t))return t.call(this,e,n);if(Ro.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Qo(e)){const n=Ro.findKey(this,e);return!(!n||void 0===this[n]||t&&!ei(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Qo(e)){const o=Ro.findKey(n,e);!o||t&&!ei(0,n[o],o,t)||(delete n[o],r=!0)}}return Ro.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ei(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Ro.forEach(this,(r,o)=>{const i=Ro.findKey(n,o);if(i)return t[i]=Xo(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=Xo(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ro.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Ro.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Zo]=this[Zo]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Qo(e);t[r]||(!function(e,t){const n=Ro.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Ro.isArray(e)?e.forEach(r):r(e),this}};function ni(e,t){const n=this||Ko,r=t||n,o=ti.from(r.headers);let i=r.data;return Ro.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ri(e){return!(!e||!e.__CANCEL__)}ti.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ro.reduceDescriptors(ti.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Ro.freezeMethods(ti);let oi=class extends Oo{constructor(e,t,n){super(null==e?"canceled":e,Oo.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ii(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Oo("Request failed with status code "+n.status,[Oo.ERR_BAD_REQUEST,Oo.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const si=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=r[s];o||(o=l),n[i]=a,r[i]=l;let u=s,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),l-o<t)return;const h=c&&l-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,l=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&i<=s?(s-i)/l:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},ai=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},li=e=>(...t)=>Ro.asap(()=>e(...t)),ci=Yo.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Yo.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Yo.origin),Yo.navigator&&/(msie|trident)/i.test(Yo.navigator.userAgent)):()=>!0,ui=Yo.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Ro.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Ro.isString(r)&&a.push(`path=${r}`),Ro.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),Ro.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function di(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const hi=e=>e instanceof ti?{...e}:e;function pi(e,t){t=t||{};const n={};function r(e,t,n,r){return Ro.isPlainObject(e)&&Ro.isPlainObject(t)?Ro.merge.call({caseless:r},e,t):Ro.isPlainObject(t)?Ro.merge({},t):Ro.isArray(t)?t.slice():t}function o(e,t,n,o){return Ro.isUndefined(t)?Ro.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Ro.isUndefined(t))return r(void 0,t)}function s(e,t){return Ro.isUndefined(t)?Ro.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const l={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(hi(e),hi(t),0,!0)};return Ro.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Ro.hasOwnProp(l,r)?l[r]:o,s=i(e[r],t[r],r);Ro.isUndefined(s)&&i!==a||(n[r]=s)}),n}const fi=e=>{const t=pi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=ti.from(s),t.url=zo(di(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Ro.isFormData(n))if(Yo.hasStandardBrowserEnv||Yo.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(Ro.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(Yo.hasStandardBrowserEnv&&(r&&Ro.isFunction(r)&&(r=r(t)),r||!1!==r&&ci(t.url))){const e=o&&i&&ui.read(i);e&&s.set(o,e)}return t},mi="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=fi(e);let o=r.data;const i=ti.from(r.headers).normalize();let s,a,l,c,u,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){c&&c(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=ti.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ii(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Oo("Request aborted",Oo.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Oo(r,Oo.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Fo;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Oo(t,o.clarifyTimeoutError?Oo.ETIMEDOUT:Oo.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&Ro.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Ro.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,u]=si(p,!0),m.addEventListener("progress",l)),h&&m.upload&&([a,c]=si(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new oi(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===Yo.protocols.indexOf(y)?n(new Oo("Unsupported protocol "+y+":",Oo.ERR_BAD_REQUEST,e)):m.send(o||null)})},gi=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Oo?t:new oi(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Oo(`timeout of ${t}ms exceeded`,Oo.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>Ro.asap(s),a}},yi=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},bi=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},vi=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of bi(e))yield*yi(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:wi}=Ro,xi=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ro.global),{ReadableStream:ki,TextEncoder:Si}=Ro.global,Ei=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},Mi=e=>{e=Ro.merge.call({skipUndefined:!0},xi,e);const{fetch:t,Request:n,Response:r}=e,o=t?wi(t):"function"==typeof fetch,i=wi(n),s=wi(r);if(!o)return!1;const a=o&&wi(ki),l=o&&("function"==typeof Si?(e=>t=>e.encode(t))(new Si):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=i&&a&&Ei(()=>{let e=!1;const t=new n(Yo.origin,{body:new ki,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&Ei(()=>Ro.isReadableStream(new r("").body)),d={stream:u&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Oo(`Response type '${e}' is not supported`,Oo.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Ro.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Ro.isBlob(e))return e.size;if(Ro.isSpecCompliantForm(e)){const t=new n(Yo.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ro.isArrayBufferView(e)||Ro.isArrayBuffer(e)?e.byteLength:(Ro.isURLSearchParams(e)&&(e+=""),Ro.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:l,cancelToken:p,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=fi(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let k=gi([l,p&&p.toAbortSignal()],f),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let M;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(M=await h(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(Ro.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=ai(M,si(li(g)));a=vi(t.body,65536,e,n)}}Ro.isString(v)||(v=v?"include":"omit");const t=i&&"credentials"in n.prototype,l={...w,signal:k,method:s.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?v:void 0};S=i&&new n(o,l);let p=await(i?x(S,w):x(o,l));const f=u&&("stream"===y||"response"===y);if(u&&(m||f&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=Ro.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&ai(t,si(li(m),!0))||[];p=new r(vi(p.body,65536,n,()=>{o&&o(),E&&E()}),e)}y=y||"text";let C=await d[Ro.findKey(d,y)||"text"](p,e);return!f&&E&&E(),await new Promise((t,n)=>{ii(t,n,{data:C,headers:ti.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:S})})}catch(C){if(E&&E(),C&&"TypeError"===C.name&&/Load failed|fetch/i.test(C.message))throw Object.assign(new Oo("Network Error",Oo.ERR_NETWORK,e,S,C&&C.response),{cause:C.cause||C});throw Oo.from(C,C&&C.code,e,S,C&&C.response)}}},Ci=new Map,Ri=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,l=i.length,c=Ci;for(;l--;)s=i[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:Mi(t)),c=a;return a};Ri();const Oi={http:null,xhr:mi,fetch:{get:Ri}};Ro.forEach(Oi,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const Ti=e=>`- ${e}`,_i=e=>Ro.isFunction(e)||null===e||!1===e;const Ni={getAdapter:function(e,t){e=Ro.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!_i(r)&&(o=Oi[(n=String(r)).toLowerCase()],void 0===o))throw new Oo(`Unknown adapter '${n}'`);if(o&&(Ro.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Ti).join("\n"):" "+Ti(e[0]):"as no adapter specified";throw new Oo("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Oi};function Ai(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new oi(null,e)}function Di(e){Ai(e),e.headers=ti.from(e.headers),e.data=ni.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ni.getAdapter(e.adapter||Ko.adapter,e)(e).then(function(t){return Ai(e),t.data=ni.call(e,e.transformResponse,t),t.headers=ti.from(t.headers),t},function(t){return ri(t)||(Ai(e),t&&t.response&&(t.response.data=ni.call(e,e.transformResponse,t.response),t.response.headers=ti.from(t.response.headers))),Promise.reject(t)})}const $i="1.13.5",Li={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Li[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Ii={};Li.transitional=function(e,t,n){function r(e,t){return"[Axios v"+$i+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Oo(r(o," has been removed"+(t?" in "+t:"")),Oo.ERR_DEPRECATED);return t&&!Ii[o]&&(Ii[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Li.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const ji={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Oo("options must be an object",Oo.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new Oo("option "+i+" must be "+n,Oo.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Oo("Unknown option "+i,Oo.ERR_BAD_OPTION)}},validators:Li},zi=ji.validators;let Pi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Po,response:new Po}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=pi(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ji.assertOptions(n,{silentJSONParsing:zi.transitional(zi.boolean),forcedJSONParsing:zi.transitional(zi.boolean),clarifyTimeoutError:zi.transitional(zi.boolean),legacyInterceptorReqResOrdering:zi.transitional(zi.boolean)},!1),null!=r&&(Ro.isFunction(r)?t.paramsSerializer={serialize:r}:ji.assertOptions(r,{encode:zi.function,serialize:zi.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),ji.assertOptions(t,{baseUrl:zi.spelling("baseURL"),withXsrfToken:zi.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Ro.merge(o.common,o[t.method]);o&&Ro.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ti.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||Fo;n&&n.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)});const l=[];let c;this.interceptors.response.forEach(function(e){l.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[Di.bind(this),void 0];for(e.unshift(...s),e.push(...l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=s.length;let h=t;for(;d<u;){const e=s[d++],t=s[d++];try{h=e(h)}catch(p){t.call(this,p);break}}try{c=Di.call(this,h)}catch(p){return Promise.reject(p)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return zo(di((e=pi(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};Ro.forEach(["delete","get","head","options"],function(e){Pi.prototype[e]=function(t,n){return this.request(pi(n||{},{method:e,url:t,data:(n||{}).data}))}}),Ro.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(pi(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Pi.prototype[e]=t(),Pi.prototype[e+"Form"]=t(!0)});const Fi={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Fi).forEach(([e,t])=>{Fi[t]=e});const Bi=function e(t){const n=new Pi(t),r=zr(Pi.prototype.request,n);return Ro.extend(r,Pi.prototype,n,{allOwnKeys:!0}),Ro.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(pi(t,n))},r}(Ko);Bi.Axios=Pi,Bi.CanceledError=oi,Bi.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new oi(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},Bi.isCancel=ri,Bi.VERSION=$i,Bi.toFormData=Do,Bi.AxiosError=Oo,Bi.Cancel=Bi.CanceledError,Bi.all=function(e){return Promise.all(e)},Bi.spread=function(e){return function(t){return e.apply(null,t)}},Bi.isAxiosError=function(e){return Ro.isObject(e)&&!0===e.isAxiosError},Bi.mergeConfig=pi,Bi.AxiosHeaders=ti,Bi.formToJSON=e=>Jo(Ro.isHTMLForm(e)?new FormData(e):e),Bi.getAdapter=Ni.getAdapter,Bi.HttpStatusCode=Fi,Bi.default=Bi;const{Axios:Hi,AxiosError:Vi,CanceledError:Ui,isCancel:qi,CancelToken:Wi,VERSION:Yi,all:Ji,Cancel:Ki,isAxiosError:Gi,spread:Zi,toFormData:Qi,AxiosHeaders:Xi,HttpStatusCode:es,formToJSON:ts,getAdapter:ns,mergeConfig:rs}=Bi;const is=Bi.create({baseURL:"/api/v6",timeout:3e5});async function ss(e,t){const n=await is.get(`/data/${e}`,{params:{...t,top:t.top??20,skip:t.skip??0}}),r=n.data?.data||[];return{data:r,total:n.data?.totalCount??n.data?.total??r.length}}async function as(e,t){const{objectName:n="",recordId:r="",parent:o="",collectionName:i="cfs.files.filerecord"}=t||{},s=new FormData;s.append("file",e),n&&s.append("object_name",n),r&&s.append("record_id",r),o&&s.append("parent",o);const a={},l=localStorage.getItem("steedos:spaceId"),c=localStorage.getItem("steedos:auth_token");l&&c&&(a.Authorization=`Bearer ${l},${c}`);return(await is.post(`/files/${i}`,s,{headers:a,timeout:6e4})).data}function ls(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}is.interceptors.request.use(e=>e);const cs=new Map,us=new Map;function ds(e,t){return 0===e.length?"":t?e.join(","):e[0]}function hs({field:t,value:n,onChange:r,onFillFields:o,isTableMode:i=!1,hasError:s=!1,formValues:a}){const[l,c]=e.useState(!1),u=t.reference_to||"",d=!!t.pickerMultiple,h=t.lookupDisplayFields||["name"],p=h[0]||"name",f=e.useMemo(()=>!d&&t.lookupFillRules||[],[d,t.lookupFillRules]),m=e.useMemo(()=>{return e=t.lookupFilters,n=a||{},e?e.replace(/\{(\w+)\}/g,(e,t)=>n[t]??""):e;var e,n},[t.lookupFilters,a]),g=e.useMemo(()=>function(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("object"==typeof t&&null!==t&&"_id"in t)return[t._id]}catch{}return e.split(",").map(e=>e.trim()).filter(Boolean)}(n),[n]),[y,b]=e.useState(new Map);e.useEffect(()=>{if(!u||0===g.length)return;const e=g.filter(e=>!y.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);ss(u,{filters:t,fields:`_id,${p}`,top:e.length}).then(({data:e})=>{b(t=>{const n=new Map(t);for(const r of e)n.set(r._id,r[p]||r._id);return n})})},[u,g.join(","),p]);const v=e.useCallback(e=>{const t=g.filter(t=>t!==e);r(ds(t,d))},[g,r,d]),w=e.useCallback((e,t,n)=>{if(r(ds(e,d)),b(e=>{const n=new Map(e);for(const[r,o]of t)n.set(r,o);return n}),c(!1),!d&&f.length>0&&1===e.length&&o){const t=e=>{const t={};for(const n of f)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(t[n.targetField]=String(e[n.sourceField]));Object.keys(t).length>0&&o(t)};if(n){const r=f.map(e=>e.sourceField).filter(Boolean);if(r.every(e=>e in n))t(n);else{const n=JSON.stringify(["_id","=",e[0]]),o=["_id",...r].join(",");ss(u,{filters:n,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const n=f.map(e=>e.sourceField).filter(Boolean),r=JSON.stringify(["_id","=",e[0]]),o=["_id",...n].join(",");ss(u,{filters:r,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[r,d,f,o,u]);return t.readonly?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-2")+" bg-gray-50/60 min-h-[34px]"},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},y.get(e)||e))):React.createElement("span",{className:"text-[13px] text-gray-400"},"—")):React.createElement(React.Fragment,null,React.createElement("div",{onClick:()=>u&&c(!0),className:"cursor-pointer smooth-transition "+(i?"w-full px-2.5 py-1.5 min-h-[34px] "+(s?"bg-red-100/90":"bg-amber-50/80 hover:bg-amber-50"):"border rounded-md px-3 py-2 min-h-[38px] "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white hover:border-indigo-300"))},g.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},g.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] bg-indigo-50 text-indigo-700 border border-indigo-200 rounded-md px-2 py-0.5 max-w-[200px]"},React.createElement("span",{className:"truncate"},y.get(e)||e),React.createElement(kt,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),v(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement(et,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement(Qe,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(ps,{objectName:u,displayFields:h,multiple:d,selectedIds:g,filters:m,onConfirm:w,onClose:()=>c(!1)}))}function ps({objectName:n,displayFields:r,multiple:o,selectedIds:i,filters:s,onConfirm:a,onClose:l}){const[c,u]=e.useState([]),[d,h]=e.useState(0),[p,f]=e.useState(!1),[m,g]=e.useState(1),[y,b]=e.useState(""),[v,w]=e.useState(new Set(i)),[x,k]=e.useState([]),S=e.useRef(void 0),E=r[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=cs.get(e);if(t)return t;const n=us.get(e);if(n)return n;const r=(async()=>{try{let t="";const n={},r=await fetch(`${t}/service/api/amis-metadata-objects/objects/${encodeURIComponent(e)}/fields/options`,{headers:n}),o=await r.json(),i=o?.data?.options??[];return cs.set(e,i),i}catch{return[]}finally{us.delete(e)}})();return us.set(e,r),r})(n).then(k)},[n]);const M=e.useMemo(()=>{const e=new Map;for(const t of x)e.set(t.value,t.label);return e},[x]),C=e.useCallback(async(e,t)=>{f(!0);try{const o=[];let i;s&&o.push(s),t&&o.push(JSON.stringify([E,"contains",t])),2===o.length?i=JSON.stringify([JSON.parse(o[0]),"and",JSON.parse(o[1])]):1===o.length&&(i=o[0]);const a=["_id",...r].join(","),l=await ss(n,{filters:i,fields:a,top:10,skip:10*(e-1),sort:`${E} asc`});u(l.data),h(l.total)}finally{f(!1)}},[n,r,E,s]);e.useEffect(()=>{C(m,y)},[m]);const R=e.useCallback(e=>{b(e),S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{g(1),C(1,e)},300)},[C]),O=e.useMemo(()=>r.map(e=>({title:M.get(e)||e,dataIndex:e,key:e,ellipsis:!0,render:e=>null!=e?String(e):"-"})),[r,M]),T=e.useMemo(()=>({type:o?"checkbox":"radio",selectedRowKeys:[...v],onChange:e=>{if(w(new Set(e)),!o&&e.length>0){const t=e[0],n=c.find(e=>e._id===t),r=new Map;n&&r.set(t,n[E]||t),a([t],r,n)}}}),[o,v,c,E,a]);return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement(et,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:l,onOk:o?()=>{const e=new Map;for(const t of c){const n=t._id;v.has(n)&&e.set(n,t[E]||n)}a([...v],e)}:void 0,okText:o?"确定"+(v.size>0?` (${v.size})`:""):void 0,cancelText:"取消",footer:o?void 0:null,destroyOnClose:!0,styles:{body:{padding:"12px 0"}}},React.createElement("div",{style:{padding:"0 0 12px"}},React.createElement(t.Input.Search,{placeholder:`搜索 ${M.get(E)||E}...`,allowClear:!0,onChange:e=>R(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:O,dataSource:c,loading:p,rowSelection:T,pagination:{current:m,pageSize:10,total:d,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>g(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(o)w(e=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});else{const n=new Map;n.set(t,e[E]||t),a([t],n,e)}},style:{cursor:"pointer"}})})))}const fs=n=>{const{visible:r,multiple:o,loading:i,users:s,searchKeyword:a,searchInputValue:l,tempSelectedUsers:c,clearable:u,rootDeptInfo:d,deptPath:h,currentLevelDepts:p,showSelectedPanel:f,onDrillDown:m,onMobileBack:g,onDrillBack:y,onBackToRoot:b,onToggleSelectedPanel:v,onUserSearch:w,onAddUser:x,onRemoveUser:k,onToggleUser:S,onToggleSelectAll:E,onReorderUsers:M,onOk:C,onCancel:R,onClearAll:O}=n,T=s.length>0&&s.every(e=>c.find(t=>t._id===e._id)),_=!!a,{visibleCount:N,scrollContainerRef:A}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),[a,l]=e.useState(!1);e.useEffect(()=>{e.startTransition(()=>i(n)),s.current&&(s.current.scrollTop=0)},[...r,t,n]);const c=e.useCallback(e=>{s.current=e,l(!!e)},[]);return e.useEffect(()=>{const e=s.current;if(!e)return;const r=()=>{i(r=>r>=t?r:e.scrollHeight-e.scrollTop-e.clientHeight<120?Math.min(r+n,t):r)};e.addEventListener("scroll",r,{passive:!0});const o=requestAnimationFrame(()=>r());return()=>{e.removeEventListener("scroll",r),cancelAnimationFrame(o)}},[t,n,a]),{visibleCount:o,scrollContainerRef:c}}(s.length,50,[h.length,a]),D=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),$=e.useRef(null),[L,I]=e.useState(null),[j,z]=e.useState(null),P=e.useCallback((e,t)=>{if(e.target.closest(".steedos-selected-remove-btn"))return;const n=e.touches[0],r=e.currentTarget,o=r.getBoundingClientRect(),i=r.cloneNode(!0);i.style.position="fixed",i.style.left=`${o.left}px`,i.style.top=`${o.top}px`,i.style.width=`${o.width}px`,i.style.zIndex="9999",i.style.boxShadow="0 8px 24px rgba(0,0,0,0.15)",i.style.borderRadius="8px",i.style.opacity="0.92",i.style.transition="box-shadow 0.2s",i.style.pointerEvents="none",document.body.appendChild(i),D.current={dragging:!0,startIndex:t,currentIndex:t,startY:n.clientY,itemHeight:o.height,clone:i,listEl:$.current},I(t),z(t),navigator.vibrate&&navigator.vibrate(20)},[]),F=e.useCallback(e=>{const t=D.current;if(!t.dragging||!t.clone)return;e.preventDefault();const n=e.touches[0].clientY-t.startY;t.clone.style.transform=`translateY(${n}px) scale(1.02)`;const r=Math.round(n/t.itemHeight)+t.startIndex,o=Math.max(0,Math.min(r,c.length-1));o!==t.currentIndex&&(t.currentIndex=o,z(o),navigator.vibrate&&navigator.vibrate(10))},[c.length]),B=e.useCallback(()=>{const e=D.current;if(!e.dragging)return;e.clone&&(e.clone.remove(),e.clone=null);const t=e.startIndex,n=e.currentIndex;e.dragging=!1,I(null),z(null),t!==n&&t>=0&&n>=0&&M(t,n)},[M]);return e.createElement(t.Drawer,{open:r,placement:"bottom",height:"100vh",closable:!1,destroyOnClose:!0,rootClassName:"steedos-mobile-drawer",onClose:R,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}}},e.createElement("style",null,"\n.steedos-mobile-drawer .ant-drawer-content-wrapper {\n border-radius: 0 !important;\n overflow: hidden;\n}\n.steedos-mobile-drawer .ant-drawer-header {\n padding: 12px 16px;\n border-bottom: none;\n}\n.steedos-mobile-drawer .ant-drawer-body {\n padding: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n.steedos-mobile-dept-card {\n display: flex;\n align-items: center;\n padding: 14px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-dept-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-user-card {\n display: flex;\n align-items: center;\n padding: 12px 16px;\n border-bottom: 1px solid #f5f5f5;\n gap: 12px;\n -webkit-tap-highlight-color: transparent;\n transition: background 0.15s;\n}\n.steedos-mobile-user-card:active {\n background: #f5f5f5;\n}\n.steedos-mobile-bottom-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 16px;\n padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));\n border-top: 1px solid #f0f0f0;\n background: #fff;\n}\n.steedos-mobile-selected-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: #fff;\n z-index: 20;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n"),e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px 8px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},h.length>0&&e.createElement("span",{onClick:g,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(zn,null)),e.createElement("span",{onClick:R,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Tn,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},o&&s.length>0&&!_&&h.length>0&&e.createElement("span",{onClick:E,style:{fontSize:14,color:"#1890ff",cursor:"pointer",WebkitTapHighlightColor:"transparent"}},T?"取消全选":"全选"))),e.createElement("div",{style:{padding:"4px 16px 8px",flexShrink:0}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Yn,null),value:l,onChange:e=>w(e.target.value),allowClear:!0,size:"large"})),h.length>0&&!_&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),h.length>0&&!_&&(()=>{const t=h.length>2,n=h.length>2?h.slice(-2):h,r=h.length>2?h.length-2:0,o=e=>e.length>8?e.slice(0,8)+"…":e;return e.createElement("div",{style:{display:"flex",alignItems:"center",padding:"8px 16px",fontSize:13,color:"#999",overflow:"hidden",whiteSpace:"nowrap",flexShrink:0,borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{onClick:b,style:{color:"#1890ff",cursor:"pointer",flexShrink:0,WebkitTapHighlightColor:"transparent"}},"联系人"),t&&e.createElement(e.Fragment,null,e.createElement(Un,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),e.createElement("span",{style:{color:"#999",flexShrink:0,display:"flex",alignItems:"center",lineHeight:1}},"···")),n.map((t,n)=>{const i=r+n,s=i===h.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement(Un,{style:{margin:"0 6px",color:"#ccc",fontSize:10,flexShrink:0}}),s?e.createElement("span",{style:{color:"#999",overflow:"hidden",textOverflow:"ellipsis"}},o(t.name)):e.createElement("span",{onClick:()=>y(i),style:{color:"#1890ff",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",WebkitTapHighlightColor:"transparent"}},o(t.name)))}))})(),e.createElement("div",{ref:A,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},e.createElement(t.Spin,{spinning:i},_||h.length>0||!d?null:e.createElement(e.Fragment,null,e.createElement("div",{className:"steedos-mobile-dept-card",onClick:()=>m(d.id,d.name)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Sn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement(Un,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),_||0===h.length||0===p.length?null:e.createElement(e.Fragment,null,p.map(t=>e.createElement("div",{key:t._id||t.id||t.key||t.value,className:"steedos-mobile-dept-card",onClick:()=>m(t._id||t.id||t.key||t.value,t.title||t.name||t.label)},e.createElement("div",{style:{width:40,height:40,borderRadius:"50%",background:"#f0f5ff",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},e.createElement(Sn,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},t.title||t.name||t.label)),e.createElement(Un,{style:{color:"#ccc",fontSize:14,flexShrink:0}}))),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),e.createElement(e.Fragment,null,s.length>0?e.createElement(e.Fragment,null,s.slice(0,N).map(n=>{const r=!!c.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:"steedos-mobile-user-card",onClick:()=>S(n)},o&&e.createElement("div",{style:{width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:r?"#1890ff":"transparent",border:r?"none":"1.5px solid #d9d9d9"}},r&&e.createElement(Cn,{style:{color:"#fff",fontSize:11}})),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:2}},n.organization?.name,n.position?` · ${n.position}`:""),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)))}),N<s.length&&e.createElement("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13}},"加载更多...")):i?null:e.createElement(t.Empty,{description:a?"未找到匹配的人员":"暂无人员",style:{marginTop:60}})))),f&&e.createElement("div",{className:"steedos-mobile-selected-overlay"},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #f0f0f0"}},e.createElement("span",{style:{fontWeight:600,fontSize:16}},"已选中 (",c.length,")"),e.createElement(t.Button,{type:"text",onClick:v,style:{padding:0,color:"#666"}},"返回")),u&&c.length>0&&e.createElement("div",{style:{padding:"4px 16px",display:"flex",justifyContent:"flex-end"}},e.createElement(t.Button,{type:"link",danger:!0,size:"small",onClick:O,style:{padding:0}},"清空全部")),o&&c.length>1&&e.createElement("div",{style:{padding:"0 16px 6px",fontSize:12,color:"#999"}},"长按拖拽可调整顺序"),e.createElement("div",{ref:$,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},c.length>0?c.map((n,r)=>{const i=L===r,s=j===r&&null!==L&&L!==r;return e.createElement("div",{key:n._id,onTouchStart:o?e=>P(e,r):void 0,onTouchMove:o?F:void 0,onTouchEnd:o?B:void 0,style:{display:"flex",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid #f5f5f5",gap:10,opacity:i?.3:1,background:s?"#e6f7ff":"#fff",borderTop:s?"2px solid #1890ff":"2px solid transparent",transition:"background 0.15s, border-top 0.15s, opacity 0.15s",touchAction:"none",userSelect:"none"}},o&&e.createElement(An,{style:{color:"#bbb",fontSize:16,flexShrink:0,cursor:"grab"}}),e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:void 0,size:36,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontSize:15,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),(n.email||n.mobile||n.username)&&e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginTop:1}},n.email||n.mobile||n.username)),u&&e.createElement(Tn,{className:"steedos-selected-remove-btn",onClick:()=>k(n._id),style:{fontSize:14,color:"#ff4d4f",padding:8,flexShrink:0}}))}):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE}))),o?e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:c.length>0?"#1890ff":"#666",cursor:"pointer"},onClick:c.length>0?v:void 0},"已选 ",c.length," 人 ",c.length>0&&!f?"▲":c.length>0&&f?"▼":""),e.createElement(t.Button,{type:"primary",onClick:C},"确定")):e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:"#666"}},c.length>0?`已选: ${c[0]?.name}`:"请选择人员"),e.createElement(t.Button,{type:"primary",onClick:C,disabled:0===c.length},"确定")))};function ms(e){return e}function gs(e={}){return{...e}}async function ys(e){const t=`{rows:space_users(filters: [${[[["user_accepted","=",!0]],"and",[["organization","=",e]]].map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}}}`,n=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function bs(e,t){if(!e&&!t)return[];const n=[];n.push([["user_accepted","=",!0]]),n.push("and"),t?n.push([[["name","contains",t],"or",["email","contains",t]],"or",["username","contains",t]]):e&&n.push([["organizations_parents","in",[e]]]);const r=`{rows:space_users(filters: [${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}], top: 1000, skip: 0, sort: "sort_no desc,name asc"){_id,user,space,name,mobile,email,position,sort_no,username,avatar,organization,_display:_ui{sort_no,organization}},count:space_users__count(filters:[${n.map(e=>"string"==typeof e?`"${e}"`:JSON.stringify(e)).join(",")}])}`,o=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),i=await o.json();return(i.data?.rows||[]).map(e=>({_id:e._id,user:e.user,name:e.name,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}))}async function vs(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 1000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.fullname||e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,sort_no,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}{const e=await fetch("/service/api/organizations/root",{headers:gs()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0}))}}const ws=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择人员",fetchUsers:a=bs,fetchDeptTree:l=vs,style:c,dispatchEvent:u,clearable:d=!0,isTableMode:h=!1,hasError:p=!1,formalTableMode:f=!1,minimal:m=!1,pickerFillRules:g,onFillFields:y,valueFormat:b="object"}=n,[v,w]=e.useState(!1),[x,k]=e.useState([]),[S,E]=e.useState([]),[M,C]=e.useState(null),[R,O]=e.useState([]),[T,_]=e.useState([]),[N,A]=e.useState(!1),[D,$]=e.useState(""),[L,I]=e.useState(""),[j,z]=e.useState(""),[P,F]=e.useState(null),[B,H]=e.useState([]),[V,U]=e.useState(null),[q,W]=e.useState(!1),[Y,J]=e.useState(0),[K,G]=e.useState(null),Z=e.useRef(null),Q=e.useRef(null),X=e.useRef(0),ee=e.useRef(null),te=function(){const[t,n]=e.useState(()=>"undefined"!=typeof window&&window.innerWidth<768);return e.useEffect(()=>{const e=()=>n(window.innerWidth<768);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t}(),[,ne]=e.useState("dept"),[,re]=e.useState(""),[oe,ie]=e.useState([]),[se,ae]=e.useState([]),[le,ce]=e.useState(!1),[ue,de]=e.useState(null),{visibleCount:he,sentinelRef:pe}=function(t,n=50,r=[]){const[o,i]=e.useState(n),s=e.useRef(null),a=e.useRef(null);return e.useEffect(()=>{i(n)},[...r,t,n]),e.useEffect(()=>{if(a.current&&a.current.disconnect(),s.current&&!(o>=t))return a.current=new IntersectionObserver(e=>{e[0]?.isIntersecting&&i(e=>Math.min(e+n,t))},{threshold:.1}),a.current.observe(s.current),()=>{a.current&&a.current.disconnect()}},[t,n,o]),{visibleCount:o,sentinelRef:s}}(S.length,50,[M,D]);e.useEffect(()=>{ee.current={props:n}}),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id)return void O([{_id:r.id,user:r.id,name:r.name||""}]);if(Array.isArray(r)&&r.length>0&&"object"==typeof r[0]&&r[0].id)return void O(r.map(e=>({_id:e.id,user:e.id,name:e.name||""})));const e=Array.isArray(r)?r.map(String).map(e=>e.trim()).filter(Boolean):r?i?String(r).split(",").map(e=>e.trim()).filter(Boolean):[String(r).trim()]:[];if(e.length>0){const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,email,mobile,position,username,avatar,organization}}`;fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{let n=(t.data?.rows||[]).map(e=>({_id:e._id,name:e.name,user:e.user,email:e.email,mobile:e.mobile,position:e.position,username:e.username,avatar:e.avatar,organization:e.organization}));n=e.map(e=>n.find(t=>t.user===e)).filter(e=>!!e),O(n)})}else O([])},[r,i]),e.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current),Q.current&&clearTimeout(Q.current)},[]),e.useEffect(()=>{if(v){A(!0),J(e=>e+1),re(""),k([]),H([]),C(null),z(""),$(""),I("");let e=!1;l().then(t=>{const n=t;k(n);const r=n.map(e=>e.key);if(H(r),r.length>0)if(te&&n[0]){re(String(n[0].title||""));const t=String(n[0].key),r=String(n[0].title||"");de({id:t,name:r}),ie([]),C(t),e=!0,a(t).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>{A(!1)})}else C(String(r[0]));n.forEach(e=>{e.isLeaf||l(String(e.key)).then(t=>{k(n=>{const r=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:r(e.children,t,n)}:e);return r(n,e.key,t)})})})}).finally(()=>{e||A(!1)})}},[v,l,a,te]),e.useEffect(()=>{te||(M||D?(A(!0),a(M||void 0,D||void 0).then(e=>E(e)).finally(()=>A(!1))):E([]))},[M,D,a,te]);const fe=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:fe(e.children,t,n)}:e),me=e=>{I(e),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>{$(e),e?(C(null),re(""),te&&(A(!0),a(void 0,e).then(e=>E(e)).finally(()=>A(!1)))):te?ue&&(ie([]),ae([]),C(ue.id),A(!0),a(ue.id).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>A(!1))):x.length>0&&C(String(x[0].key))},300)},ge=e=>{if(i){if(!T.find(t=>t._id===e._id)){const t=[...T,e];_(t)}}else _([e]),te?setTimeout(()=>{we([e])},0):(G(e._id),setTimeout(()=>{G(null),we([e])},300))},ye=e=>{_(T.filter(t=>t._id!==e))},be=()=>{F(null)},ve=()=>{if(S.length>0&&S.every(e=>T.find(t=>t._id===e._id))){const e=new Set(S.map(e=>e._id));_(T.filter(t=>!e.has(t._id)))}else{const e=[...T];S.forEach(t=>{e.find(e=>e._id===t._id)||e.push(t)}),_(e)}},we=async e=>{if(O(e),o||u){const t=await async function(e){if(0===e.length)return[];const t=e.map(e=>e.user).filter(Boolean);if(0===t.length)return[];const n=`{rows:space_users(filters: [["user","in",[${t.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name,sort_no,organization,organizations}}`;let r=[];try{const e=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),t=await e.json();r=t.data?.rows||[]}catch{}const o=new Set;for(const s of r)if(s.organization&&o.add(s.organization),Array.isArray(s.organizations))for(const e of s.organizations)e&&o.add(e);const i=new Map;if(o.size>0){const e=`{rows:organizations(filters: [["_id","in",[${[...o].map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,name,fullname}}`;try{const t=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await t.json();for(const e of n.data?.rows||[])i.set(e._id,{name:e.name||"",fullname:e.fullname||""})}catch{}}return e.map(e=>{const t=r.find(t=>t.user===e.user)||e,n=i.get(t.organization)||{name:"",fullname:""},o=Array.isArray(t.organizations)?t.organizations.map(e=>i.get(e)).filter(Boolean):n.name?[n]:[];return{id:t.user,name:t.name||"",sort_no:t.sort_no||0,organization:{name:n.name,fullname:n.fullname},organizations:{name:o.map(e=>e.name),fullname:o.map(e=>e.fullname)},hr:{},roles:[]}})}(e);let n=i?t:t[0]||null;"string"===b&&(n=i?t.map(e=>e.id):t[0]?.id||null),u&&await u("change",{value:n},ee.current),o&&o(n)}if(w(!1),!i&&g&&g.length>0&&1===e.length&&y){const t=e[0],n=[],r=new Map;for(const e of g){if(!e.sourceField||!e.targetField)continue;const t=e.sourceField.indexOf(".");if(t>0){const n=e.sourceField.substring(0,t),o=e.sourceField.substring(t+1);r.has(n)||r.set(n,[]),r.get(n).push({subField:o,targetField:e.targetField})}else n.push(e)}const o={};if(n.length>0){const e=n.map(e=>e.sourceField).filter(Boolean),r=e=>{for(const t of n)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(o[t.targetField]=String(e[t.sourceField]))};if(e.every(e=>e in t&&null!=t[e]))r(t);else try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){${["_id",...e].join(",")}}}`,o=await fetch("/graphql",{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json(),s=i.data?.rows||[];s.length>0&&r(s[0])}catch{}}const i={organization:"organizations"};for(const[e,s]of r){const n=i[e];if(!n)continue;let r=t[e];if(!r)try{const n=`{rows:space_users(filters: [["user","=","${t.user}"]], top: 1){_id,${e}}}`,o=await fetch(ms("/graphql"),{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),i=await o.json();r=i.data?.rows?.[0]?.[e]}catch{}if(!r)continue;const a=s.map(e=>e.subField);try{const e=`{rows:${n}(filters: [["_id","=","${r}"]], top: 1){${["_id",...a].join(",")}}}`,t=await fetch(ms("/graphql"),{method:"POST",headers:gs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),i=await t.json(),l=i.data?.rows?.[0];if(l)for(const n of s)null!=l[n.subField]&&(o[n.targetField]=String(l[n.subField]))}catch{}}Object.keys(o).length>0&&y(o)}},xe=async()=>{await we(T)},ke=()=>{_([...R]),w(!1)},Se=e.useCallback(async(e,t)=>{ie(n=>[...n,{id:e,name:t}]),C(e),$(""),I(""),A(!0);try{const[t,n]=await Promise.all([l(e),ys(e)]);ae(t),E(n)}catch{ae([]),E([])}finally{A(!1)}},[l]),Ee=e.useCallback(async e=>{if(e<0)return;const t=oe.slice(0,e+1);ie(t);const n=t[t.length-1];C(n.id),$(""),I(""),A(!0);try{const[e,t]=await Promise.all([l(n.id),ys(n.id)]);ae(e),E(t)}catch{ae([]),E([])}finally{A(!1)}},[oe,l]),Me=e.useCallback(async()=>{if(ue){ie([]),C(ue.id),$(""),I(""),ae([]),A(!0);try{const e=await a(ue.id);E(e)}catch{E([])}finally{A(!1)}}},[ue,a]),Ce=e.useCallback(async()=>{if(!(oe.length<=0))if(1===oe.length)await Me();else{const e=oe.slice(0,-1);ie(e);const t=e[e.length-1];C(t.id),$(""),I(""),A(!0);try{const[e,n]=await Promise.all([l(t.id),ys(t.id)]);ae(e),E(n)}catch{ae([]),E([])}finally{A(!1)}}},[oe,Me,l]),Re=e.useCallback((e,t)=>{if(e<0||t<0||e>=T.length||t>=T.length)return;const n=[...T],[r]=n.splice(e,1);n.splice(t,0,r),_(n)},[T]),Oe=e.useCallback(e=>{T.find(t=>t._id===e._id)?ye(e._id):ge(e)},[T,i,ge,ye]),Te=d&&R.length>0&&(te||q);return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:R.map(e=>e.name).join(", "),onClick:()=>{w(!0),_([...R]),te&&(ne("users"),re(""),ce(!1),ie([]),ae([]),de(null))},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),variant:h||m?"borderless":"outlined",className:h?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...h?{backgroundColor:p?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{}},suffix:m?null:Te?e.createElement(Tn,{style:{color:"#ff4d4f",cursor:"pointer",padding:te?4:0},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),onClick:async e=>{e.stopPropagation(),O([]);const t=i?[]:null;u&&await u("change",{value:t},ee.current),o&&o(t),W(!1)}}):e.createElement(Xn,{style:{color:"#999"},onMouseEnter:()=>!te&&R.length>0&&W(!0),onMouseLeave:()=>!te&&W(!1)})}),!te&&e.createElement(t.Modal,{title:i?"选择人员 (多选)":"选择人员",open:v,onOk:i?xe:void 0,onCancel:ke,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:1200,destroyOnClose:!0,bodyStyle:{height:600,overflow:"hidden",padding:0}},e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{width:240,borderRight:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement(t.Input,{placeholder:"搜索部门",prefix:e.createElement(Yn,null),value:j,onChange:e=>(e=>{if(Q.current&&clearTimeout(Q.current),z(e),!e)return A(!0),void l().then(e=>{const t=e.map(e=>({...e,children:void 0}));k(t),J(e=>e+1);const n=t.map(e=>e.key);H(n),n.length>0&&C(String(n[0]))}).finally(()=>A(!1));Q.current=setTimeout(()=>{A(!0),l(void 0,e).then(e=>k(e)).finally(()=>A(!1))},300)})(e.target.value),allowClear:!0,style:{marginBottom:12},size:"small"}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:N&&!M&&!D},e.createElement(t.Tree,{key:Y,treeData:x,onSelect:(e,t)=>{e.length>0?(C(String(e[0])),$(""),I(""),te&&t?.node&&(re(String(t.node.title||"")),ne("users"))):x.length>0&&C(String(x[0].key))},loadData:j?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await l(String(e));k(t=>fe(t,e,n))},showLine:!0,selectedKeys:M?[M]:[],expandedKeys:B,onExpand:H})))),e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column"}},e.createElement("style",null,"\n .steedos-user-selector-item:hover {\n background-color: #f0f7ff !important;\n border-color: #1890ff !important;\n }\n "),e.createElement("div",{style:{display:"flex",gap:8,marginBottom:12}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Yn,null),value:L,onChange:e=>me(e.target.value),allowClear:!0,style:{flex:1}}),i&&S.length>0&&e.createElement(t.Button,{onClick:ve},S.every(e=>T.find(t=>t._id===e._id))?"取消":"全选")),e.createElement("div",{style:{flex:1,overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:4,position:"relative"}},e.createElement(t.Spin,{spinning:N},S.length>0?e.createElement(e.Fragment,null,e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(180px, 1fr))",gap:"4px",padding:"0 8px"}},S.slice(0,he).map(n=>{const r=!!T.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||ge(n)},style:{padding:"10px 12px",borderRadius:4,cursor:"pointer",backgroundColor:K===n._id?"#e6f7ff":r&&i?"#f5f5f5":"transparent",borderColor:K===n._id||r&&i?"#1890ff":"transparent",borderWidth:1,borderStyle:"solid",transition:"all 0.2s",opacity:r&&i?.6:1,display:"flex",alignItems:"center",gap:12,minWidth:0}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:40,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,marginBottom:4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.organization?.name&&e.createElement("span",null,n.organization.name),n.position&&e.createElement("span",null," · ",n.position)),e.createElement("div",{style:{fontSize:12,color:"#999",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.email||n.mobile||n.username)),r&&e.createElement(Cn,{style:{color:"#1890ff",flexShrink:0}}))})),he<S.length&&e.createElement("div",{ref:pe,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!M&&!D||N?N?null:e.createElement(t.Empty,{description:"请选择部门或搜索",style:{marginTop:60}}):e.createElement(t.Empty,{description:"暂无人员",style:{marginTop:60}})))),e.createElement("div",{style:{width:240,borderLeft:"1px solid #f0f0f0",padding:16,display:"flex",flexDirection:"column"}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",T.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},T.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},T.map((n,r)=>e.createElement("div",{key:n._id,draggable:i,onDragStart:()=>(e=>{F(e)})(r),onDragEnd:be,onDragOver:e=>((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===P||P===t)return;const n=Date.now();if(n-X.current<100)return;X.current=n;const r=[...T],o=r[P];r.splice(P,1),r.splice(t,0,o),_(r),F(t)})(e,r),onMouseEnter:()=>U(n._id),onMouseLeave:()=>U(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:P===r?"#e6f7ff":"#f5f5f5",borderRadius:4,position:"relative",cursor:i?"grab":"default",transition:"all 0.3s ease",opacity:P===r?.5:1,border:P===r?"1px dashed #1890ff":"1px solid transparent",transform:P===r?"scale(0.98)":"scale(1)",boxShadow:P===r?"0 2px 8px rgba(0,0,0,0.1)":"none"}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:32,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n.name),d&&V===n._id&&e.createElement(Tn,{onClick:()=>ye(n._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),d&&T.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>_([]),style:{marginTop:8,padding:0}},"清空全部")))),te&&v&&e.createElement(fs,{visible:v,multiple:i,loading:N,users:S,searchKeyword:D,searchInputValue:L,tempSelectedUsers:T,clearable:d,rootDeptInfo:ue,deptPath:oe,currentLevelDepts:se,showSelectedPanel:le,onDrillDown:Se,onMobileBack:Ce,onDrillBack:Ee,onBackToRoot:Me,onToggleSelectedPanel:()=>ce(e=>!e),onUserSearch:me,onAddUser:ge,onRemoveUser:ye,onToggleUser:Oe,onToggleSelectAll:ve,onReorderUsers:Re,onOk:xe,onCancel:ke,onClearAll:()=>_([])}))};function xs(e={}){return{...e}}async function ks(e,t){if(t){const e=`{rows:organizations(filters: [["name","contains","${t}"]], top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:xs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}if(e){const t=`{rows:organizations(filters: [["parent","=","${e}"]], top: 5000, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,_display:_ui{sort_no},parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:xs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();return(r.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:xs()}),t=await e.json();return(t.data?.rows||t.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!(Array.isArray(e.children)&&e.children.length>0),children:void 0,defer:e.defer,parentId:e.parent}))}}function Ss(e,t){for(const n of e){if(n.key===t)return n;if(n.children){const e=Ss(n.children,t);if(e)return e}}return null}async function Es(e,t){try{const n=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,r=await fetch("/graphql",{method:"POST",headers:xs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json(),i=o.data?.node?.[0];if(!i)return t;if(i.fullname)return i.fullname;const s=[i.name];let a=i.parent;for(;a;)s.unshift(a.name),a=a.parent;return s.join(" / ")}catch{return t}}const Ms=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择部门/分组",fetchDeptTree:a=ks,style:l,dispatchEvent:c,data:u,isTableMode:d=!1,hasError:h=!1,formalTableMode:p=!1,pickerFillRules:f,onFillFields:m,valueFormat:g="object"}=n,[y,b]=e.useState([]),v=e.useRef(null),[w,x]=e.useState(!1),[k,S]=e.useState(new Map),[E,M]=e.useState([]),[R,O]=e.useState(""),T=e.useRef(null),_=e.useRef([]),N=e.useRef(new Map),A=e.useRef([]),D=e=>"object"==typeof e&&e?.id?String(e.id).trim():String(e).trim(),$=e.useMemo(()=>i?Array.isArray(r)?r.map(e=>D(e)).filter(Boolean):r?"object"==typeof r&&r.id?[D(r)]:String(r).split(",").map(e=>e.trim()).filter(Boolean):[]:[],[r,i]),L=e.useCallback(e=>{if(!e)return"";if("object"==typeof e)return e.id?String(e.id).trim():e._id?String(e._id).trim():"";if("string"==typeof e){const t=e.trim();if(!t)return"";if(t.startsWith("{")&&t.endsWith("}"))try{const e=JSON.parse(t);if(e?.id)return String(e.id).trim();if(e?._id)return String(e._id).trim()}catch{}return t}return String(e).trim()},[]),I=e.useMemo(()=>i?r:L(r)||void 0,[r,i,L]);e.useEffect(()=>{v.current={props:n}}),e.useEffect(()=>{e.startTransition(()=>x(!0)),a().then(e=>{b(e);const t=e.map(e=>String(e.key));M(t);const n=(e,t="")=>e.map(e=>{const r=e.fullname||(t?`${t} / ${e.title}`:e.title);return{...e,pathLabel:r,children:e.children?n(e.children,r):void 0}}),r=n(e);b(r);const o=new Map,i=e=>{e.forEach(e=>{o.set(e.key,e.pathLabel),e.children&&i(e.children)})};i(r),S(o),_.current=r,N.current=o,A.current=t}).finally(()=>x(!1))},[a]),e.useEffect(()=>{const e=i?$:L(r)?[L(r)]:[];if(0===e.length)return;const t=(e,n)=>{for(const r of e){if(r.key===n)return!0;if(r.children&&t(r.children,n))return!0}return!1},n=e.filter(e=>!t(y,String(e)));if(n.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(n)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:xs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(async e=>{const t=(e.data?.rows||[]).map(e=>({title:e.name,fullname:e.fullname,value:String(e._id),key:String(e._id),isLeaf:!0,pathLabel:e.fullname||e.name,isExtra:!0}));t.length>0&&(b(e=>{const n=new Set,r=e=>{e.forEach(e=>{n.add(e.key),e.children&&r(e.children)})};r(e);const o=t.filter(e=>!n.has(e.key));return 0===o.length?e:[...e,...o]}),S(e=>{const n=new Map(e);return t.forEach(e=>n.set(e.key,e.pathLabel)),n}))})}},[r,y,i,$,L]);const j=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:j(e.children,t,n)}:e),z=()=>{_.current.length>0&&(b(_.current),S(N.current),M(A.current))},P=e=>{const t=Ss(y,e),n=t?.title||"";return{id:e,name:n,fullname:t?.fullname||k.get(e)||n}};return e.createElement(t.Spin,{spinning:w,className:"steedos-org-selector"},e.createElement(t.TreeSelect,{treeData:y,className:"w-full "+(d?"picker-table-mode":""),value:i?$.map(e=>({value:String(e),label:k.get(String(e))||e})):I||void 0,onChange:async(e,t,n)=>{let r=e;if(i&&e&&(Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&"value"in e[0]?r=e.map(e=>e.value):Array.isArray(e)?r=e:"object"==typeof e&&"value"in e&&(r=e.value)),o||c){const e=async e=>{const t=await(c?.("change",e?C(u,{value:e}):u,v.current));t?.prevented||o?.(e)};if(Array.isArray(r)){await Promise.all(r.map(async e=>{const t=k.get(String(e));if(!t||!t.includes("/")){const t=Ss(y,String(e));if(t){const n=await Es(String(e),t.title),r=new Map(k);r.set(String(e),n),S(r)}}}));const t=r.map(e=>P(String(e)));e("string"===g?t.map(e=>e.id):t)}else if(r){const t=k.get(String(r));if(!t||!t.includes("/")){const e=Ss(y,String(r));if(e){const t=await Es(String(r),e.title),n=new Map(k);n.set(String(r),t),S(n)}}const n=P(String(r));e("string"===g?n.id:n)}else await e(void 0)}if(!i&&f&&f.length>0&&m&&r&&!Array.isArray(r)){const e=`{rows:organizations(filters: [["_id","=","${String(r)}"]], top: 1){${["_id",...f.map(e=>e.sourceField).filter(Boolean)].join(",")}}}`;fetch("/graphql",{method:"POST",headers:xs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];if(t.length>0){const e=t[0],n={};for(const t of f)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(n[t.targetField]=String(e[t.sourceField]));Object.keys(n).length>0&&m(n)}})}},treeCheckable:i,showCheckedStrategy:i?void 0:t.TreeSelect.SHOW_PARENT,placeholder:s,variant:d?"borderless":"outlined",style:{minWidth:196,...l,...d?{backgroundColor:h?"rgba(254,226,226,0.9)":p?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,width:"100%",fontSize:13}:{}},loadData:async e=>{if(e.children)return;x(!0);const t=await a(String(e.key));b(n=>{const r=new Set(t.map(e=>e.key)),o=n.filter(e=>!(e.isExtra&&r.has(e.key))),i=e.pathLabel||e.title,s=t.map(e=>({...e,pathLabel:e.fullname||`${i} / ${e.title}`})),a=j(o,String(e.key),s),l=new Map(k);return s.forEach(e=>{l.set(e.key,e.pathLabel)}),S(l),_.current=a,N.current=l,a}),x(!1)},treeDefaultExpandAll:!1,treeExpandedKeys:E,onTreeExpand:e=>{M(e.map(e=>String(e)))},allowClear:!0,multiple:i,treeCheckStrictly:i,treeLine:!0,styles:{popup:{root:{minWidth:400,maxWidth:450,maxHeight:700,overflow:"auto",zIndex:3e3}}},treeNodeLabelProp:"pathLabel",showSearch:!0,searchValue:R,onSearch:e=>{O(e),T.current&&clearTimeout(T.current),e?(x(!0),T.current=setTimeout(async()=>{const t=(await a(void 0,e)).map(e=>({...e,title:e.fullname||e.title,pathLabel:e.fullname||e.title}));b(t);const n=new Map;t.forEach(e=>{n.set(e.key,e.pathLabel)}),S(n),x(!1)},300)):z()},onDropdownVisibleChange:e=>{e&&R&&(O(""),z()),!e&&R&&(O(""),z())},filterTreeNode:!1,maxTagCount:"responsive",listHeight:600}))};function Cs(e={}){return{...e}}function Rs({value:t,isTableMode:n=!1}){const[r,o]=e.useState(new Map),{names:i,unresolvedIds:s}=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?{names:[e.name||e.id],unresolvedIds:[]}:Array.isArray(e)&&e.length>0&&"object"==typeof e[0]&&e[0].id?{names:e.map(e=>e.name||e.id),unresolvedIds:[]}:{names:[],unresolvedIds:("string"==typeof e?e:Array.isArray(e)?e.join(","):String(e)).split(",").map(e=>e.trim()).filter(Boolean)}:{names:[],unresolvedIds:[]}}(t);e.useEffect(()=>{if(0===s.length)return;const e=s.filter(e=>!r.has(e));if(0===e.length)return;const t=`{rows:space_users(filters: [["user","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 1000){_id,user,name}}`;fetch("/graphql",{method:"POST",headers:Cs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];o(e=>{const n=new Map(e);for(const r of t)r.user&&r.name&&n.set(r.user,r.name);return n})}).catch(()=>{})},[t]);const a=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return i.length>0?React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},i.map((e,t)=>React.createElement("span",{key:t,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e)))):0===s.length?React.createElement("div",{className:a}):React.createElement("div",{className:a},React.createElement("div",{className:"flex flex-wrap gap-1.5"},s.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},r.get(e)||e))))}function Os(e={}){return{...e}}function Ts({value:t,isTableMode:n=!1}){const r=function(e){return e?"object"==typeof e&&!Array.isArray(e)&&e.id?[{id:e.id,name:e.name||"",fullname:e.fullname||""}]:Array.isArray(e)?e.length>0&&"object"==typeof e[0]&&e[0].id?e.map(e=>({id:e.id,name:e.name||"",fullname:e.fullname||""})):e.map(e=>({id:String(e),name:"",fullname:""})):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean).map(e=>({id:e,name:"",fullname:""})):[]:[]}(t),[o,i]=e.useState(new Map);e.useEffect(()=>{if(0===r.length)return;const e=r.filter(e=>!e.name&&!o.has(e.id)).map(e=>e.id);if(0===e.length)return;const t=`{rows:organizations(filters: [["_id","in",${JSON.stringify(e)}]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Os({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];i(e=>{const n=new Map(e);for(const r of t)r._id&&n.set(r._id,r.fullname||r.name||r._id);return n})}).catch(()=>{})},[t]);const s=n?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return 0===r.length?React.createElement("div",{className:s}):React.createElement("div",{className:s},React.createElement("div",{className:"flex flex-wrap gap-1.5"},r.map(e=>React.createElement("span",{key:e.id,className:"inline-flex items-center gap-1 text-[12px] text-slate-700 rounded pr-2 py-0.5"},e.fullname||e.name||o.get(e.id)||e.id))))}var _s,Ns,As={exports:{}},Ds={};function $s(){return Ns||(Ns=1,As.exports=function(){if(_s)return Ds;_s=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(o){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=r({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,a(c)&&u({inst:c})},[e,n,t]),o(function(){return a(c)&&u({inst:c}),e(function(){a(c)&&u({inst:c})})},[e]),s(n),n};return Ds.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,Ds}()),As.exports}var Ls=$s();function Is(t,n,r){const{children:o,...i}=n;return void 0!==r&&(i.key=r),void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}function js(t,n,r){const{children:o,...i}=n;return Array.isArray(o)?e.createElement(t,i,...o):void 0!==o?e.createElement(t,i,o):e.createElement(t,i)}const zs=e.Fragment;function Ps(e){this.content=e}function Fs(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let e=0;o.text[e]==i.text[e];e++)n++;return n}if(o.content.size||i.content.size){let e=Fs(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function Bs(e,t,n,r){for(let o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let e=0,t=Math.min(s.text.length,a.text.length);for(;e<t&&s.text[s.text.length-e-1]==a.text[a.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let e=Bs(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}Ps.prototype={constructor:Ps,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,o=r.find(e),i=r.content.slice();return-1==o?i.push(n||e,t):(i[o+1]=t,n&&(i[o]=n)),new Ps(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Ps(n)},addToStart:function(e,t){return new Ps([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Ps(n)},addBefore:function(e,t,n){var r=this.remove(t),o=r.content.slice(),i=r.find(e);return o.splice(-1==i?o.length:i,0,t,n),new Ps(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Ps.from(e)).size?new Ps(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Ps.from(e)).size?new Ps(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Ps.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Ps.from=function(e){if(e instanceof Ps)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Ps(t)};class Hs{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new Hs(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new Hs(n,r)}cutByIndex(e,t){return e==t?Hs.empty:0==e&&t==this.content.length?this:new Hs(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new Hs(r,o)}addToStart(e){return new Hs([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Hs(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Fs(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Bs(this,e,t,n)}findIndex(e){if(0==e)return Us(0,e);if(e==this.size)return Us(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?Us(t+1,r):Us(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Hs.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Hs(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Hs.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new Hs(t||e,n)}static from(e){if(!e)return Hs.empty;if(e instanceof Hs)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Hs([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Hs.empty=new Hs([],0);const Vs={index:0,offset:0};function Us(e,t){return Vs.index=e,Vs.offset=t,Vs}function qs(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!qs(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!qs(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Ws=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ws.none=[];class Ys extends Error{}class Js{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Gs(this.content,e+this.openStart,t);return n&&new Js(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Js(Ks(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Js.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new Js(Hs.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new Js(e,n,r)}}function Ks(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(Ks(i.content,t-o-1,n-o-1)))}function Gs(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=Gs(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function Zs(e,t,n){if(n.openStart>e.depth)throw new Ys("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ys("Inconsistent open depths");return Qs(e,t,n,0)}function Qs(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=Qs(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)r=t.node(o).copy(Hs.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return ra(i,oa(e,o,s,t,r))}{let r=e.parent,o=r.content;return ra(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return ra(i,ia(e,t,r))}function Xs(e,t){if(!t.type.compatibleContent(e.type))throw new Ys("Cannot join "+t.type.name+" onto "+e.type.name)}function ea(e,t,n){let r=e.node(n);return Xs(r,t.node(n)),r}function ta(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function na(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(ta(e.nodeAfter,r),i++));for(let a=i;a<s;a++)ta(o.child(a),r);t&&t.depth==n&&t.textOffset&&ta(t.nodeBefore,r)}function ra(e,t){return e.type.checkContent(t),e.copy(t)}function oa(e,t,n,r,o){let i=e.depth>o&&ea(e,t,o+1),s=r.depth>o&&ea(n,r,o+1),a=[];return na(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(Xs(i,s),ta(ra(i,oa(e,t,n,r,o+1)),a)):(i&&ta(ra(i,ia(e,t,o+1)),a),na(t,n,o,a),s&&ta(ra(s,ia(n,r,o+1)),a)),na(r,null,o,a),new Hs(a)}function ia(e,t,n){let r=[];if(na(null,e,n,r),e.depth>n){ta(ra(ea(e,t,n+1),ia(e,t,n+1)),r)}return na(t,null,n,r),new Hs(r)}Js.empty=new Js(Hs.empty,0,0);class sa{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return Ws.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ua(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(o),s=o-t;if(n.push(i,e,r+t),!s)break;if(i=i.child(e),i.isText)break;o=s-1,r+=t+1}return new sa(t,n,o)}static resolveCached(e,t){let n=ca.get(e);if(n)for(let o=0;o<n.elts.length;o++){let e=n.elts[o];if(e.pos==t)return e}else ca.set(e,n=new aa);let r=n.elts[n.i]=sa.resolve(e,t);return n.i=(n.i+1)%la,r}}class aa{constructor(){this.elts=[],this.i=0}}const la=12,ca=new WeakMap;class ua{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const da=Object.create(null);class ha{constructor(e,t,n,r=Ws.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Hs.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&qs(this.attrs,t||e.defaultAttrs||da)&&Ws.sameSet(this.marks,n||Ws.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Js.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new Js(a,r.depth-i,o.depth-i)}replace(e,t,n){return Zs(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return sa.resolveCached(this,e)}resolveNoCache(e){return sa.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fa(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Hs.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let a=r;a<o;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ws.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ws.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=Hs.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}ha.prototype.text=void 0;class pa extends ha{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):fa(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new pa(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pa(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function fa(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ma{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new ga(e,t);if(null==n.next)return ma.empty;let r=ya(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(Sa(e,0));function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);Sa(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new ma(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(ka);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}}(function(e){let t=[[]];return o(i(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}function i(e,t){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(i(n,t)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(t,s),o(i(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(i(e.expr,t),s),o(i(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();o(i(e.expr,s),t),s=t}if(-1==e.max)o(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();r(s,t),o(i(e.expr,s),t),s=t}return[r(s)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=i(e.exprs[r],t);if(r==e.exprs.length-1)return s;o(s,t=n())}}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return Hs.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}ma.empty=new ma(!0);class ga{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ya(e){let t=[];do{t.push(ba(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ba(e){let t=[];do{t.push(va(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function va(e){let t=function(e){if(e.eat("(")){let t=ya(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let i in n){let e=n[i];e.isInGroup(t)&&o.push(e)}0==o.length&&e.err("No node type or group '"+t+"' found");return o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=xa(e,t)}return t}function wa(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function xa(e,t){let n=wa(e),r=n;return e.eat(",")&&(r="}"!=e.next?wa(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function ka(e,t){return t-e}function Sa(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(ka)}function Ea(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Ma(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function Ca(e,t,n,r){for(let o in t)if(!(o in e))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in e){let n=e[o];n.validate&&n.validate(t[o])}}function Ra(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ta(e,r,t[r]);return n}let Oa=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Ra(e,n.attrs),this.defaultAttrs=Ea(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ma.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ma(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ha(this,this.computeAttrs(e),Hs.from(t),Ws.setFrom(n))}createChecked(e=null,t,n){return t=Hs.from(t),this.checkContent(t),new ha(this,this.computeAttrs(e),t,Ws.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Hs.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(Hs.empty,!0);return o?new ha(this,e,t.append(o),Ws.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ca(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Ws.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,o)=>r[t]=new e(t,n,o));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Ta{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _a{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ra(e,r.attrs),this.excluded=null;let o=Ea(this.attrs);this.instance=o?new Ws(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ws(this,Ma(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new _a(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ca(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Na{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Ps.from(e.nodes),t.marks=Ps.from(e.marks||{}),this.nodes=Oa.compile(this.spec.nodes,this),this.marks=_a.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let e=this.nodes[r],t=e.spec.content||"",o=e.spec.marks;if(e.contentMatch=n[t]||(n[t]=ma.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==o?null:o?Aa(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let r in this.marks){let e=this.marks[r],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:Aa(this,t.split(" "))}this.nodeFromJSON=e=>ha.fromJSON(this,e),this.markFromJSON=e=>Ws.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Oa))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new pa(n,n.defaultAttrs,e,Ws.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Aa(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Da{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Pa(this,t,!1);return n.addAll(e,Ws.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Pa(this,t,!0);return n.addAll(e,Ws.none,t.from,t.to),Js.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Fa(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let r in e.marks){let t=e.marks[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ba(e)),e.mark||e.ignore||e.clearMark||(e.mark=r)})}for(let r in e.nodes){let t=e.nodes[r].spec.parseDOM;t&&t.forEach(e=>{n(e=Ba(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Da(e,Da.schemaRules(e)))}}const $a={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},La={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ia={ol:!0,ul:!0};function ja(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class za{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=Ws.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Hs.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Hs.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Hs.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!$a.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Pa{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=ja(null,t.preserveWhitespace,0)|(n?4:0);r=o?new za(o.type,o.attrs,Ws.none,!0,t.topMatch||o.type.contentMatch,i):new za(n?null:e.schema.topNodeType,null,Ws.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();Ia.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Ia.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:La.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if($a.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let e=this.parser.matchedStyles[r],o=n.getPropertyValue(e);if(o)for(let n;;){let r=this.parser.matchStyle(e,o,this,n);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;n=r}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let i=this.open,s=0;i>=0;i--){let t=this.nodes[i],a=t.findWrapping(e);if(a&&(!r||r.length>a.length+s)&&(r=a,o=t,!a.length))break;if(t.solid){if(n)break;s+=2}}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)t=this.enterInner(r[i],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=Ws.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):Ha(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=ja(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=Ws.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):Ha(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new za(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)){t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function Fa(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Ba(e){let t={};for(let n in e)t[n]=e[n];return t}function Ha(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class Va{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=qa(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=Ja(qa(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ja(qa(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return Ja(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Va(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ua(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Ua(e.marks)}}function Ua(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function qa(e){return e.document||window.document}const Wa=new WeakMap;function Ya(e){let t=Wa.get(e);return void 0===t&&Wa.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Ja(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=Ya(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],u=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){u=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let d=u;d<t.length;d++){let o=t[d];if(0===o){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:i}=Ja(e,o,n,r);if(l.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}const Ka=Math.pow(2,16);function Ga(e,t){return e+t*Ka}function Za(e){return 65535&e}class Qa{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Xa{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Xa.empty)return Xa.empty}recover(e){let t=0,n=Za(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/Ka}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],u=a+l;if(e<=u){let o=a+r+((l?e==a?-1:e==u?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:u)?null:Ga(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new Qa(o,d,i)}r+=c-l}return n?e+r:new Qa(e+r,0,null)}touches(e,t){let n=0,r=Za(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let a=this.ranges[s+o];if(e<=t+a&&s==3*r)return!0;n+=this.ranges[s+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new Xa(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Xa.empty:new Xa(e<0?[0,-e,0]:[0,0,e])}}Xa.empty=new Xa([]);class el{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new el(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new el;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let n=this._maps[o].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(o);if(null!=t&&t>o&&t<this.to){o=t,e=this._maps[t].recover(n.recover);continue}}r|=n.delInfo,e=n.pos}return n?e:new Qa(e,r,null)}}const tl=Object.create(null);class nl{getMap(){return Xa.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=tl[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in tl)throw new RangeError("Duplicate use of step JSON ID "+e);return tl[e]=t,t.prototype.jsonID=e,t}}class rl{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new rl(e,null)}static fail(e){return new rl(null,e)}static fromReplace(e,t,n,r){try{return rl.ok(e.replace(t,n,r))}catch(o){if(o instanceof Ys)return rl.fail(o.message);throw o}}}function ol(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(ol(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return Hs.fromArray(r)}class il extends nl{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new Js(ol(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return rl.fromReplace(e,this.from,this.to,o)}invert(){return new sl(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new il(t.pos,n.pos,this.mark)}merge(e){return e instanceof il&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new il(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new il(t.from,t.to,e.markFromJSON(t.mark))}}nl.jsonID("addMark",il);class sl extends nl{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Js(ol(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return rl.fromReplace(e,this.from,this.to,n)}invert(){return new il(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new sl(t.pos,n.pos,this.mark)}merge(e){return e instanceof sl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sl(t.from,t.to,e.markFromJSON(t.mark))}}nl.jsonID("removeMark",sl);class al extends nl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return rl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return rl.fromReplace(e,this.pos,this.pos+1,new Js(Hs.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new al(this.pos,t.marks[n]);return new al(this.pos,this.mark)}}return new ll(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new al(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new al(t.pos,e.markFromJSON(t.mark))}}nl.jsonID("addNodeMark",al);class ll extends nl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return rl.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return rl.fromReplace(e,this.pos,this.pos+1,new Js(Hs.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new al(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ll(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ll(t.pos,e.markFromJSON(t.mark))}}nl.jsonID("removeNodeMark",ll);class cl extends nl{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&dl(e,this.from,this.to)?rl.fail("Structure replace would overwrite content"):rl.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Xa([this.from,this.to-this.from,this.slice.size])}invert(e){return new cl(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new cl(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof cl)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Js.empty:new Js(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new cl(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Js.empty:new Js(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new cl(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new cl(t.from,t.to,Js.fromJSON(e,t.slice),!!t.structure)}}nl.jsonID("replace",cl);class ul extends nl{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(dl(e,this.from,this.gapFrom)||dl(e,this.gapTo,this.to)))return rl.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return rl.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?rl.fromReplace(e,this.from,this.to,n):rl.fail("Content does not fit in gap")}getMap(){return new Xa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ul(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new ul(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ul(t.from,t.to,t.gapFrom,t.gapTo,Js.fromJSON(e,t.slice),t.insert,!!t.structure)}}function dl(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function hl(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<i.childCount;l++){let t=i.child(l),c=a+t.nodeSize,u=r.matchType(t.type);if(u){r=u;for(let r=0;r<t.marks.length;r++)n.allowsMarkType(t.marks[r].type)||e.step(new sl(a,c,t.marks[r]));if(o&&t.isText&&"pre"!=n.whitespace){let e,r,o=/\r?\n|\r/g;for(;e=o.exec(t.text);)r||(r=new Js(Hs.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new cl(a+e.index,a+e.index+e[0].length,r))}}else s.push(new cl(a,c,Js.empty));a=c}if(!r.validEnd){let t=r.fillBefore(Hs.empty,!0);e.replace(a,a,new Js(t,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function pl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function fl(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!pl(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function ml(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(gl).concat({type:t,attrs:n}).concat(i.map(gl)):null}function gl(e){return{type:e,attrs:null}}function yl(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function bl(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function vl(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let e=o.node(c),t=o.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=r&&r[u+1];i&&(n=n.replaceChild(0,i.type.create(i.attrs)));let s=r&&r[u]||e;if(!e.canReplace(t+1,e.childCount)||!s.type.validContent(n))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function wl(e,t){let n=e.resolve(t),r=n.index();return xl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function xl(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function kl(e,t,n=-1){let r=e.resolve(t);for(let o=r.depth;;o--){let e,i,s=r.index(o);if(o==r.depth?(e=r.nodeBefore,i=r.nodeAfter):n>0?(e=r.node(o+1),s++,i=r.node(o).maybeChild(s)):(e=r.node(o).maybeChild(s-1),i=r.node(o+1)),e&&!e.isTextblock&&xl(e,i)&&r.node(o).canReplace(s,s+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}}function Sl(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=r.depth;e>=0;e--){let t=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,n=r.index(e)+(t>0?1:0),s=r.node(e),a=!1;if(1==i)a=s.canReplace(n,n,o);else{let e=s.contentMatchAt(n).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(n,n,e[0])}if(a)return 0==t?r.pos:t<0?r.before(e+1):r.after(e+1)}return null}function El(e,t,n=t,r=Js.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ml(o,i,r)?new cl(t,n,r):new Cl(o,i,r).fit()}function Ml(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}nl.jsonID("replaceAround",ul);class Cl{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Hs.empty;for(let r=0;r<=e.depth;r++){let t=e.node(r);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Hs.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new Js(o,i,s);return e>-1?new ul(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new cl(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Tl(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let i=this.depth;i>=0;i--){let e,{type:s,match:a}=this.frontier[i],l=null;if(1==t&&(o?a.matchType(o.type)||(l=a.fillBefore(Hs.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:i,parent:r,inject:l};if(2==t&&o&&(e=a.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:i,parent:r,wrap:e};if(r&&a.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Tl(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new Js(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Tl(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new Js(Rl(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new Js(Rl(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let f=0;f<o.length;f++)this.openFrontierNode(o[f]);let i=this.unplaced,s=n?n.content:i.content,a=i.openStart-e,l=0,c=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));u=u.matchFragment(r)}let h=s.size+e-(i.content.size-i.openEnd);for(;l<s.childCount;){let e=s.child(l),t=u.matchType(e.type);if(!t)break;l++,(l>1||0==a||e.content.size)&&(u=t,c.push(_l(e.mark(d.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?h:-1)))}let p=l==s.childCount;p||(h=-1),this.placed=Ol(this.placed,t,Hs.from(c)),this.frontier[t].match=u,p&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<h;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?Js.empty:new Js(Rl(i.content,e-1,1),e-1,h<0?i.openEnd:e-1):new Js(Rl(i.content,e,l),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Nl(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Nl(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Nl(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ol(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Ol(this.placed,this.depth,Hs.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Hs.empty,!0);e.childCount&&(this.placed=Ol(this.placed,this.frontier.length,e))}}function Rl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Rl(e.firstChild.content,t-1,n)))}function Ol(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ol(e.lastChild.content,t-1,n)))}function Tl(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function _l(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,_l(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Hs.empty,!0)))),e.copy(r)}function Nl(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Al(e){return e.spec.defining||e.spec.definingForContent}function Dl(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Dl(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Hs.empty,!0))}return e}function $l(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Ll extends nl{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return rl.fail("No node at attribute step's position");let n=Object.create(null);for(let o in t.attrs)n[o]=t.attrs[o];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return rl.fromReplace(e,this.pos,this.pos+1,new Js(Hs.from(r),0,t.isLeaf?0:1))}getMap(){return Xa.empty}invert(e){return new Ll(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ll(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ll(t.pos,t.attr,t.value)}}nl.jsonID("attr",Ll);class Il extends nl{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return rl.ok(n)}getMap(){return Xa.empty}invert(e){return new Il(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Il(t.attr,t.value)}}nl.jsonID("docAttr",Il);let jl=class extends Error{};jl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(jl.prototype=Object.create(Error.prototype)).constructor=jl,jl.prototype.name="TransformError";class zl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new el}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new jl(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Js.empty){let r=El(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Js(Hs.from(n),0,0))}delete(e,t){return this.replace(e,t,Js.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Ml(o,i,r))return e.step(new cl(t,n,r));let s=$l(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let e=o.node(h).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(h)>-1?a=h:o.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let e=h.firstChild;if(c.push(e),p==r.openStart)break;h=e.content}for(let h=u-1;h>=0;h--){let e=c[h],t=Al(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(a)-1)))u=h;else if(t||!e.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let t=(h+u+1)%(r.openStart+1),a=c[t];if(a)for(let c=0;c<s.length;c++){let u=s[(c+l)%s.length],d=!0;u<0&&(d=!1,u=-u);let h=o.node(u-1),p=o.index(u-1);if(h.canReplaceWith(p,p,a.type,a.marks))return e.replace(o.before(u),d?i.after(u):n,new Js(Dl(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let h=s.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>d));h--){let e=s[h];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let o=r.depth-1;o>=0;o--){let e=r.index(o);if(r.node(o).canReplaceWith(e,e,n))return r.before(o+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let e=r.indexAfter(o);if(r.node(o).canReplaceWith(e,e,n))return r.after(o+1);if(e<r.node(o).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new Js(Hs.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=$l(r,o);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||r.node(t).type.contentMatch.validEnd)return e.delete(r.start(t),o.end(t));if(t>0&&(n||r.node(t-1).canReplace(r.index(t-1),o.indexAfter(t-1))))return e.delete(r.before(t),o.after(t))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=Hs.empty,d=0;for(let f=i,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,u=Hs.from(r.node(f).copy(u)),d++):l--;let h=Hs.empty,p=0;for(let f=i,m=!1;f>n;f--)m||o.after(f+1)<o.end(f)?(m=!0,h=Hs.from(o.node(f).copy(h)),p++):c++;e.step(new ul(l,c,s,a,new Js(u.append(h),d,p),u.size-d,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);bl(e,r.node(),r.before(),a)}s.inlineContent&&hl(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new cl(c,l.map(t+n,-1),Js.empty,!0)),!0===r){let t=e.doc.resolve(c);yl(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=Hs.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let e=n[s].type.contentMatch.matchFragment(r);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Hs.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new ul(o,i,o,i,new Js(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&bl(e,t,n,i),hl(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let a=e.mapping.slice(i),l=a.map(n,1),c=a.map(n+t.nodeSize,1);return e.step(new ul(l,c,l+1,c-1,new Js(Hs.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&yl(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new ul(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Js(Hs.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ll(e,t,n)),this}setDocAttribute(e,t){return this.step(new Il(e,t)),this}addNodeMark(e,t){return this.step(new al(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Ws)t.isInSet(n.marks)&&this.step(new ll(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new ll(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=Hs.empty,s=Hs.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=Hs.from(o.node(a).copy(i));let e=r&&r[c];s=Hs.from(e?e.type.create(e.attrs,s):o.node(a).copy(s))}e.step(new cl(t,t,new Js(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),d=Math.min(l+e.nodeSize,n),h=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new sl(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new il(c,d,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof _a){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new sl(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return hl(this,e,t,n),this}}const Pl=Object.create(null);class Fl{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Bl(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Js.empty){let n=t.content.lastChild,r=null;for(let s=0;s<t.openEnd;s++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?Js.empty:t),0==s&&Zl(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),Zl(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Ul(e):Gl(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let o=e.depth-1;o>=0;o--){let r=t<0?Gl(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):Gl(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(r)return r}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Jl(e.node(0))}static atStart(e){return Gl(e,e,0,0,1)||new Jl(e)}static atEnd(e){return Gl(e,e,e.content.size,e.childCount,-1)||new Jl(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Pl[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Pl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Pl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ul.between(this.$anchor,this.$head).getBookmark()}}Fl.prototype.visible=!0;class Bl{constructor(e,t){this.$from=e,this.$to=t}}let Hl=!1;function Vl(e){Hl||e.parent.inlineContent||(Hl=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ul extends Fl{constructor(e,t=e){Vl(e),Vl(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Fl.near(n);let r=e.resolve(t.map(this.anchor));return new Ul(r.parent.inlineContent?r:n,n)}replace(e,t=Js.empty){if(super.replace(e,t),t==Js.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Ul&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ql(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ul(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=Fl.findFrom(t,n,!0)||Fl.findFrom(t,-n,!0);if(!e)return Fl.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(Fl.findFrom(e,-n,!0)||Fl.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new Ul(e,t)}}Fl.jsonID("text",Ul);class ql{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ql(e.map(this.anchor),e.map(this.head))}resolve(e){return Ul.between(e.resolve(this.anchor),e.resolve(this.head))}}class Wl extends Fl{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?Fl.near(o):new Wl(o)}content(){return new Js(Hs.from(this.node),0,0)}eq(e){return e instanceof Wl&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Yl(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Wl(e.resolve(t.anchor))}static create(e,t){return new Wl(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Wl.prototype.visible=!1,Fl.jsonID("node",Wl);class Yl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new ql(n,n):new Yl(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Wl.isSelectable(n)?new Wl(t):Fl.near(t)}}class Jl extends Fl{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Js.empty){if(t==Js.empty){e.delete(0,e.doc.content.size);let t=Fl.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Jl(e)}map(e){return new Jl(e)}eq(e){return e instanceof Jl}getBookmark(){return Kl}}Fl.jsonID("all",Jl);const Kl={map(){return this},resolve:e=>new Jl(e)};function Gl(e,t,n,r,o,i=!1){if(t.inlineContent)return Ul.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&Wl.isSelectable(r))return Wl.create(e,n-(o<0?r.nodeSize:0))}else{let t=Gl(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function Zl(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof cl||i instanceof ul)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(Fl.near(e.doc.resolve(o),n)))}class Ql extends zl{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Ws.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ws.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Fl.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function Xl(e,t){return t&&e?e.bind(t):e}class ec{constructor(e,t,n){this.name=e,this.init=Xl(t.init,n),this.apply=Xl(t.apply,n)}}const tc=[new ec("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new ec("selection",{init:(e,t)=>e.selection||Fl.atStart(t.doc),apply:e=>e.selection}),new ec("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new ec("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class nc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=tc.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new ec(e.key,e.spec.state,e))})}}class rc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new rc(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new Ql(this)}static create(e){let t=new nc(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new rc(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new nc(this.schema,e.plugins),n=t.fields,r=new rc(t);for(let o=0;o<n.length;o++){let t=n[o].name;r[t]=this.hasOwnProperty(t)?this[t]:n[o].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new nc(e.schema,e.plugins),o=new rc(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=ha.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=Fl.fromJSON(o.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],a=s.spec.state;if(s.key==r.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(o[r.name]=a.fromJSON.call(s,e,t[i],o))}o[r.name]=r.init(e,o)}}),o}}function oc(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=oc(o,t,{})),n[r]=o}return n}class ic{constructor(e){this.spec=e,this.props={},e.props&&oc(e.props,this,this.props),this.key=e.key?e.key.key:ac("plugin")}getState(e){return e[this.key]}}const sc=Object.create(null);function ac(e){return e in sc?e+"$"+ ++sc[e]:(sc[e]=0,e+"$")}class lc{constructor(e="key"){this.key=ac(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const cc=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function uc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const dc=(e,t,n)=>{let r=uc(e,n);if(!r)return!1;let o=mc(r);if(!o){let n=r.blockRange(),o=n&&fl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Mc(e,o,t,-1))return!0;if(0==r.parent.content.size&&(pc(i,"end")||Wl.isSelectable(i)))for(let s=r.depth;;s--){let n=El(e.doc,r.before(s),r.after(s),Js.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(pc(i,"end")?Fl.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):Wl.create(r.doc,o.pos-i.nodeSize)),t(r.scrollIntoView())}return!0}if(1==s||r.node(s-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0)};function hc(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=El(e.doc,o,s,Js.empty);if(!a||a.from!=o||a instanceof cl&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(Ul.create(t.doc,o)),n(t.scrollIntoView())}return!0}function pc(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const fc=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=mc(r)}let s=i&&i.nodeBefore;return!(!s||!Wl.isSelectable(s))&&(t&&t(e.tr.setSelection(Wl.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function mc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function gc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const yc=(e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=vc(r);if(!o)return!1;let i=o.nodeAfter;if(Mc(e,o,t,1))return!0;if(0==r.parent.content.size&&(pc(i,"start")||Wl.isSelectable(i))){let n=El(e.doc,r.before(),r.after(),Js.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(pc(i,"start")?Fl.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):Wl.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1)&&(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0)},bc=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=vc(r)}let s=i&&i.nodeAfter;return!(!s||!Wl.isSelectable(s))&&(t&&t(e.tr.setSelection(Wl.create(e.doc,i.pos)).scrollIntoView()),!0)};function vc(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const wc=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function xc(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const kc=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof Jl||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=xc(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Ul.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Sc=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(vl(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&fl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Ec=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof Wl&&e.selection.node.isBlock)return!(!n.parentOffset||!vl(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let h=n.depth;;h--){if(n.node(h).isBlock){a=n.end(h)==n.pos+(n.depth-h),l=n.start(h)==n.pos-(n.depth-h),i=xc(n.node(h-1).contentMatchAt(n.indexAfter(h-1))),s.unshift(a&&i?{type:i}:null),o=h;break}if(1==h)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Ul||e.selection instanceof Jl)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=vl(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=vl(c.doc,u,s.length,s)),!d)return!1;if(c.split(u,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0};function Mc(e,t,n,r){let o,i,s=t.nodeBefore,a=t.nodeAfter,l=s.type.spec.isolating||a.type.spec.isolating;if(!l&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!wl(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(a.type))&&i.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=Hs.empty;for(let e=o.length-1;e>=0;e--)i=Hs.from(o[e].create(null,i));i=Hs.from(s.copy(i));let l=e.tr.step(new ul(t.pos-1,r,t.pos,r,new Js(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&wl(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&l?null:Fl.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),h=d&&fl(d);if(null!=h&&h>=t.depth)return n&&n(e.tr.lift(d,h).scrollIntoView()),!0;if(c&&pc(a,"start",!0)&&pc(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=a,l=1;for(;!i.isTextblock;i=i.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=Hs.empty;for(let e=o.length-1;e>=0;e--)r=Hs.from(o[e].copy(r));n(e.tr.step(new ul(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new Js(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Cc(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(Ul.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Rc=Cc(-1),Oc=Cc(1);function Tc(e,t=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(r,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function _c(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}function Nc(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new ua(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ua(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=ml(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=Hs.empty;for(let u=n.length-1;u>=0;u--)i=Hs.from(n[u].type.create(n[u].attrs,i));e.step(new ul(t.start-(r?2:0),t.end,t.start,t.end,new Js(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,h=!0;u<d;u++,h=!1)!h&&vl(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize}(e,t,a,o,n);return!0}(a,s,e,t)&&(r&&r(a.scrollIntoView()),!0)}}function Ac(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new ul(i-1,s,i,s,new Js(Hs.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ua(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=fl(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);wl(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos);return t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=o.child(f).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=0==n.startIndex,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?Hs.empty:Hs.from(o))))return!1;let d=i.pos,h=d+s.nodeSize;return r.step(new ul(d-(a?1:0),h+(l?1:0),d+1,h-1,new Js((a?Hs.empty:Hs.from(o.copy(Hs.empty))).append(l?Hs.empty:Hs.from(o.copy(Hs.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}_c(cc,dc,fc),_c(cc,yc,bc),_c(wc,kc,Sc,Ec),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Dc=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},$c=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Lc=null;const Ic=function(e,t,n){let r=Lc||(Lc=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},jc=function(e,t,n,r){return n&&(Pc(e,t,n,r,-1)||Pc(e,t,n,r,1))},zc=/^(img|br|input|textarea|hr)$/i;function Pc(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:Fc(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Bc(e)||zc.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Dc(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?Fc(e):0}}}}function Fc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Bc(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Hc=function(e){return e.focusNode&&jc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Vc(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const Uc="undefined"!=typeof navigator?navigator:null,qc="undefined"!=typeof document?document:null,Wc=Uc&&Uc.userAgent||"",Yc=/Edge\/(\d+)/.exec(Wc),Jc=/MSIE \d/.exec(Wc),Kc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Wc),Gc=!!(Jc||Kc||Yc),Zc=Jc?document.documentMode:Kc?+Kc[1]:Yc?+Yc[1]:0,Qc=!Gc&&/gecko\/(\d+)/i.test(Wc);Qc&&(/Firefox\/(\d+)/.exec(Wc)||[0,0])[1];const Xc=!Gc&&/Chrome\/(\d+)/.exec(Wc),eu=!!Xc,tu=Xc?+Xc[1]:0,nu=!Gc&&!!Uc&&/Apple Computer/.test(Uc.vendor),ru=nu&&(/Mobile\/\w+/.test(Wc)||!!Uc&&Uc.maxTouchPoints>2),ou=ru||!!Uc&&/Mac/.test(Uc.platform),iu=!!Uc&&/Win/.test(Uc.platform),su=/Android \d/.test(Wc),au=!!qc&&"webkitFontSmoothing"in qc.documentElement.style,lu=au?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cu(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function uu(e,t){return"number"==typeof e?e:e[t]}function du(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function hu(e,t,n){let r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=$c(s);continue}let e=s,n=e==i.body,a=n?cu(i):du(e),l=0,c=0;if(t.top<a.top+uu(r,"top")?c=-(a.top-t.top+uu(o,"top")):t.bottom>a.bottom-uu(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+uu(o,"top")-a.top:t.bottom-a.bottom+uu(o,"bottom")),t.left<a.left+uu(r,"left")?l=-(a.left-t.left+uu(o,"left")):t.right>a.right-uu(r,"right")&&(l=t.right-a.right+uu(o,"right")),l||c)if(n)i.defaultView.scrollBy(l,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let o=e.scrollLeft-n,i=e.scrollTop-r;t={left:t.left-o,top:t.top-i,right:t.right-o,bottom:t.bottom-i}}let u=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(u))break;s="absolute"==u?s.offsetParent:$c(s)}}function pu(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=$c(r));return t}function fu(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:o,left:i}=e[n];r.scrollTop!=o+t&&(r.scrollTop=o+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let mu=null;function gu(e,t){let n,r,o,i,s=2e8,a=0,l=t.top,c=t.top;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(1==u.nodeType)e=u.getClientRects();else{if(3!=u.nodeType)continue;e=Ic(u).getClientRects()}for(let h=0;h<e.length;h++){let p=e[h];if(p.top<=l&&p.bottom>=c){l=Math.max(p.bottom,l),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&e&&(a=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!o&&p.left<=t.left&&p.right>=t.left&&(o=u,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){let n,r=e.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);let r=xu(o,1);if(r.top!=r.bottom&&yu(t,r)){n={node:e,offset:i+(t.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:gu(n,r)}function yu(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function bu(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let r=0;r<e.length;r++){let o=e[r];if(yu(t,o))return bu(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function vu(e,t){let n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Fc(r.offsetNode),r.offset)}}catch(r){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Fc(r.startContainer),r.startOffset)}}}(r,t.left,t.top);i&&({node:n,offset:o}=i);let s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let n=e.dom.getBoundingClientRect();if(!yu(t,n))return null;if(a=bu(e.dom,t,n),!a)return null}if(nu)for(let c=a;n&&c;c=$c(c))c.draggable&&(n=void 0);if(a=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(Qc&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let e,r=n.childNodes[o];"IMG"==r.nodeName&&(e=r.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&o++}let r;au&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){let o=-1;for(let i=t,s=!1;i!=e.dom;){let t,n=e.docView.nearestDesc(i,!0);if(!n)return null;if(1==n.dom.nodeType&&(n.node.isBlock&&n.parent||!n.contentDOM)&&((t=n.dom.getBoundingClientRect()).width||t.height)&&(n.node.isBlock&&n.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(n.dom.nodeName)&&(!s&&t.left>r.left||t.top>r.top?o=n.posBefore:(!s&&t.right<r.left||t.bottom<r.top)&&(o=n.posAfter),s=!0),!n.contentDOM&&o<0&&!n.node.isText))return(n.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?n.posBefore:n.posAfter;i=n.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){let{node:r,offset:o}=gu(t,n),i=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,o,i)}(e,a,t));let l=e.docView.nearestDesc(a,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function wu(e){return e.top<e.bottom||e.left<e.right}function xu(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(wu(e))return e}return Array.prototype.find.call(n,wu)||e.getBoundingClientRect()}const ku=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Su(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=au||Qc;if(3==r.nodeType){if(!s||!ku.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let e=o,t=o,i=n<0?1:-1;return n<0&&!o?(t++,i=-1):n>=0&&o==r.nodeValue.length?(e--,i=1):n<0?e--:t++,Eu(xu(Ic(r,e,t),i),i<0)}{let e=xu(Ic(r,o,o),n);if(Qc&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=xu(Ic(r,o-1,o-1),-1);if(t.top==e.top){let n=xu(Ic(r,o,o+1),-1);if(n.top!=e.top)return Eu(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==Fc(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Mu(e.getBoundingClientRect(),!1)}if(null==i&&o<Fc(r)){let e=r.childNodes[o];if(1==e.nodeType)return Mu(e.getBoundingClientRect(),!0)}return Mu(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==Fc(r))){let e=r.childNodes[o-1],t=3==e.nodeType?Ic(e,Fc(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Eu(xu(t,1),!1)}if(null==i&&o<Fc(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?Ic(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Eu(xu(t,-1),!0)}return Eu(xu(3==r.nodeType?Ic(r):r,-n),n>=0)}function Eu(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Mu(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Cu(e,t,n){let r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}const Ru=/[\u0590-\u08ac]/;let Ou=null,Tu=null,_u=!1;function Nu(e,t,n){return Ou==t&&Tu==n?_u:(Ou=t,Tu=n,_u="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Cu(e,t,()=>{let{node:t}=e.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Su(e,o.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=Ic(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let o=t[e];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(e,t,n):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?Ru.test(r.parent.textContent)&&a.modify?Cu(e,t,()=>{let{focusNode:t,focusOffset:o,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),h=u&&!c.contains(1==u.nodeType?u:u.parentNode)||t==u&&o==d;try{a.collapse(i,s),t&&(t!=i||o!=s)&&a.extend&&a.extend(t,o)}catch(p){}return null!=l&&(a.caretBidiLevel=l),h}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class Au{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Dc(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let o=0;n<this.children.length;n++){let t=this.children[n],i=o+t.size;if(i>e||t instanceof Pu){r=e-o;break}o=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Du&&o.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Dc(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Dc(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,s=0;;s++){let n=this.children[s],a=i+n.size;if(-1==r&&e<=a){let o=i+n.border;if(e>=o&&t<=a-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,o);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Dc(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(a>t||s==this.children.length-1)){t=a;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=Dc(n.dom);break}t+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=a}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let o=Math.min(e,t),i=Math.max(e,t);for(let p=0,f=0;p<this.children.length;p++){let s=this.children[p],a=f+s.size;if(o>f&&i<a)return s.setSelection(e-f-s.border,t-f-s.border,n,r);f=a}let s=this.domFromPos(e,e?-1:1),a=t==e?s:this.domFromPos(t,t?-1:1),l=n.root.getSelection(),c=n.domSelectionRange(),u=!1;if((Qc||nu)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(u=!(!t||"\n"!=e.nodeValue[t-1]),u&&t==e.nodeValue.length)for(let n,r=e;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(s=a={node:n.parentNode,offset:Dc(n)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Qc&&c.focusNode&&c.focusNode!=a.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||u&&nu)&&jc(s.node,s.offset,c.anchorNode,c.anchorOffset)&&jc(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==t)&&(!u||!Qc)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(h){}}if(!d){if(e>t){let e=s;s=a,a=e}let n=document.createRange();n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),l.removeAllRanges(),l.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let r=n+o.border,s=i-o.border;if(e>=r&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=r||t!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-r,t-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Du extends Au{constructor(e,t,n,r){let o,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,o=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class $u extends Au{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Lu extends Au{constructor(e,t,n,r,o){super(e,[],n,r),this.mark=t,this.spec=o}static create(e,t,n,r){let o=r.nodeViews[t.type.name],i=o&&o(t,r,n);return i&&i.dom||(i=Va.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Lu(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=Lu.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Qu(o,t,i,n)),e>0&&(o=Qu(o,0,e,n));for(let s=0;s<o.length;s++)o[s].parent=r;return r.children=o,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Iu extends Au{constructor(e,t,n,r,o,i,s,a,l){super(e,[],o,i),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,o,i){let s,a=o.nodeViews[t.type.name],l=a&&a(t,o,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i,n,r),c=l&&l.dom,u=l&&l.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Va.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:u}=e)}u||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let d=c;return c=Yu(c,n,t),l?s=new Fu(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new zu(e,t,n,r,c,d,o):new Iu(e,t,n,r,c,u||null,d,o,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Hs.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ju(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,r=t,o=e.composing?this.localCompositionInfo(e,t):null,i=o&&o.pos>-1?o:null,s=o&&o.pos<0,a=new Gu(this,i&&i.node,e);!function(e,t,n,r){let o=t.locals(e),i=0;if(0==o.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,o,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d,h,p;for(;s<o.length&&o[s].to==i;){let e=o[s++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(Zu);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)p=-1,h=l,l=null;else{if(!(c<e.childCount))break;p=c,h=e.child(c++)}for(let e=0;e<a.length;e++)a[e].to<=i&&a.splice(e--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+h.nodeSize;if(h.isText){let e=f;s<o.length&&o[s].from<e&&(e=o[s].from);for(let t=0;t<a.length;t++)a[t].to<e&&(e=a[t].to);e<f&&(l=h.cut(e-i),h=h.cut(0,e-i),f=e,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(h,h.isInline&&!h.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,h),p),i=f}}(this.node,this.innerDeco,(t,o,i)=>{t.spec.marks?a.syncToMarks(t.spec.marks,n,e,o):t.type.side>=0&&!i&&a.syncToMarks(o==this.node.childCount?Ws.none:this.node.child(o).marks,n,e,o),a.placeWidget(t,e,r)},(t,i,l,c)=>{let u;a.syncToMarks(t.marks,n,e,c),a.findNodeMatch(t,i,l,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(t,i,l,u,e)||a.updateNextNode(t,i,l,e,c,r)||a.addNode(t,i,l,e,r),r+=t.nodeSize}),a.syncToMarks([],n,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),Bu(this.contentDOM,this.children,e),ru&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Ul)||n<t||r>t+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let e=o.nodeValue,i=function(e,t,n,r){for(let o=0,i=0;o<e.childCount&&i<=r;){let s=e.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<e.childCount;){let t=e.child(o++);if(i+=t.nodeSize,!t.isText)break;l+=t.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let e=a<r?l.lastIndexOf(t,r-a-1):-1;if(e>=0&&e+t.length+a>=n)return a+e;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}(this.node.content,e,n-t,r-t);return i<0?null:{node:o,pos:i,text:e}}return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let o=t;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new $u(this,o,t,r);e.input.compositionNodes.push(i),this.children=Qu(this.children,n,n+r.length,e,i)}update(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Ju(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=qu(this.dom,this.nodeDOM,Uu(this.outerDeco,this.node,t),Uu(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ju(e,t,n,r,o){Yu(r,t,e);let i=new Iu(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class zu extends Iu{constructor(e,t,n,r,o,i,s){super(e,t,n,r,o,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),o=document.createTextNode(r.text);return new zu(this.parent,r,this.outerDeco,this.innerDeco,o,o,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Pu extends Au{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Fu extends Iu{constructor(e,t,n,r,o,i,s,a,l,c){super(e,t,n,r,o,i,s,l,c),this.spec=a}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,t,n);return o&&this.updateInner(e,t,n,r),o}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Bu(e,t,n){let r=e.firstChild,o=!1;for(let i=0;i<t.length;i++){let s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=Ku(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof Lu){let t=r?r.previousSibling:e.lastChild;Bu(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Ku(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const Hu=function(e){e&&(this.nodeName=e)};Hu.prototype=Object.create(null);const Vu=[new Hu];function Uu(e,t,n){if(0==e.length)return Vu;let r=n?Vu[0]:new Hu,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new Hu(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new Hu(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+i:"style"==e?r.style=(r.style?r.style+";":"")+i:"nodeName"!=e&&(r[e]=i))}}}return o}function qu(e,t,n,r){if(n==Vu&&r==Vu)return t;let o=t;for(let i=0;i<r.length;i++){let t=r[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&o!=e&&(n=o.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(o),s=Vu[0]),o=n}Wu(o,s||Vu[0],t)}return o}function Wu(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.add(o[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function Yu(e,t,n){return qu(e,e,Vu,Uu(t,n,1!=e.nodeType))}function Ju(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Ku(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Gu{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let e=n.children[r-1];if(!(e instanceof Lu)){a=e,r--;break}n=e,r=e.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[i])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=Lu.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(e,t,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){let r=this.top.children[s];if(r.matchesNode(e,t,n)&&!this.preMatch.matched.has(r)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof Iu){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,u=a.dom,d=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Ju(t,a.outerDeco));if(!d&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!d&&(c=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,o,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ju(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=Iu.create(this.top,t,n,r,o,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,r,o){let i=Iu.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Du(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Lu;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof zu)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((nu||eu)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Pu(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Zu(e,t){return e.type.side-t.type.side}function Qu(e,t,n,r,o){let i=[];for(let s=0,a=0;s<e.length;s++){let l=e[s],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Xu(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(Hc(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&Wl.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==Fc(e);r||o;){if(e==n)return!0;let t=Dc(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==Fc(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new Wl(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!l){l=ld(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function ed(e){return e.editable?e.hasFocus():ud(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function td(e,t=!1){let n=e.state.selection;if(sd(e,n),ed(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&eu){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&jc(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Dc(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&Gc&&Zc<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!nd||n instanceof Ul||(n.$from.parent.inlineContent||(r=rd(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=rd(e,n.to))),e.docView.setSelection(i,s,e,t),nd&&(r&&id(r),o&&id(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{ed(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const nd=nu||eu&&tu<63;function rd(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(nu&&o&&"false"==o.contentEditable)return od(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return od(o);if(i)return od(i)}}function od(e){return e.contentEditable="true",nu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function id(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function sd(e,t){if(t instanceof Wl){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(ad(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else ad(e)}function ad(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ld(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||Ul.between(t,n,r)}function cd(e){return!(e.editable&&!e.hasFocus())&&ud(e)}function ud(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(n){return!1}}function dd(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&Fl.findFrom(i,t)}function hd(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function pd(e,t,n){let r=e.state.selection;if(!(r instanceof Ul)){if(r instanceof Wl&&r.node.isInline)return hd(e,new Ul(t>0?r.$to:r.$from));{let n=dd(e.state,t);return!!n&&hd(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return hd(e,new Ul(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=dd(e.state,t);return!!(n&&n instanceof Wl)&&hd(e,n)}if(!(ou&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Wl.isSelectable(i)?hd(e,new Wl(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!au&&hd(e,new Ul(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function fd(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function md(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function gd(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;Qc&&1==n.nodeType&&r<fd(n)&&md(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(md(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(yd(n))break;{let t=n.previousSibling;for(;t&&md(t,-1);)o=n.parentNode,i=Dc(t),t=t.previousSibling;if(t)n=t,r=fd(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?bd(e,n,r):o&&bd(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=fd(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!md(n.childNodes[r],1))break;o=n,i=++r}else{if(yd(n))break;{let t=n.nextSibling;for(;t&&md(t,1);)o=t.parentNode,i=Dc(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=fd(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&bd(e,o,i)}(e)}function yd(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function bd(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!Bc(e);)t=Dc(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!Bc(e);)t=Dc(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Hc(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&td(e)},50)}function vd(e,t){let n=e.state.doc.resolve(t);if(!eu&&!iu&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function wd(e,t,n){let r=e.state.selection;if(r instanceof Ul&&!r.empty||n.indexOf("s")>-1)return!1;if(ou&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=dd(e.state,t);if(n&&n instanceof Wl)return hd(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof Jl?Fl.near(n,t):Fl.findFrom(n,t);return!!s&&hd(e,s)}return!1}function xd(e,t){if(!(e.state.selection instanceof Ul))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function kd(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Sd(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||ou&&72==n&&"c"==r)return xd(e,-1)||gd(e,-1);if(46==n&&!t.shiftKey||ou&&68==n&&"c"==r)return xd(e,1)||gd(e,1);if(13==n||27==n)return!0;if(37==n||ou&&66==n&&"c"==r){let t=37==n?"ltr"==vd(e,e.state.selection.from)?-1:1:-1;return pd(e,t,r)||gd(e,t)}if(39==n||ou&&70==n&&"c"==r){let t=39==n?"ltr"==vd(e,e.state.selection.from)?1:-1:1;return pd(e,t,r)||gd(e,t)}return 38==n||ou&&80==n&&"c"==r?wd(e,-1,r)||gd(e,-1):40==n||ou&&78==n&&"c"==r?function(e){if(!nu||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;kd(e,n,"true"),setTimeout(()=>kd(e,n,"false"),20)}return!1}(e)||wd(e,1,r)||gd(e,1):r==(ou?"m":"c")&&(66==n||73==n||89==n||90==n)}function Ed(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||Va.fromSchema(e.state.schema),a=$d(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=Ad[u.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),d++}u=l.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Md(e,t,n,r,o){let i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",n=>{t=n(t,a||r,e)}),a)return s=new Js(Hs.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=Va.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=$d().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&Ad[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join(""));if(r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Ld||(Ld=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Ld.createHTML(e)}(e),n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),au&&function(e){let t=e.querySelectorAll(eu?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Da.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Cd.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(u)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(a){return e}let{content:o,openStart:i,openEnd:s}=e;for(let l=n.length-2;l>=0;l-=2){let e=r.nodes[n[l]];if(!e||e.hasRequiredAttrs())break;o=Hs.from(e.create(n[l+1],o)),i++,s++}return new Js(o,i,s)}(Nd(s,+u[1],+u[2]),u[4]);else if(s=Js.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&Od(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Td(i[i.length-1],r.length));let t=Rd(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return Hs.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let n=s.content.firstChild;e<s.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=s.content.lastChild;t<s.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);s=Nd(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Cd=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Rd(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Hs.from(e));return e}function Od(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Od(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(Hs.from(Rd(n,e,o+1))))}}function Td(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Td(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Hs.empty,!0);return e.copy(n.append(r))}function _d(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=_d(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(Hs.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function Nd(e,t,n){return t<e.openStart&&(e=new Js(_d(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Js(_d(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Ad={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Dd=null;function $d(){return Dd||(Dd=document.implementation.createHTMLDocument("title"))}let Ld=null;const Id={},jd={},zd={touchstart:!0,touchmove:!0};class Pd{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Fd(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Bd(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Hd(e,t))})}function Hd(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Vd(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Ud(e){return{left:e.clientX,top:e.clientY}}function qd(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),o,!0):t(e,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Wd(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function Yd(e,t,n,r,o){return qd(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof Wl&&(n=o.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let e=s>i.depth?i.nodeAfter:i.node(s);if(Wl.isSelectable(e)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Wd(e,Wl.create(e.state.doc,r)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Wl.isSelectable(r))&&(Wd(e,new Wl(n)),!0)}(e,n))}function Jd(e,t,n,r){return qd(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function Kd(e,t,n,r){return qd(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Wd(e,Ul.create(r,0,r.content.size)),!0);let o=r.resolve(t);for(let i=o.depth+1;i>0;i--){let t=i>o.depth?o.nodeAfter:o.node(i),n=o.before(i);if(t.inlineContent)Wd(e,Ul.create(r,n+1,n+1+t.content.size));else{if(!Wl.isSelectable(t))continue;Wd(e,Wl.create(r,n))}return!0}}(e,n,r)}function Gd(e){return oh(e)}jd.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Xd(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!su||!eu||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!ru||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||Sd(e,n)?n.preventDefault():Fd(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Vc(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},jd.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},jd.keypress=(e,t)=>{let n=t;if(Xd(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||ou&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof Ul&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const Zd=ou?"metaKey":"ctrlKey";Id.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Gd(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Zd]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(Ud(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Qd(e,s,n,!!r)):("doubleClick"==i?Jd:Kd)(e,s.pos,s.inside,n)?n.preventDefault():Fd(e,"pointer"))};class Qd{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Zd],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof Wl&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Qc||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Fd(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>td(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ud(e))),this.updateAllowDefault(e),this.allowDefault||!t?Fd(this.view,"pointer"):Yd(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||nu&&this.mightDrag&&!this.mightDrag.node.isAtom||eu&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Wd(this.view,Fl.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Fd(this.view,"pointer")}move(e){this.updateAllowDefault(e),Fd(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Xd(e,t){return!!e.composing||!!(nu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}Id.touchstart=e=>{e.input.lastTouch=Date.now(),Gd(e),Fd(e,"pointer")},Id.touchmove=e=>{e.input.lastTouch=Date.now(),Fd(e,"pointer")},Id.contextmenu=e=>Gd(e);const eh=su?5e3:-1;function th(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>oh(e),t))}function nh(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function rh(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Fc(e=e.childNodes[t-1])}else{if(!e.parentNode||Bc(e))return null;t=Dc(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Bc(e))return null;t=Dc(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function oh(e,t=!1){if(!(su&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),nh(e),t||e.docView&&e.docView.dirty){let n=Xu(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}jd.compositionstart=jd.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ul&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||eu&&iu&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),oh(e,!0),e.markCursor=null;else if(oh(e,!t.selection.empty),Qc&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}th(e,eh)},jd.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,th(e,20))};const ih=Gc&&Zc<15||ru&&lu<604;function sh(e,t,n,r,o){let i=Md(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||Js.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ah(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Id.copy=jd.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=ih?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ed(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},jd.paste=(e,t)=>{let n=t;if(e.composing&&!su)return;let r=ih?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&sh(e,ah(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?sh(e,r.value,null,o,t):sh(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class lh{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const ch=ou?"altKey":"ctrlKey";function uh(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[ch]}Id.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Ud(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Wl?i.to-1:i.to));else if(r&&r.mightDrag)o=Wl.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Wl.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Ed(e,a);(!n.dataTransfer.files.length||!eu||tu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ih?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ih||n.dataTransfer.setData("text/plain",c),e.dragging=new lh(u,uh(e,n),o)},Id.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},jd.dragover=jd.dragenter=(e,t)=>t.preventDefault(),jd.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ud(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Md(e,ah(t.dataTransfer),ih?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!uh(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||Js.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?Sl(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,d=l.doc;u?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i);if(l.doc.eq(d))return;let h=l.doc.resolve(c);if(u&&Wl.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Wl(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(ld(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},Id.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&td(e)},20))},Id.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},Id.beforeinput=(e,t)=>{if(eu&&su&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Vc(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let os in jd)Id[os]=jd[os];function dh(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class hh{constructor(e,t){this.toDOM=e,this.spec=t||yh,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new mh(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof hh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&dh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ph{constructor(e,t){this.attrs=e,this.spec=t||yh}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new mh(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ph&&dh(this.attrs,e.attrs)&&dh(this.spec,e.spec)}static is(e){return e.type instanceof ph}destroy(){}}class fh{constructor(e,t){this.attrs=e,this.spec=t||yh}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new mh(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof fh&&dh(this.attrs,e.attrs)&&dh(this.spec,e.spec)}destroy(){}}class mh{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new mh(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new mh(e,e,new hh(t,n))}static inline(e,t,n,r){return new mh(e,t,new ph(n,r))}static node(e,t,n,r){return new mh(e,t,new fh(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof ph}get widget(){return this.type instanceof hh}}const gh=[],yh={};class bh{constructor(e,t){this.local=e.length?e:gh,this.children=t.length?t:gh}static create(e,t){return t.length?Eh(t,e,0,yh):vh}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==vh||0==e.maps.length?this:this.mapInner(e,t,0,0,n||yh)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach((t,n,r,o)=>{let i=o-r-(n-t);for(let s=0;s<a.length;s+=3){let r=a[s+1];if(r<0||t>r+u-e)continue;let o=a[s]+u-e;n>=o?a[s+1]=t<=o?-2:-1:t>=u&&i&&(a[s]+=i,a[s+1]+=i)}e+=i}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(-2==a[c+1]){l=!0,a[c+1]=-1;continue}let t=n.map(e[c]+i),u=t-o;if(u<0||u>=r.content.size){l=!0;continue}let d=n.map(e[c+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(u),f=r.maybeChild(h);if(f&&p==u&&p+f.nodeSize==d){let r=a[c+2].mapInner(n,f,t+1,e[c]+i+1,s);r!=vh?(a[c]=u,a[c+1]=d,a[c+2]=r):(a[c+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t,n,o,i,s),c=Eh(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new bh(t.sort(Mh),a)}(this.children,i||[],e,t,n,r,o):i?new bh(i.sort(Mh),gh):vh}add(e,t){return t.length?this==vh?bh.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=kh(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Eh(s,e,a+1,yh)),o+=3}});let i=xh(o?Sh(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new bh(i.length?this.local.concat(i).sort(Mh):this.local,r||this.children)}remove(e){return 0==e.length||this==vh?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let o=0;o<n.length;o+=3){let r,i=n[o]+t,s=n[o+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(r||(r=[])).push(t));if(!r)continue;n==this.children&&(n=this.children.slice());let a=n[o+2].removeInner(r,i+1);a!=vh?n[o+2]=a:(n.splice(o,3),o-=3)}if(r.length)for(let o,i=0;i<e.length;i++)if(o=e[i])for(let e=0;e<r.length;e++)r[e].eq(o,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new bh(r,n):vh}forChild(e,t){if(this==vh)return this;if(t.isLeaf)return bh.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let o=e+1,i=o+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>o&&e.type instanceof ph){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let e=new bh(r.sort(Mh),gh);return n?new wh([e,n]):e}return n||vh}eq(e){if(this==e)return!0;if(!(e instanceof bh)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ch(this.localsInner(e))}localsInner(e){if(this==vh)return gh;if(e.inlineContent||!this.local.some(ph.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof ph||t.push(this.local[n]);return t}forEachSet(e){e(this)}}bh.empty=new bh([],[]),bh.removeOverlap=Ch;const vh=bh.empty;class wh{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,yh));return wh.from(n)}forChild(e,t){if(t.isLeaf)return bh.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=vh&&(o instanceof wh?n=n.concat(o.members):n.push(o))}return wh.from(n)}eq(e){if(!(e instanceof wh)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?Ch(n?t:t.sort(Mh)):gh}static from(e){switch(e.length){case 0:return vh;case 1:return e[0];default:return new wh(e.every(e=>e instanceof bh)?e:e.reduce((e,t)=>e.concat(t instanceof bh?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function xh(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new mh(o.from+t,o.to+t,o.type))}return n}function kh(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<r&&((o||(o=[])).push(i),e[s]=null);return o}function Sh(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Eh(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=kh(e,t,s+n);if(a){i=!0;let e=Eh(a,t,n+s+1,r);e!=vh&&o.push(s,s+t.nodeSize,e)}});let s=xh(i?Sh(e):e,-n).sort(Mh);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new bh(s,o):vh}function Mh(e,t){return e.from-t.from||e.to-t.to}function Ch(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Rh(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Rh(t,o+1,i.copy(r.to,i.to)))}}return t}function Rh(e,t,n){for(;t<e.length&&Mh(n,e[t])>0;)t++;e.splice(t,0,n)}function Oh(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=vh&&t.push(r)}),e.cursorWrapper&&t.push(bh.create(e.state.doc,[e.cursorWrapper.deco])),wh.from(t)}const Th={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},_h=Gc&&Zc<=11;class Nh{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Ah{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Nh,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Gc&&Zc<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():nu&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),_h&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Th)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(cd(this.view)){if(this.suppressingSelectionUpdates)return td(this.view);if(Gc&&Zc<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&jc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let o=e.focusNode;o;o=$c(o))n.add(o);for(let o=e.anchorNode;o;o=$c(o))if(n.has(o)){t=o;break}let r=t&&this.view.docView.nearestDesc(t);return r&&r.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&cd(e)&&!this.ignoreSelectionChange(n),o=-1,i=-1,s=!1,a=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],a);e&&(o=o<0?e.from:Math.min(e.from,o),i=i<0?e.to:Math.max(e.to,i),e.typeOver&&(s=!0))}if(!a.some(e=>"BR"==e.nodeName)||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(Qc&&a.length){let t=a.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;!t||"LI"!=t.nodeName||n&&Ih(e,n)==t||r.remove()}}}}else for(let c of a)if("BR"==c.nodeName&&c.parentNode){let e=c.nextSibling;e&&1==e.nodeType&&"false"==e.contentEditable&&c.parentNode.removeChild(c)}let l=null;o<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Hc(n)&&(l=Xu(e))&&l.eq(Fl.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,td(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(Dh.has(e))return;if(Dh.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Qc,$h)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),$h=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:o}=e.domSelectionRange();for(let i of t)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let t=i.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(i,n.firstChild),r==i&&e.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(e,a)),this.handleDOMChange(o,i,s,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||td(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,o=e.nextSibling;if(Gc&&Zc<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==e.target?Dc(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?Dc(o):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,a,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Dh=new WeakMap,$h=!1;function Lh(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return jc(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function Ih(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function jh(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(nu&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||nu&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const zh=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ph(e,t,n,r,o){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Xu(e,t);if(n&&!e.state.selection.eq(n)){if(eu&&su&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Vc(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),i&&r.setMeta("composition",i),e.dispatch(r)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(n);t=s.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l,c,u=e.state.selection,d=function(e,t,n){let r,{node:o,fromOffset:i,toOffset:s,from:a,to:l}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u=c.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:c.anchorOffset}],Hc(c)||r.push({node:c.focusNode,offset:c.focusOffset})),eu&&8===e.input.lastKeyCode)for(let g=s;g>i;g--){let e=o.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){s=g;break}if(!t||t.size)break}let d=e.state.doc,h=e.someProp("domParser")||Da.fromSchema(e.state.schema),p=d.resolve(a),f=null,m=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:r,ruleFromNode:jh,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),f={anchor:e+a,head:t+a}}return{doc:m,sel:f,from:a,to:l}}(e,t,n),h=e.state.doc,p=h.slice(d.from,d.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,r,o){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==o){r-=s+Math.max(0,i-Math.min(s,a))-i}if(s<i&&e.size<t.size){let e=r<=i&&r>=s?i-r:0;i-=e,i&&i<t.size&&Hh(t.textBetween(i-1,i+1))&&(i+=e?1:-1),a=i+(a-s),s=i}else if(a<i){let t=r<=i&&r>=a?i-r:0;i-=t,i&&i<e.size&&Hh(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(p.content,d.doc.content,d.from,l,c);if(f&&e.input.domChangeCount++,(ru&&e.input.lastIOSEnter>Date.now()-225||su)&&o.some(e=>1==e.nodeType&&!zh.test(e.nodeName))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",t=>t(e,Vc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!f){if(!(r&&u instanceof Ul&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=Fh(e,e.state.doc,d.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Ul&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),Gc&&Zc<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>d.from&&" "==d.doc.textBetween(f.start-d.from-1,f.start-d.from+1)&&(f.start--,f.endA--,f.endB--);let m=d.doc.resolveNoCache(f.start-d.from),g=d.doc.resolveNoCache(f.endB-d.from),y=h.resolve(f.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=f.endA;if((ru&&e.input.lastIOSEnter>Date.now()-225&&(!b||o.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&m.pos<d.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(d.doc.textBetween(m.pos,g.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Vc(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Bh(r,!0,!1)<o.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(Bh(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Bh(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(h,f.start,f.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,Vc(8,"Backspace"))))return void(su&&eu&&e.domObserver.suppressSelectionUpdates());eu&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),su&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==f.endA&&(f.endB-=2,g=d.doc.resolveNoCache(f.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Vc(13,"Enter"))})},20));let v,w=f.start,x=f.endA,k=t=>{let n=t||e.state.tr.replace(w,x,d.doc.slice(f.start-d.from,f.endB-d.from));if(d.sel){let t=Fh(e,n.doc,d.sel);t&&!(eu&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(x)-1)||Gc&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){Gc&&Zc<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>td(e),20));let t=k(e.state.tr.delete(w,x)),n=h.resolve(f.start).marksAcross(h.resolve(f.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(f.endA==f.endB&&(v=function(e,t){let n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s;for(let u=0;u<s.length;u++)a=s[u].removeFromSet(a);for(let u=0;u<i.length;u++)l=i[u].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=e=>e.mark(r.addToSet(e.marks));else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=e=>e.mark(r.removeFromSet(e.marks))}let c=[];for(let u=0;u<t.childCount;u++)c.push(o(t.child(u)));if(Hs.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,f.endA-y.start())))){let t=k(e.state.tr);"add"==v.type?t.addMark(w,x,v.mark):t.removeMark(w,x,v.mark),e.dispatch(t)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let t=m.parent.textBetween(m.parentOffset,g.parentOffset),n=()=>k(e.state.tr.insertText(t,w,x));e.someProp("handleTextInput",r=>r(e,w,x,t,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())}function Fh(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:ld(e,t.resolve(n.anchor),t.resolve(n.head))}function Bh(e,t,n){let r=e.depth,o=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,o++}return o}function Hh(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class Vh{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Pd,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Jh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Wh(this),qh(this),this.nodeViews=Yh(this),this.docView=ju(this.state.doc,Uh(this),Oh(this),this.dom,this),this.domObserver=new Ah(this,(e,t,n,r)=>Ph(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in Id){let n=Id[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!Vd(e,t)||Hd(e,t)||!e.editable&&t.type in jd||n(e,t)},zd[t]?{passive:!0}:void 0)}nu&&e.dom.addEventListener("input",()=>null),Bd(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Bd(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Jh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(nh(this),i=!0),this.state=e;let s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=Yh(this);(function(e,t){let n=0,r=0;for(let o in e){if(e[o]!=t[o])return!0;n++}for(let o in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&Bd(this),this.editable=Wh(this),qh(this);let a=Oh(this),l=Uh(this),c=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,l,a);!u&&e.selection.eq(r.selection)||(i=!0);let d="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(i,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){t=r,n=a.top;break}}return{refDOM:t,refTop:n,stack:pu(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(Gc||eu)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(r.selection,e.selection);if(u){let n=eu?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=rh(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=ju(e.doc,l,a,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return jc(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?td(this,t):(sd(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():d&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;fu(n,0==r?0:r-t)}(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof Wl){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&hu(this,t.getBoundingClientRect(),e)}else hu(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new lh(e.slice,e.move,r<0?void 0:Wl.create(this.state.doc,r))}someProp(e,t){let n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(let i=0;i<this.directPlugins.length;i++){let r=this.directPlugins[i].props[e];if(null!=r&&(n=t?t(r):r))return n}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let r=o[i].props[e];if(null!=r&&(n=t?t(r):r))return n}}hasFocus(){if(Gc){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(mu)return e.focus(mu);let t=pu(e);e.focus(null==mu?{get preventScroll(){return mu={preventScroll:!0},!0}}:void 0),mu||(mu=!1,fu(t,0))}(this.dom),td(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return vu(this,e)}coordsAtPos(e,t=1){return Su(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return Nu(this,t||this.state,e)}pasteHTML(e,t){return sh(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return sh(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ed(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Oh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Lc=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){Hd(e,t)||!Id[t.type]||!e.editable&&t.type in jd||Id[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?nu&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Lh(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Lh(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Uh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[mh.node(0,e.state.doc.content.size,t)]}function qh(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:mh.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Wh(e){return!e.someProp("editable",t=>!1===t(e.state))}function Yh(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Jh(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Vh.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Kh={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:"'"},Gh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Zh="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Qh="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Xh=0;Xh<10;Xh++)Kh[48+Xh]=Kh[96+Xh]=String(Xh);for(Xh=1;Xh<=24;Xh++)Kh[Xh+111]="F"+Xh;for(Xh=65;Xh<=90;Xh++)Kh[Xh]=String.fromCharCode(Xh+32),Gh[Xh]=String.fromCharCode(Xh);for(var ep in Kh)Gh.hasOwnProperty(ep)||(Gh[ep]=Kh[ep]);const tp="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),np="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function rp(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let a=0;a<i.length-1;a++){let e=i[a];if(/^(cmd|meta|m)$/i.test(e))o=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);tp?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function op(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ip(e){let t=function(e){let t=Object.create(null);for(let n in e)t[rp(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(Zh&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Qh&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Gh:Kh)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[op(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[op(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(np&&n.ctrlKey&&n.altKey)&&(r=Kh[n.keyCode])&&r!=o){let o=t[op(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var sp=Object.defineProperty,ap=(e,t)=>{for(var n in t)sp(e,n,{get:t[n],enumerable:!0})};function lp(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var cp=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:lp({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},up={};ap(up,{blur:()=>dp,clearContent:()=>hp,clearNodes:()=>pp,command:()=>fp,createParagraphNear:()=>mp,cut:()=>gp,deleteCurrentNode:()=>yp,deleteNode:()=>vp,deleteRange:()=>wp,deleteSelection:()=>xp,enter:()=>kp,exitCode:()=>Sp,extendMarkRange:()=>_p,first:()=>Np,focus:()=>jp,forEach:()=>zp,insertContent:()=>Pp,insertContentAt:()=>Vp,joinBackward:()=>Wp,joinDown:()=>qp,joinForward:()=>Yp,joinItemBackward:()=>Jp,joinItemForward:()=>Kp,joinTextblockBackward:()=>Gp,joinTextblockForward:()=>Zp,joinUp:()=>Up,keyboardShortcut:()=>Xp,lift:()=>tf,liftEmptyBlock:()=>nf,liftListItem:()=>rf,newlineInCode:()=>of,resetAttributes:()=>lf,scrollIntoView:()=>cf,selectAll:()=>uf,selectNodeBackward:()=>df,selectNodeForward:()=>hf,selectParentNode:()=>pf,selectTextblockEnd:()=>ff,selectTextblockStart:()=>mf,setContent:()=>yf,setMark:()=>Qf,setMeta:()=>Xf,setNode:()=>em,setNodeSelection:()=>tm,setTextDirection:()=>nm,setTextSelection:()=>rm,sinkListItem:()=>om,splitBlock:()=>sm,splitListItem:()=>am,toggleList:()=>um,toggleMark:()=>dm,toggleNode:()=>hm,toggleWrap:()=>pm,undoInputRule:()=>fm,unsetAllMarks:()=>mm,unsetMark:()=>gm,unsetTextDirection:()=>ym,updateAttributes:()=>bm,wrapIn:()=>vm,wrapInList:()=>wm});var dp=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),hp=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),pp=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=fl(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},fp=e=>t=>e(t),mp=()=>({state:e,dispatch:t})=>kc(e,t),gp=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new Ul(r.doc.resolve(Math.max(s-1,0)))),!0},yp=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let i=o.depth;i>0;i-=1){if(o.node(i).type===r.type){if(t){const t=o.before(i),n=o.after(i);e.delete(t,n).scrollIntoView()}return!0}}return!1};function bp(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var vp=e=>({tr:t,state:n,dispatch:r})=>{const o=bp(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},wp=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},xp=()=>({state:e,dispatch:t})=>cc(e,t),kp=()=>({commands:e})=>e.keyboardShortcut("Enter"),Sp=()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=xc(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(Fl.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t);function Ep(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Mp(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Ep(t[r])?t[r].test(e[r]):t[r]===e[r])}function Cp(e,t,n={}){return e.find(e=>e.type===t&&Mp(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Rp(e,t,n={}){return!!Cp(e,t,n)}function Op(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t))return;n=n||(null==(r=o.node.marks[0])?void 0:r.attrs);if(!Cp([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&Rp([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Rp([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Tp(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var _p=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Tp(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const e=Op(l,i,t);if(e&&e.from<=c&&e.to>=u){const t=Ul.create(s,e.from,e.to);n.setSelection(t)}}return!0},Np=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Ap(e){return e instanceof Ul}function Dp(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function $p(e,t=null){if(!t)return null;const n=Fl.atStart(e),r=Fl.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?Ul.create(e,Dp(0,o,i),Dp(e.content.size,o,i)):Ul.create(e,Dp(t,o,i),Dp(t,o,i))}function Lp(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function Ip(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var jp=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(Ip()||Lp())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||Ip()||Lp()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!Ap(n.state.selection))return s(),!0;const a=$p(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},zp=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Pp=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Fp=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Fp(r)}return e};function Bp(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Fp(n)}function Hp(e,t,n){if(e instanceof ha||e instanceof Hs)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Hs.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),Hp("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Na({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?Da.fromSchema(i).parseSlice(Bp(e),n.parseOptions):Da.fromSchema(i).parse(Bp(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Da.fromSchema(t);return n.slice?r.parseSlice(Bp(e),n.parseOptions).content:r.parse(Bp(e),n.parseOptions)}return Hp("",t,n)}var Vp=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Hp(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(a){l(a)}try{o=Hp(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(a){return l(a),!1}let{from:u,to:d}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),h=!!h&&(e.isText&&0===e.marks.length),p=!!p&&e.isBlock}),u===d&&p){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,d+=1)}let f;if(h){if(Array.isArray(t))f=t.map(e=>e.text||"").join("");else if(t instanceof Hs){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f="object"==typeof t&&t&&t.text?t.text:t;r.insertText(f,u,d)}else{f=o;const e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&(u=Math.max(0,u-1)),r.replaceWith(u,d,f)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof cl||o instanceof ul))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(Fl.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:f}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:f})}return!0},Up=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof Wl;if(o){if(r.node.isTextblock||!wl(e.doc,r.from))return!1;n=r.from}else if(n=kl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(Wl.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),qp=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof Wl){if(r.node.isTextblock||!wl(e.doc,r.to))return!1;n=r.to}else if(n=kl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Wp=()=>({state:e,dispatch:t})=>dc(e,t),Yp=()=>({state:e,dispatch:t})=>yc(e,t),Jp=()=>({state:e,dispatch:t,tr:n})=>{try{const r=kl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Kp=()=>({state:e,dispatch:t,tr:n})=>{try{const r=kl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Gp=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=uc(e,n);if(!r)return!1;let o=mc(r);return!!o&&hc(e,o,t)})(e,t),Zp=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=gc(e,n);if(!r)return!1;let o=vc(r);return!!o&&hc(e,o,t)})(e,t);function Qp(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Xp=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let a=0;a<t.length-1;a+=1){const e=t[a];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))n=!0;else if(/^(c|ctrl|control)$/i.test(e))r=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw new Error(`Unrecognized modifier name: ${e}`);Ip()||Qp()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function ef(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?bp(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>Mp(e.node.attrs,n,{strict:!1}));if(i)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=l}var tf=(e,t={})=>({state:n,dispatch:r})=>!!ef(n,bp(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&fl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),nf=()=>({state:e,dispatch:t})=>Sc(e,t),rf=e=>({state:t,dispatch:n})=>Ac(bp(e,t.schema))(t,n),of=()=>({state:e,dispatch:t})=>wc(e,t);function sf(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function af(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var lf=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=sf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=bp(e,r.schema)),"mark"===a&&(s=Tp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,af(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(af(i.attrs,t))))})})}),l},cf=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),uf=()=>({tr:e,dispatch:t})=>{if(t){const t=new Jl(e.doc);e.setSelection(t)}return!0},df=()=>({state:e,dispatch:t})=>fc(e,t),hf=()=>({state:e,dispatch:t})=>bc(e,t),pf=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(Wl.create(e.doc,n))),!0)})(e,t),ff=()=>({state:e,dispatch:t})=>Oc(e,t),mf=()=>({state:e,dispatch:t})=>Rc(e,t);function gf(e,t,n={},r={}){return Hp(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var yf=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=gf(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function bf(e,t){const n=Tp(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function vf(e,t){const n=new zl(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function wf(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}function xf(e,t,n){if(void 0===e.config[t]&&e.parent)return xf(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?xf(e.parent,t,n):null})}return e.config[t]}function kf(e){return e.map(e=>{const t=xf(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...kf(t())]:e}).flat(10)}function Sf(e,t){const n=Va.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Ef(e){return"function"==typeof e}function Mf(e,t=void 0,...n){return Ef(e)?t?e.bind(t)(...n):e(...n):e}function Cf(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Rf(e){const t=[],{nodeExtensions:n,markExtensions:r}=Cf(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=xf(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});if(!n)return;n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=xf(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function Of(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let o=0;o<r;o+=1){const e=n[o],r=e.indexOf(":");if(-1===r)continue;const i=e.slice(0,r).trim(),s=e.slice(r+1).trim();i&&s&&t.push([i,s])}return t}function Tf(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...Of(n[e]),...Of(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function _f(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Tf(e,t),{})}function Nf(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function Af(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Df(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function $f(e){return e.sort((e,t)=>{const n=xf(e,"priority")||100,r=xf(t,"priority")||100;return n>r?-1:n<r?1:0})}function Lf(e){const t=$f(kf(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function If(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,c)=>{var u;e.isBlock&&n>r&&(a+=i);const d=null==s?void 0:s[e.type.name];if(d)return l&&(a+=d({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(u=null==e?void 0:e.text)?void 0:u.slice(Math.max(r,n)-n,o-n))}),a}function jf(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function zf(e,t){const n=sf("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=bp(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?bf(e,t):{}}function Pf(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Ff(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),Pf(r)}function Bf(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Op(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function Hf(e,t){return t.nodes[e]||t.marks[e]||null}function Vf(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function Uf(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Tp(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Mp(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Mp(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function qf(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Wf(e,t){const{nodeExtensions:n}=Cf(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=Mf(xf(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Yf(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Yf(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Jf(e){return e instanceof Wl}var Kf=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Gf(e,t){const n=t.mapping.mapResult(e.position);return{position:new Kf(n.pos),mapResult:n}}function Zf(e){return new Kf(e)}var Qf=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Tp(e,r.schema);if(o)if(s){const e=bf(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(Ap(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},Xf=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),em=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=bp(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!Tc(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Tc(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},tm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Dp(e,0,n.content.size),o=Wl.create(n,r);t.setSelection(o)}return!0},nm=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},rm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=Ul.atStart(n).from,s=Ul.atEnd(n).to,a=Dp(r,i,s),l=Dp(o,i,s),c=Ul.create(n,a,l);t.setSelection(c)}return!0},om=e=>({state:t,dispatch:n})=>{const r=bp(e,t.schema);return(o=r,function(e,t){let{$from:n,$to:r}=e.selection,i=n.blockRange(r,e=>e.childCount>0&&e.firstChild.type==o);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=o)return!1;if(t){let n=l.lastChild&&l.lastChild.type==a.type,r=Hs.from(n?o.create():null),s=new Js(Hs.from(o.create(null,Hs.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new ul(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function im(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var sm=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Vf(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof Wl&&i.node.isBlock)return!(!a.parentOffset||!vl(s,a.pos))&&(r&&(e&&im(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,d=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=u&&d?[{type:d,attrs:c}]:void 0,p=vl(t.doc,t.mapping.map(a.pos),1,h);if(h||p||!vl(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)||(p=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(p&&(i instanceof Ul&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),d&&!u&&!a.parentOffset&&a.parent.type!==d)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,d)&&t.setNodeMarkup(t.mapping.map(a.before()),d)}e&&im(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},am=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=bp(e,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=Hs.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=Hs.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Vf(h,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(Hs.from(a.createAndFill(null,c)||void 0));const u=l.before(l.depth-(r-1));n.replace(u,l.after(-o),new Js(e,4-r,0));let d=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(d>-1)return!1;e.isTextblock&&0===e.content.size&&(d=t+1)}),d>-1&&n.setSelection(Ul.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,f={...Vf(h,d.type.name,d.attrs),...t},m={...Vf(h,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!vl(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},lm=(e,t)=>{const n=wf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!wl(e.doc,n.pos)||(e.join(n.pos),!0)},cm=(e,t)=>{const n=wf(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!wl(e.doc,r)||(e.join(r),!0)},um=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=o.extensionManager,p=bp(e,s.schema),f=bp(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:b}=m,v=y.blockRange(b),w=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const x=wf(e=>Wf(e.type.name,d))(m);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(f);if(Wf(x.node.type.name,d)&&p.validContent(x.node.content)&&a)return l().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>lm(i,p)).command(()=>cm(i,p)).run()}return n&&w&&a?l().command(()=>{const e=u().wrapInList(p,r),t=w.filter(e=>h.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>lm(i,p)).command(()=>cm(i,p)).run():l().command(()=>!!u().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>lm(i,p)).command(()=>cm(i,p)).run()},dm=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Tp(e,r.schema);return Uf(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},hm=(e,t,n={})=>({state:r,commands:o})=>{const i=bp(e,r.schema),s=bp(t,r.schema),a=ef(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},pm=(e,t={})=>({state:n,commands:r})=>{const o=bp(e,n.schema);return ef(n,o,t)?r.lift(o):r.wrapIn(o,t)},fm=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},mm=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},gm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Tp(e,r.schema),{$from:c,empty:u,ranges:d}=a;if(!o)return!0;if(u&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find(e=>e.type===l))?void 0:i.attrs,o=Op(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else d.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},ym=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},bm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=sf("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=bp(e,r.schema)),"mark"===a&&(s=Tp(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let u,d,h,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,h=Math.max(t,a),p=Math.min(t+e.nodeSize,c),u=t,d=e)}):r.doc.nodesBetween(a,c,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,h=Math.max(r,a),p=Math.min(r+e.nodeSize,c),u=r,d=e),r>=a&&r<=c&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),d&&(void 0!==u&&o&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&o&&n.addMark(h,p,s.create({...e.attrs,...t}))}))}),l},vm=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&ml(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(bp(e,n.schema),t)(n,r),wm=(e,t={})=>({state:n,dispatch:r})=>Nc(bp(e,n.schema),t)(n,r),xm=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},km=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Sm(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let u=!1;const d=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(u)return;const t=((e,t)=>{if(Ep(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(d,e.find);if(!t)return;const s=l.state.tr,c=lp({state:l.state,transaction:s}),h={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new cp({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),u=!0)}),u}function Em(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Mm(e,t){const n={...e};return Em(e)&&Em(t)&&Object.keys(t).forEach(r=>{Em(t[r])&&Em(e[r])?n[r]=Mm(e[r],t[r]):n[r]=t[r]}),n}var Cm=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Mf(xf(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Mf(xf(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Mm(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Rm=class e extends Cm{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};var Om=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Tm(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new cp({editor:t,state:n}),d=[];n.doc.nodesBetween(r,o,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,b=Math.max(r,t),v=Math.min(o,t+y);if(b>=v)return;((e,t,n)=>{if(Ep(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(b-t,v-t,void 0,""),i.find,s).forEach(e=>{if(void 0===e.index)return;const t=b+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(h)})});return d.every(e=>null!==e)}var _m=null;function Nm(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=lp({state:e,transaction:l});if(Tm({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new ic({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(_m=t)},r=()=>{_m&&(_m=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=_m;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,u="drop"===o.getMeta("uiEvent")&&!s,d=o.getMeta("applyPasteRules"),h=!!d;if(!c&&!u&&!h)return;if(h){let{text:t}=d;"string"==typeof t||(t=Sf(Hs.from(t),r.schema));const{from:n}=d,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}}))}var Am=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Lf(e),this.schema=function(e,t){var n;const r=Rf(e),{nodeExtensions:o,markExtensions:i}=Cf(e),s=null==(n=o.find(e=>xf(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Af({...e.reduce((e,t)=>{const r=xf(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:Mf(xf(n,"content",i)),marks:Mf(xf(n,"marks",i)),group:Mf(xf(n,"group",i)),inline:Mf(xf(n,"inline",i)),atom:Mf(xf(n,"atom",i)),selectable:Mf(xf(n,"selectable",i)),draggable:Mf(xf(n,"draggable",i)),code:Mf(xf(n,"code",i)),whitespace:Mf(xf(n,"whitespace",i)),linebreakReplacement:Mf(xf(n,"linebreakReplacement",i)),defining:Mf(xf(n,"defining",i)),isolating:Mf(xf(n,"isolating",i)),attrs:Object.fromEntries(o.map(Df))}),a=Mf(xf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Nf(e,o)));const l=xf(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:_f(e,o)}));const c=xf(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Af({...e.reduce((e,t)=>{const r=xf(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:Mf(xf(n,"inclusive",i)),excludes:Mf(xf(n,"excludes",i)),group:Mf(xf(n,"group",i)),spanning:Mf(xf(n,"spanning",i)),code:Mf(xf(n,"code",i)),attrs:Object.fromEntries(o.map(Df))}),a=Mf(xf(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Nf(e,o)));const l=xf(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:_f(e,o)})),[n.name,s]}));return new Na({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=xf(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Hf(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return $f([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Hf(t.name,this.schema)},r=[],o=xf(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&xf(t,"exitable",n)&&(i.ArrowRight=()=>Rm.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new ic({props:{handleKeyDown:ip(i)}});r.push(s);const a=xf(t,"addInputRules",n);if(qf(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new ic({state:{init:()=>null,apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=Sf(Hs.from(e),i.schema));const{from:o}=a,s=o+e.length;Sm({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Sm({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Sm({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Sm({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=xf(t,"addPasteRules",n);if(qf(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=Nm({editor:e,rules:t});r.push(...n)}}const c=xf(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return Rf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Cf(this.extensions);return Object.fromEntries(t.filter(e=>!!xf(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:bp(t.name,this.schema)},o=xf(t,"addNodeView",r);if(!o)return[];const i=o();if(!i)return[];return[t.name,(r,o,s,a,l)=>{const c=_f(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]}))}dispatchTransaction(e){const{editor:t}=this;return $f([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Hf(n.name,this.schema)},o=xf(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return $f([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Hf(n.name,this.schema)},o=xf(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=Cf(this.extensions);return Object.fromEntries(t.filter(e=>!!xf(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Tp(t.name,this.schema)},o=xf(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=_f(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hf(e.name,this.schema)};if("mark"===e.type){(null==(t=Mf(xf(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=xf(e,"onBeforeCreate",n),o=xf(e,"onCreate",n),i=xf(e,"onUpdate",n),s=xf(e,"onSelectionUpdate",n),a=xf(e,"onTransaction",n),l=xf(e,"onFocus",n),c=xf(e,"onBlur",n),u=xf(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};Am.resolve=Lf,Am.sort=$f,Am.flatten=kf;ap({},{ClipboardTextSerializer:()=>$m,Commands:()=>Lm,Delete:()=>Im,Drop:()=>jm,Editable:()=>zm,FocusEvents:()=>Fm,Keymap:()=>Bm,Paste:()=>Hm,Tabindex:()=>Vm,TextDirection:()=>Um,focusEventsPluginKey:()=>Pm});var Dm=class e extends Cm{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},$m=Dm.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new ic({key:new lc("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=jf(n);return If(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Lm=Dm.create({name:"commands",addCommands:()=>({...up})}),Im=Dm.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=vf(e.before,[e,...t]);Ff(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof sl){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),u=a.invert().map(l),d=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:u},newRange:{from:i,to:l},partial:Boolean(h||d),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),jm=Dm.create({name:"drop",addProseMirrorPlugins(){return[new ic({key:new lc("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),zm=Dm.create({name:"editable",addProseMirrorPlugins(){return[new ic({key:new lc("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Pm=new lc("focusEvents"),Fm=Dm.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new ic({key:Pm,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Bm=Dm.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,u=i.pos-i.parentOffset,d=c&&1===l.parent.childCount?u===i.pos:Fl.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!d||d&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ip()||Qp()?o:r},addProseMirrorPlugins(){return[new ic({key:new lc("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Fl.atStart(t.doc).from,c=Fl.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!Yf(n.doc))return;const u=n.tr,d=lp({state:n,transaction:u}),{commands:h}=new cp({editor:this.editor,state:d});return h.clearNodes(),u.steps.length?u:void 0}})]}}),Hm=Dm.create({name:"paste",addProseMirrorPlugins(){return[new ic({key:new lc("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Vm=Dm.create({name:"tabindex",addProseMirrorPlugins(){return[new ic({key:new lc("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Um=Dm.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Cf(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ic({key:new lc("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),qm=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new e(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{if(!(n&&r.length>0)){if(i.node.type.name===e){o.every(e=>t[e]===i.node.attrs[e])&&r.push(i)}n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n)))}}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};var Wm=class extends xm{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Gf,createMappablePosition:Zf},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=$p(t,this.options.autofocus);this.editorState=rc.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Ef(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[zm,$m.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),Lm,Fm,Bm,Vm,jm,Hm,Im,Um.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Am(n,this)}createCommandManager(){this.commandManager=new cp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=gf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=gf(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Vh(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return zf(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return ef(e,null,n)||Uf(e,null,n);const r=sf(t,e.schema);return"node"===r?ef(e,t,n):"mark"===r&&Uf(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Sf(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return If(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...jf(this.schema),...n}})}get isEmpty(){return Yf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new qm(t,this)}get $doc(){return this.$pos(0)}};function Ym(e){return new km({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Mf(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Bf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const u=n.from+r+s.length;i.addMark(n.from+r,u,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function Jm(e){return new km({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=Mf(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Km(e){return new km({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=Mf(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&ml(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&wl(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function Gm(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();if(s){s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)})}return t}function Zm(e){if(!e||0===Object.keys(e).length)return"";const t=[];if(e.class){String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`))}return e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function Qm(e){const{nodeName:t,name:n,parseAttributes:r=Gm,serializeAttributes:o=Zm,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const c=a[1]||"",u=r(c);return s.find(e=>!(e in u))?void 0:{type:t,raw:a[0],attributes:u}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function Xm(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Gm,serializeAttributes:i=Zm,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[u,d=""]=l,h=o(d);let p=1;const f=u.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)p+=1;else if(p-=1,0===p){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function eg(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function tg(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function ng(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=eg,serializeAttributes:i=tg,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),s=e.match(i);if(!s)return;let l="",c="";if(a){const[,e]=s;c=e}else{const[,e,t]=s;c=e,l=t||""}const d=o(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:d}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function rg(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<a.length;){const e=a[u],h=e.match(t.itemPattern);if(!h){if(l.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(h),{indentLevel:f,mainContent:m}=p;c=`${c}${e}\n`;const g=[m];for(u+=1;u<a.length;){const e=a[u];if(""===e.trim()){const t=a.slice(u+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[u+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),c=`${c}${e}\n`,u+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),c=`${c}${e}\n`,u+=1}let y;const b=g.slice(1);if(b.length>0){const e=b.map(e=>e.slice(f+d)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const v=t.createToken(p,y);l.push(v)}if(0!==l.length)return{items:l,raw:c}}function og(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,a=[`${o}${t.renderChildren([i])}`];return s&&s.length>0&&s.forEach(e=>{const n=t.renderChildren([e]);if(n){const e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}ap({},{createAtomBlockMarkdownSpec:()=>Qm,createBlockMarkdownSpec:()=>Xm,createInlineMarkdownSpec:()=>ng,parseAttributes:()=>Gm,parseIndentedBlocks:()=>rg,renderNestedMarkdownContent:()=>og,serializeAttributes:()=>Zm});var ig=class e extends Cm{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}};function sg(e){return new Om({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Mf(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),u=o+a.length;if(Bf(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>o).length)return null;u<n.to&&s.delete(u,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}const{getOwnPropertyNames:ag,getOwnPropertySymbols:lg}=Object,{hasOwnProperty:cg}=Object.prototype;function ug(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function dg(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);const{cache:o}=r,i=o.get(t),s=o.get(n);if(i&&s)return i===n&&s===t;o.set(t,n),o.set(n,t);const a=e(t,n,r);return o.delete(t),o.delete(n),a}}function hg(e){return ag(e).concat(lg(e))}const pg=Object.hasOwn||((e,t)=>cg.call(e,t));function fg(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:mg,keys:gg}=Object;function yg(e,t){return e.byteLength===t.byteLength&&_g(new Uint8Array(e),new Uint8Array(t))}function bg(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function vg(e,t){return e.byteLength===t.byteLength&&_g(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function wg(e,t){return fg(e.getTime(),t.getTime())}function xg(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function kg(e,t){return e===t}function Sg(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.entries();let s,a,l=0;for(;(s=i.next())&&!s.done;){const r=t.entries();let i=!1,c=0;for(;(a=r.next())&&!a.done;){if(o[c]){c++;continue}const r=s.value,u=a.value;if(n.equals(r[0],u[0],l,c,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){i=o[c]=!0;break}c++}if(!i)return!1;l++}return!0}const Eg=fg;function Mg(e,t,n){const r=gg(e);let o=r.length;if(gg(t).length!==o)return!1;for(;o-- >0;)if(!Ag(e,t,n,r[o]))return!1;return!0}function Cg(e,t,n){const r=hg(e);let o,i,s,a=r.length;if(hg(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!Ag(e,t,n,o))return!1;if(i=mg(e,o),s=mg(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function Rg(e,t){return fg(e.valueOf(),t.valueOf())}function Og(e,t){return e.source===t.source&&e.flags===t.flags}function Tg(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const o=new Array(r),i=e.values();let s,a;for(;(s=i.next())&&!s.done;){const r=t.values();let i=!1,l=0;for(;(a=r.next())&&!a.done;){if(!o[l]&&n.equals(s.value,a.value,s.value,a.value,e,t,n)){i=o[l]=!0;break}l++}if(!i)return!1}return!0}function _g(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Ng(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Ag(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||pg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const Dg={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},$g=Object.prototype.toString;function Lg({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:o,areFunctionsEqual:i,areMapsEqual:s,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;const b=typeof m;if(b!==typeof g)return!1;if("object"!==b)return"number"===b?a(m,g,y):"function"===b&&i(m,g,y);const v=m.constructor;if(v!==g.constructor)return!1;if(v===Object)return l(m,g,y);if(Array.isArray(m))return t(m,g,y);if(v===Date)return r(m,g,y);if(v===RegExp)return u(m,g,y);if(v===Map)return s(m,g,y);if(v===Set)return d(m,g,y);const w=$g.call(m);if("[object Date]"===w)return r(m,g,y);if("[object RegExp]"===w)return u(m,g,y);if("[object Map]"===w)return s(m,g,y);if("[object Set]"===w)return d(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&l(m,g,y);if("[object URL]"===w)return p(m,g,y);if("[object Error]"===w)return o(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(Dg[w])return h(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return n(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return c(m,g,y);if(f){let e=f[w];if(!e){const t=null!=(x=m)?x[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}var x;return!1}}const Ig=jg();function jg(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:yg,areArraysEqual:n?Cg:bg,areDataViewsEqual:vg,areDatesEqual:wg,areErrorsEqual:xg,areFunctionsEqual:kg,areMapsEqual:n?ug(Sg,Cg):Sg,areNumbersEqual:Eg,areObjectsEqual:n?Cg:Mg,arePrimitiveWrappersEqual:Rg,areRegExpsEqual:Og,areSetsEqual:n?ug(Tg,Cg):Tg,areTypedArraysEqual:n?ug(_g,Cg):_g,areUrlsEqual:Ng,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=dg(r.areArraysEqual),t=dg(r.areMapsEqual),n=dg(r.areObjectsEqual),o=dg(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=Lg(i);var a;return function({circular:e,comparator:t,createState:n,equals:r,strict:o}){if(n)return function(i,s){const{cache:a=(e?new WeakMap:void 0),meta:l}=n();return t(i,s,{cache:a,equals:r,meta:l,strict:o})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:o})};const i={cache:void 0,equals:r,meta:void 0,strict:o};return function(e,n){return t(e,n,i)}}({circular:t,comparator:s,createState:r,equals:n?n(s):(a=s,function(e,t,n,r,o,i,s){return a(e,t,s)}),strict:o})}jg({strict:!0}),jg({circular:!0}),jg({circular:!0,strict:!0}),jg({createInternalComparator:()=>fg}),jg({strict:!0,createInternalComparator:()=>fg}),jg({circular:!0,createInternalComparator:()=>fg}),jg({circular:!0,createInternalComparator:()=>fg,strict:!0});var zg,Pg,Fg={exports:{}},Bg={};var Hg=(Pg||(Pg=1,Fg.exports=function(){if(zg)return Bg;zg=1;var t=e,n=$s(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Bg.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=a(function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,r(o,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(o=e,t):(o=e,i=n)}var o,i,s=!1,a=void 0===n?null:n;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]},[t,n,c,u]);var p=o(e,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=p},[p]),l(p),p},Bg}()),Fg.exports),Vg=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},Ug=({contentComponent:e})=>{const t=Ls.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return Is(zs,{children:Object.values(t)})};var qg=class extends e.Component{constructor(t){var n;super(t),this.editorContentRef=e.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null==(n=t.editor)?void 0:n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;const t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:e}),t.contentComponent=function(){const e=new Set;let t={};return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>t,getServerSnapshot:()=>t,setRenderer(r,o){t={...t,[r]:n.createPortal(o.reactElement,o.element,r)},e.forEach(e=>e())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(e=>e())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return js(zs,{children:[Is("div",{ref:Vg(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&Is(Ug,{contentComponent:e.contentComponent})]})}},Wg=e.forwardRef((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(qg,{key:r,innerRef:n,...t})}),Yg=e.memo(Wg),Jg="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,Kg=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}};var Gg="undefined"==typeof window,Zg=Gg||Boolean("undefined"!=typeof window&&window.next),Qg=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?Gg||Zg?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)},onDelete:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDelete)?void 0:n.call(t,...e)}};return new Wm(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Xg(t={},n=[]){const r=e.useRef(t);r.current=t;const[o]=e.useState(()=>new Qg(r)),i=Ls.useSyncExternalStore(o.subscribe,o.getEditor,o.getServerSnapshot);return e.useDebugValue(i),e.useEffect(o.onRender(n)),function(t){var n;const[r]=e.useState(()=>new Kg(t.editor)),o=Hg.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:Ig);Jg(()=>r.watch(t.editor),[t.editor,r]),e.useDebugValue(o)}({editor:i,selector:({transactionNumber:e})=>!1===t.shouldRerenderOnTransaction||void 0===t.shouldRerenderOnTransaction?null:t.immediatelyRender&&0===e?0:e+1}),i}var ey=e.createContext({editor:null});ey.Consumer;var ty=e.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=e.useContext(ty);return Is(t.as||"div",{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});var ny=e.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});ny.displayName="TiptapContext";function ry({editor:t,instance:n,children:r}){const o=null!=t?t:n;if(!o)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=e.useMemo(()=>({editor:o}),[o]),s=e.useMemo(()=>({editor:o}),[o]);return Is(ey.Provider,{value:s,children:Is(ny.Provider,{value:i,children:r})})}function oy({...t}){const{editor:n}=e.useContext(ny);return Is(Yg,{editor:n,...t})}ry.displayName="Tiptap",oy.displayName="Tiptap.Content",Object.assign(ry,{Content:oy});var iy=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},sy=/^\s*>\s$/,ay=ig.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return iy("blockquote",{...Tf(this.options.HTMLAttributes,e),children:iy("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach(e=>{const r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Km({find:sy,type:this.type})]}}),ly=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,cy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,uy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,dy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,hy=Rm.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return iy("strong",{...Tf(this.options.HTMLAttributes,e),children:iy("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ym({find:ly,type:this.type}),Ym({find:uy,type:this.type})]},addPasteRules(){return[sg({find:cy,type:this.type}),sg({find:dy,type:this.type})]}}),py=/(^|[^`])`([^`]+)`(?!`)$/,fy=/(^|[^`])`([^`]+)`(?!`)/g,my=Rm.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Tf(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ym({find:py,type:this.type})]},addPasteRules(){return[sg({find:fy,type:this.type})]}}),gy=/^```([a-z]+)?[\s\n]$/,yy=/^~~~([a-z]+)?[\s\n]$/,by=ig.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Tf(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";if(e.content){r=[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n")}else r=`\`\`\`${o}\n\n\`\`\``;return r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let c=0,u=0;const d=o-s;for(let n=0;n<l.length;n+=1){if(u+l[n].length>=d){c=n;break}u+=l[n].length+1}const h=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let n=0;n<c;n+=1)f+=l[n].length+1;e.delete(f,f+p);return o-f<=p&&e.setSelection(Ul.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(Fl.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[Jm({find:gy,type:this.type,getAttributes:e=>({language:e[1]})}),Jm({find:yy,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new ic({key:new lc("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Ul.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),vy=ig.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),wy=ig.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Tf(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),xy=ig.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Tf(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Jm({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),ky=ig.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Tf(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Wl){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Jf(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Ul.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Wl.create(t.doc,n.pos)):t.setSelection(Ul.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(Ul.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new km({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Mf(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable}))];var e}}),Sy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ey=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,My=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Cy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ry=Rm.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Tf(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ym({find:Sy,type:this.type}),Ym({find:My,type:this.type})]},addPasteRules(){return[sg({find:Ey,type:this.type}),sg({find:Cy,type:this.type})]}});const Oy="numeric",Ty="ascii",_y="alpha",Ny="asciinumeric",Ay="alphanumeric",Dy="domain",$y="emoji",Ly="scheme",Iy="slashscheme",jy="whitespace";function zy(e,t){return e in t||(t[e]=[]),t[e]}function Py(e,t,n){t[Oy]&&(t[Ny]=!0,t[Ay]=!0),t[Ty]&&(t[Ny]=!0,t[_y]=!0),t[Ny]&&(t[Ay]=!0),t[_y]&&(t[Ay]=!0),t[Ay]&&(t[Dy]=!0),t[$y]&&(t[Dy]=!0);for(const r in t){const t=zy(r,n);t.indexOf(e)<0&&t.push(e)}}function Fy(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Fy.groups={},Fy.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const n=t.jr[r][0],o=t.jr[r][1];if(o&&n.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Fy.groups,t&&t.j?o=t:(o=new Fy(t),n&&r&&Py(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(e[s]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Fy.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Fy,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Fy,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Py(i,e,r)}else n&&Py(i,n,r);s.t=i}return o.j[e]=s,s}};const By=(e,t,n,r,o)=>e.ta(t,n,r,o),Hy=(e,t,n,r,o)=>e.tr(t,n,r,o),Vy=(e,t,n,r,o)=>e.ts(t,n,r,o),Uy=(e,t,n,r,o)=>e.tt(t,n,r,o),qy="WORD",Wy="UWORD",Yy="ASCIINUMERICAL",Jy="ALPHANUMERICAL",Ky="LOCALHOST",Gy="TLD",Zy="UTLD",Qy="SCHEME",Xy="SLASH_SCHEME",eb="NUM",tb="WS",nb="NL",rb="OPENBRACE",ob="CLOSEBRACE",ib="OPENBRACKET",sb="CLOSEBRACKET",ab="OPENPAREN",lb="CLOSEPAREN",cb="OPENANGLEBRACKET",ub="CLOSEANGLEBRACKET",db="FULLWIDTHLEFTPAREN",hb="FULLWIDTHRIGHTPAREN",pb="LEFTCORNERBRACKET",fb="RIGHTCORNERBRACKET",mb="LEFTWHITECORNERBRACKET",gb="RIGHTWHITECORNERBRACKET",yb="FULLWIDTHLESSTHAN",bb="FULLWIDTHGREATERTHAN",vb="AMPERSAND",wb="APOSTROPHE",xb="ASTERISK",kb="AT",Sb="BACKSLASH",Eb="BACKTICK",Mb="CARET",Cb="COLON",Rb="COMMA",Ob="DOLLAR",Tb="DOT",_b="EQUALS",Nb="EXCLAMATION",Ab="HYPHEN",Db="PERCENT",$b="PIPE",Lb="PLUS",Ib="POUND",jb="QUERY",zb="QUOTE",Pb="FULLWIDTHMIDDLEDOT",Fb="SEMI",Bb="SLASH",Hb="TILDE",Vb="UNDERSCORE",Ub="EMOJI",qb="SYM";var Wb=Object.freeze({__proto__:null,ALPHANUMERICAL:Jy,AMPERSAND:vb,APOSTROPHE:wb,ASCIINUMERICAL:Yy,ASTERISK:xb,AT:kb,BACKSLASH:Sb,BACKTICK:Eb,CARET:Mb,CLOSEANGLEBRACKET:ub,CLOSEBRACE:ob,CLOSEBRACKET:sb,CLOSEPAREN:lb,COLON:Cb,COMMA:Rb,DOLLAR:Ob,DOT:Tb,EMOJI:Ub,EQUALS:_b,EXCLAMATION:Nb,FULLWIDTHGREATERTHAN:bb,FULLWIDTHLEFTPAREN:db,FULLWIDTHLESSTHAN:yb,FULLWIDTHMIDDLEDOT:Pb,FULLWIDTHRIGHTPAREN:hb,HYPHEN:Ab,LEFTCORNERBRACKET:pb,LEFTWHITECORNERBRACKET:mb,LOCALHOST:Ky,NL:nb,NUM:eb,OPENANGLEBRACKET:cb,OPENBRACE:rb,OPENBRACKET:ib,OPENPAREN:ab,PERCENT:Db,PIPE:$b,PLUS:Lb,POUND:Ib,QUERY:jb,QUOTE:zb,RIGHTCORNERBRACKET:fb,RIGHTWHITECORNERBRACKET:gb,SCHEME:Qy,SEMI:Fb,SLASH:Bb,SLASH_SCHEME:Xy,SYM:qb,TILDE:Hb,TLD:Gy,UNDERSCORE:Vb,UTLD:Zy,UWORD:Wy,WORD:qy,WS:tb});const Yb=/[a-z]/,Jb=new RegExp("\\p{L}","u"),Kb=new RegExp("\\p{Emoji}","u"),Gb=/\d/,Zb=/\s/;let Qb=null,Xb=null;function ev(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,u=null,d=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[s].length,h++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=h,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function tv(e,t,n,r,o){let i;const s=t.length;for(let a=0;a<s-1;a++){const n=t[a];e.j[n]?i=e.j[n]:(i=new Fy(r),i.jr=o.slice(),e.j[n]=i),e=i}return i=new Fy(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function nv(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const rv={defaultProtocol:"http",events:null,format:iv,formatHref:iv,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ov(e,t=null){let n=Object.assign({},rv);e&&(n=Object.assign(n,e instanceof ov?e.o:e));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function iv(e){return e}function sv(e,t){this.t="token",this.v=e,this.tk=t}function av(e,t){class n extends sv{constructor(t,n){super(t,n),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}ov.prototype={o:rv,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:rv[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},sv.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=rv.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};const lv=av("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),cv=av("text"),uv=av("nl"),dv=av("url",{isLink:!0,toHref(e=rv.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Ky&&e[1].t===Cb}}),hv=e=>new Fy(e);function pv(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const fv="undefined"!=typeof console&&console&&console.warn||(()=>{}),mv={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function gv(e,t=!1){if(mv.initialized&&fv(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');mv.customSchemes.push([e,t])}function yv(){mv.scanner=function(e=[]){const t={};Fy.groups=t;const n=new Fy;null==Qb&&(Qb=nv("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Xb&&(Xb=nv("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Uy(n,"'",wb),Uy(n,"{",rb),Uy(n,"}",ob),Uy(n,"[",ib),Uy(n,"]",sb),Uy(n,"(",ab),Uy(n,")",lb),Uy(n,"<",cb),Uy(n,">",ub),Uy(n,"(",db),Uy(n,")",hb),Uy(n,"「",pb),Uy(n,"」",fb),Uy(n,"『",mb),Uy(n,"』",gb),Uy(n,"<",yb),Uy(n,">",bb),Uy(n,"&",vb),Uy(n,"*",xb),Uy(n,"@",kb),Uy(n,"`",Eb),Uy(n,"^",Mb),Uy(n,":",Cb),Uy(n,",",Rb),Uy(n,"$",Ob),Uy(n,".",Tb),Uy(n,"=",_b),Uy(n,"!",Nb),Uy(n,"-",Ab),Uy(n,"%",Db),Uy(n,"|",$b),Uy(n,"+",Lb),Uy(n,"#",Ib),Uy(n,"?",jb),Uy(n,'"',zb),Uy(n,"/",Bb),Uy(n,";",Fb),Uy(n,"~",Hb),Uy(n,"_",Vb),Uy(n,"\\",Sb),Uy(n,"・",Pb);const r=Hy(n,Gb,eb,{[Oy]:!0});Hy(r,Gb,r);const o=Hy(r,Yb,Yy,{[Ny]:!0}),i=Hy(r,Jb,Jy,{[Ay]:!0}),s=Hy(n,Yb,qy,{[Ty]:!0});Hy(s,Gb,o),Hy(s,Yb,s),Hy(o,Gb,o),Hy(o,Yb,o);const a=Hy(n,Jb,Wy,{[_y]:!0});Hy(a,Yb),Hy(a,Gb,i),Hy(a,Jb,a),Hy(i,Gb,i),Hy(i,Yb),Hy(i,Jb,i);const l=Uy(n,"\n",nb,{[jy]:!0}),c=Uy(n,"\r",tb,{[jy]:!0}),u=Hy(n,Zb,tb,{[jy]:!0});Uy(n,"",u),Uy(c,"\n",l),Uy(c,"",u),Hy(c,Zb,u),Uy(u,"\r"),Uy(u,"\n"),Hy(u,Zb,u),Uy(u,"",u);const d=Hy(n,Kb,Ub,{[$y]:!0});Uy(d,"#"),Hy(d,Kb,d),Uy(d,"️",d);const h=Uy(d,"");Uy(h,"#"),Hy(h,Kb,d);const p=[[Yb,s],[Gb,o]],f=[[Yb,null],[Jb,a],[Gb,i]];for(let m=0;m<Qb.length;m++)tv(n,Qb[m],Gy,qy,p);for(let m=0;m<Xb.length;m++)tv(n,Xb[m],Zy,Wy,f);Py(Gy,{tld:!0,ascii:!0},t),Py(Zy,{utld:!0,alpha:!0},t),tv(n,"file",Qy,qy,p),tv(n,"mailto",Qy,qy,p),tv(n,"http",Xy,qy,p),tv(n,"https",Xy,qy,p),tv(n,"ftp",Xy,qy,p),tv(n,"ftps",Xy,qy,p),Py(Qy,{scheme:!0,ascii:!0},t),Py(Xy,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let m=0;m<e.length;m++){const t=e[m][0],r=e[m][1]?{[Ly]:!0}:{[Iy]:!0};t.indexOf("-")>=0?r[Dy]=!0:Yb.test(t)?Gb.test(t)?r[Ny]=!0:r[Ty]=!0:r[Oy]=!0,Vy(n,t,t,r)}return Vy(n,"localhost",Ky,{ascii:!0}),n.jd=new Fy(qb),{start:n,tokens:Object.assign({groups:t},Wb)}}(mv.customSchemes);for(let e=0;e<mv.tokenQueue.length;e++)mv.tokenQueue[e][1]({scanner:mv.scanner});mv.parser=function({groups:e}){const t=e.domain.concat([vb,xb,kb,Sb,Eb,Mb,Ob,_b,Ab,eb,Db,$b,Lb,Ib,Bb,qb,Hb,Vb]),n=[wb,Cb,Rb,Tb,Nb,Db,jb,zb,Fb,cb,ub,rb,ob,sb,ib,ab,lb,db,hb,pb,fb,mb,gb,yb,bb],r=[vb,wb,xb,Sb,Eb,Mb,Ob,_b,Ab,rb,ob,Db,$b,Lb,Ib,jb,Bb,qb,Hb,Vb],o=hv(),i=Uy(o,Hb);By(i,r,i),By(i,e.domain,i);const s=hv(),a=hv(),l=hv();By(o,e.domain,s),By(o,e.scheme,a),By(o,e.slashscheme,l),By(s,r,i),By(s,e.domain,s);const c=Uy(s,kb);Uy(i,kb,c),Uy(a,kb,c),Uy(l,kb,c);const u=Uy(i,Tb);By(u,r,i),By(u,e.domain,i);const d=hv();By(c,e.domain,d),By(d,e.domain,d);const h=Uy(d,Tb);By(h,e.domain,d);const p=hv(lv);By(h,e.tld,p),By(h,e.utld,p),Uy(c,Ky,p);const f=Uy(d,Ab);Uy(f,Ab,f),By(f,e.domain,d),By(p,e.domain,d),Uy(p,Tb,h),Uy(p,Ab,f);const m=Uy(p,Cb);By(m,e.numeric,lv);const g=Uy(s,Ab),y=Uy(s,Tb);Uy(g,Ab,g),By(g,e.domain,s),By(y,r,i),By(y,e.domain,s);const b=hv(dv);By(y,e.tld,b),By(y,e.utld,b),By(b,e.domain,s),By(b,r,i),Uy(b,Tb,y),Uy(b,Ab,g),Uy(b,kb,c);const v=Uy(b,Cb),w=hv(dv);By(v,e.numeric,w);const x=hv(dv),k=hv();By(x,t,x),By(x,n,k),By(k,t,x),By(k,n,k),Uy(b,Bb,x),Uy(w,Bb,x);const S=Uy(a,Cb),E=Uy(l,Cb),M=Uy(E,Bb),C=Uy(M,Bb);By(a,e.domain,s),Uy(a,Tb,y),Uy(a,Ab,g),By(l,e.domain,s),Uy(l,Tb,y),Uy(l,Ab,g),By(S,e.domain,x),Uy(S,Bb,x),Uy(S,jb,x),By(C,e.domain,x),By(C,t,x),Uy(C,Bb,x);const R=[[rb,ob],[ib,sb],[ab,lb],[cb,ub],[db,hb],[pb,fb],[mb,gb],[yb,bb]];for(let O=0;O<R.length;O++){const[e,r]=R[O],o=Uy(x,e);Uy(k,e,o),Uy(o,r,x);const i=hv(dv);By(o,t,i);const s=hv();By(o,n),By(i,t,i),By(i,n,s),By(s,t,i),By(s,n,s),Uy(i,r,x),Uy(s,r,x)}return Uy(o,Ky,b),Uy(o,nb,uv),{start:o,tokens:Wb}}(mv.scanner.tokens);for(let e=0;e<mv.pluginQueue.length;e++)mv.pluginQueue[e][1]({scanner:mv.scanner,parser:mv.parser});return mv.initialized=!0,mv}function bv(e){return mv.initialized||yv(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,u=0,d=null,h=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,o++,u++;if(h<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(pv(cv,t,s)),s=[]),o-=h,u-=h;const e=d.t,r=n.slice(o-u,o);i.push(pv(e,t,r))}}return s.length>0&&i.push(pv(cv,t,s)),i}(mv.parser.start,e,ev(mv.scanner.start,e))}function vv(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new ov(n),o=bv(e),i=[];for(let s=0;s<o.length;s++){const e=o[s];!e.isLink||t&&e.t!==t||!r.check(e)||i.push(e.toFormattedObject(r))}return i}bv.scan=ev;var wv="[\0- -\u2029 ]",xv=new RegExp(wv),kv=new RegExp(`${wv}$`),Sv=new RegExp(wv,"g");function Ev(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(Sv,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Mv=Rm.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?gv(e.scheme,e.optionalSlashes):gv(e)})},onDestroy(){Fy.groups={},mv.scanner=null,mv.parser=null,mv.tokenQueue=[],mv.pluginQueue=[],mv.customSchemes=[],mv.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Ev(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Ev(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Ev(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Tf(this.options.HTMLAttributes,e),0]:["a",Tf(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Ev(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Ev(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[sg({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=vv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Ev(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var r;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Ev(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new ic({key:new lc("autolink"),appendTransaction:(e,t,n)=>{const o=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=n;return Ff(vf(t.doc,[...e])).forEach(({newRange:e})=>{const t=function(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}(n.doc,e,e=>e.isTextblock);let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!kv.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(xv).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=bv(t).map(e=>e.toObject(r.defaultProtocol));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(e=>r.validate(e.value)).filter(e=>r.shouldAutoLink(e.value)).forEach(e=>{Bf(e.from,e.to,n.doc).some(e=>e.mark.type===r.type)||s.addMark(e.from,e.to,r.type.create({href:e.href}))})}var a}),s.steps.length?s:void 0}}))),e.push(function(e){return new ic({key:new lc("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=zf(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new ic({key:new lc("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const c=vv(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!c||void 0!==o&&!o(c.value))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Cv=Mv,Rv=Object.defineProperty,Ov="textStyle",Tv=/^\s*([-+*])\s$/,_v=ig.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",Tf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ov)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Km({find:Tv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Km({find:Tv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ov),editor:this.editor})),[e]}}),Nv=ig.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Tf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0){if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{const r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){const r=e.tokens.slice(1),o=t.parseChildren(r);n.push(...o)}}else n=t.parseChildren(e.tokens)}}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>og(e,t,e=>{var t,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){return`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)Rv(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>Av,getNextListDepth:()=>Dv,handleBackspace:()=>jv,handleDelete:()=>Fv,hasListBefore:()=>$v,hasListItemAfter:()=>Bv,hasListItemBefore:()=>Lv,listItemHasSubList:()=>Iv,nextListIsDeeper:()=>zv,nextListIsHigher:()=>Pv});var Av=(e,t)=>{const{$from:n}=t.selection,r=bp(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},Dv=(e,t)=>{const n=Av(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},$v=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Lv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Iv=(e,t,n)=>{if(!n)return!1;const r=bp(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},jv=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!ef(e.state,t)&&$v(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!ef(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=Av(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Iv(t,e.state,o);return Lv(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},zv=(e,t)=>{const n=Dv(e,t),r=Av(e,t);return!(!r||!n)&&n>r.depth},Pv=(e,t)=>{const n=Dv(e,t),r=Av(e,t);return!(!r||!n)&&n<r.depth},Fv=(e,t)=>{if(!ef(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=wf(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(zv(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Pv(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Bv=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Hv=Dm.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Fv(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Fv(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&jv(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&jv(e,n,r)&&(t=!0)}),t}}}}),Vv=/^(\s*)(\d+)\.\s+(.*)$/,Uv=/^\s/;function qv(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join("\n").trim();if(u){const e=n.blockTokens(u);c.push(...e)}let d=i+1;const h=[];for(;d<e.length&&e[d].indent>t;)h.push(e[d]),d+=1;if(h.length>0){const e=Math.min(...h.map(e=>e.indent)),t=qv(h,e,n);c.push({type:"list",ordered:!0,start:h[0].number,items:t,raw:h.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}var Wv="textStyle",Yv=/^(\d+)\.\s$/,Jv=ig.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",Tf(this.options.HTMLAttributes,n),0]:["ol",Tf(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Vv);if(!i)break;const[,s,a,l]=i,c=s.length;let u=l,d=n+1;const h=[o];for(;d<e.length;){const t=e[d];if(t.match(Vv))break;if(""===t.trim())h.push(t),u+="\n",d+=1;else{if(!t.match(Uv))break;h.push(t),u+=`\n${t.slice(c+2)}`,d+=1}}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:h.join("\n")}),r=d,n=d}return[t,r]}(o);if(0===i.length)return;const a=qv(i,0,n);if(0===a.length)return;return{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Wv)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Km({find:Yv,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Km({find:Yv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Wv)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Kv=/^\s*(\[([( |x])?\])\s$/,Gv=ig.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Tf(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return og(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);const t=_f(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return u.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),u=n,!0}}}},addInputRules(){return[Km({find:Kv,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),Zv=ig.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Tf(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=rg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=rg(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Dm.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(_v.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Nv.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Hv.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Jv.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(Gv.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(Zv.configure(this.options.taskList)),e}});var Qv=" ",Xv=ig.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Tf(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==r.length||"text"!==r[0].type||r[0].text!==Qv&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return 0===n.length?Qv:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ew=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nw=Rm.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Tf(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ym({find:ew,type:this.type})]},addPasteRules(){return[sg({find:tw,type:this.type})]}}),rw=ig.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),ow=Rm.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Tf(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),iw=ow;function sw(e={}){return new ic({view:t=>new aw(t,e)})}class aw{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Sl(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class lw extends Fl{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return lw.valid(n)?new lw(n):Fl.near(n)}content(){return Js.empty}eq(e){return e instanceof lw&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new lw(e.resolve(t.pos))}getBookmark(){return new cw(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||uw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||uw(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&lw.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(lw.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!Wl.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(lw.valid(s))return s}return null}}}lw.prototype.visible=!1,lw.findFrom=lw.findGapCursorFrom,Fl.jsonID("gapcursor",lw);class cw{constructor(e){this.pos=e}map(e){return new cw(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return lw.valid(t)?new lw(t):Fl.near(t)}}function uw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const dw=ip({ArrowLeft:hw("horiz",-1),ArrowRight:hw("horiz",1),ArrowUp:hw("vert",-1),ArrowDown:hw("vert",1)});function hw(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Ul){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=lw.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new lw(l))),!0)}}function pw(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!lw.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&Wl.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new lw(r))),!0)}function fw(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof lw))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=Hs.empty;for(let s=r.length-1;s>=0;s--)o=Hs.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new Js(o,0,0));return i.setSelection(Ul.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function mw(e){if(!(e.selection instanceof lw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",bh.create(e.doc,[mh.widget(e.selection.head,t,{key:"gapcursor"})])}var gw=200,yw=function(){};yw.prototype.append=function(e){return e.length?(e=yw.from(e),!this.length&&e||e.length<gw&&this.leafAppend(e)||this.length<gw&&e.leafPrepend(this)||this.appendInner(e)):this},yw.prototype.prepend=function(e){return e.length?yw.from(e).append(this):this},yw.prototype.appendInner=function(e){return new vw(this,e)},yw.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?yw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},yw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},yw.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},yw.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},yw.from=function(e){return e instanceof yw?e:e&&e.length?new bw(e):yw.empty};var bw=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=gw)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=gw)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(yw);yw.empty=new bw([]);var vw=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(yw);class ww{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new xw(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new xw(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new ww(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let n,l=e.steps[c].invert(e.docs[c]),u=new xw(e.mapping.maps[c],l,t);(n=a&&a.merge(u))&&(u=n,c?o.pop():s=s.slice(0,s.length-1)),o.push(u),t&&(i++,t=void 0),r||(a=u)}let l=i-n.depth;return l>Sw&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new ww(s.append(o),i)}remapping(e,t){let n=new el;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new ww(this.items.append(e.map(e=>new xw(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new xw(l,i,c))}else n.push(new xw(l))},r);let l=[];for(let d=t;d<i;d++)l.push(new xw(o.maps[d]));let c=this.items.slice(0,r).append(l).append(n),u=new ww(c,s);return u.emptyItemCount()>500&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new xw(s.invert(),e,a),u=r.length-1;(l=r.length&&r[u].merge(c))?r[u]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new ww(yw.from(r.reverse()),o)}}ww.empty=new ww(yw.empty,0);class xw{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new xw(t.getMap().invert(),t,this.selection)}}}class kw{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Sw=20;function Ew(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function Mw(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let Cw=!1,Rw=null;function Ow(e){let t=e.plugins;if(Rw!=t){Cw=!1,Rw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Cw=!0;break}}return Cw}const Tw=new lc("history"),_w=new lc("closeHistory");function Nw(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ic({key:Tw,state:{init:()=>new kw(ww.empty,ww.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Tw);if(i)return i.historyState;n.getMeta(_w)&&(e=new kw(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Tw))return s.getMeta(Tw).redo?new kw(e.done.addTransform(n,void 0,r,Ow(t)),e.undone,Ew(n.mapping.maps),e.prevTime,e.prevComposition):new kw(e.done,e.undone.addTransform(n,void 0,r,Ow(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new kw(e.done.rebased(n,o),e.undone.rebased(n,o),Mw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new kw(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Mw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?Mw(e.prevRanges,n.mapping):Ew(n.mapping.maps);return new kw(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Ow(t)),ww.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Dw:"historyRedo"==n?$w:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Aw(e,t){return(n,r)=>{let o=Tw.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Ow(t),o=Tw.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new kw(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Tw,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Dw=Aw(!1,!0),$w=Aw(!0,!0);Dm.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new ic({key:new lc("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;e.deleteRange(s,a);return!(this.storage.characters({node:e.doc})>n)}})]}});var Lw=Dm.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[sw(this.options)]}});Dm.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new ic({key:new lc("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return bh.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(e.isText)return;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;s+=1});let a=0;return e.descendants((e,t)=>{if(e.isText)return!1;if(!(o>=t&&o<=t+e.nodeSize-1))return!1;a+=1;if("deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1)return"deepest"===this.options.mode;i.push(mh.node(t,t+e.nodeSize,{class:this.options.className}))}),bh.create(e,i)}}})]}});var Iw=Dm.create({name:"gapCursor",addProseMirrorPlugins:()=>[new ic({props:{decorations:mw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&lw.valid(n)?new lw(n):null,handleClick:pw,handleKeyDown:dw,handleDOMEvents:{beforeinput:fw}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=Mf(xf(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),jw="placeholder";var zw=Dm.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:jw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${jw}`;var t;return[new ic({key:new lc("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Yf(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=mh.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),bh.create(t,i)}}})]}});function Pw({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}Dm.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new ic({key:new lc("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||Jf(n.selection)||e.view.dragging?null:bh.create(n.doc,[mh.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var Fw=Dm.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new lc(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new ic({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),c=i.content.size,u=a.nodes[n];if(l)return s.insert(c,u.create())},state:{init:(e,t)=>!Pw({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!Pw({node:e.doc.lastChild,types:r})}}})]}}),Bw=Dm.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>Dw(e,t),redo:()=>({state:e,dispatch:t})=>$w(e,t)}),addProseMirrorPlugins(){return[Nw(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Hw=Dm.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(hy.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(ay.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(_v.configure(this.options.bulletList)),!1!==this.options.code&&o.push(my.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(by.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(vy.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Lw.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Iw.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(wy.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(xy.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(Bw.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(ky.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Ry.configure(this.options.italic)),!1!==this.options.listItem&&o.push(Nv.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Hv.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(Mv.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Jv.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Xv.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(nw.configure(this.options.strike)),!1!==this.options.text&&o.push(rw.configure(this.options.text)),!1!==this.options.underline&&o.push(ow.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Fw.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),Vw=Dm.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Uw=zw,qw=(e,t=0)=>{const n=[];return!e.children.length||t>20||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?n.push(e):e.children.length&&n.push(...qw(e,t+1))}),n},Ww=Rm.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(e=>{if(!e.children.length)return;const t=qw(e);t&&t.forEach(e=>{var t,n;const r=e.getAttribute("style"),o=null==(n=null==(t=e.parentElement)?void 0:t.closest("span"))?void 0:n.getAttribute("style");e.setAttribute("style",`${o};${r}`)})})(e),{})}]},renderHTML({HTMLAttributes:e}){return["span",Tf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),Yw=Dm.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("background-color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.backgroundColor)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands:()=>({setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()})}),Jw=Dm.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.color)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands:()=>({setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()})}),Kw=Dm.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands:()=>({setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()})}),Gw=Dm.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands:()=>({setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})}),Zw=Dm.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands:()=>({setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()})});Dm.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(Yw.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(Jw.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(Kw.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(Gw.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(Zw.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(Ww.configure(this.options.textStyle)),e}});var Qw=Jw,Xw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,tx=Rm.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",Tf(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){const r=/^(==)([^=]+)(==)/.exec(e);if(r){const e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ym({find:Xw,type:this.type})]},addPasteRules(){return[sg({find:ex,type:this.type})]}}),nx=tx;function rx({onClick:e,active:t,disabled:n,title:r,children:o}){return React.createElement("button",{type:"button",onMouseDown:t=>{t.preventDefault(),e()},disabled:n,title:r,className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(n?"text-gray-300 cursor-not-allowed":t?"bg-gray-200 text-indigo-600":"text-gray-500")},o)}const ox=["#000000","#434343","#666666","#999999","#cccccc","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#8b5cf6","#ec4899","#f43f5e","#991b1b","#9a3412","#854d0e","#166534","#115e59","#1e40af","#3730a3","#5b21b6","#9d174d","#be123c"];function ix({currentColor:t,onSelect:r,icon:o,title:i}){const[s,a]=e.useState(!1),[l,c]=e.useState({top:0,left:0}),u=e.useRef(null),d=e.useRef(null);e.useEffect(()=>{if(!s)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);const h=e.useCallback(e=>{if(e.preventDefault(),!s&&u.current){const e=u.current.getBoundingClientRect();c({top:e.bottom+4,left:e.left})}a(e=>!e)},[s]);return React.createElement("div",{className:"relative"},React.createElement("button",{ref:u,type:"button",title:i,className:"flex items-center p-1 rounded hover:bg-gray-200 smooth-transition text-gray-500",onMouseDown:h},React.createElement("span",{className:"relative"},o,t&&React.createElement("span",{className:"absolute -bottom-0.5 left-0 right-0 h-[3px] rounded-sm",style:{backgroundColor:t}})),React.createElement(Qe,{className:"w-2.5 h-2.5 ml-0.5"})),s&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:d,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-2.5",style:{top:l.top,left:l.left}},React.createElement("div",{className:"flex flex-wrap gap-1.5",style:{width:164}},ox.map(e=>React.createElement("button",{key:e,type:"button",title:e,className:"w-7 h-7 rounded-md border-2 smooth-transition flex items-center justify-center "+(e===t?"border-gray-800 shadow-sm scale-110":"border-transparent hover:border-gray-300"),style:{backgroundColor:e},onMouseDown:t=>{t.preventDefault(),r(e),a(!1)}}))),React.createElement("button",{type:"button",className:"w-full mt-2 text-[11px] text-gray-500 hover:text-gray-700 py-1 rounded-md hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),r(null),a(!1)}},"清除颜色"))),document.body))}function sx({editor:t}){const[r,o]=e.useState(!1),[i,s]=e.useState({top:0,left:0}),a=e.useRef(null),l=e.useRef(null);e.useEffect(()=>{if(!r)return;const e=e=>{a.current&&!a.current.contains(e.target)&&l.current&&!l.current.contains(e.target)&&o(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r]);const c=e.useCallback(e=>{if(e.preventDefault(),!r&&a.current){const e=a.current.getBoundingClientRect();s({top:e.bottom+4,left:e.left})}o(e=>!e)},[r]),u=[{label:"正文",active:!t.isActive("heading"),action:()=>t.chain().focus().setParagraph().run()},{label:"标题 1",active:t.isActive("heading",{level:1}),action:()=>t.chain().focus().toggleHeading({level:1}).run(),className:"text-[16px] font-bold"},{label:"标题 2",active:t.isActive("heading",{level:2}),action:()=>t.chain().focus().toggleHeading({level:2}).run(),className:"text-[15px] font-bold"},{label:"标题 3",active:t.isActive("heading",{level:3}),action:()=>t.chain().focus().toggleHeading({level:3}).run(),className:"text-[14px] font-semibold"}],d=u.find(e=>e.active)?.label||"正文";return React.createElement("div",{className:"relative"},React.createElement("button",{ref:a,type:"button",className:"flex items-center gap-0.5 px-1.5 py-1 rounded hover:bg-gray-200 smooth-transition text-gray-600 text-[12px] font-medium min-w-[56px]",onMouseDown:c},d,React.createElement(Qe,{className:"w-3 h-3"})),r&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:l,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg py-1 min-w-[120px]",style:{top:i.top,left:i.left}},u.map(e=>React.createElement("button",{key:e.label,type:"button",className:`w-full text-left px-3 py-1.5 hover:bg-gray-100 smooth-transition ${e.active?"bg-indigo-50 text-indigo-600":"text-gray-700"} ${e.className||"text-[13px]"}`,onMouseDown:t=>{t.preventDefault(),e.action(),o(!1)}},e.label)))),document.body))}function ax({editor:r,iconSize:o}){const[i,s]=e.useState(!1),[a,l]=e.useState(""),[c,u]=e.useState({top:0,left:0}),d=e.useRef(null),h=e.useRef(null),p=e.useRef(null);e.useEffect(()=>{if(!i)return;const e=e=>{d.current&&!d.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const f=()=>{s(!1),a&&"https://"!==a?r.chain().focus().extendMarkRange("link").setLink({href:a}).run():r.chain().focus().extendMarkRange("link").unsetLink().run()};return React.createElement("div",{className:"relative"},React.createElement("button",{ref:d,type:"button",title:"插入链接",className:"p-1 rounded hover:bg-gray-200 smooth-transition "+(r.isActive("link")?"bg-gray-200 text-indigo-600":"text-gray-500"),onMouseDown:e=>{e.preventDefault(),(()=>{const e=r.getAttributes("link").href||"";if(l(e||"https://"),d.current){const e=d.current.getBoundingClientRect();u({top:e.bottom+4,left:Math.max(8,e.right-320)})}s(!i),setTimeout(()=>p.current?.focus(),50)})()}},React.createElement(rt,{className:o})),i&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:h,className:"fixed z-[9999] bg-white border border-gray-200 rounded-lg shadow-lg p-3 w-[320px]",style:{top:c.top,left:c.left},onMouseDown:e=>e.stopPropagation()},React.createElement("label",{className:"block text-[12px] font-medium text-gray-600 mb-1"},"链接地址"),React.createElement(t.Input,{ref:p,value:a,onChange:e=>l(e.target.value),placeholder:"https://",size:"small",onPressEnter:f}),React.createElement("div",{className:"flex justify-end gap-1.5 mt-2"},React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-gray-500 hover:text-gray-700 rounded hover:bg-gray-100 smooth-transition",onMouseDown:e=>{e.preventDefault(),s(!1)}},"取消"),React.createElement("button",{type:"button",className:"px-2.5 py-1 text-[12px] text-white bg-indigo-500 hover:bg-indigo-600 rounded smooth-transition",onMouseDown:e=>{e.preventDefault(),f()}},"确定")))),document.body))}function lx({editor:t}){const n="w-3.5 h-3.5",[,r]=e.useState(0);e.useEffect(()=>{const e=()=>r(e=>e+1);return t.on("transaction",e),()=>{t.off("transaction",e)}},[t]);const o=t.getAttributes("textStyle").color,i=t.getAttributes("highlight").color;return React.createElement(React.Fragment,null,React.createElement("div",{className:"flex flex-wrap items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-gray-50/80"},React.createElement(sx,{editor:t}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(rx,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"加粗"},React.createElement(Ze,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"斜体"},React.createElement(nt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"下划线"},React.createElement(vt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"删除线"},React.createElement(ft,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(ix,{currentColor:o,onSelect:e=>{e?t.chain().focus().setColor(e).run():t.chain().focus().unsetColor().run()},icon:React.createElement(ut,{className:n}),title:"字体颜色"}),React.createElement(ix,{currentColor:i,onSelect:e=>{e?t.chain().focus().setHighlight({color:e}).run():t.chain().focus().unsetHighlight().run()},icon:React.createElement(tt,{className:n}),title:"背景色"}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(rx,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"无序列表"},React.createElement(at,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"有序列表"},React.createElement(st,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().sinkListItem("listItem").run(),disabled:!t.can().sinkListItem("listItem"),title:"增加缩进"},React.createElement(it,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().liftListItem("listItem").run(),disabled:!t.can().liftListItem("listItem"),title:"减少缩进"},React.createElement(ot,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(rx,{onClick:()=>t.chain().focus().setTextAlign("left").run(),active:t.isActive({textAlign:"left"}),title:"左对齐"},React.createElement(yt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().setTextAlign("center").run(),active:t.isActive({textAlign:"center"}),title:"居中"},React.createElement(mt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().setTextAlign("right").run(),active:t.isActive({textAlign:"right"}),title:"右对齐"},React.createElement(gt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(ax,{editor:t,iconSize:n}),React.createElement(rx,{onClick:()=>t.chain().focus().unsetLink().run(),disabled:!t.isActive("link"),title:"取消链接"},React.createElement(xt,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(rx,{onClick:()=>t.chain().focus().unsetAllMarks().clearNodes().run(),title:"清除格式"},React.createElement(pt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"撤销"},React.createElement(wt,{className:n})),React.createElement(rx,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"重做"},React.createElement(ht,{className:n}))))}function cx({value:t,onChange:n,readonly:r=!1,placeholder:o="请输入内容...",isTableMode:i=!1,hasError:s=!1,minHeight:a=120}){const l=Xg({extensions:[Hw,iw,Ww,Qw,nx.configure({multicolor:!0}),Cv.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),Vw.configure({types:["heading","paragraph"]}),Uw.configure({placeholder:o})],content:t||"",editable:!r,onUpdate:({editor:e})=>{n(e.getHTML())}});if(e.useEffect(()=>{l?.setEditable(!r)},[l,r]),e.useEffect(()=>{if(!l)return;if(l.isFocused)return;const e=l.getHTML(),n=t||"";("<p></p>"===e?"":e)!==n&&l.commands.setContent(n,{emitUpdate:!1})},[l,t]),r){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";return React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:t||""}})}const c=i?"w-full "+(s?"bg-red-100/90":"bg-white"):"w-full border rounded-md "+(s?"border-red-200 bg-red-50":"border-gray-300 bg-white focus-within:border-indigo-400 focus-within:ring-2 focus-within:ring-indigo-100");return React.createElement("div",{className:c},l&&React.createElement(lx,{editor:l}),React.createElement(Yg,{editor:l,className:"tiptap-editor rich-text-content overflow-hidden rounded-b-md",style:{minHeight:`${a}px`}}))}function ux(e){return e.filter(e=>"done"===e.status).map(e=>e.response?._id||e.uid).join(",")}function dx(e){const t=e.autoNumberPrefix||"",n=e.autoNumberSuffix||"",r=e.autoNumberPadding??4,o=e.autoNumberDateFormat??"YYYYMM",i="1".padStart(r,"0"),s=new Date;let a="";"YYYY"===o?a=`${s.getFullYear()}`:"YYYYMM"===o?a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}`:"YYYYMMDD"===o&&(a=`${s.getFullYear()}${String(s.getMonth()+1).padStart(2,"0")}${String(s.getDate()).padStart(2,"0")}`);const l=[t,a,i,n].filter(Boolean);return a?`${t}${a}-${i}${n}`:`${t}${i}${n}`||l.join("")}function hx({field:n,value:r,onChange:o,isTableMode:i=!1,hasError:s=!1,minimal:a=!1,onFillFields:l,formValues:c,formalTableMode:d=!1,historyApproves:h=[],previewMode:p=!1}){const[f,m]=e.useState(()=>{if(("file"===n.type||"image"===n.type)&&r){const e=String(r).split(",").map(e=>e.trim()).filter(Boolean),t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";if(e.length>0)return e.map(e=>({uid:e,name:e,status:"done",url:ls(e,void 0,t),response:{_id:e}}))}return[]});e.useEffect(()=>{if("file"!==n.type&&"image"!==n.type)return;const e=f.filter(e=>"done"===e.status&&e.name===e.uid).map(e=>e.uid);if(0===e.length)return;const t="image"===n.type?"cfs.images.filerecord":"cfs.files.filerecord";(async function(e,t="cfs.files.filerecord"){if(!e.length)return{};const n=t.replace(/\./g,"_");try{const t=await is.get(`/data/${n}`,{params:{filters:JSON.stringify(["_id","in",e]),fields:"_id,original",top:e.length,skip:0}}),r=t.data?.data||[],o={};for(const e of r)e._id&&e.original?.name&&(o[e._id]=e.original.name);return o}catch{return{}}})(e,t).then(e=>{0!==Object.keys(e).length&&m(r=>r.map(r=>{const o=e[r.uid];return o?{...r,name:o,url:ls(r.uid,o,t),..."image"===n.type?{thumbUrl:ls(r.uid,o,t)}:{}}:r}))})},[]);const[g,y]=e.useState(!1),[b,v]=e.useState(""),[w,x]=e.useState(!1),k=d?s?"bg-red-100/90 focus:bg-red-50":"bg-transparent focus:bg-blue-50/30":s?"bg-red-100/90 focus:bg-red-50":"bg-amber-50/80 focus:bg-amber-50",S=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(s?"border-red-200 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100"),E=n.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"",[M,C]=e.useState(null),R=e.useCallback(e=>{if(!e)return void C(null);const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);C(t?null:"邮箱格式不正确")},[]),O=e.useCallback(e=>{if(!e)return void C(null);const t=/^https?:\/\/.+/i.test(e);C(t?null:"链接格式不正确,需以 http:// 或 https:// 开头")},[]);if(n.readonly){const e=i?"w-full h-full px-2.5 py-2 text-[13px] text-gray-700 min-h-[34px]":"w-full border border-gray-200 rounded-md px-3 py-2 text-[13px] text-gray-700 min-h-[38px]";if("formula"===n.type||"approvalComments"===n.type);else{if("checkbox"===n.type)return React.createElement("label",{className:"flex items-center gap-2 py-1 "+(i?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===r,disabled:!0,readOnly:!0,className:"w-4 h-4 rounded border-gray-300 text-indigo-600"}),!i&&React.createElement("span",{className:"text-[13px] text-gray-500"},n.label));if("radio"===n.type)return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1")},(n.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-default text-[13px] "+(e.value===r?"text-gray-700":"text-gray-400")},React.createElement("input",{type:"radio",name:n._id,checked:r===e.value,disabled:!0,readOnly:!0,className:"w-4 h-4 text-indigo-600 border-gray-300"}),e.label)));if("select"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label||r||"")}if("file"===n.type)return 0===f.length?React.createElement("div",{className:e}):React.createElement("div",{className:`${e} flex flex-wrap gap-2`},f.map(e=>{const t=e.url||(e.response?._id?ls(e.response._id,e.name,"cfs.files.filerecord"):"");return t?React.createElement("a",{key:e.uid,href:t,target:"_blank",rel:"noopener noreferrer",className:"text-gray-900 hover:underline cursor-pointer text-[13px]",title:`下载 ${e.name}`},e.name):React.createElement("span",{key:e.uid,className:"text-gray-500 text-[13px]"},e.name)}));if("image"===n.type);else{if("member"===n.type||"memberMulti"===n.type)return React.createElement(Rs,{value:r,isTableMode:i});if("org"===n.type||"orgMulti"===n.type)return React.createElement(Ts,{value:r,isTableMode:i});if("lookup"===n.type);else{if("email"===n.type)return React.createElement("div",{className:e},r?React.createElement("a",{href:`mailto:${r}`,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:"发送邮件"},r):"");if("url"===n.type)return React.createElement("div",{className:e},r?React.createElement(React.Fragment,null,React.createElement("span",{role:"link",tabIndex:0,className:"text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",title:r,onClick:()=>x(!0),onKeyDown:e=>{"Enter"===e.key&&x(!0)}},r),React.createElement(t.Modal,{title:"即将离开当前页面",open:w,okText:"继续访问",cancelText:"取消",onOk:()=>{x(!1),window.open(r,"_blank","noopener,noreferrer")},onCancel:()=>x(!1)},React.createElement("p",{className:"text-gray-500 mb-2"},"您即将打开以下外部链接:"),React.createElement("p",{className:"break-all text-blue-600 bg-gray-50 rounded px-3 py-2 text-[13px] font-mono"},r))):"");if("password"===n.type)return React.createElement("div",{className:e},"••••••••");if("qrcode"!==n.type)return"autoNumber"===n.type?React.createElement("div",{className:`${e} flex items-center gap-1.5 text-gray-400`},React.createElement("span",null,r||dx(n))):"richtext"===n.type?React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:r||""}}):React.createElement("div",{className:e},r||"")}}}}switch(n.type){case"text":return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入",readOnly:n.readonly,maxLength:n.maxLength,className:`${S} ${E}`});case"email":case"url":{const e="email"===n.type,t=s||!!M,a=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${t?"bg-red-100/90 focus:bg-red-50":k}`:"w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition "+(t?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":"border-gray-300 bg-white focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100");return React.createElement("div",{className:"w-full"},React.createElement("input",{type:e?"email":"url",value:r,onChange:t=>{o(t.target.value),M&&(e?R(t.target.value):O(t.target.value))},onBlur:t=>{e?R(t.target.value):O(t.target.value)},placeholder:n.placeholder||(e?"请输入邮箱地址":"请输入链接地址"),readOnly:n.readonly,maxLength:n.maxLength,className:`${a} ${E}`}),M&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},M))}case"textarea":return React.createElement("textarea",{value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,maxLength:n.maxLength,rows:3,className:`${S} ${E} resize-none`});case"number":{const e=e=>{if(!n.thousandSeparator||""===e||void 0===e)return e;const t=Number(e);return isNaN(t)?e:null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN")};return n.thousandSeparator&&!n.readonly?React.createElement("input",{type:"text",defaultValue:e(r),key:`num-${n._id}-${r}`,onFocus:e=>{e.target.value=r},onBlur:t=>{const n=t.target.value.replace(/,/g,"");o(n),t.target.value=e(n)},placeholder:n.placeholder||"请输入数字",className:`${S}`}):React.createElement("input",{type:"number",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入数字",readOnly:n.readonly,min:n.min,max:n.max,step:n.precision?Math.pow(10,-n.precision):void 0,className:`${S} ${E}`})}case"date":return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.DatePicker,{value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:r?u(r):null,onChange:(e,t)=>o("string"==typeof t?t:""),disabled:n.readonly,placeholder:"选择日期时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.TimePicker,{value:r?u(r,"HH:mm"):null,onChange:(e,t)=>o("string"==typeof t?t:""),format:"HH:mm",disabled:n.readonly,placeholder:"选择时间",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.Select,{value:r||void 0,onChange:e=>o(e??""),disabled:n.readonly,placeholder:"请选择",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.Select,{mode:"multiple",value:r?Array.isArray(r)?r:String(r).split(",").filter(Boolean):[],onChange:e=>o(e.join(",")),disabled:n.readonly,placeholder:"请选择(多选)",className:"!w-full "+(i?"picker-table-mode":""),variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,minHeight:34,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1")},(n.options||[]).map(e=>React.createElement("label",{key:e.value,className:"flex items-center gap-1.5 cursor-pointer text-[13px] text-gray-700"},React.createElement("input",{type:"radio",name:n._id,value:e.value,checked:r===e.value,onChange:e=>o(e.target.value),disabled:n.readonly,className:"w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-200"}),e.label)),(!n.options||0===n.options.length)&&React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"));case"checkbox":return React.createElement("label",{className:"flex items-center gap-2 cursor-pointer py-1 "+(i?"px-2.5 py-2":"px-1")},React.createElement("input",{type:"checkbox",checked:"true"===r,onChange:e=>o(e.target.checked?"true":"false"),disabled:n.readonly,className:"w-4 h-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-200"}),!i&&React.createElement("span",{className:"text-[13px] text-gray-700"},n.label));case"file":{const e=!!n.multiple,r={fileList:f,multiple:e,maxCount:e?void 0:1,accept:n.accept||void 0,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await as(e);n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{m(e.fileList),o(ux(e.fileList))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(ux(t))}};return React.createElement(t.ConfigProvider,{locale:jr},i?React.createElement(t.Upload,{...r},React.createElement(t.Button,{size:"small",icon:React.createElement(Gn,null),disabled:n.readonly},n.readonly?"仅读":"上传文件")):React.createElement(t.Upload.Dragger,{...r},React.createElement("p",{className:"ant-upload-drag-icon"},React.createElement(Ln,null)),React.createElement("p",{className:"ant-upload-text text-[13px]"},n.readonly?"仅读模式":e?"点击或拖拽文件到此区域上传(可多选)":"点击或拖拽文件到此区域上传"),n.accept&&React.createElement("p",{className:"ant-upload-hint text-[11px]"},"支持格式: ",n.accept)))}case"image":{const e=!!n.pickerMultiple,r=async e=>{const t=e.url||e.thumbUrl||"";v(t),y(!0)},i={listType:"picture-card",fileList:f,accept:"image/*",multiple:e,maxCount:e?void 0:1,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await as(e,{collectionName:"cfs.images.filerecord"});n?.(t)}catch(o){const e=o instanceof Error?o.message:"未知错误";t.message.error(`上传失败: ${e}`),r?.(o instanceof Error?o:new Error(e))}},onChange:e=>{const t=e.fileList.map(e=>{if("done"===e.status&&e.response?._id&&!e.url){const t=ls(e.response._id,e.name,"cfs.images.filerecord");return{...e,url:t,thumbUrl:t}}return e});m(t),o(ux(t))},onRemove:e=>{const t=f.filter(t=>t.uid!==e.uid);m(t),o(ux(t))},onPreview:r};return React.createElement(t.ConfigProvider,{locale:jr},React.createElement(t.Upload,{...i},!n.readonly&&React.createElement("div",{className:"flex flex-col items-center justify-center"},React.createElement(Bn,null),React.createElement("span",{className:"text-[11px] mt-1"},"上传"))),b&&React.createElement(t.Image,{wrapperStyle:{display:"none"},preview:{visible:g,onVisibleChange:e=>{y(e),e||v("")}},src:b}))}case"member":return React.createElement(ws,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"memberMulti":return React.createElement(ws,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,valueFormat:n.valueFormat});case"org":return React.createElement(Ms,{value:r,onChange:o,multiple:!1,isTableMode:i,hasError:s,formalTableMode:d,pickerFillRules:n.pickerFillRules,onFillFields:l,valueFormat:n.valueFormat});case"orgMulti":return React.createElement(Ms,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,valueFormat:n.valueFormat});case"lookup":return React.createElement(hs,{field:n,value:r,onChange:o,onFillFields:l,isTableMode:i,hasError:s,formValues:c});case"formula":return React.createElement("div",{className:`${i?"overflow-hidden":"border border-gray-200 rounded-md bg-gray-50"} px-3 py-2 text-[13px] font-mono ${r.startsWith("#ERR")?"text-red-400 text-[11px]":r?"text-gray-800":"text-gray-400"} truncate`,title:r.startsWith("#ERR")?r:n.formula?`= ${n.formula}`:""},i?r.startsWith("#ERR")?r:r||"—":r||(n.formula?`= ${n.formula}`:"(自动计算)"));case"approvalComments":{const e=n.approvalCommentSteps||[];let t=Array.isArray(h)&&h.length?h:function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(r);return p&&0===t.length&&e.length>0&&(t=e.map(e=>({name:e.stepLabel||e.stepId||"审批步骤",type:"trace",judge:"",judgeValue:"approved",step_type:"sign",step_id:e.stepId,children:[{name:"",user_name:"张三",finish_date:"2026-03-14 10:30",judge:"已核准",judgeValue:"approved",opinion:e.defaultComment||"已审阅,同意。",type:"approve",approve_type:"",step_type:"sign",step_id:e.stepId}]}))),0===e.length?React.createElement("div",{className:(i?"px-2.5 py-2":"border border-dashed border-purple-300 rounded-md px-4 py-3")+" flex items-center gap-2 text-gray-400"},React.createElement(ct,{className:"w-4 h-4 shrink-0 text-purple-400"}),React.createElement("span",{className:"text-[12px]"},"审批意见(未绑定步骤)")):React.createElement("div",{className:(i?"":"border border-purple-200 rounded-md")+" bg-white overflow-hidden"},e.map((e,n)=>(()=>{const r=t.filter(t=>{const n=String(t?.step_id||""),r=String(t?.name||"");return n===e.stepId||r===e.stepLabel||r===e.stepId}).flatMap(e=>Array.isArray(e.children)?e.children:[]).filter(t=>{const n="cc"===t?.approve_type;return!(!e.showCirculateComments||!e.showHandlerComments)||(e.showCirculateComments?n:!!e.showHandlerComments&&!n)});if(0===r.length)return null;const o=t=>r.map((n,r)=>{const o=String(n?.user_name||""),i=function(e){if(!e)return"";const t=e.match(/<img[^>]*src=["']([^"']+)["'][^>]*>/i);return t?.[1]||""}(o),s=((a=o)?a.replace(/<img[^>]*>/gi,"").replace(/<[^>]+>/g,"").trim():"")||"审批人";var a;const l=(n?.opinion||"").trim()||e.defaultComment||"";return React.createElement("div",{key:`${n?.step_id||e.stepId||"step"}-${r}`,className:""+(t?"px-2 py-1.5":"px-2.5 py-2")},l&&React.createElement("p",{className:"text-[12px] text-gray-700 leading-snug break-words mb-1"},l),React.createElement("div",{className:"flex items-center gap-1.5 pl-3"},e.showSignature&&i?React.createElement("img",{src:i,alt:s,className:"max-w-[90px] max-h-[60px] object-contain"}):React.createElement("span",{className:"text-[12px] font-medium text-gray-600"},s),n?.finish_date&&React.createElement("span",{className:"text-[12px] text-gray-600 shrink-0"},String(n.finish_date).split(" ")[0])))});return i?React.createElement("div",{key:e.stepId||n,className:n>0?"border-gray-100":""},o(!0)):React.createElement("div",{key:e.stepId||n,className:""+(n>0?"border-gray-100":"")},o(!1))})()))}case"password":return React.createElement(t.Input.Password,{value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"请输入密码",readOnly:n.readonly,disabled:n.readonly,className:i?"picker-table-mode":"",variant:i?"borderless":"outlined",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%"}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:{}}}});case"richtext":return React.createElement(cx,{value:r,onChange:o,readonly:n.readonly,placeholder:n.placeholder||"请输入富文本内容...",isTableMode:i,hasError:s,formalTableMode:d});case"autoNumber":return React.createElement("div",{className:(i?"px-2.5 py-2 flex items-center gap-1.5":"border border-gray-200 rounded-md px-3 py-2 flex items-center gap-1.5")+" text-[13px] text-gray-400 bg-gray-50"},React.createElement("span",null,r||dx(n)));case"qrcode":return React.createElement("div",{className:(i?"px-2.5 py-2":"border border-gray-200 rounded-md px-3 py-3")+" flex flex-col items-center gap-2"},r?React.createElement(t.QRCode,{value:r,size:i?80:120}):React.createElement(t.QRCode,{value:"-",size:i?80:120,status:"expired"}),!n.readonly&&React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:n.placeholder||"输入二维码内容",className:`${S} mt-1`}));default:return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:"请输入",className:S})}}function px(e){const t=Number(e);if(isNaN(t)||!isFinite(t))return"";if(0===t)return"零元整";const n=t<0,r=Math.abs(t),o=Math.floor(r),i=Math.round(100*(r-o)),s=Math.floor(i/10),a=i%10,l=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],c=["","拾","佰","仟"],u=["","万","亿","兆"];function d(e){if(0===e)return"";let t="",n=!1;for(let r=3;r>=0;r--){const o=Math.floor(e/Math.pow(10,r))%10;0===o?t.length>0&&(n=!0):(n&&(t+="零",n=!1),t+=l[o]+c[r])}return t}let h=(function(e){if(0===e)return"";const t=[];let n=e;for(;n>0;)t.push(n%1e4),n=Math.floor(n/1e4);let r="";for(let o=t.length-1;o>=0;o--){const e=t[o];if(0===e)r.length>0&&!r.endsWith("零")&&(r+="零");else{const t=d(e);r.length>0&&e<1e3&&!r.endsWith("零")&&(r+="零"),r+=t+u[o]}}return r.replace(/零+$/,"")}(o)||"零")+"元";return 0===s&&0===a?h+="整":0===s?h+="零"+l[a]+"分":(h+=l[s]+"角",h+=a>0?l[a]+"分":"整"),(n?"负":"")+h}function fx(e){const t=[],n=e=>{Array.isArray(e)?e.forEach(n):t.push(e)};return e.forEach(n),t}function mx(e){if("number"==typeof e)return isFinite(e)?e:0;if(null==e||""===e)return 0;if("string"==typeof e){const t=e.replace(/,/g,"").trim();if(!t)return 0;const n=Number(t);return isNaN(n)||!isFinite(n)?0:n}const t=Number(e);return isNaN(t)||!isFinite(t)?0:t}u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn");const gx={SUM:(...e)=>fx(e).reduce((e,t)=>e+mx(t),0),AVG:(...e)=>{const t=fx(e);return t.length?t.reduce((e,t)=>e+mx(t),0)/t.length:0},AVERAGE:(...e)=>{const t=fx(e);return t.length?t.reduce((e,t)=>e+mx(t),0)/t.length:0},MAX:(...e)=>{const t=fx(e);return 0===t.length?0:Math.max(...t.map(mx))},MIN:(...e)=>{const t=fx(e);return 0===t.length?0:Math.min(...t.map(mx))},COUNT:(...e)=>fx(e).filter(e=>0!==e&&""!==e&&null!=e).length,ABS:e=>Math.abs(Number(e)),ROUND:(e,t=0)=>{const n=Math.pow(10,Number(t));return Math.round(Number(e)*n)/n},FLOOR:e=>Math.floor(Number(e)),CEIL:e=>Math.ceil(Number(e)),INT:e=>Math.trunc(Number(e)),MOD:(e,t)=>Number(e)%Number(t),POWER:(e,t)=>Math.pow(Number(e),Number(t)),SQRT:e=>Math.sqrt(Number(e)),IF:(e,t,n)=>e?t:n,AND:(...e)=>e.every(e=>!!e),OR:(...e)=>e.some(e=>!!e),NOT:e=>!e,ISNULL:e=>null==e||""===e,ISBLANK:e=>null==e||""===e,TODAY:()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},NOW:()=>(new Date).toISOString(),DATE:(e,t,n)=>new Date(Number(e),Number(t)-1,Number(n)).toISOString().split("T")[0],YEAR:e=>(e?new Date(e):new Date).getFullYear(),MONTH:e=>(e?new Date(e):new Date).getMonth()+1,DAY:e=>(e?new Date(e):new Date).getDate(),DATEDIF:(e,t,n)=>{if(!e||!t)return 0;const r=new Date(e),o=new Date(t),i=o.getTime()-r.getTime(),s=String(n).toUpperCase();return"D"===s?Math.floor(i/864e5):"M"===s?12*(o.getFullYear()-r.getFullYear())+(o.getMonth()-r.getMonth()):"Y"===s?o.getFullYear()-r.getFullYear():Math.floor(i/864e5)},DAYS:(e,t)=>t&&e?Math.floor((new Date(e).getTime()-new Date(t).getTime())/864e5):0,CONCAT:(...e)=>e.join(""),LEFT:(e,t)=>String(e).substring(0,Number(t)),RIGHT:(e,t)=>{const n=String(e);return n.substring(n.length-Number(t))},MID:(e,t,n)=>String(e).substring(Number(t)-1,Number(t)-1+Number(n)),LEN:e=>String(e).length,UPPER:e=>String(e).toUpperCase(),LOWER:e=>String(e).toLowerCase(),TRIM:e=>String(e).trim(),REPLACE:(e,t,n)=>String(e).split(String(t)).join(String(n)),FIND:(e,t)=>{const n=String(t).indexOf(String(e));return n>=0?n+1:0},TEXT:(e,t)=>{const n=String(t||"");if("rmb"===n.toLowerCase()||n.includes("[DBNum2]")||n.includes("DBNum2"))return px(e);const r=Number(e);if(isNaN(r))return String(e);if(n.includes(".")){const e=n.split(".")[1]?.length||0;return r.toFixed(e)}return String(r)},RMB:e=>px(e),CNY:e=>px(e)},yx=Object.keys(gx),bx=Object.values(gx);function vx(e,t){if(!e)return"";const n=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),r=[],o=[];for(const n of e){const i=t[n];if("string"!=typeof i||!i.trim())continue;let s;try{s=JSON.parse(i)}catch{continue}if(!Array.isArray(s)||0===s.length)continue;if(!s.every(e=>e&&"object"==typeof e&&!Array.isArray(e)))continue;const a=new Map;for(const e of s)Object.keys(e).forEach(t=>{a.has(t)||a.set(t,[]),a.get(t).push(e[t])});for(const[t,l]of a.entries()){e.includes(t)||r.includes(t)||(r.push(t),o.push(l));const i=`${n}_${t}`;e.includes(i)||r.includes(i)||(r.push(i),o.push(l))}}const i=e.map(e=>{const n=t[e];if(null==n||""===n)return 0;const r=Number(n);return isNaN(r)?n:r});return n.replace(/\$\{([^}]+)\}/g,(t,n)=>{try{const t=[],s=[],a=new Set([...yx,...e,...r]),l=n.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const e of l)a.has(e)||(a.add(e),t.push(e),s.push(0));const c=new Function(...yx,...e,...r,...t,`return (${n});`)(...bx,...i,...o,...s);return null==c?"":"number"==typeof c?isNaN(c)?"":isFinite(c)?String(Math.round(1e4*c)/1e4):"#ERR: 除以零":String(c)}catch(s){return`#ERR: ${s instanceof Error?s.message:String(s)}`}})}catch(r){const t=r instanceof Error?r.message:String(r);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function wx(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function xx({field:n,isTableMode:r=!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:a,onChange:l,fieldPermissions:c}){const u=n.children||[],d=e.useMemo(()=>c?u.filter(e=>"hidden"!==c[e.name]).map(e=>{const t=c[e.name];return"editable"===t?e:"readonly"===t?{...e,readonly:!0}:e}):u,[u,c]),h=void 0!==l,[p,f]=e.useState([{}]),m=h?wx(a).length>0?wx(a):[{}]:p,[g,y]=e.useState(a);h&&a!==g&&y(a);const b=e=>{h?l(JSON.stringify(e)):f(e)},v=null==n.maxRows||m.length<n.maxRows,w=m.length>1&&(null==n.minRows||m.length>n.minRows),x=d.filter(e=>"formula"===e.type&&e.formula),k=e=>{if(0===x.length)return e;let t={...e};for(const n of x){const e=vx(n.formula,t);t[n.name]!==e&&(t={...t,[n.name]:e})}return t},S=e.useMemo(()=>0===x.length?m:m.map(k),[m,x.map(e=>e.name+":"+e.formula).join(",")]),[E,M]=e.useState(null),[C,R]=e.useState({}),O=e.useCallback(e=>{M(e),R({...m[e]||{}})},[m]),T=e.useCallback((e,t)=>{R(n=>{const r={...n,[e]:t};return k(r)})},[k]),_=e.useCallback(()=>{if(null===E)return;const e=[...m];e[E]=k(C),b(e),M(null)},[E,C,m,b,k]),N=e.useCallback(()=>{M(null)},[]),A=r?"border-black":"border-gray-200",D=!!n.readonly,[$,L]=t.message.useMessage(),I=e.useMemo(()=>(n.children||[]).filter(e=>"formula"!==e.type&&!e.readonly).map(e=>e.name),[n.children]),j=e.useCallback(e=>{if(!e.trim())return[];const t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").filter(e=>e.trim());if(0===t.length)return[];const n=t[0].includes("\t")?"\t":",";return t.map(e=>{const t="\t"===n?e.split("\t"):function(e){const t=[];let n="",r=!1;for(let o=0;o<e.length;o++){const i=e[o];r?'"'===i?o+1<e.length&&'"'===e[o+1]?(n+='"',o++):r=!1:n+=i:'"'===i?r=!0:","===i?(t.push(n),n=""):n+=i}return t.push(n),t}(e),r={};return I.forEach((e,n)=>{n<t.length&&(r[e]=t[n].trim())}),r})},[I]),z=e.useCallback(e=>{if(D)return;const t=e.target?.tagName?.toLowerCase();if("input"===t||"textarea"===t||"select"===t)return;const r=e.clipboardData.getData("text/plain");if(!r?.trim())return;const o=j(r);if(0===o.length)return;e.preventDefault();const i=null!=n.maxRows?Math.max(0,n.maxRows-m.length):o.length;if(0===i)return void $.warning(`已达到最大行数 ${n.maxRows}`);const s=o.slice(0,i).map(k);b([...m,...s]),$.success(`已粘贴 ${s.length} 行数据`)},[D,j,m,n.maxRows,k,b,$]),P=e.useCallback(async()=>{if(!D)try{const e=await navigator.clipboard.readText();if(!e?.trim())return void $.info("剪贴板为空");const t=j(e);if(0===t.length)return void $.info("未解析到有效数据");const r=null!=n.maxRows?Math.max(0,n.maxRows-m.length):t.length;if(0===r)return void $.warning(`已达到最大行数 ${n.maxRows}`);const o=t.slice(0,r).map(k);b([...m,...o]),$.success(`已粘贴 ${o.length} 行数据`)}catch{$.error("无法读取剪贴板,请使用 Ctrl+V / ⌘+V 粘贴")}},[D,j,m,n.maxRows,k,b,$]);if(0===d.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const F=e.useMemo(()=>0===x.length?C:k(C),[C,x.map(e=>e.name+":"+e.formula).join(",")]),B=null!==E&&React.createElement(t.Modal,{open:!0,title:`${n.label} - 第 ${E+1} 行`,onCancel:N,onOk:_,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:N},"取消"),React.createElement(t.Button,{type:"primary",onClick:_},"确认")),width:"min(780px, 95vw)",destroyOnClose:!0,styles:{body:{maxHeight:"70vh",overflowY:"auto",padding:"16px 0 24px"}}},React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-5"},d.map(e=>{const t="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:t?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&!D&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(hx,{field:D?{...e,readonly:!0}:e,value:F[e.name]||"",onChange:t=>T(e.name,t),isTableMode:!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))})));return React.createElement("div",{className:r?"":"mt-1",onPaste:z},L,React.createElement("div",{className:r?(!1!==n.showLabel?"border-t border-black ":"")+"overflow-hidden":"border border-gray-300 rounded-md overflow-hidden"},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"w-full text-[13px]",style:{minWidth:d.length>3?120*d.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${A}`},!1!==n.showRowNumber&&React.createElement("th",{className:`w-10 px-2 py-2 text-center text-gray-500 font-medium border-r ${A} sticky left-0 bg-gray-50 z-[1]`},"#"),d.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${A} last:border-r-0 whitespace-nowrap`},e.label,e.required&&!e.readonly&&!D&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*"))),!D&&React.createElement("th",{className:"w-16 px-2 py-2 text-center text-gray-500 font-medium sticky right-0 bg-gray-50 z-[1]"},"操作"))),React.createElement("tbody",null,S.map((e,t)=>React.createElement("tr",{key:t,className:`border-b ${r?"border-black":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`},!1!==n.showRowNumber&&React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-400 text-[12px] border-r ${A} sticky left-0 bg-white z-[1]`},t+1),d.map(n=>React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${A} last:border-r-0 ${!r||n.readonly||D?"":"bg-amber-50/80"}`},React.createElement(hx,{field:D?{...n,readonly:!0}:n,value:e[n.name]||"",onChange:e=>((e,t,n)=>{const r=[...m];r[e]={...r[e],[t]:n},r[e]=k(r[e]),b(r)})(t,n.name,e),isTableMode:r,formalTableMode:!0,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s}))),!D&&React.createElement("td",{className:"px-1 py-1.5 text-center sticky right-0 bg-white z-[1]"},React.createElement("div",{className:"flex items-center justify-center gap-0.5"},React.createElement("button",{onClick:()=>O(t),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(lt,{className:"w-3 h-3"})),w&&React.createElement("button",{onClick:()=>{return e=t,void(w&&(b(m.filter((t,n)=>n!==e)),E===e?M(null):null!==E&&E>e&&M(E-1)));var e},className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(bt,{className:"w-3 h-3"}))))))))),!D&&React.createElement("div",{className:r?"border-t border-black":"border-t border-gray-100"},React.createElement("div",{className:"flex items-center gap-2 px-3 py-1.5"},v&&React.createElement("button",{onClick:()=>{v&&b([...m,{}])},className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition"},React.createElement(dt,{className:"w-3.5 h-3.5"})," 添加一行"),v&&React.createElement("button",{onClick:P,className:"flex items-center gap-1 text-[12px] text-gray-500 hover:text-indigo-600 smooth-transition",title:"从Excel或CSV粘贴数据(也可以直接 Ctrl+V / ⌘+V)"},React.createElement(Xe,{className:"w-3.5 h-3.5"})," 粘贴")))),B)}function kx(e,t){return`${e}_${t}`}function Sx({field:t,isTableMode:n=!1,formValues:r,onUpdateValue:o,onFillFields:i,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c,formMode:u="editable",compact:d=!1}){const h=t.gridRows||3,p=t.gridCols||4,f=t.gridData||[],m=t.children||[],g=e.useMemo(()=>"editable"!==u?m.map(e=>({...e,readonly:!0})):c?m.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):m,[m,c,u]),y=e.useMemo(()=>{const e=new Map;for(const t of g)e.set(t._id,t);return e},[g]),b=e.useMemo(()=>function(e){const t=new Set;for(const n of e){const e=n.rowspan||1,r=n.colspan||1;for(let o=0;o<e;o++)for(let e=0;e<r;e++)0===o&&0===e||t.add(kx(n.row+o,n.col+e))}return t}(f),[f]),v=e.useMemo(()=>{const e=f.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const n of e){t[kx(n.row,n.col)]=vx(n.value,r)}return t},[r,f]),w=n?"border-black":"border-gray-300",x=t.gridColumnWidths,k=!!t.gridScrollable||d;return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?""+(!1!==t.showLabel?"border-t border-black":""):`border ${w}`,style:n?{overflow:"hidden"}:void 0},React.createElement("div",{className:k?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(k?"table-fixed":""),style:{minWidth:k&&p>4?100*p+"px":void 0,...n?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:p},(e,t)=>React.createElement("col",{key:t,style:x?.[t]?{width:`${x[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:h},(e,t)=>React.createElement("tr",{key:t,className:""+(t<h-1?`border-b ${w}`:"")},Array.from({length:p},(e,d)=>{const h=kx(t,d);if(b.has(h))return null;const m=function(e,t,n){return e.find(e=>e.row===t&&e.col===n)}(f,t,d),g=m?.rowspan||1,x=m?.colspan||1,S=d+x>=p,E=m?.cellType||"input",M={textAlign:m?.align||("label"===E?"center":"left")};if(m?.color&&(M.color=m.color),m?.backgroundColor&&(M.backgroundColor=m.backgroundColor),m?.fontWeight&&(M.fontWeight=m.fontWeight),m?.borderStyle&&(M.borderStyle=m.borderStyle),"label"===E)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${S?"":`border-r ${w}`} ${m?.backgroundColor?"":"bg-white"} ${m?.color?"":"text-gray-600"} ${m?.fontWeight?"":"font-medium"}`,style:M},m?.value||"");if("formula"===E){const e=v[h]||"";return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`px-3 py-2 ${S?"":`border-r ${w}`} ${m?.backgroundColor?"":n?"bg-amber-50/50":""} ${m?.color?"":"text-gray-700"}`,style:k?{...M,maxWidth:0}:M},React.createElement("div",{className:k?"truncate":"",title:e},e))}const C=m?.fieldId?y.get(m.fieldId):null;if(!C&&!m?.fieldType)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(S?"":`border-r ${w}`),style:M}," ");if(C){if(C.hidden)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"px-3 py-2 "+(S?"":`border-r ${w}`),style:M}," ");const e=C.name,t=r[e]||C.defaultValue||"";if("table"===C.type)return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(S?"":`border-r ${w}`),style:M},React.createElement(xx,{field:C,isTableMode:n,value:t,onChange:t=>o(e,t),searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c}));const u=!C.readonly&&n?"bg-amber-50/80":"",h=C.required&&!C.readonly;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:`p-0 ${S?"":`border-r ${w}`} ${u} ${k?"overflow-hidden":""}`,style:k?{...M,maxWidth:0}:M},React.createElement("div",{className:"relative"},h&&React.createElement("span",{className:"absolute top-0.5 right-1 text-red-500 text-[10px] font-bold z-10"},"*"),React.createElement(hx,{field:C,value:t,onChange:t=>o(e,t),isTableMode:!0,formalTableMode:!0,searchUsersFn:s,searchOrgsFn:a,onFillFields:i,formValues:r})))}const R="editable"!==u;return React.createElement("td",{key:d,rowSpan:g>1?g:void 0,colSpan:x>1?x:void 0,className:"p-0 "+(S?"":`border-r ${w}`),style:M},React.createElement("input",{type:"number"===m?.fieldType?"number":"text",className:"w-full h-full px-3 py-2 text-[13px] bg-transparent outline-none "+(R?"cursor-not-allowed text-gray-500 bg-gray-50":"focus:bg-blue-50/50"),value:r[h]||"",onChange:e=>!R&&o(h,e.target.value),readOnly:R,placeholder:m?.fieldLabel||m?.value||""}))}))))))))}const Ex=e=>(e.colspan??6)>=12,Mx=e=>"section"===e||"table"===e||"grid"===e;const Cx=[{name:"indigo",label:"靛蓝",primary:"#6366f1",title:"#4338ca",bg:"#eef2ff",border:"#818cf8",desc:"#818cf8"},{name:"emerald",label:"翡翠绿",primary:"#10b981",title:"#047857",bg:"#ecfdf5",border:"#34d399",desc:"#6ee7b7"},{name:"amber",label:"琥珀",primary:"#f59e0b",title:"#92400e",bg:"#fffbeb",border:"#fbbf24",desc:"#fbbf24"},{name:"rose",label:"玫瑰红",primary:"#f43f5e",title:"#be123c",bg:"#fff1f2",border:"#fb7185",desc:"#fda4af"},{name:"sky",label:"天蓝",primary:"#0ea5e9",title:"#0369a1",bg:"#f0f9ff",border:"#38bdf8",desc:"#7dd3fc"},{name:"violet",label:"紫罗兰",primary:"#8b5cf6",title:"#6d28d9",bg:"#f5f3ff",border:"#a78bfa",desc:"#c4b5fd"},{name:"slate",label:"石板灰",primary:"#64748b",title:"#334155",bg:"#f8fafc",border:"#94a3b8",desc:"#94a3b8"},{name:"orange",label:"橙色",primary:"#f97316",title:"#c2410c",bg:"#fff7ed",border:"#fb923c",desc:"#fdba74"},{name:"teal",label:"青色",primary:"#14b8a6",title:"#0f766e",bg:"#f0fdfa",border:"#2dd4bf",desc:"#5eead4"}];function Rx(e){const t=e.replace("#","");return 3===t.length?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)}:6===t.length?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:null}function Ox(e,t,n){return"#"+[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function Tx(e,t){const n=Rx(e);return n?Ox(n.r+(255-n.r)*t,n.g+(255-n.g)*t,n.b+(255-n.b)*t):e}function _x(e,t){const n=Rx(e);return n?Ox(n.r*(1-t),n.g*(1-t),n.b*(1-t)):e}function Nx(e){if(e.sectionColor){const n={name:"custom",label:"自定义",primary:t=e.sectionColor,title:_x(t,.35),bg:Tx(t,.92),border:Tx(t,.35),desc:Tx(t,.35)};return{...n,title:e.titleColor||n.title}}var t;const n=Cx.find(t=>t.name===e.colorScheme)||Cx[0];return{...n,title:e.titleColor||n.title}}function Ax(e,t,n){if(!e?.length)return!1;const r=e.map(e=>function(e,t){const n=String(t[e.field]??"");switch(e.operator){case"eq":return n===e.value;case"neq":return n!==e.value;case"contains":return n.includes(e.value||"");case"notContains":return!n.includes(e.value||"");case"empty":return""===n;case"notEmpty":return""!==n;default:return!1}}(e,n));return"or"===(t||"and")?r.some(Boolean):r.every(Boolean)}function Dx({fields:e,columns:t=2,formValues:n,updateValue:r,fieldErrors:o,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,labelClassName:l,onFillFields:c,fieldPermissions:u,formMode:d="editable",resolveValue:h,historyApproves:p,previewMode:f}){const m=[];let g=0,y=0;if(e.forEach(e=>{const n=Mx(e.type),r=Ex(e),o=n||r?t:Math.min(e.tableColspan||1,t);if(g>0&&(n||r||g+o>t)){const e=t-g;e>0&&m.push({type:"empty",cs:e,key:"empty-"+y++}),g=0}m.push({type:"field",field:e}),n||r?g=0:(g+=o,g>=t&&(g=0))}),g>0){const e=t-g;e>0&&m.push({type:"empty",cs:e,key:"empty-"+y++})}const b={minWidth:0,backgroundColor:"#fff"};return React.createElement("div",{className:"border-2 border-black overflow-hidden workflow-form-v2-body",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:"#000"}},m.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...b,gridColumn:`span ${e.cs}`}});const{field:m}=e,g=Mx(m.type),y=Ex(m),v={gridColumn:`span ${g||y?t:Math.min(m.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===m.type){const e=Nx(m);return React.createElement("div",{key:m._id,style:{...v,backgroundColor:e.bg},"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} px-3 py-2`},React.createElement("div",{className:"flex items-center gap-2"},React.createElement("span",{className:"text-[13px] font-semibold",style:{color:e.title}},m.label)),m.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc},dangerouslySetInnerHTML:{__html:m.description}}))}if("table"===m.type){const e=!1!==m.showLabel&&(m.colorScheme||m.sectionColor)?Nx(m):null;return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},!1!==m.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(238,242,255,0.6)"}},React.createElement("span",{className:"text-[13px] font-semibold table-label",style:{color:e?.title||"#374151"}},m.label),m.required&&!m.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==m.showLabel&&m.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(238,242,255,0.6)"},dangerouslySetInnerHTML:{__html:m.description}}),React.createElement(xx,{field:m,isTableMode:!0,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,value:n[m.name],onChange:e=>r(m.name,e),fieldPermissions:u}))}if("grid"===m.type){const e=!1!==m.showLabel&&(m.colorScheme||m.sectionColor)?Nx(m):null;return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},!1!==m.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"rgba(240,253,250,0.6)"}},React.createElement("span",{className:"text-[13px] grid-label font-semibold",style:{color:e?.title||"#374151"}},m.label)),!1!==m.showLabel&&m.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#9ca3af",backgroundColor:e?.bg||"rgba(240,253,250,0.6)"},dangerouslySetInnerHTML:{__html:m.description}}),React.createElement(Sx,{field:m,isTableMode:!0,formValues:n,onUpdateValue:r,onFillFields:c,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,fieldPermissions:u,formMode:d}))}const w=!!o?.[m.name];return React.createElement("div",{key:m._id,style:v,"data-field-cell":"","data-field-type":m.type,"data-field-name":m.name,className:`field-cell field-cell-${m.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==m.showLabel&&React.createElement("div",{"data-field-label":"",className:Ue("field-label w-28 lg:w-32 shrink-0 border-r border-black px-2.5 py-2 flex items-center justify-center",w?"bg-red-50":"bg-gray-50/30",m.labelClassName||l)},React.createElement("span",{className:Ue("text-[13px] font-medium break-words text-center leading-snug",w?"text-red-700":"text-gray-600",m.labelClassName||l)},m.label),m.required&&!m.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:Ue("field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center",!m.readonly&&(w?"bg-red-100/90":"bg-amber-50/80"))},React.createElement(hx,{field:m,value:(h||Lx)(n[m.name]??m.defaultValue??""),onChange:e=>r(m.name,e),isTableMode:!0,hasError:w,searchUsersFn:i,searchOrgsFn:s,searchObjectFn:a,onFillFields:c,formValues:n,historyApproves:p,previewMode:f}),w&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},o[m.name]))))}))}function $x(e){if(!e)return"";if("__TODAY__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}if("__NOW__"===e){const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}if("__CURRENT_TIME__"===e){const e=new Date;return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}return"__CURRENT_USER__"===e||"__CURRENT_USER_ORG__"===e?e:e.includes("${")?vx(e,{}):e}function Lx(e){return e&&"string"==typeof e&&e.includes("${")?$x(e):e}function Ix(e){if(!e)return"";try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0");return`${n}-${r}-${String(t.getDate()).padStart(2,"0")}`}catch{return e}}const jx=e.forwardRef(({fields:n,values:r,onChange:o,onSubmit:i,formName:s,viewMode:a="form",readOnly:l=!1,formMode:c="editable",fieldPermissions:u,formEvents:d,showButtons:h=!0,searchUsersFn:p,searchOrgsFn:f,tableColumns:m=2,searchObjectFn:g,className:y,labelClassName:b,onUpdateField:v,compact:w=!1,showFormName:x=!0,currentUser:k,state:S="draft",submitDate:E,context:M,currentStep:C={},historyApproves:R=[],previewMode:_=!1,formColumns:N=2},A)=>{const[D,$]=t.message.useMessage(),L=e.useCallback(e=>{const t=Lx(e||"");return"__CURRENT_USER__"===t?k?.user||"":"__CURRENT_USER_ORG__"===t?k?.organization?._id||"":t},[k?.user,k?.organization?._id]),I=e.useMemo(()=>{const e=k?.organization;if(e?._id)return{id:e._id,name:e.name||"",fullname:e.fullname||""}},[k?.organization]),j=e.useMemo(()=>n.map(e=>{const t=e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:$x(e.defaultValue)}:e;if(t.children?.length){const e=t.children.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:$x(e.defaultValue)}:e);return{...t,children:e}}return t}),[n.map(e=>`${e.name}:${e.defaultValue??""}:${(e.children||[]).map(e=>`${e.name}:${e.defaultValue??""}`).join(",")}`).join("|")]),z=l||"readonly"===c||"print"===c,P=z?"print"===c?"print":"readonly":c,F=e.useMemo(()=>j.map(e=>{if(z)return{...e,readonly:!0};if(!u)return e;const t=u[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}),[j,u,z]);console.log("FormRenderer externalValues",r);const B=e.useMemo(()=>{const e={_id:"__applicant__system",name:"__applicant",label:"申请人",type:"member",required:!1,readonly:"draft"!==S,hidden:!1,pickerMultiple:!1,defaultValue:k?.user,valueFormat:"string"};return F.some(e=>"__applicant"===e.name)?F:[...F,e]},[F,k,S]),[H,V]=e.useState(()=>{const e={};for(const t of n){if(t.defaultValue){const n=$x(t.defaultValue);"__CURRENT_USER__"===n?k?.user&&(e[t.name]=k.user):"__CURRENT_USER_ORG__"===n?k?.organization?._id&&(e[t.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[t.name]=n}if(t.children?.length)for(const n of t.children)if(n.defaultValue){const t=$x(n.defaultValue);"__CURRENT_USER__"===t?k?.user&&(e[n.name]=k.user):"__CURRENT_USER_ORG__"===t?k?.organization?._id&&(e[n.name]={id:k.organization._id,name:k.organization.name||"",fullname:k.organization.fullname||""}):e[n.name]=t}}return{...e,...r||{}}}),[U,q]=e.useState({}),W=e.useRef(H);e.useEffect(()=>{W.current=H},[H]),e.useEffect(()=>{V(e=>{const t={};for(const n of j){if(n.defaultValue&&null==e[n.name]){const e=n.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[n.name]=k.user):"__CURRENT_USER_ORG__"===e?I&&(t[n.name]=I):t[n.name]=e}if(n.children?.length)for(const r of n.children)if(r.defaultValue&&null==e[r.name]){const e=r.defaultValue;"__CURRENT_USER__"===e?k?.user&&(t[r.name]=k.user):"__CURRENT_USER_ORG__"===e?I&&(t[r.name]=I):t[r.name]=e}}return Object.keys(t).length>0?{...e,...t}:e})},[j,k?.user,I]);const Y=e.useRef("");e.useEffect(()=>{if(!r)return;const e=JSON.stringify(r);e!==Y.current&&(Y.current=e,V(e=>{const t={...e};let n=!1;for(const[o,i]of Object.entries(r)){const e=L(i);t[o]!==e&&(t[o]=e,n=!0)}return n?t:e}))},[r,L]);const J=e.useMemo(()=>{const e=String(C?.name??"");return{...H,stepName:e}},[H,C]),K=B.filter(e=>!e.hidden&&(!e.visibilityRules?.length||Ax(e.visibilityRules,e.visibilityLogic,J))).map(e=>{let t=e;if(t.requiredRules?.length){const e=Ax(t.requiredRules,t.requiredLogic,J);e!==t.required&&(t={...t,required:t.required||e})}if(["table","grid"].includes(t.type)&&t.children?.length){const n=t.children.filter(e=>!e.hidden&&(!e.visibilityRules?.length||Ax(e.visibilityRules,e.visibilityLogic,J))).map(e=>{if(!e.requiredRules?.length)return e;const t=Ax(e.requiredRules,e.requiredLogic,J);return t!==e.required?{...e,required:e.required||t}:e});t=t===e?{...e,children:n}:{...t,children:n}}return t}),G=function(e,t=2){const n=[];let r=[],o=0;for(const i of e)if(!i.hidden)if(Ex(i)||Mx(i.type))r.length&&(n.push(r),r=[],o=0),n.push([i]);else{const e=Math.min(i.tableColspan||1,t);o+e>t&&(r.length&&(n.push(r),r=[]),o=0),r.push(i),o+=e,o>=t&&(n.push(r),r=[],o=0)}return r.length&&n.push(r),n}(K,"table"===a?m:N),Z=[...B.filter(e=>"formula"===e.type&&e.formula),...B.filter(e=>["grid","table"].includes(e.type)&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...H};for(const n of Z){const r=vx(n.formula,H);t[n.name]!==r&&(t[n.name]=r,e=!0)}e&&(V(t),o?.(t))},[H,Z.map(e=>e.name+":"+e.formula).join(",")]);const Q=e.useRef(!1);e.useEffect(()=>{if(Q.current)return;if(!d?.onInit)return;Q.current=!0;const e=O(W.current,(e,t)=>{V(n=>{const r={...n,[e]:t};return o?.(r),r})},B,v,D,M,C);T(d.onInit,{form:e,fields:B,values:W.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[d?.onInit]);const X=e.useMemo(()=>{const e=[];for(const t of K)"grid"===t.type&&t.children?.length?e.push(...t.children):e.push(t);return e},[K]);e.useImperativeHandle(A,()=>({getValues:()=>{const e={};return X.forEach(t=>{e[t.name]=H[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={};if(X.forEach(n=>{const r=H[n.name]??n.defaultValue??"";if(n.required&&!n.readonly&&!r){const r=`${n.label} 不能为空`;e.push(r),t[n.name]=r}}),q(t),e.length>0){const e=X.find(e=>t[e.name]);e&&setTimeout(()=>{const t=document.querySelector(`[data-field-name="${e.name}"]`);t?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}}}),[H,X,q]);const ee=e.useCallback((e,t)=>{q(t=>{if(!t[e])return t;const n={...t};return delete n[e],n}),V(n=>{const r={...n,[e]:t};return o?.(r),r})},[o]),te=e.useCallback((e,t)=>{const n=W.current[e]||"";if(ee(e,t),d?.onValueChange){let r=B.find(t=>t.name===e);if(!r)for(const t of B)if(t.children){const n=t.children.find(t=>t.name===e);if(n){r=n;break}}const o={...W.current,[e]:t},i=O(o,ee,B,v,D,M,C);T(d.onValueChange,{field:r?{name:r.name,label:r.label,type:r.type}:{name:e},value:t,oldValue:n,form:i,values:o,fields:B}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[d?.onValueChange,B,ee,v,D,M,C]),ne=e.useCallback(e=>{q(t=>{const n=Object.keys(e);if(n.every(e=>!t[e]))return t;const r={...t};for(const e of n)delete r[e];return r}),V(t=>{const n={...t,...e};return o?.(n),n})},[o]),re=e.useCallback(async()=>{if(d?.onSubmit){const t=O(W.current,ee,B,v,D,M,C);try{if(!1===await T(d.onSubmit,{form:t,values:{...W.current},fields:B}))return}catch(e){return void console.error("[FormRenderer] onSubmit error:",e)}}i?.(W.current)},[d?.onSubmit,B,ee,v,D,M,C,i]);if(0===B.length)return React.createElement("div",{className:`h-full flex items-center justify-center ${y||""}`},$,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===a){const e=K.filter(e=>"__applicant__system"!==e._id),t=K.find(e=>"__applicant__system"===e._id),n=t?U[t.name]:void 0;return React.createElement("div",{className:`p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===P?"workflow-form-print":""} ${y||""}`},$,React.createElement("div",{className:"mx-auto"},x&&s&&React.createElement("div",{className:"mb-4 text-center"},React.createElement("h2",{className:"text-xl font-bold text-gray-800"},s)),React.createElement(Dx,{fields:e,columns:m,formValues:H,updateValue:te,fieldErrors:U,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,labelClassName:b,onFillFields:ne,fieldPermissions:u,formMode:P,resolveValue:L,historyApproves:R,previewMode:_}),t&&React.createElement("div",{className:"flex items-center","data-field-name":t.name},React.createElement("div",{className:"flex items-center",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},t.label,t.required&&!t.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(hx,{field:t,value:L(H[t.name]??t.defaultValue??""),onChange:e=>te(t.name,e),hasError:!!n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:_,minimal:!0})),n&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 ml-2 flex items-center gap-1"},React.createElement("span",null,"⚠"),n)),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center justify-end ml-4",style:{width:"50%"}},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Ix(E))))))}return React.createElement("div",{className:`h-full overflow-y-auto custom-scrollbar ${w?"bg-white":"bg-gray-50/50"} ${"print"===P?"workflow-form-print":""} ${y||""}`},$,React.createElement("div",{className:w?"px-3 py-3":"p-6 max-w-3xl mx-auto"},x&&s&&React.createElement("div",{className:w?"mb-3 text-center":"mb-6 text-center"},React.createElement("h2",{className:w?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},s)),React.createElement("div",{className:w?"":"bg-white rounded-xl border border-gray-200 shadow-sm p-6"},React.createElement("div",{className:w?"space-y-3":"grid gap-x-6 gap-y-5",style:w?void 0:{gridTemplateColumns:`repeat(${N}, minmax(0, 1fr))`}},G.map((e,t)=>{const n=e[0];if("section"===n.type){const e=Nx(n);return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${N}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement("h3",{className:(w?"text-[13px]":"text-[15px]")+" font-semibold",style:{color:n.titleColor||e.title}},n.label)),n.description&&React.createElement("div",{className:"text-[12px] ml-6",style:{color:e.desc},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement("div",{className:w?"mt-1 mb-1":"mt-2 mb-1",style:{borderBottom:`2px solid ${e.border}`}}))}if("table"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?Nx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${N}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label),n.required&&!n.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(xx,{field:n,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,value:H[n.name],onChange:e=>te(n.name,e),fieldPermissions:u}))}if("grid"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?Nx(n):null;return React.createElement("div",{key:t,className:"",style:w?void 0:{gridColumn:`span ${N}`}},!1!==n.showLabel&&React.createElement("div",{className:"flex items-center gap-2 mb-2"},React.createElement("label",{className:"text-[13px] font-medium",style:{color:e?.title||"#374151"}},n.label)),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#9ca3af"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Sx,{field:n,formValues:H,onUpdateValue:te,onFillFields:ne,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,fieldPermissions:u,formMode:P,compact:w}))}return e.map(e=>{const t=Ex(e)||Mx(e.type),n=!1!==e.showLabel&&"checkbox"!==e.type,r=U[e.name],o="__applicant__system"===e._id;return React.createElement("div",{key:e._id,"data-field-name":e.name,className:"",style:w?void 0:t?{gridColumn:`span ${N}`}:void 0},o&&w?React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"[&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(hx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:_,minimal:!0})),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r),"draft"!==S&&E&&React.createElement(React.Fragment,null,React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1 mt-3"},"提交日期"),React.createElement("span",{className:"block text-[13px] text-gray-800"},Ix(E)))):o?React.createElement("div",{className:"flex items-center gap-2",style:{gridColumn:`span ${N}`}},React.createElement("div",{className:"flex items-center flex-1 min-w-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 shrink-0 mr-2"},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement("div",{className:"flex-1 min-w-0 [&_input]:!border-0 [&_input]:!shadow-none [&_input]:!outline-none [&_input]:!ring-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(hx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:_,minimal:!0}))),"draft"!==S&&E&&React.createElement("div",{className:"flex items-center shrink-0"},React.createElement("label",{className:"text-[13px] font-medium text-gray-700 mr-2"},"提交日期"),React.createElement("span",{className:"text-[13px] text-gray-800"},Ix(E))),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 flex items-center gap-1 w-full"},React.createElement("span",null,"⚠"),r)):React.createElement(React.Fragment,null,n&&React.createElement("label",{className:`block text-[13px] font-medium ${r?"text-red-600":"text-gray-700"} ${w?"mb-1":"mb-1.5"}`},e.label,e.required&&!e.readonly&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),n&&e.description&&React.createElement("p",{className:"text-[11px] text-gray-400 "+(w?"mb-1":"mb-1.5")},e.description),React.createElement(hx,{field:e,value:L(H[e.name]??e.defaultValue??""),onChange:t=>te(e.name,t),hasError:!!r,searchUsersFn:p,searchOrgsFn:f,searchObjectFn:g,onFillFields:ne,formValues:H,historyApproves:R,previewMode:_}),r&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 rounded px-2 py-0.5 mt-1 flex items-center gap-1"},React.createElement("span",null,"⚠"),r)))})})),h&&"editable"===P&&React.createElement("div",{className:(w?"mt-4 pt-3":"mt-8 pt-5")+" border-t border-gray-100 flex justify-end gap-3"},React.createElement("button",{className:`rounded-md border border-gray-300 bg-white ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-gray-700 hover:bg-gray-50 smooth-transition`},"取消"),React.createElement("button",{onClick:re,className:`rounded-md bg-indigo-600 ${w?"px-4 py-1.5":"px-5 py-2"} text-[13px] font-medium text-white hover:bg-indigo-700 smooth-transition`},"提交")))))}),zx={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:(e,t)=>"W"===t?e+"周":e+"日",weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:(e,t)=>{const n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1100?"上午":n<1300?"中午":n<1800?"下午":"晚上"}};function Px(e,t){const n={...e};for(const r of t)if("table"===r.type){const e=n[r.name];if("string"==typeof e)if(""===e)n[r.name]=[];else try{const t=JSON.parse(e);n[r.name]=Array.isArray(t)?t:[]}catch{n[r.name]=[]}else Array.isArray(e)||(n[r.name]=[])}return n}!function(){const e=window.dayjs;e&&"function"==typeof e.extend&&(e.extend(p),e.extend(g),e.extend(v),e.locale(zx,null,!0),e.locale("zh-cn")),u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn")}(),function(){if("undefined"==typeof amisRequire)return void console.error("[workflow-form-v2] amisRequire is not defined. Make sure the amis SDK is loaded first.");const e=amisRequire("react"),t=amisRequire("amis");t?.Renderer?(t.Renderer({type:"workflow-form-v2",autoVar:!0})(function(n){const{$schema:r,data:o,dispatchEvent:i,currentUser:s,state:a,submit_date:l,currentStep:c}=n,u=t.ScopedContext,d=e.useContext(u),h=e.useRef(null),p={getValues:()=>Px(h.current?.getValues()||y,m),validate:async()=>{const e=await(h.current?h.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid}},f=e.useRef(null);null===f.current?f.current={...p}:Object.assign(f.current,p),Object.defineProperty(f.current,"props",{get:()=>n,configurable:!0}),e.useEffect(()=>{if(d&&(r.id||n.id))return d.registerComponent(f.current),()=>{d.unRegisterComponent(f.current)}},[r.id||n.id]);let m=[];Array.isArray(r.fields)?m=r.fields:"string"==typeof r.fields&&o&&(m=o[r.fields.replace(/^\$\{|\}$/g,"")]||[]),!m.length&&Array.isArray(o?.fields)&&(m=o.fields);let g={};r.values&&"object"==typeof r.values?g=r.values:"string"==typeof r.values&&o&&(g=o[r.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(g).length&&o?.values&&"object"==typeof o.values&&(g=o.values);const y=e.useMemo(()=>function(e){const t={};for(const[n,r]of Object.entries(e))Array.isArray(r)?r.length>0&&"object"==typeof r[0]&&r[0]?.id?t[n]=r:t[n]=JSON.stringify(r):"object"==typeof r&&null!==r&&r.id?t[n]=r:t[n]=null==r?"":String(r);return t}(g),[JSON.stringify(g)]),[b,v]=e.useState(!1);e.useEffect(()=>{const e=()=>{v(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const w=b?"form":r.viewMode||"form",x=b?1:r.tableColumns||2,k=r.layout??r.formColumns,S=b||"single"===k?1:"double"===k?2:Math.min(Math.max(Number(k)||2,1),3),E=r.readOnly??r.static??!1,M=r.formMode||"editable",R=r.formName||o?.formName||"",O=r.showButtons??!0,T=!!b||(r.compact??!1),_=r.showFormName??!0,N=r.formEvents;let A,D=[];Array.isArray(r.historyApproves)?D=r.historyApproves:"string"==typeof r.historyApproves&&o&&(D=o[r.historyApproves.replace(/^\$\{|\}$/g,"")]||[]),Array.isArray(D)&&0!==D.length||!Array.isArray(o?.historyApproves)||(D=o.historyApproves),"editable"===M&&(r.fieldPermissions&&"object"==typeof r.fieldPermissions?A=r.fieldPermissions:"string"==typeof r.fieldPermissions&&o&&(A=o[r.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!A&&o?.fieldPermissions&&(A=o.fieldPermissions));const $=r.apiBaseUrl||o?.context?.rootUrl||o?.rootUrl||"",L=r.authToken||o?.context?.authToken||o?.authToken||"",I=r.spaceId||o?.context?.spaceId||o?.spaceId||"",j=e.useCallback(async e=>{if(!$)return[];try{const t=`${$}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${I},${L}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e.user||e._id,label:e.name||e.label||"",description:e.mobile||""}))}catch(t){return console.warn("[workflow-form-v2] searchUsers error:",t),[]}},[$,L,I]),z=e.useCallback(async e=>{if(!$)return[];try{const t=`${$}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${I},${L}`}}),r=await n.json();return(r?.value||r?.data||r||[]).map(e=>({_id:e._id,label:e.name||e.label||"",description:e.fullname||""}))}catch(t){return console.warn("[workflow-form-v2] searchOrgs error:",t),[]}},[$,L,I]),P=e.useCallback((e,t)=>async n=>{if(!$||!e)return[];try{const r=n?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(n)}')`:"",o=`${$}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${r}`,i=await fetch(o,{headers:{Authorization:`Bearer ${I},${L}`}}),s=await i.json();return(s?.value||s?.data||s||[]).map(e=>({_id:e._id,label:e[t]||e.name||e._id,description:""}))}catch(r){return console.warn("[workflow-form-v2] searchObject error:",r),[]}},[$,L,I]),F={props:n,getValues:p.getValues,validate:p.validate};return e.createElement(jx,{fields:m,values:y,ref:h,onChange:e=>{const t=Px(e,m);i?.("change",t?C(o,{value:t}):o,F)},onSubmit:e=>{const t=Px(e,m);i?.("submit",t?C(o,{value:t}):o,F)},formName:R,viewMode:w,tableColumns:x,formColumns:S,readOnly:E,formMode:M,fieldPermissions:A,formEvents:N,showButtons:O,compact:T,showFormName:_,searchUsersFn:j,searchOrgsFn:z,searchObjectFn:P,currentUser:s,state:a,submitDate:l,currentStep:c||r.currentStep||{},historyApproves:Array.isArray(D)?D:[],className:["workflow-form-v2",n.className].filter(Boolean).join(" ")})}),console.log("[workflow-form-v2] amis Renderer registered successfully.")):console.error("[workflow-form-v2] amis.Renderer not found.")}()}(amisRequire("react"),antd,amisRequire("react-dom"));
|