@steedos-labs/plugin-workflow 3.0.85 → 3.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
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",p="date",f="Invalid Date",h=/^(\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:p,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(h);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()===f)},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),f=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)},h=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?f(1,0):f(31,11);case c:return r?f(1,g):f(0,g+1);case l:var v=this.$locale().weekStart||0,w=(m<v?m+7:m)-v;return f(r?y-w:y+(6-w),g);case a:case p:return h(b+"Hours",0);case s:return h(b+"Minutes",1);case i:return h(b+"Seconds",2);case o:return h(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":""),f=(n={},n[a]=u+"Date",n[p]=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],h=l===a?this.$D+(t-this.$W):t;if(l===c||l===d){var m=this.clone().set(p,1);m.$d[f](h),m.init(),this.$d=m.set(p,Math.min(this.$D,m.daysInMonth())).$d}else f&&this.$d[f](h);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 p,f=this;r=Number(r);var h=M.p(u),m=function(e){var t=E(f);return M.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===a)return m(1);if(h===l)return m(7);var g=(p={},p[i]=t,p[s]=n,p[o]=e,p)[h]||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||f;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)},p=function(e){return M.s(i%12||12,e,"0")},h=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 p(1);case"hh":return p(2);case"a":return h(i,s,!0);case"A":return h(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,p,f){var h,m=this,g=M.p(p),y=E(r),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,w=function(){return M.m(m,y)};switch(g){case d:h=w()/12;break;case c:h=w();break;case u:h=w()/3;break;case l:h=(v-b)/6048e5;break;case a:h=(v-b)/864e5;break;case s:h=v/n;break;case i:h=v/t;break;case o:h=v/e;break;default:h=v}return f?h:M.a(h)},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}(),_=C.prototype;return E.prototype=_,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",d],["$D",p]].forEach(function(e){_[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,p={exports:{}};const f=s((d||(d=1,p.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")}}),p.exports));var h,m={exports:{}};const g=s((h||(h=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},p={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 f(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=p[c],d=u&&u[0],f=u&&u[1];i[l]=f?{regex:d,parser:f}: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=f(t)(e),i=o.year,s=o.month,a=o.day,l=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,p=o.zone,h=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 p?new Date(Date.UTC(y,b,g,w,x,k,S+60*p.offset*1e3)):n?new Date(Date.UTC(y,b,g,w,x,k,S)):(v=new Date(y,b,g,w,x,k,S),h&&(v=r(v).week(h).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 p=a.length,h=1;h<=p;h+=1){i[1]=a[h-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}h===p&&(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}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,p=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",a]],f="[object Arguments]",h="[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]",_="[object Set]",N="[object String]",R="[object Symbol]",O="[object WeakMap]",T="[object ArrayBuffer]",A="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",L="[object Int8Array]",j="[object Int16Array]",I="[object Int32Array]",z="[object Uint8Array]",P="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",H=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(U.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,pe=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,he=/^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",_e="\\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="['’]",Re="["+xe+"]",Oe="["+_e+"]",Te="["+ke+"]",Ae="\\d+",De="["+Se+"]",$e="["+Ee+"]",Le="[^"+xe+_e+Ae+Se+Ee+Me+"]",je="\\ud83c[\\udffb-\\udfff]",Ie="[^"+xe+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Me+"]",Be="\\u200d",He="(?:"+$e+"|"+Le+")",Ve="(?:"+Fe+"|"+Le+")",qe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Te+"|"+je+")?",Ye="["+Ce+"]?",Je=Ye+We+"(?:"+Be+"(?:"+[Ie,ze,Pe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,ze,Pe].join("|")+")"+Je,Ge="(?:"+[Ie+Te+"?",Te,ze,Pe,Re].join("|")+")",Ze=RegExp(Ne,"g"),Qe=RegExp(Te,"g"),Xe=RegExp(je+"(?="+je+")|"+Ge+Je,"g"),et=RegExp([Fe+"?"+$e+"+"+qe+"(?="+[Oe,Fe,"$"].join("|")+")",Ve+"+"+Ue+"(?="+[Oe,Fe+He,"$"].join("|")+")",Fe+"?"+He+"+"+qe,Fe+"+"+Ue,"\\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[j]=it[I]=it[z]=it[P]=it[F]=it[B]=!0,it[f]=it[h]=it[T]=it[m]=it[A]=it[g]=it[y]=it[b]=it[w]=it[x]=it[k]=it[C]=it[_]=it[N]=it[O]=!1;var st={};st[f]=st[h]=st[T]=st[A]=st[m]=st[g]=st[D]=st[$]=st[L]=st[j]=st[I]=st[w]=st[x]=st[k]=st[C]=st[_]=st[N]=st[R]=st[z]=st[P]=st[F]=st[B]=!0,st[y]=st[b]=st[O]=!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,pt=ut||dt||Function("return this")(),ft=E&&!E.nodeType&&E,ht=ft&&S&&!S.nodeType&&S,mt=ht&&ht.exports===ft,gt=mt&&ut.process,yt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||gt&&gt.binding&&gt.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 _t(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Nt(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 Rt(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 Ot(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function Tt(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 jt(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 It=qt("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 qt(t){return function(n){return null==n?e:n[t]}}function Ut(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,pn(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=Ut({"À":"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=Ut({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});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):It(e)}function dn(e){return on(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function pn(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var fn=Ut({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function i(S){var E,oe=(S=null==S?pt:hn.defaults(pt.Object(),S,hn.pick(pt,rt))).Array,xe=S.Date,ke=S.Error,Se=S.Function,Ee=S.Math,Me=S.Object,Ce=S.RegExp,_e=S.String,Ne=S.TypeError,Re=oe.prototype,Oe=Se.prototype,Te=Me.prototype,Ae=S["__core-js_shared__"],De=Oe.toString,$e=Te.hasOwnProperty,Le=0,je=(E=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",Ie=Te.toString,ze=De.call(Me),Pe=pt._,Fe=Ce("^"+De.call($e).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=mt?S.Buffer:e,He=S.Symbol,Ve=S.Uint8Array,qe=Be?Be.allocUnsafe:e,Ue=an(Me.getPrototypeOf,Me),We=Me.create,Ye=Te.propertyIsEnumerable,Je=Re.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!==pt.clearTimeout&&S.clearTimeout,ut=xe&&xe.now!==pt.Date.now&&xe.now,dt=S.setTimeout!==pt.setTimeout&&S.setTimeout,ft=Ee.ceil,ht=Ee.floor,gt=Me.getOwnPropertySymbols,yt=Be?Be.isBuffer:e,It=S.isFinite,Ut=Re.join,mn=an(Me.keys,Me),gn=Ee.max,yn=Ee.min,bn=xe.now,vn=S.parseInt,wn=Ee.random,xn=Re.reverse,kn=ui(S,"DataView"),Sn=ui(S,"Map"),En=ui(S,"Promise"),Mn=ui(S,"Set"),Cn=ui(S,"WeakMap"),_n=ui(Me,"create"),Nn=Cn&&new Cn,Rn={},On=Pi(kn),Tn=Pi(Sn),An=Pi(En),Dn=Pi(Mn),$n=Pi(Cn),Ln=He?He.prototype:e,jn=Ln?Ln.valueOf:e,In=Ln?Ln.toString:e;function zn(e){if(na(e)&&!Us(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 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 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 Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Un;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new qn(e);this.size=t.size}function Jn(e,t){var n=Us(e),r=!n&&qs(e),o=!n&&!r&&Ks(e),i=!n&&!r&&!o&&ua(e),s=n||r||o||i,a=s?Jt(e.length,_e):[],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(No(e),ir(t,0,e.length))}function Zn(e){return Di(No(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&&Ro(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:_a(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=Us(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 No(t,a)}else{var p=fi(t),h=p==b||p==v;if(Ks(t))return ko(t,l);if(p==k||p==f||h&&!i){if(a=c||h?{}:mi(t),!l)return c?function(e,t){return Ro(e,pi(e),t)}(t,function(e,t){return e&&Ro(t,Da(t),e)}(a,t)):function(e,t){return Ro(e,di(e),t)}(t,nr(a,t))}else{if(!st[p])return i?t:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case T: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 j:case I:case z:case P:case F:case B:return Eo(e,n);case w:return new o;case x:case N:return new o(e);case C:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case _:return new o;case R:return r=e,jn?Me(jn.call(r)):{}}}(t,p,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 Ne(t);return Ri(function(){n.apply(e,o)},r)}function cr(e,t,n,r){var o=-1,i=Ot,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=At(t,Gt(n))),r?(i=Tt,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 p=c;p--;)if(t[p]===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__=_n?_n(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(_n){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 _n?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]=_n&&r===e?n:r,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.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))},qn.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},qn.prototype.has=function(e){return er(this.__data__,e)>-1},qn.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},Un.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(Sn||qn),string:new Vn}},Un.prototype.delete=function(e){var t=li(this,e).delete(e);return this.size-=t?1:0,t},Un.prototype.get=function(e){return li(this,e).get(e)},Un.prototype.has=function(e){return li(this,e).has(e)},Un.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 qn,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 qn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Un(r)}return n.set(e,t),this.size=n.size,this};var ur=Ao(br),dr=Ao(vr,!0);function pr(e,t){var n=!0;return ur(e,function(e,r,o){return n=!!t(e,r,o)}),n}function fr(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 hr(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 Rt(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 Us(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=Ie.call(t);return o&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return Ie.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 _r(t,n,r){for(var o=r?Tt:Ot,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 p=-1,f=l[0];e:for(;++p<i&&u.length<c;){var h=d[p],m=n?n(h):h;if(h=r||0!==h?h:0,!(f?Qt(f,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}f&&f.push(m),u.push(h)}}return u}function Nr(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 Rr(e){return na(e)&&Sr(e)==f}function Or(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=Us(t),l=Us(n),c=a?h:fi(t),u=l?h:fi(n),d=(c=c==f?k:c)==k,p=(u=u==f?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 T: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 N:return e==t+"";case w:var a=sn;case _: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 R:if(jn)return jn.call(e)==jn.call(t)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var v=d&&$e.call(t,"__wrapped__"),S=p&&$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 p=c;p--;){var f=l[p];if(!(a?f in n:$e.call(n,f)))return!1}var h=s.get(t),m=s.get(n);if(h&&m)return h==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++p<c;){var b=t[f=l[p]],v=n[f];if(o)var w=a?o(v,b,f,n,t,s):o(b,v,f,t,n,s);if(!(w===e?b===v||i(b,v,r,o,s):w)){g=!1;break}y||(y="constructor"==f)}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,Or,i))}function Tr(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 p=new Yn;if(o)var f=o(u,d,c,t,n,p);if(!(f===e?Or(d,u,3,o,p):f))return!1}}return!0}function Ar(e){return!(!ta(e)||(t=e,je&&je 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?Us(e)?Pr(e[0],e[1]):zr(e):fl(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 jr(e,t){return e<t}function Ir(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||Tr(n,e,t)}}function Pr(t,n){return vi(t)&&Si(n)?Ei(zi(t),n):function(r){var o=_a(r,t);return o===e&&o===n?Na(r,t):Or(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=_i(t,r),c=_i(n,r),u=a.get(c);if(u)Qn(t,r,u);else{var d=s?s(l,c,r+"",t,n,a):e,p=d===e;if(p){var f=Us(c),h=!f&&Ks(c),m=!f&&!h&&ua(c);d=c,f||h||m?Us(l)?d=l:Js(l)?d=No(l):h?(p=!1,d=ko(c,!0)):m?(p=!1,d=Eo(c,!0)):d=[]:ia(c)||qs(c)?(d=l,qs(l)?d=ba(l):ta(l)&&!Qs(l)||(d=mi(c))):p=!1}p&&(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(_i(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 Us(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}(Ir(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 qr(e,t,n,r){var o=r?Bt:Ft,i=-1,s=t.length,a=e;for(e===t&&(t=No(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 Ur(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+ht(wn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return Oi(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=Nn?function(e,t){return Nn.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=ht((i+s)/2),p=r(t[d]),f=p!==e,h=null===p,m=p==p,g=ca(p);if(a)var y=o||m;else y=u?m&&(o||f):l?m&&f&&(o||!h):c?m&&f&&!h&&(o||!g):!h&&!g&&(o?p<=n:p<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(Us(e))return At(e,ao)+"";if(ca(e))return In?In.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function lo(e,t,n){var r=-1,o=Ot,i=e.length,s=!0,a=[],l=a;if(n)s=!1,o=Tt;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 p=l.length;p--;)if(l[p]===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 po(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 fo(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 ho(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 Us(e)?e:vi(e,t)?[e]:Ii(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 pt.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=qe?qe(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 _o(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),p=!r;++o<u;)d[o]=e[o];for(var f=o;++l<c;)d[f+l]=t[l];for(;++s<a;)(p||o<i)&&(d[f+n[s]]=e[o++]);return d}function No(e,t){var n=-1,r=e.length;for(t||(t=oe(r));++n<r;)t[n]=e[n];return t}function Ro(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 Oo(e,t){return function(n,r){var o=Us(n)?Mt:tr,i=t?t():{};return o(n,e,ai(r,2),i)}}function To(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(qa(t).replace(Ze,"")),e,"")}}function jo(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 Io(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 Ne(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&&Us(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 p=n&s,f=1&n,h=2&n,m=24&n,g=512&n,y=h?e:jo(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=_o(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=f?r:this,M=h?E[t]:t;return b=v.length,c?v=function(t,n){for(var r=t.length,o=yn(n.length,r),i=No(t);o--;){var s=n[o];t[o]=yi(s,r)?i[s]:e}return t}(v,c):g&&b>1&&v.reverse(),p&&u<b&&(v.length=u),this&&this!==pt&&this instanceof s&&(M=y||jo(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,ft(t/un(n)));return on(n)?wo(dn(o),0,t).join(""):o.slice(0,t)}function qo(t){return function(n,r,o){return o&&"number"!=typeof o&&bi(n,r,o)&&(r=o=e),n=ha(n),r===e?(r=n,n=0):r=ha(r),function(e,t,n,r){for(var o=-1,i=gn(ft((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:ha(o),t)}}function Uo(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 p=8&n;n|=p?o:64,4&(n&=~(p?64:o))||(n&=-4);var f=[t,n,s,p?a:e,p?l:e,p?e:a,p?e:l,c,u,d],h=r.apply(e,f);return wi(t)&&Ni(h,f),h.placeholder=i,Ti(h,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))&&It(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=fi(t);return n==w?sn(t):n==_?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,p,f){var h=2&i;if(!h&&"function"!=typeof n)throw new Ne(t);var m=c?c.length:0;if(m||(i&=-97,c=u=e),p=p===e?p:gn(ma(p),0),f=f===e?f:ma(f),m-=u?u.length:0,64&i){var g=c,y=u;c=u=e}var b=h?e:oi(n),v=[n,i,l,c,u,g,y,d,p,f];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?_o(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],!(f=v[9]=v[9]===e?h?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=jo(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!==pt&&this instanceof i?o:t,this,a)}}(n,i,f):i!=o&&33!=i||u.length?Po.apply(e,v):function(e,t,n,r){var o=1&t,i=jo(e);return function t(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=oe(c+a),d=this&&this!==pt&&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=jo(e);return function t(){return(this&&this!==pt&&this instanceof t?o:e).apply(r?n:this,arguments)}}(n,i,l);return Ti((b?Qr:Ni)(w,v),n,i)}function Zo(t,n,r,o){return t===e||Bs(t,Te[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 p=-1,f=!0,h=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++p<l;){var m=t[p],g=n[p];if(o)var y=a?o(g,m,p,n,t,s):o(m,g,p,t,n,s);if(y!==e){if(y)continue;f=!1;break}if(h){if(!jt(n,function(e,t){if(!Qt(h,t)&&(m===e||i(m,e,r,o,s)))return h.push(t)})){f=!1;break}}else if(m!==g&&!i(m,g,r,o,s)){f=!1;break}}return s.delete(t),s.delete(n),f}function ti(t){return Oi(Mi(t,e,Wi),t+"")}function ni(e){return kr(e,Aa,di)}function ri(e){return kr(e,Da,pi)}var oi=Nn?function(e){return Nn.get(e)}:cl;function ii(e){for(var t=e.name+"",n=Rn[t],r=$e.call(Rn,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),Rt(gt(e),function(t){return Ye.call(e,t)}))}:gl,pi=gt?function(e){for(var t=[];e;)Dt(t,di(e)),e=Ue(e);return t}:gl,fi=Sr;function hi(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)&&(Us(e)||qs(e))}function mi(e){return"function"!=typeof e.constructor||ki(e)?{}:Pn(Ue(e))}function gi(e){return Us(e)||qs(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(Us(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&&fi(new kn(new ArrayBuffer(1)))!=A||Sn&&fi(new Sn)!=w||En&&fi(En.resolve())!=M||Mn&&fi(new Mn)!=_||Cn&&fi(new Cn)!=O)&&(fi=function(t){var n=Sr(t),r=n==k?t.constructor:e,o=r?Pi(r):"";if(o)switch(o){case On:return A;case Tn:return w;case An:return M;case Dn:return _;case $n:return O}return n});var xi=Ae?Qs:yl;function ki(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Te)}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 _i(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ni=Ai(Qr),Ri=dt||function(e,t){return pt.setTimeout(e,t)},Oi=Ai(Xr);function Ti(e,t,n){var r=t+"";return Oi(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(p,function(n){var r="_."+n[0];t&n[1]&&!Ot(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,ji,Ii=($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===ji.size&&ji.clear(),e}),ji=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__=No(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 qi(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 Ui(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]?_r(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]?_r(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]?_r(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?qr(e,t):e}var es=ti(function(e,t){var n=null==e?0:e.length,r=or(e,t);return Ur(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=Rt(e,function(e){if(Js(e))return t=gn(e.length,t),!0}),Jt(t,function(t){return At(e,qt(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 ho(Rt(e,Js))}),cs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),ho(Rt(t,Js),ai(n,2))}),us=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,ho(Rt(t,Js),e,n)}),ds=Jr(is),ps=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 fs(e){var t=zn(e);return t.__chain__=!0,t}function hs(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:hs,args:[i],thisArg:e}),new Bn(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(e),t})):this.thru(i)}),gs=Oo(function(e,t,n){$e.call(e,n)?++e[n]:rr(e,n,1)}),ys=Io(qi),bs=Io(Ui);function vs(e,t){return(Us(e)?Ct:ur)(e,ai(t,3))}function ws(e,t){return(Us(e)?_t:dr)(e,ai(t,3))}var xs=Oo(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):Nr(e,t,n)}),i}),Ss=Oo(function(e,t,n){rr(e,n,t)});function Es(e,t){return(Us(e)?At:Ir)(e,ai(t,3))}var Ms=Oo(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),[])}),_s=ut||function(){return pt.Date.now()};function Ns(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Go(t,s,e,e,e,e,n)}function Rs(n,r){var o;if("function"!=typeof r)throw new Ne(t);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=e),o}}var Os=Jr(function(e,t,n){var r=1;if(n.length){var i=ln(n,si(Os));r|=o}return Go(e,r,t,n,i)}),Ts=Jr(function(e,t,n){var r=3;if(n.length){var i=ln(n,si(Ts));r|=o}return Go(t,r,e,n,i)});function As(n,r,o){var i,s,a,l,c,u,d=0,p=!1,f=!1,h=!0;if("function"!=typeof n)throw new Ne(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||f&&t-d>=a}function y(){var e=_s();if(g(e))return b(e);c=Ri(y,function(e){var t=r-(e-u);return f?yn(t,a-(e-d)):t}(e))}function b(t){return c=e,h&&i?m(t):(i=s=e,l)}function v(){var t=_s(),n=g(t);if(i=arguments,s=this,u=t,n){if(c===e)return function(e){return d=e,c=Ri(y,r),p?m(e):l}(u);if(f)return xo(c),c=Ri(y,r),m(u)}return c===e&&(c=Ri(y,r)),l}return r=ya(r)||0,ta(o)&&(p=!!o.leading,a=(f="maxWait"in o)?gn(ya(o.maxWait)||0,r):a,h="trailing"in o?!!o.trailing:h),v.cancel=function(){c!==e&&xo(c),d=0,i=u=s=c=e},v.flush=function(){return c===e?l:b(_s())},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 Ne(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||Un),r}function js(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)}}Ls.Cache=Un;var Is=vo(function(e,t){var n=(t=1==t.length&&Us(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=Uo(Er),Vs=Uo(function(e,t){return e>=t}),qs=Rr(function(){return arguments}())?Rr:function(e){return na(e)&&$e.call(e,"callee")&&!Ye.call(e,"callee")},Us=oe.isArray,Ws=bt?Gt(bt):function(e){return na(e)&&Sr(e)==T};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)&&fi(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=Ue(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)&&fi(e)==_};function la(e){return"string"==typeof e||!Us(e)&&na(e)&&Sr(e)==N}function ca(e){return"symbol"==typeof e||na(e)&&Sr(e)==R}var ua=St?Gt(St):function(e){return na(e)&&ea(e.length)&&!!it[Sr(e)]},da=Uo(jr),pa=Uo(function(e,t){return e<=t});function fa(e){if(!e)return[];if(Ys(e))return la(e)?dn(e):No(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=fi(e);return(t==w?sn:t==_?cn:Ba)(e)}function ha(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=ha(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=he.test(e);return n||ge.test(e)?ct(e.slice(2),n?2:8):fe.test(e)?u:+e}function ba(e){return Ro(e,Da(e))}function va(e){return null==e?"":ao(e)}var wa=To(function(e,t){if(ki(t)||Ys(t))Ro(t,Aa(t),e);else for(var n in t)$e.call(t,n)&&Xn(e,n,t[n])}),xa=To(function(e,t){Ro(t,Da(t),e)}),ka=To(function(e,t,n,r){Ro(t,Da(t),e,r)}),Sa=To(function(e,t,n,r){Ro(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,Te[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 _a(t,n,r){var o=null==t?e:xr(t,n);return o===e?r:o}function Na(e,t){return null!=e&&hi(e,t,Cr)}var Ra=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),e[t]=n},tl(ol)),Oa=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),$e.call(e,t)?e[t].push(n):e[t]=[n]},ai),Ta=Jr(Nr);function Aa(e){return Ys(e)?Jn(e):$r(e)}function Da(e){return Ys(e)?Jn(e,!0):Lr(e)}var $a=To(function(e,t,n){Fr(e,t,n)}),La=To(function(e,t,n,r){Fr(e,t,n,r)}),ja=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}),Ro(e,ri(e),n),r&&(n=sr(n,7,Xo));for(var o=t.length;o--;)co(n,t[o]);return n}),Ia=ti(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Na(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 qa(e){return(e=va(e))&&e.replace(be,tn).replace(Qe,"")}var Ua=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,Os(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 Nr(n,e,t)}}),al=Jr(function(e,t){return function(n){return Nr(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__=No(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(Nt),pl=Ho(jt);function fl(e){return vi(e)?qt(zi(e)):function(e){return function(t){return xr(t,e)}}(e)}var hl=qo(),ml=qo(!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 Ne(t);return e=ma(e),function(){if(--e<1)return n.apply(this,arguments)}},zn.ary=Ns,zn.assign=wa,zn.assignIn=xa,zn.assignInWith=ka,zn.assignWith=Sa,zn.at=Ea,zn.before=Rs,zn.bind=Os,zn.bindAll=el,zn.bindKey=Ts,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(e)?e:[e]},zn.chain=fs,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(ft(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(Us(n)?No(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 Ne(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?po(e,ai(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?po(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(Us(e)?Rt:hr)(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=Ra,zn.invertBy=Oa,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=js,zn.nthArg=function(e){return e=ma(e),Jr(function(t){return Br(t,e)})},zn.omit=ja,zn.omitBy=function(e,t){return za(e,js(ai(t)))},zn.once=function(e){return Rs(2,e)},zn.orderBy=function(t,n,r,o){return null==t?[]:(Us(n)||(n=null==n?[]:[n]),Us(r=o?e:r)||(r=null==r?[]:[r]),Hr(t,n,r))},zn.over=ul,zn.overArgs=Is,zn.overEvery=dl,zn.overSome=pl,zn.partial=zs,zn.partialRight=Ps,zn.partition=Ms,zn.pick=Ia,zn.pickBy=za,zn.property=fl,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?qr(e,t,ai(n,2)):e},zn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?qr(t,n,e,r):t},zn.pullAt=es,zn.range=hl,zn.rangeRight=ml,zn.rearg=Fs,zn.reject=function(e,t){return(Us(e)?Rt:hr)(e,js(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 Ur(e,o),n},zn.rest=function(n,r){if("function"!=typeof n)throw new Ne(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),(Us(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(Us(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 Ne(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?po(e,ai(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?po(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 Ne(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=hs,zn.toArray=fa,zn.toPairs=Pa,zn.toPairsIn=Fa,zn.toPath=function(e){return Us(e)?At(e,zi):ca(e)?[e]:No(Ii(va(e)))},zn.toPlainObject=ba,zn.transform=function(e,t,n){var r=Us(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(Ue(e)):{}}return(o?Ct:br)(e,function(e,r,o){return t(n,e,r,o)}),n},zn.unary=function(e){return Ns(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=ps,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=qa,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=Us(t)?Nt:pr;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.find=ys,zn.findIndex=qi,zn.findKey=function(e,t){return zt(e,ai(t,3),br)},zn.findLast=bs,zn.findLastIndex=Ui,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=_a,zn.gt=Hs,zn.gte=Vs,zn.has=function(e,t){return null!=e&&hi(e,t,Mr)},zn.hasIn=Na,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=ha(n),r===e?(r=n,n=0):r=ha(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(t=ya(t),n,r)},zn.invoke=Ta,zn.isArguments=qs,zn.isArray=Us,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)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ua(e)||qs(e)))return!e.length;var t=fi(e);if(t==w||t==_)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 Or(e,t)},zn.isEqualWith=function(t,n,r){var o=(r="function"==typeof r?r:e)?r(t,n):e;return o===e?Or(t,n,e,r):!!o},zn.isError=Zs,zn.isFinite=function(e){return"number"==typeof e&&It(e)},zn.isFunction=Qs,zn.isInteger=Xs,zn.isLength=ea,zn.isMap=ra,zn.isMatch=function(e,t){return e===t||Tr(e,t,ci(t))},zn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Tr(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)&&fi(e)==O},zn.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":Ut.call(e,t)},zn.kebabCase=Ua,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=pa,zn.max=function(t){return t&&t.length?fr(t,ol,Er):e},zn.maxBy=function(t,n){return t&&t.length?fr(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?fr(t,ol,jr):e},zn.minBy=function(t,n){return t&&t.length?fr(t,ai(n,2),jr):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 pt._===this&&(pt._=Pe),this},zn.noop=cl,zn.now=_s,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(ht(o),n)+e+Vo(ft(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=ha(t),n===e?(n=t,t=0):n=ha(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=Us(e)?$t:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,ur)},zn.reduceRight=function(e,t,n){var r=Us(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(Us(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=fi(e);return t==w||t==_?e.size:$r(e).length},zn.snakeCase=Ja,zn.some=function(t,n,r){var o=Us(t)?jt: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,p="__p += '",f=Ce((n.escape||ve).source+"|"+d.source+"|"+(d===Z?de:ve).source+"|"+(n.evaluate||ve).source+"|$","g"),h="//# sourceURL="+($e.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(f,function(e,n,r,o,a,l){return r||(r=o),p+=t.slice(u,l).replace(we,rn),n&&(i=!0,p+="' +\n__e("+n+") +\n'"),a&&(s=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),p+="';\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 p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(H,""):p).replace(V,"$1").replace(q,"$1;"),p="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")+p+"return __p\n}";var g=Xa(function(){return Se(l,h+"return "+p).apply(e,c)});if(g.source=p,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=ha,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,pn(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(pe.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var p=u.index;c=c.slice(0,p===e?l:p)}}else if(t.indexOf(ao(i),l)!=l){var f=c.lastIndexOf(i);f>-1&&(c=c.slice(0,f))}return c+o},zn.unescape=function(e){return(e=va(e))&&Y.test(e)?e.replace(U,fn):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 Nr(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(js(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||Us(n),d=function(e){var t=i.apply(zn,Dt([e],a));return o&&p?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var p=this.__chain__,f=!!this.__actions__.length,h=s&&!p,m=l&&!f;if(!s&&u){n=m?n:new Hn(this);var g=t.apply(n,a);return g.__actions__.push({func:hs,args:[d],thisArg:e}),new Bn(g,p)}return h&&m?t.apply(this,a):(g=this.thru(d),h?o?g.value()[0]:g.value():g)})}),Ct(["pop","push","shift","sort","splice","unshift"],function(e){var t=Re[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(Us(o)?o:[],e)}return this[n](function(n){return t.apply(Us(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";$e.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:t,func:n})}}),Rn[Po(e,2).name]=[{name:"wrapper",func:e}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=No(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=No(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=No(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=Us(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,p=0,f=yn(l,this.__takeCount__);if(!n||!r&&o==l&&f==l)return fo(e,this.__actions__);var h=[];e:for(;l--&&p<f;){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}}h[p++]=g}return h},zn.prototype.at=ms,zn.prototype.chain=function(){return fs(this)},zn.prototype.commit=function(){return new Bn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===e&&(this.__values__=fa(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:hs,args:[ts],thisArg:e}),new Bn(n,this.__chain__)}return this.thru(ts)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return fo(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Ge&&(zn.prototype[Ge]=function(){return this}),zn}();ht?((ht.exports=hn)._=hn,ft._=hn):pt._=hn}.call(M.exports));const _=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),N=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 R={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},T=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,...R,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:_("lucide",i),...!s&&!O(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,n])=>e.createElement(t,n)),...Array.isArray(s)?s:[s]])),A=(t,n)=>{const r=e.forwardRef(({className:r,...o},i)=>{return e.createElement(T,{ref:i,iconNode:n,className:_(`lucide-${s=N(t),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var s});return r.displayName=N(t),r},D=A("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"}]]),$=A("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),L=A("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"}]]),j=A("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"}]]),I=A("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"}]]),z=A("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"}]]),P=A("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"}]]),F=A("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"}]]),B=A("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"}]]),H=A("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"}]]),V=A("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"}]]),q=A("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"}]]),U=A("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"}]]),W=A("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"}]]),Y=A("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),J=A("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"}]]),K=A("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"}]]),G=A("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"}]]),Z=A("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),Q=A("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),X=A("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),ee=A("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"}]]),te=A("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),ne=A("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"}]]),re=A("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"}]]),oe=A("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ie(e,t){if(!e)return null;const n=e.trim();if("form"===function(e){const t=e.trim();return t.startsWith("${")&&t.endsWith("}")?"form":"flow"}(n)){const e=n.startsWith("${")&&n.endsWith("}")?n.slice(2,-1).trim():n;if(!e)return null;try{return e.includes("{")?se(e):ue(e)}catch{return null}}if(!n.includes("{"))return null;try{return se(n)}catch{return null}}function se(e){const t=ae(e);if(t.startsWith("!")){const e=se(t.slice(1).trim());return e?(e.negate=!e.negate,e):null}for(const r of["||","&&"]){const e=le(t,r);if(e.length>1){const t="&&"===r?"and":"or",n=[];for(const r of e){const e=r.trim(),t=se(e);if(t&&t.children.length>1)n.push(t);else if(t&&t.negate)n.push(t);else{const t=ce(ae(e));if(!t)return null;n.push(t)}}return{type:"group",logic:t,children:n}}}const n=ce(t);return n?{type:"group",logic:"and",children:[n]}:null}function ae(e){const t=e.trim();if(t.startsWith("(")&&t.endsWith(")")){let e=0;for(let n=0;n<t.length;n++)if("("===t[n]?e++:")"===t[n]&&e--,0===e&&n<t.length-1)return t;return ae(t.slice(1,-1).trim())}return t}function le(e,t){const n=[];let r=0,o=0;for(let i=0;i<=e.length-t.length;i++)"("===e[i]?r++:")"===e[i]?r--:0===r&&e.substring(i,i+t.length)===t&&(n.push(e.substring(o,i)),o=i+t.length,i+=t.length-1);return n.push(e.substring(o)),n.filter(e=>e.trim())}function ce(e){const t=e.trim().match(/^\{([^}]+)\}\s*(==|!=|>=|<=|>|<|contains)\s*(.+)$/);return t?{type:"rule",field:t[1].trim(),operator:t[2],value:t[3].trim().replace(/^["']|["']$/g,"")}:null}function ue(e){const t=ae(e);if(t.startsWith("!")){const e=ue(t.slice(1).trim());return e?(e.negate=!e.negate,e):null}for(const r of["||","&&"]){const e=le(t,r);if(e.length>1){const t="&&"===r?"and":"or",n=[];for(const r of e){const e=r.trim(),t=ue(e);if(t&&t.children.length>1)n.push(t);else if(t&&t.negate)n.push(t);else{const t=de(ae(e));if(!t)return null;n.push(t)}}return{type:"group",logic:t,children:n}}}const n=de(t);return n?{type:"group",logic:"and",children:[n]}:null}function de(e){const t=e.trim().match(/^(\S+)\s+(==|!=|>=|<=|>|<|contains)\s+(.+)$/);return t?{type:"rule",field:t[1].trim(),operator:t[2],value:t[3].trim().replace(/^["']|["']$/g,"")}:null}function pe(e,t){if(!e)return!1;const n=ie(e);return!!n&&fe(n,t)}function fe(e,t){const n=e.children.map(e=>"rule"===e.type?function(e,t){if(!e.field)return!1;const n=t[e.field],r=String(n??""),o=e.value??"";switch(e.operator){case"==":return r===o;case"!=":return r!==o;case">":return parseFloat(r)>parseFloat(o);case">=":return parseFloat(r)>=parseFloat(o);case"<":return parseFloat(r)<parseFloat(o);case"<=":return parseFloat(r)<=parseFloat(o);case"contains":return r.includes(o);default:return!1}}(e,t):fe(e,t)),r="or"===e.logic?n.some(Boolean):n.every(Boolean);return e.negate?!r:r}function he(e,t){return function(){return e.apply(t,arguments)}}const{toString:me}=Object.prototype,{getPrototypeOf:ge}=Object,{iterator:ye,toStringTag:be}=Symbol,ve=(e=>t=>{const n=me.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),we=e=>(e=e.toLowerCase(),t=>ve(t)===e),xe=e=>t=>typeof t===e,{isArray:ke}=Array,Se=xe("undefined");function Ee(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&_e(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Me=we("ArrayBuffer");const Ce=xe("string"),_e=xe("function"),Ne=xe("number"),Re=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==ve(e))return!1;const t=ge(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||be in e||ye in e)},Te=we("Date"),Ae=we("File"),De=we("Blob"),$e=we("FileList");const Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},je=void 0!==Le.FormData?Le.FormData:void 0,Ie=we("URLSearchParams"),[ze,Pe,Fe,Be]=["ReadableStream","Request","Response","Headers"].map(we);function He(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),ke(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Ee(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 Ve(e,t){if(Ee(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 qe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ue=e=>!Se(e)&&e!==qe;const We=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&ge(Uint8Array)),Ye=we("HTMLFormElement"),Je=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ke=we("RegExp"),Ge=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};He(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ze=we("AsyncFunction"),Qe=(Xe="function"==typeof setImmediate,et=_e(qe.postMessage),Xe?setImmediate:et?(tt=`axios@${Math.random()}`,nt=[],qe.addEventListener("message",({source:e,data:t})=>{e===qe&&t===tt&&nt.length&&nt.shift()()},!1),e=>{nt.push(e),qe.postMessage(tt,"*")}):e=>setTimeout(e));var Xe,et,tt,nt;const rt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(qe):"undefined"!=typeof process&&process.nextTick||Qe,ot={isArray:ke,isArrayBuffer:Me,isBuffer:Ee,isFormData:e=>{let t;return e&&(je&&e instanceof je||_e(e.append)&&("formdata"===(t=ve(e))||"object"===t&&_e(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Me(e.buffer),t},isString:Ce,isNumber:Ne,isBoolean:e=>!0===e||!1===e,isObject:Re,isPlainObject:Oe,isEmptyObject:e=>{if(!Re(e)||Ee(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:ze,isRequest:Pe,isResponse:Fe,isHeaders:Be,isUndefined:Se,isDate:Te,isFile:Ae,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:De,isRegExp:Ke,isFunction:_e,isStream:e=>Re(e)&&_e(e.pipe),isURLSearchParams:Ie,isTypedArray:We,isFileList:$e,forEach:He,merge:function e(){const{caseless:t,skipUndefined:n}=Ue(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t&&Ve(r,i)||i;Oe(r[s])&&Oe(o)?r[s]=e(r[s],o):Oe(o)?r[s]=e({},o):ke(o)?r[s]=o.slice():n&&Se(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&He(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(He(t,(t,r)=>{n&&_e(t)?Object.defineProperty(e,r,{value:he(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&&ge(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:ve,kindOfTest:we,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(ke(e))return e;let t=e.length;if(!Ne(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[ye]).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:Ye,hasOwnProperty:Je,hasOwnProp:Je,reduceDescriptors:Ge,freezeMethods:e=>{Ge(e,(t,n)=>{if(_e(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];_e(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 ke(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:Ve,global:qe,isContextDefined:Ue,isSpecCompliantForm:function(e){return!!(e&&_e(e.append)&&"FormData"===e[be]&&e[ye])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Re(e)){if(t.indexOf(e)>=0)return;if(Ee(e))return e;if(!("toJSON"in e)){t[r]=e;const o=ke(e)?[]:{};return He(e,(e,t)=>{const i=n(e,r+1);!Se(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Ze,isThenable:e=>e&&(Re(e)||_e(e))&&_e(e.then)&&_e(e.catch),setImmediate:Qe,asap:rt,isIterable:e=>null!=e&&_e(e[ye])};let it=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,null!=t.status&&null==a.status&&(a.status=t.status),s&&Object.assign(a,s),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),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:ot.toJSONObject(this.config),code:this.code,status:this.status}}};it.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",it.ERR_BAD_OPTION="ERR_BAD_OPTION",it.ECONNABORTED="ECONNABORTED",it.ETIMEDOUT="ETIMEDOUT",it.ERR_NETWORK="ERR_NETWORK",it.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",it.ERR_DEPRECATED="ERR_DEPRECATED",it.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",it.ERR_BAD_REQUEST="ERR_BAD_REQUEST",it.ERR_CANCELED="ERR_CANCELED",it.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",it.ERR_INVALID_URL="ERR_INVALID_URL";function st(e){return ot.isPlainObject(e)||ot.isArray(e)}function at(e){return ot.endsWith(e,"[]")?e.slice(0,-2):e}function lt(e,t,n){return e?e.concat(t).map(function(e,t){return e=at(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ct=ot.toFlatObject(ot,{},null,function(e){return/^is[A-Z]/.test(e)});function ut(e,t,n){if(!ot.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ot.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ot.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ot.isSpecCompliantForm(t);if(!ot.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ot.isDate(e))return e.toISOString();if(ot.isBoolean(e))return e.toString();if(!a&&ot.isBlob(e))throw new it("Blob is not supported. Use a Buffer instead.");return ot.isArrayBuffer(e)||ot.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(ot.isReactNative(t)&&ot.isReactNativeBlob(e))return t.append(lt(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(ot.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ot.isArray(e)&&function(e){return ot.isArray(e)&&!e.some(st)}(e)||(ot.isFileList(e)||ot.endsWith(n,"[]"))&&(a=ot.toArray(e)))return n=at(n),a.forEach(function(e,r){!ot.isUndefined(e)&&null!==e&&t.append(!0===s?lt([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!st(e)||(t.append(lt(o,n,i),l(e)),!1)}const u=[],d=Object.assign(ct,{defaultVisitor:c,convertValue:l,isVisitable:st});if(!ot.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!ot.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),ot.forEach(n,function(n,i){!0===(!(ot.isUndefined(n)||null===n)&&o.call(t,n,ot.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function dt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function pt(e,t){this._pairs=[],e&&ut(e,this,t)}const ft=pt.prototype;function ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mt(e,t,n){if(!t)return e;const r=n&&n.encode||ht,o=ot.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let s;if(s=i?i(t,o):ot.isURLSearchParams(t)?t.toString():new pt(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ft.append=function(e,t){this._pairs.push([e,t])},ft.toString=function(e){const t=e?function(t){return e.call(this,t,dt)}:dt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class gt{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){ot.forEach(this.handlers,function(t){null!==t&&e(t)})}}const yt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},bt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:pt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},vt="undefined"!=typeof window&&"undefined"!=typeof document,wt="object"==typeof navigator&&navigator||void 0,xt=vt&&(!wt||["ReactNative","NativeScript","NS"].indexOf(wt.product)<0),kt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,St=vt&&window.location.href||"http://localhost",Et={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vt,hasStandardBrowserEnv:xt,hasStandardBrowserWebWorkerEnv:kt,navigator:wt,origin:St},Symbol.toStringTag,{value:"Module"})),...bt};function Mt(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&&ot.isArray(r)?r.length:i,a)return ot.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&ot.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ot.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(ot.isFormData(e)&&ot.isFunction(e.entries)){const n={};return ot.forEachEntry(e,(e,r)=>{t(function(e){return ot.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Ct={transitional:yt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ot.isObject(e);o&&ot.isHTMLForm(e)&&(e=new FormData(e));if(ot.isFormData(e))return r?JSON.stringify(Mt(e)):e;if(ot.isArrayBuffer(e)||ot.isBuffer(e)||ot.isStream(e)||ot.isFile(e)||ot.isBlob(e)||ot.isReadableStream(e))return e;if(ot.isArrayBufferView(e))return e.buffer;if(ot.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 ut(e,new Et.classes.URLSearchParams,{visitor:function(e,t,n,r){return Et.isNode&&ot.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=ot.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ut(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ot.isString(e))try{return(t||JSON.parse)(e),ot.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ct.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ot.isResponse(e)||ot.isReadableStream(e))return e;if(e&&ot.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 it.from(o,it.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:Et.classes.FormData,Blob:Et.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ot.forEach(["delete","get","head","post","put","patch"],e=>{Ct.headers[e]={}});const _t=ot.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"]),Nt=Symbol("internals");function Rt(e){return e&&String(e).trim().toLowerCase()}function Ot(e){return!1===e||null==e?e:ot.isArray(e)?e.map(Ot):String(e)}function Tt(e,t,n,r,o){return ot.isFunction(r)?r.call(this,t,n):(o&&(t=n),ot.isString(t)?ot.isString(r)?-1!==t.indexOf(r):ot.isRegExp(r)?r.test(t):void 0:void 0)}let At=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Rt(t);if(!o)throw new Error("header name must be a non-empty string");const i=ot.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Ot(e))}const i=(e,t)=>ot.forEach(e,(e,n)=>o(e,n,t));if(ot.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ot.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]&&_t[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(ot.isObject(e)&&ot.isIterable(e)){let n,r,o={};for(const t of e){if(!ot.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ot.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=Rt(e)){const n=ot.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(ot.isFunction(t))return t.call(this,e,n);if(ot.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Rt(e)){const n=ot.findKey(this,e);return!(!n||void 0===this[n]||t&&!Tt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Rt(e)){const o=ot.findKey(n,e);!o||t&&!Tt(0,n[o],o,t)||(delete n[o],r=!0)}}return ot.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&&!Tt(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ot.forEach(this,(r,o)=>{const i=ot.findKey(n,o);if(i)return t[i]=Ot(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]=Ot(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ot.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ot.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[Nt]=this[Nt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Rt(e);t[r]||(!function(e,t){const n=ot.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 ot.isArray(e)?e.forEach(r):r(e),this}};function Dt(e,t){const n=this||Ct,r=t||n,o=At.from(r.headers);let i=r.data;return ot.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function $t(e){return!(!e||!e.__CANCEL__)}At.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ot.reduceDescriptors(At.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ot.freezeMethods(At);let Lt=class extends it{constructor(e,t,n){super(null==e?"canceled":e,it.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function jt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new it("Request failed with status code "+n.status,[it.ERR_BAD_REQUEST,it.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const It=(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 p=c&&l-c;return p?Math.round(1e3*d/p):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)},zt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pt=e=>(...t)=>ot.asap(()=>e(...t)),Ft=Et.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Et.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Et.origin),Et.navigator&&/(msie|trident)/i.test(Et.navigator.userAgent)):()=>!0,Bt=Et.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ot.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),ot.isString(r)&&a.push(`path=${r}`),ot.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),ot.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 Ht(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 Vt=e=>e instanceof At?{...e}:e;function qt(e,t){t=t||{};const n={};function r(e,t,n,r){return ot.isPlainObject(e)&&ot.isPlainObject(t)?ot.merge.call({caseless:r},e,t):ot.isPlainObject(t)?ot.merge({},t):ot.isArray(t)?t.slice():t}function o(e,t,n,o){return ot.isUndefined(t)?ot.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ot.isUndefined(t))return r(void 0,t)}function s(e,t){return ot.isUndefined(t)?ot.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(Vt(e),Vt(t),0,!0)};return ot.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ot.hasOwnProp(l,r)?l[r]:o,s=i(e[r],t[r],r);ot.isUndefined(s)&&i!==a||(n[r]=s)}),n}const Ut=e=>{const t=qt({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=At.from(s),t.url=mt(Ht(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ot.isFormData(n))if(Et.hasStandardBrowserEnv||Et.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ot.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(Et.hasStandardBrowserEnv&&(r&&ot.isFunction(r)&&(r=r(t)),r||!1!==r&&Ft(t.url))){const e=o&&i&&Bt.read(i);e&&s.set(o,e)}return t},Wt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ut(e);let o=r.data;const i=At.from(r.headers).normalize();let s,a,l,c,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){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=At.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());jt(function(e){t(e),h()},function(e){n(e),h()},{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 it("Request aborted",it.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new it(r,it.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||yt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new it(t,o.clarifyTimeoutError?it.ETIMEDOUT:it.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ot.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ot.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([l,u]=It(f,!0),m.addEventListener("progress",l)),p&&m.upload&&([a,c]=It(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new Lt(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===Et.protocols.indexOf(y)?n(new it("Unsupported protocol "+y+":",it.ERR_BAD_REQUEST,e)):m.send(o||null)})},Yt=(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 it?t:new Lt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new it(`timeout of ${t}ms exceeded`,it.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=()=>ot.asap(s),a}},Jt=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},Kt=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()}},Gt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Kt(e))yield*Jt(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:Zt}=ot,Qt=(({Request:e,Response:t})=>({Request:e,Response:t}))(ot.global),{ReadableStream:Xt,TextEncoder:en}=ot.global,tn=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},nn=e=>{e=ot.merge.call({skipUndefined:!0},Qt,e);const{fetch:t,Request:n,Response:r}=e,o=t?Zt(t):"function"==typeof fetch,i=Zt(n),s=Zt(r);if(!o)return!1;const a=o&&Zt(Xt),l=o&&("function"==typeof en?(e=>t=>e.encode(t))(new en):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=i&&a&&tn(()=>{let e=!1;const t=new n(Et.origin,{body:new Xt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&tn(()=>ot.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 it(`Response type '${e}' is not supported`,it.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=ot.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(ot.isBlob(e))return e.size;if(ot.isSpecCompliantForm(e)){const t=new n(Et.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ot.isArrayBufferView(e)||ot.isArrayBuffer(e)?e.byteLength:(ot.isURLSearchParams(e)&&(e+=""),ot.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:l,cancelToken:f,timeout:h,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=Ut(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let k=Yt([l,f&&f.toAbortSignal()],h),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let M;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(M=await p(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(ot.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=zt(M,It(Pt(g)));a=Gt(t.body,65536,e,n)}}ot.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 f=await(i?x(S,w):x(o,l));const h=u&&("stream"===y||"response"===y);if(u&&(m||h&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=f[t]});const t=ot.toFiniteNumber(f.headers.get("content-length")),[n,o]=m&&zt(t,It(Pt(m),!0))||[];f=new r(Gt(f.body,65536,n,()=>{o&&o(),E&&E()}),e)}y=y||"text";let C=await d[ot.findKey(d,y)||"text"](f,e);return!h&&E&&E(),await new Promise((t,n)=>{jt(t,n,{data:C,headers:At.from(f.headers),status:f.status,statusText:f.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 it("Network Error",it.ERR_NETWORK,e,S,C&&C.response),{cause:C.cause||C});throw it.from(C,C&&C.code,e,S,C&&C.response)}}},rn=new Map,on=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=rn;for(;l--;)s=i[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:nn(t)),c=a;return a};on();const sn={http:null,xhr:Wt,fetch:{get:on}};ot.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const an=e=>`- ${e}`,ln=e=>ot.isFunction(e)||null===e||!1===e;const cn={getAdapter:function(e,t){e=ot.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,!ln(r)&&(o=sn[(n=String(r)).toLowerCase()],void 0===o))throw new it(`Unknown adapter '${n}'`);if(o&&(ot.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(an).join("\n"):" "+an(e[0]):"as no adapter specified";throw new it("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:sn};function un(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lt(null,e)}function dn(e){un(e),e.headers=At.from(e.headers),e.data=Dt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return cn.getAdapter(e.adapter||Ct.adapter,e)(e).then(function(t){return un(e),t.data=Dt.call(e,e.transformResponse,t),t.headers=At.from(t.headers),t},function(t){return $t(t)||(un(e),t&&t.response&&(t.response.data=Dt.call(e,e.transformResponse,t.response),t.response.headers=At.from(t.response.headers))),Promise.reject(t)})}const pn="1.13.6",fn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{fn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const hn={};fn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+pn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new it(r(o," has been removed"+(t?" in "+t:"")),it.ERR_DEPRECATED);return t&&!hn[o]&&(hn[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)}},fn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const mn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new it("options must be an object",it.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 it("option "+i+" must be "+n,it.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new it("Unknown option "+i,it.ERR_BAD_OPTION)}},validators:fn},gn=mn.validators;let yn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new gt,response:new gt}}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=qt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&mn.assertOptions(n,{silentJSONParsing:gn.transitional(gn.boolean),forcedJSONParsing:gn.transitional(gn.boolean),clarifyTimeoutError:gn.transitional(gn.boolean),legacyInterceptorReqResOrdering:gn.transitional(gn.boolean)},!1),null!=r&&(ot.isFunction(r)?t.paramsSerializer={serialize:r}:mn.assertOptions(r,{encode:gn.function,serialize:gn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),mn.assertOptions(t,{baseUrl:gn.spelling("baseURL"),withXsrfToken:gn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ot.merge(o.common,o[t.method]);o&&ot.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=At.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||yt;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=[dn.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 p=t;for(;d<u;){const e=s[d++],t=s[d++];try{p=e(p)}catch(f){t.call(this,f);break}}try{c=dn.call(this,p)}catch(f){return Promise.reject(f)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return mt(Ht((e=qt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ot.forEach(["delete","get","head","options"],function(e){yn.prototype[e]=function(t,n){return this.request(qt(n||{},{method:e,url:t,data:(n||{}).data}))}}),ot.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(qt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}yn.prototype[e]=t(),yn.prototype[e+"Form"]=t(!0)});const bn={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(bn).forEach(([e,t])=>{bn[t]=e});const vn=function e(t){const n=new yn(t),r=he(yn.prototype.request,n);return ot.extend(r,yn.prototype,n,{allOwnKeys:!0}),ot.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(qt(t,n))},r}(Ct);vn.Axios=yn,vn.CanceledError=Lt,vn.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 Lt(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}}},vn.isCancel=$t,vn.VERSION=pn,vn.toFormData=ut,vn.AxiosError=it,vn.Cancel=vn.CanceledError,vn.all=function(e){return Promise.all(e)},vn.spread=function(e){return function(t){return e.apply(null,t)}},vn.isAxiosError=function(e){return ot.isObject(e)&&!0===e.isAxiosError},vn.mergeConfig=qt,vn.AxiosHeaders=At,vn.formToJSON=e=>Mt(ot.isHTMLForm(e)?new FormData(e):e),vn.getAdapter=cn.getAdapter,vn.HttpStatusCode=bn,vn.default=vn;const{Axios:wn,AxiosError:xn,CanceledError:kn,isCancel:Sn,CancelToken:En,VERSION:Mn,all:Cn,Cancel:_n,isAxiosError:Nn,spread:Rn,toFormData:On,AxiosHeaders:Tn,HttpStatusCode:An,formToJSON:Dn,getAdapter:$n,mergeConfig:Ln}=vn;const jn=vn.create({baseURL:"/api/v6",timeout:3e5});async function In(e,t){const n=await jn.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 zn(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 jn.post(`/files/${i}`,s,{headers:a,timeout:6e4})).data}function Pn(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}jn.interceptors.request.use(e=>e);const Fn=new Map,Bn=new Map;function Hn(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 Vn(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function qn(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function Un(e){const t=new Date(e);return t.setSeconds(0,0),t.toISOString()}function Wn(e,t,n,r,o,i,s,a,l){const c=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=c(t),r=e[t];return"table"===n?.type?Hn(r):r??""},setFieldValue(e,n){const r=function(e,t){if(null==t||""===t)return"";const n=e?.type;if("date"===n){if(t instanceof Date)return isNaN(t.getTime())?"":Vn(t);if("string"==typeof t){const e=t.toLowerCase();if("today"===e||"__today__"===e)return Vn(new Date);if(t.includes("T")&&t.length>10){const e=new Date(t);if(!isNaN(e.getTime()))return Vn(e)}}if("number"==typeof t){const e=new Date(t);if(!isNaN(e.getTime()))return Vn(e)}}if("datetime"===n){if(t instanceof Date)return isNaN(t.getTime())?"":Un(t);if("string"==typeof t){const e=t.toLowerCase();if("now"===e||"__now__"===e)return Un(new Date);if("today"===e||"__today__"===e){const e=new Date;return e.setHours(0,0,0,0),e.toISOString()}if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const e=new Date(t+"T00:00:00");if(!isNaN(e.getTime()))return e.toISOString()}if(t.includes("T")&&t.length>10){const e=new Date(t);if(!isNaN(e.getTime()))return Un(e)}}if("number"==typeof t){const e=new Date(t);if(!isNaN(e.getTime()))return Un(e)}}if("time"===n){if(t instanceof Date)return isNaN(t.getTime())?"":qn(t);if("string"==typeof t){const e=t.toLowerCase();if("now"===e||"__current_time__"===e)return qn(new Date)}}return t}(c(e),n);!r||"object"!=typeof r||r instanceof Date?t(e,null==r?"":String(r)):t(e,r)},setFieldVisible(e,t){const n=c(e);n&&r&&r(n._id,{hidden:!t})},setFieldHidden(e,t){const n=c(e);n&&r&&r(n._id,{hidden:t})},setFieldRequired(e,t){const n=c(e);n&&r&&r(n._id,{required:t})},setFieldReadonly(e,t){const n=c(e);n&&r&&r(n._id,{readonly:t})},getFieldOptions(e){const t=c(e);return t?.options||[]},setFieldOptions(e,t){const n=c(e);n&&r&&r(n._id,{options:t})},getTableRows:t=>Hn(e[t]),setTableRows(e,n){t(e,JSON.stringify(Array.isArray(n)?n:[]))},addTableRow(n,r={}){const o=Hn(e[n]);o.push(r),t(n,JSON.stringify(o))},removeTableRow(n,r){const o=Hn(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)},showError(e){o?.error(e)},showSuccess(e){o?.success(e)},showWarning(e){o?.warning(e)},context:i||{},currentStep:s||{},currentApprove:a||{},instance:l||{}}}async function Yn(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]=Hn(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=Hn(t.value));try{const o=new Function("form","field","value","oldValue","values","fields","fetch","currentStep","currentApprove","instance",`return (async () => { ${e} })();`);return await o(t.form,t.field,r,t.oldValue,n,t.fields,fetch.bind(window),t.form?.currentStep,t.form?.currentApprove,t.form?.instance)}catch(o){throw console.error("[fieldDataService] executeFormEvent error:",o),o}}function Jn(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=Jn(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const Kn=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Gn="-",Zn=[],Qn=e=>{const t=tr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return er(e);const n=e.split(Gn),r=""===n[0]&&n.length>1?1:0;return Xn(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||Zn}return n[e]||Zn}}},Xn=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=Xn(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(Gn):e.slice(t).join(Gn),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},er=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})(),tr=e=>{const{theme:t,classGroups:n}=e;return nr(n,t)},nr=(e,t)=>{const n=Kn();for(const r in e){const o=e[r];rr(o,n,r,t)}return n},rr=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];or(o,t,n,r)}},or=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?ar(e,t,n,r):sr(e,t,n,r):ir(e,t,n)},ir=(e,t,n)=>{(""===e?t:lr(t,e)).classGroupId=n},sr=(e,t,n,r)=>{cr(e)?rr(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},ar=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];rr(i,lr(t,e),n,r)}},lr=(e,t)=>{let n=e;const r=t.split(Gn),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=Kn(),n.nextPart.set(e,t)),n=t}return n},cr=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,ur=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)}}},dr=[],pr=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),fr=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 pr(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)):pr(dr,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},hr=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}},mr=/\s+/,gr=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=gr(e[r]))&&(n&&(n+=" "),n+=t);return n},yr=[],br=e=>{const t=t=>t[e]||yr;return t.isThemeGetter=!0,t},vr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sr=/\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$/,Er=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_r=e=>xr.test(e),Nr=e=>!!e&&!Number.isNaN(Number(e)),Rr=e=>!!e&&Number.isInteger(Number(e)),Or=e=>e.endsWith("%")&&Nr(e.slice(0,-1)),Tr=e=>kr.test(e),Ar=()=>!0,Dr=e=>Sr.test(e)&&!Er.test(e),$r=()=>!1,Lr=e=>Mr.test(e),jr=e=>Cr.test(e),Ir=e=>!Pr(e)&&!Yr(e),zr=e=>to(e,io,$r),Pr=e=>vr.test(e),Fr=e=>to(e,so,Dr),Br=e=>to(e,ao,Nr),Hr=e=>to(e,co,Ar),Vr=e=>to(e,lo,$r),qr=e=>to(e,ro,$r),Ur=e=>to(e,oo,jr),Wr=e=>to(e,uo,Lr),Yr=e=>wr.test(e),Jr=e=>no(e,so),Kr=e=>no(e,lo),Gr=e=>no(e,ro),Zr=e=>no(e,io),Qr=e=>no(e,oo),Xr=e=>no(e,uo,!0),eo=e=>no(e,co,!0),to=(e,t,n)=>{const r=vr.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},no=(e,t,n=!1)=>{const r=wr.exec(e);return!!r&&(r[1]?t(r[1]):n)},ro=e=>"position"===e||"percentage"===e,oo=e=>"image"===e||"url"===e,io=e=>"length"===e||"size"===e||"bg-size"===e,so=e=>"length"===e,ao=e=>"number"===e,lo=e=>"family-name"===e,co=e=>"number"===e||"weight"===e,uo=e=>"shadow"===e,po=((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(mr);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:p,maybePostfixModifierPosition:f}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let h=!!f,m=r(h?p.substring(0,f):p);if(!m){if(!h){l=e+(l.length>0?" "+l:l);continue}if(m=r(p),!m){l=e+(l.length>0?" "+l:l);continue}h=!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,h);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:ur(e.cacheSize),parseClassName:fr(e),sortModifiers:hr(e),...Qn(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=gr(t))&&(o&&(o+=" "),o+=n);return o})(...e))})(()=>{const e=br("color"),t=br("font"),n=br("text"),r=br("font-weight"),o=br("tracking"),i=br("leading"),s=br("breakpoint"),a=br("container"),l=br("spacing"),c=br("radius"),u=br("shadow"),d=br("inset-shadow"),p=br("text-shadow"),f=br("drop-shadow"),h=br("blur"),m=br("perspective"),g=br("aspect"),y=br("ease"),b=br("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Yr,Pr],w=()=>[Yr,Pr,l],x=()=>[_r,"full","auto",...w()],k=()=>[Rr,"none","subgrid",Yr,Pr],S=()=>["auto",{span:["full",Rr,Yr,Pr]},Rr,Yr,Pr],E=()=>[Rr,"auto",Yr,Pr],M=()=>["auto","min","max","fr",Yr,Pr],C=()=>["auto",...w()],_=()=>[_r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],N=()=>[_r,"screen","full","dvw","lvw","svw","min","max","fit",...w()],R=()=>[_r,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],O=()=>[e,Yr,Pr],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Gr,qr,{position:[Yr,Pr]}],A=()=>["auto","cover","contain",Zr,zr,{size:[Yr,Pr]}],D=()=>[Or,Jr,Fr],$=()=>["","none","full",c,Yr,Pr],L=()=>["",Nr,Jr,Fr],j=()=>[Nr,Or,Gr,qr],I=()=>["","none",h,Yr,Pr],z=()=>["none",Nr,Yr,Pr],P=()=>["none",Nr,Yr,Pr],F=()=>[Nr,Yr,Pr],B=()=>[_r,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tr],breakpoint:[Tr],color:[Ar],container:[Tr],"drop-shadow":[Tr],ease:["in","out","in-out"],font:[Ir],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tr],shadow:[Tr],spacing:["px",Nr],text:[Tr],"text-shadow":[Tr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_r,Pr,Yr,g]}],container:["container"],columns:[{columns:[Nr,Pr,Yr,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:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[Rr,"auto",Yr,Pr]}],basis:[{basis:[_r,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nr,_r,"auto","initial","none",Pr]}],grow:[{grow:["",Nr,Yr,Pr]}],shrink:[{shrink:["",Nr,Yr,Pr]}],order:[{order:[Rr,"first","last","none",Yr,Pr]}],"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()}],pbs:[{pbs:w()}],pbe:[{pbe: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()}],mbs:[{mbs:C()}],mbe:[{mbe: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:_()}],"inline-size":[{inline:["auto",...N()]}],"min-inline-size":[{"min-inline":["auto",...N()]}],"max-inline-size":[{"max-inline":["none",...N()]}],"block-size":[{block:["auto",...R()]}],"min-block-size":[{"min-block":["auto",...R()]}],"max-block-size":[{"max-block":["none",...R()]}],w:[{w:[a,"screen",..._()]}],"min-w":[{"min-w":[a,"screen","none",..._()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",n,Jr,Fr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,eo,Hr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Or,Pr]}],"font-family":[{font:[Kr,Vr,t]}],"font-features":[{"font-features":[Pr]}],"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,Yr,Pr]}],"line-clamp":[{"line-clamp":[Nr,"none",Yr,Br]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Yr,Pr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Yr,Pr]}],"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:[Nr,"from-font","auto",Yr,Fr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Nr,"auto",Yr,Pr]}],"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",Yr,Pr]}],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",Yr,Pr]}],"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:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rr,Yr,Pr],radial:["",Yr,Pr],conic:[Rr,Yr,Pr]},Qr,Ur]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"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-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":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":[Nr,Yr,Pr]}],"outline-w":[{outline:["",Nr,Jr,Fr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,Xr,Wr]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,Xr,Wr]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Nr,Fr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",p,Xr,Wr]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Nr,Yr,Pr]}],"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":[Nr]}],"mask-image-linear-from-pos":[{"mask-linear-from":j()}],"mask-image-linear-to-pos":[{"mask-linear-to":j()}],"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":j()}],"mask-image-t-to-pos":[{"mask-t-to":j()}],"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":j()}],"mask-image-r-to-pos":[{"mask-r-to":j()}],"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":j()}],"mask-image-b-to-pos":[{"mask-b-to":j()}],"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":j()}],"mask-image-l-to-pos":[{"mask-l-to":j()}],"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":j()}],"mask-image-x-to-pos":[{"mask-x-to":j()}],"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":j()}],"mask-image-y-to-pos":[{"mask-y-to":j()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Yr,Pr]}],"mask-image-radial-from-pos":[{"mask-radial-from":j()}],"mask-image-radial-to-pos":[{"mask-radial-to":j()}],"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":[Nr]}],"mask-image-conic-from-pos":[{"mask-conic-from":j()}],"mask-image-conic-to-pos":[{"mask-conic-to":j()}],"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:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Yr,Pr]}],filter:[{filter:["","none",Yr,Pr]}],blur:[{blur:I()}],brightness:[{brightness:[Nr,Yr,Pr]}],contrast:[{contrast:[Nr,Yr,Pr]}],"drop-shadow":[{"drop-shadow":["","none",f,Xr,Wr]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Nr,Yr,Pr]}],"hue-rotate":[{"hue-rotate":[Nr,Yr,Pr]}],invert:[{invert:["",Nr,Yr,Pr]}],saturate:[{saturate:[Nr,Yr,Pr]}],sepia:[{sepia:["",Nr,Yr,Pr]}],"backdrop-filter":[{"backdrop-filter":["","none",Yr,Pr]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Nr,Yr,Pr]}],"backdrop-contrast":[{"backdrop-contrast":[Nr,Yr,Pr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nr,Yr,Pr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nr,Yr,Pr]}],"backdrop-invert":[{"backdrop-invert":["",Nr,Yr,Pr]}],"backdrop-opacity":[{"backdrop-opacity":[Nr,Yr,Pr]}],"backdrop-saturate":[{"backdrop-saturate":[Nr,Yr,Pr]}],"backdrop-sepia":[{"backdrop-sepia":["",Nr,Yr,Pr]}],"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",Yr,Pr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nr,"initial",Yr,Pr]}],ease:[{ease:["linear","initial",y,Yr,Pr]}],delay:[{delay:[Nr,Yr,Pr]}],animate:[{animate:["none",b,Yr,Pr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Yr,Pr]}],"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:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Yr,Pr,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"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",Yr,Pr]}],"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-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":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-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":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",Yr,Pr]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Nr,Jr,Fr,Br]}],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","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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 fo(...e){return po(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Jn(e))&&(r&&(r+=" "),r+=t);return r}(e))}var ho=e.createContext({});function mo(){return mo=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},mo.apply(null,arguments)}function go(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 yo(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 go(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)?go(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 bo(e){return(bo="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 vo(e){var t=function(e,t){if("object"!=bo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=bo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==bo(t)?t:t+""}function wo(e,t,n){return(t=vo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xo(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 ko,So={exports:{}};var Eo=(ko||(ko=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}()}(So)),So.exports);const Mo=s(Eo),Co=Math.round;function _o(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 No=(e,t,n)=>0===n?e:e/100;function Ro(e,t){const n=t||255;return e>n?n:e<0?0:e}class Oo{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(wo(this,"isValid",!0),wo(this,"r",0),wo(this,"g",0),wo(this,"b",0),wo(this,"a",1),wo(this,"_h",void 0),wo(this,"_s",void 0),wo(this,"_l",void 0),wo(this,"_v",void 0),wo(this,"_max",void 0),wo(this,"_min",void 0),wo(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 Oo)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=Ro(e.r),this.g=Ro(e.g),this.b=Ro(e.b),this.a="number"==typeof e.a?Ro(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:Co(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:Co(o("r")),g:Co(o("g")),b:Co(o("b")),a:Co(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=>Co((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=Co(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=Co(100*this.getSaturation()),n=Co(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]=Ro(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=Co(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=Co(255*(o+u)),this.g=Co(255*(i+u)),this.b=Co(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=Co(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=Co(n*(1-t)*255),c=Co(n*(1-t*a)*255),u=Co(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=_o(e,No);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=_o(e,No);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=_o(e,(e,t)=>t.includes("%")?Co(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var To=[{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 Ao(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 Do(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 $o(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 Lo=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function jo(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 Io(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(n),!0).forEach(function(t){wo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Lo.primary=Lo[5];var zo="data-rc-order",Po="data-rc-priority",Fo=new Map;function Bo(){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 Ho(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Vo(e){return Array.from((Fo.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function qo(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(zo,s),a&&i&&l.setAttribute(Po,"".concat(i)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=Ho(t),u=c.firstChild;if(r){if(a){var d=(t.styles||Vo(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(zo)))return!1;var t=Number(e.getAttribute(Po)||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 Uo(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Ho(n),o=Vo(r),i=Io(Io({},n),{},{styles:o});!function(e,t){var n=Fo.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=qo("",t),o=r.parentNode;Fo.set(e,o),e.removeChild(r)}}(r,i);var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ho(t);return(t.styles||Vo(n)).find(function(n){return n.getAttribute(Bo(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=qo(e,i);return u.setAttribute(Bo(i),t),u}function Wo(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function Yo(e){return function(e){return Wo(e)instanceof ShadowRoot}(e)?Wo(e):null}var Jo={};function Ko(e,t){}function Go(e,t){}function Zo(e,t,n){t||Jo[n]||(e(!1,n),Jo[n]=!0)}function Qo(e,t){Zo(Ko,e,t)}function Xo(e){return"object"===bo(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===bo(e.icon)||"function"==typeof e.icon)}function ei(){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 ti(t,n,r){return r?e.createElement(t.tag,Io(Io({key:n},ei(t.attrs)),r),(t.children||[]).map(function(e,r){return ti(e,"".concat(n,"-").concat(t.tag,"-").concat(r))})):e.createElement(t.tag,Io({key:n},ei(t.attrs)),(t.children||[]).map(function(e,r){return ti(e,"".concat(n,"-").concat(t.tag,"-").concat(r))}))}function ni(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Oo(e),o=r.toHsv(),i=5;i>0;i-=1){var s=new Oo({h:Ao(o,i,!0),s:Do(o,i,!0),v:$o(o,i,!0)});n.push(s)}n.push(r);for(var a=1;a<=4;a+=1){var l=new Oo({h:Ao(o,a),s:Do(o,a),v:$o(o,a)});n.push(l)}return"dark"===t.theme?To.map(function(e){var r=e.index,o=e.amount;return new Oo(t.backgroundColor||"#141414").mix(n[r],o).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function ri(e){return e?Array.isArray(e)?e:[e]:[]}Qo.preMessage=function(e){},Qo.resetWarned=function(){Jo={}},Qo.noteOnce=function(e,t){Zo(Go,e,t)};var oi=["icon","className","onClick","style","primaryColor","secondaryColor"],ii={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var si=function(t){var n,r,i,s,a,l,c,u,d=t.icon,p=t.className,f=t.onClick,h=t.style,m=t.primaryColor,g=t.secondaryColor,y=xo(t,oi),b=o.useRef(),v=ii;if(m&&(v={primaryColor:m,secondaryColor:g||ni(m)}),n=b,r=e.useContext(ho),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=Yo(n.current);Uo(l,"@ant-design-icons",{prepend:!a,csp:i,attachTo:e})},[]),c=Xo(d),u="icon should be icon definiton, but got ".concat(d),Qo(c,"[@ant-design/icons] ".concat(u)),!Xo(d))return null;var w=d;return w&&"function"==typeof w.icon&&(w=Io(Io({},w),{},{icon:w.icon(v.primaryColor,v.secondaryColor)})),ti(w.icon,"svg-".concat(w.name),Io(Io({className:p,onClick:f,style:h,"data-icon":w.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function ai(e){var t=yo(ri(e),2),n=t[0],r=t[1];return si.setTwoToneColors({primaryColor:n,secondaryColor:r})}si.displayName="IconReact",si.getTwoToneColors=function(){return Io({},ii)},si.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;ii.primaryColor=t,ii.secondaryColor=n||ni(t),ii.calculated=!!n};var li=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];ai(Lo.primary);var ci=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=xo(e,li),d=o.useContext(ho),p=d.prefixCls,f=void 0===p?"anticon":p,h=d.rootClassName,m=Mo(h,f,wo(wo({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-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=yo(ri(c),2),v=b[0],w=b[1];return o.createElement("span",mo({role:"img","aria-label":r.name},u,{ref:t,tabIndex:g,onClick:l,className:m}),o.createElement(si,{icon:r,primaryColor:v,secondaryColor:w,style:y}))});ci.displayName="AntdIcon",ci.getTwoToneColor=function(){var e=si.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},ci.setTwoToneColor=ai;var ui,di={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"},pi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:di}))},fi=o.forwardRef(pi),hi={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"},mi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:hi}))},gi=o.forwardRef(mi),yi={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"},bi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:yi}))},vi=o.forwardRef(bi),wi={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"},xi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:wi}))},ki=o.forwardRef(xi),Si={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"},Ei=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Si}))},Mi=o.forwardRef(Ei),Ci={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"},_i=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Ci}))},Ni=o.forwardRef(_i),Ri={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"},Oi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Ri}))},Ti=o.forwardRef(Oi),Ai={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"},Di=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Ai}))},$i=o.forwardRef(Di),Li={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"},ji=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Li}))},Ii=o.forwardRef(ji),zi={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"},Pi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:zi}))},Fi=o.forwardRef(Pi),Bi={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"},Hi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Bi}))},Vi=o.forwardRef(Hi),qi={},Ui={exports:{}};function Wi(){return ui||(ui=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(Ui)),Ui.exports}var Yi,Ji={};var Ki,Gi={},Zi={},Qi={},Xi={exports:{}},es={exports:{}},ts={exports:{}},ns={exports:{}};function rs(){return Ki||(Ki=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}(ns)),ns.exports}var is,ss,as,ls,cs={exports:{}};function us(){return ss||(ss=1,function(e){var t=rs().default,n=(is||(is=1,function(e){var t=rs().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}(cs)),cs.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}(ts)),ts.exports}function ds(){return ls||(ls=1,function(e){var t=(as||(as=1,function(e){var t=us();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}(es)),es.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}(Xi)),Xi.exports}var ps,fs,hs={};function ms(){if(fs)return Qi;fs=1;var e=Wi().default;Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.default=void 0;var t=e(ds()),n=(ps||(ps=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.commonLocale=void 0,hs.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),hs),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 Qi.default=r,Qi}var gs,ys,bs,vs,ws,xs,ks={};function Ss(){if(gs)return ks;gs=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.default=void 0;return ks.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},ks}function Es(){if(ys)return Zi;ys=1;var e=Wi().default;Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.default=void 0;var t=e(ms()),n=e(Ss());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="确定",Zi.default=r,Zi}function Ms(){if(bs)return Gi;bs=1;var e=Wi().default;Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.default=void 0;var t=e(Es());return Gi.default=t.default,Gi}function Cs(){if(vs)return qi;vs=1;var e=Wi().default;Object.defineProperty(qi,"__esModule",{value:!0}),qi.default=void 0;var t=e((Yi||(Yi=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.default=void 0,Ji.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:"页码"}),Ji)),n=e(Ms()),r=e(Es()),o=e(Ss());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 qi.default=s,qi}function _s(){return xs?ws:(xs=1,ws=Cs())}const Ns=s(_s()),Rs=e=>(e.colspan??6)>=12,Os=e=>"section"===e||"table"===e||"grid"===e;function Ts(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):Array.isArray(e)?e.map(e=>"string"==typeof e?e:String("object"==typeof e&&null!==e&&"_id"in e?e._id:e)).join(","):String("object"==typeof e&&"_id"in e?e._id:e)}function As(e,t){return 0===e.length?"":t?e.join(","):e[0]}function Ds(e){return"string"==typeof e?e:String(e&&"object"==typeof e&&"field"in e?e.field:e)}function $s({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,p=(t.lookupDisplayFields||["name"]).map(Ds),f=p[0]||"name",h=t.lookupSortField||"",m=t.lookupSortOrder||"asc",g=e.useMemo(()=>!d&&t.lookupFillRules||[],[d,t.lookupFillRules]),y=e.useMemo(()=>function(e,t){if(!e)return;function n(e){const n=e.indexOf(".");if(-1!==n){const r=e.slice(0,n),o=e.slice(n+1),i=t[r];if(!i)return{value:"",isArray:!1};try{const e="string"==typeof i?JSON.parse(i):i;if(!Array.isArray(e))return{value:"",isArray:!1};const t=e.map(e=>e[o]).filter(e=>null!=e&&""!==e);return{value:JSON.stringify(t),isArray:!0}}catch{return{value:"",isArray:!1}}}const r=t[e]??"";return Array.isArray(r)?{value:JSON.stringify(r),isArray:!0}:{value:String(r),isArray:!1}}let r=("string"==typeof e?e:JSON.stringify(e)).replace(/"\{([^{}]+)\}"/g,(e,t)=>{const r=n(t);return r.isArray?r.value:`"${r.value}"`});return r=r.replace(/\{([^{}]+)\}/g,(e,t)=>{const r=n(t);return r.isArray,r.value}),r}(t.lookupFilters,a||{}),[t.lookupFilters,a]),b=e.useMemo(()=>function(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("string"!=typeof e)return[String(e)];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]),v=e.useRef(y);e.useEffect(()=>{const e=v.current;if(v.current=y,i)return;if(void 0===e||e===y)return;if(0===b.length||!u)return;const t=JSON.stringify(["_id","in",b]),n=y?JSON.stringify([JSON.parse(t),"and",JSON.parse(y)]):t;In(u,{filters:n,fields:"_id",top:b.length}).then(({data:e})=>{const t=new Set(e.map(e=>e._id)),n=b.filter(e=>t.has(e));n.length!==b.length&&r(As(n,d))})},[y]);const[w,x]=e.useState(new Map);e.useEffect(()=>{if(!u||0===b.length)return;const e=b.filter(e=>!w.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);In(u,{filters:t,fields:`_id,${f}`,top:e.length}).then(({data:e})=>{x(t=>{const n=new Map(t);for(const r of e)n.set(r._id,r[f]||r._id);return n})})},[u,b.join(","),f]);const k=e.useCallback(e=>{const t=b.filter(t=>t!==e);r(As(t,d))},[b,r,d]),S=e.useCallback((e,t,n)=>{if(r(As(e,d)),x(e=>{const n=new Map(e);for(const[r,o]of t)n.set(r,o);return n}),c(!1),!d&&g.length>0&&1===e.length&&o){const t=e=>{const t={};for(const n of g)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(t[n.targetField]=Ts(e[n.sourceField]));Object.keys(t).length>0&&o(t)};if(n){const r=g.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(",");In(u,{filters:n,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const n=g.map(e=>e.sourceField).filter(Boolean),r=JSON.stringify(["_id","=",e[0]]),o=["_id",...n].join(",");In(u,{filters:r,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[r,d,g,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]"},b.length>0&&React.createElement("div",{className:"flex flex-wrap gap-1.5"},b.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[13px] text-slate-700 rounded pr-2 py-0.5"},w.get(e)||e)))):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-amber-50/80 hover:border-indigo-300"))},b.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},b.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[13px] 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"},w.get(e)||e),React.createElement(oe,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),k(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement(j,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement($,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(Ls,{objectName:u,displayFields:p,multiple:d,selectedIds:b,filters:y,sortField:h,sortOrder:m,onConfirm:S,onClose:()=>c(!1)}))}function Ls({objectName:n,displayFields:r,multiple:o,selectedIds:i,filters:s,sortField:a,sortOrder:l,onConfirm:c,onClose:u}){const[d,p]=e.useState([]),[f,h]=e.useState(0),[m,g]=e.useState(!1),[y,b]=e.useState(1),[v,w]=e.useState(""),[x,k]=e.useState(new Set(i)),[S,E]=e.useState([]),M=e.useRef(void 0),C=r[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=Fn.get(e);if(t)return t;const n=Bn.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 Fn.set(e,i),i}catch{return[]}finally{Bn.delete(e)}})();return Bn.set(e,r),r})(n).then(E)},[n]);const _=e.useMemo(()=>{const e=new Map;for(const t of S)e.set(t.value,t.label);return e},[S]),N=e.useCallback(async(e,t)=>{g(!0);try{const o=[];let i;s&&o.push(s),t&&o.push(JSON.stringify([C,"contains",t])),2===o.length?i=JSON.stringify([JSON.parse(o[0]),"and",JSON.parse(o[1])]):1===o.length&&(i=o[0]);const c=["_id",...r].join(","),u=await In(n,{filters:i,fields:c,top:10,skip:10*(e-1),sort:`${a||C} ${l||"asc"}`});p(u.data),h(u.total)}finally{g(!1)}},[n,r,C,s,a,l]);e.useEffect(()=>{N(y,v)},[y]);const R=e.useCallback(e=>{w(e),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{b(1),N(1,e)},300)},[N]),O=e.useMemo(()=>r.map(e=>{const t="string"==typeof e?e:String(e&&"object"==typeof e&&"field"in e?e.field:e);return{title:_.get(t)||t,dataIndex:t,key:t,ellipsis:!0,render:e=>null!=e?String(e):"-"}}),[r,_]),T=e.useMemo(()=>({type:o?"checkbox":"radio",selectedRowKeys:[...x],onChange:e=>{if(k(new Set(e)),!o&&e.length>0){const t=e[0],n=d.find(e=>e._id===t),r=new Map;n&&r.set(t,n[C]||t),c([t],r,n)}}}),[o,x,d,C,c]);return React.createElement(t.ConfigProvider,{locale:Ns},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement(j,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:u,onOk:o?()=>{const e=new Map;for(const t of d){const n=t._id;x.has(n)&&e.set(n,t[C]||n)}c([...x],e)}:void 0,okText:o?"确定"+(x.size>0?` (${x.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:`搜索 ${_.get(C)||C}...`,allowClear:!0,onChange:e=>R(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:O,dataSource:d,loading:m,rowSelection:T,pagination:{current:y,pageSize:10,total:f,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>b(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(o)k(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[C]||t),c([t],n,e)}},style:{cursor:"pointer"}})})))}const js=n=>{const{visible:r,multiple:o,loading:i,users:s,searchKeyword:a,searchInputValue:l,tempSelectedUsers:c,clearable:u,rootDeptInfo:d,deptPath:p,currentLevelDepts:f,showSelectedPanel:h,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:_,onClearAll:N}=n,R=s.length>0&&s.every(e=>c.find(t=>t._id===e._id)),O=!!a,{visibleCount:T,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,[p.length,a]),D=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),$=e.useRef(null),[L,j]=e.useState(null),[I,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},j(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,j(null),z(null),t!==n&&t>=0&&n>=0&&M(t,n)},[M]);return e.createElement(t.Drawer,{open:r,placement:"bottom",height:"100dvh",closable:!1,destroyOnClose:!0,rootClassName:"steedos-mobile-drawer",onClose:_,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 height: 100vh !important;\n height: 100dvh !important;\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",paddingTop:"calc(12px + env(safe-area-inset-top, 0px))"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},p.length>0&&e.createElement("span",{onClick:g,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Ni,null)),e.createElement("span",{onClick:_,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(vi,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},o&&s.length>0&&!O&&p.length>0&&e.createElement("span",{onClick:E,style:{fontSize:14,color:"#1890ff",cursor:"pointer",WebkitTapHighlightColor:"transparent"}},R?"取消全选":"全选"))),e.createElement("div",{style:{padding:"4px 16px 8px",flexShrink:0}},e.createElement(t.Input,{placeholder:"搜索姓名、邮箱或用户名",prefix:e.createElement(Ii,null),value:l,onChange:e=>w(e.target.value),allowClear:!0,size:"large"})),p.length>0&&!O&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),p.length>0&&!O&&(()=>{const t=p.length>2,n=p.length>2?p.slice(-2):p,r=p.length>2?p.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($i,{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===p.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement($i,{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},O||p.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(fi,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement($i,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),O||0===p.length||0===f.length?null:e.createElement(e.Fragment,null,f.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(fi,{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($i,{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,T).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(gi,{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)))}),T<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}})))),h&&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}},"清空全部")),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=I===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(ki,{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(vi,{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&&!h?"▲":c.length>0&&h?"▼":""),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 Is(e){return e}function zs(e={}){return{...e}}async function Ps(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,hr,_display:_ui{sort_no,organization}}}`,n=await fetch("/graphql",{method:"POST",headers:zs({"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,hr:e.hr}))}async function Fs(e,t){if(t=t?.trim()||"",!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,hr,_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:zs({"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,hr:e.hr}))}async function Bs(e,t){if(t=t?.trim()||""){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:zs({"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:zs({"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:zs()}),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 Hs=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择人员",fetchUsers:a=Fs,fetchDeptTree:l=Bs,style:c,dispatchEvent:u,clearable:d=!0,isTableMode:p=!1,hasError:f=!1,formalTableMode:h=!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),[_,N]=e.useState([]),[R,O]=e.useState([]),[T,A]=e.useState(!1),[D,$]=e.useState(""),[L,j]=e.useState(""),[I,z]=e.useState(""),[P,F]=e.useState(null),[B,H]=e.useState([]),[V,q]=e.useState(null),[U,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:pe,sentinelRef:fe}=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]),he=e.useRef(!1),me=e.useCallback(async e=>{if(!g||0===g.length||!y)return;const t=[],n=new Map;for(const i of g){if(!i.sourceField||!i.targetField)continue;const e=i.sourceField.indexOf(".");if(e>0){const t=i.sourceField.substring(0,e),r=i.sourceField.substring(e+1);n.has(t)||n.set(t,[]),n.get(t).push({subField:r,targetField:i.targetField})}else t.push(i)}const r={};if(t.length>0){const n=t.map(e=>e.sourceField).filter(Boolean),o=e=>{for(const n of t)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(r[n.targetField]=Ts(e[n.sourceField]))};if(n.every(t=>t in e&&null!=e[t]))o(e);else try{const t=`{rows:space_users(filters: [["user","=","${e.user}"]], top: 1){${["_id",...n].join(",")}}}`,r=await fetch("/graphql",{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),i=await r.json(),s=i.data?.rows||[];s.length>0&&o(s[0])}catch{}}const o={organization:"organizations"};for(const[i,s]of n){const t=e[i];if(t&&"object"==typeof t&&!o[i]){for(const e of s)null!=t[e.subField]&&(r[e.targetField]=Ts(t[e.subField]));continue}const n=o[i];if(!n)continue;let a=e[i];if(!a)try{const t=`{rows:space_users(filters: [["user","=","${e.user}"]], top: 1){_id,${i}}}`,n=await fetch(Is("/graphql"),{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();a=r.data?.rows?.[0]?.[i]}catch{}if(!a)continue;const l=s.map(e=>e.subField);try{const e=`{rows:${n}(filters: [["_id","=","${a}"]], top: 1){${["_id",...l].join(",")}}}`,t=await fetch(Is("/graphql"),{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),o=await t.json(),i=o.data?.rows?.[0];if(i)for(const n of s)null!=i[n.subField]&&(r[n.targetField]=Ts(i[n.subField]))}catch{}}Object.keys(r).length>0&&y(r)},[g,y]);e.useEffect(()=>{ee.current={props:n}}),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id)return void N([{_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 N(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,hr}}`;fetch("/graphql",{method:"POST",headers:zs({"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,hr:e.hr}));n=e.map(e=>n.find(t=>t.user===e)).filter(e=>!!e),N(n),!i&&g&&g.length>0&&1===n.length&&y&&!he.current&&(he.current=!0,me(n[0]))})}else N([])},[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(""),$(""),j("");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 ge=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:ge(e.children,t,n)}:e),ye=e=>{j(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)},be=e=>{if(i){if(!R.find(t=>t._id===e._id)){const t=[...R,e];O(t)}}else O([e]),te?setTimeout(()=>{ke([e])},0):(G(e._id),setTimeout(()=>{G(null),ke([e])},300))},ve=e=>{O(R.filter(t=>t._id!==e))},we=()=>{F(null)},xe=()=>{if(S.length>0&&S.every(e=>R.find(t=>t._id===e._id))){const e=new Set(S.map(e=>e._id));O(R.filter(t=>!e.has(t._id)))}else{const e=[...R];S.forEach(t=>{e.find(e=>e._id===t._id)||e.push(t)}),O(e)}},ke=async e=>{if(N(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,hr}}`;let r=[];try{const e=await fetch("/graphql",{method:"POST",headers:zs({"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:zs({"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:t.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)}w(!1),i||1!==e.length||await me(e[0])},Se=async()=>{await ke(R)},Ee=()=>{O([..._]),w(!1)},Me=e.useCallback(async(e,t)=>{ie(n=>[...n,{id:e,name:t}]),C(e),$(""),j(""),A(!0);try{const[t,n]=await Promise.all([l(e),Ps(e)]);ae(t),E(n)}catch{ae([]),E([])}finally{A(!1)}},[l]),Ce=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),$(""),j(""),A(!0);try{const[e,t]=await Promise.all([l(n.id),Ps(n.id)]);ae(e),E(t)}catch{ae([]),E([])}finally{A(!1)}},[oe,l]),_e=e.useCallback(async()=>{if(ue){ie([]),C(ue.id),$(""),j(""),ae([]),A(!0);try{const e=await a(ue.id);E(e)}catch{E([])}finally{A(!1)}}},[ue,a]),Ne=e.useCallback(async()=>{if(!(oe.length<=0))if(1===oe.length)await _e();else{const e=oe.slice(0,-1);ie(e);const t=e[e.length-1];C(t.id),$(""),j(""),A(!0);try{const[e,n]=await Promise.all([l(t.id),Ps(t.id)]);ae(e),E(n)}catch{ae([]),E([])}finally{A(!1)}}},[oe,_e,l]),Re=e.useCallback((e,t)=>{if(e<0||t<0||e>=R.length||t>=R.length)return;const n=[...R],[r]=n.splice(e,1);n.splice(t,0,r),O(n)},[R]),Oe=e.useCallback(e=>{R.find(t=>t._id===e._id)?ve(e._id):be(e)},[R,i,be,ve]),Te=d&&_.length>0&&(te||U);return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:_.map(e=>e.name).join(", "),onClick:()=>{w(!0),O([..._]),te&&(ne("users"),re(""),ce(!1),ie([]),ae([]),de(null))},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),variant:p||m?"borderless":"outlined",className:p?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...p?{backgroundColor:f?"rgba(254,226,226,0.9)":h?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{height:38,...f||m?{}:{backgroundColor:"rgba(255,251,235,0.8)"}}},suffix:m?null:Te?e.createElement(vi,{style:{color:"#ff4d4f",cursor:"pointer",padding:te?4:0},onMouseEnter:()=>!te&&W(!0),onMouseLeave:()=>!te&&W(!1),onClick:async e=>{e.stopPropagation(),N([]);const t=i?[]:null;u&&await u("change",{value:t},ee.current),o&&o(t),W(!1)}}):e.createElement(Vi,{style:{color:"#999"},onMouseEnter:()=>!te&&_.length>0&&W(!0),onMouseLeave:()=>!te&&W(!1)})}),!te&&e.createElement(t.Modal,{title:i?"选择人员 (多选)":"选择人员",open:v,onOk:i?Se:void 0,onCancel:Ee,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:1200,centered:!0,destroyOnClose:!0,bodyStyle:{height:"min(600px, calc(100vh - 200px))",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(Ii,null),value:I,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:T&&!M&&!D},e.createElement(t.Tree,{key:Y,treeData:x,onSelect:(e,t)=>{e.length>0?(C(String(e[0])),$(""),j(""),te&&t?.node&&(re(String(t.node.title||"")),ne("users"))):x.length>0&&C(String(x[0].key))},loadData:I?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await l(String(e));k(t=>ge(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(Ii,null),value:L,onChange:e=>ye(e.target.value),allowClear:!0,style:{flex:1}}),i&&S.length>0&&e.createElement(t.Button,{onClick:xe},S.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:T},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,pe).map(n=>{const r=!!R.find(e=>e._id===n._id);return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||be(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(gi,{style:{color:"#1890ff",flexShrink:0}}))})),pe<S.length&&e.createElement("div",{ref:fe,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!M&&!D||T?T?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((n,r)=>e.createElement("div",{key:n._id,draggable:i,onDragStart:()=>(e=>{F(e)})(r),onDragEnd:we,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=[...R],o=r[P];r.splice(P,1),r.splice(t,0,o),O(r),F(t)})(e,r),onMouseEnter:()=>q(n._id),onMouseLeave:()=>q(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(vi,{onClick:()=>ve(n._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),d&&R.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>O([]),style:{marginTop:8,padding:0}},"清空全部")))),te&&v&&e.createElement(js,{visible:v,multiple:i,loading:T,users:S,searchKeyword:D,searchInputValue:L,tempSelectedUsers:R,clearable:d,rootDeptInfo:ue,deptPath:oe,currentLevelDepts:se,showSelectedPanel:le,onDrillDown:Me,onMobileBack:Ne,onDrillBack:Ce,onBackToRoot:_e,onToggleSelectedPanel:()=>ce(e=>!e),onUserSearch:ye,onAddUser:be,onRemoveUser:ve,onToggleUser:Oe,onToggleSelectAll:xe,onReorderUsers:Re,onOk:Se,onCancel:Ee,onClearAll:()=>O([])}))};function Vs(e={}){return{...e}}async function qs(e,t){if(t=t?.trim()||""){const e=[["name","contains",t]],n=`{rows:organizations(filters: ${JSON.stringify(e)}, top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Vs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json();return(o.data?.rows||[]).map(e=>({title:e.fullname||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,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,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Vs({"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,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:Vs()}),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,parentId:e.parent}))}}function Us(e,t){for(const n of e){if(n.key===t)return n;if(n.children){const e=Us(n.children,t);if(e)return e}}return null}const Ws=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择部门/分组",fetchDeptTree:a=qs,style:l,dispatchEvent:c,data:u,isTableMode:d=!1,hasError:p=!1,formalTableMode:f=!1,pickerFillRules:h,onFillFields:m,valueFormat:g="object"}=n,[y,b]=e.useState(!1),[v,w]=e.useState([]),[x,k]=e.useState([]),[S,E]=e.useState([]),[M,_]=e.useState(!1),[N,R]=e.useState(""),[O,T]=e.useState(""),[A,D]=e.useState([]),[$,L]=e.useState(0),[j,I]=e.useState(!1),[z,P]=e.useState(null),[F,B]=e.useState(null),[H,V]=e.useState(null),q=e.useRef(null),U=e.useRef(0),W=e.useRef(null),Y=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}();e.useEffect(()=>{W.current={props:n}}),e.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id){const e=r;return void k([{id:e.id,name:e.name||"",fullname:e.fullname||e.name||""}])}if(Array.isArray(r)&&r.length>0&&"object"==typeof r[0]&&r[0].id)return void k(r.map(e=>({id:e.id,name:e.name||"",fullname:e.fullname||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(0===e.length)return void k([]);const t=`{rows:organizations(filters: [["_id","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Vs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{const n=t.data?.rows||[],r=new Map(n.map(e=>[String(e._id),e])),o=e.map(e=>{const t=r.get(e);return t?{id:String(t._id),name:t.name||"",fullname:t.fullname||t.name||""}:{id:e,name:e,fullname:e}});k(o)}).catch(()=>{k(e.map(e=>({id:e,name:e,fullname:e})))})},[r,i]);const J=e.useCallback((e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:J(e.children,t,n)}:e),[]);e.useEffect(()=>{y&&(_(!0),L(e=>e+1),w([]),D([]),T(""),R(""),a().then(e=>{w(e);const t=e.map(e=>e.key);D(t),e.forEach(e=>{e.isLeaf||a(String(e.key)).then(t=>{w(n=>J(n,e.key,t))})})}).finally(()=>_(!1)))},[y,a]);const K=e.useCallback(async(e,t,n)=>{const r=t;let o=n||"";return o||(o=await async function(e,t){try{const n=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,r=await fetch("/graphql",{method:"POST",headers:Vs({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json(),i=o.data?.node?.[0];return i?i.fullname?i.fullname:i.name||t:t}catch{return t}}(e,r)),{id:e,name:r,fullname:o}},[]),G=e.useCallback(async e=>{const t=C(u,{value:e}),n=await(c?.("change",t,W.current));n?.prevented||o?.(e)},[u,c,o]),Z=e.useCallback(e=>{if(!h||0===h.length||!m)return;const t=`{rows:organizations(filters: [["_id","=","${e}"]], top: 1){${["_id",...h.map(e=>e.sourceField).filter(Boolean)].join(",")}}}`;fetch("/graphql",{method:"POST",headers:Vs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];if(t.length>0){const e=t[0],n={};for(const t of h)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(n[t.targetField]=Ts(e[t.sourceField]));Object.keys(n).length>0&&m(n)}})},[h,m]),Q=e.useCallback(e=>{if(R(e),q.current&&clearTimeout(q.current),!e)return T(""),_(!0),void a().then(e=>{w(e),L(e=>e+1);const t=e.map(e=>e.key);D(t),e.forEach(e=>{e.isLeaf||a(String(e.key)).then(t=>{w(n=>J(n,e.key,t))})})}).finally(()=>_(!1));q.current=setTimeout(()=>{T(e),_(!0),a(void 0,e).then(e=>{w(e),L(e=>e+1)}).finally(()=>_(!1))},300)},[a,J]),X=e.useCallback(()=>{b(!0),E([...x])},[x]),ee=e.useCallback(()=>{E([...x]),b(!1)},[x]),te=e.useCallback(e=>{if(0===e.length)return;const t=String(e[0]),n=Us(v,t);P(t),K(t,n?.title||t,n?.fullname).then(e=>{setTimeout(async()=>{P(null),k([e]),b(!1);const t="string"===g?e.id:e;await G(t),i||Z(e.id)},Y?0:300)})},[v,K,g,G,Z,Y,i]),ne=e.useCallback(async e=>{let t;t=Array.isArray(e)?e.map(String):(e.checked||[]).map(String);const n=new Set(t),r=S.filter(e=>n.has(e.id)),o=new Set(r.map(e=>e.id)),i=t.filter(e=>!o.has(e)).map(async e=>{const t=Us(v,e);return K(e,t?.title||e,t?.fullname)}),s=await Promise.all(i);E([...r,...s])},[S,v,K]),re=e.useCallback(async()=>{k(S),b(!1);const e="string"===g?S.map(e=>e.id):S;await G(e),i||1!==S.length||Z(S[0].id)},[S,g,G,i,Z]),oe=e.useCallback(e=>{E(t=>t.filter(t=>t.id!==e))},[]),ie=e.useCallback(async e=>{e.stopPropagation(),k([]);const t=i?[]:null;await G(t),I(!1)},[i,G]),se=e.useCallback(e=>B(e),[]),ae=e.useCallback(()=>B(null),[]),le=e.useCallback((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===F||F===t)return;const n=Date.now();if(n-U.current<100)return;U.current=n;const r=[...S],[o]=r.splice(F,1);r.splice(t,0,o),E(r),B(t)},[F,S]),ce=x.map(e=>e.fullname||e.name).join(", "),ue=x.length>0&&(Y||j),de=e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column",borderRight:i?"1px solid #f0f0f0":"none",minWidth:0}},e.createElement(t.Input,{placeholder:"搜索部门/分组",prefix:e.createElement(Ii,null),value:N,onChange:e=>Q(e.target.value),allowClear:!0,style:{marginBottom:12}}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:M},v.length>0?e.createElement(t.Tree,{key:$,treeData:v,loadData:O?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await a(String(e));w(t=>J(t,e,n))},showLine:!0,checkable:i,checkStrictly:i,checkedKeys:i?{checked:S.map(e=>e.id),halfChecked:[]}:void 0,selectedKeys:!i&&z?[z]:[],expandedKeys:A,onExpand:D,onSelect:i?void 0:te,onCheck:i?ne:void 0}):M?null:e.createElement(t.Empty,{description:"暂无部门数据",style:{marginTop:60}})))),i&&e.createElement("div",{style:{width:220,padding:16,display:"flex",flexDirection:"column",flexShrink:0}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",S.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},S.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},S.map((t,n)=>e.createElement("div",{key:t.id,draggable:!0,onDragStart:()=>se(n),onDragEnd:ae,onDragOver:e=>le(e,n),onMouseEnter:()=>V(t.id),onMouseLeave:()=>V(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:F===n?"#e6f7ff":"#f5f5f5",borderRadius:4,cursor:"grab",transition:"all 0.3s ease",opacity:F===n?.5:1,border:F===n?"1px dashed #1890ff":"1px solid transparent"}},e.createElement(fi,{style:{color:"#1890ff",flexShrink:0}}),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13}},t.name||t.fullname),H===t.id&&e.createElement(vi,{onClick:()=>oe(t.id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f",flexShrink:0}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),S.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>E([]),style:{marginTop:8,padding:0}},"清空全部")));return e.createElement("div",{style:{...l},className:"steedos-org-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:ce,onClick:X,onMouseEnter:()=>!Y&&I(!0),onMouseLeave:()=>!Y&&I(!1),variant:d?"borderless":"outlined",className:d?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...d?{backgroundColor:p?"rgba(254,226,226,0.9)":f?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{height:38,...p?{}:{backgroundColor:"rgba(255,251,235,0.8)"}}},suffix:ue?e.createElement(vi,{style:{color:"#ff4d4f",cursor:"pointer",padding:Y?4:0},onMouseEnter:()=>!Y&&I(!0),onMouseLeave:()=>!Y&&I(!1),onClick:ie}):e.createElement(fi,{style:{color:"#999"},onMouseEnter:()=>!Y&&x.length>0&&I(!0),onMouseLeave:()=>!Y&&I(!1)})}),!Y&&e.createElement(t.Modal,{title:i?"选择部门/分组(多选)":"选择部门/分组",open:y,onOk:i?re:void 0,onCancel:ee,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:i?900:640,centered:!0,destroyOnClose:!0,styles:{body:{height:"min(520px, calc(100vh - 200px))",overflow:"hidden",padding:0}}},de),Y&&e.createElement(t.Drawer,{title:i?"选择部门/分组(多选)":"选择部门/分组",placement:"bottom",height:"80%",open:y,onClose:ee,destroyOnClose:!0,footer:i?e.createElement("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"}},e.createElement(t.Button,{onClick:ee},"取消"),e.createElement(t.Button,{type:"primary",onClick:re},"确定")):null,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden"}}},e.createElement("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}},de)))};function Ys(e={}){return{...e}}function Js({value:t,isTableMode:n=!1,minimal:r=!1}){const[o,i]=e.useState(new Map),{names:s,unresolvedIds:a}=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===a.length)return;const e=a.filter(e=>!o.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:Ys({"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.user&&r.name&&n.set(r.user,r.name);return n})}).catch(()=>{})},[t]);const l=r?"text-[13px] text-gray-700":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 s.length>0?React.createElement("div",{className:l},React.createElement("div",{className:"flex flex-wrap gap-1.5"},s.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===a.length?React.createElement("div",{className:l}):React.createElement("div",{className:l},React.createElement("div",{className:"flex flex-wrap gap-1.5"},a.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"},o.get(e)||e))))}function Ks(e={}){return{...e}}function Gs({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:Ks({"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 Zs,Qs,Xs={exports:{}},ea={};function ta(){return Qs||(Qs=1,Xs.exports=function(){if(Zs)return ea;Zs=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 ea.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,ea}()),Xs.exports}var na=ta();function ra(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 oa(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 ia=e.Fragment;function sa(e){this.content=e}function aa(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=aa(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function la(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=la(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}sa.prototype={constructor:sa,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 sa(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 sa(n)},addToStart:function(e,t){return new sa([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new sa(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 sa(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=sa.from(e)).size?new sa(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=sa.from(e)).size?new sa(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=sa.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}},sa.from=function(e){if(e instanceof sa)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new sa(t)};class ca{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 ca(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 ca(n,r)}cutByIndex(e,t){return e==t?ca.empty:0==e&&t==this.content.length?this:new ca(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 ca(r,o)}addToStart(e){return new ca([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ca(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 aa(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return la(this,e,t,n)}findIndex(e){if(0==e)return da(0,e);if(e==this.size)return da(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?da(t+1,r):da(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 ca.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new ca(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ca.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 ca(t||e,n)}static from(e){if(!e)return ca.empty;if(e instanceof ca)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ca([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ca.empty=new ca([],0);const ua={index:0,offset:0};function da(e,t){return ua.index=e,ua.offset=t,ua}function pa(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(!pa(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!pa(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let fa=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&&pa(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}};fa.none=[];class ha extends Error{}class ma{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=ya(this.content,e+this.openStart,t);return n&&new ma(n,this.openStart,this.openEnd)}removeBetween(e,t){return new ma(ga(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 ma.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 ma(ca.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 ma(e,n,r)}}function ga(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(ga(i.content,t-o-1,n-o-1)))}function ya(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=ya(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function ba(e,t,n){if(n.openStart>e.depth)throw new ha("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ha("Inconsistent open depths");return va(e,t,n,0)}function va(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=va(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(ca.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Ea(i,Ma(e,o,s,t,r))}{let r=e.parent,o=r.content;return Ea(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return Ea(i,Ca(e,t,r))}function wa(e,t){if(!t.type.compatibleContent(e.type))throw new ha("Cannot join "+t.type.name+" onto "+e.type.name)}function xa(e,t,n){let r=e.node(n);return wa(r,t.node(n)),r}function ka(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 Sa(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&&(ka(e.nodeAfter,r),i++));for(let a=i;a<s;a++)ka(o.child(a),r);t&&t.depth==n&&t.textOffset&&ka(t.nodeBefore,r)}function Ea(e,t){return e.type.checkContent(t),e.copy(t)}function Ma(e,t,n,r,o){let i=e.depth>o&&xa(e,t,o+1),s=r.depth>o&&xa(n,r,o+1),a=[];return Sa(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(wa(i,s),ka(Ea(i,Ma(e,t,n,r,o+1)),a)):(i&&ka(Ea(i,Ca(e,t,o+1)),a),Sa(t,n,o,a),s&&ka(Ea(s,Ca(n,r,o+1)),a)),Sa(r,null,o,a),new ca(a)}function Ca(e,t,n){let r=[];if(Sa(null,e,n,r),e.depth>n){ka(Ea(xa(e,t,n+1),Ca(e,t,n+1)),r)}return Sa(t,null,n,r),new ca(r)}ma.empty=new ma(ca.empty,0,0);class _a{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 fa.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 Ta(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 _a(t,n,o)}static resolveCached(e,t){let n=Oa.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 Oa.set(e,n=new Na);let r=n.elts[n.i]=_a.resolve(e,t);return n.i=(n.i+1)%Ra,r}}class Na{constructor(){this.elts=[],this.i=0}}const Ra=12,Oa=new WeakMap;class Ta{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 Aa=Object.create(null);class Da{constructor(e,t,n,r=fa.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||ca.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&&pa(this.attrs,t||e.defaultAttrs||Aa)&&fa.sameSet(this.marks,n||fa.none)}copy(e=null){return e==this.content?this:new Da(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Da(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 ma.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 ma(a,r.depth-i,o.depth-i)}replace(e,t,n){return ba(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 _a.resolveCached(this,e)}resolveNoCache(e){return _a.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()+")"),La(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=ca.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=fa.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(!fa.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=ca.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Da.prototype.text=void 0;class $a extends Da{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):La(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 $a(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $a(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 La(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ja{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Ia(e,t);if(null==n.next)return ja.empty;let r=za(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(qa(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]);qa(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new ja(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Va);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 ca.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")}}ja.empty=new ja(!0);class Ia{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 za(e){let t=[];do{t.push(Pa(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Pa(e){let t=[];do{t.push(Fa(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Fa(e){let t=function(e){if(e.eat("(")){let t=za(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=Ha(e,t)}return t}function Ba(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ha(e,t){let n=Ba(e),r=n;return e.eat(",")&&(r="}"!=e.next?Ba(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Va(e,t){return t-e}function qa(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(Va)}function Ua(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 Wa(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 Ya(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 Ja(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Ga(e,r,t[r]);return n}let Ka=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=Ja(e,n.attrs),this.defaultAttrs=Ua(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==ja.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:Wa(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Da(this,this.computeAttrs(e),ca.from(t),fa.setFrom(n))}createChecked(e=null,t,n){return t=ca.from(t),this.checkContent(t),new Da(this,this.computeAttrs(e),t,fa.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=ca.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(ca.empty,!0);return o?new Da(this,e,t.append(o),fa.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){Ya(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:fa.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 Ga{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 Za{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ja(e,r.attrs),this.excluded=null;let o=Ua(this.attrs);this.instance=o?new fa(this,o):null}create(e=null){return!e&&this.instance?this.instance:new fa(this,Wa(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new Za(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){Ya(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qa{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=sa.from(e.nodes),t.marks=sa.from(e.marks||{}),this.nodes=Ka.compile(this.spec.nodes,this),this.marks=Za.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]=ja.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?Xa(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?[]:Xa(this,t.split(" "))}this.nodeFromJSON=e=>Da.fromJSON(this,e),this.markFromJSON=e=>fa.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 Ka))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 $a(n,n.defaultAttrs,e,fa.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 Xa(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 el{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 sl(this,t,!1);return n.addAll(e,fa.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new sl(this,t,!0);return n.addAll(e,fa.none,t.from,t.to),ma.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(al(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=ll(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=ll(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new el(e,el.schemaRules(e)))}}const tl={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},nl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rl={ol:!0,ul:!0};function ol(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class il{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=fa.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(ca.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=ca.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(ca.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&&!tl.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class sl{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=ol(null,t.preserveWhitespace,0)|(n?4:0);r=o?new il(o.type,o.attrs,fa.none,!0,t.topMatch||o.type.contentMatch,i):new il(n?null:e.schema.topNodeType,null,fa.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();rl.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&&rl.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:nl.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(tl.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=fa.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):cl(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=ol(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=fa.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):cl(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new il(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 al(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ll(e){let t={};for(let n in e)t[n]=e[n];return t}function cl(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 ul{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=pl(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}=ml(pl(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&&ml(pl(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return ml(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ul(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dl(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return dl(e.marks)}}function dl(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function pl(e){return e.document||window.document}const fl=new WeakMap;function hl(e){let t=fl.get(e);return void 0===t&&fl.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 ml(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=hl(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}=ml(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 gl=Math.pow(2,16);function yl(e,t){return e+t*gl}function bl(e){return 65535&e}class vl{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 wl{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wl.empty)return wl.empty}recover(e){let t=0,n=bl(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))/gl}(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:yl(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new vl(o,d,i)}r+=c-l}return n?e+r:new vl(e+r,0,null)}touches(e,t){let n=0,r=bl(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 wl(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?wl.empty:new wl(e<0?[0,-e,0]:[0,0,e])}}wl.empty=new wl([]);class xl{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 xl(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 xl;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 vl(e,r,null)}}const kl=Object.create(null);class Sl{getMap(){return wl.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=kl[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 kl)throw new RangeError("Duplicate use of step JSON ID "+e);return kl[e]=t,t.prototype.jsonID=e,t}}class El{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new El(e,null)}static fail(e){return new El(null,e)}static fromReplace(e,t,n,r){try{return El.ok(e.replace(t,n,r))}catch(o){if(o instanceof ha)return El.fail(o.message);throw o}}}function Ml(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(Ml(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return ca.fromArray(r)}class Cl extends Sl{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 ma(Ml(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 El.fromReplace(e,this.from,this.to,o)}invert(){return new _l(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 Cl(t.pos,n.pos,this.mark)}merge(e){return e instanceof Cl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cl(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 Cl(t.from,t.to,e.markFromJSON(t.mark))}}Sl.jsonID("addMark",Cl);class _l extends Sl{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 ma(Ml(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return El.fromReplace(e,this.from,this.to,n)}invert(){return new Cl(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 _l(t.pos,n.pos,this.mark)}merge(e){return e instanceof _l&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new _l(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 _l(t.from,t.to,e.markFromJSON(t.mark))}}Sl.jsonID("removeMark",_l);class Nl extends Sl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return El.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return El.fromReplace(e,this.pos,this.pos+1,new ma(ca.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 Nl(this.pos,t.marks[n]);return new Nl(this.pos,this.mark)}}return new Rl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Nl(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 Nl(t.pos,e.markFromJSON(t.mark))}}Sl.jsonID("addNodeMark",Nl);class Rl extends Sl{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return El.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return El.fromReplace(e,this.pos,this.pos+1,new ma(ca.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Nl(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Rl(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 Rl(t.pos,e.markFromJSON(t.mark))}}Sl.jsonID("removeNodeMark",Rl);class Ol extends Sl{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Al(e,this.from,this.to)?El.fail("Structure replace would overwrite content"):El.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wl([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ol(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 Ol(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ol)||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?ma.empty:new ma(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ol(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?ma.empty:new ma(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ol(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 Ol(t.from,t.to,ma.fromJSON(e,t.slice),!!t.structure)}}Sl.jsonID("replace",Ol);class Tl extends Sl{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&&(Al(e,this.from,this.gapFrom)||Al(e,this.gapTo,this.to)))return El.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return El.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?El.fromReplace(e,this.from,this.to,n):El.fail("Content does not fit in gap")}getMap(){return new wl([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 Tl(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 Tl(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 Tl(t.from,t.to,t.gapFrom,t.gapTo,ma.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Al(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 Dl(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 _l(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 ma(ca.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new Ol(a+e.index,a+e.index+e[0].length,r))}}else s.push(new Ol(a,c,ma.empty));a=c}if(!r.validEnd){let t=r.fillBefore(ca.empty,!0);e.replace(a,a,new ma(t,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function $l(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Ll(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||!$l(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function jl(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(Il).concat({type:t,attrs:n}).concat(i.map(Il)):null}function Il(e){return{type:e,attrs:null}}function zl(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 Pl(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 Fl(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 Bl(e,t){let n=e.resolve(t),r=n.index();return Hl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Hl(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 Vl(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&&Hl(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 ql(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 Ul(e,t,n=t,r=ma.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Wl(o,i,r)?new Ol(t,n,r):new Yl(o,i,r).fit()}function Wl(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Sl.jsonID("replaceAround",Tl);class Yl{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=ca.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=ca.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 ma(o,i,s);return e>-1?new Tl(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Ol(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=Gl(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(ca.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=Gl(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new ma(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=Gl(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new ma(Jl(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new ma(Jl(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 h=0;h<o.length;h++)this.openFrontierNode(o[h]);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 p=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(Zl(e.mark(d.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?p:-1)))}let f=l==s.childCount;f||(p=-1),this.placed=Kl(this.placed,t,ca.from(c)),this.frontier[t].match=u,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let h=0,m=s;h<p;h++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=f?0==e?ma.empty:new ma(Jl(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new ma(Jl(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||!Ql(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=Ql(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Ql(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=Kl(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=Kl(this.placed,this.depth,ca.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ca.empty,!0);e.childCount&&(this.placed=Kl(this.placed,this.frontier.length,e))}}function Jl(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Jl(e.firstChild.content,t-1,n)))}function Kl(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Kl(e.lastChild.content,t-1,n)))}function Gl(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Zl(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Zl(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(ca.empty,!0)))),e.copy(r)}function Ql(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 Xl(e){return e.spec.defining||e.spec.definingForContent}function ec(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(ec(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(ca.empty,!0))}return e}function tc(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 nc extends Sl{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 El.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 El.fromReplace(e,this.pos,this.pos+1,new ma(ca.from(r),0,t.isLeaf?0:1))}getMap(){return wl.empty}invert(e){return new nc(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 nc(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 nc(t.pos,t.attr,t.value)}}Sl.jsonID("attr",nc);class rc extends Sl{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 El.ok(n)}getMap(){return wl.empty}invert(e){return new rc(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 rc(t.attr,t.value)}}Sl.jsonID("docAttr",rc);let oc=class extends Error{};oc=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(oc.prototype=Object.create(Error.prototype)).constructor=oc,oc.prototype.name="TransformError";class ic{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new oc(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=ma.empty){let r=Ul(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new ma(ca.from(n),0,0))}delete(e,t){return this.replace(e,t,ma.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(Wl(o,i,r))return e.step(new Ol(t,n,r));let s=tc(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let e=o.node(p).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let e=p.firstChild;if(c.push(e),f==r.openStart)break;p=e.content}for(let p=u-1;p>=0;p--){let e=c[p],t=Xl(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(t||!e.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let t=(p+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 p=o.node(u-1),f=o.index(u-1);if(p.canReplaceWith(f,f,a.type,a.marks))return e.replace(o.before(u),d?i.after(u):n,new ma(ec(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let p=s.length-1;p>=0&&(e.replace(t,n,r),!(e.steps.length>d));p--){let e=s[p];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 ma(ca.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=tc(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=ca.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=ca.from(r.node(h).copy(u)),d++):l--;let p=ca.empty,f=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,p=ca.from(o.node(h).copy(p)),f++):c++;e.step(new Tl(l,c,s,a,new ma(u.append(p),d,f),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);Pl(e,r.node(),r.before(),a)}s.inlineContent&&Dl(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 Ol(c,l.map(t+n,-1),ma.empty,!0)),!0===r){let t=e.doc.resolve(c);zl(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=ca.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=ca.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new Tl(o,i,o,i,new ma(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&&Pl(e,t,n,i),Dl(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 Tl(l,c,l+1,c-1,new ma(ca.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&zl(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 Tl(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new ma(ca.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new nc(e,t,n)),this}setDocAttribute(e,t){return this.step(new rc(e,t)),this}addNodeMark(e,t){return this.step(new Nl(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 fa)t.isInSet(n.marks)&&this.step(new Rl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new Rl(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=ca.empty,s=ca.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ca.from(o.node(a).copy(i));let e=r&&r[c];s=ca.from(e?e.type.create(e.attrs,s):o.node(a).copy(s))}e.step(new Ol(t,t,new ma(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),p=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(p)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new _l(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new Cl(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 Za){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 _l(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return Dl(this,e,t,n),this}}const sc=Object.create(null);class ac{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new lc(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=ma.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?ma.empty:t),0==s&&bc(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),bc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new dc(e):yc(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?yc(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):yc(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 mc(e.node(0))}static atStart(e){return yc(e,e,0,0,1)||new mc(e)}static atEnd(e){return yc(e,e,e.content.size,e.childCount,-1)||new mc(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=sc[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 sc)throw new RangeError("Duplicate use of selection JSON ID "+e);return sc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return dc.between(this.$anchor,this.$head).getBookmark()}}ac.prototype.visible=!0;class lc{constructor(e,t){this.$from=e,this.$to=t}}let cc=!1;function uc(e){cc||e.parent.inlineContent||(cc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class dc extends ac{constructor(e,t=e){uc(e),uc(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 ac.near(n);let r=e.resolve(t.map(this.anchor));return new dc(r.parent.inlineContent?r:n,n)}replace(e,t=ma.empty){if(super.replace(e,t),t==ma.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof dc&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new pc(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 dc(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=ac.findFrom(t,n,!0)||ac.findFrom(t,-n,!0);if(!e)return ac.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(ac.findFrom(e,-n,!0)||ac.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new dc(e,t)}}ac.jsonID("text",dc);class pc{constructor(e,t){this.anchor=e,this.head=t}map(e){return new pc(e.map(this.anchor),e.map(this.head))}resolve(e){return dc.between(e.resolve(this.anchor),e.resolve(this.head))}}class fc extends ac{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?ac.near(o):new fc(o)}content(){return new ma(ca.from(this.node),0,0)}eq(e){return e instanceof fc&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hc(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new fc(e.resolve(t.anchor))}static create(e,t){return new fc(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}fc.prototype.visible=!1,ac.jsonID("node",fc);class hc{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new pc(n,n):new hc(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&fc.isSelectable(n)?new fc(t):ac.near(t)}}class mc extends ac{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ma.empty){if(t==ma.empty){e.delete(0,e.doc.content.size);let t=ac.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new mc(e)}map(e){return new mc(e)}eq(e){return e instanceof mc}getBookmark(){return gc}}ac.jsonID("all",mc);const gc={map(){return this},resolve:e=>new mc(e)};function yc(e,t,n,r,o,i=!1){if(t.inlineContent)return dc.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&&fc.isSelectable(r))return fc.create(e,n-(o<0?r.nodeSize:0))}else{let t=yc(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function bc(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof Ol||i instanceof Tl)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(ac.near(e.doc.resolve(o),n)))}class vc extends ic{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 fa.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)||fa.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(ac.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 wc(e,t){return t&&e?e.bind(t):e}class xc{constructor(e,t,n){this.name=e,this.init=wc(t.init,n),this.apply=wc(t.apply,n)}}const kc=[new xc("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new xc("selection",{init:(e,t)=>e.selection||ac.atStart(t.doc),apply:e=>e.selection}),new xc("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new xc("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class Sc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=kc.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 xc(e.key,e.spec.state,e))})}}class Ec{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 Ec(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 vc(this)}static create(e){let t=new Sc(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Ec(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 Sc(this.schema,e.plugins),n=t.fields,r=new Ec(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 Sc(e.schema,e.plugins),o=new Ec(r);return r.fields.forEach(r=>{if("doc"==r.name)o.doc=Da.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=ac.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 Mc(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=Mc(o,t,{})),n[r]=o}return n}class Cc{constructor(e){this.spec=e,this.props={},e.props&&Mc(e.props,this,this.props),this.key=e.key?e.key.key:Nc("plugin")}getState(e){return e[this.key]}}const _c=Object.create(null);function Nc(e){return e in _c?e+"$"+ ++_c[e]:(_c[e]=0,e+"$")}class Rc{constructor(e="key"){this.key=Nc(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Oc=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Tc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Ac=(e,t,n)=>{let r=Tc(e,n);if(!r)return!1;let o=jc(r);if(!o){let n=r.blockRange(),o=n&&Ll(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Wc(e,o,t,-1))return!0;if(0==r.parent.content.size&&($c(i,"end")||fc.isSelectable(i)))for(let s=r.depth;;s--){let n=Ul(e.doc,r.before(s),r.after(s),ma.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection($c(i,"end")?ac.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):fc.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 Dc(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=Ul(e.doc,o,s,ma.empty);if(!a||a.from!=o||a instanceof Ol&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(dc.create(t.doc,o)),n(t.scrollIntoView())}return!0}function $c(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 Lc=(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=jc(r)}let s=i&&i.nodeBefore;return!(!s||!fc.isSelectable(s))&&(t&&t(e.tr.setSelection(fc.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function jc(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 Ic(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const zc=(e,t,n)=>{let r=Ic(e,n);if(!r)return!1;let o=Fc(r);if(!o)return!1;let i=o.nodeAfter;if(Wc(e,o,t,1))return!0;if(0==r.parent.content.size&&($c(i,"start")||fc.isSelectable(i))){let n=Ul(e.doc,r.before(),r.after(),ma.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection($c(i,"start")?ac.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):fc.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)},Pc=(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=Fc(r)}let s=i&&i.nodeAfter;return!(!s||!fc.isSelectable(s))&&(t&&t(e.tr.setSelection(fc.create(e.doc,i.pos)).scrollIntoView()),!0)};function Fc(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 Bc=(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 Hc(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 Vc=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof mc||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Hc(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(dc.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},qc=(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(Fl(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ll(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Uc=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof fc&&e.selection.node.isBlock)return!(!n.parentOffset||!Fl(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 p=n.depth;;p--){if(n.node(p).isBlock){a=n.end(p)==n.pos+(n.depth-p),l=n.start(p)==n.pos-(n.depth-p),i=Hc(n.node(p-1).contentMatchAt(n.indexAfter(p-1))),s.unshift(a&&i?{type:i}:null),o=p;break}if(1==p)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof dc||e.selection instanceof mc)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=Fl(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=Fl(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 Wc(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&&!Bl(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=ca.empty;for(let e=o.length-1;e>=0;e--)i=ca.from(o[e].create(null,i));i=ca.from(s.copy(i));let l=e.tr.step(new Tl(t.pos-1,r,t.pos,r,new ma(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Bl(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&l?null:ac.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),p=d&&Ll(d);if(null!=p&&p>=t.depth)return n&&n(e.tr.lift(d,p).scrollIntoView()),!0;if(c&&$c(a,"start",!0)&&$c(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=ca.empty;for(let e=o.length-1;e>=0;e--)r=ca.from(o[e].copy(r));n(e.tr.step(new Tl(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new ma(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Yc(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(dc.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Jc=Yc(-1),Kc=Yc(1);function Gc(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 Zc(...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 Qc(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 Ta(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Ta(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=jl(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=ca.empty;for(let u=n.length-1;u>=0;u--)i=ca.from(n[u].type.create(n[u].attrs,i));e.step(new Tl(t.start-(r?2:0),t.end,t.start,t.end,new ma(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,p=!0;u<d;u++,p=!1)!p&&Fl(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 Xc(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 Tl(i-1,s,i,s,new ma(ca.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ta(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ll(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);Bl(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 f=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)f-=o.child(h).nodeSize,r.delete(f-1,f+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?ca.empty:ca.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new Tl(d-(a?1:0),p+(l?1:0),d+1,p-1,new ma((a?ca.empty:ca.from(o.copy(ca.empty))).append(l?ca.empty:ca.from(o.copy(ca.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}Zc(Oc,Ac,Lc),Zc(Oc,zc,Pc),Zc(Bc,Vc,qc,Uc),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const eu=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},tu=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let nu=null;const ru=function(e,t,n){let r=nu||(nu=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},ou=function(e,t,n,r){return n&&(su(e,t,n,r,-1)||su(e,t,n,r,1))},iu=/^(img|br|input|textarea|hr)$/i;function su(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:au(e))){let n=e.parentNode;if(!n||1!=n.nodeType||lu(e)||iu.test(e.nodeName)||"false"==e.contentEditable)return!1;t=eu(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?au(e):0}}}}function au(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function lu(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 cu=function(e){return e.focusNode&&ou(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function uu(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const du="undefined"!=typeof navigator?navigator:null,pu="undefined"!=typeof document?document:null,fu=du&&du.userAgent||"",hu=/Edge\/(\d+)/.exec(fu),mu=/MSIE \d/.exec(fu),gu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fu),yu=!!(mu||gu||hu),bu=mu?document.documentMode:gu?+gu[1]:hu?+hu[1]:0,vu=!yu&&/gecko\/(\d+)/i.test(fu);vu&&(/Firefox\/(\d+)/.exec(fu)||[0,0])[1];const wu=!yu&&/Chrome\/(\d+)/.exec(fu),xu=!!wu,ku=wu?+wu[1]:0,Su=!yu&&!!du&&/Apple Computer/.test(du.vendor),Eu=Su&&(/Mobile\/\w+/.test(fu)||!!du&&du.maxTouchPoints>2),Mu=Eu||!!du&&/Mac/.test(du.platform),Cu=!!du&&/Win/.test(du.platform),_u=/Android \d/.test(fu),Nu=!!pu&&"webkitFontSmoothing"in pu.documentElement.style,Ru=Nu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Ou(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 Tu(e,t){return"number"==typeof e?e:e[t]}function Au(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 Du(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=tu(s);continue}let e=s,n=e==i.body,a=n?Ou(i):Au(e),l=0,c=0;if(t.top<a.top+Tu(r,"top")?c=-(a.top-t.top+Tu(o,"top")):t.bottom>a.bottom-Tu(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Tu(o,"top")-a.top:t.bottom-a.bottom+Tu(o,"bottom")),t.left<a.left+Tu(r,"left")?l=-(a.left-t.left+Tu(o,"left")):t.right>a.right-Tu(r,"right")&&(l=t.right-a.right+Tu(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:tu(s)}}function $u(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=tu(r));return t}function Lu(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 ju=null;function Iu(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=ru(u).getClientRects()}for(let p=0;p<e.length;p++){let f=e[p];if(f.top<=l&&f.bottom>=c){l=Math.max(f.bottom,l),c=Math.min(f.top,c);let e=f.left>t.left?f.left-t.left:f.right<t.left?t.left-f.right:0;if(e<s){n=u,s=e,r=e&&3==n.nodeType?{left:f.right<t.left?f.right:f.left,top:t.top}:t,1==u.nodeType&&e&&(a=d+(t.left>=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!o&&f.left<=t.left&&f.right>=t.left&&(o=u,i={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!n&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.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=Hu(o,1);if(r.top!=r.bottom&&zu(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}:Iu(n,r)}function zu(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Pu(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(zu(t,o))return Pu(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function Fu(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(au(r.offsetNode),r.offset)}}catch(r){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(au(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(!zu(t,n))return null;if(a=Pu(e.dom,t,n),!a)return null}if(Su)for(let c=a;n&&c;c=tu(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(vu&&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;Nu&&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}=Iu(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 Bu(e){return e.top<e.bottom||e.left<e.right}function Hu(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Bu(e))return e}return Array.prototype.find.call(n,Bu)||e.getBoundingClientRect()}const Vu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qu(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Nu||vu;if(3==r.nodeType){if(!s||!Vu.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++,Uu(Hu(ru(r,e,t),i),i<0)}{let e=Hu(ru(r,o,o),n);if(vu&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Hu(ru(r,o-1,o-1),-1);if(t.top==e.top){let n=Hu(ru(r,o,o+1),-1);if(n.top!=e.top)return Uu(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==au(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Wu(e.getBoundingClientRect(),!1)}if(null==i&&o<au(r)){let e=r.childNodes[o];if(1==e.nodeType)return Wu(e.getBoundingClientRect(),!0)}return Wu(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==au(r))){let e=r.childNodes[o-1],t=3==e.nodeType?ru(e,au(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Uu(Hu(t,1),!1)}if(null==i&&o<au(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?ru(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Uu(Hu(t,-1),!0)}return Uu(Hu(3==r.nodeType?ru(r):r,-n),n>=0)}function Uu(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 Wu(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 Yu(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 Ju=/[\u0590-\u08ac]/;let Ku=null,Gu=null,Zu=!1;function Qu(e,t,n){return Ku==t&&Gu==n?Zu:(Ku=t,Gu=n,Zu="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Yu(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=qu(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=ru(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?Ju.test(r.parent.textContent)&&a.modify?Yu(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(),p=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(f){}return null!=l&&(a.caretBidiLevel=l),p}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class Xu{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>eu(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 sd){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 ed&&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?eu(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?eu(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=eu(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=eu(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 f=0,h=0;f<this.children.length;f++){let s=this.children[f],a=h+s.size;if(o>h&&i<a)return s.setSelection(e-h-s.border,t-h-s.border,n,r);h=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((vu||Su)&&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:eu(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(vu&&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&&Su)&&ou(s.node,s.offset,c.anchorNode,c.anchorOffset)&&ou(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==t)&&(!u||!vu)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(p){}}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 ed extends Xu{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 td extends Xu{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 nd extends Xu{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=ul.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new nd(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=nd.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=vd(o,t,i,n)),e>0&&(o=vd(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 rd extends Xu{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=ul.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=hd(c,n,t),l?s=new ad(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new id(e,t,n,r,c,d,o):new rd(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=()=>ca.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)&&md(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 yd(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,p,f;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(bd);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)f=-1,p=l,l=null;else{if(!(c<e.childCount))break;f=c,p=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 h=i+p.nodeSize;if(p.isText){let e=h;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<h&&(l=p.cut(e-i),p=p.cut(0,e-i),h=e,f=-1)}else for(;s<o.length&&o[s].to<h;)s++;r(p,p.isInline&&!p.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,p),f),i=h}}(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?fa.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),ld(this.contentDOM,this.children,e),Eu&&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 dc)||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 td(this,o,t,r);e.input.compositionNodes.push(i),this.children=vd(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(md(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=pd(this.dom,this.nodeDOM,dd(this.outerDeco,this.node,t),dd(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 od(e,t,n,r,o){hd(r,t,e);let i=new rd(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class id extends rd{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 id(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 sd extends Xu{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 ad extends rd{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 ld(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=gd(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof nd){let t=r?r.previousSibling:e.lastChild;ld(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=gd(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const cd=function(e){e&&(this.nodeName=e)};cd.prototype=Object.create(null);const ud=[new cd];function dd(e,t,n){if(0==e.length)return ud;let r=n?ud[0]:new cd,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new cd(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new cd(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 pd(e,t,n,r){if(n==ud&&r==ud)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=ud[0]),o=n}fd(o,s||ud[0],t)}return o}function fd(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 hd(e,t,n){return pd(e,e,ud,dd(t,n,1!=e.nodeType))}function md(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 gd(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class yd{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 nd)){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=nd.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 rd){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&&md(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)||!md(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=rd.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=rd.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 ed(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 nd;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof id)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Su||xu)&&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 sd(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 bd(e,t){return e.type.side-t.type.side}function vd(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 wd(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(cu(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&fc.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==au(e);r||o;){if(e==n)return!0;let t=eu(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==au(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new fc(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=Rd(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function xd(e){return e.editable?e.hasFocus():Td(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function kd(e,t=!1){let n=e.state.selection;if(_d(e,n),xd(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&xu){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&ou(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,eu(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&yu&&bu<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!Sd||n instanceof dc||(n.$from.parent.inlineContent||(r=Ed(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=Ed(e,n.to))),e.docView.setSelection(i,s,e,t),Sd&&(r&&Cd(r),o&&Cd(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(()=>{xd(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Sd=Su||xu&&ku<63;function Ed(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(Su&&o&&"false"==o.contentEditable)return Md(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Md(o);if(i)return Md(i)}}function Md(e){return e.contentEditable="true",Su&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Cd(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function _d(e,t){if(t instanceof fc){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Nd(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Nd(e)}function Nd(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Rd(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||dc.between(t,n,r)}function Od(e){return!(e.editable&&!e.hasFocus())&&Td(e)}function Td(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 Ad(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&&ac.findFrom(i,t)}function Dd(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function $d(e,t,n){let r=e.state.selection;if(!(r instanceof dc)){if(r instanceof fc&&r.node.isInline)return Dd(e,new dc(t>0?r.$to:r.$from));{let n=Ad(e.state,t);return!!n&&Dd(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 Dd(e,new dc(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Ad(e.state,t);return!!(n&&n instanceof fc)&&Dd(e,n)}if(!(Mu&&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)&&(fc.isSelectable(i)?Dd(e,new fc(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!Nu&&Dd(e,new dc(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Ld(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function jd(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Id(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;vu&&1==n.nodeType&&r<Ld(n)&&jd(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(jd(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(zd(n))break;{let t=n.previousSibling;for(;t&&jd(t,-1);)o=n.parentNode,i=eu(t),t=t.previousSibling;if(t)n=t,r=Ld(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Pd(e,n,r):o&&Pd(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Ld(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!jd(n.childNodes[r],1))break;o=n,i=++r}else{if(zd(n))break;{let t=n.nextSibling;for(;t&&jd(t,1);)o=t.parentNode,i=eu(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Ld(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Pd(e,o,i)}(e)}function zd(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Pd(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!lu(e);)t=eu(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&&!lu(e);)t=eu(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(cu(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&&kd(e)},50)}function Fd(e,t){let n=e.state.doc.resolve(t);if(!xu&&!Cu&&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 Bd(e,t,n){let r=e.state.selection;if(r instanceof dc&&!r.empty||n.indexOf("s")>-1)return!1;if(Mu&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Ad(e.state,t);if(n&&n instanceof fc)return Dd(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof mc?ac.near(n,t):ac.findFrom(n,t);return!!s&&Dd(e,s)}return!1}function Hd(e,t){if(!(e.state.selection instanceof dc))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 Vd(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function qd(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||Mu&&72==n&&"c"==r)return Hd(e,-1)||Id(e,-1);if(46==n&&!t.shiftKey||Mu&&68==n&&"c"==r)return Hd(e,1)||Id(e,1);if(13==n||27==n)return!0;if(37==n||Mu&&66==n&&"c"==r){let t=37==n?"ltr"==Fd(e,e.state.selection.from)?-1:1:-1;return $d(e,t,r)||Id(e,t)}if(39==n||Mu&&70==n&&"c"==r){let t=39==n?"ltr"==Fd(e,e.state.selection.from)?1:-1:1;return $d(e,t,r)||Id(e,t)}return 38==n||Mu&&80==n&&"c"==r?Bd(e,-1,r)||Id(e,-1):40==n||Mu&&78==n&&"c"==r?function(e){if(!Su||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;Vd(e,n,"true"),setTimeout(()=>Vd(e,n,"false"),20)}return!1}(e)||Bd(e,1,r)||Id(e,1):r==(Mu?"m":"c")&&(66==n||73==n||89==n||90==n)}function Ud(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")||ul.fromSchema(e.state.schema),a=tp(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=Xd[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 Wd(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 ma(ca.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=ul.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=tp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&Xd[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;np||(np=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return np.createHTML(e)}(e),n)for(let i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),Nu&&function(e){let t=e.querySelectorAll(xu?"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")||el.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Yd.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=ca.from(e.create(n[l+1],o)),i++,s++}return new ma(o,i,s)}(Qd(s,+u[1],+u[2]),u[4]);else if(s=ma.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&&Kd(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Gd(i[i.length-1],r.length));let t=Jd(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return ca.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=Qd(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Yd=/^(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 Jd(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,ca.from(e));return e}function Kd(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Kd(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(ca.from(Jd(n,e,o+1))))}}function Gd(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Gd(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(ca.empty,!0);return e.copy(n.append(r))}function Zd(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=Zd(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(ca.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function Qd(e,t,n){return t<e.openStart&&(e=new ma(Zd(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new ma(Zd(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Xd={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 ep=null;function tp(){return ep||(ep=document.implementation.createHTMLDocument("title"))}let np=null;const rp={},op={},ip={touchstart:!0,touchmove:!0};class sp{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 ap(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function lp(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>cp(e,t))})}function cp(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function up(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 dp(e){return{left:e.clientX,top:e.clientY}}function pp(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 fp(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 hp(e,t,n,r,o){return pp(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 fc&&(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(fc.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&&(fp(e,fc.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&&fc.isSelectable(r))&&(fp(e,new fc(n)),!0)}(e,n))}function mp(e,t,n,r){return pp(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function gp(e,t,n,r){return pp(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&&(fp(e,dc.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)fp(e,dc.create(r,n+1,n+1+t.content.size));else{if(!fc.isSelectable(t))continue;fp(e,fc.create(r,n))}return!0}}(e,n,r)}function yp(e){return Mp(e)}op.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!wp(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!_u||!xu||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Eu||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||qd(e,n)?n.preventDefault():ap(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,uu(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},op.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},op.keypress=(e,t)=>{let n=t;if(wp(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Mu&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof dc&&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 bp=Mu?"metaKey":"ctrlKey";rp.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=yp(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[bp]&&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(dp(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new vp(e,s,n,!!r)):("doubleClick"==i?mp:gp)(e,s.pos,s.inside,n)?n.preventDefault():ap(e,"pointer"))};class vp{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[bp],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 fc&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!vu||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)),ap(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(()=>kd(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(dp(e))),this.updateAllowDefault(e),this.allowDefault||!t?ap(this.view,"pointer"):hp(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Su&&this.mightDrag&&!this.mightDrag.node.isAtom||xu&&!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)?(fp(this.view,ac.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ap(this.view,"pointer")}move(e){this.updateAllowDefault(e),ap(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 wp(e,t){return!!e.composing||!!(Su&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}rp.touchstart=e=>{e.input.lastTouch=Date.now(),yp(e),ap(e,"pointer")},rp.touchmove=e=>{e.input.lastTouch=Date.now(),ap(e,"pointer")},rp.contextmenu=e=>yp(e);const xp=_u?5e3:-1;function kp(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Mp(e),t))}function Sp(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 Ep(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=au(e=e.childNodes[t-1])}else{if(!e.parentNode||lu(e))return null;t=eu(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||lu(e))return null;t=eu(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 Mp(e,t=!1){if(!(_u&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Sp(e),t||e.docView&&e.docView.dirty){let n=wd(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}}op.compositionstart=op.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof dc&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||xu&&Cu&&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(),Mp(e,!0),e.markCursor=null;else if(Mp(e,!t.selection.empty),vu&&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}kp(e,xp)},op.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++,kp(e,20))};const Cp=yu&&bu<15||Eu&&Ru<604;function _p(e,t,n,r,o){let i=Wd(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||ma.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 Np(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," "):""}rp.copy=op.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Cp?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Ud(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"))},op.paste=(e,t)=>{let n=t;if(e.composing&&!_u)return;let r=Cp?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&_p(e,Np(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?_p(e,r.value,null,o,t):_p(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class Rp{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Op=Mu?"altKey":"ctrlKey";function Tp(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[Op]}rp.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(dp(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof fc?i.to-1:i.to));else if(r&&r.mightDrag)o=fc.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=fc.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Ud(e,a);(!n.dataTransfer.files.length||!xu||ku>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Cp?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Cp||n.dataTransfer.setData("text/plain",c),e.dragging=new Rp(u,Tp(e,n),o)},rp.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},op.dragover=op.dragenter=(e,t)=>t.preventDefault(),op.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(dp(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=Wd(e,Np(t.dataTransfer),Cp?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!Tp(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||ma.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?ql(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 p=l.doc.resolve(c);if(u&&fc.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new fc(p));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(Rd(e,p,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},rp.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())&&kd(e)},20))},rp.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)},rp.beforeinput=(e,t)=>{if(xu&&_u&&"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,uu(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 op)rp[os]=op[os];function Ap(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 Dp{constructor(e,t){this.toDOM=e,this.spec=t||zp,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 jp(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Dp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ap(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $p{constructor(e,t){this.attrs=e,this.spec=t||zp}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 jp(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $p&&Ap(this.attrs,e.attrs)&&Ap(this.spec,e.spec)}static is(e){return e.type instanceof $p}destroy(){}}class Lp{constructor(e,t){this.attrs=e,this.spec=t||zp}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 jp(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 Lp&&Ap(this.attrs,e.attrs)&&Ap(this.spec,e.spec)}destroy(){}}class jp{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new jp(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 jp(e,e,new Dp(t,n))}static inline(e,t,n,r){return new jp(e,t,new $p(n,r))}static node(e,t,n,r){return new jp(e,t,new Lp(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof $p}get widget(){return this.type instanceof Dp}}const Ip=[],zp={};class Pp{constructor(e,t){this.local=e.length?e:Ip,this.children=t.length?t:Ip}static create(e,t){return t.length?Up(t,e,0,zp):Fp}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==Fp||0==e.maps.length?this:this.mapInner(e,t,0,0,n||zp)}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:p,offset:f}=r.content.findIndex(u),h=r.maybeChild(p);if(h&&f==u&&f+h.nodeSize==d){let r=a[c+2].mapInner(n,h,t+1,e[c]+i+1,s);r!=Fp?(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=Up(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 Pp(t.sort(Wp),a)}(this.children,i||[],e,t,n,r,o):i?new Pp(i.sort(Wp),Ip):Fp}add(e,t){return t.length?this==Fp?Pp.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=Vp(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,Up(s,e,a+1,zp)),o+=3}});let i=Hp(o?qp(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Pp(i.length?this.local.concat(i).sort(Wp):this.local,r||this.children)}remove(e){return 0==e.length||this==Fp?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!=Fp?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 Pp(r,n):Fp}forChild(e,t){if(this==Fp)return this;if(t.isLeaf)return Pp.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 $p){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 Pp(r.sort(Wp),Ip);return n?new Bp([e,n]):e}return n||Fp}eq(e){if(this==e)return!0;if(!(e instanceof Pp)||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 Yp(this.localsInner(e))}localsInner(e){if(this==Fp)return Ip;if(e.inlineContent||!this.local.some($p.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof $p||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Pp.empty=new Pp([],[]),Pp.removeOverlap=Yp;const Fp=Pp.empty;class Bp{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,zp));return Bp.from(n)}forChild(e,t){if(t.isLeaf)return Pp.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Fp&&(o instanceof Bp?n=n.concat(o.members):n.push(o))}return Bp.from(n)}eq(e){if(!(e instanceof Bp)||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?Yp(n?t:t.sort(Wp)):Ip}static from(e){switch(e.length){case 0:return Fp;case 1:return e[0];default:return new Bp(e.every(e=>e instanceof Pp)?e:e.reduce((e,t)=>e.concat(t instanceof Pp?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Hp(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 jp(o.from+t,o.to+t,o.type))}return n}function Vp(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 qp(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Up(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Vp(e,t,s+n);if(a){i=!0;let e=Up(a,t,n+s+1,r);e!=Fp&&o.push(s,s+t.nodeSize,e)}});let s=Hp(i?qp(e):e,-n).sort(Wp);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 Pp(s,o):Fp}function Wp(e,t){return e.from-t.from||e.to-t.to}function Yp(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),Jp(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),Jp(t,o+1,i.copy(r.to,i.to)))}}return t}function Jp(e,t,n){for(;t<e.length&&Wp(n,e[t])>0;)t++;e.splice(t,0,n)}function Kp(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Fp&&t.push(r)}),e.cursorWrapper&&t.push(Pp.create(e.state.doc,[e.cursorWrapper.deco])),Bp.from(t)}const Gp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Zp=yu&&bu<=11;class Qp{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 Xp{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qp,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]);yu&&bu<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():Su&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Zp&&(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,Gp)),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(Od(this.view)){if(this.suppressingSelectionUpdates)return kd(this.view);if(yu&&bu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ou(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=tu(o))n.add(o);for(let o=e.anchorNode;o;o=tu(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)&&Od(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(vu&&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&&rf(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&&cu(n)&&(l=wd(e))&&l.eq(ac.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,kd(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(ef.has(e))return;if(ef.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=vu,tf)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."),tf=!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)||kd(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(yu&&bu<=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?eu(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?eu(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 ef=new WeakMap,tf=!1;function nf(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return ou(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function rf(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 of(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Su&&/^(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||Su&&/^(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 sf=/^(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 af(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=wd(e,t);if(n&&!e.state.selection.eq(n)){if(xu&&_u&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,uu(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}],cu(c)||r.push({node:c.focusNode,offset:c.focusOffset})),xu&&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,p=e.someProp("domParser")||el.fromSchema(e.state.schema),f=d.resolve(a),h=null,m=p.parse(o,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:of,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),h={anchor:e+a,head:t+a}}return{doc:m,sel:h,from:a,to:l}}(e,t,n),p=e.state.doc,f=p.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 h=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&&uf(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&&uf(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}(f.content,d.doc.content,d.from,l,c);if(h&&e.input.domChangeCount++,(Eu&&e.input.lastIOSEnter>Date.now()-225||_u)&&o.some(e=>1==e.nodeType&&!sf.test(e.nodeName))&&(!h||h.endA>=h.endB)&&e.someProp("handleKeyDown",t=>t(e,uu(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!h){if(!(r&&u instanceof dc&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=lf(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}h={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&h.start==h.endB&&e.state.selection instanceof dc&&(h.start>e.state.selection.from&&h.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?h.start=e.state.selection.from:h.endA<e.state.selection.to&&h.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(h.endB+=e.state.selection.to-h.endA,h.endA=e.state.selection.to)),yu&&bu<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>d.from&&"  "==d.doc.textBetween(h.start-d.from-1,h.start-d.from+1)&&(h.start--,h.endA--,h.endB--);let m=d.doc.resolveNoCache(h.start-d.from),g=d.doc.resolveNoCache(h.endB-d.from),y=p.resolve(h.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA;if((Eu&&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,uu(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>h.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||cf(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(cf(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||cf(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,h.start,h.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,uu(8,"Backspace"))))return void(_u&&xu&&e.domObserver.suppressSelectionUpdates());xu&&h.endB==h.start&&(e.input.lastChromeDelete=Date.now()),_u&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==h.endA&&(h.endB-=2,g=d.doc.resolveNoCache(h.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,uu(13,"Enter"))})},20));let v,w=h.start,x=h.endA,k=t=>{let n=t||e.state.tr.replace(w,x,d.doc.slice(h.start-d.from,h.endB-d.from));if(d.sel){let t=lf(e,n.doc,d.sel);t&&!(xu&&e.composing&&t.empty&&(h.start!=h.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(x)-1)||yu&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){yu&&bu<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>kd(e),20));let t=k(e.state.tr.delete(w,x)),n=p.resolve(h.start).marksAcross(p.resolve(h.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(h.endA==h.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(ca.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.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 lf(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Rd(e,t.resolve(n.anchor),t.resolve(n.head))}function cf(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 uf(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 df{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 sp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(gf),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=hf(this),ff(this),this.nodeViews=mf(this),this.docView=od(this.state.doc,pf(this),Kp(this),this.dom,this),this.domObserver=new Xp(this,(e,t,n,r)=>af(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in rp){let n=rp[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!up(e,t)||cp(e,t)||!e.editable&&t.type in op||n(e,t)},ip[t]?{passive:!0}:void 0)}Su&&e.dom.addEventListener("input",()=>null),lp(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&&lp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(gf),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&&(Sp(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=mf(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)&&lp(this),this.editable=hf(this),ff(this);let a=Kp(this),l=pf(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:$u(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(yu||xu)&&!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=xu?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ep(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=od(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 ou(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?kd(this,t):(_d(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;Lu(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 fc){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Du(this,t.getBoundingClientRect(),e)}else Du(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 Rp(e.slice,e.move,r<0?void 0:fc.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(yu){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(ju)return e.focus(ju);let t=$u(e);e.focus(null==ju?{get preventScroll(){return ju={preventScroll:!0},!0}}:void 0),ju||(ju=!1,Lu(t,0))}(this.dom),kd(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 Fu(this,e)}coordsAtPos(e,t=1){return qu(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 Qu(this,t||this.state,e)}pasteHTML(e,t){return _p(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return _p(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ud(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,[],Kp(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nu=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){cp(e,t)||!rp[t.type]||!e.editable&&t.type in op||rp[t.type](e,t)}(this,e)}domSelectionRange(){let e=this.domSelection();return e?Su&&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 nf(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?nf(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function pf(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"),[jp.node(0,e.state.doc.content.size,t)]}function ff(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:jp.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function hf(e){return!e.someProp("editable",t=>!1===t(e.state))}function mf(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 gf(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")}df.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var yf={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:"'"},bf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vf="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),wf="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),xf=0;xf<10;xf++)yf[48+xf]=yf[96+xf]=String(xf);for(xf=1;xf<=24;xf++)yf[xf+111]="F"+xf;for(xf=65;xf<=90;xf++)yf[xf]=String.fromCharCode(xf+32),bf[xf]=String.fromCharCode(xf);for(var kf in yf)bf.hasOwnProperty(kf)||(bf[kf]=yf[kf]);const Sf="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ef="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function Mf(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);Sf?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function Cf(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 _f(e){let t=function(e){let t=Object.create(null);for(let n in e)t[Mf(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(vf&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||wf&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?bf:yf)[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[Cf(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[Cf(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Ef&&n.ctrlKey&&n.altKey)&&(r=yf[n.keyCode])&&r!=o){let o=t[Cf(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var Nf=Object.defineProperty,Rf=(e,t)=>{for(var n in t)Nf(e,n,{get:t[n],enumerable:!0})};function Of(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 Tf=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:Of({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}},Af={};Rf(Af,{blur:()=>Df,clearContent:()=>$f,clearNodes:()=>Lf,command:()=>jf,createParagraphNear:()=>If,cut:()=>zf,deleteCurrentNode:()=>Pf,deleteNode:()=>Bf,deleteRange:()=>Hf,deleteSelection:()=>Vf,enter:()=>qf,exitCode:()=>Uf,extendMarkRange:()=>Qf,first:()=>Xf,focus:()=>ih,forEach:()=>sh,insertContent:()=>ah,insertContentAt:()=>dh,joinBackward:()=>hh,joinDown:()=>fh,joinForward:()=>mh,joinItemBackward:()=>gh,joinItemForward:()=>yh,joinTextblockBackward:()=>bh,joinTextblockForward:()=>vh,joinUp:()=>ph,keyboardShortcut:()=>xh,lift:()=>Sh,liftEmptyBlock:()=>Eh,liftListItem:()=>Mh,newlineInCode:()=>Ch,resetAttributes:()=>Rh,scrollIntoView:()=>Oh,selectAll:()=>Th,selectNodeBackward:()=>Ah,selectNodeForward:()=>Dh,selectParentNode:()=>$h,selectTextblockEnd:()=>Lh,selectTextblockStart:()=>jh,setContent:()=>zh,setMark:()=>vm,setMeta:()=>wm,setNode:()=>xm,setNodeSelection:()=>km,setTextDirection:()=>Sm,setTextSelection:()=>Em,sinkListItem:()=>Mm,splitBlock:()=>_m,splitListItem:()=>Nm,toggleList:()=>Tm,toggleMark:()=>Am,toggleNode:()=>Dm,toggleWrap:()=>$m,undoInputRule:()=>Lm,unsetAllMarks:()=>jm,unsetMark:()=>Im,unsetTextDirection:()=>zm,updateAttributes:()=>Pm,wrapIn:()=>Fm,wrapInList:()=>Bm});var Df=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),$f=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Lf=()=>({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=Ll(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)},jf=e=>t=>e(t),If=()=>({state:e,dispatch:t})=>Vc(e,t),zf=(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 dc(r.doc.resolve(Math.max(s-1,0)))),!0},Pf=()=>({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 Ff(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 Bf=e=>({tr:t,state:n,dispatch:r})=>{const o=Ff(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},Hf=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},Vf=()=>({state:e,dispatch:t})=>Oc(e,t),qf=()=>({commands:e})=>e.keyboardShortcut("Enter"),Uf=()=>({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=Hc(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(ac.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t);function Wf(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Yf(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Wf(t[r])?t[r].test(e[r]):t[r]===e[r])}function Jf(e,t,n={}){return e.find(e=>e.type===t&&Yf(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Kf(e,t,n={}){return!!Jf(e,t,n)}function Gf(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(!Jf([...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&&Kf([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Kf([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Zf(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 Qf=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Zf(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const e=Gf(l,i,t);if(e&&e.from<=c&&e.to>=u){const t=dc.create(s,e.from,e.to);n.setSelection(t)}}return!0},Xf=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 eh(e){return e instanceof dc}function th(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nh(e,t=null){if(!t)return null;const n=ac.atStart(e),r=ac.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?dc.create(e,th(0,o,i),th(e.content.size,o,i)):dc.create(e,th(t,o,i),th(t,o,i))}function rh(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function oh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var ih=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(oh()||rh())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||oh()||rh()||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&&!eh(n.state.selection))return s(),!0;const a=nh(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},sh=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),ah=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),lh=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&&lh(r)}return e};function ch(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 lh(n)}function uh(e,t,n){if(e instanceof Da||e instanceof ca)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 ca.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),uh("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Qa({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?el.fromSchema(i).parseSlice(ch(e),n.parseOptions):el.fromSchema(i).parse(ch(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=el.fromSchema(t);return n.slice?r.parseSlice(ch(e),n.parseOptions).content:r.parse(ch(e),n.parseOptions)}return uh("",t,n)}var dh=(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{uh(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(a){l(a)}try{o=uh(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},p=!0,f=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),p=!!p&&(e.isText&&0===e.marks.length),f=!!f&&e.isBlock}),u===d&&f){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,d+=1)}let h;if(p){if(Array.isArray(t))h=t.map(e=>e.text||"").join("");else if(t instanceof ca){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),h=e}else h="object"==typeof t&&t&&t.text?t.text:t;r.insertText(h,u,d)}else{h=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,h)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof Ol||o instanceof Tl))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(ac.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:h})}return!0},ph=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof fc;if(o){if(r.node.isTextblock||!Bl(e.doc,r.from))return!1;n=r.from}else if(n=Vl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(fc.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),fh=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof fc){if(r.node.isTextblock||!Bl(e.doc,r.to))return!1;n=r.to}else if(n=Vl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),hh=()=>({state:e,dispatch:t})=>Ac(e,t),mh=()=>({state:e,dispatch:t})=>zc(e,t),gh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Vl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},yh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Vl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},bh=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Tc(e,n);if(!r)return!1;let o=jc(r);return!!o&&Dc(e,o,t)})(e,t),vh=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Ic(e,n);if(!r)return!1;let o=Fc(r);return!!o&&Dc(e,o,t)})(e,t);function wh(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var xh=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}`);oh()||wh()?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 kh(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?Ff(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=>Yf(e.node.attrs,n,{strict:!1}));if(i)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=l}var Sh=(e,t={})=>({state:n,dispatch:r})=>!!kh(n,Ff(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Ll(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),Eh=()=>({state:e,dispatch:t})=>qc(e,t),Mh=e=>({state:t,dispatch:n})=>Xc(Ff(e,t.schema))(t,n),Ch=()=>({state:e,dispatch:t})=>Bc(e,t);function _h(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Nh(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 Rh=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=_h("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ff(e,r.schema)),"mark"===a&&(s=Zf(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,Nh(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(Nh(i.attrs,t))))})})}),l},Oh=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Th=()=>({tr:e,dispatch:t})=>{if(t){const t=new mc(e.doc);e.setSelection(t)}return!0},Ah=()=>({state:e,dispatch:t})=>Lc(e,t),Dh=()=>({state:e,dispatch:t})=>Pc(e,t),$h=()=>({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(fc.create(e.doc,n))),!0)})(e,t),Lh=()=>({state:e,dispatch:t})=>Kc(e,t),jh=()=>({state:e,dispatch:t})=>Jc(e,t);function Ih(e,t,n={},r={}){return uh(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var zh=(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=Ih(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 Ph(e,t){const n=Zf(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 Fh(e,t){const n=new ic(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Bh(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 Hh(e,t,n){if(void 0===e.config[t]&&e.parent)return Hh(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?Hh(e.parent,t,n):null})}return e.config[t]}function Vh(e){return e.map(e=>{const t=Hh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Vh(t())]:e}).flat(10)}function qh(e,t){const n=ul.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Uh(e){return"function"==typeof e}function Wh(e,t=void 0,...n){return Uh(e)?t?e.bind(t)(...n):e(...n):e}function Yh(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Jh(e){const t=[],{nodeExtensions:n,markExtensions:r}=Yh(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=Hh(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=Hh(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 Kh(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 Gh(...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([...Kh(n[e]),...Kh(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function Zh(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)=>Gh(e,t),{})}function Qh(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 Xh(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 em(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 tm(e){return e.sort((e,t)=>{const n=Hh(e,"priority")||100,r=Hh(t,"priority")||100;return n>r?-1:n<r?1:0})}function nm(e){const t=tm(Vh(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 rm(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 om(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function im(e,t){const n=_h("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=Ff(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?Ph(e,t):{}}function sm(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 am(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}})})}),sm(r)}function lm(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Gf(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 cm(e,t){return t.nodes[e]||t.marks[e]||null}function um(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 dm(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Zf(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Yf(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=>Yf(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 pm(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function fm(e,t){const{nodeExtensions:n}=Yh(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=Wh(Hh(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function hm(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&&(hm(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function mm(e){return e instanceof fc}var gm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function ym(e,t){const n=t.mapping.mapResult(e.position);return{position:new gm(n.pos),mapResult:n}}function bm(e){return new gm(e)}var vm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Zf(e,r.schema);if(o)if(s){const e=Ph(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(eh(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)},wm=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),xm=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=Ff(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})=>!!Gc(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Gc(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},km=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=th(e,0,n.content.size),o=fc.create(n,r);t.setSelection(o)}return!0},Sm=(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},Em=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=dc.atStart(n).from,s=dc.atEnd(n).to,a=th(r,i,s),l=th(o,i,s),c=dc.create(n,a,l);t.setSelection(c)}return!0},Mm=e=>({state:t,dispatch:n})=>{const r=Ff(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=ca.from(n?o.create():null),s=new ma(ca.from(o.create(null,ca.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new Tl(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function Cm(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 _m=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=um(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof fc&&i.node.isBlock)return!(!a.parentOffset||!Fl(s,a.pos))&&(r&&(e&&Cm(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 p=u&&d?[{type:d,attrs:c}]:void 0,f=Fl(t.doc,t.mapping.map(a.pos),1,p);if(p||f||!Fl(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)||(f=!0,p=d?[{type:d,attrs:c}]:void 0),r){if(f&&(i instanceof dc&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,p),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&&Cm(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return f},Nm=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=Ff(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 p=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=ca.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=ca.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={...um(p,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(ca.from(a.createAndFill(null,c)||void 0));const u=l.before(l.depth-(r-1));n.replace(u,l.after(-o),new ma(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(dc.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const f=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...um(p,d.type.name,d.attrs),...t},m={...um(p,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=f?[{type:a,attrs:h},{type:f,attrs:m}]:[{type:a,attrs:h}];if(!Fl(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},Rm=(e,t)=>{const n=Bh(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)||!Bl(e.doc,n.pos)||(e.join(n.pos),!0)},Om=(e,t)=>{const n=Bh(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)||!Bl(e.doc,r)||(e.join(r),!0)},Tm=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:p}=o.extensionManager,f=Ff(e,s.schema),h=Ff(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=Bh(e=>fm(e.type.name,d))(m);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===f)return c.liftListItem(h);if(fm(x.node.type.name,d)&&f.validContent(x.node.content)&&a)return l().command(()=>(i.setNodeMarkup(x.pos,f),!0)).command(()=>Rm(i,f)).command(()=>Om(i,f)).run()}return n&&w&&a?l().command(()=>{const e=u().wrapInList(f,r),t=w.filter(e=>p.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(f,r).command(()=>Rm(i,f)).command(()=>Om(i,f)).run():l().command(()=>!!u().wrapInList(f,r)||c.clearNodes()).wrapInList(f,r).command(()=>Rm(i,f)).command(()=>Om(i,f)).run()},Am=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Zf(e,r.schema);return dm(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},Dm=(e,t,n={})=>({state:r,commands:o})=>{const i=Ff(e,r.schema),s=Ff(t,r.schema),a=kh(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})},$m=(e,t={})=>({state:n,commands:r})=>{const o=Ff(e,n.schema);return kh(n,o,t)?r.lift(o):r.wrapIn(o,t)},Lm=()=>({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},jm=()=>({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},Im=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Zf(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=Gf(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},zm=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},Pm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=_h("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=Ff(e,r.schema)),"mark"===a&&(s=Zf(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let u,d,p,f;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,p=Math.max(t,a),f=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,p=Math.max(r,a),f=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(p,f,s.create({...e.attrs,...t}))}))}),l},Fm=(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&&jl(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(Ff(e,n.schema),t)(n,r),Bm=(e,t={})=>({state:n,dispatch:r})=>Qc(Ff(e,n.schema),t)(n,r),Hm=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={}}},Vm=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function qm(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(Wf(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=Of({state:l.state,transaction:s}),p={from:r-(t[0].length-i.length),to:o},{commands:f,chain:h,can:m}=new Tf({editor:n,state:c});null!==e.handler({state:c,range:p,match:t,commands:f,chain:h,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 Um(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Wm(e,t){const n={...e};return Um(e)&&Um(t)&&Object.keys(t).forEach(r=>{Um(t[r])&&Um(e[r])?n[r]=Wm(e[r],t[r]):n[r]=t[r]}),n}var Ym=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{...Wh(Hh(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Wh(Hh(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Wm(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}},Jm=class e extends Ym{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 Km=class{constructor(e){this.find=e.find,this.handler=e.handler}};function Gm(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new Tf({editor:t,state:n}),d=[];n.doc.nodesBetween(r,o,(e,t)=>{var p,f,h,m,g;if((null==(f=null==(p=e.type)?void 0:p.spec)?void 0:f.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(h=e.content)?void 0:h.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(Wf(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)},p=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(p)})});return d.every(e=>null!==e)}var Zm=null;function Qm(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=Of({state:e,transaction:l});if(Gm({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 Cc({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(Zm=t)},r=()=>{Zm&&(Zm=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=Zm;(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"),p=!!d;if(!c&&!u&&!p)return;if(p){let{text:t}=d;"string"==typeof t||(t=qh(ca.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 f=n.doc.content.findDiffStart(r.doc.content),h=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof f&&h&&f!==h.b?l({rule:e,state:r,from:f,to:h,pasteEvt:a}):void 0}}))}var Xm=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=nm(e),this.schema=function(e,t){var n;const r=Jh(e),{nodeExtensions:o,markExtensions:i}=Yh(e),s=null==(n=o.find(e=>Hh(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=Xh({...e.reduce((e,t)=>{const r=Hh(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:Wh(Hh(n,"content",i)),marks:Wh(Hh(n,"marks",i)),group:Wh(Hh(n,"group",i)),inline:Wh(Hh(n,"inline",i)),atom:Wh(Hh(n,"atom",i)),selectable:Wh(Hh(n,"selectable",i)),draggable:Wh(Hh(n,"draggable",i)),code:Wh(Hh(n,"code",i)),whitespace:Wh(Hh(n,"whitespace",i)),linebreakReplacement:Wh(Hh(n,"linebreakReplacement",i)),defining:Wh(Hh(n,"defining",i)),isolating:Wh(Hh(n,"isolating",i)),attrs:Object.fromEntries(o.map(em))}),a=Wh(Hh(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Qh(e,o)));const l=Hh(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:Zh(e,o)}));const c=Hh(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=Xh({...e.reduce((e,t)=>{const r=Hh(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:Wh(Hh(n,"inclusive",i)),excludes:Wh(Hh(n,"excludes",i)),group:Wh(Hh(n,"group",i)),spanning:Wh(Hh(n,"spanning",i)),code:Wh(Hh(n,"code",i)),attrs:Object.fromEntries(o.map(em))}),a=Wh(Hh(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Qh(e,o)));const l=Hh(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:Zh(e,o)})),[n.name,s]}));return new Qa({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Hh(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:cm(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return tm([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cm(t.name,this.schema)},r=[],o=Hh(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Hh(t,"exitable",n)&&(i.ArrowRight=()=>Jm.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 Cc({props:{handleKeyDown:_f(i)}});r.push(s);const a=Hh(t,"addInputRules",n);if(pm(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new Cc({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=qh(ca.from(e),i.schema));const{from:o}=a,s=o+e.length;qm({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>qm({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&qm({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&&qm({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=Hh(t,"addPasteRules",n);if(pm(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=Qm({editor:e,rules:t});r.push(...n)}}const c=Hh(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return Jh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Yh(this.extensions);return Object.fromEntries(t.filter(e=>!!Hh(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:Ff(t.name,this.schema)},o=Hh(t,"addNodeView",r);if(!o)return[];const i=o();if(!i)return[];return[t.name,(r,o,s,a,l)=>{const c=Zh(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 tm([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cm(n.name,this.schema)},o=Hh(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return tm([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:cm(n.name,this.schema)},o=Hh(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}=Yh(this.extensions);return Object.fromEntries(t.filter(e=>!!Hh(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:Zf(t.name,this.schema)},o=Hh(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=Zh(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:cm(e.name,this.schema)};if("mark"===e.type){(null==(t=Wh(Hh(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=Hh(e,"onBeforeCreate",n),o=Hh(e,"onCreate",n),i=Hh(e,"onUpdate",n),s=Hh(e,"onSelectionUpdate",n),a=Hh(e,"onTransaction",n),l=Hh(e,"onFocus",n),c=Hh(e,"onBlur",n),u=Hh(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)})}};Xm.resolve=nm,Xm.sort=tm,Xm.flatten=Vh;Rf({},{ClipboardTextSerializer:()=>tg,Commands:()=>ng,Delete:()=>rg,Drop:()=>og,Editable:()=>ig,FocusEvents:()=>ag,Keymap:()=>lg,Paste:()=>cg,Tabindex:()=>ug,TextDirection:()=>dg,focusEventsPluginKey:()=>sg});var eg=class e extends Ym{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)}},tg=eg.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new Cc({key:new Rc("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=om(n);return rm(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),ng=eg.create({name:"commands",addCommands:()=>({...Af})}),rg=eg.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=Fh(e.before,[e,...t]);am(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 _l){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)),p=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(p||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()}}),og=eg.create({name:"drop",addProseMirrorPlugins(){return[new Cc({key:new Rc("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ig=eg.create({name:"editable",addProseMirrorPlugins(){return[new Cc({key:new Rc("editable"),props:{editable:()=>this.editor.options.editable}})]}}),sg=new Rc("focusEvents"),ag=eg.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Cc({key:sg,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}}}})]}}),lg=eg.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:ac.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 oh()||wh()?o:r},addProseMirrorPlugins(){return[new Cc({key:new Rc("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=ac.atStart(t.doc).from,c=ac.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!hm(n.doc))return;const u=n.tr,d=Of({state:n,transaction:u}),{commands:p}=new Tf({editor:this.editor,state:d});return p.clearNodes(),u.steps.length?u:void 0}})]}}),cg=eg.create({name:"paste",addProseMirrorPlugins(){return[new Cc({key:new Rc("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),ug=eg.create({name:"tabindex",addProseMirrorPlugins(){return[new Cc({key:new Rc("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),dg=eg.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Yh(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 Cc({key:new Rc("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),pg=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 fg=class extends Hm{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:ym,createMappablePosition:bm},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=nh(t,this.options.autofocus);this.editorState=Ec.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=Uh(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?[ig,tg.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),ng,ag,lg,ug,og,cg,rg,dg.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 Xm(n,this)}createCommandManager(){this.commandManager=new Tf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ih(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=Ih(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 df(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 im(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 kh(e,null,n)||dm(e,null,n);const r=_h(t,e.schema);return"node"===r?kh(e,t,n):"mark"===r&&dm(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return qh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return rm(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...om(this.schema),...n}})}get isEmpty(){return hm(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 pg(t,this)}get $doc(){return this.$pos(0)}};function hg(e){return new Vm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Wh(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(lm(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 mg(e){return new Vm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=Wh(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 gg(e){return new Vm({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=Wh(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&jl(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&&Bl(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function yg(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 bg(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 vg(e){const{nodeName:t,name:n,parseAttributes:r=yg,serializeAttributes:o=bg,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 wg(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=yg,serializeAttributes:i=bg,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,p=o(d);let f=1;const h=u.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(h);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)f+=1;else if(f-=1,0===f){const i=y.slice(0,o);m=i.trim();const s=e.slice(0,h+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:p,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 xg(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 kg(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function Sg(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=xg,serializeAttributes:i=kg,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 Eg(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],p=e.match(t.itemPattern);if(!p){if(l.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const f=t.extractItemData(p),{indentLevel:h,mainContent:m}=f;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)>h){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)>h))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(h+d)).join("\n");e.trim()&&(y=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const v=t.createToken(f,y);l.push(v)}if(0!==l.length)return{items:l,raw:c}}function Mg(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")}Rf({},{createAtomBlockMarkdownSpec:()=>vg,createBlockMarkdownSpec:()=>wg,createInlineMarkdownSpec:()=>Sg,parseAttributes:()=>yg,parseIndentedBlocks:()=>Eg,renderNestedMarkdownContent:()=>Mg,serializeAttributes:()=>bg});var Cg=class e extends Ym{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 _g(e){return new Km({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Wh(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(lm(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:Ng,getOwnPropertySymbols:Rg}=Object,{hasOwnProperty:Og}=Object.prototype;function Tg(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function Ag(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 Dg(e){return Ng(e).concat(Rg(e))}const $g=Object.hasOwn||((e,t)=>Og.call(e,t));function Lg(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:jg,keys:Ig}=Object;function zg(e,t){return e.byteLength===t.byteLength&&Zg(new Uint8Array(e),new Uint8Array(t))}function Pg(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 Fg(e,t){return e.byteLength===t.byteLength&&Zg(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Bg(e,t){return Lg(e.getTime(),t.getTime())}function Hg(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Vg(e,t){return e===t}function qg(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 Ug=Lg;function Wg(e,t,n){const r=Ig(e);let o=r.length;if(Ig(t).length!==o)return!1;for(;o-- >0;)if(!Xg(e,t,n,r[o]))return!1;return!0}function Yg(e,t,n){const r=Dg(e);let o,i,s,a=r.length;if(Dg(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!Xg(e,t,n,o))return!1;if(i=jg(e,o),s=jg(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function Jg(e,t){return Lg(e.valueOf(),t.valueOf())}function Kg(e,t){return e.source===t.source&&e.flags===t.flags}function Gg(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 Zg(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 Qg(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 Xg(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||$g(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const ey={"[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},ty=Object.prototype.toString;function ny({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:p,areUrlsEqual:f,unknownTagComparators:h}){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=ty.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 f(m,g,y);if("[object Error]"===w)return o(m,g,y);if("[object Arguments]"===w)return l(m,g,y);if(ey[w])return p(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(h){let e=h[w];if(!e){const t=null!=(x=m)?x[Symbol.toStringTag]:void 0;t&&(e=h[t])}if(e)return e(m,g,y)}var x;return!1}}const ry=oy();function oy(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:zg,areArraysEqual:n?Yg:Pg,areDataViewsEqual:Fg,areDatesEqual:Bg,areErrorsEqual:Hg,areFunctionsEqual:Vg,areMapsEqual:n?Tg(qg,Yg):qg,areNumbersEqual:Ug,areObjectsEqual:n?Yg:Wg,arePrimitiveWrappersEqual:Jg,areRegExpsEqual:Kg,areSetsEqual:n?Tg(Gg,Yg):Gg,areTypedArraysEqual:n?Tg(Zg,Yg):Zg,areUrlsEqual:Qg,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=Ag(r.areArraysEqual),t=Ag(r.areMapsEqual),n=Ag(r.areObjectsEqual),o=Ag(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=ny(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})}oy({strict:!0}),oy({circular:!0}),oy({circular:!0,strict:!0}),oy({createInternalComparator:()=>Lg}),oy({strict:!0,createInternalComparator:()=>Lg}),oy({circular:!0,createInternalComparator:()=>Lg}),oy({circular:!0,createInternalComparator:()=>Lg,strict:!0});var iy,sy,ay={exports:{}},ly={};var cy=(sy||(sy=1,ay.exports=function(){if(iy)return ly;iy=1;var t=e,n=ta(),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 ly.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=a(function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==u&&p.hasValue){var t=p.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 f=o(e,d[0],d[1]);return s(function(){p.hasValue=!0,p.value=f},[f]),l(f),f},ly}()),ay.exports),uy=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},dy=({contentComponent:e})=>{const t=na.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return ra(ia,{children:Object.values(t)})};var py=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 oa(ia,{children:[ra("div",{ref:uy(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&ra(dy,{contentComponent:e.contentComponent})]})}},fy=e.forwardRef((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(py,{key:r,innerRef:n,...t})}),hy=e.memo(fy),my="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,gy=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 yy="undefined"==typeof window,by=yy||Boolean("undefined"!=typeof window&&window.next),vy=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?yy||by?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 fg(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 wy(t={},n=[]){const r=e.useRef(t);r.current=t;const[o]=e.useState(()=>new vy(r)),i=na.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 gy(t.editor)),o=cy.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:ry);my(()=>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 xy=e.createContext({editor:null});xy.Consumer;var ky=e.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=e.useContext(ky);return ra(t.as||"div",{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})}),e.createContext({markViewContentRef:()=>{}});var Sy=e.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Sy.displayName="TiptapContext";function Ey({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 ra(xy.Provider,{value:s,children:ra(Sy.Provider,{value:i,children:r})})}function My({...t}){const{editor:n}=e.useContext(Sy);return ra(hy,{editor:n,...t})}Ey.displayName="Tiptap",My.displayName="Tiptap.Content",Object.assign(Ey,{Content:My});var Cy=(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]},_y=/^\s*>\s$/,Ny=Cg.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Cy("blockquote",{...Gh(this.options.HTMLAttributes,e),children:Cy("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[gg({find:_y,type:this.type})]}}),Ry=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Oy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ty=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Ay=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Dy=Jm.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 Cy("strong",{...Gh(this.options.HTMLAttributes,e),children:Cy("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[hg({find:Ry,type:this.type}),hg({find:Ty,type:this.type})]},addPasteRules(){return[_g({find:Oy,type:this.type}),_g({find:Ay,type:this.type})]}}),$y=/(^|[^`])`([^`]+)`(?!`)$/,Ly=/(^|[^`])`([^`]+)`(?!`)/g,jy=Jm.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Gh(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[hg({find:$y,type:this.type})]},addPasteRules(){return[_g({find:Ly,type:this.type})]}}),Iy=/^```([a-z]+)?[\s\n]$/,zy=/^~~~([a-z]+)?[\s\n]$/,Py=Cg.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",Gh(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 p=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",f=Math.min(p.length,n);if(0===f)return!0;let h=s;for(let n=0;n<c;n+=1)h+=l[n].length+1;e.delete(h,h+f);return o-h<=f&&e.setSelection(dc.create(e.doc,h)),!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(ac.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[mg({find:Iy,type:this.type,getAttributes:e=>({language:e[1]})}),mg({find:zy,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Cc({key:new Rc("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(dc.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),Fy=Cg.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),By=Cg.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",Gh(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()}}}),Hy=Cg.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]}`,Gh(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=>mg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Vy=Cg.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Gh(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 fc){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 mm(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(dc.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(fc.create(t.doc,n.pos)):t.setSelection(dc.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(dc.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Vm({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Wh(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}}),qy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Uy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Wy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Yy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Jy=Jm.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",Gh(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[hg({find:qy,type:this.type}),hg({find:Wy,type:this.type})]},addPasteRules(){return[_g({find:Uy,type:this.type}),_g({find:Yy,type:this.type})]}});const Ky="numeric",Gy="ascii",Zy="alpha",Qy="asciinumeric",Xy="alphanumeric",eb="domain",tb="emoji",nb="scheme",rb="slashscheme",ob="whitespace";function ib(e,t){return e in t||(t[e]=[]),t[e]}function sb(e,t,n){t[Ky]&&(t[Qy]=!0,t[Xy]=!0),t[Gy]&&(t[Qy]=!0,t[Zy]=!0),t[Qy]&&(t[Xy]=!0),t[Zy]&&(t[Xy]=!0),t[Xy]&&(t[eb]=!0),t[tb]&&(t[eb]=!0);for(const r in t){const t=ib(r,n);t.indexOf(e)<0&&t.push(e)}}function ab(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}ab.groups={},ab.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||ab.groups,t&&t.j?o=t:(o=new ab(t),n&&r&&sb(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||ab.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 ab,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new ab,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);sb(i,e,r)}else n&&sb(i,n,r);s.t=i}return o.j[e]=s,s}};const lb=(e,t,n,r,o)=>e.ta(t,n,r,o),cb=(e,t,n,r,o)=>e.tr(t,n,r,o),ub=(e,t,n,r,o)=>e.ts(t,n,r,o),db=(e,t,n,r,o)=>e.tt(t,n,r,o),pb="WORD",fb="UWORD",hb="ASCIINUMERICAL",mb="ALPHANUMERICAL",gb="LOCALHOST",yb="TLD",bb="UTLD",vb="SCHEME",wb="SLASH_SCHEME",xb="NUM",kb="WS",Sb="NL",Eb="OPENBRACE",Mb="CLOSEBRACE",Cb="OPENBRACKET",_b="CLOSEBRACKET",Nb="OPENPAREN",Rb="CLOSEPAREN",Ob="OPENANGLEBRACKET",Tb="CLOSEANGLEBRACKET",Ab="FULLWIDTHLEFTPAREN",Db="FULLWIDTHRIGHTPAREN",$b="LEFTCORNERBRACKET",Lb="RIGHTCORNERBRACKET",jb="LEFTWHITECORNERBRACKET",Ib="RIGHTWHITECORNERBRACKET",zb="FULLWIDTHLESSTHAN",Pb="FULLWIDTHGREATERTHAN",Fb="AMPERSAND",Bb="APOSTROPHE",Hb="ASTERISK",Vb="AT",qb="BACKSLASH",Ub="BACKTICK",Wb="CARET",Yb="COLON",Jb="COMMA",Kb="DOLLAR",Gb="DOT",Zb="EQUALS",Qb="EXCLAMATION",Xb="HYPHEN",ev="PERCENT",tv="PIPE",nv="PLUS",rv="POUND",ov="QUERY",iv="QUOTE",sv="FULLWIDTHMIDDLEDOT",av="SEMI",lv="SLASH",cv="TILDE",uv="UNDERSCORE",dv="EMOJI",pv="SYM";var fv=Object.freeze({__proto__:null,ALPHANUMERICAL:mb,AMPERSAND:Fb,APOSTROPHE:Bb,ASCIINUMERICAL:hb,ASTERISK:Hb,AT:Vb,BACKSLASH:qb,BACKTICK:Ub,CARET:Wb,CLOSEANGLEBRACKET:Tb,CLOSEBRACE:Mb,CLOSEBRACKET:_b,CLOSEPAREN:Rb,COLON:Yb,COMMA:Jb,DOLLAR:Kb,DOT:Gb,EMOJI:dv,EQUALS:Zb,EXCLAMATION:Qb,FULLWIDTHGREATERTHAN:Pb,FULLWIDTHLEFTPAREN:Ab,FULLWIDTHLESSTHAN:zb,FULLWIDTHMIDDLEDOT:sv,FULLWIDTHRIGHTPAREN:Db,HYPHEN:Xb,LEFTCORNERBRACKET:$b,LEFTWHITECORNERBRACKET:jb,LOCALHOST:gb,NL:Sb,NUM:xb,OPENANGLEBRACKET:Ob,OPENBRACE:Eb,OPENBRACKET:Cb,OPENPAREN:Nb,PERCENT:ev,PIPE:tv,PLUS:nv,POUND:rv,QUERY:ov,QUOTE:iv,RIGHTCORNERBRACKET:Lb,RIGHTWHITECORNERBRACKET:Ib,SCHEME:vb,SEMI:av,SLASH:lv,SLASH_SCHEME:wb,SYM:pv,TILDE:cv,TLD:yb,UNDERSCORE:uv,UTLD:bb,UWORD:fb,WORD:pb,WS:kb});const hv=/[a-z]/,mv=new RegExp("\\p{L}","u"),gv=new RegExp("\\p{Emoji}","u"),yv=/\d/,bv=/\s/;let vv=null,wv=null;function xv(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,p=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,p=0,u=a):d>=0&&(d+=n[s].length,p++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=p,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function kv(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 ab(r),i.jr=o.slice(),e.j[n]=i),e=i}return i=new ab(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Sv(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 Ev={defaultProtocol:"http",events:null,format:Cv,formatHref:Cv,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Mv(e,t=null){let n=Object.assign({},Ev);e&&(n=Object.assign(n,e instanceof Mv?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 Cv(e){return e}function _v(e,t){this.t="token",this.v=e,this.tk=t}function Nv(e,t){class n extends _v{constructor(t,n){super(t,n),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}Mv.prototype={o:Ev,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]:Ev[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)}},_v.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=Ev.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 Rv=Nv("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ov=Nv("text"),Tv=Nv("nl"),Av=Nv("url",{isLink:!0,toHref(e=Ev.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==gb&&e[1].t===Yb}}),Dv=e=>new ab(e);function $v(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const Lv="undefined"!=typeof console&&console&&console.warn||(()=>{}),jv={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Iv(e,t=!1){if(jv.initialized&&Lv(`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');jv.customSchemes.push([e,t])}function zv(){jv.scanner=function(e=[]){const t={};ab.groups=t;const n=new ab;null==vv&&(vv=Sv("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==wv&&(wv=Sv("ελ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")),db(n,"'",Bb),db(n,"{",Eb),db(n,"}",Mb),db(n,"[",Cb),db(n,"]",_b),db(n,"(",Nb),db(n,")",Rb),db(n,"<",Ob),db(n,">",Tb),db(n,"(",Ab),db(n,")",Db),db(n,"「",$b),db(n,"」",Lb),db(n,"『",jb),db(n,"』",Ib),db(n,"<",zb),db(n,">",Pb),db(n,"&",Fb),db(n,"*",Hb),db(n,"@",Vb),db(n,"`",Ub),db(n,"^",Wb),db(n,":",Yb),db(n,",",Jb),db(n,"$",Kb),db(n,".",Gb),db(n,"=",Zb),db(n,"!",Qb),db(n,"-",Xb),db(n,"%",ev),db(n,"|",tv),db(n,"+",nv),db(n,"#",rv),db(n,"?",ov),db(n,'"',iv),db(n,"/",lv),db(n,";",av),db(n,"~",cv),db(n,"_",uv),db(n,"\\",qb),db(n,"・",sv);const r=cb(n,yv,xb,{[Ky]:!0});cb(r,yv,r);const o=cb(r,hv,hb,{[Qy]:!0}),i=cb(r,mv,mb,{[Xy]:!0}),s=cb(n,hv,pb,{[Gy]:!0});cb(s,yv,o),cb(s,hv,s),cb(o,yv,o),cb(o,hv,o);const a=cb(n,mv,fb,{[Zy]:!0});cb(a,hv),cb(a,yv,i),cb(a,mv,a),cb(i,yv,i),cb(i,hv),cb(i,mv,i);const l=db(n,"\n",Sb,{[ob]:!0}),c=db(n,"\r",kb,{[ob]:!0}),u=cb(n,bv,kb,{[ob]:!0});db(n,"",u),db(c,"\n",l),db(c,"",u),cb(c,bv,u),db(u,"\r"),db(u,"\n"),cb(u,bv,u),db(u,"",u);const d=cb(n,gv,dv,{[tb]:!0});db(d,"#"),cb(d,gv,d),db(d,"️",d);const p=db(d,"‍");db(p,"#"),cb(p,gv,d);const f=[[hv,s],[yv,o]],h=[[hv,null],[mv,a],[yv,i]];for(let m=0;m<vv.length;m++)kv(n,vv[m],yb,pb,f);for(let m=0;m<wv.length;m++)kv(n,wv[m],bb,fb,h);sb(yb,{tld:!0,ascii:!0},t),sb(bb,{utld:!0,alpha:!0},t),kv(n,"file",vb,pb,f),kv(n,"mailto",vb,pb,f),kv(n,"http",wb,pb,f),kv(n,"https",wb,pb,f),kv(n,"ftp",wb,pb,f),kv(n,"ftps",wb,pb,f),sb(vb,{scheme:!0,ascii:!0},t),sb(wb,{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]?{[nb]:!0}:{[rb]:!0};t.indexOf("-")>=0?r[eb]=!0:hv.test(t)?yv.test(t)?r[Qy]=!0:r[Gy]=!0:r[Ky]=!0,ub(n,t,t,r)}return ub(n,"localhost",gb,{ascii:!0}),n.jd=new ab(pv),{start:n,tokens:Object.assign({groups:t},fv)}}(jv.customSchemes);for(let e=0;e<jv.tokenQueue.length;e++)jv.tokenQueue[e][1]({scanner:jv.scanner});jv.parser=function({groups:e}){const t=e.domain.concat([Fb,Hb,Vb,qb,Ub,Wb,Kb,Zb,Xb,xb,ev,tv,nv,rv,lv,pv,cv,uv]),n=[Bb,Yb,Jb,Gb,Qb,ev,ov,iv,av,Ob,Tb,Eb,Mb,_b,Cb,Nb,Rb,Ab,Db,$b,Lb,jb,Ib,zb,Pb],r=[Fb,Bb,Hb,qb,Ub,Wb,Kb,Zb,Xb,Eb,Mb,ev,tv,nv,rv,ov,lv,pv,cv,uv],o=Dv(),i=db(o,cv);lb(i,r,i),lb(i,e.domain,i);const s=Dv(),a=Dv(),l=Dv();lb(o,e.domain,s),lb(o,e.scheme,a),lb(o,e.slashscheme,l),lb(s,r,i),lb(s,e.domain,s);const c=db(s,Vb);db(i,Vb,c),db(a,Vb,c),db(l,Vb,c);const u=db(i,Gb);lb(u,r,i),lb(u,e.domain,i);const d=Dv();lb(c,e.domain,d),lb(d,e.domain,d);const p=db(d,Gb);lb(p,e.domain,d);const f=Dv(Rv);lb(p,e.tld,f),lb(p,e.utld,f),db(c,gb,f);const h=db(d,Xb);db(h,Xb,h),lb(h,e.domain,d),lb(f,e.domain,d),db(f,Gb,p),db(f,Xb,h);const m=db(f,Yb);lb(m,e.numeric,Rv);const g=db(s,Xb),y=db(s,Gb);db(g,Xb,g),lb(g,e.domain,s),lb(y,r,i),lb(y,e.domain,s);const b=Dv(Av);lb(y,e.tld,b),lb(y,e.utld,b),lb(b,e.domain,s),lb(b,r,i),db(b,Gb,y),db(b,Xb,g),db(b,Vb,c);const v=db(b,Yb),w=Dv(Av);lb(v,e.numeric,w);const x=Dv(Av),k=Dv();lb(x,t,x),lb(x,n,k),lb(k,t,x),lb(k,n,k),db(b,lv,x),db(w,lv,x);const S=db(a,Yb),E=db(l,Yb),M=db(E,lv),C=db(M,lv);lb(a,e.domain,s),db(a,Gb,y),db(a,Xb,g),lb(l,e.domain,s),db(l,Gb,y),db(l,Xb,g),lb(S,e.domain,x),db(S,lv,x),db(S,ov,x),lb(C,e.domain,x),lb(C,t,x),db(C,lv,x);const _=[[Eb,Mb],[Cb,_b],[Nb,Rb],[Ob,Tb],[Ab,Db],[$b,Lb],[jb,Ib],[zb,Pb]];for(let N=0;N<_.length;N++){const[e,r]=_[N],o=db(x,e);db(k,e,o),db(o,r,x);const i=Dv(Av);lb(o,t,i);const s=Dv();lb(o,n),lb(i,t,i),lb(i,n,s),lb(s,t,i),lb(s,n,s),db(i,r,x),db(s,r,x)}return db(o,gb,b),db(o,Sb,Tv),{start:o,tokens:fv}}(jv.scanner.tokens);for(let e=0;e<jv.pluginQueue.length;e++)jv.pluginQueue[e][1]({scanner:jv.scanner,parser:jv.parser});return jv.initialized=!0,jv}function Pv(e){return jv.initialized||zv(),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,p=-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()?(p=0,d=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push($v(Ov,t,s)),s=[]),o-=p,u-=p;const e=d.t,r=n.slice(o-u,o);i.push($v(e,t,r))}}return s.length>0&&i.push($v(Ov,t,s)),i}(jv.parser.start,e,xv(jv.scanner.start,e))}function Fv(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 Mv(n),o=Pv(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}Pv.scan=xv;var Bv="[\0-   ᠎ -\u2029  ]",Hv=new RegExp(Bv),Vv=new RegExp(`${Bv}$`),qv=new RegExp(Bv,"g");function Uv(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(qv,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Wv=Jm.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?Iv(e.scheme,e.optionalSlashes):Iv(e)})},onDestroy(){ab.groups={},jv.scanner=null,jv.parser=null,jv.tokenQueue=[],jv.pluginQueue=[],jv.customSchemes=[],jv.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)=>!!Uv(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=>!!Uv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Uv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Gh(this.options.HTMLAttributes,e),0]:["a",Gh(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=>!!Uv(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=>!!Uv(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[_g({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=Fv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Uv(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=>!!Uv(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new Cc({key:new Rc("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 am(Fh(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(!Vv.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(Hv).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=Pv(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=>{lm(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 Cc({key:new Rc("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=im(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 Cc({key:new Rc("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=Fv(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}}),Yv=Wv,Jv=Object.defineProperty,Kv="textStyle",Gv=/^\s*([-+*])\s$/,Zv=Cg.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",Gh(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(Kv)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=gg({find:Gv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=gg({find:Gv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Kv),editor:this.editor})),[e]}}),Qv=Cg.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Gh(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)=>Mg(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)Jv(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>Xv,getNextListDepth:()=>ew,handleBackspace:()=>ow,handleDelete:()=>aw,hasListBefore:()=>tw,hasListItemAfter:()=>lw,hasListItemBefore:()=>nw,listItemHasSubList:()=>rw,nextListIsDeeper:()=>iw,nextListIsHigher:()=>sw});var Xv=(e,t)=>{const{$from:n}=t.selection,r=Ff(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}},ew=(e,t)=>{const n=Xv(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},tw=(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))},nw=(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},rw=(e,t,n)=>{if(!n)return!1;const r=Ff(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},ow=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!kh(e.state,t)&&tw(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(!kh(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=Xv(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=rw(t,e.state,o);return nw(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},iw=(e,t)=>{const n=ew(e,t),r=Xv(e,t);return!(!r||!n)&&n>r.depth},sw=(e,t)=>{const n=ew(e,t),r=Xv(e,t);return!(!r||!n)&&n<r.depth},aw=(e,t)=>{if(!kh(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Bh(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))&&(iw(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():sw(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},lw=(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},cw=eg.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]&&aw(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]&&aw(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]&&ow(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]&&ow(e,n,r)&&(t=!0)}),t}}}}),uw=/^(\s*)(\d+)\.\s+(.*)$/,dw=/^\s/;function pw(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 p=[];for(;d<e.length&&e[d].indent>t;)p.push(e[d]),d+=1;if(p.length>0){const e=Math.min(...p.map(e=>e.indent)),t=pw(p,e,n);c.push({type:"list",ordered:!0,start:p[0].number,items:t,raw:p.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}var fw="textStyle",hw=/^(\d+)\.\s$/,mw=Cg.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",Gh(this.options.HTMLAttributes,n),0]:["ol",Gh(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(uw);if(!i)break;const[,s,a,l]=i,c=s.length;let u=l,d=n+1;const p=[o];for(;d<e.length;){const t=e[d];if(t.match(uw))break;if(""===t.trim())p.push(t),u+="\n",d+=1;else{if(!t.match(dw))break;p.push(t),u+=`\n${t.slice(c+2)}`,d+=1}}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:p.join("\n")}),r=d,n=d}return[t,r]}(o);if(0===i.length)return;const a=pw(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(fw)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=gg({find:hw,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=gg({find:hw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(fw)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),gw=/^\s*(\[([( |x])?\])\s$/,yw=Cg.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",Gh(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 Mg(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=Zh(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[gg({find:gw,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),bw=Cg.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",Gh(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=Eg(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=Eg(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()}}});eg.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(Zv.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Qv.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(cw.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(mw.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(yw.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(bw.configure(this.options.taskList)),e}});var vw="&nbsp;",ww=Cg.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Gh(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!==vw&&" "!==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?vw:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),xw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,kw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Sw=Jm.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",Gh(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[hg({find:xw,type:this.type})]},addPasteRules(){return[_g({find:kw,type:this.type})]}}),Ew=Cg.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Mw=Jm.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Gh(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()}}}),Cw=Mw;function _w(e={}){return new Cc({view:t=>new Nw(t,e)})}class Nw{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=ql(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 Rw extends ac{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Rw.valid(n)?new Rw(n):ac.near(n)}content(){return ma.empty}eq(e){return e instanceof Rw&&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 Rw(e.resolve(t.pos))}getBookmark(){return new Ow(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||Tw(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||Tw(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&&Rw.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(Rw.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!fc.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(Rw.valid(s))return s}return null}}}Rw.prototype.visible=!1,Rw.findFrom=Rw.findGapCursorFrom,ac.jsonID("gapcursor",Rw);class Ow{constructor(e){this.pos=e}map(e){return new Ow(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Rw.valid(t)?new Rw(t):ac.near(t)}}function Tw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const Aw=_f({ArrowLeft:Dw("horiz",-1),ArrowRight:Dw("horiz",1),ArrowUp:Dw("vert",-1),ArrowDown:Dw("vert",1)});function Dw(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 dc){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=Rw.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new Rw(l))),!0)}}function $w(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Rw.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&fc.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new Rw(r))),!0)}function Lw(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Rw))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=ca.empty;for(let s=r.length-1;s>=0;s--)o=ca.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ma(o,0,0));return i.setSelection(dc.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function jw(e){if(!(e.selection instanceof Rw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Pp.create(e.doc,[jp.widget(e.selection.head,t,{key:"gapcursor"})])}var Iw=200,zw=function(){};zw.prototype.append=function(e){return e.length?(e=zw.from(e),!this.length&&e||e.length<Iw&&this.leafAppend(e)||this.length<Iw&&e.leafPrepend(this)||this.appendInner(e)):this},zw.prototype.prepend=function(e){return e.length?zw.from(e).append(this):this},zw.prototype.appendInner=function(e){return new Fw(this,e)},zw.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?zw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},zw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},zw.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)},zw.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},zw.from=function(e){return e instanceof zw?e:e&&e.length?new Pw(e):zw.empty};var Pw=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<=Iw)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Iw)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}(zw);zw.empty=new Pw([]);var Fw=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}(zw);class Bw{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 Hw(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 Hw(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 Bw(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 Hw(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>qw&&(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 Bw(s.append(o),i)}remapping(e,t){let n=new xl;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 Bw(this.items.append(e.map(e=>new Hw(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 Hw(l,i,c))}else n.push(new Hw(l))},r);let l=[];for(let d=t;d<i;d++)l.push(new Hw(o.maps[d]));let c=this.items.slice(0,r).append(l).append(n),u=new Bw(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 Hw(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 Bw(zw.from(r.reverse()),o)}}Bw.empty=new Bw(zw.empty,0);class Hw{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 Hw(t.getMap().invert(),t,this.selection)}}}class Vw{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const qw=20;function Uw(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 Ww(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 Yw=!1,Jw=null;function Kw(e){let t=e.plugins;if(Jw!=t){Yw=!1,Jw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Yw=!0;break}}return Yw}const Gw=new Rc("history"),Zw=new Rc("closeHistory");function Qw(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Cc({key:Gw,state:{init:()=>new Vw(Bw.empty,Bw.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(Gw);if(i)return i.historyState;n.getMeta(Zw)&&(e=new Vw(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(Gw))return s.getMeta(Gw).redo?new Vw(e.done.addTransform(n,void 0,r,Kw(t)),e.undone,Uw(n.mapping.maps),e.prevTime,e.prevComposition):new Vw(e.done,e.undone.addTransform(n,void 0,r,Kw(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Vw(e.done.rebased(n,o),e.undone.rebased(n,o),Ww(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Vw(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ww(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?Ww(e.prevRanges,n.mapping):Uw(n.mapping.maps);return new Vw(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Kw(t)),Bw.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?ex:"historyRedo"==n?tx:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Xw(e,t){return(n,r)=>{let o=Gw.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Kw(t),o=Gw.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 Vw(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Gw,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const ex=Xw(!1,!0),tx=Xw(!0,!0);eg.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 Cc({key:new Rc("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 nx=eg.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[_w(this.options)]}});eg.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new Cc({key:new Rc("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Pp.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(jp.node(t,t+e.nodeSize,{class:this.options.className}))}),Pp.create(e,i)}}})]}});var rx=eg.create({name:"gapCursor",addProseMirrorPlugins:()=>[new Cc({props:{decorations:jw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Rw.valid(n)?new Rw(n):null,handleClick:$w,handleKeyDown:Aw,handleDOMEvents:{beforeinput:Lw}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=Wh(Hh(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),ox="placeholder";var ix=eg.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ox,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-${ox}`;var t;return[new Cc({key:new Rc("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&&hm(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=jp.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}),Pp.create(t,i)}}})]}});function sx({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}eg.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Cc({key:new Rc("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||mm(n.selection)||e.view.dragging?null:Pp.create(n.doc,[jp.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var ax=eg.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new Rc(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 Cc({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)=>!sx({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!sx({node:e.doc.lastChild,types:r})}}})]}}),lx=eg.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>ex(e,t),redo:()=>({state:e,dispatch:t})=>tx(e,t)}),addProseMirrorPlugins(){return[Qw(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()}}}),cx=eg.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(Dy.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(Ny.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(Zv.configure(this.options.bulletList)),!1!==this.options.code&&o.push(jy.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(Py.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(Fy.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(nx.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(rx.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(By.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(Hy.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(lx.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(Vy.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Jy.configure(this.options.italic)),!1!==this.options.listItem&&o.push(Qv.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(cw.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(Wv.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(mw.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(ww.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(Sw.configure(this.options.strike)),!1!==this.options.text&&o.push(Ew.configure(this.options.text)),!1!==this.options.underline&&o.push(Mw.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(ax.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),ux=eg.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")}}}),dx=ix,px=(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(...px(e,t+1))}),n},fx=Jm.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=px(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",Gh(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}}}}),hx=eg.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()})}),mx=eg.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()})}),gx=eg.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()})}),yx=eg.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()})}),bx=eg.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()})});eg.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(hx.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(mx.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(gx.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(yx.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(bx.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(fx.configure(this.options.textStyle)),e}});var vx=mx,wx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,xx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,kx=Jm.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",Gh(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[hg({find:wx,type:this.type})]},addPasteRules(){return[_g({find:xx,type:this.type})]}}),Sx=kx;function Ex({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 Mx=["#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 Cx({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 p=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:p},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($,{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}},Mx.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 _x({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($,{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 Nx({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),p=e.useRef(null),f=e.useRef(null);e.useEffect(()=>{if(!i)return;const e=e=>{d.current&&!d.current.contains(e.target)&&p.current&&!p.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const h=()=>{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(()=>f.current?.focus(),50)})()}},React.createElement(P,{className:o})),i&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:p,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:f,value:a,onChange:e=>l(e.target.value),placeholder:"https://",size:"small",onPressEnter:h}),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(),h()}},"确定")))),document.body))}function Rx({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(_x,{editor:t}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleBold().run(),active:t.isActive("bold"),title:"加粗"},React.createElement(D,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"斜体"},React.createElement(z,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"下划线"},React.createElement(te,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"删除线"},React.createElement(G,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Cx,{currentColor:o,onSelect:e=>{e?t.chain().focus().setColor(e).run():t.chain().focus().unsetColor().run()},icon:React.createElement(W,{className:n}),title:"字体颜色"}),React.createElement(Cx,{currentColor:i,onSelect:e=>{e?t.chain().focus().setHighlight({color:e}).run():t.chain().focus().unsetHighlight().run()},icon:React.createElement(I,{className:n}),title:"背景色"}),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleBulletList().run(),active:t.isActive("bulletList"),title:"无序列表"},React.createElement(V,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"有序列表"},React.createElement(H,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().sinkListItem("listItem").run(),disabled:!t.can().sinkListItem("listItem"),title:"增加缩进"},React.createElement(B,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().liftListItem("listItem").run(),disabled:!t.can().liftListItem("listItem"),title:"减少缩进"},React.createElement(F,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Ex,{onClick:()=>t.chain().focus().setTextAlign("left").run(),active:t.isActive({textAlign:"left"}),title:"左对齐"},React.createElement(X,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().setTextAlign("center").run(),active:t.isActive({textAlign:"center"}),title:"居中"},React.createElement(Z,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().setTextAlign("right").run(),active:t.isActive({textAlign:"right"}),title:"右对齐"},React.createElement(Q,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Nx,{editor:t,iconSize:n}),React.createElement(Ex,{onClick:()=>t.chain().focus().unsetLink().run(),disabled:!t.isActive("link"),title:"取消链接"},React.createElement(re,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Ex,{onClick:()=>t.chain().focus().unsetAllMarks().clearNodes().run(),title:"清除格式"},React.createElement(K,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"撤销"},React.createElement(ne,{className:n})),React.createElement(Ex,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"重做"},React.createElement(J,{className:n}))))}function Ox({value:t,onChange:n,readonly:r=!1,placeholder:o="请输入内容...",isTableMode:i=!1,hasError:s=!1,minHeight:a=120}){const l=wy({extensions:[cx,Cw,fx,vx,Sx.configure({multicolor:!0}),Yv.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),ux.configure({types:["heading","paragraph"]}),dx.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-amber-50/80 focus-within:border-indigo-400 focus-within:ring-2 focus-within:ring-indigo-100");return React.createElement("div",{className:c},l&&React.createElement(Rx,{editor:l}),React.createElement(hy,{editor:l,className:"tiptap-editor rich-text-content overflow-hidden rounded-b-md",style:{minHeight:`${a}px`}}))}function Tx(e){return e.filter(e=>"done"===e.status).map(e=>e.response?._id||e.uid).join(",")}function Ax(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 Dx({field:n,value:r,onChange:o,isTableMode:i=!1,hasError:s=!1,minimal:a=!1,onFillFields:l,formValues:c,formalTableMode:d=!1,historyApproves:p=[],previewMode:f=!1}){const{remoteOptions:h,remoteLoading:m}=function(t,n){const[r,o]=e.useState([]),[i,s]=e.useState(!1);return e.useEffect(()=>{if("apiSelect"!==t.type||!t.optionsUrl)return;s(!0);let e=t.optionsUrl,r={method:(t.optionsMethod||"GET").toUpperCase()};if(t.optionsBeforeScript)try{const o=new Function("url","options","values",t.optionsBeforeScript)(e,r,n||{});o&&"object"==typeof o&&(e=o.url||e,r=o.options||r)}catch(i){console.warn("[apiSelect] optionsBeforeScript error:",i)}fetch(e,r).then(e=>e.json()).then(e=>{let n,r=Array.isArray(e)?e:Array.isArray(e?.value)?e.value:Array.isArray(e?.data)?e.data:[];if(t.optionsMapScript)try{n=new Function("data",t.optionsMapScript)(r)}catch(i){console.warn("[apiSelect] optionsMapScript error:",i),n=[]}else{const e=t.optionsLabelField||"name",o=t.optionsValueField||"_id";n=r.map(t=>({label:String(t[e]||""),value:String(t[o]||"")}))}o(n)}).catch(e=>console.warn("[apiSelect] fetch error:",e)).finally(()=>s(!1))},[t.type,t.optionsUrl,t.optionsMethod,t.optionsBeforeScript,t.optionsMapScript,t.optionsLabelField,t.optionsValueField,n]),{remoteOptions:r,remoteLoading:i}}(n,c),[g,y]=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:Pn(e,void 0,t),response:{_id:e}}))}return[]});e.useEffect(()=>{if("file"!==n.type&&"image"!==n.type)return;const e=g.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 jn.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&&y(r=>r.map(r=>{const o=e[r.uid];return o?{...r,name:o,url:Pn(r.uid,o,t),..."image"===n.type?{thumbUrl:Pn(r.uid,o,t)}:{}}:r}))})},[]);const[b,v]=e.useState(!1),[w,x]=e.useState(""),[k,S]=e.useState(!1),E=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",M=n.readonly?"bg-white":"bg-amber-50/80",C=n.readonly?{}:{backgroundColor:"rgba(255,251,235,0.8)"},_=`border-gray-300 ${M} focus:border-[#4096ff] focus:ring-2 focus:ring-[#1677ff]/10`,N=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${E}`:`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":_}`,R=n.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"",[O,T]=e.useState(null),A=e.useCallback(e=>{if(!e)return void T(null);const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);T(t?null:"邮箱格式不正确")},[]),D=e.useCallback(e=>{if(!e)return void T(null);const t=/^https?:\/\/.+/i.test(e);T(t?null:"链接格式不正确,需以 http:// 或 https:// 开头")},[]),$=e.useCallback(e=>{if(""===e||null==e)return void T(null);const t=Number(String(e).replace(/,/g,""));isNaN(t)?T(null):null!=n.min&&t<n.min?T(`不能小于 ${n.min}`):null!=n.max&&t>n.max?T(`不能大于 ${n.max}`):T(null)},[n.min,n.max]),L=e.useCallback(e=>{n.minLength&&e&&e.length<n.minLength?T(`长度不能少于 ${n.minLength} 个字符(当前 ${e.length} 字符)`):T(null)},[n.minLength]),j=O?React.createElement(t.Tooltip,{title:O,color:"orange",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 text-amber-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))):null;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){const t="true"===r?"是":"否";return React.createElement("div",{className:e},t)}if("checkboxGroup"===n.type){const t=(Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[]).map(e=>(n.options||[]).find(t=>t.value===e)?.label??e).join(", ");return React.createElement("div",{className:e},t)}if("radio"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label??"")}if("select"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label||r||"")}if("apiSelect"===n.type){if(n.optionsMultiple){const t=(Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[]).map(e=>h.find(t=>t.value===e)?.label??e).join(", ");return React.createElement("div",{className:e},m?"加载中...":t)}const t=h.find(e=>e.value===r);return React.createElement("div",{className:e},m?"加载中...":t?.label||r||"")}if("file"===n.type)return 0===g.length?React.createElement("div",{className:e}):React.createElement("div",{className:`${e} flex flex-wrap gap-2`},g.map(e=>{const t=e.url||(e.response?._id?Pn(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(Js,{value:r,isTableMode:i,minimal:a});if("org"===n.type||"orgMulti"===n.type)return React.createElement(Gs,{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:()=>S(!0),onKeyDown:e=>{"Enter"===e.key&&S(!0)}},r),React.createElement(t.Modal,{title:"即将离开当前页面",open:k,okText:"继续访问",cancelText:"取消",onOk:()=>{S(!1),window.open(r,"_blank","noopener,noreferrer")},onCancel:()=>S(!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){if("autoNumber"===n.type)return React.createElement("div",{className:`${e} flex items-center gap-1.5 text-gray-400`},React.createElement("span",null,r||Ax(n)));if("richtext"===n.type)return React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:r||""}});if("datetime"===n.type&&r){const t=u(r);return React.createElement("div",{className:e},t.isValid()?t.format("YYYY-MM-DD HH:mm"):r)}if("number"!==n.type||!n.thousandSeparator&&null==n.precision||null==r||""===r)return"textarea"===n.type?React.createElement("div",{className:e,style:{whiteSpace:"pre-wrap"}},r??""):React.createElement("div",{className:e},r??"");{const t=Number(r),o=isNaN(t)?r:n.thousandSeparator?null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN"):t.toFixed(n.precision);return React.createElement("div",{className:e},o)}}}}}}switch(n.type){case"text":{const e=s||!!O,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":E}`:`w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition ${e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":_}`,a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:"text",value:r,onChange:e=>{o(e.target.value),O&&L(e.target.value)},onBlur:e=>{n.minLength&&L(e.target.value)},placeholder:n.placeholder||"请输入",readOnly:n.readonly,maxLength:n.maxLength,className:`${t} ${R} ${i&&O?"flex-1 min-w-0":""}`}),!i&&(O||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},O?React.createElement("p",{className:"text-[11px] text-red-500"},O):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"email":case"url":{const e="email"===n.type,t=s||!!O,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":E}`:`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":_}`;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:e?"email":"url",value:r,onChange:t=>{o(t.target.value),O&&(e?A(t.target.value):D(t.target.value))},onBlur:t=>{e?A(t.target.value):D(t.target.value)},placeholder:n.placeholder||(e?"请输入邮箱地址":"请输入链接地址"),readOnly:n.readonly,maxLength:n.maxLength,className:`${a} ${R} ${i&&O?"flex-1 min-w-0":""}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O))}case"textarea":{const e=s||!!O,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":E}`:`w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition ${e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":_}`,a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("textarea",{value:r,onChange:e=>{o(e.target.value),O&&L(e.target.value)},onBlur:e=>{n.minLength&&L(e.target.value)},placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,maxLength:n.maxLength,rows:3,className:`${t} ${R} resize-none ${i&&O?"flex-1 min-w-0":""}`}),!i&&(O||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},O?React.createElement("p",{className:"text-[11px] text-red-500"},O):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"number":{const e=e=>{if(""===e||null==e)return"";const t=Number(String(e).replace(/,/g,""));return isNaN(t)?String(e):n.thousandSeparator?null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN"):null!=n.precision?t.toFixed(n.precision):String(t)},t=s||!!O,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":E}`:`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":_}`;return!n.thousandSeparator&&null==n.precision||n.readonly?React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:"number",value:r,onChange:e=>{const t=e.target.value;o(""===t?"":Number(t)),O&&$(t)},onBlur:e=>{null==n.min&&null==n.max||$(e.target.value)},placeholder:n.placeholder||"请输入数字",readOnly:n.readonly,min:n.min,max:n.max,className:`${a} ${R} ${i&&O?"flex-1 min-w-0":""}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O)):React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full flex items-center"},i&&O&&j,React.createElement("input",{type:"text",defaultValue:e(r),key:`num-${n._id}-${r}`,onFocus:e=>{e.target.value=null==r?"":String(r),T(null)},onBlur:t=>{const i=t.target.value.replace(/,/g,"");if(""===i)return o(""),t.target.value="",void $("");const s=Number(i);if(isNaN(s))return void(t.target.value=e(r));const a=null!=n.precision?Number(s.toFixed(n.precision)):s;o(a),t.target.value=e(a),$(String(a))},placeholder:n.placeholder||"请输入数字",className:`${a} ${i&&O?"flex-1 min-w-0":"w-full"}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O))}case"date":return React.createElement(t.ConfigProvider,{locale:Ns},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":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:Ns},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:r?u(r):null,onChange:e=>o(e?e.second(0).millisecond(0).toISOString():""),disabled:n.readonly,placeholder:"选择日期时间",className:"!w-full "+(i?"picker-table-mode":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:Ns},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":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:Ns},React.createElement(t.Select,{value:r||void 0,onChange:e=>o(e??""),disabled:n.readonly,placeholder:"请选择",className:"!w-full "+(i?"picker-table-mode":n.readonly?"":"select-editable-bg"),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:Ns},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":"multiselect-form-mode"+(n.readonly?"":" select-editable-bg")),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"apiSelect":return React.createElement(t.ConfigProvider,{locale:Ns},React.createElement(t.Select,{...n.optionsMultiple?{mode:"multiple"}:{},value:n.optionsMultiple?r?Array.isArray(r)?r:String(r).split(",").filter(Boolean):[]:r||void 0,onChange:n.optionsMultiple?e=>o(e.join(",")):e=>o(e??""),disabled:n.readonly,loading:m,placeholder:m?"加载中...":n.optionsMultiple?"请选择(多选)":"请选择",className:"!w-full "+(i?"picker-table-mode":`${n.optionsMultiple?"multiselect-form-mode":""}${n.readonly?"":" select-editable-bg"}`),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,...n.optionsMultiple?{}:{height:"100%"}}:{...n.optionsMultiple?{}:{height:38},...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,showSearch:!0,filterOption:(e,t)=>(t?.label??"").toString().toLowerCase().includes(e.toLowerCase()),options:h}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},(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 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},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"checkboxGroup":{const e=Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[],s=(n.options||[]).map(e=>({label:e.label,value:e.value}));return React.createElement("div",{className:"py-1 "+(i?"px-2.5 py-2":"px-1 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},s.length>0?React.createElement(t.ConfigProvider,{locale:Ns},React.createElement(t.Checkbox.Group,{value:e,onChange:e=>o(e),disabled:n.readonly,options:s})):React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"))}case"file":{const e=!!n.multiple,r={fileList:g,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 zn(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=>{y(e.fileList),o(Tx(e.fileList))},onRemove:e=>{const t=g.filter(t=>t.uid!==e.uid);y(t),o(Tx(t))}};return React.createElement(t.ConfigProvider,{locale:Ns},i?React.createElement("div",{className:"px-2.5 py-2"},React.createElement(t.Upload,{...r},React.createElement(t.Button,{size:"small",icon:React.createElement(Fi,null),disabled:n.readonly},n.readonly?"仅读":"上传文件"))):React.createElement("div",{className:"mb-2"},React.createElement(t.Upload.Dragger,{...r},React.createElement("p",{className:"ant-upload-drag-icon"},React.createElement(Mi,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||"";x(t),v(!0)},s={listType:"picture-card",fileList:g,accept:"image/*",multiple:e,maxCount:e?void 0:1,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await zn(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=Pn(e.response._id,e.name,"cfs.images.filerecord");return{...e,url:t,thumbUrl:t}}return e});y(t),o(Tx(t))},onRemove:e=>{const t=g.filter(t=>t.uid!==e.uid);y(t),o(Tx(t))},onPreview:r};return React.createElement(t.ConfigProvider,{locale:Ns},React.createElement("div",{className:"workflow-image-field "+(i?"px-2.5 py-1.5":"")},React.createElement(t.Upload,{...s},!n.readonly&&React.createElement("div",{className:"flex flex-col items-center justify-center"},React.createElement(Ti,null),React.createElement("span",{className:"text-[11px] mt-1"},"上传")))),w&&React.createElement(t.Image,{wrapperStyle:{display:"none"},preview:{visible:b,onVisibleChange:e=>{v(e),e||x("")}},src:w}))}case"member":return React.createElement(Hs,{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(Hs,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,minimal:a,valueFormat:n.valueFormat});case"org":return React.createElement(Ws,{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(Ws,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,valueFormat:n.valueFormat});case"lookup":return React.createElement($s,{field:n,value:r,onChange:o,onFillFields:l,isTableMode:i,hasError:s,formValues:c});case"formula":{const e=null==r?"":String(r);let t=e;if(e&&!e.startsWith("#ERR")&&n.thousandSeparator){const r=Number(e);isNaN(r)||(t=null!=n.precision?r.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):r.toLocaleString("zh-CN"))}else if(e&&!e.startsWith("#ERR")&&null!=n.precision){const r=Number(e);isNaN(r)||(t=r.toFixed(n.precision))}const o=!n.readonly;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 ${e.startsWith("#ERR")?"text-red-400 text-[11px]":e?"text-gray-800":"text-gray-400"} truncate flex items-center`,title:e.startsWith("#ERR")?e:n.formula?`= ${n.formula}`:""},React.createElement("span",{className:"truncate flex-1"},i?e.startsWith("#ERR")?e:t||"":t||"(自动计算)"),o&&React.createElement("span",{className:"shrink-0 ml-1 text-[10px] italic text-gray-300",title:`公式: ${n.formula||""}`},"ƒ"))}case"approvalComments":{const e=n.approvalCommentSteps||[];let t=Array.isArray(p)&&p.length?p:function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(r);return f&&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(U,{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"}:C}}});case"richtext":return React.createElement(Ox,{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||Ax(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:`${N} mt-1`}));default:return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:"请输入",className:N})}}function $x(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 p=(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?p+="整":0===s?p+="零"+l[a]+"分":(p+=l[s]+"角",p+=a>0?l[a]+"分":"整"),(n?"负":"")+p}function Lx(e){const t=[],n=e=>{Array.isArray(e)?e.forEach(n):t.push(e)};return e.forEach(n),t}function jx(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(f),u.extend(g),u.extend(v),u.locale("zh-cn");const Ix={SUM:(...e)=>Lx(e).reduce((e,t)=>e+jx(t),0),AVG:(...e)=>{const t=Lx(e);return t.length?t.reduce((e,t)=>e+jx(t),0)/t.length:0},AVERAGE:(...e)=>{const t=Lx(e);return t.length?t.reduce((e,t)=>e+jx(t),0)/t.length:0},MAX:(...e)=>{const t=Lx(e);return 0===t.length?0:Math.max(...t.map(jx))},MIN:(...e)=>{const t=Lx(e);return 0===t.length?0:Math.min(...t.map(jx))},COUNT:(...e)=>Lx(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,IFS:(...e)=>{for(let t=0;t<e.length-1;t+=2)if(e[t])return e[t+1];return e.length%2!=0?e[e.length-1]:""},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 $x(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=>$x(e),CNY:e=>$x(e)},zx=Object.keys(Ix),Px=Object.values(Ix);function Fx(e,t,n){if(!e)return"";const r=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),i=/^[A-Za-z_$][A-Za-z0-9_$]*$/,s=n?e:e.filter(e=>i.test(e)),a=[],l=[];for(const n of s){const e=t[n];if("string"!=typeof e||!e.trim())continue;let r;try{r=JSON.parse(e)}catch{continue}if(!Array.isArray(r)||0===r.length)continue;if(!r.every(e=>e&&"object"==typeof e&&!Array.isArray(e)))continue;const o=new Map;for(const t of r)Object.keys(t).forEach(e=>{o.has(e)||o.set(e,[]),o.get(e).push(t[e])});for(const[t,i]of o.entries()){s.includes(t)||a.includes(t)||(a.push(t),l.push(i));const e=`${n}_${t}`;s.includes(e)||a.includes(e)||(a.push(e),l.push(i))}}if(n){const n={};zx.forEach((e,t)=>{n[e]=Px[t]});for(const r of e){const e=t[r];if(null==e||""===e){n[r]=0;continue}const o=Number(e);n[r]=isNaN(o)?e:o}a.forEach((e,t)=>{n[e]=l[t]});const s=new Set([...e,...a]),c=e=>{const t=[];let r=e.replace(/\{([^{}]+)\}/g,(e,n)=>{const r=t.length,o=n.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return t.push(`__v["${o}"]`),`__PLACEHOLDER_${r}__`});const o=new Set([...zx,...[...s].filter(e=>i.test(e))]);r=r.replace(/(["'])(?:(?!\1)[^\\]|\\.)*\1|\b([A-Za-z_$][A-Za-z0-9_$]*)\b/g,(e,t,r)=>r?r.startsWith("__PLACEHOLDER_")?e:(o.has(r)||(n[r]=0),`__v["${r}"]`):e),r=r.replace(/__PLACEHOLDER_(\d+)__/g,(e,n)=>t[Number(n)]);return new Function("__v",`return (${r});`)(n)},u=r.match(/^\$\{([\s\S]+)\}$/);if(u&&!r.match(/\}\s*[^}]*\$\{/))try{const e=c(u[1]);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?Math.round(1e4*e)/1e4:"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}return r.replace(/\$\{([^}]*(?:\{[^{}]*\}[^}]*)*)\}/g,(e,t)=>{try{const e=c(t);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?String(Math.round(1e4*e)/1e4):"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}})}const c=s.map(e=>{const n=t[e];if(null==n||""===n)return 0;const r=Number(n);return isNaN(r)?n:r}),u=e=>{const t=[],n=[],r=new Set([...zx,...s,...a]),o=e.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const i of o)r.has(i)||(r.add(i),t.push(i),n.push(0));return new Function(...zx,...s,...a,...t,`return (${e});`)(...Px,...c,...l,...n)},d=r.match(/^\$\{([^}]+)\}$/);if(d)try{const e=u(d[1]);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?Math.round(1e4*e)/1e4:"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}return r.replace(/\$\{([^}]+)\}/g,(e,t)=>{try{const e=u(t);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?String(Math.round(1e4*e)/1e4):"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}})}catch(o){const t=o instanceof Error?o.message:String(o);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function Bx(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function Hx(e){return e._id?e:{...e,_id:Bx()}}function Vx(e={}){return{...e}}function qx(e){if(!e)return"";const t=["YYYY-MM-DD","YYYY/MM/DD","YYYY.MM.DD","MM/DD/YYYY","DD/MM/YYYY","YYYY年MM月DD日","YYYY年M月D日"];for(const r of t){const t=u(e,r,!0);if(t.isValid())return t.format("YYYY-MM-DD")}const n=u(e);return n.isValid()&&e.length>=8?n.format("YYYY-MM-DD"):""}function Ux(e){if(!e)return"";const t=["YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm","YYYY/MM/DD HH:mm:ss","YYYY/MM/DD HH:mm","YYYY.MM.DD HH:mm:ss","YYYY.MM.DD HH:mm","YYYY年MM月DD日 HH:mm:ss","YYYY年MM月DD日 HH:mm","YYYY年M月D日 HH:mm","YYYY-MM-DDTHH:mm:ss","YYYY-MM-DDTHH:mm:ssZ"];for(const r of t){const t=u(e,r,!0);if(t.isValid())return t.second(0).millisecond(0).toISOString()}const n=u(e);return n.isValid()&&e.length>=10?n.second(0).millisecond(0).toISOString():""}function Wx(e){if(!e)return"";const t=e.replace(/[¥$€£₹,,\s]/g,"");return""===t||isNaN(Number(t))?e:t}async function Yx(e){const t=[...new Set(e.filter(Boolean))];if(0===t.length)return new Map;const n=`{rows:space_users(filters: [["user_accepted","=",true],["name","in",[${t.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(",")}]]], top: 5000){_id,user,name,organization}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Vx({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),t=await e.json(),r=t.data?.rows||[],o=[...new Set(r.map(e=>e.organization).filter(Boolean))],i=new Map;if(o.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(o)}]], top: 1000){_id,name,fullname}}`,t=await fetch("/graphql",{method:"POST",headers:Vx({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await t.json();for(const r of n.data?.rows||[])i.set(r._id,{name:r.name||"",fullname:r.fullname||""})}const s=new Map;for(const n of r){const e=i.get(n.organization)||{name:"",fullname:""},t={id:n.user,name:n.name,sort_no:0,organization:{name:e.name,fullname:e.fullname}};s.has(n.name)||s.set(n.name,t)}return s}catch{return new Map}}async function Jx(e){const t=[...new Set(e.filter(Boolean))];if(0===t.length)return new Map;const n=t.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(","),r=`{byName:organizations(filters: [["name","in",[${n}]]], top: 5000){_id,name,fullname},byFullname:organizations(filters: [["fullname","in",[${n}]]], top: 5000){_id,name,fullname}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Vx({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),t=await e.json(),n=t.data?.byName||[],o=t.data?.byFullname||[],i=new Map;for(const r of o)i.has(r.fullname)||i.set(r.fullname,{id:r._id,name:r.name,fullname:r.fullname||r.name});for(const r of n)i.has(r.name)||i.set(r.name,{id:r._id,name:r.name,fullname:r.fullname||r.name});return i}catch{return new Map}}async function Kx(e,t){if(0===e.length)return e;const n=new Set,r=new Set,o=new Map;for(const c of t){const t=e.map(e=>e[c.name]).filter(Boolean);if(0!==t.length)if("member"===c.type||"memberMulti"===c.type)for(const e of t)"memberMulti"===c.type?e.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>n.add(e)):n.add(e.trim());else if("org"===c.type||"orgMulti"===c.type)for(const e of t)"orgMulti"===c.type?e.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>r.add(e)):r.add(e.trim());else if("lookup"===c.type&&c.reference_to){const e=c.lookupDisplayFields||["name"],n=("string"==typeof e[0]?e[0]:e[0]?.field)||"name",r=`${c.reference_to}:${n}`;o.has(r)||o.set(r,{field:c,names:new Set});const i=o.get(r);for(const o of t)c.pickerMultiple?o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>i.names.add(e)):i.names.add(o.trim())}}const[i,s,...a]=await Promise.all([n.size>0?Yx([...n]):Promise.resolve(new Map),r.size>0?Jx([...r]):Promise.resolve(new Map),...Array.from(o.values()).map(({field:e,names:t})=>async function(e,t){const n=[...new Set(e.filter(Boolean))];if(0===n.length||!t.reference_to)return new Map;const r=t.reference_to,o=t.lookupDisplayFields||["name"],i=("string"==typeof o[0]?o[0]:o[0]?.field)||"name",s=`{rows:${r}(filters: [["${i}","in",[${n.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(",")}]]], top: 5000){_id,${i}}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Vx({"Content-Type":"application/json"}),body:JSON.stringify({query:s})}),t=await e.json(),n=t.data?.rows||[],r=new Map;for(const o of n){const e=o[i];e&&!r.has(e)&&r.set(e,o._id)}return r}catch{return new Map}}([...t],e))]),l=new Map;return Array.from(o.keys()).forEach((e,t)=>{l.set(e,a[t])}),e.map(e=>{const n={};for(const r of t){const t=e[r.name];if(null==t)continue;const o="string"==typeof t?t.trim():String(t);if(o)switch(r.type){case"number":n[r.name]=Wx(o);break;case"date":{const e=qx(o);n[r.name]=e||o;break}case"datetime":{const e=Ux(o);n[r.name]=e||o;break}case"member":{const e=i.get(o);n[r.name]=e||"";break}case"memberMulti":{const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>i.get(e)).filter(Boolean);n[r.name]=e.length>0?e:"";break}case"org":{const e=s.get(o);n[r.name]=e||"";break}case"orgMulti":{const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>s.get(e)).filter(Boolean);n[r.name]=e.length>0?e:"";break}case"lookup":{const e=r.lookupDisplayFields||["name"],t=("string"==typeof e[0]?e[0]:e[0]?.field)||"name",i=`${r.reference_to}:${t}`,s=l.get(i);if(s)if(r.pickerMultiple){const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>s.get(e)).filter(Boolean);n[r.name]=e.length>0?e.join(","):""}else{const e=s.get(o);n[r.name]=e||""}else n[r.name]="";break}case"select":{const e=(r.options||[]).find(e=>e.label===o||e.value===o);n[r.name]=e?e.value:"";break}case"multiSelect":{const e=r.options||[],t=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(t=>{const n=e.find(e=>e.label===t||e.value===t);return n?.value}).filter(Boolean);n[r.name]=t.length>0?t.join(","):"";break}case"checkbox":{const e=o.toLowerCase();["true","是","yes","1","✓","✔"].includes(e)?n[r.name]="true":["false","否","no","0"].includes(e)?n[r.name]="false":n[r.name]=o;break}case"checkboxGroup":{const e=o.split(/[,,]/).map(e=>e.trim()).filter(Boolean).map(e=>{const t=(r.options||[]).find(t=>t.label===e||t.value===e);return t?.value}).filter(Boolean);n[r.name]=e;break}default:n[r.name]=o}else n[r.name]=""}return n})}function Gx({field:n,isTableMode:r=!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:a,onChange:l,fieldPermissions:c,tableBorderColor:u,rowErrors:d,parentFormValues:p,chineseFieldNames:f=!1}){const h=n.children||[],m=e.useMemo(()=>c?h.filter(e=>"hidden"!==c[e.name]).map(e=>"editable"===c[e.name]?e:{...e,readonly:!0}):h,[h,c]),g=void 0!==l,y=e.useCallback((e,t)=>{const n={...p||{},...t};return e.visibilityExpression?.trim()?pe(e.visibilityExpression,n):!e.visibilityRules?.length||lk(e.visibilityRules,e.visibilityLogic,n)},[p]),b=e.useCallback((e,t)=>{if(e.required)return!0;const n={...p||{},...t};return e.requiredExpression?.trim()?pe(e.requiredExpression,n):!!e.requiredRules?.length&&lk(e.requiredRules,e.requiredLogic,n)},[p]),v=!!c&&"editable"!==c[n.name],[w,x]=e.useState([{_id:Bx()}]),k=g?function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(a):[],S=g?k.map(Hx):w,E=e.useRef(S);E.current=S;const[M,C]=e.useState(a);g&&a!==M&&C(a);const _=e=>{g?l(JSON.stringify(e)):x(e)},N=null==n.maxRows||S.length<n.maxRows,R=S.length>0&&(null==n.minRows||S.length>n.minRows),O=m.filter(e=>"formula"===e.type&&e.formula),T=e=>{if(0===O.length)return e;let t={...e};for(const n of O){const e=Fx(n.formula,t,f);t[n.name]!==e&&(t={...t,[n.name]:e})}return t},A=e.useRef(p);e.useEffect(()=>{const e=A.current;if(A.current=p,!e||!p||!g)return;const t=m.filter(e=>"lookup"===e.type&&e.lookupFilters);if(0===t.length)return;const n=[];for(const s of t){[...("string"==typeof s.lookupFilters?s.lookupFilters:JSON.stringify(s.lookupFilters)).matchAll(/\{([^{}.]+)\}/g)].map(e=>e[1]).some(t=>e[t]!==p[t])&&n.push(s.name)}if(0===n.length)return;const r=E.current;let o=!1;const i=r.map(e=>{let t=e;for(const r of n)e[r]&&(t===e&&(t={...e}),t[r]="",o=!0);return t});o&&_(i)},[p]);const D=e.useMemo(()=>0===O.length?S:S.map(T),[S,O.map(e=>e.name+":"+e.formula).join(",")]),[$,j]=e.useState(null),[I,z]=e.useState({}),P=e.useCallback(e=>{j(e),z({...S[e]||{}})},[S]),F=e.useCallback((e,t)=>{z(n=>{const r={...n,[e]:t};return T(r)})},[T]),B=e.useCallback(()=>{if(null===$)return;const e=[...S];e[$]=T(I),_(e),j(null)},[$,I,S,_,T]),H=e.useCallback(()=>{j(null)},[]),V=r?"":"border-gray-200",U=r?u||"#000000":void 0,W=U?{borderColor:U}:void 0,J=!!n.readonly,[K,G]=t.message.useMessage(),[Z,Q]=e.useState(!1),X=e.useMemo(()=>(n.children||[]).filter(e=>"formula"!==e.type&&!e.readonly),[n.children]),te=e.useMemo(()=>n.children||[],[n.children]),ne=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 te.forEach((e,n)=>{n<t.length&&"formula"!==e.type&&!e.readonly&&(r[e.name]=t[n].trim())}),r})},[te]),re=e.useMemo(()=>X.some(e=>["member","memberMulti","org","orgMulti","lookup"].includes(e.type)),[X]),oe=e.useCallback(async e=>{if(0===e.length)return;const t=null!=n.maxRows?Math.max(0,n.maxRows-S.length):e.length;if(0===t)return void K.warning(`已达到最大行数 ${n.maxRows}`);const r=e.slice(0,t);let o;if(re||X.some(e=>["date","datetime","number","checkbox","select","multiSelect"].includes(e.type))){Q(!0);try{o=await Kx(r,X)}finally{Q(!1)}}else o=r;const i=o.map(e=>Hx(T(e)));_([...S,...i]),K.success(`已粘贴 ${i.length} 行数据`)},[n.maxRows,S,re,X,T,_,K]),ie=e.useCallback(e=>{if(J||Z||v)return;const t=e.target?.tagName?.toLowerCase();if("input"===t||"textarea"===t||"select"===t)return;const n=e.clipboardData.getData("text/plain");if(!n?.trim())return;const r=ne(n);0!==r.length&&(e.preventDefault(),oe(r))},[J,Z,v,ne,oe]),se=e.useCallback(async()=>{if(!(J||Z||v))try{const e=await navigator.clipboard.readText();if(!e?.trim())return void K.info("剪贴板为空");const t=ne(e);if(0===t.length)return void K.info("未解析到有效数据");await oe(t)}catch{K.error("无法读取剪贴板,请使用 Ctrl+V / ⌘+V 粘贴")}},[J,Z,v,ne,oe,K]);if(0===m.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const ae=e.useMemo(()=>0===O.length?I:T(I),[I,O.map(e=>e.name+":"+e.formula).join(",")]),le=null!==$&&React.createElement(t.Modal,{open:!0,title:`${n.label} - 第 ${$+1} 行`,onCancel:H,onOk:B,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:H},"取消"),React.createElement(t.Button,{type:"primary",onClick:B},"确认")),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"},m.map(e=>{if(!y(e,ae))return null;const t=b(e,ae),n=t!==e.required?{...e,required:t}:e,r="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:r?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},n.label,n.required&&!n.readonly&&!J&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(Dx,{field:J?{...n,readonly:!0}:n,value:ae[e.name]??"",onChange:t=>F(e.name,t),isTableMode:!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,formValues:p,onFillFields:e=>{Object.entries(e).forEach(([e,t])=>F(e,t))}}))})));return React.createElement("div",{className:r?"":"mt-1",onPaste:ie},G,React.createElement("div",{className:r?(!1!==n.showLabel?"border-t ":"")+"overflow-hidden":"border border-gray-300 rounded-md overflow-hidden",style:r&&!1!==n.showLabel?{borderColor:U}:void 0},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"w-full text-[13px]",style:{minWidth:m.length>3?120*m.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${V}`,style:W},!1!==n.showRowNumber&&React.createElement("th",{className:`w-10 px-2 py-2 text-center text-gray-500 font-medium border-r ${V} sticky left-0 bg-gray-50 z-[1]`,style:W},"#"),m.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${V} last:border-r-0 whitespace-nowrap`,style:W},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,D.map((e,a)=>React.createElement("tr",{key:a,className:`border-b ${r?"":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`,style:r?W:void 0},!1!==n.showRowNumber&&React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-400 text-[12px] border-r ${V} sticky left-0 bg-white z-[1]`,style:W},a+1),m.map(n=>{if(!y(n,e))return React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${V} last:border-r-0`,style:W});const l=d?.[a]?.[n.name],c=b(n,e),u=c!==n.required?{...n,required:c}:n;return React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${V} last:border-r-0 ${l?"bg-red-50":!r||n.readonly||J?"":"bg-amber-50/80"}`,style:W},React.createElement("div",{className:l?"flex items-center":void 0},l&&React.createElement(t.Tooltip,{title:l,color:"red",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 ml-1 mr-0.5 text-red-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))),React.createElement("div",{className:"flex-1 min-w-0"},React.createElement(Dx,{field:J?{...u,readonly:!0}:u,value:e[n.name]??"",onChange:e=>((e,t,n)=>{const r=[...E.current];r[e]={...r[e],[t]:n},r[e]=T(r[e]),E.current=r,_(r)})(a,n.name,e),isTableMode:r,formalTableMode:!l,hasError:!!l,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,formValues:p,onFillFields:e=>{const t=[...E.current];t[a]={...t[a]},Object.entries(e).forEach(([e,n])=>{t[a][e]=n}),t[a]=T(t[a]),E.current=t,_(t)}}))))}),!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:()=>P(a),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(q,{className:"w-3 h-3"})),R&&!v&&React.createElement("button",{onClick:()=>(e=>{if(!R)return;const t=S.filter((t,n)=>n!==e);_(t),$===e?j(null):null!==$&&$>e&&j($-1)})(a),className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(ee,{className:"w-3 h-3"}))))))))),!J&&!v&&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"},N&&React.createElement("button",{onClick:()=>{N&&_([...S,{_id:Bx()}])},className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition"},React.createElement(Y,{className:"w-3.5 h-3.5"})," 添加一行"),N&&React.createElement("button",{onClick:se,disabled:Z,className:"flex items-center gap-1 text-[12px] smooth-transition "+(Z?"text-gray-400 cursor-wait":"text-gray-500 hover:text-indigo-600"),title:"从Excel或CSV粘贴数据(也可以直接 Ctrl+V / ⌘+V)"},React.createElement(L,{className:"w-3.5 h-3.5"})," ",Z?"粘贴中...":"粘贴")))),le)}function Zx(e,t){return`${e}_${t}`}function Qx({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,tableBorderColor:p,chineseFieldNames:f=!1}){const h=e.useMemo(()=>t.gridData||[],[t.gridData]),m=e.useMemo(()=>{let e=t.gridRows||3;for(const t of h){const n=t.row+(t.rowspan||1);n>e&&(e=n)}return e},[t.gridRows,h]),g=e.useMemo(()=>{let e=t.gridCols||4;for(const t of h){const n=t.col+(t.colspan||1);n>e&&(e=n)}return e},[t.gridCols,h]),y=e.useMemo(()=>t.children||[],[t.children]),b=e.useMemo(()=>"editable"!==u?y.map(e=>({...e,readonly:!0})):c?y.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):y,[y,c,u]),v=e.useMemo(()=>{const e=new Map;for(const t of b)e.set(t._id,t);return e},[b]),w=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(Zx(n.row+o,n.col+e))}return t}(h),[h]),x=e.useMemo(()=>{const e=h.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const n of e){t[Zx(n.row,n.col)]=Fx(n.value,r,f)}return t},[r,h]),k=n?p||"#000000":"",S=n?"":"border-gray-300",E=e.useMemo(()=>{const e=t.gridColumnWidths;if(!e||0===e.length)return;if(e.length>=g)return e;const n=e.reduce((e,t)=>e+t,0),r=g-e.length,o=n/e.length,i=100/(n+o*r);return[...e.map(e=>+(e*i).toFixed(2)),...Array(r).fill(+(o*i).toFixed(2))]},[t.gridColumnWidths,g]),M=!!t.gridScrollable||d;return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?""+(!1!==t.showLabel?"border-t":""):`border ${S}`,style:n?{overflow:"hidden",...!1!==t.showLabel?{borderColor:k}:{}}:void 0},React.createElement("div",{className:M?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(M?"table-fixed":""),style:{minWidth:M&&g>4?100*g+"px":void 0,...n?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:g},(e,t)=>React.createElement("col",{key:t,style:E?.[t]?{width:`${E[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:m},(e,t)=>React.createElement("tr",{key:t,className:""+(t<m-1?`border-b ${S}`:""),style:n?{borderColor:k}:void 0},Array.from({length:g},(e,d)=>{const p=Zx(t,d);if(w.has(p))return null;const f=function(e,t,n){return e.find(e=>e.row===t&&e.col===n)}(h,t,d),m=f?.rowspan||1,y=f?.colspan||1,b=d+y>=g,E=f?.cellType||"input",C={textAlign:f?.align||("label"===E?"center":"left")};if(f?.color&&(C.color=f.color),f?.backgroundColor&&(C.backgroundColor=f.backgroundColor),f?.fontWeight&&(C.fontWeight=f.fontWeight),f?.borderStyle&&(C.borderStyle=f.borderStyle),n&&(C.borderColor=k),"label"===E)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${b?"":`border-r ${S}`} ${f?.backgroundColor?"":"bg-white"} ${f?.color?"":"text-gray-600"} ${f?.fontWeight?"":"font-medium"}`,style:C},f?.value??"");if("formula"===E){const e=x[p]??"";return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${b?"":`border-r ${S}`} ${f?.color?"":"text-gray-700"}`,style:M?{...C,maxWidth:0}:C},React.createElement("div",{className:M?"truncate":"",title:String(e)},e))}const _=f?.fieldId?v.get(f.fieldId):null;if(!_&&!f?.fieldType)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(b?"":`border-r ${S}`),style:C}," ");if(_){if(_.hidden)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(b?"":`border-r ${S}`),style:C}," ");const e=_.name,t=r[e]??_.defaultValue??"";if("table"===_.type)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(b?"":`border-r ${S}`),style:C},React.createElement(Gx,{field:_,isTableMode:n,value:t,onChange:t=>o(e,t),searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c,parentFormValues:r}));const u=!_.readonly&&"formula"!==_.type&&n?"bg-amber-50/80":"",p=_.required&&!_.readonly;return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`p-0 ${b?"":`border-r ${S}`} ${u} ${M?"overflow-hidden":""}`,style:M?{...C,maxWidth:0}:C},React.createElement("div",{className:"relative"},p&&React.createElement("span",{className:"absolute top-0.5 right-1 text-red-500 text-[10px] font-bold z-10"},"*"),React.createElement(Dx,{field:_,value:t,onChange:t=>o(e,t),isTableMode:!0,formalTableMode:!0,searchUsersFn:s,searchOrgsFn:a,onFillFields:i,formValues:r})))}const N="editable"!==u;return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(b?"":`border-r ${S}`),style:C},React.createElement("input",{type:"number"===f?.fieldType?"number":"text",className:"w-full h-full px-3 py-2 text-[13px] bg-transparent outline-none "+(N?"cursor-not-allowed text-gray-500 bg-gray-50":"focus:bg-blue-50/50"),value:r[p]||"",onChange:e=>!N&&o(p,e.target.value),readOnly:N,placeholder:f?.fieldLabel||f?.value||""}))}))))))))}u.extend(v);const Xx=[{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 ek(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 tk(e,t,n){return"#"+[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function nk(e,t){const n=ek(e);return n?tk(n.r+(255-n.r)*t,n.g+(255-n.g)*t,n.b+(255-n.b)*t):e}function rk(e,t){const n=ek(e);return n?tk(n.r*(1-t),n.g*(1-t),n.b*(1-t)):e}function ok(e){if(e.sectionColor){const n={name:"custom",label:"自定义",primary:t=e.sectionColor,title:rk(t,.35),bg:nk(t,.92),border:nk(t,.35),desc:nk(t,.35)};return{...n,title:e.titleColor||n.title}}var t;const n=Xx.find(t=>t.name===e.colorScheme)||{name:"default",label:"默认",primary:"#6b7280",title:"#1f2937",bg:"#f3f4f6",border:"#9ca3af",desc:"#6b7280"};return{...n,title:e.titleColor||n.title}}function ik(e,t){for(const n of e){if(n.name===t)return n;if(n.children){const e=ik(n.children,t);if(e)return e}}}async function sk(e){try{const{data:t}=await In("organizations",{filters:JSON.stringify(["_id","=",e]),fields:"_id,name,fullname",top:1});if(t.length>0){const e=t[0];return{id:String(e._id),name:String(e.name||""),fullname:String(e.fullname||"")}}}catch{}return null}async function ak(e){try{let t=null;const n=await In("space_users",{filters:JSON.stringify(["user","=",e]),fields:"_id,user,name,sort_no,organization",top:1});if(n.data.length>0)t=n.data[0];else{const n=await In("space_users",{filters:JSON.stringify(["_id","=",e]),fields:"_id,user,name,sort_no,organization",top:1});n.data.length>0&&(t=n.data[0])}if(!t)return null;const r=t.organization,o="object"==typeof r&&null!==r&&"_id"in r?String(r._id):r?String(r):"";let i={name:"",fullname:""};if(o)try{const e=await In("organizations",{filters:JSON.stringify(["_id","=",o]),fields:"_id,name,fullname",top:1});e.data.length>0&&(i={name:String(e.data[0].name||""),fullname:String(e.data[0].fullname||"")})}catch{}return{id:String(t.user||t._id),name:String(t.name||""),sort_no:t.sort_no||0,organization:i,organizations:{name:i.name?[i.name]:[],fullname:i.fullname?[i.fullname]:[]},hr:{},roles:[]}}catch{}return null}function lk(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 ck({fields:e,columns:t=2,formValues:n,updateValue:r,fieldErrors:o,tableRowErrors:i={},searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,labelClassName:c,onFillFields:u,fieldPermissions:d,formMode:p="editable",resolveValue:f,historyApproves:h,previewMode:m,tableBorderColor:g="#000000",tableShowLeftBorder:y=!0,tableShowRightBorder:b=!0,chineseFieldNames:v=!1}){const w=[];let x=0,k=0;if(e.forEach(e=>{const n=Os(e.type),r=Rs(e),o=n||r?t:Math.min(e.tableColspan||1,t);if(x>0&&(n||r||x+o>t)){const e=t-x;e>0&&w.push({type:"empty",cs:e,key:"empty-"+k++}),x=0}w.push({type:"field",field:e}),n||r?x=0:(x+=o,x>=t&&(x=0))}),x>0){const e=t-x;e>0&&w.push({type:"empty",cs:e,key:"empty-"+k++})}const S={minWidth:0,backgroundColor:"#fff"},E=g||"#000000";return React.createElement("div",{className:"overflow-hidden workflow-form-v2-body",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:E,borderTop:`2px solid ${E}`,borderBottom:`2px solid ${E}`,borderLeft:y?`2px solid ${E}`:"none",borderRight:b?`2px solid ${E}`:"none"}},w.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...S,gridColumn:`span ${e.cs}`}});const{field:y}=e,b=Os(y.type),w=Rs(y),x={gridColumn:`span ${b||w?t:Math.min(y.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===y.type){const e=ok(y);return React.createElement("div",{key:y._id,style:{...x,backgroundColor:e.bg},"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.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}},y.label)),y.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc,whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}))}if("table"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?ok(y):null;return React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"#f3f4f6"}},React.createElement("span",{className:"text-[13px] font-semibold table-label",style:{color:e?.title||"#1f2937"}},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#6b7280",backgroundColor:e?.bg||"#f3f4f6",whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(Gx,{field:y,isTableMode:!0,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,value:n[y.name],onChange:e=>r(y.name,e),fieldPermissions:d,tableBorderColor:g,rowErrors:i[y.name],parentFormValues:n,chineseFieldNames:v}))}if("grid"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?ok(y):null;return React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"#f3f4f6"}},React.createElement("span",{className:"text-[13px] grid-label font-semibold",style:{color:e?.title||"#1f2937"}},y.label)),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#6b7280",backgroundColor:e?.bg||"#f3f4f6",whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(Qx,{field:y,isTableMode:!0,formValues:n,onUpdateValue:r,onFillFields:u,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:d,formMode:p,tableBorderColor:g,chineseFieldNames:v}))}const k=!!o?.[y.name];return"__applicant__system"===y._id&&y.hidden?React.createElement("div",{key:y._id,style:{...x,display:"none"},"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name},React.createElement(Dx,{field:y,value:(f||dk)(n[y.name]??y.defaultValue??""),onChange:e=>r(y.name,e),isTableMode:!0,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,formValues:n})):React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==y.showLabel&&React.createElement("div",{"data-field-label":"",className:fo("field-label w-28 lg:w-32 shrink-0 border-r px-2.5 py-2 flex items-center justify-center",k?"bg-red-50":"bg-gray-50/30",y.labelClassName||c),style:{borderColor:E}},React.createElement("span",{className:fo("text-[13px] font-medium break-words text-center leading-snug",k?"text-red-700":"text-gray-600",y.labelClassName||c)},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:fo("field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center",!y.readonly&&"formula"!==y.type&&"__applicant__system"!==y._id&&(k?"bg-red-100/90":"bg-amber-50/80"))},React.createElement(Dx,{field:y,value:(f||dk)(n[y.name]??y.defaultValue??""),onChange:e=>r(y.name,e),isTableMode:!0,hasError:k,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,onFillFields:u,formValues:n,historyApproves:h,previewMode:m}),k&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},o[y.name]))))}))}function uk(e,t){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("__TODAY_AT__"===e){const e=new Date,n=String(t?.defaultHour??9).padStart(2,"0"),r=String(t?.defaultMinute??0).padStart(2,"0");return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${n}:${r}`}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("${")?String(Fx(e,{})):e}function dk(e){return null==e||"string"!=typeof e?e:e&&e.includes("${")?uk(e):e}function pk(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 fk=e.forwardRef(({fields:n,values:r,onChange:o,onSubmit:i,formName:s,formTitle:a,viewMode:l="form",readOnly:c=!1,formMode:u="editable",fieldPermissions:d,formEvents:p,showButtons:f=!0,searchUsersFn:h,searchOrgsFn:m,tableColumns:g=2,searchObjectFn:y,className:b,labelClassName:v,onUpdateField:w,compact:x=!1,showFormName:k=!0,currentUser:S,applicant:E,state:M="draft",submitDate:C,context:_,currentStep:N={},currentApprove:R={},instance:O={},historyApproves:T=[],previewMode:A=!1,formColumns:D=2,tableTitleColor:$,tableBorderColor:L="#000000",tableShowLeftBorder:j=!0,tableShowRightBorder:I=!0,noMaxWidth:z=!1,chineseFieldNames:P=!1},F)=>{const[B,H]=t.message.useMessage(),V=e.useCallback(e=>{const t=dk(e??"");return"__CURRENT_USER__"===t?S?.user||"":"__CURRENT_USER_ORG__"===t?S?.organization?._id||"":t},[S?.user,S?.organization?._id]),q=e.useMemo(()=>{const e=S?.organization;if(e?._id)return{id:e._id,name:e.name||"",fullname:e.fullname||""}},[S?.organization]),U=e.useMemo(()=>n.map(e=>{const t=e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:uk(e.defaultValue,e)}:e;if(t.children?.length){const e=t.children.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:uk(e.defaultValue,e)}:e);return{...t,children:e}}return t}),[n.map(e=>`${e.name}:${e.defaultValue??""}:${(e.children||[]).map(e=>`${e.name}:${e.defaultValue??""}`).join(",")}`).join("|")]),W=c||"readonly"===u||"print"===u,Y=W?"print"===u?"print":"readonly":u,J=e.useMemo(()=>U.map(e=>{if(W)return{...e,readonly:!0};if(!d)return e;const t=d[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t||["table","grid"].includes(e.type)&&!t&&e.children?.some(e=>d[e.name])?e:{...e,readonly:!0}}),[U,d,W]);console.log("FormRenderer externalValues",r);const K=E||S?.user,G=e.useMemo(()=>{const e={_id:"__applicant__system",name:"__applicant",label:"提交人",type:"member",required:!1,readonly:"draft"!==M,hidden:!1,colspan:12,pickerMultiple:!1,defaultValue:K,valueFormat:"string"};return J.some(e=>"__applicant"===e.name)?J.map(e=>"__applicant"===e.name?{...e,_id:"__applicant__system",type:"member",readonly:"draft"!==M,defaultValue:E||e.defaultValue||S?.user,valueFormat:"string"}:e):[...J,e]},[J,S,M,K,E]),[Z,Q]=e.useState(()=>{const e={};for(const r of n){if(r.defaultValue){const t=uk(r.defaultValue,r);"__CURRENT_USER__"===t?S?.user&&(e[r.name]=S.user):"__CURRENT_USER_ORG__"===t?S?.organization?._id&&(e[r.name]={id:S.organization._id,name:S.organization.name||"",fullname:S.organization.fullname||""}):e[r.name]=t}if(r.children?.length)for(const t of r.children)if(t.defaultValue){const n=uk(t.defaultValue,t);"__CURRENT_USER__"===n?S?.user&&(e[t.name]=S.user):"__CURRENT_USER_ORG__"===n?S?.organization?._id&&(e[t.name]={id:S.organization._id,name:S.organization.name||"",fullname:S.organization.fullname||""}):e[t.name]=n}}const t={...e,...r||{}};return E&&(t.__applicant=E),t}),[X,ee]=e.useState({}),[te,ne]=e.useState({}),re=e.useRef(Z);e.useEffect(()=>{re.current=Z},[Z]),e.useEffect(()=>{Q(e=>{const t={};for(const n of U){if(n.defaultValue&&null==e[n.name]){const e=n.defaultValue;"__CURRENT_USER__"===e?S?.user&&(t[n.name]=S.user):"__CURRENT_USER_ORG__"===e?q&&(t[n.name]=q):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?S?.user&&(t[r.name]=S.user):"__CURRENT_USER_ORG__"===e?q&&(t[r.name]=q):t[r.name]=e}}return Object.keys(t).length>0?{...e,...t}:e})},[U,S?.user,q]);const oe=e.useRef("");e.useEffect(()=>{if(!r)return;const e=JSON.stringify(r);e!==oe.current&&(oe.current=e,Q(e=>{const t={...e};let n=!1;for(const[o,i]of Object.entries(r)){const e=V(i);t[o]!==e&&(t[o]=e,n=!0)}return n?t:e}))},[r,V]),e.useEffect(()=>{E&&Q(e=>e.__applicant===E?e:{...e,__applicant:E})},[E]);const ie=e.useMemo(()=>{const e=String(N?.name??"");return{...Z,stepName:e}},[Z,N]),se=G.filter(e=>(!e.hidden||"__applicant__system"===e._id)&&(e.visibilityExpression?.trim()?pe(e.visibilityExpression,ie):!e.visibilityRules?.length||lk(e.visibilityRules,e.visibilityLogic,ie))),ae=se.filter((e,t)=>{if("section"!==e.type)return!0;if(e.description)return!0;for(let n=t+1;n<se.length;n++){const e=se[n];if("section"===e.type)break;if("__applicant__system"!==e._id)return!0}return!1}).map(e=>{let t=e;if(t.requiredExpression?.trim()){const e=pe(t.requiredExpression,ie);e!==t.required&&(t={...t,required:t.required||e})}else if(t.requiredRules?.length){const e=lk(t.requiredRules,t.requiredLogic,ie);e!==t.required&&(t={...t,required:t.required||e})}if(["table","grid"].includes(t.type)&&t.children?.length)if("table"===t.type){const n=t.children.filter(e=>!e.hidden&&(!d||"hidden"!==d[e.name])).map(e=>(d&&"editable"!==d[e.name]&&(e={...e,readonly:!0}),e));t=t===e?{...e,children:n}:{...t,children:n}}else{const n=t.children.filter(e=>!e.hidden&&((!d||"hidden"!==d[e.name])&&(e.visibilityExpression?.trim()?pe(e.visibilityExpression,ie):!e.visibilityRules?.length||lk(e.visibilityRules,e.visibilityLogic,ie)))).map(e=>{if(d&&"editable"!==d[e.name]&&(e={...e,readonly:!0}),e.requiredExpression?.trim()){const t=pe(e.requiredExpression,ie);return t!==e.required?{...e,required:e.required||t}:e}if(!e.requiredRules?.length)return e;const t=lk(e.requiredRules,e.requiredLogic,ie);return t!==e.required?{...e,required:e.required||t}:e});t=t===e?{...e,children:n}:{...t,children:n}}return t}),le=function(e,t=2){const n=[];let r=[],o=0;for(const i of e)if(!i.hidden)if(Rs(i)||Os(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}(ae,"table"===l?g:D),ce=[...G.filter(e=>"formula"===e.type&&e.formula),...G.filter(e=>"grid"===e.type&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...Z};for(const n of ce){const r=Fx(n.formula,Z,P);t[n.name]!==r&&(t[n.name]=r,e=!0)}e&&(Q(t),o?.(t))},[Z,ce.map(e=>e.name+":"+e.formula).join(",")]);const ue=e.useRef(!1);e.useEffect(()=>{if(ue.current)return;if(!p?.onInit)return;ue.current=!0;const e=Wn(re.current,(e,t)=>{Q(n=>{const r={...n,[e]:t};return o?.(r),r})},G,w,B,_,N,R,O);Yn(p.onInit,{form:e,fields:G,values:re.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[p?.onInit]);const de=e.useMemo(()=>{const e=[];for(const n of ae)"grid"===n.type&&n.children?.length?e.push(...n.children):e.push(n);const t=new Set(e.map(e=>e.name));for(const n of G)if(n.preserveValueWhenHidden&&!t.has(n.name))if("grid"===n.type&&n.children?.length)for(const r of n.children)t.has(r.name)||(e.push(r),t.add(r.name));else e.push(n),t.add(n.name);return e},[ae,G]),fe=e.useRef(async()=>!0);e.useImperativeHandle(F,()=>({getValues:()=>{const e={};return de.forEach(t=>{e[t.name]=Z[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={},n={},r=e=>{if(!e)return[];try{const t="string"==typeof e?JSON.parse(e):e;return Array.isArray(t)?t:[]}catch{return[]}};if(de.forEach(o=>{const i=Z[o.name]??o.defaultValue??"";if(o.required&&!o.readonly){let n=!1;if("table"===o.type){const e=r(i);n=0===e.length||1===e.length&&!Object.values(e[0]).some(e=>null!=e&&""!==e)}else n=0!==i&&!1!==i&&!i;if(n){const n=`${o.label} 不能为空`;return e.push(n),void(t[o.name]=n)}}if("number"===o.type&&""!==i&&null!=i){const n=Number(i);if(!isNaN(n))if(null!=o.min&&n<o.min){const n=`${o.label} 不能小于 ${o.min}`;e.push(n),t[o.name]=n}else if(null!=o.max&&n>o.max){const n=`${o.label} 不能大于 ${o.max}`;e.push(n),t[o.name]=n}}if(["text","textarea"].includes(o.type)&&"string"==typeof i&&""!==i)if(null!=o.minLength&&i.length<o.minLength){const n=`${o.label} 长度不能少于 ${o.minLength} 个字符`;e.push(n),t[o.name]=n}else if(null!=o.maxLength&&i.length>o.maxLength){const n=`${o.label} 长度不能超过 ${o.maxLength} 个字符`;e.push(n),t[o.name]=n}if("table"===o.type){const s=r(i),a=s.filter(e=>Object.values(e).some(e=>null!=e&&""!==e));if(null!=o.minRows&&a.length<o.minRows){const n=`${o.label} 至少需要填写 ${o.minRows} 行数据`;e.push(n),t[o.name]=n}else if(null!=o.maxRows&&s.length>o.maxRows){const n=`${o.label} 不能超过 ${o.maxRows} 行`;e.push(n),t[o.name]=n}if(o.children?.length){const t=s.map(e=>{const t={};for(const n of o.children){if(n.readonly||"formula"===n.type)continue;const r={...Z,...e};if(n.visibilityExpression?.trim()){if(!pe(n.visibilityExpression,r))continue}else if(n.visibilityRules?.length&&!lk(n.visibilityRules,n.visibilityLogic,r))continue;let o=!!n.required;!o&&n.requiredExpression?.trim()?o=pe(n.requiredExpression,r):!o&&n.requiredRules?.length&&(o=lk(n.requiredRules,n.requiredLogic,r));const i=e[n.name]??"";if(o&&0!==i&&!1!==i&&!i)t[n.name]=`${n.label} 不能为空`;else if("number"===n.type&&""!==i){const e=Number(i);isNaN(e)||(null!=n.min&&e<n.min?t[n.name]=`${n.label} 不能小于 ${n.min}`:null!=n.max&&e>n.max&&(t[n.name]=`${n.label} 不能大于 ${n.max}`))}else if(["text","textarea"].includes(n.type)&&""!==i){const e=String(i);null!=n.minLength&&e.length<n.minLength?t[n.name]=`${n.label} 长度不能少于 ${n.minLength} 个字符`:null!=n.maxLength&&e.length>n.maxLength&&(t[n.name]=`${n.label} 长度不能超过 ${n.maxLength} 个字符`)}}return t});t.some(e=>Object.keys(e).length>0)&&(n[o.name]=t,t.forEach((t,n)=>{Object.keys(t).length>0&&e.push(`${o.label} 第 ${n+1} 行:${Object.values(t).join("、")}`)}))}}}),ee(t),ne(n),e.length>0){B.error({content:1===e.length?e[0]:`表单校验未通过,请检查以下字段:${e.join(";")}`,duration:4});const n=de.find(e=>t[e.name]);n&&setTimeout(()=>{const e=document.querySelector(`[data-field-name="${n.name}"]`);e?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}},submit:async()=>await fe.current()}),[Z,de,ee,ne,B]);const he=e.useCallback((e,t)=>{ee(t=>{if(!t[e])return t;const n={...t};return delete n[e],n}),Q(n=>{const r={...n,[e]:t};return o?.(r),r})},[o]),me=e.useCallback((e,t)=>{const n=re.current[e]||"";if(he(e,t),p?.onValueChange){let r=G.find(t=>t.name===e);if(!r)for(const t of G)if(t.children){const n=t.children.find(t=>t.name===e);if(n){r=n;break}}const o={...re.current,[e]:t},i=Wn(o,he,G,w,B,_,N,R,O);Yn(p.onValueChange,{field:r?{name:r.name,label:r.label,type:r.type}:{name:e},value:t,oldValue:n,form:i,values:o,fields:G}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[p?.onValueChange,G,he,w,B,_,N,R,O]),ge=e.useCallback(async e=>{ee(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});const t={...e},n=[];for(const[r,o]of Object.entries(e)){if(!o||"string"!=typeof o)continue;const e=ik(G,r);e&&("org"===e.type?n.push(sk(o).then(e=>{e&&(t[r]=e)})):"member"===e.type&&n.push(ak(o).then(e=>{e&&(t[r]=e)})))}n.length>0&&await Promise.all(n),Q(e=>{const n={...e,...t};return o?.(n),n})},[o,G]),ye=e.useCallback(async()=>{if(p?.onSubmit){const t=Wn(re.current,he,G,w,B,_,N,R,O);try{if(!1===await Yn(p.onSubmit,{form:t,values:{...re.current},fields:G}))return!1}catch(e){return console.error("[FormRenderer] onSubmit error:",e),!1}}return i?.(re.current),!0},[p?.onSubmit,G,he,w,B,_,N,R,O,i]);if(fe.current=ye,0===G.length)return React.createElement("div",{className:`h-full flex items-center justify-center ${b||""}`},H,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===l){const e=ae.filter(e=>"__applicant__system"!==e._id),t=ae.find(e=>"__applicant__system"===e._id),n=t?X[t.name]:void 0;return React.createElement("div",{className:`p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===Y?"workflow-form-print":""} ${b||""}`},H,React.createElement("div",{className:"mx-auto"},k&&(a||s)&&React.createElement("div",{className:"mb-4 text-center"},a?React.createElement("div",{className:"text-xl font-bold",style:$?{color:$}:void 0,dangerouslySetInnerHTML:{__html:a}}):React.createElement("h2",{className:"text-xl font-bold",style:$?{color:$}:void 0},s)),React.createElement(ck,{fields:e,columns:g,formValues:Z,updateValue:me,fieldErrors:X,tableRowErrors:te,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,labelClassName:v,onFillFields:ge,fieldPermissions:d,formMode:Y,resolveValue:V,historyApproves:T,previewMode:A,tableBorderColor:L,tableShowLeftBorder:j,tableShowRightBorder:I,chineseFieldNames:P}),t&&!t.hidden&&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 [&_input]:!pl-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Dx,{field:t,value:V(Z[t.name]??t.defaultValue??""),onChange:e=>me(t.name,e),hasError:!!n,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,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"!==M&&C&&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"},pk(C))))))}return React.createElement("div",{className:`h-full overflow-y-auto custom-scrollbar ${x?"bg-white":"bg-gray-50/50"} ${"print"===Y?"workflow-form-print":""} ${b||""}`},H,React.createElement("div",{className:x?"px-3 py-3":`p-6${z?"":" max-w-3xl"} mx-auto`},k&&(a||s)&&React.createElement("div",{className:x?"mb-3 text-center":"mb-6 text-center"},a?React.createElement("div",{className:x?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800",dangerouslySetInnerHTML:{__html:a}}):React.createElement("h2",{className:x?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},s)),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(${D}, minmax(0, 1fr))`}},le.map((e,t)=>{const n=e[0];if("section"===n.type){const e=ok(n);return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement("h3",{className:(x?"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:x?"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)?ok(n):null;return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},!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||"#1f2937"}},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||"#6b7280"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Gx,{field:n,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,value:Z[n.name],onChange:e=>me(n.name,e),fieldPermissions:d,rowErrors:te[n.name],parentFormValues:Z,chineseFieldNames:P}))}if("grid"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?ok(n):null;return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},!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||"#1f2937"}},n.label)),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#6b7280"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(Qx,{field:n,formValues:Z,onUpdateValue:me,onFillFields:ge,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,fieldPermissions:d,formMode:Y,compact:x,chineseFieldNames:P}))}return e.map(e=>{const t=Rs(e)||Os(e.type),n=!1!==e.showLabel&&"checkbox"!==e.type,r=X[e.name],o="__applicant__system"===e._id,i=t||o;return o&&e.hidden?React.createElement("div",{key:e._id,"data-field-name":e.name,style:{display:"none"}},React.createElement(Dx,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,formValues:Z})):React.createElement("div",{key:e._id,"data-field-name":e.name,className:x?"":"relative",style:x?void 0:i?{gridColumn:`span ${D}`}:void 0},o&&x?React.createElement(React.Fragment,null,React.createElement("div",{className:"flex items-center gap-2"},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 [&_input]:!pl-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Dx,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,minimal:!0}))),"draft"!==M&&C&&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 whitespace-nowrap"},pk(C)))),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)):o?React.createElement("div",{className:"flex items-center gap-2"},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 [&_input]:!pl-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Dx,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,minimal:!0}))),"draft"!==M&&C&&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"},pk(C))),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"} ${x?"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 "+(x?"mb-1":"mb-1.5")},e.description),React.createElement(Dx,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A}),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)))})})),f&&"editable"===Y&&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:ye,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`},"提交")))))}),hk={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 mk(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(f),e.extend(g),e.extend(v),e.locale(hk,null,!0),e.locale("zh-cn")),u.extend(f),u.extend(g),u.extend(v),u.locale("zh-cn")}(),function(){try{const e=10,t=[];for(let r=localStorage.length-1;r>=0;r--){const e=localStorage.key(r);if(e&&(e.startsWith("/app/")||e.startsWith("/api/"))){const n=localStorage.getItem(e);t.push({key:e,size:n?n.length:0})}}if(t.length<=e)return;t.sort((e,t)=>t.key.length-e.key.length);const n=t.slice(e);for(const{key:r}of n)localStorage.removeItem(r);n.length>0&&console.log(`[workflow-form-v2] Cleaned up ${n.length} stale amis localStorage entries`)}catch{}}(),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,currentApprove:u,instance:d,applicant:p}=n,f=t.ScopedContext,h=e.useContext(f),m=e.useRef(null),g={getValues:()=>mk(m.current?.getValues()||w,b),validate:async()=>{const e=await(m.current?m.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid},submit:async()=>!m.current||await m.current.submit()},y=e.useRef(null);null===y.current?y.current={...g}:Object.assign(y.current,g),Object.defineProperty(y.current,"props",{get:()=>n,configurable:!0}),e.useEffect(()=>{if(h&&(r.id||n.id))return h.registerComponent(y.current),()=>{h.unRegisterComponent(y.current)}},[r.id||n.id]);let b=[];Array.isArray(r.fields)?b=r.fields:"string"==typeof r.fields&&o&&(b=o[r.fields.replace(/^\$\{|\}$/g,"")]||[]),!b.length&&Array.isArray(o?.fields)&&(b=o.fields);let v={};r.values&&"object"==typeof r.values?v=r.values:"string"==typeof r.values&&o&&(v=o[r.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(v).length&&o?.values&&"object"==typeof o.values&&(v=o.values);const w=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?"":"number"==typeof r||"boolean"==typeof r?r:String(r);return t}(v),[JSON.stringify(v)]),[x,k]=e.useState(!1);e.useEffect(()=>{const e=()=>{k(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const S=x?"form":r.viewMode||"form",E=x?1:r.tableColumns||2,M=r.layout??r.formColumns,_=x||"single"===M?1:"double"===M?2:Math.min(Math.max(Number(M)||2,1),3),N=r.readOnly??r.static??!1,R=r.formMode||"editable",O=r.formName||o?.formName||"",T=r.formTitle||o?.formTitle||"",A=r.showButtons??!0,D=!!x||(r.compact??!1),$=r.showFormName??!0,L=r.formEvents,j=r.tableTitleColor||void 0,I=r.tableBorderColor||"#000000",z=!1!==r.tableShowOuterBorder,P=r.chineseFieldNames??!1,F=p||r.applicant||o?.applicant||void 0;let B,H=[];Array.isArray(r.historyApproves)?H=r.historyApproves:"string"==typeof r.historyApproves&&o&&(H=o[r.historyApproves.replace(/^\$\{|\}$/g,"")]||[]),Array.isArray(H)&&0!==H.length||!Array.isArray(o?.historyApproves)||(H=o.historyApproves),"editable"===R&&(r.fieldPermissions&&"object"==typeof r.fieldPermissions?B=r.fieldPermissions:"string"==typeof r.fieldPermissions&&o&&(B=o[r.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!B&&o?.fieldPermissions&&(B=o.fieldPermissions));const V=r.apiBaseUrl||o?.context?.rootUrl||o?.rootUrl||"",q=r.authToken||o?.context?.authToken||o?.authToken||"",U=r.spaceId||o?.context?.spaceId||o?.spaceId||"",W=e.useCallback(async e=>{if(e=e?.trim()||"",!V)return[];try{const t=`${V}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),Y=e.useCallback(async e=>{if(e=e?.trim()||"",!V)return[];try{const t=`${V}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),J=e.useCallback((e,t)=>async n=>{if(n=n?.trim()||"",!V||!e)return[];try{const r=n?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(n)}')`:"",o=`${V}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${r}`,i=await fetch(o,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),K={props:n,getValues:g.getValues,validate:g.validate,submit:g.submit};return e.createElement(fk,{fields:b,values:w,ref:m,onChange:e=>{const t=mk(e,b);i?.("change",t?C(o,{value:t}):o,K)},onSubmit:e=>{const t=mk(e,b);i?.("submit",t?C(o,{value:t}):o,K)},formName:O,formTitle:T||void 0,viewMode:S,tableColumns:E,formColumns:_,readOnly:N,formMode:R,fieldPermissions:B,formEvents:L,showButtons:A,compact:D,showFormName:$,searchUsersFn:W,searchOrgsFn:Y,searchObjectFn:J,currentUser:s,applicant:F,state:a,submitDate:l,currentStep:c||r.currentStep||{},currentApprove:u||r.currentApprove||{},instance:d||r.instance||{},historyApproves:Array.isArray(H)?H:[],tableTitleColor:j,tableBorderColor:I,tableShowLeftBorder:z,tableShowRightBorder:z,noMaxWidth:!0,chineseFieldNames:P,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"));
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",f="date",p="Invalid Date",h=/^(\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:f,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(h);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)},h=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 f:return h(b+"Hours",0);case s:return h(b+"Minutes",1);case i:return h(b+"Seconds",2);case o:return h(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[f]=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],h=l===a?this.$D+(t-this.$W):t;if(l===c||l===d){var m=this.clone().set(f,1);m.$d[p](h),m.init(),this.$d=m.set(f,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](h);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 f,p=this;r=Number(r);var h=M.p(u),m=function(e){var t=E(p);return M.w(t.date(t.date()+Math.round(e*r)),p)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===a)return m(1);if(h===l)return m(7);var g=(f={},f[i]=t,f[s]=n,f[o]=e,f)[h]||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)},f=function(e){return M.s(i%12||12,e,"0")},h=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 f(1);case"hh":return f(2);case"a":return h(i,s,!0);case"A":return h(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,f,p){var h,m=this,g=M.p(f),y=E(r),b=(y.utcOffset()-this.utcOffset())*t,v=this-y,w=function(){return M.m(m,y)};switch(g){case d:h=w()/12;break;case c:h=w();break;case u:h=w()/3;break;case l:h=(v-b)/6048e5;break;case a:h=(v-b)/864e5;break;case s:h=v/n;break;case i:h=v/t;break;case o:h=v/e;break;default:h=v}return p?h:M.a(h)},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}(),N=C.prototype;return E.prototype=N,[["$ms",r],["$s",o],["$m",i],["$H",s],["$W",a],["$M",c],["$y",d],["$D",f]].forEach(function(e){N[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,f={exports:{}};const p=s((d||(d=1,f.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")}}),f.exports));var h,m={exports:{}};const g=s((h||(h=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},f={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=f[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,f=o.zone,h=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 f?new Date(Date.UTC(y,b,g,w,x,k,S+60*f.offset*1e3)):n?new Date(Date.UTC(y,b,g,w,x,k,S)):(v=new Date(y,b,g,w,x,k,S),h&&(v=r(v).week(h).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 f=a.length,h=1;h<=f;h+=1){i[1]=a[h-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}h===f&&(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}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,f=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",a]],p="[object Arguments]",h="[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]",N="[object Set]",R="[object String]",_="[object Symbol]",O="[object WeakMap]",T="[object ArrayBuffer]",A="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",L="[object Int8Array]",j="[object Int16Array]",I="[object Int32Array]",z="[object Uint8Array]",P="[object Uint8ClampedArray]",F="[object Uint16Array]",B="[object Uint32Array]",H=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,Y=RegExp(U.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,fe=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^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",Ne="\\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",Re="['’]",_e="["+xe+"]",Oe="["+Ne+"]",Te="["+ke+"]",Ae="\\d+",De="["+Se+"]",$e="["+Ee+"]",Le="[^"+xe+Ne+Ae+Se+Ee+Me+"]",je="\\ud83c[\\udffb-\\udfff]",Ie="[^"+xe+"]",ze="(?:\\ud83c[\\udde6-\\uddff]){2}",Pe="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Me+"]",Be="\\u200d",He="(?:"+$e+"|"+Le+")",Ve="(?:"+Fe+"|"+Le+")",qe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Te+"|"+je+")?",Ye="["+Ce+"]?",Je=Ye+We+"(?:"+Be+"(?:"+[Ie,ze,Pe].join("|")+")"+Ye+We+")*",Ke="(?:"+[De,ze,Pe].join("|")+")"+Je,Ge="(?:"+[Ie+Te+"?",Te,ze,Pe,_e].join("|")+")",Ze=RegExp(Re,"g"),Qe=RegExp(Te,"g"),Xe=RegExp(je+"(?="+je+")|"+Ge+Je,"g"),et=RegExp([Fe+"?"+$e+"+"+qe+"(?="+[Oe,Fe,"$"].join("|")+")",Ve+"+"+Ue+"(?="+[Oe,Fe+He,"$"].join("|")+")",Fe+"?"+He+"+"+qe,Fe+"+"+Ue,"\\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[j]=it[I]=it[z]=it[P]=it[F]=it[B]=!0,it[p]=it[h]=it[T]=it[m]=it[A]=it[g]=it[y]=it[b]=it[w]=it[x]=it[k]=it[C]=it[N]=it[R]=it[O]=!1;var st={};st[p]=st[h]=st[T]=st[A]=st[m]=st[g]=st[D]=st[$]=st[L]=st[j]=st[I]=st[w]=st[x]=st[k]=st[C]=st[N]=st[R]=st[_]=st[z]=st[P]=st[F]=st[B]=!0,st[y]=st[b]=st[O]=!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,ft=ut||dt||Function("return this")(),pt=E&&!E.nodeType&&E,ht=pt&&S&&!S.nodeType&&S,mt=ht&&ht.exports===pt,gt=mt&&ut.process,yt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||gt&&gt.binding&&gt.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 Nt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Rt(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 _t(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 Ot(e,t){return!(null==e||!e.length)&&Ft(e,t,0)>-1}function Tt(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 jt(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 It=qt("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 qt(t){return function(n){return null==n?e:n[t]}}function Ut(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,fn(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=Ut({"À":"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=Ut({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});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):It(e)}function dn(e){return on(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.split("")}(e)}function fn(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pn=Ut({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function i(S){var E,oe=(S=null==S?ft:hn.defaults(ft.Object(),S,hn.pick(ft,rt))).Array,xe=S.Date,ke=S.Error,Se=S.Function,Ee=S.Math,Me=S.Object,Ce=S.RegExp,Ne=S.String,Re=S.TypeError,_e=oe.prototype,Oe=Se.prototype,Te=Me.prototype,Ae=S["__core-js_shared__"],De=Oe.toString,$e=Te.hasOwnProperty,Le=0,je=(E=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||""))?"Symbol(src)_1."+E:"",Ie=Te.toString,ze=De.call(Me),Pe=ft._,Fe=Ce("^"+De.call($e).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=mt?S.Buffer:e,He=S.Symbol,Ve=S.Uint8Array,qe=Be?Be.allocUnsafe:e,Ue=an(Me.getPrototypeOf,Me),We=Me.create,Ye=Te.propertyIsEnumerable,Je=_e.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!==ft.clearTimeout&&S.clearTimeout,ut=xe&&xe.now!==ft.Date.now&&xe.now,dt=S.setTimeout!==ft.setTimeout&&S.setTimeout,pt=Ee.ceil,ht=Ee.floor,gt=Me.getOwnPropertySymbols,yt=Be?Be.isBuffer:e,It=S.isFinite,Ut=_e.join,mn=an(Me.keys,Me),gn=Ee.max,yn=Ee.min,bn=xe.now,vn=S.parseInt,wn=Ee.random,xn=_e.reverse,kn=ui(S,"DataView"),Sn=ui(S,"Map"),En=ui(S,"Promise"),Mn=ui(S,"Set"),Cn=ui(S,"WeakMap"),Nn=ui(Me,"create"),Rn=Cn&&new Cn,_n={},On=Pi(kn),Tn=Pi(Sn),An=Pi(En),Dn=Pi(Mn),$n=Pi(Cn),Ln=He?He.prototype:e,jn=Ln?Ln.valueOf:e,In=Ln?Ln.toString:e;function zn(e){if(na(e)&&!Us(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 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 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 Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Un;++t<n;)this.add(e[t])}function Yn(e){var t=this.__data__=new qn(e);this.size=t.size}function Jn(e,t){var n=Us(e),r=!n&&qs(e),o=!n&&!r&&Ks(e),i=!n&&!r&&!o&&ua(e),s=n||r||o||i,a=s?Jt(e.length,Ne):[],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(Ro(e),ir(t,0,e.length))}function Zn(e){return Di(Ro(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&&_o(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:Na(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=Us(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 Ro(t,a)}else{var f=pi(t),h=f==b||f==v;if(Ks(t))return ko(t,l);if(f==k||f==p||h&&!i){if(a=c||h?{}:mi(t),!l)return c?function(e,t){return _o(e,fi(e),t)}(t,function(e,t){return e&&_o(t,Da(t),e)}(a,t)):function(e,t){return _o(e,di(e),t)}(t,nr(a,t))}else{if(!st[f])return i?t:{};a=function(e,t,n){var r,o=e.constructor;switch(t){case T: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 j:case I:case z:case P:case F:case B:return Eo(e,n);case w:return new o;case x:case R:return new o(e);case C:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case N:return new o;case _:return r=e,jn?Me(jn.call(r)):{}}}(t,f,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 Re(t);return _i(function(){n.apply(e,o)},r)}function cr(e,t,n,r){var o=-1,i=Ot,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=At(t,Gt(n))),r?(i=Tt,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 f=c;f--;)if(t[f]===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__=Nn?Nn(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(Nn){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 Nn?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]=Nn&&r===e?n:r,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.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))},qn.prototype.get=function(t){var n=this.__data__,r=er(n,t);return r<0?e:n[r][1]},qn.prototype.has=function(e){return er(this.__data__,e)>-1},qn.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},Un.prototype.clear=function(){this.size=0,this.__data__={hash:new Vn,map:new(Sn||qn),string:new Vn}},Un.prototype.delete=function(e){var t=li(this,e).delete(e);return this.size-=t?1:0,t},Un.prototype.get=function(e){return li(this,e).get(e)},Un.prototype.has=function(e){return li(this,e).has(e)},Un.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 qn,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 qn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Un(r)}return n.set(e,t),this.size=n.size,this};var ur=Ao(br),dr=Ao(vr,!0);function fr(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 hr(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 _t(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 Us(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=Ie.call(t);return o&&(n?t[Xe]=r:delete t[Xe]),i}(t):function(e){return Ie.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 Nr(t,n,r){for(var o=r?Tt:Ot,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 f=-1,p=l[0];e:for(;++f<i&&u.length<c;){var h=d[f],m=n?n(h):h;if(h=r||0!==h?h: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(h)}}return u}function Rr(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 _r(e){return na(e)&&Sr(e)==p}function Or(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=Us(t),l=Us(n),c=a?h:pi(t),u=l?h:pi(n),d=(c=c==p?k:c)==k,f=(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 T: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 R:return e==t+"";case w:var a=sn;case N: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 _:if(jn)return jn.call(e)==jn.call(t)}return!1}(t,n,c,r,o,i,s);if(!(1&r)){var v=d&&$e.call(t,"__wrapped__"),S=f&&$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 f=c;f--;){var p=l[f];if(!(a?p in n:$e.call(n,p)))return!1}var h=s.get(t),m=s.get(n);if(h&&m)return h==n&&m==t;var g=!0;s.set(t,n),s.set(n,t);for(var y=a;++f<c;){var b=t[p=l[f]],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,Or,i))}function Tr(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 f=new Yn;if(o)var p=o(u,d,c,t,n,f);if(!(p===e?Or(d,u,3,o,f):p))return!1}}return!0}function Ar(e){return!(!ta(e)||(t=e,je&&je 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?Us(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 jr(e,t){return e<t}function Ir(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||Tr(n,e,t)}}function Pr(t,n){return vi(t)&&Si(n)?Ei(zi(t),n):function(r){var o=Na(r,t);return o===e&&o===n?Ra(r,t):Or(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=Ni(t,r),c=Ni(n,r),u=a.get(c);if(u)Qn(t,r,u);else{var d=s?s(l,c,r+"",t,n,a):e,f=d===e;if(f){var p=Us(c),h=!p&&Ks(c),m=!p&&!h&&ua(c);d=c,p||h||m?Us(l)?d=l:Js(l)?d=Ro(l):h?(f=!1,d=ko(c,!0)):m?(f=!1,d=Eo(c,!0)):d=[]:ia(c)||qs(c)?(d=l,qs(l)?d=ba(l):ta(l)&&!Qs(l)||(d=mi(c))):f=!1}f&&(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(Ni(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 Us(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}(Ir(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 qr(e,t,n,r){var o=r?Bt:Ft,i=-1,s=t.length,a=e;for(e===t&&(t=Ro(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 Ur(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+ht(wn()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>c)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return Oi(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=Rn?function(e,t){return Rn.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=ht((i+s)/2),f=r(t[d]),p=f!==e,h=null===f,m=f==f,g=ca(f);if(a)var y=o||m;else y=u?m&&(o||p):l?m&&p&&(o||!h):c?m&&p&&!h&&(o||!g):!h&&!g&&(o?f<=n:f<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(Us(e))return At(e,ao)+"";if(ca(e))return In?In.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function lo(e,t,n){var r=-1,o=Ot,i=e.length,s=!0,a=[],l=a;if(n)s=!1,o=Tt;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 f=l.length;f--;)if(l[f]===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 fo(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 ho(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 Us(e)?e:vi(e,t)?[e]:Ii(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 ft.clearTimeout(e)};function ko(e,t){if(t)return e.slice();var n=e.length,r=qe?qe(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 No(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),f=!r;++o<u;)d[o]=e[o];for(var p=o;++l<c;)d[p+l]=t[l];for(;++s<a;)(f||o<i)&&(d[p+n[s]]=e[o++]);return d}function Ro(e,t){var n=-1,r=e.length;for(t||(t=oe(r));++n<r;)t[n]=e[n];return t}function _o(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 Oo(e,t){return function(n,r){var o=Us(n)?Mt:tr,i=t?t():{};return o(n,e,ai(r,2),i)}}function To(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(qa(t).replace(Ze,"")),e,"")}}function jo(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 Io(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 Re(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&&Us(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 f=n&s,p=1&n,h=2&n,m=24&n,g=512&n,y=h?e:jo(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=No(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=h?E[t]:t;return b=v.length,c?v=function(t,n){for(var r=t.length,o=yn(n.length,r),i=Ro(t);o--;){var s=n[o];t[o]=yi(s,r)?i[s]:e}return t}(v,c):g&&b>1&&v.reverse(),f&&u<b&&(v.length=u),this&&this!==ft&&this instanceof s&&(M=y||jo(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 qo(t){return function(n,r,o){return o&&"number"!=typeof o&&bi(n,r,o)&&(r=o=e),n=ha(n),r===e?(r=n,n=0):r=ha(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:ha(o),t)}}function Uo(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 f=8&n;n|=f?o:64,4&(n&=~(f?64:o))||(n&=-4);var p=[t,n,s,f?a:e,f?l:e,f?e:a,f?e:l,c,u,d],h=r.apply(e,p);return wi(t)&&Ri(h,p),h.placeholder=i,Ti(h,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))&&It(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==N?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,f,p){var h=2&i;if(!h&&"function"!=typeof n)throw new Re(t);var m=c?c.length:0;if(m||(i&=-97,c=u=e),f=f===e?f:gn(ma(f),0),p=p===e?p:ma(p),m-=u?u.length:0,64&i){var g=c,y=u;c=u=e}var b=h?e:oi(n),v=[n,i,l,c,u,g,y,d,f,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?No(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?h?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=jo(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!==ft&&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=jo(e);return function t(){for(var s=-1,a=arguments.length,l=-1,c=r.length,u=oe(c+a),d=this&&this!==ft&&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=jo(e);return function t(){return(this&&this!==ft&&this instanceof t?o:e).apply(r?n:this,arguments)}}(n,i,l);return Ti((b?Qr:Ri)(w,v),n,i)}function Zo(t,n,r,o){return t===e||Bs(t,Te[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 f=-1,p=!0,h=2&r?new Wn:e;for(s.set(t,n),s.set(n,t);++f<l;){var m=t[f],g=n[f];if(o)var y=a?o(g,m,f,n,t,s):o(m,g,f,t,n,s);if(y!==e){if(y)continue;p=!1;break}if(h){if(!jt(n,function(e,t){if(!Qt(h,t)&&(m===e||i(m,e,r,o,s)))return h.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 Oi(Mi(t,e,Wi),t+"")}function ni(e){return kr(e,Aa,di)}function ri(e){return kr(e,Da,fi)}var oi=Rn?function(e){return Rn.get(e)}:cl;function ii(e){for(var t=e.name+"",n=_n[t],r=$e.call(_n,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),_t(gt(e),function(t){return Ye.call(e,t)}))}:gl,fi=gt?function(e){for(var t=[];e;)Dt(t,di(e)),e=Ue(e);return t}:gl,pi=Sr;function hi(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)&&(Us(e)||qs(e))}function mi(e){return"function"!=typeof e.constructor||ki(e)?{}:Pn(Ue(e))}function gi(e){return Us(e)||qs(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(Us(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)!=N||Cn&&pi(new Cn)!=O)&&(pi=function(t){var n=Sr(t),r=n==k?t.constructor:e,o=r?Pi(r):"";if(o)switch(o){case On:return A;case Tn:return w;case An:return M;case Dn:return N;case $n:return O}return n});var xi=Ae?Qs:yl;function ki(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Te)}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 Ni(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ri=Ai(Qr),_i=dt||function(e,t){return ft.setTimeout(e,t)},Oi=Ai(Xr);function Ti(e,t,n){var r=t+"";return Oi(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(f,function(n){var r="_."+n[0];t&n[1]&&!Ot(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,ji,Ii=($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===ji.size&&ji.clear(),e}),ji=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__=Ro(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 qi(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 Ui(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]?Nr(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]?Nr(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]?Nr(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?qr(e,t):e}var es=ti(function(e,t){var n=null==e?0:e.length,r=or(e,t);return Ur(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=_t(e,function(e){if(Js(e))return t=gn(e.length,t),!0}),Jt(t,function(t){return At(e,qt(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 ho(_t(e,Js))}),cs=Jr(function(t){var n=Zi(t);return Js(n)&&(n=e),ho(_t(t,Js),ai(n,2))}),us=Jr(function(t){var n=Zi(t);return n="function"==typeof n?n:e,ho(_t(t,Js),e,n)}),ds=Jr(is),fs=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 hs(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:hs,args:[i],thisArg:e}),new Bn(o,this.__chain__).thru(function(t){return n&&!t.length&&t.push(e),t})):this.thru(i)}),gs=Oo(function(e,t,n){$e.call(e,n)?++e[n]:rr(e,n,1)}),ys=Io(qi),bs=Io(Ui);function vs(e,t){return(Us(e)?Ct:ur)(e,ai(t,3))}function ws(e,t){return(Us(e)?Nt:dr)(e,ai(t,3))}var xs=Oo(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):Rr(e,t,n)}),i}),Ss=Oo(function(e,t,n){rr(e,n,t)});function Es(e,t){return(Us(e)?At:Ir)(e,ai(t,3))}var Ms=Oo(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),[])}),Ns=ut||function(){return ft.Date.now()};function Rs(t,n,r){return n=r?e:n,n=t&&null==n?t.length:n,Go(t,s,e,e,e,e,n)}function _s(n,r){var o;if("function"!=typeof r)throw new Re(t);return n=ma(n),function(){return--n>0&&(o=r.apply(this,arguments)),n<=1&&(r=e),o}}var Os=Jr(function(e,t,n){var r=1;if(n.length){var i=ln(n,si(Os));r|=o}return Go(e,r,t,n,i)}),Ts=Jr(function(e,t,n){var r=3;if(n.length){var i=ln(n,si(Ts));r|=o}return Go(t,r,e,n,i)});function As(n,r,o){var i,s,a,l,c,u,d=0,f=!1,p=!1,h=!0;if("function"!=typeof n)throw new Re(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=Ns();if(g(e))return b(e);c=_i(y,function(e){var t=r-(e-u);return p?yn(t,a-(e-d)):t}(e))}function b(t){return c=e,h&&i?m(t):(i=s=e,l)}function v(){var t=Ns(),n=g(t);if(i=arguments,s=this,u=t,n){if(c===e)return function(e){return d=e,c=_i(y,r),f?m(e):l}(u);if(p)return xo(c),c=_i(y,r),m(u)}return c===e&&(c=_i(y,r)),l}return r=ya(r)||0,ta(o)&&(f=!!o.leading,a=(p="maxWait"in o)?gn(ya(o.maxWait)||0,r):a,h="trailing"in o?!!o.trailing:h),v.cancel=function(){c!==e&&xo(c),d=0,i=u=s=c=e},v.flush=function(){return c===e?l:b(Ns())},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 Re(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||Un),r}function js(e){if("function"!=typeof e)throw new Re(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=Un;var Is=vo(function(e,t){var n=(t=1==t.length&&Us(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=Uo(Er),Vs=Uo(function(e,t){return e>=t}),qs=_r(function(){return arguments}())?_r:function(e){return na(e)&&$e.call(e,"callee")&&!Ye.call(e,"callee")},Us=oe.isArray,Ws=bt?Gt(bt):function(e){return na(e)&&Sr(e)==T};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=Ue(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)==N};function la(e){return"string"==typeof e||!Us(e)&&na(e)&&Sr(e)==R}function ca(e){return"symbol"==typeof e||na(e)&&Sr(e)==_}var ua=St?Gt(St):function(e){return na(e)&&ea(e.length)&&!!it[Sr(e)]},da=Uo(jr),fa=Uo(function(e,t){return e<=t});function pa(e){if(!e)return[];if(Ys(e))return la(e)?dn(e):Ro(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==N?cn:Ba)(e)}function ha(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=ha(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=he.test(e);return n||ge.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?u:+e}function ba(e){return _o(e,Da(e))}function va(e){return null==e?"":ao(e)}var wa=To(function(e,t){if(ki(t)||Ys(t))_o(t,Aa(t),e);else for(var n in t)$e.call(t,n)&&Xn(e,n,t[n])}),xa=To(function(e,t){_o(t,Da(t),e)}),ka=To(function(e,t,n,r){_o(t,Da(t),e,r)}),Sa=To(function(e,t,n,r){_o(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,Te[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 Na(t,n,r){var o=null==t?e:xr(t,n);return o===e?r:o}function Ra(e,t){return null!=e&&hi(e,t,Cr)}var _a=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),e[t]=n},tl(ol)),Oa=Fo(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ie.call(t)),$e.call(e,t)?e[t].push(n):e[t]=[n]},ai),Ta=Jr(Rr);function Aa(e){return Ys(e)?Jn(e):$r(e)}function Da(e){return Ys(e)?Jn(e,!0):Lr(e)}var $a=To(function(e,t,n){Fr(e,t,n)}),La=To(function(e,t,n,r){Fr(e,t,n,r)}),ja=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}),_o(e,ri(e),n),r&&(n=sr(n,7,Xo));for(var o=t.length;o--;)co(n,t[o]);return n}),Ia=ti(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Ra(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 qa(e){return(e=va(e))&&e.replace(be,tn).replace(Qe,"")}var Ua=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,Os(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 Rr(n,e,t)}}),al=Jr(function(e,t){return function(n){return Rr(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__=Ro(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(Rt),fl=Ho(jt);function pl(e){return vi(e)?qt(zi(e)):function(e){return function(t){return xr(t,e)}}(e)}var hl=qo(),ml=qo(!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 Re(t);return e=ma(e),function(){if(--e<1)return n.apply(this,arguments)}},zn.ary=Rs,zn.assign=wa,zn.assignIn=xa,zn.assignInWith=ka,zn.assignWith=Sa,zn.at=Ea,zn.before=_s,zn.bind=Os,zn.bindAll=el,zn.bindKey=Ts,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Us(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(Us(n)?Ro(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 Re(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?fo(e,ai(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?fo(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(Us(e)?_t:hr)(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=_a,zn.invertBy=Oa,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=js,zn.nthArg=function(e){return e=ma(e),Jr(function(t){return Br(t,e)})},zn.omit=ja,zn.omitBy=function(e,t){return za(e,js(ai(t)))},zn.once=function(e){return _s(2,e)},zn.orderBy=function(t,n,r,o){return null==t?[]:(Us(n)||(n=null==n?[]:[n]),Us(r=o?e:r)||(r=null==r?[]:[r]),Hr(t,n,r))},zn.over=ul,zn.overArgs=Is,zn.overEvery=dl,zn.overSome=fl,zn.partial=zs,zn.partialRight=Ps,zn.partition=Ms,zn.pick=Ia,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?qr(e,t,ai(n,2)):e},zn.pullAllWith=function(t,n,r){return t&&t.length&&n&&n.length?qr(t,n,e,r):t},zn.pullAt=es,zn.range=hl,zn.rangeRight=ml,zn.rearg=Fs,zn.reject=function(e,t){return(Us(e)?_t:hr)(e,js(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 Ur(e,o),n},zn.rest=function(n,r){if("function"!=typeof n)throw new Re(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),(Us(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(Us(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 Re(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?fo(e,ai(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?fo(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 Re(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=hs,zn.toArray=pa,zn.toPairs=Pa,zn.toPairsIn=Fa,zn.toPath=function(e){return Us(e)?At(e,zi):ca(e)?[e]:Ro(Ii(va(e)))},zn.toPlainObject=ba,zn.transform=function(e,t,n){var r=Us(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(Ue(e)):{}}return(o?Ct:br)(e,function(e,r,o){return t(n,e,r,o)}),n},zn.unary=function(e){return Rs(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=fs,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=qa,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=Us(t)?Rt:fr;return r&&bi(t,n,r)&&(n=e),o(t,ai(n,3))},zn.find=ys,zn.findIndex=qi,zn.findKey=function(e,t){return zt(e,ai(t,3),br)},zn.findLast=bs,zn.findLastIndex=Ui,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=Na,zn.gt=Hs,zn.gte=Vs,zn.has=function(e,t){return null!=e&&hi(e,t,Mr)},zn.hasIn=Ra,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=ha(n),r===e?(r=n,n=0):r=ha(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(t=ya(t),n,r)},zn.invoke=Ta,zn.isArguments=qs,zn.isArray=Us,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)&&(Us(e)||"string"==typeof e||"function"==typeof e.splice||Ks(e)||ua(e)||qs(e)))return!e.length;var t=pi(e);if(t==w||t==N)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 Or(e,t)},zn.isEqualWith=function(t,n,r){var o=(r="function"==typeof r?r:e)?r(t,n):e;return o===e?Or(t,n,e,r):!!o},zn.isError=Zs,zn.isFinite=function(e){return"number"==typeof e&&It(e)},zn.isFunction=Qs,zn.isInteger=Xs,zn.isLength=ea,zn.isMap=ra,zn.isMatch=function(e,t){return e===t||Tr(e,t,ci(t))},zn.isMatchWith=function(t,n,r){return r="function"==typeof r?r:e,Tr(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)==O},zn.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":Ut.call(e,t)},zn.kebabCase=Ua,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=fa,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,jr):e},zn.minBy=function(t,n){return t&&t.length?pr(t,ai(n,2),jr):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 ft._===this&&(ft._=Pe),this},zn.noop=cl,zn.now=Ns,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(ht(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=ha(t),n===e?(n=t,t=0):n=ha(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=Us(e)?$t:Wt,o=arguments.length<3;return r(e,ai(t,4),n,o,ur)},zn.reduceRight=function(e,t,n){var r=Us(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(Us(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==N?e.size:$r(e).length},zn.snakeCase=Ja,zn.some=function(t,n,r){var o=Us(t)?jt: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,f="__p += '",p=Ce((n.escape||ve).source+"|"+d.source+"|"+(d===Z?de:ve).source+"|"+(n.evaluate||ve).source+"|$","g"),h="//# 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),f+=t.slice(u,l).replace(we,rn),n&&(i=!0,f+="' +\n__e("+n+") +\n'"),a&&(s=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=l+e.length,e}),f+="';\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 f="with (obj) {\n"+f+"\n}\n";f=(s?f.replace(H,""):f).replace(V,"$1").replace(q,"$1;"),f="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")+f+"return __p\n}";var g=Xa(function(){return Se(l,h+"return "+f).apply(e,c)});if(g.source=f,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=ha,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,fn(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(fe.exec(i))+"g")),i.lastIndex=0;u=i.exec(d);)var f=u.index;c=c.slice(0,f===e?l:f)}}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(U,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 Rr(n,e,t)})}),Hn.prototype.reject=function(e){return this.filter(js(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||Us(n),d=function(e){var t=i.apply(zn,Dt([e],a));return o&&f?t[0]:t};u&&r&&"function"==typeof c&&1!=c.length&&(l=u=!1);var f=this.__chain__,p=!!this.__actions__.length,h=s&&!f,m=l&&!p;if(!s&&u){n=m?n:new Hn(this);var g=t.apply(n,a);return g.__actions__.push({func:hs,args:[d],thisArg:e}),new Bn(g,f)}return h&&m?t.apply(this,a):(g=this.thru(d),h?o?g.value()[0]:g.value():g)})}),Ct(["pop","push","shift","sort","splice","unshift"],function(e){var t=_e[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(Us(o)?o:[],e)}return this[n](function(n){return t.apply(Us(n)?n:[],e)})}}),br(Hn.prototype,function(e,t){var n=zn[t];if(n){var r=n.name+"";$e.call(_n,r)||(_n[r]=[]),_n[r].push({name:t,func:n})}}),_n[Po(e,2).name]=[{name:"wrapper",func:e}],Hn.prototype.clone=function(){var e=new Hn(this.__wrapped__);return e.__actions__=Ro(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ro(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ro(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=Us(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,f=0,p=yn(l,this.__takeCount__);if(!n||!r&&o==l&&p==l)return po(e,this.__actions__);var h=[];e:for(;l--&&f<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}}h[f++]=g}return h},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:hs,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}();ht?((ht.exports=hn)._=hn,pt._=hn):ft._=hn}.call(M.exports));const N=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),R=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 _={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},T=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,..._,width:n,height:n,stroke:t,strokeWidth:o?24*Number(r)/Number(n):r,className:N("lucide",i),...!s&&!O(l)&&{"aria-hidden":"true"},...l},[...a.map(([t,n])=>e.createElement(t,n)),...Array.isArray(s)?s:[s]])),A=(t,n)=>{const r=e.forwardRef(({className:r,...o},i)=>{return e.createElement(T,{ref:i,iconNode:n,className:N(`lucide-${s=R(t),s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${t}`,r),...o});var s});return r.displayName=R(t),r},D=A("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"}]]),$=A("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),L=A("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"}]]),j=A("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"}]]),I=A("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"}]]),z=A("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"}]]),P=A("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"}]]),F=A("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"}]]),B=A("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"}]]),H=A("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"}]]),V=A("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"}]]),q=A("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"}]]),U=A("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"}]]),W=A("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"}]]),Y=A("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),J=A("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"}]]),K=A("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"}]]),G=A("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"}]]),Z=A("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),Q=A("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),X=A("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),ee=A("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"}]]),te=A("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),ne=A("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"}]]),re=A("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"}]]),oe=A("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ie(e,t){if(!e)return null;const n=e.trim();if("form"===function(e){const t=e.trim();return t.startsWith("${")&&t.endsWith("}")?"form":"flow"}(n)){const e=n.startsWith("${")&&n.endsWith("}")?n.slice(2,-1).trim():n;if(!e)return null;try{return e.includes("{")?se(e):ue(e)}catch{return null}}if(!n.includes("{"))return null;try{return se(n)}catch{return null}}function se(e){const t=ae(e);if(t.startsWith("!")){const e=se(t.slice(1).trim());return e?(e.negate=!e.negate,e):null}for(const r of["||","&&"]){const e=le(t,r);if(e.length>1){const t="&&"===r?"and":"or",n=[];for(const r of e){const e=r.trim(),t=se(e);if(t&&t.children.length>1)n.push(t);else if(t&&t.negate)n.push(t);else{const t=ce(ae(e));if(!t)return null;n.push(t)}}return{type:"group",logic:t,children:n}}}const n=ce(t);return n?{type:"group",logic:"and",children:[n]}:null}function ae(e){const t=e.trim();if(t.startsWith("(")&&t.endsWith(")")){let e=0;for(let n=0;n<t.length;n++)if("("===t[n]?e++:")"===t[n]&&e--,0===e&&n<t.length-1)return t;return ae(t.slice(1,-1).trim())}return t}function le(e,t){const n=[];let r=0,o=0;for(let i=0;i<=e.length-t.length;i++)"("===e[i]?r++:")"===e[i]?r--:0===r&&e.substring(i,i+t.length)===t&&(n.push(e.substring(o,i)),o=i+t.length,i+=t.length-1);return n.push(e.substring(o)),n.filter(e=>e.trim())}function ce(e){const t=e.trim().match(/^\{([^}]+)\}\s*(==|!=|>=|<=|>|<|contains)\s*(.+)$/);return t?{type:"rule",field:t[1].trim(),operator:t[2],value:t[3].trim().replace(/^["']|["']$/g,"")}:null}function ue(e){const t=ae(e);if(t.startsWith("!")){const e=ue(t.slice(1).trim());return e?(e.negate=!e.negate,e):null}for(const r of["||","&&"]){const e=le(t,r);if(e.length>1){const t="&&"===r?"and":"or",n=[];for(const r of e){const e=r.trim(),t=ue(e);if(t&&t.children.length>1)n.push(t);else if(t&&t.negate)n.push(t);else{const t=de(ae(e));if(!t)return null;n.push(t)}}return{type:"group",logic:t,children:n}}}const n=de(t);return n?{type:"group",logic:"and",children:[n]}:null}function de(e){const t=e.trim().match(/^(\S+)\s+(==|!=|>=|<=|>|<|contains)\s+(.+)$/);return t?{type:"rule",field:t[1].trim(),operator:t[2],value:t[3].trim().replace(/^["']|["']$/g,"")}:null}function fe(e,t){if(!e)return!1;const n=ie(e);return!!n&&pe(n,t)}function pe(e,t){const n=e.children.map(e=>"rule"===e.type?function(e,t){if(!e.field)return!1;const n=t[e.field],r=String(n??""),o=e.value??"";switch(e.operator){case"==":return r===o;case"!=":return r!==o;case">":return parseFloat(r)>parseFloat(o);case">=":return parseFloat(r)>=parseFloat(o);case"<":return parseFloat(r)<parseFloat(o);case"<=":return parseFloat(r)<=parseFloat(o);case"contains":return r.includes(o);default:return!1}}(e,t):pe(e,t)),r="or"===e.logic?n.some(Boolean):n.every(Boolean);return e.negate?!r:r}function he(e,t){return function(){return e.apply(t,arguments)}}const{toString:me}=Object.prototype,{getPrototypeOf:ge}=Object,{iterator:ye,toStringTag:be}=Symbol,ve=(e=>t=>{const n=me.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),we=e=>(e=e.toLowerCase(),t=>ve(t)===e),xe=e=>t=>typeof t===e,{isArray:ke}=Array,Se=xe("undefined");function Ee(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&Ne(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Me=we("ArrayBuffer");const Ce=xe("string"),Ne=xe("function"),Re=xe("number"),_e=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==ve(e))return!1;const t=ge(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||be in e||ye in e)},Te=we("Date"),Ae=we("File"),De=we("Blob"),$e=we("FileList");const Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},je=void 0!==Le.FormData?Le.FormData:void 0,Ie=we("URLSearchParams"),[ze,Pe,Fe,Be]=["ReadableStream","Request","Response","Headers"].map(we);function He(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),ke(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(Ee(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 Ve(e,t){if(Ee(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 qe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ue=e=>!Se(e)&&e!==qe;const We=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&ge(Uint8Array)),Ye=we("HTMLFormElement"),Je=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ke=we("RegExp"),Ge=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};He(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ze=we("AsyncFunction"),Qe=(Xe="function"==typeof setImmediate,et=Ne(qe.postMessage),Xe?setImmediate:et?(tt=`axios@${Math.random()}`,nt=[],qe.addEventListener("message",({source:e,data:t})=>{e===qe&&t===tt&&nt.length&&nt.shift()()},!1),e=>{nt.push(e),qe.postMessage(tt,"*")}):e=>setTimeout(e));var Xe,et,tt,nt;const rt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(qe):"undefined"!=typeof process&&process.nextTick||Qe,ot={isArray:ke,isArrayBuffer:Me,isBuffer:Ee,isFormData:e=>{let t;return e&&(je&&e instanceof je||Ne(e.append)&&("formdata"===(t=ve(e))||"object"===t&&Ne(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Me(e.buffer),t},isString:Ce,isNumber:Re,isBoolean:e=>!0===e||!1===e,isObject:_e,isPlainObject:Oe,isEmptyObject:e=>{if(!_e(e)||Ee(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:ze,isRequest:Pe,isResponse:Fe,isHeaders:Be,isUndefined:Se,isDate:Te,isFile:Ae,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:De,isRegExp:Ke,isFunction:Ne,isStream:e=>_e(e)&&Ne(e.pipe),isURLSearchParams:Ie,isTypedArray:We,isFileList:$e,forEach:He,merge:function e(){const{caseless:t,skipUndefined:n}=Ue(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const s=t&&Ve(r,i)||i;Oe(r[s])&&Oe(o)?r[s]=e(r[s],o):Oe(o)?r[s]=e({},o):ke(o)?r[s]=o.slice():n&&Se(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&He(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(He(t,(t,r)=>{n&&Ne(t)?Object.defineProperty(e,r,{value:he(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&&ge(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:ve,kindOfTest:we,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(ke(e))return e;let t=e.length;if(!Re(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[ye]).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:Ye,hasOwnProperty:Je,hasOwnProp:Je,reduceDescriptors:Ge,freezeMethods:e=>{Ge(e,(t,n)=>{if(Ne(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ne(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 ke(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:Ve,global:qe,isContextDefined:Ue,isSpecCompliantForm:function(e){return!!(e&&Ne(e.append)&&"FormData"===e[be]&&e[ye])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(_e(e)){if(t.indexOf(e)>=0)return;if(Ee(e))return e;if(!("toJSON"in e)){t[r]=e;const o=ke(e)?[]:{};return He(e,(e,t)=>{const i=n(e,r+1);!Se(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Ze,isThenable:e=>e&&(_e(e)||Ne(e))&&Ne(e.then)&&Ne(e.catch),setImmediate:Qe,asap:rt,isIterable:e=>null!=e&&Ne(e[ye])};let it=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,null!=t.status&&null==a.status&&(a.status=t.status),s&&Object.assign(a,s),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),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:ot.toJSONObject(this.config),code:this.code,status:this.status}}};it.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",it.ERR_BAD_OPTION="ERR_BAD_OPTION",it.ECONNABORTED="ECONNABORTED",it.ETIMEDOUT="ETIMEDOUT",it.ERR_NETWORK="ERR_NETWORK",it.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",it.ERR_DEPRECATED="ERR_DEPRECATED",it.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",it.ERR_BAD_REQUEST="ERR_BAD_REQUEST",it.ERR_CANCELED="ERR_CANCELED",it.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",it.ERR_INVALID_URL="ERR_INVALID_URL";function st(e){return ot.isPlainObject(e)||ot.isArray(e)}function at(e){return ot.endsWith(e,"[]")?e.slice(0,-2):e}function lt(e,t,n){return e?e.concat(t).map(function(e,t){return e=at(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ct=ot.toFlatObject(ot,{},null,function(e){return/^is[A-Z]/.test(e)});function ut(e,t,n){if(!ot.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=ot.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!ot.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ot.isSpecCompliantForm(t);if(!ot.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(ot.isDate(e))return e.toISOString();if(ot.isBoolean(e))return e.toString();if(!a&&ot.isBlob(e))throw new it("Blob is not supported. Use a Buffer instead.");return ot.isArrayBuffer(e)||ot.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){let a=e;if(ot.isReactNative(t)&&ot.isReactNativeBlob(e))return t.append(lt(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(ot.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(ot.isArray(e)&&function(e){return ot.isArray(e)&&!e.some(st)}(e)||(ot.isFileList(e)||ot.endsWith(n,"[]"))&&(a=ot.toArray(e)))return n=at(n),a.forEach(function(e,r){!ot.isUndefined(e)&&null!==e&&t.append(!0===s?lt([n],r,i):null===s?n:n+"[]",l(e))}),!1;return!!st(e)||(t.append(lt(o,n,i),l(e)),!1)}const u=[],d=Object.assign(ct,{defaultVisitor:c,convertValue:l,isVisitable:st});if(!ot.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!ot.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),ot.forEach(n,function(n,i){!0===(!(ot.isUndefined(n)||null===n)&&o.call(t,n,ot.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t}function dt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ft(e,t){this._pairs=[],e&&ut(e,this,t)}const pt=ft.prototype;function ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mt(e,t,n){if(!t)return e;const r=n&&n.encode||ht,o=ot.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let s;if(s=i?i(t,o):ot.isURLSearchParams(t)?t.toString():new ft(t,o).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}pt.append=function(e,t){this._pairs.push([e,t])},pt.toString=function(e){const t=e?function(t){return e.call(this,t,dt)}:dt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class gt{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){ot.forEach(this.handlers,function(t){null!==t&&e(t)})}}const yt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},bt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ft,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},vt="undefined"!=typeof window&&"undefined"!=typeof document,wt="object"==typeof navigator&&navigator||void 0,xt=vt&&(!wt||["ReactNative","NativeScript","NS"].indexOf(wt.product)<0),kt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,St=vt&&window.location.href||"http://localhost",Et={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:vt,hasStandardBrowserEnv:xt,hasStandardBrowserWebWorkerEnv:kt,navigator:wt,origin:St},Symbol.toStringTag,{value:"Module"})),...bt};function Mt(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&&ot.isArray(r)?r.length:i,a)return ot.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&ot.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&ot.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(ot.isFormData(e)&&ot.isFunction(e.entries)){const n={};return ot.forEachEntry(e,(e,r)=>{t(function(e){return ot.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Ct={transitional:yt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=ot.isObject(e);o&&ot.isHTMLForm(e)&&(e=new FormData(e));if(ot.isFormData(e))return r?JSON.stringify(Mt(e)):e;if(ot.isArrayBuffer(e)||ot.isBuffer(e)||ot.isStream(e)||ot.isFile(e)||ot.isBlob(e)||ot.isReadableStream(e))return e;if(ot.isArrayBufferView(e))return e.buffer;if(ot.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 ut(e,new Et.classes.URLSearchParams,{visitor:function(e,t,n,r){return Et.isNode&&ot.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=ot.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ut(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(ot.isString(e))try{return(t||JSON.parse)(e),ot.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ct.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(ot.isResponse(e)||ot.isReadableStream(e))return e;if(e&&ot.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 it.from(o,it.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:Et.classes.FormData,Blob:Et.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ot.forEach(["delete","get","head","post","put","patch"],e=>{Ct.headers[e]={}});const Nt=ot.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"]),Rt=Symbol("internals");function _t(e){return e&&String(e).trim().toLowerCase()}function Ot(e){return!1===e||null==e?e:ot.isArray(e)?e.map(Ot):String(e)}function Tt(e,t,n,r,o){return ot.isFunction(r)?r.call(this,t,n):(o&&(t=n),ot.isString(t)?ot.isString(r)?-1!==t.indexOf(r):ot.isRegExp(r)?r.test(t):void 0:void 0)}let At=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=_t(t);if(!o)throw new Error("header name must be a non-empty string");const i=ot.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Ot(e))}const i=(e,t)=>ot.forEach(e,(e,n)=>o(e,n,t));if(ot.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ot.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]&&Nt[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(ot.isObject(e)&&ot.isIterable(e)){let n,r,o={};for(const t of e){if(!ot.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?ot.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=_t(e)){const n=ot.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(ot.isFunction(t))return t.call(this,e,n);if(ot.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_t(e)){const n=ot.findKey(this,e);return!(!n||void 0===this[n]||t&&!Tt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=_t(e)){const o=ot.findKey(n,e);!o||t&&!Tt(0,n[o],o,t)||(delete n[o],r=!0)}}return ot.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&&!Tt(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return ot.forEach(this,(r,o)=>{const i=ot.findKey(n,o);if(i)return t[i]=Ot(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]=Ot(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ot.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&ot.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[Rt]=this[Rt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=_t(e);t[r]||(!function(e,t){const n=ot.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 ot.isArray(e)?e.forEach(r):r(e),this}};function Dt(e,t){const n=this||Ct,r=t||n,o=At.from(r.headers);let i=r.data;return ot.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function $t(e){return!(!e||!e.__CANCEL__)}At.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ot.reduceDescriptors(At.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),ot.freezeMethods(At);let Lt=class extends it{constructor(e,t,n){super(null==e?"canceled":e,it.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function jt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new it("Request failed with status code "+n.status,[it.ERR_BAD_REQUEST,it.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const It=(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 f=c&&l-c;return f?Math.round(1e3*d/f):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)},zt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Pt=e=>(...t)=>ot.asap(()=>e(...t)),Ft=Et.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Et.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Et.origin),Et.navigator&&/(msie|trident)/i.test(Et.navigator.userAgent)):()=>!0,Bt=Et.hasStandardBrowserEnv?{write(e,t,n,r,o,i,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ot.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),ot.isString(r)&&a.push(`path=${r}`),ot.isString(o)&&a.push(`domain=${o}`),!0===i&&a.push("secure"),ot.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 Ht(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 Vt=e=>e instanceof At?{...e}:e;function qt(e,t){t=t||{};const n={};function r(e,t,n,r){return ot.isPlainObject(e)&&ot.isPlainObject(t)?ot.merge.call({caseless:r},e,t):ot.isPlainObject(t)?ot.merge({},t):ot.isArray(t)?t.slice():t}function o(e,t,n,o){return ot.isUndefined(t)?ot.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!ot.isUndefined(t))return r(void 0,t)}function s(e,t){return ot.isUndefined(t)?ot.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(Vt(e),Vt(t),0,!0)};return ot.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=ot.hasOwnProp(l,r)?l[r]:o,s=i(e[r],t[r],r);ot.isUndefined(s)&&i!==a||(n[r]=s)}),n}const Ut=e=>{const t=qt({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=At.from(s),t.url=mt(Ht(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),ot.isFormData(n))if(Et.hasStandardBrowserEnv||Et.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ot.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(Et.hasStandardBrowserEnv&&(r&&ot.isFunction(r)&&(r=r(t)),r||!1!==r&&Ft(t.url))){const e=o&&i&&Bt.read(i);e&&s.set(o,e)}return t},Wt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ut(e);let o=r.data;const i=At.from(r.headers).normalize();let s,a,l,c,u,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){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=At.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());jt(function(e){t(e),h()},function(e){n(e),h()},{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 it("Request aborted",it.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new it(r,it.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||yt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new it(t,o.clarifyTimeoutError?it.ETIMEDOUT:it.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&ot.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),ot.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([l,u]=It(p,!0),m.addEventListener("progress",l)),f&&m.upload&&([a,c]=It(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",c)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new Lt(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===Et.protocols.indexOf(y)?n(new it("Unsupported protocol "+y+":",it.ERR_BAD_REQUEST,e)):m.send(o||null)})},Yt=(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 it?t:new Lt(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new it(`timeout of ${t}ms exceeded`,it.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=()=>ot.asap(s),a}},Jt=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},Kt=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()}},Gt=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Kt(e))yield*Jt(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:Zt}=ot,Qt=(({Request:e,Response:t})=>({Request:e,Response:t}))(ot.global),{ReadableStream:Xt,TextEncoder:en}=ot.global,tn=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},nn=e=>{e=ot.merge.call({skipUndefined:!0},Qt,e);const{fetch:t,Request:n,Response:r}=e,o=t?Zt(t):"function"==typeof fetch,i=Zt(n),s=Zt(r);if(!o)return!1;const a=o&&Zt(Xt),l=o&&("function"==typeof en?(e=>t=>e.encode(t))(new en):async e=>new Uint8Array(await new n(e).arrayBuffer())),c=i&&a&&tn(()=>{let e=!1;const t=new n(Et.origin,{body:new Xt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),u=s&&a&&tn(()=>ot.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 it(`Response type '${e}' is not supported`,it.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=ot.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(ot.isBlob(e))return e.size;if(ot.isSpecCompliantForm(e)){const t=new n(Et.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ot.isArrayBufferView(e)||ot.isArrayBuffer(e)?e.byteLength:(ot.isURLSearchParams(e)&&(e+=""),ot.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:h,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:v="same-origin",fetchOptions:w}=Ut(e),x=t||fetch;y=y?(y+"").toLowerCase():"text";let k=Yt([l,p&&p.toAbortSignal()],h),S=null;const E=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let M;try{if(g&&c&&"get"!==s&&"head"!==s&&0!==(M=await f(b,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(ot.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=zt(M,It(Pt(g)));a=Gt(t.body,65536,e,n)}}ot.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 h=u&&("stream"===y||"response"===y);if(u&&(m||h&&E)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=ot.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&zt(t,It(Pt(m),!0))||[];p=new r(Gt(p.body,65536,n,()=>{o&&o(),E&&E()}),e)}y=y||"text";let C=await d[ot.findKey(d,y)||"text"](p,e);return!h&&E&&E(),await new Promise((t,n)=>{jt(t,n,{data:C,headers:At.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 it("Network Error",it.ERR_NETWORK,e,S,C&&C.response),{cause:C.cause||C});throw it.from(C,C&&C.code,e,S,C&&C.response)}}},rn=new Map,on=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=rn;for(;l--;)s=i[l],a=c.get(s),void 0===a&&c.set(s,a=l?new Map:nn(t)),c=a;return a};on();const sn={http:null,xhr:Wt,fetch:{get:on}};ot.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const an=e=>`- ${e}`,ln=e=>ot.isFunction(e)||null===e||!1===e;const cn={getAdapter:function(e,t){e=ot.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,!ln(r)&&(o=sn[(n=String(r)).toLowerCase()],void 0===o))throw new it(`Unknown adapter '${n}'`);if(o&&(ot.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(an).join("\n"):" "+an(e[0]):"as no adapter specified";throw new it("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:sn};function un(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lt(null,e)}function dn(e){un(e),e.headers=At.from(e.headers),e.data=Dt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return cn.getAdapter(e.adapter||Ct.adapter,e)(e).then(function(t){return un(e),t.data=Dt.call(e,e.transformResponse,t),t.headers=At.from(t.headers),t},function(t){return $t(t)||(un(e),t&&t.response&&(t.response.data=Dt.call(e,e.transformResponse,t.response),t.response.headers=At.from(t.response.headers))),Promise.reject(t)})}const fn="1.13.6",pn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const hn={};pn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+fn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new it(r(o," has been removed"+(t?" in "+t:"")),it.ERR_DEPRECATED);return t&&!hn[o]&&(hn[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)}},pn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const mn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new it("options must be an object",it.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 it("option "+i+" must be "+n,it.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new it("Unknown option "+i,it.ERR_BAD_OPTION)}},validators:pn},gn=mn.validators;let yn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new gt,response:new gt}}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=qt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&mn.assertOptions(n,{silentJSONParsing:gn.transitional(gn.boolean),forcedJSONParsing:gn.transitional(gn.boolean),clarifyTimeoutError:gn.transitional(gn.boolean),legacyInterceptorReqResOrdering:gn.transitional(gn.boolean)},!1),null!=r&&(ot.isFunction(r)?t.paramsSerializer={serialize:r}:mn.assertOptions(r,{encode:gn.function,serialize:gn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),mn.assertOptions(t,{baseUrl:gn.spelling("baseURL"),withXsrfToken:gn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&ot.merge(o.common,o[t.method]);o&&ot.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=At.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||yt;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=[dn.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 f=t;for(;d<u;){const e=s[d++],t=s[d++];try{f=e(f)}catch(p){t.call(this,p);break}}try{c=dn.call(this,f)}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 mt(Ht((e=qt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ot.forEach(["delete","get","head","options"],function(e){yn.prototype[e]=function(t,n){return this.request(qt(n||{},{method:e,url:t,data:(n||{}).data}))}}),ot.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(qt(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}yn.prototype[e]=t(),yn.prototype[e+"Form"]=t(!0)});const bn={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(bn).forEach(([e,t])=>{bn[t]=e});const vn=function e(t){const n=new yn(t),r=he(yn.prototype.request,n);return ot.extend(r,yn.prototype,n,{allOwnKeys:!0}),ot.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(qt(t,n))},r}(Ct);vn.Axios=yn,vn.CanceledError=Lt,vn.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 Lt(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}}},vn.isCancel=$t,vn.VERSION=fn,vn.toFormData=ut,vn.AxiosError=it,vn.Cancel=vn.CanceledError,vn.all=function(e){return Promise.all(e)},vn.spread=function(e){return function(t){return e.apply(null,t)}},vn.isAxiosError=function(e){return ot.isObject(e)&&!0===e.isAxiosError},vn.mergeConfig=qt,vn.AxiosHeaders=At,vn.formToJSON=e=>Mt(ot.isHTMLForm(e)?new FormData(e):e),vn.getAdapter=cn.getAdapter,vn.HttpStatusCode=bn,vn.default=vn;const{Axios:wn,AxiosError:xn,CanceledError:kn,isCancel:Sn,CancelToken:En,VERSION:Mn,all:Cn,Cancel:Nn,isAxiosError:Rn,spread:_n,toFormData:On,AxiosHeaders:Tn,HttpStatusCode:An,formToJSON:Dn,getAdapter:$n,mergeConfig:Ln}=vn;const jn=vn.create({baseURL:"/api/v6",timeout:3e5});async function In(e,t){const n=await jn.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 zn(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 jn.post(`/files/${i}`,s,{headers:a,timeout:6e4})).data}function Pn(e,t,n="cfs.files.filerecord"){return`/api/v6/files/download/${n}/${e}/${encodeURIComponent(t||e)}`}jn.interceptors.request.use(e=>e);const Fn=new Map,Bn=new Map;function Hn(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 Vn(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function qn(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function Un(e){const t=new Date(e);return t.setSeconds(0,0),t.toISOString()}function Wn(e,t,n,r,o,i,s,a,l){const c=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=c(t),r=e[t];return"table"===n?.type?Hn(r):r??""},setFieldValue(e,n){const r=function(e,t){if(null==t||""===t)return"";const n=e?.type;if("date"===n){if(t instanceof Date)return isNaN(t.getTime())?"":Vn(t);if("string"==typeof t){const e=t.toLowerCase();if("today"===e||"__today__"===e)return Vn(new Date);if(t.includes("T")&&t.length>10){const e=new Date(t);if(!isNaN(e.getTime()))return Vn(e)}}if("number"==typeof t){const e=new Date(t);if(!isNaN(e.getTime()))return Vn(e)}}if("datetime"===n){if(t instanceof Date)return isNaN(t.getTime())?"":Un(t);if("string"==typeof t){const e=t.toLowerCase();if("now"===e||"__now__"===e)return Un(new Date);if("today"===e||"__today__"===e){const e=new Date;return e.setHours(0,0,0,0),e.toISOString()}if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const e=new Date(t+"T00:00:00");if(!isNaN(e.getTime()))return e.toISOString()}if(t.includes("T")&&t.length>10){const e=new Date(t);if(!isNaN(e.getTime()))return Un(e)}}if("number"==typeof t){const e=new Date(t);if(!isNaN(e.getTime()))return Un(e)}}if("time"===n){if(t instanceof Date)return isNaN(t.getTime())?"":qn(t);if("string"==typeof t){const e=t.toLowerCase();if("now"===e||"__current_time__"===e)return qn(new Date)}}return t}(c(e),n);!r||"object"!=typeof r||r instanceof Date?t(e,null==r?"":String(r)):t(e,r)},setFieldVisible(e,t){const n=c(e);n&&r&&r(n._id,{hidden:!t})},setFieldHidden(e,t){const n=c(e);n&&r&&r(n._id,{hidden:t})},setFieldRequired(e,t){const n=c(e);n&&r&&r(n._id,{required:t})},setFieldReadonly(e,t){const n=c(e);n&&r&&r(n._id,{readonly:t})},getFieldOptions(e){const t=c(e);return t?.options||[]},setFieldOptions(e,t){const n=c(e);n&&r&&r(n._id,{options:t})},getTableRows:t=>Hn(e[t]),setTableRows(e,n){t(e,JSON.stringify(Array.isArray(n)?n:[]))},addTableRow(n,r={}){const o=Hn(e[n]);o.push(r),t(n,JSON.stringify(o))},removeTableRow(n,r){const o=Hn(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)},showError(e){o?.error(e)},showSuccess(e){o?.success(e)},showWarning(e){o?.warning(e)},context:i||{},currentStep:s||{},currentApprove:a||{},instance:l||{}}}async function Yn(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]=Hn(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=Hn(t.value));try{const o=new Function("form","field","value","oldValue","values","fields","fetch","currentStep","currentApprove","instance",`return (async () => { ${e} })();`);return await o(t.form,t.field,r,t.oldValue,n,t.fields,fetch.bind(window),t.form?.currentStep,t.form?.currentApprove,t.form?.instance)}catch(o){throw console.error("[fieldDataService] executeFormEvent error:",o),o}}function Jn(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=Jn(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const Kn=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Gn="-",Zn=[],Qn=e=>{const t=tr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return er(e);const n=e.split(Gn),r=""===n[0]&&n.length>1?1:0;return Xn(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||Zn}return n[e]||Zn}}},Xn=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=Xn(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(Gn):e.slice(t).join(Gn),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},er=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})(),tr=e=>{const{theme:t,classGroups:n}=e;return nr(n,t)},nr=(e,t)=>{const n=Kn();for(const r in e){const o=e[r];rr(o,n,r,t)}return n},rr=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];or(o,t,n,r)}},or=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?ar(e,t,n,r):sr(e,t,n,r):ir(e,t,n)},ir=(e,t,n)=>{(""===e?t:lr(t,e)).classGroupId=n},sr=(e,t,n,r)=>{cr(e)?rr(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},ar=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];rr(i,lr(t,e),n,r)}},lr=(e,t)=>{let n=e;const r=t.split(Gn),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=Kn(),n.nextPart.set(e,t)),n=t}return n},cr=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,ur=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)}}},dr=[],fr=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),pr=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 fr(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)):fr(dr,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},hr=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}},mr=/\s+/,gr=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=gr(e[r]))&&(n&&(n+=" "),n+=t);return n},yr=[],br=e=>{const t=t=>t[e]||yr;return t.isThemeGetter=!0,t},vr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wr=/^\((?:(\w[\w-]*):)?(.+)\)$/i,xr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sr=/\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$/,Er=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nr=e=>xr.test(e),Rr=e=>!!e&&!Number.isNaN(Number(e)),_r=e=>!!e&&Number.isInteger(Number(e)),Or=e=>e.endsWith("%")&&Rr(e.slice(0,-1)),Tr=e=>kr.test(e),Ar=()=>!0,Dr=e=>Sr.test(e)&&!Er.test(e),$r=()=>!1,Lr=e=>Mr.test(e),jr=e=>Cr.test(e),Ir=e=>!Pr(e)&&!Yr(e),zr=e=>to(e,io,$r),Pr=e=>vr.test(e),Fr=e=>to(e,so,Dr),Br=e=>to(e,ao,Rr),Hr=e=>to(e,co,Ar),Vr=e=>to(e,lo,$r),qr=e=>to(e,ro,$r),Ur=e=>to(e,oo,jr),Wr=e=>to(e,uo,Lr),Yr=e=>wr.test(e),Jr=e=>no(e,so),Kr=e=>no(e,lo),Gr=e=>no(e,ro),Zr=e=>no(e,io),Qr=e=>no(e,oo),Xr=e=>no(e,uo,!0),eo=e=>no(e,co,!0),to=(e,t,n)=>{const r=vr.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},no=(e,t,n=!1)=>{const r=wr.exec(e);return!!r&&(r[1]?t(r[1]):n)},ro=e=>"position"===e||"percentage"===e,oo=e=>"image"===e||"url"===e,io=e=>"length"===e||"size"===e||"bg-size"===e,so=e=>"length"===e,ao=e=>"number"===e,lo=e=>"family-name"===e,co=e=>"number"===e||"weight"===e,uo=e=>"shadow"===e,fo=((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(mr);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let h=!!p,m=r(h?f.substring(0,p):f);if(!m){if(!h){l=e+(l.length>0?" "+l:l);continue}if(m=r(f),!m){l=e+(l.length>0?" "+l:l);continue}h=!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,h);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:ur(e.cacheSize),parseClassName:pr(e),sortModifiers:hr(e),...Qn(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=gr(t))&&(o&&(o+=" "),o+=n);return o})(...e))})(()=>{const e=br("color"),t=br("font"),n=br("text"),r=br("font-weight"),o=br("tracking"),i=br("leading"),s=br("breakpoint"),a=br("container"),l=br("spacing"),c=br("radius"),u=br("shadow"),d=br("inset-shadow"),f=br("text-shadow"),p=br("drop-shadow"),h=br("blur"),m=br("perspective"),g=br("aspect"),y=br("ease"),b=br("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Yr,Pr],w=()=>[Yr,Pr,l],x=()=>[Nr,"full","auto",...w()],k=()=>[_r,"none","subgrid",Yr,Pr],S=()=>["auto",{span:["full",_r,Yr,Pr]},_r,Yr,Pr],E=()=>[_r,"auto",Yr,Pr],M=()=>["auto","min","max","fr",Yr,Pr],C=()=>["auto",...w()],N=()=>[Nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],R=()=>[Nr,"screen","full","dvw","lvw","svw","min","max","fit",...w()],_=()=>[Nr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],O=()=>[e,Yr,Pr],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Gr,qr,{position:[Yr,Pr]}],A=()=>["auto","cover","contain",Zr,zr,{size:[Yr,Pr]}],D=()=>[Or,Jr,Fr],$=()=>["","none","full",c,Yr,Pr],L=()=>["",Rr,Jr,Fr],j=()=>[Rr,Or,Gr,qr],I=()=>["","none",h,Yr,Pr],z=()=>["none",Rr,Yr,Pr],P=()=>["none",Rr,Yr,Pr],F=()=>[Rr,Yr,Pr],B=()=>[Nr,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tr],breakpoint:[Tr],color:[Ar],container:[Tr],"drop-shadow":[Tr],ease:["in","out","in-out"],font:[Ir],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tr],shadow:[Tr],spacing:["px",Rr],text:[Tr],"text-shadow":[Tr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nr,Pr,Yr,g]}],container:["container"],columns:[{columns:[Rr,Pr,Yr,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:[{"inset-s":x(),start:x()}],end:[{"inset-e":x(),end:x()}],"inset-bs":[{"inset-bs":x()}],"inset-be":[{"inset-be":x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[_r,"auto",Yr,Pr]}],basis:[{basis:[Nr,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rr,Nr,"auto","initial","none",Pr]}],grow:[{grow:["",Rr,Yr,Pr]}],shrink:[{shrink:["",Rr,Yr,Pr]}],order:[{order:[_r,"first","last","none",Yr,Pr]}],"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()}],pbs:[{pbs:w()}],pbe:[{pbe: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()}],mbs:[{mbs:C()}],mbe:[{mbe: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:N()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",..._()]}],"min-block-size":[{"min-block":["auto",..._()]}],"max-block-size":[{"max-block":["none",..._()]}],w:[{w:[a,"screen",...N()]}],"min-w":[{"min-w":[a,"screen","none",...N()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...N()]}],h:[{h:["screen","lh",...N()]}],"min-h":[{"min-h":["screen","lh","none",...N()]}],"max-h":[{"max-h":["screen","lh",...N()]}],"font-size":[{text:["base",n,Jr,Fr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,eo,Hr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Or,Pr]}],"font-family":[{font:[Kr,Vr,t]}],"font-features":[{"font-features":[Pr]}],"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,Yr,Pr]}],"line-clamp":[{"line-clamp":[Rr,"none",Yr,Br]}],leading:[{leading:[i,...w()]}],"list-image":[{"list-image":["none",Yr,Pr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Yr,Pr]}],"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:[Rr,"from-font","auto",Yr,Fr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Rr,"auto",Yr,Pr]}],"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",Yr,Pr]}],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",Yr,Pr]}],"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:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_r,Yr,Pr],radial:["",Yr,Pr],conic:[_r,Yr,Pr]},Qr,Ur]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:D()}],"gradient-via-pos":[{via:D()}],"gradient-to-pos":[{to:D()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":L()}],"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-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":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":[Rr,Yr,Pr]}],"outline-w":[{outline:["",Rr,Jr,Fr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,Xr,Wr]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",d,Xr,Wr]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Rr,Fr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",f,Xr,Wr]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Rr,Yr,Pr]}],"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":[Rr]}],"mask-image-linear-from-pos":[{"mask-linear-from":j()}],"mask-image-linear-to-pos":[{"mask-linear-to":j()}],"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":j()}],"mask-image-t-to-pos":[{"mask-t-to":j()}],"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":j()}],"mask-image-r-to-pos":[{"mask-r-to":j()}],"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":j()}],"mask-image-b-to-pos":[{"mask-b-to":j()}],"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":j()}],"mask-image-l-to-pos":[{"mask-l-to":j()}],"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":j()}],"mask-image-x-to-pos":[{"mask-x-to":j()}],"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":j()}],"mask-image-y-to-pos":[{"mask-y-to":j()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Yr,Pr]}],"mask-image-radial-from-pos":[{"mask-radial-from":j()}],"mask-image-radial-to-pos":[{"mask-radial-to":j()}],"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":[Rr]}],"mask-image-conic-from-pos":[{"mask-conic-from":j()}],"mask-image-conic-to-pos":[{"mask-conic-to":j()}],"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:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Yr,Pr]}],filter:[{filter:["","none",Yr,Pr]}],blur:[{blur:I()}],brightness:[{brightness:[Rr,Yr,Pr]}],contrast:[{contrast:[Rr,Yr,Pr]}],"drop-shadow":[{"drop-shadow":["","none",p,Xr,Wr]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Rr,Yr,Pr]}],"hue-rotate":[{"hue-rotate":[Rr,Yr,Pr]}],invert:[{invert:["",Rr,Yr,Pr]}],saturate:[{saturate:[Rr,Yr,Pr]}],sepia:[{sepia:["",Rr,Yr,Pr]}],"backdrop-filter":[{"backdrop-filter":["","none",Yr,Pr]}],"backdrop-blur":[{"backdrop-blur":I()}],"backdrop-brightness":[{"backdrop-brightness":[Rr,Yr,Pr]}],"backdrop-contrast":[{"backdrop-contrast":[Rr,Yr,Pr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rr,Yr,Pr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rr,Yr,Pr]}],"backdrop-invert":[{"backdrop-invert":["",Rr,Yr,Pr]}],"backdrop-opacity":[{"backdrop-opacity":[Rr,Yr,Pr]}],"backdrop-saturate":[{"backdrop-saturate":[Rr,Yr,Pr]}],"backdrop-sepia":[{"backdrop-sepia":["",Rr,Yr,Pr]}],"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",Yr,Pr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rr,"initial",Yr,Pr]}],ease:[{ease:["linear","initial",y,Yr,Pr]}],delay:[{delay:[Rr,Yr,Pr]}],animate:[{animate:["none",b,Yr,Pr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,Yr,Pr]}],"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:P()}],"scale-x":[{"scale-x":P()}],"scale-y":[{"scale-y":P()}],"scale-z":[{"scale-z":P()}],"scale-3d":["scale-3d"],skew:[{skew:F()}],"skew-x":[{"skew-x":F()}],"skew-y":[{"skew-y":F()}],transform:[{transform:[Yr,Pr,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:B()}],"translate-x":[{"translate-x":B()}],"translate-y":[{"translate-y":B()}],"translate-z":[{"translate-z":B()}],"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",Yr,Pr]}],"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-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":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-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":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",Yr,Pr]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Rr,Jr,Fr,Br]}],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","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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 po(...e){return fo(function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Jn(e))&&(r&&(r+=" "),r+=t);return r}(e))}var ho=e.createContext({});function mo(){return mo=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},mo.apply(null,arguments)}function go(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 yo(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 go(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)?go(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 bo(e){return(bo="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 vo(e){var t=function(e,t){if("object"!=bo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=bo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==bo(t)?t:t+""}function wo(e,t,n){return(t=vo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xo(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 ko,So={exports:{}};var Eo=(ko||(ko=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}()}(So)),So.exports);const Mo=s(Eo),Co=Math.round;function No(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 Ro=(e,t,n)=>0===n?e:e/100;function _o(e,t){const n=t||255;return e>n?n:e<0?0:e}class Oo{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(wo(this,"isValid",!0),wo(this,"r",0),wo(this,"g",0),wo(this,"b",0),wo(this,"a",1),wo(this,"_h",void 0),wo(this,"_s",void 0),wo(this,"_l",void 0),wo(this,"_v",void 0),wo(this,"_max",void 0),wo(this,"_min",void 0),wo(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 Oo)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=_o(e.r),this.g=_o(e.g),this.b=_o(e.b),this.a="number"==typeof e.a?_o(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:Co(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:Co(o("r")),g:Co(o("g")),b:Co(o("b")),a:Co(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=>Co((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=Co(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=Co(100*this.getSaturation()),n=Co(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]=_o(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=Co(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=Co(255*(o+u)),this.g=Co(255*(i+u)),this.b=Co(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=Co(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=Co(n*(1-t)*255),c=Co(n*(1-t*a)*255),u=Co(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=No(e,Ro);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=No(e,Ro);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=No(e,(e,t)=>t.includes("%")?Co(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var To=[{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 Ao(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 Do(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 $o(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 Lo=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function jo(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 Io(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jo(Object(n),!0).forEach(function(t){wo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Lo.primary=Lo[5];var zo="data-rc-order",Po="data-rc-priority",Fo=new Map;function Bo(){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 Ho(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function Vo(e){return Array.from((Fo.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function qo(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(zo,s),a&&i&&l.setAttribute(Po,"".concat(i)),null!=n&&n.nonce&&(l.nonce=null==n?void 0:n.nonce),l.innerHTML=e;var c=Ho(t),u=c.firstChild;if(r){if(a){var d=(t.styles||Vo(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(zo)))return!1;var t=Number(e.getAttribute(Po)||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 Uo(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=Ho(n),o=Vo(r),i=Io(Io({},n),{},{styles:o});!function(e,t){var n=Fo.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=qo("",t),o=r.parentNode;Fo.set(e,o),e.removeChild(r)}}(r,i);var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ho(t);return(t.styles||Vo(n)).find(function(n){return n.getAttribute(Bo(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=qo(e,i);return u.setAttribute(Bo(i),t),u}function Wo(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function Yo(e){return function(e){return Wo(e)instanceof ShadowRoot}(e)?Wo(e):null}var Jo={};function Ko(e,t){}function Go(e,t){}function Zo(e,t,n){t||Jo[n]||(e(!1,n),Jo[n]=!0)}function Qo(e,t){Zo(Ko,e,t)}function Xo(e){return"object"===bo(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===bo(e.icon)||"function"==typeof e.icon)}function ei(){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 ti(t,n,r){return r?e.createElement(t.tag,Io(Io({key:n},ei(t.attrs)),r),(t.children||[]).map(function(e,r){return ti(e,"".concat(n,"-").concat(t.tag,"-").concat(r))})):e.createElement(t.tag,Io({key:n},ei(t.attrs)),(t.children||[]).map(function(e,r){return ti(e,"".concat(n,"-").concat(t.tag,"-").concat(r))}))}function ni(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Oo(e),o=r.toHsv(),i=5;i>0;i-=1){var s=new Oo({h:Ao(o,i,!0),s:Do(o,i,!0),v:$o(o,i,!0)});n.push(s)}n.push(r);for(var a=1;a<=4;a+=1){var l=new Oo({h:Ao(o,a),s:Do(o,a),v:$o(o,a)});n.push(l)}return"dark"===t.theme?To.map(function(e){var r=e.index,o=e.amount;return new Oo(t.backgroundColor||"#141414").mix(n[r],o).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function ri(e){return e?Array.isArray(e)?e:[e]:[]}Qo.preMessage=function(e){},Qo.resetWarned=function(){Jo={}},Qo.noteOnce=function(e,t){Zo(Go,e,t)};var oi=["icon","className","onClick","style","primaryColor","secondaryColor"],ii={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var si=function(t){var n,r,i,s,a,l,c,u,d=t.icon,f=t.className,p=t.onClick,h=t.style,m=t.primaryColor,g=t.secondaryColor,y=xo(t,oi),b=o.useRef(),v=ii;if(m&&(v={primaryColor:m,secondaryColor:g||ni(m)}),n=b,r=e.useContext(ho),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=Yo(n.current);Uo(l,"@ant-design-icons",{prepend:!a,csp:i,attachTo:e})},[]),c=Xo(d),u="icon should be icon definiton, but got ".concat(d),Qo(c,"[@ant-design/icons] ".concat(u)),!Xo(d))return null;var w=d;return w&&"function"==typeof w.icon&&(w=Io(Io({},w),{},{icon:w.icon(v.primaryColor,v.secondaryColor)})),ti(w.icon,"svg-".concat(w.name),Io(Io({className:f,onClick:p,style:h,"data-icon":w.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},y),{},{ref:b}))};function ai(e){var t=yo(ri(e),2),n=t[0],r=t[1];return si.setTwoToneColors({primaryColor:n,secondaryColor:r})}si.displayName="IconReact",si.getTwoToneColors=function(){return Io({},ii)},si.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;ii.primaryColor=t,ii.secondaryColor=n||ni(t),ii.calculated=!!n};var li=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];ai(Lo.primary);var ci=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=xo(e,li),d=o.useContext(ho),f=d.prefixCls,p=void 0===f?"anticon":f,h=d.rootClassName,m=Mo(h,p,wo(wo({},"".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=yo(ri(c),2),v=b[0],w=b[1];return o.createElement("span",mo({role:"img","aria-label":r.name},u,{ref:t,tabIndex:g,onClick:l,className:m}),o.createElement(si,{icon:r,primaryColor:v,secondaryColor:w,style:y}))});ci.displayName="AntdIcon",ci.getTwoToneColor=function(){var e=si.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},ci.setTwoToneColor=ai;var ui,di={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"},fi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:di}))},pi=o.forwardRef(fi),hi={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"},mi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:hi}))},gi=o.forwardRef(mi),yi={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"},bi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:yi}))},vi=o.forwardRef(bi),wi={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"},xi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:wi}))},ki=o.forwardRef(xi),Si={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"},Ei=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Si}))},Mi=o.forwardRef(Ei),Ci={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"},Ni=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Ci}))},Ri=o.forwardRef(Ni),_i={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"},Oi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:_i}))},Ti=o.forwardRef(Oi),Ai={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"},Di=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Ai}))},$i=o.forwardRef(Di),Li={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"},ji=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Li}))},Ii=o.forwardRef(ji),zi={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"},Pi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:zi}))},Fi=o.forwardRef(Pi),Bi={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"},Hi=function(e,t){return o.createElement(ci,mo({},e,{ref:t,icon:Bi}))},Vi=o.forwardRef(Hi),qi={},Ui={exports:{}};function Wi(){return ui||(ui=1,function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}(Ui)),Ui.exports}var Yi,Ji={};var Ki,Gi={},Zi={},Qi={},Xi={exports:{}},es={exports:{}},ts={exports:{}},ns={exports:{}};function rs(){return Ki||(Ki=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}(ns)),ns.exports}var is,ss,as,ls,cs={exports:{}};function us(){return ss||(ss=1,function(e){var t=rs().default,n=(is||(is=1,function(e){var t=rs().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}(cs)),cs.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}(ts)),ts.exports}function ds(){return ls||(ls=1,function(e){var t=(as||(as=1,function(e){var t=us();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}(es)),es.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}(Xi)),Xi.exports}var fs,ps,hs={};function ms(){if(ps)return Qi;ps=1;var e=Wi().default;Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.default=void 0;var t=e(ds()),n=(fs||(fs=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.commonLocale=void 0,hs.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),hs),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 Qi.default=r,Qi}var gs,ys,bs,vs,ws,xs,ks={};function Ss(){if(gs)return ks;gs=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.default=void 0;return ks.default={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},ks}function Es(){if(ys)return Zi;ys=1;var e=Wi().default;Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.default=void 0;var t=e(ms()),n=e(Ss());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="确定",Zi.default=r,Zi}function Ms(){if(bs)return Gi;bs=1;var e=Wi().default;Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.default=void 0;var t=e(Es());return Gi.default=t.default,Gi}function Cs(){if(vs)return qi;vs=1;var e=Wi().default;Object.defineProperty(qi,"__esModule",{value:!0}),qi.default=void 0;var t=e((Yi||(Yi=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.default=void 0,Ji.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:"页码"}),Ji)),n=e(Ms()),r=e(Es()),o=e(Ss());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 qi.default=s,qi}function Ns(){return xs?ws:(xs=1,ws=Cs())}const Rs=s(Ns()),_s=e=>(e.colspan??6)>=12,Os=e=>"section"===e||"table"===e||"grid"===e;function Ts(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):Array.isArray(e)?e.map(e=>"string"==typeof e?e:String("object"==typeof e&&null!==e&&"_id"in e?e._id:e)).join(","):String("object"==typeof e&&"_id"in e?e._id:e)}function As(e,t){return 0===e.length?"":t?e.join(","):e[0]}function Ds(e){return"string"==typeof e?e:String(e&&"object"==typeof e&&"field"in e?e.field:e)}function $s({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,f=(t.lookupDisplayFields||["name"]).map(Ds),p=f[0]||"name",h=t.lookupSortField||"",m=t.lookupSortOrder||"asc",g=e.useMemo(()=>!d&&t.lookupFillRules||[],[d,t.lookupFillRules]),y=e.useMemo(()=>function(e,t){if(!e)return;function n(e){const n=e.indexOf(".");if(-1!==n){const r=e.slice(0,n),o=e.slice(n+1),i=t[r];if(!i)return{value:"",isArray:!1};try{const e="string"==typeof i?JSON.parse(i):i;if(!Array.isArray(e))return{value:"",isArray:!1};const t=e.map(e=>e[o]).filter(e=>null!=e&&""!==e);return{value:JSON.stringify(t),isArray:!0}}catch{return{value:"",isArray:!1}}}const r=t[e]??"";return Array.isArray(r)?{value:JSON.stringify(r),isArray:!0}:{value:String(r),isArray:!1}}let r=("string"==typeof e?e:JSON.stringify(e)).replace(/"\{([^{}]+)\}"/g,(e,t)=>{const r=n(t);return r.isArray?r.value:`"${r.value}"`});return r=r.replace(/\{([^{}]+)\}/g,(e,t)=>{const r=n(t);return r.isArray,r.value}),r}(t.lookupFilters,a||{}),[t.lookupFilters,a]),b=e.useMemo(()=>function(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>"object"==typeof e&&null!==e&&"_id"in e?e._id:String(e)).filter(Boolean);if("string"!=typeof e)return[String(e)];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]),v=e.useRef(y);e.useEffect(()=>{const e=v.current;if(v.current=y,i)return;if(void 0===e||e===y)return;if(0===b.length||!u)return;const t=JSON.stringify(["_id","in",b]),n=y?JSON.stringify([JSON.parse(t),"and",JSON.parse(y)]):t;In(u,{filters:n,fields:"_id",top:b.length}).then(({data:e})=>{const t=new Set(e.map(e=>e._id)),n=b.filter(e=>t.has(e));n.length!==b.length&&r(As(n,d))})},[y]);const[w,x]=e.useState(new Map);e.useEffect(()=>{if(!u||0===b.length)return;const e=b.filter(e=>!w.has(e));if(0===e.length)return;const t=JSON.stringify(["_id","in",e]);In(u,{filters:t,fields:`_id,${p}`,top:e.length}).then(({data:e})=>{x(t=>{const n=new Map(t);for(const r of e)n.set(r._id,r[p]||r._id);return n})})},[u,b.join(","),p]);const k=e.useCallback(e=>{const t=b.filter(t=>t!==e);r(As(t,d))},[b,r,d]),S=e.useCallback((e,t,n)=>{if(r(As(e,d)),x(e=>{const n=new Map(e);for(const[r,o]of t)n.set(r,o);return n}),c(!1),!d&&g.length>0&&1===e.length&&o){const t=e=>{const t={};for(const n of g)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(t[n.targetField]=Ts(e[n.sourceField]));Object.keys(t).length>0&&o(t)};if(n){const r=g.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(",");In(u,{filters:n,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}else{const n=g.map(e=>e.sourceField).filter(Boolean),r=JSON.stringify(["_id","=",e[0]]),o=["_id",...n].join(",");In(u,{filters:r,fields:o,top:1}).then(({data:e})=>{e.length>0&&t(e[0])})}}},[r,d,g,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]"},b.length>0&&React.createElement("div",{className:"flex flex-wrap gap-1.5"},b.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[13px] text-slate-700 rounded pr-2 py-0.5"},w.get(e)||e)))):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-amber-50/80 hover:border-indigo-300"))},b.length>0?React.createElement("div",{className:"flex flex-wrap gap-1.5 items-center"},b.map(e=>React.createElement("span",{key:e,className:"inline-flex items-center gap-1 text-[13px] 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"},w.get(e)||e),React.createElement(oe,{className:"w-3 h-3 text-indigo-300 hover:text-red-500 shrink-0 cursor-pointer",onClick:t=>{t.stopPropagation(),k(e)}})))):React.createElement("div",{className:"flex items-center gap-2 text-gray-400"},React.createElement(j,{className:"w-4 h-4 shrink-0"}),React.createElement("span",{className:"text-[13px]"},u?"选择数据":"请先配置关联对象"),React.createElement($,{className:"w-3.5 h-3.5 ml-auto shrink-0"}))),l&&React.createElement(Ls,{objectName:u,displayFields:f,multiple:d,selectedIds:b,filters:y,sortField:h,sortOrder:m,onConfirm:S,onClose:()=>c(!1)}))}function Ls({objectName:n,displayFields:r,multiple:o,selectedIds:i,filters:s,sortField:a,sortOrder:l,onConfirm:c,onClose:u}){const[d,f]=e.useState([]),[p,h]=e.useState(0),[m,g]=e.useState(!1),[y,b]=e.useState(1),[v,w]=e.useState(""),[x,k]=e.useState(new Set(i)),[S,E]=e.useState([]),M=e.useRef(void 0),C=r[0]||"name";e.useEffect(()=>{(async function(e){if(!e)return[];const t=Fn.get(e);if(t)return t;const n=Bn.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 Fn.set(e,i),i}catch{return[]}finally{Bn.delete(e)}})();return Bn.set(e,r),r})(n).then(E)},[n]);const N=e.useMemo(()=>{const e=new Map;for(const t of S)e.set(t.value,t.label);return e},[S]),R=e.useCallback(async(e,t)=>{g(!0);try{const o=[];let i;s&&o.push(s),t&&o.push(JSON.stringify([C,"contains",t])),2===o.length?i=JSON.stringify([JSON.parse(o[0]),"and",JSON.parse(o[1])]):1===o.length&&(i=o[0]);const c=["_id",...r].join(","),u=await In(n,{filters:i,fields:c,top:10,skip:10*(e-1),sort:`${a||C} ${l||"asc"}`});f(u.data),h(u.total)}finally{g(!1)}},[n,r,C,s,a,l]);e.useEffect(()=>{R(y,v)},[y]);const _=e.useCallback(e=>{w(e),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{b(1),R(1,e)},300)},[R]),O=e.useMemo(()=>r.map(e=>{const t="string"==typeof e?e:String(e&&"object"==typeof e&&"field"in e?e.field:e);return{title:N.get(t)||t,dataIndex:t,key:t,ellipsis:!0,render:e=>null!=e?String(e):"-"}}),[r,N]),T=e.useMemo(()=>({type:o?"checkbox":"radio",selectedRowKeys:[...x],onChange:e=>{if(k(new Set(e)),!o&&e.length>0){const t=e[0],n=d.find(e=>e._id===t),r=new Map;n&&r.set(t,n[C]||t),c([t],r,n)}}}),[o,x,d,C,c]);return React.createElement(t.ConfigProvider,{locale:Rs},React.createElement(t.Modal,{open:!0,title:React.createElement("div",{className:"flex items-center gap-2"},React.createElement(j,{className:"w-4 h-4 text-indigo-500"}),React.createElement("span",null,"选择数据")),width:Math.min(960,window.innerWidth-32),onCancel:u,onOk:o?()=>{const e=new Map;for(const t of d){const n=t._id;x.has(n)&&e.set(n,t[C]||n)}c([...x],e)}:void 0,okText:o?"确定"+(x.size>0?` (${x.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:`搜索 ${N.get(C)||C}...`,allowClear:!0,onChange:e=>_(e.target.value),style:{width:"100%"}})),React.createElement(t.Table,{rowKey:"_id",columns:O,dataSource:d,loading:m,rowSelection:T,pagination:{current:y,pageSize:10,total:p,size:"small",showSizeChanger:!1,showTotal:e=>`共 ${e} 条`,onChange:e=>b(e)},size:"small",scroll:{x:"max-content"},style:{fontSize:13},onRow:e=>({onClick:()=>{const t=e._id;if(o)k(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[C]||t),c([t],n,e)}},style:{cursor:"pointer"}})})))}const js=n=>{const{visible:r,multiple:o,loading:i,users:s,searchKeyword:a,searchInputValue:l,recentUsers:c=[],tempSelectedUsers:u,clearable:d,rootDeptInfo:f,deptPath:p,currentLevelDepts:h,showSelectedPanel:m,onDrillDown:g,onMobileBack:y,onDrillBack:b,onBackToRoot:v,onToggleSelectedPanel:w,onUserSearch:x,onAddUser:k,onRemoveUser:S,onToggleUser:E,onToggleSelectAll:M,onReorderUsers:C,onOk:N,onCancel:R,onClearAll:_}=n,O=e=>String(e?.user||e?.id||e?._id||""),T=s.length>0&&s.every(e=>u.find(t=>O(t)===O(e))),A=!!a,{visibleCount:D,scrollContainerRef:$}=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,[p.length,a]),L=e.useRef({dragging:!1,startIndex:-1,currentIndex:-1,startY:0,itemHeight:56,clone:null,listEl:null}),j=e.useRef(null),[I,z]=e.useState(null),[P,F]=e.useState(null),B=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),L.current={dragging:!0,startIndex:t,currentIndex:t,startY:n.clientY,itemHeight:o.height,clone:i,listEl:j.current},z(t),F(t),navigator.vibrate&&navigator.vibrate(20)},[]),H=e.useCallback(e=>{const t=L.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,u.length-1));o!==t.currentIndex&&(t.currentIndex=o,F(o),navigator.vibrate&&navigator.vibrate(10))},[u.length]),V=e.useCallback(()=>{const e=L.current;if(!e.dragging)return;e.clone&&(e.clone.remove(),e.clone=null);const t=e.startIndex,n=e.currentIndex;e.dragging=!1,z(null),F(null),t!==n&&t>=0&&n>=0&&C(t,n)},[C]);return e.createElement(t.Drawer,{open:r,placement:"bottom",height:"100dvh",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 height: 100vh !important;\n height: 100dvh !important;\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",paddingTop:"calc(12px + env(safe-area-inset-top, 0px))"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:28,minWidth:60}},p.length>0&&e.createElement("span",{onClick:y,style:{color:"#1890ff",fontSize:18,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(Ri,null)),e.createElement("span",{onClick:R,style:{color:"#666",fontSize:16,lineHeight:1,cursor:"pointer",WebkitTapHighlightColor:"transparent",padding:"4px 0"}},e.createElement(vi,null))),e.createElement("span",{style:{fontWeight:600,fontSize:16}},"选择人员"),e.createElement("div",{style:{minWidth:60,display:"flex",justifyContent:"flex-end"}},o&&s.length>0&&!A&&p.length>0&&e.createElement("span",{onClick:M,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(Ii,null),value:l,onChange:e=>x(e.target.value),allowClear:!0,size:"large"})),p.length>0&&!A&&e.createElement("div",{style:{height:8,background:"#f5f5f5",flexShrink:0}}),p.length>0&&!A&&(()=>{const t=p.length>2,n=p.length>2?p.slice(-2):p,r=p.length>2?p.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:v,style:{color:"#1890ff",cursor:"pointer",flexShrink:0,WebkitTapHighlightColor:"transparent"}},"联系人"),t&&e.createElement(e.Fragment,null,e.createElement($i,{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===p.length-1;return e.createElement(e.Fragment,{key:t.id},e.createElement($i,{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:()=>b(i),style:{color:"#1890ff",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",WebkitTapHighlightColor:"transparent"}},o(t.name)))}))})(),e.createElement("div",{ref:$,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},e.createElement(t.Spin,{spinning:i},0===c.length||A?null:e.createElement(e.Fragment,null,e.createElement("div",{style:{padding:"10px 16px 6px",fontSize:12,color:"#999",background:"#fff"}},"最近使用"),c.map(n=>{const r=!!u.find(e=>O(e)===O(n));return e.createElement("div",{key:`recent-${O(n)}`,className:"steedos-mobile-user-card",onClick:()=>E(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(gi,{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)))}),e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),A||p.length>0||!f?null:e.createElement(e.Fragment,null,e.createElement("div",{className:"steedos-mobile-dept-card",onClick:()=>g(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(pi,{style:{fontSize:18,color:"#1890ff"}})),e.createElement("div",{style:{flex:1,minWidth:0}},e.createElement("div",{style:{fontWeight:500,fontSize:15}},"通讯录")),e.createElement($i,{style:{color:"#ccc",fontSize:14,flexShrink:0}})),s.length>0&&e.createElement("div",{style:{height:8,background:"#f5f5f5"}})),A||0===p.length||0===h.length?null:e.createElement(e.Fragment,null,h.map(t=>e.createElement("div",{key:t._id||t.id||t.key||t.value,className:"steedos-mobile-dept-card",onClick:()=>g(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(pi,{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($i,{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,D).map(n=>{const r=!!u.find(e=>O(e)===O(n));return e.createElement("div",{key:n._id,className:"steedos-mobile-user-card",onClick:()=>E(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(gi,{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)))}),D<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}})))),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}},"已选中 (",u.length,")"),e.createElement(t.Button,{type:"text",onClick:w,style:{padding:0,color:"#666"}},"返回")),d&&u.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:_,style:{padding:0}},"清空全部")),o&&u.length>1&&e.createElement("div",{style:{padding:"0 16px 6px",fontSize:12,color:"#999"}},"长按拖拽可调整顺序"),e.createElement("div",{ref:j,style:{flex:1,overflowY:"auto",WebkitOverflowScrolling:"touch"}},u.length>0?u.map((n,r)=>{const i=I===r,s=P===r&&null!==I&&I!==r;return e.createElement("div",{key:n._id,onTouchStart:o?e=>B(e,r):void 0,onTouchMove:o?H:void 0,onTouchEnd:o?V: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(ki,{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)),d&&e.createElement(vi,{className:"steedos-selected-remove-btn",onClick:()=>S(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:u.length>0?"#1890ff":"#666",cursor:"pointer"},onClick:u.length>0?w:void 0},"已选 ",u.length," 人 ",u.length>0&&!m?"▲":u.length>0&&m?"▼":""),e.createElement(t.Button,{type:"primary",onClick:N},"确定")):e.createElement("div",{className:"steedos-mobile-bottom-bar"},e.createElement("span",{style:{fontSize:14,color:"#666"}},u.length>0?`已选: ${u[0]?.name}`:"请选择人员"),e.createElement(t.Button,{type:"primary",onClick:N,disabled:0===u.length},"确定")))};function Is(e){return e}function zs(e={}){return{...e}}const Ps="steedos:workflow:user-selector:recent-users";function Fs(e){if(!e)return null;const t=e.user||e.id||e._id,n=e._id||e.user||e.id;return t&&n?{_id:String(n),user:String(t),name:e.name||"",email:e.email||"",mobile:e.mobile||"",position:e.position||"",username:e.username||"",avatar:e.avatar,organization:e.organization,hr:e.hr||{}}:null}function Bs(e){return String(e?.user||e?.id||e?._id||"")}function Hs(){if("undefined"==typeof window)return[];try{const e=window.localStorage.getItem(Ps);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(Fs).filter(Boolean).slice(0,12):[]}catch{return[]}}async function Vs(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,hr,_display:_ui{sort_no,organization}}}`,n=await fetch("/graphql",{method:"POST",headers:zs({"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,hr:e.hr}))}async function qs(e,t){if(t=t?.trim()||"",!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,hr,_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:zs({"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,hr:e.hr}))}async function Us(e,t){if(t=t?.trim()||""){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:zs({"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:zs({"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:zs()}),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=qs,fetchDeptTree:l=Us,style:c,dispatchEvent:u,clearable:d=!0,isTableMode:f=!1,hasError:p=!1,formalTableMode:h=!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),[N,R]=e.useState([]),[_,O]=e.useState([]),[T,A]=e.useState([]),[D,$]=e.useState("selected"),[L,j]=e.useState(!1),[I,z]=e.useState(""),[P,F]=e.useState(""),[B,H]=e.useState(""),[V,q]=e.useState(null),[U,W]=e.useState([]),[Y,J]=e.useState(null),[K,G]=e.useState(!1),[Z,Q]=e.useState(0),[X,ee]=e.useState(null),te=e.useRef(null),ne=e.useRef(null),re=e.useRef(0),oe=e.useRef(null),ie=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}(),[,se]=e.useState("dept"),[,ae]=e.useState(""),[le,ce]=e.useState([]),[ue,de]=e.useState([]),[fe,pe]=e.useState(!1),[he,me]=e.useState(null),{visibleCount:ge,sentinelRef:ye}=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,I]),be=e.useRef(!1),ve=e.useCallback(async e=>{if(!g||0===g.length||!y)return;const t=[],n=new Map;for(const i of g){if(!i.sourceField||!i.targetField)continue;const e=i.sourceField.indexOf(".");if(e>0){const t=i.sourceField.substring(0,e),r=i.sourceField.substring(e+1);n.has(t)||n.set(t,[]),n.get(t).push({subField:r,targetField:i.targetField})}else t.push(i)}const r={};if(t.length>0){const n=t.map(e=>e.sourceField).filter(Boolean),o=e=>{for(const n of t)n.sourceField&&n.targetField&&null!=e[n.sourceField]&&(r[n.targetField]=Ts(e[n.sourceField]))};if(n.every(t=>t in e&&null!=e[t]))o(e);else try{const t=`{rows:space_users(filters: [["user","=","${e.user}"]], top: 1){${["_id",...n].join(",")}}}`,r=await fetch("/graphql",{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),i=await r.json(),s=i.data?.rows||[];s.length>0&&o(s[0])}catch{}}const o={organization:"organizations"};for(const[i,s]of n){const t=e[i];if(t&&"object"==typeof t&&!o[i]){for(const e of s)null!=t[e.subField]&&(r[e.targetField]=Ts(t[e.subField]));continue}const n=o[i];if(!n)continue;let a=e[i];if(!a)try{const t=`{rows:space_users(filters: [["user","=","${e.user}"]], top: 1){_id,${i}}}`,n=await fetch(Is("/graphql"),{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}),r=await n.json();a=r.data?.rows?.[0]?.[i]}catch{}if(!a)continue;const l=s.map(e=>e.subField);try{const e=`{rows:${n}(filters: [["_id","=","${a}"]], top: 1){${["_id",...l].join(",")}}}`,t=await fetch(Is("/graphql"),{method:"POST",headers:zs({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),o=await t.json(),i=o.data?.rows?.[0];if(i)for(const n of s)null!=i[n.subField]&&(r[n.targetField]=Ts(i[n.subField]))}catch{}}Object.keys(r).length>0&&y(r)},[g,y]);e.useEffect(()=>{oe.current={props:n}}),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id)return void R([{_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 R(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,hr}}`;fetch("/graphql",{method:"POST",headers:zs({"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,hr:e.hr}));n=e.map(e=>n.find(t=>t.user===e)).filter(e=>!!e),R(n),!i&&g&&g.length>0&&1===n.length&&y&&!be.current&&(be.current=!0,ve(n[0]))})}else R([])},[r,i]),e.useEffect(()=>()=>{te.current&&clearTimeout(te.current),ne.current&&clearTimeout(ne.current)},[]),e.useEffect(()=>{if(v){j(!0),Q(e=>e+1),ae(""),k([]),W([]),C(null),H(""),z(""),F("");let e=!1;l().then(t=>{const n=t;k(n);const r=n.map(e=>e.key);if(W(r),r.length>0)if(ie&&n[0]){ae(String(n[0].title||""));const t=String(n[0].key),r=String(n[0].title||"");me({id:t,name:r}),ce([]),C(t),e=!0,a(t).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>{j(!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||j(!1)})}},[v,l,a,ie]),e.useEffect(()=>{ie||(M||I?(j(!0),a(M||void 0,I||void 0).then(e=>E(e)).finally(()=>j(!1))):E([]))},[M,I,a,ie]);const we=(e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:we(e.children,t,n)}:e),xe=e=>{F(e),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{z(e),e?(C(null),ae(""),ie&&(j(!0),a(void 0,e).then(e=>E(e)).finally(()=>j(!1)))):ie?he&&(ce([]),de([]),C(he.id),j(!0),a(he.id).then(e=>{E(e)}).catch(()=>{E([])}).finally(()=>j(!1))):x.length>0&&C(String(x[0].key))},300)},ke=e=>{const t=Bs(e);if(i){if(!_.find(e=>Bs(e)===t)){const t=[..._,e];O(t)}}else O([e]),ie?setTimeout(()=>{Ce([e])},0):(ee(e._id),setTimeout(()=>{ee(null),Ce([e])},300))},Se=e=>{O(_.filter(t=>t._id!==e&&Bs(t)!==e))},Ee=()=>{q(null)},Me=()=>{if(S.length>0&&S.every(e=>_.find(t=>Bs(t)===Bs(e)))){const e=new Set(S.map(Bs));O(_.filter(t=>!e.has(Bs(t))))}else{const e=[..._];S.forEach(t=>{e.find(e=>Bs(e)===Bs(t))||e.push(t)}),O(e)}},Ce=async e=>{if(R(e),e.length>0&&A(function(e){if("undefined"==typeof window)return[];const t=Hs(),n=[],r=new Set;for(const o of[...e,...t]){const e=Fs(o);if(!e)continue;const t=Bs(e);if(!r.has(t)&&(r.add(t),n.push(e),n.length>=12))break}try{window.localStorage.setItem(Ps,JSON.stringify(n))}catch{}return n}(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,hr}}`;let r=[];try{const e=await fetch("/graphql",{method:"POST",headers:zs({"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:zs({"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:t.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},oe.current),o&&o(n)}w(!1),i||1!==e.length||await ve(e[0])},Ne=async()=>{await Ce(_)},Re=()=>{O([...N]),w(!1)},_e=e.useCallback(async(e,t)=>{ce(n=>[...n,{id:e,name:t}]),C(e),z(""),F(""),j(!0);try{const[t,n]=await Promise.all([l(e),Vs(e)]);de(t),E(n)}catch{de([]),E([])}finally{j(!1)}},[l]),Oe=e.useCallback(async e=>{if(e<0)return;const t=le.slice(0,e+1);ce(t);const n=t[t.length-1];C(n.id),z(""),F(""),j(!0);try{const[e,t]=await Promise.all([l(n.id),Vs(n.id)]);de(e),E(t)}catch{de([]),E([])}finally{j(!1)}},[le,l]),Te=e.useCallback(async()=>{if(he){ce([]),C(he.id),z(""),F(""),de([]),j(!0);try{const e=await a(he.id);E(e)}catch{E([])}finally{j(!1)}}},[he,a]),Ae=e.useCallback(async()=>{if(!(le.length<=0))if(1===le.length)await Te();else{const e=le.slice(0,-1);ce(e);const t=e[e.length-1];C(t.id),z(""),F(""),j(!0);try{const[e,n]=await Promise.all([l(t.id),Vs(t.id)]);de(e),E(n)}catch{de([]),E([])}finally{j(!1)}}},[le,Te,l]),De=e.useCallback((e,t)=>{if(e<0||t<0||e>=_.length||t>=_.length)return;const n=[..._],[r]=n.splice(e,1);n.splice(t,0,r),O(n)},[_]),$e=e.useCallback(e=>{_.find(t=>Bs(t)===Bs(e))?Se(e._id):ke(e)},[_,i,ke,Se]),Le=d&&N.length>0&&(ie||K),je=T.length>0&&!I;return e.createElement("div",{style:{...c},className:"steedos-user-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:N.map(e=>e.name).join(", "),onClick:()=>{A(Hs()),$("selected"),w(!0),O([...N]),ie&&(se("users"),ae(""),pe(!1),ce([]),de([]),me(null))},onMouseEnter:()=>!ie&&G(!0),onMouseLeave:()=>!ie&&G(!1),variant:f||m?"borderless":"outlined",className:f?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...f?{backgroundColor:p?"rgba(254,226,226,0.9)":h?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{height:38,...p||m?{}:{backgroundColor:"rgba(255,251,235,0.8)"}}},suffix:m?null:Le?e.createElement(vi,{style:{color:"#ff4d4f",cursor:"pointer",padding:ie?4:0},onMouseEnter:()=>!ie&&G(!0),onMouseLeave:()=>!ie&&G(!1),onClick:async e=>{e.stopPropagation(),R([]);const t=i?[]:null;u&&await u("change",{value:t},oe.current),o&&o(t),G(!1)}}):e.createElement(Vi,{style:{color:"#999"},onMouseEnter:()=>!ie&&N.length>0&&G(!0),onMouseLeave:()=>!ie&&G(!1)})}),!ie&&e.createElement(t.Modal,{title:i?"选择人员 (多选)":"选择人员",open:v,onOk:i?Ne:void 0,onCancel:Re,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:1200,centered:!0,destroyOnClose:!0,bodyStyle:{height:"min(600px, calc(100vh - 200px))",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(Ii,null),value:B,onChange:e=>(e=>{if(ne.current&&clearTimeout(ne.current),H(e),!e)return j(!0),void l().then(e=>{const t=e.map(e=>({...e,children:void 0}));k(t),Q(e=>e+1);const n=t.map(e=>e.key);W(n),n.length>0&&C(String(n[0]))}).finally(()=>j(!1));ne.current=setTimeout(()=>{j(!0),l(void 0,e).then(e=>k(e)).finally(()=>j(!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:L&&!M&&!I},e.createElement(t.Tree,{key:Z,treeData:x,onSelect:(e,t)=>{e.length>0?(C(String(e[0])),z(""),F(""),ie&&t?.node&&(ae(String(t.node.title||"")),se("users"))):x.length>0&&C(String(x[0].key))},loadData:B?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await l(String(e));k(t=>we(t,e,n))},showLine:!0,selectedKeys:M?[M]:[],expandedKeys:U,onExpand:W})))),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(Ii,null),value:P,onChange:e=>xe(e.target.value),allowClear:!0,style:{flex:1}}),i&&S.length>0&&e.createElement(t.Button,{onClick:Me},S.every(e=>_.find(t=>Bs(t)===Bs(e)))?"取消":"全选")),e.createElement("div",{style:{flex:1,overflowY:"auto",border:"1px solid #f0f0f0",borderRadius:4,position:"relative"}},e.createElement(t.Spin,{spinning:L},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,ge).map(n=>{const r=!!_.find(e=>Bs(e)===Bs(n));return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||ke(n)},style:{padding:"10px 12px",borderRadius:4,cursor:"pointer",backgroundColor:X===n._id?"#e6f7ff":r&&i?"#f5f5f5":"transparent",borderColor:X===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(gi,{style:{color:"#1890ff",flexShrink:0}}))})),ge<S.length&&e.createElement("div",{ref:ye,style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:13,marginTop:8}},"滚动加载更多...")):!M&&!I||L?L?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(t.Tabs,{size:"small",activeKey:D,onChange:e=>$(e),items:[{key:"selected",label:`已选中 (${_.length})`},{key:"recent",label:`最近使用 (${T.length})`}],style:{flexShrink:0}}),"selected"===D?e.createElement(e.Fragment,null,e.createElement("div",{style:{flex:1,overflowY:"auto"}},_.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},_.map((n,r)=>e.createElement("div",{key:n._id,draggable:i,onDragStart:()=>(e=>{q(e)})(r),onDragEnd:Ee,onDragOver:e=>((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===V||V===t)return;const n=Date.now();if(n-re.current<100)return;re.current=n;const r=[..._],o=r[V];r.splice(V,1),r.splice(t,0,o),O(r),q(t)})(e,r),onMouseEnter:()=>J(n._id),onMouseLeave:()=>J(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:V===r?"#e6f7ff":"#f5f5f5",borderRadius:4,position:"relative",cursor:i?"grab":"default",transition:"all 0.3s ease",opacity:V===r?.5:1,border:V===r?"1px dashed #1890ff":"1px solid transparent",transform:V===r?"scale(0.98)":"scale(1)",boxShadow:V===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&&Y===n._id&&e.createElement(vi,{onClick:()=>Se(n._id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f"}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),d&&_.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>O([]),style:{marginTop:8,padding:0}},"清空全部")):e.createElement("div",{style:{flex:1,overflowY:"auto"}},T.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:4},T.map(n=>{const r=!!_.find(e=>Bs(e)===Bs(n));return e.createElement("div",{key:n._id,className:r&&i?"":"steedos-user-selector-item",onClick:()=>{i&&r||ke(n)},style:{height:36,padding:"4px 8px",borderRadius:4,cursor:"pointer",backgroundColor:X===n._id?"#e6f7ff":r&&i?"#f5f5f5":"transparent",border:"1px solid "+(X===n._id||r&&i?"#1890ff":"transparent"),transition:"all 0.2s",opacity:r&&i?.6:1,display:"flex",alignItems:"center",gap:8,minWidth:0}},e.createElement(t.Avatar,{src:n.avatar?`/api/v6/users/${n.user}/avatar`:n.avatar,size:28,style:{backgroundColor:n.avatar?void 0:"#1890ff",flexShrink:0}},!n.avatar&&n.name?.charAt(0)),e.createElement("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,fontWeight:500}},n.name),r&&e.createElement(gi,{style:{color:"#1890ff",flexShrink:0,fontSize:12}}))})):e.createElement(t.Empty,{description:"暂无最近使用",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE}))))),ie&&v&&e.createElement(js,{visible:v,multiple:i,loading:L,users:S,recentUsers:je?T:[],searchKeyword:I,searchInputValue:P,tempSelectedUsers:_,clearable:d,rootDeptInfo:he,deptPath:le,currentLevelDepts:ue,showSelectedPanel:fe,onDrillDown:_e,onMobileBack:Ae,onDrillBack:Oe,onBackToRoot:Te,onToggleSelectedPanel:()=>pe(e=>!e),onUserSearch:xe,onAddUser:ke,onRemoveUser:Se,onToggleUser:$e,onToggleSelectAll:Me,onReorderUsers:De,onOk:Ne,onCancel:Re,onClearAll:()=>O([])}))};function Ys(e={}){return{...e}}async function Js(e,t){if(t=t?.trim()||""){const e=[["name","contains",t]],n=`{rows:organizations(filters: ${JSON.stringify(e)}, top: 100, skip: 0, sort: "sort_no desc"){_id,space,name,fullname,sort_no,parent,children}}`,r=await fetch("/graphql",{method:"POST",headers:Ys({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json();return(o.data?.rows||[]).map(e=>({title:e.fullname||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,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,parent,children}}`,n=await fetch("/graphql",{method:"POST",headers:Ys({"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,parentId:e.parent}))}{const e=await fetch("/service/api/organizations/root",{headers:Ys()}),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,parentId:e.parent}))}}function Ks(e,t){for(const n of e){if(n.key===t)return n;if(n.children){const e=Ks(n.children,t);if(e)return e}}return null}const Gs=n=>{const{value:r,onChange:o,multiple:i=!1,placeholder:s="请选择部门/分组",fetchDeptTree:a=Js,style:l,dispatchEvent:c,data:u,isTableMode:d=!1,hasError:f=!1,formalTableMode:p=!1,pickerFillRules:h,onFillFields:m,valueFormat:g="object"}=n,[y,b]=e.useState(!1),[v,w]=e.useState([]),[x,k]=e.useState([]),[S,E]=e.useState([]),[M,N]=e.useState(!1),[R,_]=e.useState(""),[O,T]=e.useState(""),[A,D]=e.useState([]),[$,L]=e.useState(0),[j,I]=e.useState(!1),[z,P]=e.useState(null),[F,B]=e.useState(null),[H,V]=e.useState(null),q=e.useRef(null),U=e.useRef(0),W=e.useRef(null),Y=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}();e.useEffect(()=>{W.current={props:n}}),e.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]),e.useEffect(()=>{if(r&&"object"==typeof r&&!Array.isArray(r)&&r.id){const e=r;return void k([{id:e.id,name:e.name||"",fullname:e.fullname||e.name||""}])}if(Array.isArray(r)&&r.length>0&&"object"==typeof r[0]&&r[0].id)return void k(r.map(e=>({id:e.id,name:e.name||"",fullname:e.fullname||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(0===e.length)return void k([]);const t=`{rows:organizations(filters: [["_id","in",[${e.map(e=>`"${e}"`).join(",")}]]], top: 500){_id,name,fullname}}`;fetch("/graphql",{method:"POST",headers:Ys({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(t=>{const n=t.data?.rows||[],r=new Map(n.map(e=>[String(e._id),e])),o=e.map(e=>{const t=r.get(e);return t?{id:String(t._id),name:t.name||"",fullname:t.fullname||t.name||""}:{id:e,name:e,fullname:e}});k(o)}).catch(()=>{k(e.map(e=>({id:e,name:e,fullname:e})))})},[r,i]);const J=e.useCallback((e,t,n)=>e.map(e=>e.key===t?{...e,children:n}:e.children?{...e,children:J(e.children,t,n)}:e),[]);e.useEffect(()=>{y&&(N(!0),L(e=>e+1),w([]),D([]),T(""),_(""),a().then(e=>{w(e);const t=e.map(e=>e.key);D(t),e.forEach(e=>{e.isLeaf||a(String(e.key)).then(t=>{w(n=>J(n,e.key,t))})})}).finally(()=>N(!1)))},[y,a]);const K=e.useCallback(async(e,t,n)=>{const r=t;let o=n||"";return o||(o=await async function(e,t){try{const n=`{node:organizations(filters: [["_id","=","${e}"]], top: 1){_id,name,fullname}}`,r=await fetch("/graphql",{method:"POST",headers:Ys({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),o=await r.json(),i=o.data?.node?.[0];return i?i.fullname?i.fullname:i.name||t:t}catch{return t}}(e,r)),{id:e,name:r,fullname:o}},[]),G=e.useCallback(async e=>{const t=C(u,{value:e}),n=await(c?.("change",t,W.current));n?.prevented||o?.(e)},[u,c,o]),Z=e.useCallback(e=>{if(!h||0===h.length||!m)return;const t=`{rows:organizations(filters: [["_id","=","${e}"]], top: 1){${["_id",...h.map(e=>e.sourceField).filter(Boolean)].join(",")}}}`;fetch("/graphql",{method:"POST",headers:Ys({"Content-Type":"application/json"}),body:JSON.stringify({query:t})}).then(e=>e.json()).then(e=>{const t=e.data?.rows||[];if(t.length>0){const e=t[0],n={};for(const t of h)t.sourceField&&t.targetField&&null!=e[t.sourceField]&&(n[t.targetField]=Ts(e[t.sourceField]));Object.keys(n).length>0&&m(n)}})},[h,m]),Q=e.useCallback(e=>{if(_(e),q.current&&clearTimeout(q.current),!e)return T(""),N(!0),void a().then(e=>{w(e),L(e=>e+1);const t=e.map(e=>e.key);D(t),e.forEach(e=>{e.isLeaf||a(String(e.key)).then(t=>{w(n=>J(n,e.key,t))})})}).finally(()=>N(!1));q.current=setTimeout(()=>{T(e),N(!0),a(void 0,e).then(e=>{w(e),L(e=>e+1)}).finally(()=>N(!1))},300)},[a,J]),X=e.useCallback(()=>{b(!0),E([...x])},[x]),ee=e.useCallback(()=>{E([...x]),b(!1)},[x]),te=e.useCallback(e=>{if(0===e.length)return;const t=String(e[0]),n=Ks(v,t);P(t),K(t,n?.title||t,n?.fullname).then(e=>{setTimeout(async()=>{P(null),k([e]),b(!1);const t="string"===g?e.id:e;await G(t),i||Z(e.id)},Y?0:300)})},[v,K,g,G,Z,Y,i]),ne=e.useCallback(async e=>{let t;t=Array.isArray(e)?e.map(String):(e.checked||[]).map(String);const n=new Set(t),r=S.filter(e=>n.has(e.id)),o=new Set(r.map(e=>e.id)),i=t.filter(e=>!o.has(e)).map(async e=>{const t=Ks(v,e);return K(e,t?.title||e,t?.fullname)}),s=await Promise.all(i);E([...r,...s])},[S,v,K]),re=e.useCallback(async()=>{k(S),b(!1);const e="string"===g?S.map(e=>e.id):S;await G(e),i||1!==S.length||Z(S[0].id)},[S,g,G,i,Z]),oe=e.useCallback(e=>{E(t=>t.filter(t=>t.id!==e))},[]),ie=e.useCallback(async e=>{e.stopPropagation(),k([]);const t=i?[]:null;await G(t),I(!1)},[i,G]),se=e.useCallback(e=>B(e),[]),ae=e.useCallback(()=>B(null),[]),le=e.useCallback((e,t)=>{if(e.preventDefault(),e.dataTransfer.dropEffect="move",null===F||F===t)return;const n=Date.now();if(n-U.current<100)return;U.current=n;const r=[...S],[o]=r.splice(F,1);r.splice(t,0,o),E(r),B(t)},[F,S]),ce=x.map(e=>e.fullname||e.name).join(", "),ue=x.length>0&&(Y||j),de=e.createElement("div",{style:{display:"flex",height:"100%"}},e.createElement("div",{style:{flex:1,padding:16,display:"flex",flexDirection:"column",borderRight:i?"1px solid #f0f0f0":"none",minWidth:0}},e.createElement(t.Input,{placeholder:"搜索部门/分组",prefix:e.createElement(Ii,null),value:R,onChange:e=>Q(e.target.value),allowClear:!0,style:{marginBottom:12}}),e.createElement("div",{style:{flex:1,overflowY:"auto"}},e.createElement(t.Spin,{spinning:M},v.length>0?e.createElement(t.Tree,{key:$,treeData:v,loadData:O?void 0:async({key:e,children:t})=>{if(t&&t.length>0)return;const n=await a(String(e));w(t=>J(t,e,n))},showLine:!0,checkable:i,checkStrictly:i,checkedKeys:i?{checked:S.map(e=>e.id),halfChecked:[]}:void 0,selectedKeys:!i&&z?[z]:[],expandedKeys:A,onExpand:D,onSelect:i?void 0:te,onCheck:i?ne:void 0}):M?null:e.createElement(t.Empty,{description:"暂无部门数据",style:{marginTop:60}})))),i&&e.createElement("div",{style:{width:220,padding:16,display:"flex",flexDirection:"column",flexShrink:0}},e.createElement("div",{style:{marginBottom:12,fontSize:14}},e.createElement("span",{style:{fontWeight:500}},"已选中"),e.createElement("span",{style:{marginLeft:8,color:"#999"}},"(",S.length,")")),e.createElement("div",{style:{flex:1,overflowY:"auto"}},S.length>0?e.createElement(t.Space,{direction:"vertical",style:{width:"100%"},size:8},S.map((t,n)=>e.createElement("div",{key:t.id,draggable:!0,onDragStart:()=>se(n),onDragEnd:ae,onDragOver:e=>le(e,n),onMouseEnter:()=>V(t.id),onMouseLeave:()=>V(null),style:{width:"100%",padding:"8px 12px",display:"flex",alignItems:"center",gap:8,backgroundColor:F===n?"#e6f7ff":"#f5f5f5",borderRadius:4,cursor:"grab",transition:"all 0.3s ease",opacity:F===n?.5:1,border:F===n?"1px dashed #1890ff":"1px solid transparent"}},e.createElement(pi,{style:{color:"#1890ff",flexShrink:0}}),e.createElement("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13}},t.name||t.fullname),H===t.id&&e.createElement(vi,{onClick:()=>oe(t.id),style:{fontSize:12,cursor:"pointer",color:"#ff4d4f",flexShrink:0}})))):e.createElement(t.Empty,{description:"未选择",style:{marginTop:60},image:t.Empty.PRESENTED_IMAGE_SIMPLE})),S.length>0&&e.createElement(t.Button,{size:"small",type:"link",onClick:()=>E([]),style:{marginTop:8,padding:0}},"清空全部")));return e.createElement("div",{style:{...l},className:"steedos-org-selector"},e.createElement(t.Input,{readOnly:!0,placeholder:s,value:ce,onClick:X,onMouseEnter:()=>!Y&&I(!0),onMouseLeave:()=>!Y&&I(!1),variant:d?"borderless":"outlined",className:d?"picker-table-mode":"",style:{minWidth:150,cursor:"pointer",...d?{backgroundColor:f?"rgba(254,226,226,0.9)":p?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,height:"100%",fontSize:13}:{height:38,...f?{}:{backgroundColor:"rgba(255,251,235,0.8)"}}},suffix:ue?e.createElement(vi,{style:{color:"#ff4d4f",cursor:"pointer",padding:Y?4:0},onMouseEnter:()=>!Y&&I(!0),onMouseLeave:()=>!Y&&I(!1),onClick:ie}):e.createElement(pi,{style:{color:"#999"},onMouseEnter:()=>!Y&&x.length>0&&I(!0),onMouseLeave:()=>!Y&&I(!1)})}),!Y&&e.createElement(t.Modal,{title:i?"选择部门/分组(多选)":"选择部门/分组",open:y,onOk:i?re:void 0,onCancel:ee,okText:"确定",cancelText:"取消",footer:i?void 0:null,width:i?900:640,centered:!0,destroyOnClose:!0,styles:{body:{height:"min(520px, calc(100vh - 200px))",overflow:"hidden",padding:0}}},de),Y&&e.createElement(t.Drawer,{title:i?"选择部门/分组(多选)":"选择部门/分组",placement:"bottom",height:"80%",open:y,onClose:ee,destroyOnClose:!0,footer:i?e.createElement("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"}},e.createElement(t.Button,{onClick:ee},"取消"),e.createElement(t.Button,{type:"primary",onClick:re},"确定")):null,styles:{body:{padding:0,display:"flex",flexDirection:"column",overflow:"hidden"}}},e.createElement("div",{style:{flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}},de)))};function Zs(e={}){return{...e}}function Qs({value:t,isTableMode:n=!1,minimal:r=!1}){const[o,i]=e.useState(new Map),{names:s,unresolvedIds:a}=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===a.length)return;const e=a.filter(e=>!o.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:Zs({"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.user&&r.name&&n.set(r.user,r.name);return n})}).catch(()=>{})},[t]);const l=r?"text-[13px] text-gray-700":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 s.length>0?React.createElement("div",{className:l},React.createElement("div",{className:"flex flex-wrap gap-1.5"},s.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===a.length?React.createElement("div",{className:l}):React.createElement("div",{className:l},React.createElement("div",{className:"flex flex-wrap gap-1.5"},a.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"},o.get(e)||e))))}function Xs(e={}){return{...e}}function ea({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:Xs({"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 ta,na,ra={exports:{}},oa={};function ia(){return na||(na=1,ra.exports=function(){if(ta)return oa;ta=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 oa.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:l,oa}()),ra.exports}var sa=ia();function aa(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 la(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 ca=e.Fragment;function ua(e){this.content=e}function da(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=da(o.content,i.content,n+1);if(null!=e)return e}n+=o.nodeSize}else n+=o.nodeSize}}function fa(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=fa(s.content,a.content,n-1,r-1);if(e)return e}n-=l,r-=l}else n-=l,r-=l}}ua.prototype={constructor:ua,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 ua(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 ua(n)},addToStart:function(e,t){return new ua([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new ua(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 ua(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=ua.from(e)).size?new ua(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=ua.from(e)).size?new ua(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=ua.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}},ua.from=function(e){if(e instanceof ua)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new ua(t)};class pa{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 pa(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 pa(n,r)}cutByIndex(e,t){return e==t?pa.empty:0==e&&t==this.content.length?this:new pa(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 pa(r,o)}addToStart(e){return new pa([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new pa(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 da(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return fa(this,e,t,n)}findIndex(e){if(0==e)return ma(0,e);if(e==this.size)return ma(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?ma(t+1,r):ma(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 pa.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new pa(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return pa.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 pa(t||e,n)}static from(e){if(!e)return pa.empty;if(e instanceof pa)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new pa([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}pa.empty=new pa([],0);const ha={index:0,offset:0};function ma(e,t){return ha.index=e,ha.offset=t,ha}function ga(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(!ga(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!ga(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let ya=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&&ga(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}};ya.none=[];class ba extends Error{}class va{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=xa(this.content,e+this.openStart,t);return n&&new va(n,this.openStart,this.openEnd)}removeBetween(e,t){return new va(wa(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 va.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 va(pa.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 va(e,n,r)}}function wa(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(wa(i.content,t-o-1,n-o-1)))}function xa(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=xa(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function ka(e,t,n){if(n.openStart>e.depth)throw new ba("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ba("Inconsistent open depths");return Sa(e,t,n,0)}function Sa(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=Sa(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(pa.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Ra(i,_a(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,Oa(e,t,r))}function Ea(e,t){if(!t.type.compatibleContent(e.type))throw new ba("Cannot join "+t.type.name+" onto "+e.type.name)}function Ma(e,t,n){let r=e.node(n);return Ea(r,t.node(n)),r}function Ca(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&&(Ca(e.nodeAfter,r),i++));for(let a=i;a<s;a++)Ca(o.child(a),r);t&&t.depth==n&&t.textOffset&&Ca(t.nodeBefore,r)}function Ra(e,t){return e.type.checkContent(t),e.copy(t)}function _a(e,t,n,r,o){let i=e.depth>o&&Ma(e,t,o+1),s=r.depth>o&&Ma(n,r,o+1),a=[];return Na(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(Ea(i,s),Ca(Ra(i,_a(e,t,n,r,o+1)),a)):(i&&Ca(Ra(i,Oa(e,t,o+1)),a),Na(t,n,o,a),s&&Ca(Ra(s,Oa(n,r,o+1)),a)),Na(r,null,o,a),new pa(a)}function Oa(e,t,n){let r=[];if(Na(null,e,n,r),e.depth>n){Ca(Ra(Ma(e,t,n+1),Oa(e,t,n+1)),r)}return Na(t,null,n,r),new pa(r)}va.empty=new va(pa.empty,0,0);class Ta{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 ya.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 La(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 Ta(t,n,o)}static resolveCached(e,t){let n=$a.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 $a.set(e,n=new Aa);let r=n.elts[n.i]=Ta.resolve(e,t);return n.i=(n.i+1)%Da,r}}class Aa{constructor(){this.elts=[],this.i=0}}const Da=12,$a=new WeakMap;class La{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 ja=Object.create(null);class Ia{constructor(e,t,n,r=ya.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||pa.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&&ga(this.attrs,t||e.defaultAttrs||ja)&&ya.sameSet(this.marks,n||ya.none)}copy(e=null){return e==this.content?this:new Ia(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ia(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 va.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 va(a,r.depth-i,o.depth-i)}replace(e,t,n){return ka(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 Ta.resolveCached(this,e)}resolveNoCache(e){return Ta.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()+")"),Pa(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=pa.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=ya.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(!ya.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=pa.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}Ia.prototype.text=void 0;class za extends Ia{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):Pa(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 za(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new za(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 Pa(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Fa{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new Ba(e,t);if(null==n.next)return Fa.empty;let r=Ha(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return n(Ja(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]);Ja(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new Fa(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(Ya);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 pa.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")}}Fa.empty=new Fa(!0);class Ba{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 Ha(e){let t=[];do{t.push(Va(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function Va(e){let t=[];do{t.push(qa(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function qa(e){let t=function(e){if(e.eat("(")){let t=Ha(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=Wa(e,t)}return t}function Ua(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Wa(e,t){let n=Ua(e),r=n;return e.eat(",")&&(r="}"!=e.next?Ua(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function Ya(e,t){return t-e}function Ja(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(Ya)}function Ka(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 Ga(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 Za(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 Qa(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new el(e,r,t[r]);return n}let Xa=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=Qa(e,n.attrs),this.defaultAttrs=Ka(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==Fa.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:Ga(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ia(this,this.computeAttrs(e),pa.from(t),ya.setFrom(n))}createChecked(e=null,t,n){return t=pa.from(t),this.checkContent(t),new Ia(this,this.computeAttrs(e),t,ya.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=pa.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(pa.empty,!0);return o?new Ia(this,e,t.append(o),ya.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){Za(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:ya.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 el{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 tl{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Qa(e,r.attrs),this.excluded=null;let o=Ka(this.attrs);this.instance=o?new ya(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ya(this,Ga(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new tl(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){Za(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class nl{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=ua.from(e.nodes),t.marks=ua.from(e.marks||{}),this.nodes=Xa.compile(this.spec.nodes,this),this.marks=tl.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]=Fa.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?rl(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?[]:rl(this,t.split(" "))}this.nodeFromJSON=e=>Ia.fromJSON(this,e),this.markFromJSON=e=>ya.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 Xa))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 za(n,n.defaultAttrs,e,ya.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 rl(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 ol{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 ul(this,t,!1);return n.addAll(e,ya.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ul(this,t,!0);return n.addAll(e,ya.none,t.from,t.to),va.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(dl(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=fl(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=fl(e)),e.node||e.ignore||e.mark||(e.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ol(e,ol.schemaRules(e)))}}const il={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},sl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},al={ol:!0,ul:!0};function ll(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class cl{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=ya.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(pa.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=pa.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(pa.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&&!il.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ul{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=ll(null,t.preserveWhitespace,0)|(n?4:0);r=o?new cl(o.type,o.attrs,ya.none,!0,t.topMatch||o.type.contentMatch,i):new cl(n?null:e.schema.topNodeType,null,ya.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();al.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&&al.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:sl.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(il.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=ya.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):pl(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=ll(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=ya.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):pl(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new cl(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 dl(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function fl(e){let t={};for(let n in e)t[n]=e[n];return t}function pl(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 hl{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=gl(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}=vl(gl(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&&vl(gl(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return vl(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new hl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ml(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ml(e.marks)}}function ml(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function gl(e){return e.document||window.document}const yl=new WeakMap;function bl(e){let t=yl.get(e);return void 0===t&&yl.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 vl(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=bl(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}=vl(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 wl=Math.pow(2,16);function xl(e,t){return e+t*wl}function kl(e){return 65535&e}class Sl{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 El{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&El.empty)return El.empty}recover(e){let t=0,n=kl(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))/wl}(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:xl(s/3,e-a),d=e==a?2:e==u?1:4;return(t<0?e!=a:e!=u)&&(d|=8),new Sl(o,d,i)}r+=c-l}return n?e+r:new Sl(e+r,0,null)}touches(e,t){let n=0,r=kl(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 El(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?El.empty:new El(e<0?[0,-e,0]:[0,0,e])}}El.empty=new El([]);class Ml{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 Ml(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 Ml;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 Sl(e,r,null)}}const Cl=Object.create(null);class Nl{getMap(){return El.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Cl[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 Cl)throw new RangeError("Duplicate use of step JSON ID "+e);return Cl[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 ba)return Rl.fail(o.message);throw o}}}function _l(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(_l(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return pa.fromArray(r)}class Ol 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 va(_l(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 Tl(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 Ol(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ol&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ol(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 Ol(t.from,t.to,e.markFromJSON(t.mark))}}Nl.jsonID("addMark",Ol);class Tl 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 va(_l(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 Ol(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 Tl(t.pos,n.pos,this.mark)}merge(e){return e instanceof Tl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Tl(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 Tl(t.from,t.to,e.markFromJSON(t.mark))}}Nl.jsonID("removeMark",Tl);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 va(pa.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 Dl(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 Dl 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 va(pa.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 Dl(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 Dl(t.pos,e.markFromJSON(t.mark))}}Nl.jsonID("removeNodeMark",Dl);class $l 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&&jl(e,this.from,this.to)?Rl.fail("Structure replace would overwrite content"):Rl.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new El([this.from,this.to-this.from,this.slice.size])}invert(e){return new $l(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 $l(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof $l)||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?va.empty:new va(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new $l(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?va.empty:new va(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new $l(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 $l(t.from,t.to,va.fromJSON(e,t.slice),!!t.structure)}}Nl.jsonID("replace",$l);class Ll 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&&(jl(e,this.from,this.gapFrom)||jl(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 El([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 Ll(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 Ll(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 Ll(t.from,t.to,t.gapFrom,t.gapTo,va.fromJSON(e,t.slice),t.insert,!!t.structure)}}function jl(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 Il(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 Tl(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 va(pa.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new $l(a+e.index,a+e.index+e[0].length,r))}}else s.push(new $l(a,c,va.empty));a=c}if(!r.validEnd){let t=r.fillBefore(pa.empty,!0);e.replace(a,a,new va(t,0,0))}for(let l=s.length-1;l>=0;l--)e.step(s[l])}function zl(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Pl(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||!zl(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function Fl(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(Bl).concat({type:t,attrs:n}).concat(i.map(Bl)):null}function Bl(e){return{type:e,attrs:null}}function Hl(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 Vl(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 ql(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 Ul(e,t){let n=e.resolve(t),r=n.index();return Wl(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Wl(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 Yl(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&&Wl(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 Jl(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 Kl(e,t,n=t,r=va.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Gl(o,i,r)?new $l(t,n,r):new Zl(o,i,r).fit()}function Gl(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Nl.jsonID("replaceAround",Ll);class Zl{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=pa.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=pa.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 va(o,i,s);return e>-1?new Ll(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new $l(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=ec(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(pa.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=ec(e,t);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new va(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=ec(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new va(Ql(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new va(Ql(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 h=0;h<o.length;h++)this.openFrontierNode(o[h]);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 f=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(tc(e.mark(d.allowedMarks(e.marks)),1==l?a:0,l==s.childCount?f:-1)))}let p=l==s.childCount;p||(f=-1),this.placed=Xl(this.placed,t,pa.from(c)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let h=0,m=s;h<f;h++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?va.empty:new va(Ql(i.content,e-1,1),e-1,f<0?i.openEnd:e-1):new va(Ql(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||!nc(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=nc(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=nc(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=Xl(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=Xl(this.placed,this.depth,pa.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(pa.empty,!0);e.childCount&&(this.placed=Xl(this.placed,this.frontier.length,e))}}function Ql(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Ql(e.firstChild.content,t-1,n)))}function Xl(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Xl(e.lastChild.content,t-1,n)))}function ec(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function tc(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,tc(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(pa.empty,!0)))),e.copy(r)}function nc(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 rc(e){return e.spec.defining||e.spec.definingForContent}function oc(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(oc(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(pa.empty,!0))}return e}function ic(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 sc 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 va(pa.from(r),0,t.isLeaf?0:1))}getMap(){return El.empty}invert(e){return new sc(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 sc(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 sc(t.pos,t.attr,t.value)}}Nl.jsonID("attr",sc);class ac 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 El.empty}invert(e){return new ac(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 ac(t.attr,t.value)}}Nl.jsonID("docAttr",ac);let lc=class extends Error{};lc=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(lc.prototype=Object.create(Error.prototype)).constructor=lc,lc.prototype.name="TransformError";class cc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ml}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new lc(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=va.empty){let r=Kl(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new va(pa.from(n),0,0))}delete(e,t){return this.replace(e,t,va.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(Gl(o,i,r))return e.step(new $l(t,n,r));let s=ic(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let e=o.node(f).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==p&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let e=f.firstChild;if(c.push(e),p==r.openStart)break;f=e.content}for(let f=u-1;f>=0;f--){let e=c[f],t=rc(e.type);if(t&&!e.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(t||!e.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let t=(f+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 f=o.node(u-1),p=o.index(u-1);if(f.canReplaceWith(p,p,a.type,a.marks))return e.replace(o.before(u),d?i.after(u):n,new va(oc(r.content,0,r.openStart,t),t,r.openEnd))}}let d=e.steps.length;for(let f=s.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let e=s[f];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 va(pa.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=ic(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=pa.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=pa.from(r.node(h).copy(u)),d++):l--;let f=pa.empty,p=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=pa.from(o.node(h).copy(f)),p++):c++;e.step(new Ll(l,c,s,a,new va(u.append(f),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);Vl(e,r.node(),r.before(),a)}s.inlineContent&&Il(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 $l(c,l.map(t+n,-1),va.empty,!0)),!0===r){let t=e.doc.resolve(c);Hl(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=pa.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=pa.from(n[s].type.create(n[s].attrs,r))}let o=t.start,i=t.end;e.step(new Ll(o,i,o,i,new va(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&&Vl(e,t,n,i),Il(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 Ll(l,c,l+1,c-1,new va(pa.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Hl(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 Ll(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new va(pa.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new sc(e,t,n)),this}setDocAttribute(e,t){return this.step(new ac(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 ya)t.isInSet(n.marks)&&this.step(new Dl(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new Dl(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=pa.empty,s=pa.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=pa.from(o.node(a).copy(i));let e=r&&r[c];s=pa.from(e?e.type.create(e.attrs,s):o.node(a).copy(s))}e.step(new $l(t,t,new va(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),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==c&&o.mark.eq(u[e])?o.to=d:s.push(o=new Tl(c,d,u[e])));i&&i.to==c?i.to=d:a.push(i=new Ol(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 tl){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 Tl(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return Il(this,e,t,n),this}}const uc=Object.create(null);class dc{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new fc(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=va.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?va.empty:t),0==s&&kc(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),kc(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new mc(e):xc(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?xc(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):xc(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 vc(e.node(0))}static atStart(e){return xc(e,e,0,0,1)||new vc(e)}static atEnd(e){return xc(e,e,e.content.size,e.childCount,-1)||new vc(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=uc[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 uc)throw new RangeError("Duplicate use of selection JSON ID "+e);return uc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return mc.between(this.$anchor,this.$head).getBookmark()}}dc.prototype.visible=!0;class fc{constructor(e,t){this.$from=e,this.$to=t}}let pc=!1;function hc(e){pc||e.parent.inlineContent||(pc=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class mc extends dc{constructor(e,t=e){hc(e),hc(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 dc.near(n);let r=e.resolve(t.map(this.anchor));return new mc(r.parent.inlineContent?r:n,n)}replace(e,t=va.empty){if(super.replace(e,t),t==va.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof mc&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gc(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 mc(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=dc.findFrom(t,n,!0)||dc.findFrom(t,-n,!0);if(!e)return dc.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(dc.findFrom(e,-n,!0)||dc.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new mc(e,t)}}dc.jsonID("text",mc);class gc{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gc(e.map(this.anchor),e.map(this.head))}resolve(e){return mc.between(e.resolve(this.anchor),e.resolve(this.head))}}class yc extends dc{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?dc.near(o):new yc(o)}content(){return new va(pa.from(this.node),0,0)}eq(e){return e instanceof yc&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new bc(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new yc(e.resolve(t.anchor))}static create(e,t){return new yc(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}yc.prototype.visible=!1,dc.jsonID("node",yc);class bc{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new gc(n,n):new bc(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&yc.isSelectable(n)?new yc(t):dc.near(t)}}class vc extends dc{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=va.empty){if(t==va.empty){e.delete(0,e.doc.content.size);let t=dc.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vc(e)}map(e){return new vc(e)}eq(e){return e instanceof vc}getBookmark(){return wc}}dc.jsonID("all",vc);const wc={map(){return this},resolve:e=>new vc(e)};function xc(e,t,n,r,o,i=!1){if(t.inlineContent)return mc.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&&yc.isSelectable(r))return yc.create(e,n-(o<0?r.nodeSize:0))}else{let t=xc(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function kc(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof $l||i instanceof Ll)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(dc.near(e.doc.resolve(o),n)))}class Sc extends cc{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 ya.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)||ya.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(dc.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 Ec(e,t){return t&&e?e.bind(t):e}class Mc{constructor(e,t,n){this.name=e,this.init=Ec(t.init,n),this.apply=Ec(t.apply,n)}}const Cc=[new Mc("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Mc("selection",{init:(e,t)=>e.selection||dc.atStart(t.doc),apply:e=>e.selection}),new Mc("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new Mc("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=Cc.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 Mc(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 Sc(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=Ia.fromJSON(e.schema,t.doc);else if("selection"==r.name)o.selection=dc.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 _c(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=_c(o,t,{})),n[r]=o}return n}class Oc{constructor(e){this.spec=e,this.props={},e.props&&_c(e.props,this,this.props),this.key=e.key?e.key.key:Ac("plugin")}getState(e){return e[this.key]}}const Tc=Object.create(null);function Ac(e){return e in Tc?e+"$"+ ++Tc[e]:(Tc[e]=0,e+"$")}class Dc{constructor(e="key"){this.key=Ac(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const $c=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Lc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const jc=(e,t,n)=>{let r=Lc(e,n);if(!r)return!1;let o=Fc(r);if(!o){let n=r.blockRange(),o=n&&Pl(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(Gc(e,o,t,-1))return!0;if(0==r.parent.content.size&&(zc(i,"end")||yc.isSelectable(i)))for(let s=r.depth;;s--){let n=Kl(e.doc,r.before(s),r.after(s),va.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(zc(i,"end")?dc.findFrom(r.doc.resolve(r.mapping.map(o.pos,-1)),-1):yc.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 Ic(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=Kl(e.doc,o,s,va.empty);if(!a||a.from!=o||a instanceof $l&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(mc.create(t.doc,o)),n(t.scrollIntoView())}return!0}function zc(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 Pc=(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=Fc(r)}let s=i&&i.nodeBefore;return!(!s||!yc.isSelectable(s))&&(t&&t(e.tr.setSelection(yc.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Fc(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 Bc(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Hc=(e,t,n)=>{let r=Bc(e,n);if(!r)return!1;let o=qc(r);if(!o)return!1;let i=o.nodeAfter;if(Gc(e,o,t,1))return!0;if(0==r.parent.content.size&&(zc(i,"start")||yc.isSelectable(i))){let n=Kl(e.doc,r.before(),r.after(),va.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(zc(i,"start")?dc.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):yc.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)},Vc=(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=qc(r)}let s=i&&i.nodeAfter;return!(!s||!yc.isSelectable(s))&&(t&&t(e.tr.setSelection(yc.create(e.doc,i.pos)).scrollIntoView()),!0)};function qc(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 Uc=(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 Wc(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 Yc=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof vc||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Wc(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(mc.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Jc=(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(ql(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Pl(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};const Kc=(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof yc&&e.selection.node.isBlock)return!(!n.parentOffset||!ql(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 f=n.depth;;f--){if(n.node(f).isBlock){a=n.end(f)==n.pos+(n.depth-f),l=n.start(f)==n.pos-(n.depth-f),i=Wc(n.node(f-1).contentMatchAt(n.indexAfter(f-1))),s.unshift(a&&i?{type:i}:null),o=f;break}if(1==f)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof mc||e.selection instanceof vc)&&c.deleteSelection();let u=c.mapping.map(n.pos),d=ql(c.doc,u,s.length,s);if(d||(s[0]=i?{type:i}:null,d=ql(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 Gc(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&&!Ul(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=pa.empty;for(let e=o.length-1;e>=0;e--)i=pa.from(o[e].create(null,i));i=pa.from(s.copy(i));let l=e.tr.step(new Ll(t.pos-1,r,t.pos,r,new va(i,1,0),o.length,!0)),c=l.doc.resolve(r+2*o.length);c.nodeAfter&&c.nodeAfter.type==s.type&&Ul(l.doc,c.pos)&&l.join(c.pos),n(l.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&l?null:dc.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Pl(d);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(c&&zc(a,"start",!0)&&zc(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=pa.empty;for(let e=o.length-1;e>=0;e--)r=pa.from(o[e].copy(r));n(e.tr.step(new Ll(t.pos-o.length,t.pos+a.nodeSize,t.pos+l,t.pos+a.nodeSize-l,new va(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Zc(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(mc.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const Qc=Zc(-1),Xc=Zc(1);function eu(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 tu(...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 nu(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 La(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new La(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=Fl(i,n,r,t);if(!a)return!1;e&&function(e,t,n,r,o){let i=pa.empty;for(let u=n.length-1;u>=0;u--)i=pa.from(n[u].type.create(n[u].attrs,i));e.step(new Ll(t.start-(r?2:0),t.end,t.start,t.end,new va(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,f=!0;u<d;u++,f=!1)!f&&ql(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 ru(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 Ll(i-1,s,i,s,new va(pa.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new La(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Pl(r);if(null==a)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);Ul(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,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).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?pa.empty:pa.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Ll(d-(a?1:0),f+(l?1:0),d+1,f-1,new va((a?pa.empty:pa.from(o.copy(pa.empty))).append(l?pa.empty:pa.from(o.copy(pa.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}tu($c,jc,Pc),tu($c,Hc,Vc),tu(Uc,Yc,Jc,Kc),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const ou=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},iu=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let su=null;const au=function(e,t,n){let r=su||(su=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},lu=function(e,t,n,r){return n&&(uu(e,t,n,r,-1)||uu(e,t,n,r,1))},cu=/^(img|br|input|textarea|hr)$/i;function uu(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:du(e))){let n=e.parentNode;if(!n||1!=n.nodeType||fu(e)||cu.test(e.nodeName)||"false"==e.contentEditable)return!1;t=ou(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?du(e):0}}}}function du(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function fu(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 pu=function(e){return e.focusNode&&lu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function hu(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const mu="undefined"!=typeof navigator?navigator:null,gu="undefined"!=typeof document?document:null,yu=mu&&mu.userAgent||"",bu=/Edge\/(\d+)/.exec(yu),vu=/MSIE \d/.exec(yu),wu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(yu),xu=!!(vu||wu||bu),ku=vu?document.documentMode:wu?+wu[1]:bu?+bu[1]:0,Su=!xu&&/gecko\/(\d+)/i.test(yu);Su&&(/Firefox\/(\d+)/.exec(yu)||[0,0])[1];const Eu=!xu&&/Chrome\/(\d+)/.exec(yu),Mu=!!Eu,Cu=Eu?+Eu[1]:0,Nu=!xu&&!!mu&&/Apple Computer/.test(mu.vendor),Ru=Nu&&(/Mobile\/\w+/.test(yu)||!!mu&&mu.maxTouchPoints>2),_u=Ru||!!mu&&/Mac/.test(mu.platform),Ou=!!mu&&/Win/.test(mu.platform),Tu=/Android \d/.test(yu),Au=!!gu&&"webkitFontSmoothing"in gu.documentElement.style,Du=Au?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $u(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 Lu(e,t){return"number"==typeof e?e:e[t]}function ju(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 Iu(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=iu(s);continue}let e=s,n=e==i.body,a=n?$u(i):ju(e),l=0,c=0;if(t.top<a.top+Lu(r,"top")?c=-(a.top-t.top+Lu(o,"top")):t.bottom>a.bottom-Lu(r,"bottom")&&(c=t.bottom-t.top>a.bottom-a.top?t.top+Lu(o,"top")-a.top:t.bottom-a.bottom+Lu(o,"bottom")),t.left<a.left+Lu(r,"left")?l=-(a.left-t.left+Lu(o,"left")):t.right>a.right-Lu(r,"right")&&(l=t.right-a.right+Lu(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:iu(s)}}function zu(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=iu(r));return t}function Pu(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 Fu=null;function Bu(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=au(u).getClientRects()}for(let f=0;f<e.length;f++){let p=e[f];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=Wu(o,1);if(r.top!=r.bottom&&Hu(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}:Bu(n,r)}function Hu(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Vu(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(Hu(t,o))return Vu(n,t,o)}}if((i=(i+1)%r)==o)break}return e}function qu(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(du(r.offsetNode),r.offset)}}catch(r){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(du(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(!Hu(t,n))return null;if(a=Vu(e.dom,t,n),!a)return null}if(Nu)for(let c=a;n&&c;c=iu(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(Su&&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}=Bu(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 Uu(e){return e.top<e.bottom||e.left<e.right}function Wu(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Uu(e))return e}return Array.prototype.find.call(n,Uu)||e.getBoundingClientRect()}const Yu=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ju(e,t,n){let{node:r,offset:o,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Au||Su;if(3==r.nodeType){if(!s||!Yu.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++,Ku(Wu(au(r,e,t),i),i<0)}{let e=Wu(au(r,o,o),n);if(Su&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let t=Wu(au(r,o-1,o-1),-1);if(t.top==e.top){let n=Wu(au(r,o,o+1),-1);if(n.top!=e.top)return Ku(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==du(r))){let e=r.childNodes[o-1];if(1==e.nodeType)return Gu(e.getBoundingClientRect(),!1)}if(null==i&&o<du(r)){let e=r.childNodes[o];if(1==e.nodeType)return Gu(e.getBoundingClientRect(),!0)}return Gu(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==du(r))){let e=r.childNodes[o-1],t=3==e.nodeType?au(e,du(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Ku(Wu(t,1),!1)}if(null==i&&o<du(r)){let e=r.childNodes[o];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?au(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Ku(Wu(t,-1),!0)}return Ku(Wu(3==r.nodeType?au(r):r,-n),n>=0)}function Ku(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 Gu(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 Zu(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 Qu=/[\u0590-\u08ac]/;let Xu=null,ed=null,td=!1;function nd(e,t,n){return Xu==t&&ed==n?td:(Xu=t,ed=n,td="up"==n||"down"==n?function(e,t,n){let r=t.selection,o="up"==n?r.$from:r.$to;return Zu(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=Ju(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=au(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?Qu.test(r.parent.textContent)&&a.modify?Zu(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(),f=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),f}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}class rd{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>ou(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 ud){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 od&&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?ou(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?ou(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=ou(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=ou(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,h=0;p<this.children.length;p++){let s=this.children[p],a=h+s.size;if(o>h&&i<a)return s.setSelection(e-h-s.border,t-h-s.border,n,r);h=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((Su||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:ou(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(Su&&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)&&lu(s.node,s.offset,c.anchorNode,c.anchorOffset)&&lu(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((l.extend||e==t)&&(!u||!Su)){l.collapse(s.node,s.offset);try{e!=t&&l.extend(a.node,a.offset),d=!0}catch(f){}}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 od extends rd{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 id extends rd{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 sd extends rd{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=hl.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new sd(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=sd.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;t<i&&(o=Sd(o,t,i,n)),e>0&&(o=Sd(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 ad extends rd{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=hl.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=bd(c,n,t),l?s=new dd(e,t,n,r,c,u||null,d,l,o,i+1):t.isText?new cd(e,t,n,r,c,d,o):new ad(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=()=>pa.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)&&vd(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 xd(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,f,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(kd);for(let e=0;e<d.length;e++)n(d[e],c,!!l)}else n(u,c,!!l);if(l)p=-1,f=l,l=null;else{if(!(c<e.childCount))break;p=c,f=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 h=i+f.nodeSize;if(f.isText){let e=h;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<h&&(l=f.cut(e-i),f=f.cut(0,e-i),h=e,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;r(f,f.isInline&&!f.isLeaf?a.filter(e=>!e.inline):a.slice(),t.forChild(i,f),p),i=h}}(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?ya.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),fd(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 mc)||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 id(this,o,t,r);e.input.compositionNodes.push(i),this.children=Sd(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(vd(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=gd(this.dom,this.nodeDOM,md(this.outerDeco,this.node,t),md(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 ld(e,t,n,r,o){bd(r,t,e);let i=new ad(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}class cd extends ad{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 cd(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 ud extends rd{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 dd extends ad{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 fd(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=wd(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof sd){let t=r?r.previousSibling:e.lastChild;fd(s.contentDOM,s.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=wd(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}const pd=function(e){e&&(this.nodeName=e)};pd.prototype=Object.create(null);const hd=[new pd];function md(e,t,n){if(0==e.length)return hd;let r=n?hd[0]:new pd,o=[r];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&o.push(r=new pd(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==o.length&&o.push(r=new pd(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 gd(e,t,n,r){if(n==hd&&r==hd)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=hd[0]),o=n}yd(o,s||hd[0],t)}return o}function yd(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 bd(e,t,n){return gd(e,e,hd,md(t,n,1!=e.nodeType))}function vd(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 wd(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class xd{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 sd)){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=sd.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 ad){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&&vd(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)||!vd(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=ad.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=ad.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 od(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 sd;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof cd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Nu||Mu)&&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 ud(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 kd(e,t){return e.type.side-t.type.side}function Sd(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 Ed(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(pu(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&yc.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==du(e);r||o;){if(e==n)return!0;let t=ou(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==du(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new yc(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=Dd(e,u,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return l}function Md(e){return e.editable?e.hasFocus():Ld(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Cd(e,t=!1){let n=e.state.selection;if(Td(e,n),Md(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Mu){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&lu(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,ou(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&xu&&ku<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!Nd||n instanceof mc||(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&&Od(r),o&&Od(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(()=>{Md(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Nd=Nu||Mu&&Cu<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 _d(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return _d(o);if(i)return _d(i)}}function _d(e){return e.contentEditable="true",Nu&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Od(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Td(e,t){if(t instanceof yc){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 Dd(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||mc.between(t,n,r)}function $d(e){return!(e.editable&&!e.hasFocus())&&Ld(e)}function Ld(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 jd(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&&dc.findFrom(i,t)}function Id(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function zd(e,t,n){let r=e.state.selection;if(!(r instanceof mc)){if(r instanceof yc&&r.node.isInline)return Id(e,new mc(t>0?r.$to:r.$from));{let n=jd(e.state,t);return!!n&&Id(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 Id(e,new mc(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=jd(e.state,t);return!!(n&&n instanceof yc)&&Id(e,n)}if(!(_u&&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)&&(yc.isSelectable(i)?Id(e,new yc(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!Au&&Id(e,new mc(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Pd(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Fd(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Bd(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;Su&&1==n.nodeType&&r<Pd(n)&&Fd(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(Fd(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Hd(n))break;{let t=n.previousSibling;for(;t&&Fd(t,-1);)o=n.parentNode,i=ou(t),t=t.previousSibling;if(t)n=t,r=Pd(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?Vd(e,n,r):o&&Vd(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Pd(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!Fd(n.childNodes[r],1))break;o=n,i=++r}else{if(Hd(n))break;{let t=n.nextSibling;for(;t&&Fd(t,1);)o=t.parentNode,i=ou(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Pd(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&Vd(e,o,i)}(e)}function Hd(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Vd(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!fu(e);)t=ou(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&&!fu(e);)t=ou(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(pu(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&&Cd(e)},50)}function qd(e,t){let n=e.state.doc.resolve(t);if(!Mu&&!Ou&&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 Ud(e,t,n){let r=e.state.selection;if(r instanceof mc&&!r.empty||n.indexOf("s")>-1)return!1;if(_u&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=jd(e.state,t);if(n&&n instanceof yc)return Id(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof vc?dc.near(n,t):dc.findFrom(n,t);return!!s&&Id(e,s)}return!1}function Wd(e,t){if(!(e.state.selection instanceof mc))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 Yd(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Jd(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||_u&&72==n&&"c"==r)return Wd(e,-1)||Bd(e,-1);if(46==n&&!t.shiftKey||_u&&68==n&&"c"==r)return Wd(e,1)||Bd(e,1);if(13==n||27==n)return!0;if(37==n||_u&&66==n&&"c"==r){let t=37==n?"ltr"==qd(e,e.state.selection.from)?-1:1:-1;return zd(e,t,r)||Bd(e,t)}if(39==n||_u&&70==n&&"c"==r){let t=39==n?"ltr"==qd(e,e.state.selection.from)?1:-1:1;return zd(e,t,r)||Bd(e,t)}return 38==n||_u&&80==n&&"c"==r?Ud(e,-1,r)||Bd(e,-1):40==n||_u&&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;Yd(e,n,"true"),setTimeout(()=>Yd(e,n,"false"),20)}return!1}(e)||Ud(e,1,r)||Bd(e,1):r==(_u?"m":"c")&&(66==n||73==n||89==n||90==n)}function Kd(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")||hl.fromSchema(e.state.schema),a=sf(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,u=l.firstChild,d=0;for(;u&&1==u.nodeType&&(c=rf[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 Gd(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 va(pa.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=hl.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=sf().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);(n=o&&rf[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;af||(af=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return af.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(Mu?"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")||ol.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!l&&!u),context:o,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Zd.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=pa.from(e.create(n[l+1],o)),i++,s++}return new va(o,i,s)}(nf(s,+u[1],+u[2]),u[4]);else if(s=va.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&&Xd(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=ef(i[i.length-1],r.length));let t=Qd(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return pa.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=nf(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,l)}),s}const Zd=/^(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 Qd(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,pa.from(e));return e}function Xd(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=Xd(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(pa.from(Qd(n,e,o+1))))}}function ef(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,ef(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(pa.empty,!0);return e.copy(n.append(r))}function tf(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=tf(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(pa.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function nf(e,t,n){return t<e.openStart&&(e=new va(tf(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new va(tf(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const rf={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 of=null;function sf(){return of||(of=document.implementation.createHTMLDocument("title"))}let af=null;const lf={},cf={},uf={touchstart:!0,touchmove:!0};class df{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 ff(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function pf(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>hf(e,t))})}function hf(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function mf(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 gf(e){return{left:e.clientX,top:e.clientY}}function yf(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 bf(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 vf(e,t,n,r,o){return yf(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 yc&&(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(yc.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&&(bf(e,yc.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&&yc.isSelectable(r))&&(bf(e,new yc(n)),!0)}(e,n))}function wf(e,t,n,r){return yf(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function xf(e,t,n,r){return yf(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&&(bf(e,mc.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)bf(e,mc.create(r,n+1,n+1+t.content.size));else{if(!yc.isSelectable(t))continue;bf(e,yc.create(r,n))}return!0}}(e,n,r)}function kf(e){return Of(e)}cf.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Mf(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Tu||!Mu||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))||Jd(e,n)?n.preventDefault():ff(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,hu(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},cf.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},cf.keypress=(e,t)=>{let n=t;if(Mf(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||_u&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof mc&&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 Sf=_u?"metaKey":"ctrlKey";lf.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=kf(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[Sf]&&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(gf(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Ef(e,s,n,!!r)):("doubleClick"==i?wf:xf)(e,s.pos,s.inside,n)?n.preventDefault():ff(e,"pointer"))};class Ef{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[Sf],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 yc&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Su||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)),ff(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(()=>Cd(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(gf(e))),this.updateAllowDefault(e),this.allowDefault||!t?ff(this.view,"pointer"):vf(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Nu&&this.mightDrag&&!this.mightDrag.node.isAtom||Mu&&!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)?(bf(this.view,dc.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):ff(this.view,"pointer")}move(e){this.updateAllowDefault(e),ff(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 Mf(e,t){return!!e.composing||!!(Nu&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}lf.touchstart=e=>{e.input.lastTouch=Date.now(),kf(e),ff(e,"pointer")},lf.touchmove=e=>{e.input.lastTouch=Date.now(),ff(e,"pointer")},lf.contextmenu=e=>kf(e);const Cf=Tu?5e3:-1;function Nf(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Of(e),t))}function Rf(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 _f(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=du(e=e.childNodes[t-1])}else{if(!e.parentNode||fu(e))return null;t=ou(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||fu(e))return null;t=ou(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 Of(e,t=!1){if(!(Tu&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Rf(e),t||e.docView&&e.docView.dirty){let n=Ed(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}}cf.compositionstart=cf.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof mc&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||Mu&&Ou&&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(),Of(e,!0),e.markCursor=null;else if(Of(e,!t.selection.empty),Su&&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}Nf(e,Cf)},cf.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++,Nf(e,20))};const Tf=xu&&ku<15||Ru&&Du<604;function Af(e,t,n,r,o){let i=Gd(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||va.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 Df(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," "):""}lf.copy=cf.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Tf?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Kd(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"))},cf.paste=(e,t)=>{let n=t;if(e.composing&&!Tu)return;let r=Tf?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Af(e,Df(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?Af(e,r.value,null,o,t):Af(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class $f{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Lf=_u?"altKey":"ctrlKey";function jf(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[Lf]}lf.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(gf(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof yc?i.to-1:i.to));else if(r&&r.mightDrag)o=yc.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=yc.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Kd(e,a);(!n.dataTransfer.files.length||!Mu||Cu>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Tf?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Tf||n.dataTransfer.setData("text/plain",c),e.dragging=new $f(u,jf(e,n),o)},lf.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},cf.dragover=cf.dragenter=(e,t)=>t.preventDefault(),cf.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(gf(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=Gd(e,Df(t.dataTransfer),Tf?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!jf(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||va.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?Jl(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 f=l.doc.resolve(c);if(u&&yc.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new yc(f));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(Dd(e,f,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},lf.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())&&Cd(e)},20))},lf.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)},lf.beforeinput=(e,t)=>{if(Mu&&Tu&&"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,hu(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 cf)lf[os]=cf[os];function If(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 zf{constructor(e,t){this.toDOM=e,this.spec=t||Vf,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 Bf(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof zf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&If(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Pf{constructor(e,t){this.attrs=e,this.spec=t||Vf}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 Bf(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Pf&&If(this.attrs,e.attrs)&&If(this.spec,e.spec)}static is(e){return e.type instanceof Pf}destroy(){}}class Ff{constructor(e,t){this.attrs=e,this.spec=t||Vf}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 Bf(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 Ff&&If(this.attrs,e.attrs)&&If(this.spec,e.spec)}destroy(){}}class Bf{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Bf(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 Bf(e,e,new zf(t,n))}static inline(e,t,n,r){return new Bf(e,t,new Pf(n,r))}static node(e,t,n,r){return new Bf(e,t,new Ff(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Pf}get widget(){return this.type instanceof zf}}const Hf=[],Vf={};class qf{constructor(e,t){this.local=e.length?e:Hf,this.children=t.length?t:Hf}static create(e,t){return t.length?Gf(t,e,0,Vf):Uf}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==Uf||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Vf)}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:f,offset:p}=r.content.findIndex(u),h=r.maybeChild(f);if(h&&p==u&&p+h.nodeSize==d){let r=a[c+2].mapInner(n,h,t+1,e[c]+i+1,s);r!=Uf?(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=Gf(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 qf(t.sort(Zf),a)}(this.children,i||[],e,t,n,r,o):i?new qf(i.sort(Zf),Hf):Uf}add(e,t){return t.length?this==Uf?qf.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=Jf(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,Gf(s,e,a+1,Vf)),o+=3}});let i=Yf(o?Kf(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new qf(i.length?this.local.concat(i).sort(Zf):this.local,r||this.children)}remove(e){return 0==e.length||this==Uf?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!=Uf?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 qf(r,n):Uf}forChild(e,t){if(this==Uf)return this;if(t.isLeaf)return qf.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 Pf){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 qf(r.sort(Zf),Hf);return n?new Wf([e,n]):e}return n||Uf}eq(e){if(this==e)return!0;if(!(e instanceof qf)||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 Qf(this.localsInner(e))}localsInner(e){if(this==Uf)return Hf;if(e.inlineContent||!this.local.some(Pf.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Pf||t.push(this.local[n]);return t}forEachSet(e){e(this)}}qf.empty=new qf([],[]),qf.removeOverlap=Qf;const Uf=qf.empty;class Wf{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,Vf));return Wf.from(n)}forChild(e,t){if(t.isLeaf)return qf.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Uf&&(o instanceof Wf?n=n.concat(o.members):n.push(o))}return Wf.from(n)}eq(e){if(!(e instanceof Wf)||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?Qf(n?t:t.sort(Zf)):Hf}static from(e){switch(e.length){case 0:return Uf;case 1:return e[0];default:return new Wf(e.every(e=>e instanceof qf)?e:e.reduce((e,t)=>e.concat(t instanceof qf?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Yf(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 Bf(o.from+t,o.to+t,o.type))}return n}function Jf(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 Kf(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Gf(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Jf(e,t,s+n);if(a){i=!0;let e=Gf(a,t,n+s+1,r);e!=Uf&&o.push(s,s+t.nodeSize,e)}});let s=Yf(i?Kf(e):e,-n).sort(Zf);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 qf(s,o):Uf}function Zf(e,t){return e.from-t.from||e.to-t.to}function Qf(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),Xf(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),Xf(t,o+1,i.copy(r.to,i.to)))}}return t}function Xf(e,t,n){for(;t<e.length&&Zf(n,e[t])>0;)t++;e.splice(t,0,n)}function ep(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=Uf&&t.push(r)}),e.cursorWrapper&&t.push(qf.create(e.state.doc,[e.cursorWrapper.deco])),Wf.from(t)}const tp={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},np=xu&&ku<=11;class rp{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 op{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new rp,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]);xu&&ku<=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()}),np&&(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,tp)),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($d(this.view)){if(this.suppressingSelectionUpdates)return Cd(this.view);if(xu&&ku<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&lu(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=iu(o))n.add(o);for(let o=e.anchorNode;o;o=iu(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)&&$d(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(Su&&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&&lp(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&&pu(n)&&(l=Ed(e))&&l.eq(dc.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Cd(e),this.currentSelection.set(n),e.scrollToSelection()):(o>-1||r)&&(o>-1&&(e.docView.markDirty(o,i),function(e){if(ip.has(e))return;if(ip.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Su,sp)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."),sp=!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)||Cd(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(xu&&ku<=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?ou(r)+1:0,s=n.localPosFromDOM(e.target,i,-1),a=o&&o.parentNode==e.target?ou(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 ip=new WeakMap,sp=!1;function ap(e,t){let n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return lu(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function lp(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 cp(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 up=/^(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 dp(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=Ed(e,t);if(n&&!e.state.selection.eq(n)){if(Mu&&Tu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,hu(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}],pu(c)||r.push({node:c.focusNode,offset:c.focusOffset})),Mu&&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,f=e.someProp("domParser")||ol.fromSchema(e.state.schema),p=d.resolve(a),h=null,m=f.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:cp,context:p});if(r&&null!=r[0].pos){let e=r[0].pos,t=r[1]&&r[1].pos;null==t&&(t=e),h={anchor:e+a,head:t+a}}return{doc:m,sel:h,from:a,to:l}}(e,t,n),f=e.state.doc,p=f.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 h=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&&hp(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&&hp(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(h&&e.input.domChangeCount++,(Ru&&e.input.lastIOSEnter>Date.now()-225||Tu)&&o.some(e=>1==e.nodeType&&!up.test(e.nodeName))&&(!h||h.endA>=h.endB)&&e.someProp("handleKeyDown",t=>t(e,hu(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(!h){if(!(r&&u instanceof mc&&!u.empty&&u.$head.sameParent(u.$anchor))||e.composing||d.sel&&d.sel.anchor!=d.sel.head){if(d.sel){let t=fp(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}h={start:u.from,endA:u.to,endB:u.to}}e.state.selection.from<e.state.selection.to&&h.start==h.endB&&e.state.selection instanceof mc&&(h.start>e.state.selection.from&&h.start<=e.state.selection.from+2&&e.state.selection.from>=d.from?h.start=e.state.selection.from:h.endA<e.state.selection.to&&h.endA>=e.state.selection.to-2&&e.state.selection.to<=d.to&&(h.endB+=e.state.selection.to-h.endA,h.endA=e.state.selection.to)),xu&&ku<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>d.from&&"  "==d.doc.textBetween(h.start-d.from-1,h.start-d.from+1)&&(h.start--,h.endA--,h.endB--);let m=d.doc.resolveNoCache(h.start-d.from),g=d.doc.resolveNoCache(h.endB-d.from),y=f.resolve(h.start),b=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.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,hu(13,"Enter"))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>h.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||pp(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(pp(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||pp(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,h.start,h.endA,m,g)&&e.someProp("handleKeyDown",t=>t(e,hu(8,"Backspace"))))return void(Tu&&Mu&&e.domObserver.suppressSelectionUpdates());Mu&&h.endB==h.start&&(e.input.lastChromeDelete=Date.now()),Tu&&!b&&m.start()!=g.start()&&0==g.parentOffset&&m.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==h.endA&&(h.endB-=2,g=d.doc.resolveNoCache(h.endB-d.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,hu(13,"Enter"))})},20));let v,w=h.start,x=h.endA,k=t=>{let n=t||e.state.tr.replace(w,x,d.doc.slice(h.start-d.from,h.endB-d.from));if(d.sel){let t=fp(e,n.doc,d.sel);t&&!(Mu&&e.composing&&t.empty&&(h.start!=h.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(x)-1)||xu&&t.empty&&t.head==w)&&n.setSelection(t)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(b)if(m.pos==g.pos){xu&&ku<=11&&0==m.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Cd(e),20));let t=k(e.state.tr.delete(w,x)),n=f.resolve(h.start).marksAcross(f.resolve(h.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(h.endA==h.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(pa.from(c).eq(e))return{mark:r,type:n}}(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.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 fp(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Dd(e,t.resolve(n.anchor),t.resolve(n.head))}function pp(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 hp(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 mp{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 df,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(wp),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=bp(this),yp(this),this.nodeViews=vp(this),this.docView=ld(this.state.doc,gp(this),ep(this),this.dom,this),this.domObserver=new op(this,(e,t,n,r)=>dp(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in lf){let n=lf[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!mf(e,t)||hf(e,t)||!e.editable&&t.type in cf||n(e,t)},uf[t]?{passive:!0}:void 0)}Nu&&e.dom.addEventListener("input",()=>null),pf(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&&pf(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wp),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&&(Rf(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=vp(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)&&pf(this),this.editable=bp(this),yp(this);let a=ep(this),l=gp(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:zu(e.dom)}}(this);if(i){this.domObserver.stop();let t=u&&(xu||Mu)&&!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=Mu?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=_f(this)),!o&&this.docView.update(e.doc,l,a,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=ld(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 lu(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?Cd(this,t):(Td(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;Pu(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 yc){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Iu(this,t.getBoundingClientRect(),e)}else Iu(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 $f(e.slice,e.move,r<0?void 0:yc.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(xu){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(Fu)return e.focus(Fu);let t=zu(e);e.focus(null==Fu?{get preventScroll(){return Fu={preventScroll:!0},!0}}:void 0),Fu||(Fu=!1,Pu(t,0))}(this.dom),Cd(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 qu(this,e)}coordsAtPos(e,t=1){return Ju(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 nd(this,t||this.state,e)}pasteHTML(e,t){return Af(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Af(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Kd(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,[],ep(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,su=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){hf(e,t)||!lf[t.type]||!e.editable&&t.type in cf||lf[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 ap(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?ap(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function gp(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"),[Bf.node(0,e.state.doc.content.size,t)]}function yp(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:Bf.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function bp(e){return!e.someProp("editable",t=>!1===t(e.state))}function vp(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 wp(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")}mp.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var xp={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:"'"},kp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Sp="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Ep="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mp=0;Mp<10;Mp++)xp[48+Mp]=xp[96+Mp]=String(Mp);for(Mp=1;Mp<=24;Mp++)xp[Mp+111]="F"+Mp;for(Mp=65;Mp<=90;Mp++)xp[Mp]=String.fromCharCode(Mp+32),kp[Mp]=String.fromCharCode(Mp);for(var Cp in xp)kp.hasOwnProperty(Cp)||(kp[Cp]=xp[Cp]);const Np="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Rp="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function _p(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);Np?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 Tp(e){let t=function(e){let t=Object.create(null);for(let n in e)t[_p(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(Sp&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Ep&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?kp:xp)[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)&&!(Rp&&n.ctrlKey&&n.altKey)&&(r=xp[n.keyCode])&&r!=o){let o=t[Op(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var Ap=Object.defineProperty,Dp=(e,t)=>{for(var n in t)Ap(e,n,{get:t[n],enumerable:!0})};function $p(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 Lp=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:$p({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}},jp={};Dp(jp,{blur:()=>Ip,clearContent:()=>zp,clearNodes:()=>Pp,command:()=>Fp,createParagraphNear:()=>Bp,cut:()=>Hp,deleteCurrentNode:()=>Vp,deleteNode:()=>Up,deleteRange:()=>Wp,deleteSelection:()=>Yp,enter:()=>Jp,exitCode:()=>Kp,extendMarkRange:()=>nh,first:()=>rh,focus:()=>ch,forEach:()=>uh,insertContent:()=>dh,insertContentAt:()=>mh,joinBackward:()=>bh,joinDown:()=>yh,joinForward:()=>vh,joinItemBackward:()=>wh,joinItemForward:()=>xh,joinTextblockBackward:()=>kh,joinTextblockForward:()=>Sh,joinUp:()=>gh,keyboardShortcut:()=>Mh,lift:()=>Nh,liftEmptyBlock:()=>Rh,liftListItem:()=>_h,newlineInCode:()=>Oh,resetAttributes:()=>Dh,scrollIntoView:()=>$h,selectAll:()=>Lh,selectNodeBackward:()=>jh,selectNodeForward:()=>Ih,selectParentNode:()=>zh,selectTextblockEnd:()=>Ph,selectTextblockStart:()=>Fh,setContent:()=>Hh,setMark:()=>Sm,setMeta:()=>Em,setNode:()=>Mm,setNodeSelection:()=>Cm,setTextDirection:()=>Nm,setTextSelection:()=>Rm,sinkListItem:()=>_m,splitBlock:()=>Tm,splitListItem:()=>Am,toggleList:()=>Lm,toggleMark:()=>jm,toggleNode:()=>Im,toggleWrap:()=>zm,undoInputRule:()=>Pm,unsetAllMarks:()=>Fm,unsetMark:()=>Bm,unsetTextDirection:()=>Hm,updateAttributes:()=>Vm,wrapIn:()=>qm,wrapInList:()=>Um});var Ip=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),zp=(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=Pl(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),Bp=()=>({state:e,dispatch:t})=>Yc(e,t),Hp=(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 mc(r.doc.resolve(Math.max(s-1,0)))),!0},Vp=()=>({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 qp(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 Up=e=>({tr:t,state:n,dispatch:r})=>{const o=qp(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},Yp=()=>({state:e,dispatch:t})=>$c(e,t),Jp=()=>({commands:e})=>e.keyboardShortcut("Enter"),Kp=()=>({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=Wc(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(dc.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0})(e,t);function Gp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Zp(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Gp(t[r])?t[r].test(e[r]):t[r]===e[r])}function Qp(e,t,n={}){return e.find(e=>e.type===t&&Zp(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Xp(e,t,n={}){return!!Qp(e,t,n)}function eh(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(!Qp([...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&&Xp([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Xp([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function th(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 nh=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=th(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:u}=a;if(o){const e=eh(l,i,t);if(e&&e.from<=c&&e.to>=u){const t=mc.create(s,e.from,e.to);n.setSelection(t)}}return!0},rh=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 oh(e){return e instanceof mc}function ih(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function sh(e,t=null){if(!t)return null;const n=dc.atStart(e),r=dc.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?mc.create(e,ih(0,o,i),ih(e.content.size,o,i)):mc.create(e,ih(t,o,i),ih(t,o,i))}function ah(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function lh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var ch=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(lh()||ah())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||lh()||ah()||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&&!oh(n.state.selection))return s(),!0;const a=sh(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},uh=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),dh=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),fh=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&&fh(r)}return e};function ph(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 fh(n)}function hh(e,t,n){if(e instanceof Ia||e instanceof pa)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 pa.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),hh("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new nl({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?ol.fromSchema(i).parseSlice(ph(e),n.parseOptions):ol.fromSchema(i).parse(ph(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=ol.fromSchema(t);return n.slice?r.parseSlice(ph(e),n.parseOptions).content:r.parse(ph(e),n.parseOptions)}return hh("",t,n)}var mh=(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{hh(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(a){l(a)}try{o=hh(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},f=!0,p=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),f=!!f&&(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 h;if(f){if(Array.isArray(t))h=t.map(e=>e.text||"").join("");else if(t instanceof pa){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),h=e}else h="object"==typeof t&&t&&t.text?t.text:t;r.insertText(h,u,d)}else{h=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,h)}n.updateSelection&&function(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof $l||o instanceof Ll))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(dc.near(e.doc.resolve(s),n))}(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:h})}return!0},gh=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof yc;if(o){if(r.node.isTextblock||!Ul(e.doc,r.from))return!1;n=r.from}else if(n=Yl(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(yc.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),yh=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof yc){if(r.node.isTextblock||!Ul(e.doc,r.to))return!1;n=r.to}else if(n=Yl(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),bh=()=>({state:e,dispatch:t})=>jc(e,t),vh=()=>({state:e,dispatch:t})=>Hc(e,t),wh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Yl(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},xh=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Yl(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},kh=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Lc(e,n);if(!r)return!1;let o=Fc(r);return!!o&&Ic(e,o,t)})(e,t),Sh=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=Bc(e,n);if(!r)return!1;let o=qc(r);return!!o&&Ic(e,o,t)})(e,t);function Eh(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Mh=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}`);lh()||Eh()?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 Ch(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?qp(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=>Zp(e.node.attrs,n,{strict:!1}));if(i)return!!c.length;return c.reduce((e,t)=>e+t.to-t.from,0)>=l}var Nh=(e,t={})=>({state:n,dispatch:r})=>!!Ch(n,qp(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&Pl(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),Rh=()=>({state:e,dispatch:t})=>Jc(e,t),_h=e=>({state:t,dispatch:n})=>ru(qp(e,t.schema))(t,n),Oh=()=>({state:e,dispatch:t})=>Uc(e,t);function Th(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Ah(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 Dh=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Th("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=qp(e,r.schema)),"mark"===a&&(s=th(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,Ah(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(Ah(i.attrs,t))))})})}),l},$h=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Lh=()=>({tr:e,dispatch:t})=>{if(t){const t=new vc(e.doc);e.setSelection(t)}return!0},jh=()=>({state:e,dispatch:t})=>Pc(e,t),Ih=()=>({state:e,dispatch:t})=>Vc(e,t),zh=()=>({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(yc.create(e.doc,n))),!0)})(e,t),Ph=()=>({state:e,dispatch:t})=>Xc(e,t),Fh=()=>({state:e,dispatch:t})=>Qc(e,t);function Bh(e,t,n={},r={}){return hh(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Hh=(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=Bh(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 Vh(e,t){const n=th(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 qh(e,t){const n=new cc(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Uh(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 Wh(e,t,n){if(void 0===e.config[t]&&e.parent)return Wh(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?Wh(e.parent,t,n):null})}return e.config[t]}function Yh(e){return e.map(e=>{const t=Wh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...Yh(t())]:e}).flat(10)}function Jh(e,t){const n=hl.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Kh(e){return"function"==typeof e}function Gh(e,t=void 0,...n){return Kh(e)?t?e.bind(t)(...n):e(...n):e}function Zh(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Qh(e){const t=[],{nodeExtensions:n,markExtensions:r}=Zh(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=Wh(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=Wh(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 Xh(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 em(...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([...Xh(n[e]),...Xh(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function tm(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)=>em(e,t),{})}function nm(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 rm(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 om(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 im(e){return e.sort((e,t)=>{const n=Wh(e,"priority")||100,r=Wh(t,"priority")||100;return n>r?-1:n<r?1:0})}function sm(e){const t=im(Yh(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 am(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 lm(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function cm(e,t){const n=Th("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=qp(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?Vh(e,t):{}}function um(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 dm(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}})})}),um(r)}function fm(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=eh(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 pm(e,t){return t.nodes[e]||t.marks[e]||null}function hm(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 mm(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?th(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Zp(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=>Zp(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 gm(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function ym(e,t){const{nodeExtensions:n}=Zh(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=Gh(Wh(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function bm(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&&(bm(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function vm(e){return e instanceof yc}var wm=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function xm(e,t){const n=t.mapping.mapResult(e.position);return{position:new wm(n.pos),mapResult:n}}function km(e){return new wm(e)}var Sm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=th(e,r.schema);if(o)if(s){const e=Vh(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(oh(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)},Em=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Mm=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=qp(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})=>!!eu(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>eu(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Cm=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=ih(e,0,n.content.size),o=yc.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=mc.atStart(n).from,s=mc.atEnd(n).to,a=ih(r,i,s),l=ih(o,i,s),c=mc.create(n,a,l);t.setSelection(c)}return!0},_m=e=>({state:t,dispatch:n})=>{const r=qp(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=pa.from(n?o.create():null),s=new va(pa.from(o.create(null,pa.from(a.type.create(null,r)))),n?3:1,0),c=i.start,u=i.end;t(e.tr.step(new Ll(c-(n?3:1),u,c,u,s,1,!0)).scrollIntoView())}return!0})(t,n);var o};function Om(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 Tm=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=hm(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof yc&&i.node.isBlock)return!(!a.parentOffset||!ql(s,a.pos))&&(r&&(e&&Om(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 f=u&&d?[{type:d,attrs:c}]:void 0,p=ql(t.doc,t.mapping.map(a.pos),1,f);if(f||p||!ql(t.doc,t.mapping.map(a.pos),1,d?[{type:d}]:void 0)||(p=!0,f=d?[{type:d,attrs:c}]:void 0),r){if(p&&(i instanceof mc&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,f),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&&Om(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},Am=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=qp(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 f=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=pa.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=pa.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={...hm(f,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(pa.from(a.createAndFill(null,c)||void 0));const u=l.before(l.depth-(r-1));n.replace(u,l.after(-o),new va(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(mc.near(n.doc.resolve(d))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,h={...hm(f,d.type.name,d.attrs),...t},m={...hm(f,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:h},{type:p,attrs:m}]:[{type:a,attrs:h}];if(!ql(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},Dm=(e,t)=>{const n=Uh(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)||!Ul(e.doc,n.pos)||(e.join(n.pos),!0)},$m=(e,t)=>{const n=Uh(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)||!Ul(e.doc,r)||(e.join(r),!0)},Lm=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=o.extensionManager,p=qp(e,s.schema),h=qp(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=Uh(e=>ym(e.type.name,d))(m);if(v.depth>=1&&x&&v.depth-x.depth<=1){if(x.node.type===p)return c.liftListItem(h);if(ym(x.node.type.name,d)&&p.validContent(x.node.content)&&a)return l().command(()=>(i.setNodeMarkup(x.pos,p),!0)).command(()=>Dm(i,p)).command(()=>$m(i,p)).run()}return n&&w&&a?l().command(()=>{const e=u().wrapInList(p,r),t=w.filter(e=>f.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>Dm(i,p)).command(()=>$m(i,p)).run():l().command(()=>!!u().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>Dm(i,p)).command(()=>$m(i,p)).run()},jm=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=th(e,r.schema);return mm(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},Im=(e,t,n={})=>({state:r,commands:o})=>{const i=qp(e,r.schema),s=qp(t,r.schema),a=Ch(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})},zm=(e,t={})=>({state:n,commands:r})=>{const o=qp(e,n.schema);return Ch(n,o,t)?r.lift(o):r.wrapIn(o,t)},Pm=()=>({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},Fm=()=>({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},Bm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=th(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=eh(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},Hm=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},Vm=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Th("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=qp(e,r.schema)),"mark"===a&&(s=th(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let u,d,f,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,f=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,f=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(f,p,s.create({...e.attrs,...t}))}))}),l},qm=(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&&Fl(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(qp(e,n.schema),t)(n,r),Um=(e,t={})=>({state:n,dispatch:r})=>nu(qp(e,n.schema),t)(n,r),Wm=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={}}},Ym=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function Jm(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(Gp(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=$p({state:l.state,transaction:s}),f={from:r-(t[0].length-i.length),to:o},{commands:p,chain:h,can:m}=new Lp({editor:n,state:c});null!==e.handler({state:c,range:f,match:t,commands:p,chain:h,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 Km(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Gm(e,t){const n={...e};return Km(e)&&Km(t)&&Object.keys(t).forEach(r=>{Km(t[r])&&Km(e[r])?n[r]=Gm(e[r],t[r]):n[r]=t[r]}),n}var Zm=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{...Gh(Wh(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Gh(Wh(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Gm(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}},Qm=class e extends Zm{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 Xm=class{constructor(e){this.find=e.find,this.handler=e.handler}};function eg(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:u}=new Lp({editor:t,state:n}),d=[];n.doc.nodesBetween(r,o,(e,t)=>{var f,p,h,m,g;if((null==(p=null==(f=e.type)?void 0:f.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const y=null!=(g=null!=(m=null==(h=e.content)?void 0:h.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(Gp(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)},f=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:u,pasteEvent:s,dropEvent:a});d.push(f)})});return d.every(e=>null!==e)}var tg=null;function ng(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=$p({state:e,transaction:l});if(eg({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 Oc({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(tg=t)},r=()=>{tg&&(tg=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=tg;(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"),f=!!d;if(!c&&!u&&!f)return;if(f){let{text:t}=d;"string"==typeof t||(t=Jh(pa.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),h=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof p&&h&&p!==h.b?l({rule:e,state:r,from:p,to:h,pasteEvt:a}):void 0}}))}var rg=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=sm(e),this.schema=function(e,t){var n;const r=Qh(e),{nodeExtensions:o,markExtensions:i}=Zh(e),s=null==(n=o.find(e=>Wh(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=rm({...e.reduce((e,t)=>{const r=Wh(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:Gh(Wh(n,"content",i)),marks:Gh(Wh(n,"marks",i)),group:Gh(Wh(n,"group",i)),inline:Gh(Wh(n,"inline",i)),atom:Gh(Wh(n,"atom",i)),selectable:Gh(Wh(n,"selectable",i)),draggable:Gh(Wh(n,"draggable",i)),code:Gh(Wh(n,"code",i)),whitespace:Gh(Wh(n,"whitespace",i)),linebreakReplacement:Gh(Wh(n,"linebreakReplacement",i)),defining:Gh(Wh(n,"defining",i)),isolating:Gh(Wh(n,"isolating",i)),attrs:Object.fromEntries(o.map(om))}),a=Gh(Wh(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>nm(e,o)));const l=Wh(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:tm(e,o)}));const c=Wh(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=rm({...e.reduce((e,t)=>{const r=Wh(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:Gh(Wh(n,"inclusive",i)),excludes:Gh(Wh(n,"excludes",i)),group:Gh(Wh(n,"group",i)),spanning:Gh(Wh(n,"spanning",i)),code:Gh(Wh(n,"code",i)),attrs:Object.fromEntries(o.map(om))}),a=Gh(Wh(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>nm(e,o)));const l=Wh(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:tm(e,o)})),[n.name,s]}));return new nl({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=Wh(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:pm(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return im([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:pm(t.name,this.schema)},r=[],o=Wh(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&Wh(t,"exitable",n)&&(i.ArrowRight=()=>Qm.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 Oc({props:{handleKeyDown:Tp(i)}});r.push(s);const a=Wh(t,"addInputRules",n);if(gm(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new Oc({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=Jh(pa.from(e),i.schema));const{from:o}=a,s=o+e.length;Jm({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,s)=>Jm({editor:t,from:o,to:i,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Jm({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&&Jm({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=Wh(t,"addPasteRules",n);if(gm(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=ng({editor:e,rules:t});r.push(...n)}}const c=Wh(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return Qh(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Zh(this.extensions);return Object.fromEntries(t.filter(e=>!!Wh(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:qp(t.name,this.schema)},o=Wh(t,"addNodeView",r);if(!o)return[];const i=o();if(!i)return[];return[t.name,(r,o,s,a,l)=>{const c=tm(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 im([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pm(n.name,this.schema)},o=Wh(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return im([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pm(n.name,this.schema)},o=Wh(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}=Zh(this.extensions);return Object.fromEntries(t.filter(e=>!!Wh(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:th(t.name,this.schema)},o=Wh(t,"addMarkView",r);if(!o)return[];return[t.name,(r,i,s)=>{const a=tm(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:pm(e.name,this.schema)};if("mark"===e.type){(null==(t=Gh(Wh(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name)}const r=Wh(e,"onBeforeCreate",n),o=Wh(e,"onCreate",n),i=Wh(e,"onUpdate",n),s=Wh(e,"onSelectionUpdate",n),a=Wh(e,"onTransaction",n),l=Wh(e,"onFocus",n),c=Wh(e,"onBlur",n),u=Wh(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)})}};rg.resolve=sm,rg.sort=im,rg.flatten=Yh;Dp({},{ClipboardTextSerializer:()=>ig,Commands:()=>sg,Delete:()=>ag,Drop:()=>lg,Editable:()=>cg,FocusEvents:()=>dg,Keymap:()=>fg,Paste:()=>pg,Tabindex:()=>hg,TextDirection:()=>mg,focusEventsPluginKey:()=>ug});var og=class e extends Zm{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)}},ig=og.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new Oc({key:new Dc("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=lm(n);return am(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),sg=og.create({name:"commands",addCommands:()=>({...jp})}),ag=og.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=qh(e.before,[e,...t]);dm(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 Tl){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)),f=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(f||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()}}),lg=og.create({name:"drop",addProseMirrorPlugins(){return[new Oc({key:new Dc("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),cg=og.create({name:"editable",addProseMirrorPlugins(){return[new Oc({key:new Dc("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ug=new Dc("focusEvents"),dg=og.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Oc({key:ug,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}}}})]}}),fg=og.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:dc.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 lh()||Eh()?o:r},addProseMirrorPlugins(){return[new Oc({key:new Dc("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=dc.atStart(t.doc).from,c=dc.atEnd(t.doc).to;if(i||!(s===l&&a===c))return;if(!bm(n.doc))return;const u=n.tr,d=$p({state:n,transaction:u}),{commands:f}=new Lp({editor:this.editor,state:d});return f.clearNodes(),u.steps.length?u:void 0}})]}}),pg=og.create({name:"paste",addProseMirrorPlugins(){return[new Oc({key:new Dc("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),hg=og.create({name:"tabindex",addProseMirrorPlugins(){return[new Oc({key:new Dc("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),mg=og.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=Zh(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 Oc({key:new Dc("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),gg=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 yg=class extends Wm{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:xm,createMappablePosition:km},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=sh(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=Kh(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?[cg,ig.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),sg,dg,fg,hg,lg,pg,ag,mg.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 rg(n,this)}createCommandManager(){this.commandManager=new Lp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Bh(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=Bh(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 mp(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 cm(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 Ch(e,null,n)||mm(e,null,n);const r=Th(t,e.schema);return"node"===r?Ch(e,t,n):"mark"===r&&mm(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Jh(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return am(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...lm(this.schema),...n}})}get isEmpty(){return bm(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 gg(t,this)}get $doc(){return this.$pos(0)}};function bg(e){return new Ym({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Gh(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(fm(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 vg(e){return new Ym({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=Gh(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 wg(e){return new Ym({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=Gh(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Fl(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&&Ul(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function xg(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 kg(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 Sg(e){const{nodeName:t,name:n,parseAttributes:r=xg,serializeAttributes:o=kg,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 Eg(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=xg,serializeAttributes:i=kg,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,f=o(d);let p=1;const h=u.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(h);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,h+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:f,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 Mg(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 Cg(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=Mg,serializeAttributes:i=Cg,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],f=e.match(t.itemPattern);if(!f){if(l.length>0)break;if(""===e.trim()){u+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(f),{indentLevel:h,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)>h){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)>h))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(h+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 _g(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")}Dp({},{createAtomBlockMarkdownSpec:()=>Sg,createBlockMarkdownSpec:()=>Eg,createInlineMarkdownSpec:()=>Ng,parseAttributes:()=>xg,parseIndentedBlocks:()=>Rg,renderNestedMarkdownContent:()=>_g,serializeAttributes:()=>kg});var Og=class e extends Zm{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 Tg(e){return new Xm({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=Gh(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(fm(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:Dg}=Object,{hasOwnProperty:$g}=Object.prototype;function Lg(e,t){return function(n,r,o){return e(n,r,o)&&t(n,r,o)}}function jg(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 Ig(e){return Ag(e).concat(Dg(e))}const zg=Object.hasOwn||((e,t)=>$g.call(e,t));function Pg(e,t){return e===t||!e&&!t&&e!=e&&t!=t}const{getOwnPropertyDescriptor:Fg,keys:Bg}=Object;function Hg(e,t){return e.byteLength===t.byteLength&&ty(new Uint8Array(e),new Uint8Array(t))}function Vg(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 qg(e,t){return e.byteLength===t.byteLength&&ty(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Ug(e,t){return Pg(e.getTime(),t.getTime())}function Wg(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Yg(e,t){return e===t}function Jg(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 Kg=Pg;function Gg(e,t,n){const r=Bg(e);let o=r.length;if(Bg(t).length!==o)return!1;for(;o-- >0;)if(!ry(e,t,n,r[o]))return!1;return!0}function Zg(e,t,n){const r=Ig(e);let o,i,s,a=r.length;if(Ig(t).length!==a)return!1;for(;a-- >0;){if(o=r[a],!ry(e,t,n,o))return!1;if(i=Fg(e,o),s=Fg(t,o),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable))return!1}return!0}function Qg(e,t){return Pg(e.valueOf(),t.valueOf())}function Xg(e,t){return e.source===t.source&&e.flags===t.flags}function ey(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 ty(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 ny(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 ry(e,t,n,r){return!("_owner"!==r&&"__o"!==r&&"__v"!==r||!e.$$typeof&&!t.$$typeof)||zg(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const oy={"[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},iy=Object.prototype.toString;function sy({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:f,areUrlsEqual:p,unknownTagComparators:h}){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=iy.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(oy[w])return f(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(h){let e=h[w];if(!e){const t=null!=(x=m)?x[Symbol.toStringTag]:void 0;t&&(e=h[t])}if(e)return e(m,g,y)}var x;return!1}}const ay=ly();function ly(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:o=!1}=e,i=function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Hg,areArraysEqual:n?Zg:Vg,areDataViewsEqual:qg,areDatesEqual:Ug,areErrorsEqual:Wg,areFunctionsEqual:Yg,areMapsEqual:n?Lg(Jg,Zg):Jg,areNumbersEqual:Kg,areObjectsEqual:n?Zg:Gg,arePrimitiveWrappersEqual:Qg,areRegExpsEqual:Xg,areSetsEqual:n?Lg(ey,Zg):ey,areTypedArraysEqual:n?Lg(ty,Zg):ty,areUrlsEqual:ny,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const e=jg(r.areArraysEqual),t=jg(r.areMapsEqual),n=jg(r.areObjectsEqual),o=jg(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:o})}return r}(e),s=sy(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})}ly({strict:!0}),ly({circular:!0}),ly({circular:!0,strict:!0}),ly({createInternalComparator:()=>Pg}),ly({strict:!0,createInternalComparator:()=>Pg}),ly({circular:!0,createInternalComparator:()=>Pg}),ly({circular:!0,createInternalComparator:()=>Pg,strict:!0});var cy,uy,dy={exports:{}},fy={};var py=(uy||(uy=1,dy.exports=function(){if(cy)return fy;cy=1;var t=e,n=ia(),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 fy.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=a(function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==u&&f.hasValue){var t=f.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(){f.hasValue=!0,f.value=p},[p]),l(p),p},fy}()),dy.exports),hy=(...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})},my=({contentComponent:e})=>{const t=sa.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return aa(ca,{children:Object.values(t)})};var gy=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 la(ca,{children:[aa("div",{ref:hy(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&aa(my,{contentComponent:e.contentComponent})]})}},yy=e.forwardRef((t,n)=>{const r=e.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[t.editor]);return e.createElement(gy,{key:r,innerRef:n,...t})}),by=e.memo(yy),vy="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,wy=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 xy="undefined"==typeof window,ky=xy||Boolean("undefined"!=typeof window&&window.next),Sy=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?xy||ky?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 yg(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 Ey(t={},n=[]){const r=e.useRef(t);r.current=t;const[o]=e.useState(()=>new Sy(r)),i=sa.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 wy(t.editor)),o=py.useSyncExternalStoreWithSelector(r.subscribe,r.getSnapshot,r.getServerSnapshot,t.selector,null!=(n=t.equalityFn)?n:ay);vy(()=>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 My=e.createContext({editor:null});My.Consumer;var Cy=e.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});e.forwardRef((t,n)=>{const{onDragStart:r}=e.useContext(Cy);return aa(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 aa(My.Provider,{value:s,children:aa(Ny.Provider,{value:i,children:r})})}function _y({...t}){const{editor:n}=e.useContext(Ny);return aa(by,{editor:n,...t})}Ry.displayName="Tiptap",_y.displayName="Tiptap.Content",Object.assign(Ry,{Content:_y});var Oy=(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]},Ty=/^\s*>\s$/,Ay=Og.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Oy("blockquote",{...em(this.options.HTMLAttributes,e),children:Oy("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[wg({find:Ty,type:this.type})]}}),Dy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,$y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Ly=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,jy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Iy=Qm.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 Oy("strong",{...em(this.options.HTMLAttributes,e),children:Oy("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[bg({find:Dy,type:this.type}),bg({find:Ly,type:this.type})]},addPasteRules(){return[Tg({find:$y,type:this.type}),Tg({find:jy,type:this.type})]}}),zy=/(^|[^`])`([^`]+)`(?!`)$/,Py=/(^|[^`])`([^`]+)`(?!`)/g,Fy=Qm.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",em(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[bg({find:zy,type:this.type})]},addPasteRules(){return[Tg({find:Py,type:this.type})]}}),By=/^```([a-z]+)?[\s\n]$/,Hy=/^~~~([a-z]+)?[\s\n]$/,Vy=Og.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",em(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 f=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",p=Math.min(f.length,n);if(0===p)return!0;let h=s;for(let n=0;n<c;n+=1)h+=l[n].length+1;e.delete(h,h+p);return o-h<=p&&e.setSelection(mc.create(e.doc,h)),!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(dc.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[vg({find:By,type:this.type,getAttributes:e=>({language:e[1]})}),vg({find:Hy,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Oc({key:new Dc("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(mc.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),qy=Og.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),Uy=Og.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",em(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()}}}),Wy=Og.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]}`,em(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=>vg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),Yy=Og.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",em(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 yc){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 vm(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(mc.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(yc.create(t.doc,n.pos)):t.setSelection(mc.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(mc.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Ym({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Gh(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}}),Jy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ky=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Gy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Zy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Qy=Qm.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",em(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[bg({find:Jy,type:this.type}),bg({find:Gy,type:this.type})]},addPasteRules(){return[Tg({find:Ky,type:this.type}),Tg({find:Zy,type:this.type})]}});const Xy="numeric",eb="ascii",tb="alpha",nb="asciinumeric",rb="alphanumeric",ob="domain",ib="emoji",sb="scheme",ab="slashscheme",lb="whitespace";function cb(e,t){return e in t||(t[e]=[]),t[e]}function ub(e,t,n){t[Xy]&&(t[nb]=!0,t[rb]=!0),t[eb]&&(t[nb]=!0,t[tb]=!0),t[nb]&&(t[rb]=!0),t[tb]&&(t[rb]=!0),t[rb]&&(t[ob]=!0),t[ib]&&(t[ob]=!0);for(const r in t){const t=cb(r,n);t.indexOf(e)<0&&t.push(e)}}function db(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}db.groups={},db.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||db.groups,t&&t.j?o=t:(o=new db(t),n&&r&&ub(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||db.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 db,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new db,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);ub(i,e,r)}else n&&ub(i,n,r);s.t=i}return o.j[e]=s,s}};const fb=(e,t,n,r,o)=>e.ta(t,n,r,o),pb=(e,t,n,r,o)=>e.tr(t,n,r,o),hb=(e,t,n,r,o)=>e.ts(t,n,r,o),mb=(e,t,n,r,o)=>e.tt(t,n,r,o),gb="WORD",yb="UWORD",bb="ASCIINUMERICAL",vb="ALPHANUMERICAL",wb="LOCALHOST",xb="TLD",kb="UTLD",Sb="SCHEME",Eb="SLASH_SCHEME",Mb="NUM",Cb="WS",Nb="NL",Rb="OPENBRACE",_b="CLOSEBRACE",Ob="OPENBRACKET",Tb="CLOSEBRACKET",Ab="OPENPAREN",Db="CLOSEPAREN",$b="OPENANGLEBRACKET",Lb="CLOSEANGLEBRACKET",jb="FULLWIDTHLEFTPAREN",Ib="FULLWIDTHRIGHTPAREN",zb="LEFTCORNERBRACKET",Pb="RIGHTCORNERBRACKET",Fb="LEFTWHITECORNERBRACKET",Bb="RIGHTWHITECORNERBRACKET",Hb="FULLWIDTHLESSTHAN",Vb="FULLWIDTHGREATERTHAN",qb="AMPERSAND",Ub="APOSTROPHE",Wb="ASTERISK",Yb="AT",Jb="BACKSLASH",Kb="BACKTICK",Gb="CARET",Zb="COLON",Qb="COMMA",Xb="DOLLAR",ev="DOT",tv="EQUALS",nv="EXCLAMATION",rv="HYPHEN",ov="PERCENT",iv="PIPE",sv="PLUS",av="POUND",lv="QUERY",cv="QUOTE",uv="FULLWIDTHMIDDLEDOT",dv="SEMI",fv="SLASH",pv="TILDE",hv="UNDERSCORE",mv="EMOJI",gv="SYM";var yv=Object.freeze({__proto__:null,ALPHANUMERICAL:vb,AMPERSAND:qb,APOSTROPHE:Ub,ASCIINUMERICAL:bb,ASTERISK:Wb,AT:Yb,BACKSLASH:Jb,BACKTICK:Kb,CARET:Gb,CLOSEANGLEBRACKET:Lb,CLOSEBRACE:_b,CLOSEBRACKET:Tb,CLOSEPAREN:Db,COLON:Zb,COMMA:Qb,DOLLAR:Xb,DOT:ev,EMOJI:mv,EQUALS:tv,EXCLAMATION:nv,FULLWIDTHGREATERTHAN:Vb,FULLWIDTHLEFTPAREN:jb,FULLWIDTHLESSTHAN:Hb,FULLWIDTHMIDDLEDOT:uv,FULLWIDTHRIGHTPAREN:Ib,HYPHEN:rv,LEFTCORNERBRACKET:zb,LEFTWHITECORNERBRACKET:Fb,LOCALHOST:wb,NL:Nb,NUM:Mb,OPENANGLEBRACKET:$b,OPENBRACE:Rb,OPENBRACKET:Ob,OPENPAREN:Ab,PERCENT:ov,PIPE:iv,PLUS:sv,POUND:av,QUERY:lv,QUOTE:cv,RIGHTCORNERBRACKET:Pb,RIGHTWHITECORNERBRACKET:Bb,SCHEME:Sb,SEMI:dv,SLASH:fv,SLASH_SCHEME:Eb,SYM:gv,TILDE:pv,TLD:xb,UNDERSCORE:hv,UTLD:kb,UWORD:yb,WORD:gb,WS:Cb});const bv=/[a-z]/,vv=new RegExp("\\p{L}","u"),wv=new RegExp("\\p{Emoji}","u"),xv=/\d/,kv=/\s/;let Sv=null,Ev=null;function Mv(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,f=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function Cv(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 db(r),i.jr=o.slice(),e.j[n]=i),e=i}return i=new db(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:Ov,formatHref:Ov,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function _v(e,t=null){let n=Object.assign({},Rv);e&&(n=Object.assign(n,e instanceof _v?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 Ov(e){return e}function Tv(e,t){this.t="token",this.v=e,this.tk=t}function Av(e,t){class n extends Tv{constructor(t,n){super(t,n),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}_v.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)}},Tv.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 Dv=Av("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$v=Av("text"),Lv=Av("nl"),jv=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!==wb&&e[1].t===Zb}}),Iv=e=>new db(e);function zv(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const Pv="undefined"!=typeof console&&console&&console.warn||(()=>{}),Fv={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bv(e,t=!1){if(Fv.initialized&&Pv(`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');Fv.customSchemes.push([e,t])}function Hv(){Fv.scanner=function(e=[]){const t={};db.groups=t;const n=new db;null==Sv&&(Sv=Nv("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Ev&&(Ev=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")),mb(n,"'",Ub),mb(n,"{",Rb),mb(n,"}",_b),mb(n,"[",Ob),mb(n,"]",Tb),mb(n,"(",Ab),mb(n,")",Db),mb(n,"<",$b),mb(n,">",Lb),mb(n,"(",jb),mb(n,")",Ib),mb(n,"「",zb),mb(n,"」",Pb),mb(n,"『",Fb),mb(n,"』",Bb),mb(n,"<",Hb),mb(n,">",Vb),mb(n,"&",qb),mb(n,"*",Wb),mb(n,"@",Yb),mb(n,"`",Kb),mb(n,"^",Gb),mb(n,":",Zb),mb(n,",",Qb),mb(n,"$",Xb),mb(n,".",ev),mb(n,"=",tv),mb(n,"!",nv),mb(n,"-",rv),mb(n,"%",ov),mb(n,"|",iv),mb(n,"+",sv),mb(n,"#",av),mb(n,"?",lv),mb(n,'"',cv),mb(n,"/",fv),mb(n,";",dv),mb(n,"~",pv),mb(n,"_",hv),mb(n,"\\",Jb),mb(n,"・",uv);const r=pb(n,xv,Mb,{[Xy]:!0});pb(r,xv,r);const o=pb(r,bv,bb,{[nb]:!0}),i=pb(r,vv,vb,{[rb]:!0}),s=pb(n,bv,gb,{[eb]:!0});pb(s,xv,o),pb(s,bv,s),pb(o,xv,o),pb(o,bv,o);const a=pb(n,vv,yb,{[tb]:!0});pb(a,bv),pb(a,xv,i),pb(a,vv,a),pb(i,xv,i),pb(i,bv),pb(i,vv,i);const l=mb(n,"\n",Nb,{[lb]:!0}),c=mb(n,"\r",Cb,{[lb]:!0}),u=pb(n,kv,Cb,{[lb]:!0});mb(n,"",u),mb(c,"\n",l),mb(c,"",u),pb(c,kv,u),mb(u,"\r"),mb(u,"\n"),pb(u,kv,u),mb(u,"",u);const d=pb(n,wv,mv,{[ib]:!0});mb(d,"#"),pb(d,wv,d),mb(d,"️",d);const f=mb(d,"‍");mb(f,"#"),pb(f,wv,d);const p=[[bv,s],[xv,o]],h=[[bv,null],[vv,a],[xv,i]];for(let m=0;m<Sv.length;m++)Cv(n,Sv[m],xb,gb,p);for(let m=0;m<Ev.length;m++)Cv(n,Ev[m],kb,yb,h);ub(xb,{tld:!0,ascii:!0},t),ub(kb,{utld:!0,alpha:!0},t),Cv(n,"file",Sb,gb,p),Cv(n,"mailto",Sb,gb,p),Cv(n,"http",Eb,gb,p),Cv(n,"https",Eb,gb,p),Cv(n,"ftp",Eb,gb,p),Cv(n,"ftps",Eb,gb,p),ub(Sb,{scheme:!0,ascii:!0},t),ub(Eb,{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]?{[sb]:!0}:{[ab]:!0};t.indexOf("-")>=0?r[ob]=!0:bv.test(t)?xv.test(t)?r[nb]=!0:r[eb]=!0:r[Xy]=!0,hb(n,t,t,r)}return hb(n,"localhost",wb,{ascii:!0}),n.jd=new db(gv),{start:n,tokens:Object.assign({groups:t},yv)}}(Fv.customSchemes);for(let e=0;e<Fv.tokenQueue.length;e++)Fv.tokenQueue[e][1]({scanner:Fv.scanner});Fv.parser=function({groups:e}){const t=e.domain.concat([qb,Wb,Yb,Jb,Kb,Gb,Xb,tv,rv,Mb,ov,iv,sv,av,fv,gv,pv,hv]),n=[Ub,Zb,Qb,ev,nv,ov,lv,cv,dv,$b,Lb,Rb,_b,Tb,Ob,Ab,Db,jb,Ib,zb,Pb,Fb,Bb,Hb,Vb],r=[qb,Ub,Wb,Jb,Kb,Gb,Xb,tv,rv,Rb,_b,ov,iv,sv,av,lv,fv,gv,pv,hv],o=Iv(),i=mb(o,pv);fb(i,r,i),fb(i,e.domain,i);const s=Iv(),a=Iv(),l=Iv();fb(o,e.domain,s),fb(o,e.scheme,a),fb(o,e.slashscheme,l),fb(s,r,i),fb(s,e.domain,s);const c=mb(s,Yb);mb(i,Yb,c),mb(a,Yb,c),mb(l,Yb,c);const u=mb(i,ev);fb(u,r,i),fb(u,e.domain,i);const d=Iv();fb(c,e.domain,d),fb(d,e.domain,d);const f=mb(d,ev);fb(f,e.domain,d);const p=Iv(Dv);fb(f,e.tld,p),fb(f,e.utld,p),mb(c,wb,p);const h=mb(d,rv);mb(h,rv,h),fb(h,e.domain,d),fb(p,e.domain,d),mb(p,ev,f),mb(p,rv,h);const m=mb(p,Zb);fb(m,e.numeric,Dv);const g=mb(s,rv),y=mb(s,ev);mb(g,rv,g),fb(g,e.domain,s),fb(y,r,i),fb(y,e.domain,s);const b=Iv(jv);fb(y,e.tld,b),fb(y,e.utld,b),fb(b,e.domain,s),fb(b,r,i),mb(b,ev,y),mb(b,rv,g),mb(b,Yb,c);const v=mb(b,Zb),w=Iv(jv);fb(v,e.numeric,w);const x=Iv(jv),k=Iv();fb(x,t,x),fb(x,n,k),fb(k,t,x),fb(k,n,k),mb(b,fv,x),mb(w,fv,x);const S=mb(a,Zb),E=mb(l,Zb),M=mb(E,fv),C=mb(M,fv);fb(a,e.domain,s),mb(a,ev,y),mb(a,rv,g),fb(l,e.domain,s),mb(l,ev,y),mb(l,rv,g),fb(S,e.domain,x),mb(S,fv,x),mb(S,lv,x),fb(C,e.domain,x),fb(C,t,x),mb(C,fv,x);const N=[[Rb,_b],[Ob,Tb],[Ab,Db],[$b,Lb],[jb,Ib],[zb,Pb],[Fb,Bb],[Hb,Vb]];for(let R=0;R<N.length;R++){const[e,r]=N[R],o=mb(x,e);mb(k,e,o),mb(o,r,x);const i=Iv(jv);fb(o,t,i);const s=Iv();fb(o,n),fb(i,t,i),fb(i,n,s),fb(s,t,i),fb(s,n,s),mb(i,r,x),mb(s,r,x)}return mb(o,wb,b),mb(o,Nb,Lv),{start:o,tokens:yv}}(Fv.scanner.tokens);for(let e=0;e<Fv.pluginQueue.length;e++)Fv.pluginQueue[e][1]({scanner:Fv.scanner,parser:Fv.parser});return Fv.initialized=!0,Fv}function Vv(e){return Fv.initialized||Hv(),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,f=-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()?(f=0,d=a):f>=0&&f++,o++,u++;if(f<0)o-=u,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(zv($v,t,s)),s=[]),o-=f,u-=f;const e=d.t,r=n.slice(o-u,o);i.push(zv(e,t,r))}}return s.length>0&&i.push(zv($v,t,s)),i}(Fv.parser.start,e,Mv(Fv.scanner.start,e))}function qv(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 _v(n),o=Vv(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}Vv.scan=Mv;var Uv="[\0-   ᠎ -\u2029  ]",Wv=new RegExp(Uv),Yv=new RegExp(`${Uv}$`),Jv=new RegExp(Uv,"g");function Kv(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(Jv,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Gv=Qm.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?Bv(e.scheme,e.optionalSlashes):Bv(e)})},onDestroy(){db.groups={},Fv.scanner=null,Fv.parser=null,Fv.tokenQueue=[],Fv.pluginQueue=[],Fv.customSchemes=[],Fv.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)=>!!Kv(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=>!!Kv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Kv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",em(this.options.HTMLAttributes,e),0]:["a",em(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=>!!Kv(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=>!!Kv(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[Tg({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=qv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Kv(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=>!!Kv(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new Oc({key:new Dc("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 dm(qh(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(!Yv.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(Wv).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=Vv(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=>{fm(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 Oc({key:new Dc("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=cm(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 Oc({key:new Dc("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=qv(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}}),Zv=Gv,Qv=Object.defineProperty,Xv="textStyle",ew=/^\s*([-+*])\s$/,tw=Og.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",em(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(Xv)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=wg({find:ew,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=wg({find:ew,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xv),editor:this.editor})),[e]}}),nw=Og.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",em(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)=>_g(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)Qv(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>rw,getNextListDepth:()=>ow,handleBackspace:()=>lw,handleDelete:()=>dw,hasListBefore:()=>iw,hasListItemAfter:()=>fw,hasListItemBefore:()=>sw,listItemHasSubList:()=>aw,nextListIsDeeper:()=>cw,nextListIsHigher:()=>uw});var rw=(e,t)=>{const{$from:n}=t.selection,r=qp(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}},ow=(e,t)=>{const n=rw(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},iw=(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))},sw=(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},aw=(e,t,n)=>{if(!n)return!1;const r=qp(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},lw=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ch(e.state,t)&&iw(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(!Ch(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=rw(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=aw(t,e.state,o);return sw(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},cw=(e,t)=>{const n=ow(e,t),r=rw(e,t);return!(!r||!n)&&n>r.depth},uw=(e,t)=>{const n=ow(e,t),r=rw(e,t);return!(!r||!n)&&n<r.depth},dw=(e,t)=>{if(!Ch(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=Uh(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))&&(cw(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():uw(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},fw=(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},pw=og.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]&&dw(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]&&dw(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]&&lw(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]&&lw(e,n,r)&&(t=!0)}),t}}}}),hw=/^(\s*)(\d+)\.\s+(.*)$/,mw=/^\s/;function gw(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 f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){const e=Math.min(...f.map(e=>e.indent)),t=gw(f,e,n);c.push({type:"list",ordered:!0,start:f[0].number,items:t,raw:f.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=d}else i+=1}return o}var yw="textStyle",bw=/^(\d+)\.\s$/,vw=Og.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",em(this.options.HTMLAttributes,n),0]:["ol",em(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(hw);if(!i)break;const[,s,a,l]=i,c=s.length;let u=l,d=n+1;const f=[o];for(;d<e.length;){const t=e[d];if(t.match(hw))break;if(""===t.trim())f.push(t),u+="\n",d+=1;else{if(!t.match(mw))break;f.push(t),u+=`\n${t.slice(c+2)}`,d+=1}}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join("\n")}),r=d,n=d}return[t,r]}(o);if(0===i.length)return;const a=gw(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(yw)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=wg({find:bw,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=wg({find:bw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(yw)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),ww=/^\s*(\[([( |x])?\])\s$/,xw=Og.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",em(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 _g(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=tm(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[wg({find:ww,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),kw=Og.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",em(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()}}});og.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(tw.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(nw.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(pw.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(vw.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(xw.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(kw.configure(this.options.taskList)),e}});var Sw="&nbsp;",Ew=Og.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",em(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!==Sw&&" "!==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?Sw:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Mw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Nw=Qm.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",em(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[bg({find:Mw,type:this.type})]},addPasteRules(){return[Tg({find:Cw,type:this.type})]}}),Rw=Og.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),_w=Qm.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",em(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()}}}),Ow=_w;function Tw(e={}){return new Oc({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=Jl(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 Dw extends dc{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Dw.valid(n)?new Dw(n):dc.near(n)}content(){return va.empty}eq(e){return e instanceof Dw&&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 Dw(e.resolve(t.pos))}getBookmark(){return new $w(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||Lw(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||Lw(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&&Dw.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(Dw.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!yc.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(Dw.valid(s))return s}return null}}}Dw.prototype.visible=!1,Dw.findFrom=Dw.findGapCursorFrom,dc.jsonID("gapcursor",Dw);class $w{constructor(e){this.pos=e}map(e){return new $w(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Dw.valid(t)?new Dw(t):dc.near(t)}}function Lw(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const jw=Tp({ArrowLeft:Iw("horiz",-1),ArrowRight:Iw("horiz",1),ArrowUp:Iw("vert",-1),ArrowDown:Iw("vert",1)});function Iw(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 mc){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=Dw.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new Dw(l))),!0)}}function zw(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Dw.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&yc.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new Dw(r))),!0)}function Pw(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Dw))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=pa.empty;for(let s=r.length-1;s>=0;s--)o=pa.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new va(o,0,0));return i.setSelection(mc.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Fw(e){if(!(e.selection instanceof Dw))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",qf.create(e.doc,[Bf.widget(e.selection.head,t,{key:"gapcursor"})])}var Bw=200,Hw=function(){};Hw.prototype.append=function(e){return e.length?(e=Hw.from(e),!this.length&&e||e.length<Bw&&this.leafAppend(e)||this.length<Bw&&e.leafPrepend(this)||this.appendInner(e)):this},Hw.prototype.prepend=function(e){return e.length?Hw.from(e).append(this):this},Hw.prototype.appendInner=function(e){return new qw(this,e)},Hw.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Hw.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Hw.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Hw.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)},Hw.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},Hw.from=function(e){return e instanceof Hw?e:e&&e.length?new Vw(e):Hw.empty};var Vw=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<=Bw)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Bw)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}(Hw);Hw.empty=new Vw([]);var qw=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}(Hw);class Uw{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 Ww(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 Ww(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 Uw(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 Ww(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>Jw&&(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 Uw(s.append(o),i)}remapping(e,t){let n=new Ml;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 Uw(this.items.append(e.map(e=>new Ww(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 Ww(l,i,c))}else n.push(new Ww(l))},r);let l=[];for(let d=t;d<i;d++)l.push(new Ww(o.maps[d]));let c=this.items.slice(0,r).append(l).append(n),u=new Uw(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 Ww(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 Uw(Hw.from(r.reverse()),o)}}Uw.empty=new Uw(Hw.empty,0);class Ww{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 Ww(t.getMap().invert(),t,this.selection)}}}class Yw{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const Jw=20;function Kw(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 Gw(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 Zw=!1,Qw=null;function Xw(e){let t=e.plugins;if(Qw!=t){Zw=!1,Qw=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Zw=!0;break}}return Zw}const ex=new Dc("history"),tx=new Dc("closeHistory");function nx(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Oc({key:ex,state:{init:()=>new Yw(Uw.empty,Uw.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(ex);if(i)return i.historyState;n.getMeta(tx)&&(e=new Yw(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(ex))return s.getMeta(ex).redo?new Yw(e.done.addTransform(n,void 0,r,Xw(t)),e.undone,Kw(n.mapping.maps),e.prevTime,e.prevComposition):new Yw(e.done,e.undone.addTransform(n,void 0,r,Xw(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new Yw(e.done.rebased(n,o),e.undone.rebased(n,o),Gw(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Yw(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Gw(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?Gw(e.prevRanges,n.mapping):Kw(n.mapping.maps);return new Yw(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,Xw(t)),Uw.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?ox:"historyRedo"==n?ix:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function rx(e,t){return(n,r)=>{let o=ex.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=Xw(t),o=ex.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 Yw(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(ex,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const ox=rx(!1,!0),ix=rx(!0,!0);og.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 Oc({key:new Dc("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 sx=og.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Tw(this.options)]}});og.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new Oc({key:new Dc("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return qf.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(Bf.node(t,t+e.nodeSize,{class:this.options.className}))}),qf.create(e,i)}}})]}});var ax=og.create({name:"gapCursor",addProseMirrorPlugins:()=>[new Oc({props:{decorations:Fw,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Dw.valid(n)?new Dw(n):null,handleClick:zw,handleKeyDown:jw,handleDOMEvents:{beforeinput:Pw}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=Gh(Wh(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),lx="placeholder";var cx=og.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:lx,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-${lx}`;var t;return[new Oc({key:new Dc("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&&bm(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=Bf.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}),qf.create(t,i)}}})]}});function ux({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}og.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Oc({key:new Dc("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||vm(n.selection)||e.view.dragging?null:qf.create(n.doc,[Bf.inline(n.selection.from,n.selection.to,{class:t.className})])}})]}});var dx=og.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const t=new Dc(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 Oc({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)=>!ux({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!ux({node:e.doc.lastChild,types:r})}}})]}}),fx=og.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>ox(e,t),redo:()=>({state:e,dispatch:t})=>ix(e,t)}),addProseMirrorPlugins(){return[nx(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()}}}),px=og.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(Iy.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(Ay.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(tw.configure(this.options.bulletList)),!1!==this.options.code&&o.push(Fy.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(Vy.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(qy.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(sx.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(ax.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(Uy.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(Wy.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(fx.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(Yy.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(Qy.configure(this.options.italic)),!1!==this.options.listItem&&o.push(nw.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(pw.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(Gv.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(vw.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(Ew.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(_w.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(dx.configure(null==(r=this.options)?void 0:r.trailingNode)),o}}),hx=og.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")}}}),mx=cx,gx=(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(...gx(e,t+1))}),n},yx=Qm.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=gx(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",em(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}}}}),bx=og.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()})}),vx=og.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()})}),wx=og.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()})}),xx=og.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()})}),kx=og.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()})});og.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(bx.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(vx.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(wx.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(xx.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(kx.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(yx.configure(this.options.textStyle)),e}});var Sx=vx,Ex=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Mx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Cx=Qm.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",em(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[bg({find:Ex,type:this.type})]},addPasteRules(){return[Tg({find:Mx,type:this.type})]}}),Nx=Cx;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 _x=["#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 Ox({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 f=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:f},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($,{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}},_x.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 Tx({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($,{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),f=e.useRef(null),p=e.useRef(null);e.useEffect(()=>{if(!i)return;const e=e=>{d.current&&!d.current.contains(e.target)&&f.current&&!f.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const h=()=>{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(P,{className:o})),i&&n.createPortal(React.createElement("div",{className:"workflow-form-v2",style:{display:"contents"}},React.createElement("div",{ref:f,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:h}),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(),h()}},"确定")))),document.body))}function Dx({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(Tx,{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(D,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().toggleItalic().run(),active:t.isActive("italic"),title:"斜体"},React.createElement(z,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().toggleUnderline().run(),active:t.isActive("underline"),title:"下划线"},React.createElement(te,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().toggleStrike().run(),active:t.isActive("strike"),title:"删除线"},React.createElement(G,{className:n})),React.createElement("div",{className:"w-px h-4 bg-gray-300 mx-0.5"}),React.createElement(Ox,{currentColor:o,onSelect:e=>{e?t.chain().focus().setColor(e).run():t.chain().focus().unsetColor().run()},icon:React.createElement(W,{className:n}),title:"字体颜色"}),React.createElement(Ox,{currentColor:i,onSelect:e=>{e?t.chain().focus().setHighlight({color:e}).run():t.chain().focus().unsetHighlight().run()},icon:React.createElement(I,{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(V,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().toggleOrderedList().run(),active:t.isActive("orderedList"),title:"有序列表"},React.createElement(H,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().sinkListItem("listItem").run(),disabled:!t.can().sinkListItem("listItem"),title:"增加缩进"},React.createElement(B,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().liftListItem("listItem").run(),disabled:!t.can().liftListItem("listItem"),title:"减少缩进"},React.createElement(F,{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(X,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().setTextAlign("center").run(),active:t.isActive({textAlign:"center"}),title:"居中"},React.createElement(Z,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().setTextAlign("right").run(),active:t.isActive({textAlign:"right"}),title:"右对齐"},React.createElement(Q,{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(re,{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(K,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().undo().run(),disabled:!t.can().undo(),title:"撤销"},React.createElement(ne,{className:n})),React.createElement(Rx,{onClick:()=>t.chain().focus().redo().run(),disabled:!t.can().redo(),title:"重做"},React.createElement(J,{className:n}))))}function $x({value:t,onChange:n,readonly:r=!1,placeholder:o="请输入内容...",isTableMode:i=!1,hasError:s=!1,minHeight:a=120}){const l=Ey({extensions:[px,Ow,yx,Sx,Nx.configure({multicolor:!0}),Zv.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),hx.configure({types:["heading","paragraph"]}),mx.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-amber-50/80 focus-within:border-indigo-400 focus-within:ring-2 focus-within:ring-indigo-100");return React.createElement("div",{className:c},l&&React.createElement(Dx,{editor:l}),React.createElement(by,{editor:l,className:"tiptap-editor rich-text-content overflow-hidden rounded-b-md",style:{minHeight:`${a}px`}}))}function Lx(e){return e.filter(e=>"done"===e.status).map(e=>e.response?._id||e.uid).join(",")}function jx(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 Ix({field:n,value:r,onChange:o,isTableMode:i=!1,hasError:s=!1,minimal:a=!1,onFillFields:l,formValues:c,formalTableMode:d=!1,historyApproves:f=[],previewMode:p=!1}){const{remoteOptions:h,remoteLoading:m}=function(t,n){const[r,o]=e.useState([]),[i,s]=e.useState(!1);return e.useEffect(()=>{if("apiSelect"!==t.type||!t.optionsUrl)return;s(!0);let e=t.optionsUrl,r={method:(t.optionsMethod||"GET").toUpperCase()};if(t.optionsBeforeScript)try{const o=new Function("url","options","values",t.optionsBeforeScript)(e,r,n||{});o&&"object"==typeof o&&(e=o.url||e,r=o.options||r)}catch(i){console.warn("[apiSelect] optionsBeforeScript error:",i)}fetch(e,r).then(e=>e.json()).then(e=>{let n,r=Array.isArray(e)?e:Array.isArray(e?.value)?e.value:Array.isArray(e?.data)?e.data:[];if(t.optionsMapScript)try{n=new Function("data",t.optionsMapScript)(r)}catch(i){console.warn("[apiSelect] optionsMapScript error:",i),n=[]}else{const e=t.optionsLabelField||"name",o=t.optionsValueField||"_id";n=r.map(t=>({label:String(t[e]||""),value:String(t[o]||"")}))}o(n)}).catch(e=>console.warn("[apiSelect] fetch error:",e)).finally(()=>s(!1))},[t.type,t.optionsUrl,t.optionsMethod,t.optionsBeforeScript,t.optionsMapScript,t.optionsLabelField,t.optionsValueField,n]),{remoteOptions:r,remoteLoading:i}}(n,c),[g,y]=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:Pn(e,void 0,t),response:{_id:e}}))}return[]});e.useEffect(()=>{if("file"!==n.type&&"image"!==n.type)return;const e=g.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 jn.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&&y(r=>r.map(r=>{const o=e[r.uid];return o?{...r,name:o,url:Pn(r.uid,o,t),..."image"===n.type?{thumbUrl:Pn(r.uid,o,t)}:{}}:r}))})},[]);const[b,v]=e.useState(!1),[w,x]=e.useState(""),[k,S]=e.useState(!1),E=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",M=n.readonly?"bg-white":"bg-amber-50/80",C=n.readonly?{}:{backgroundColor:"rgba(255,251,235,0.8)"},N=`border-gray-300 ${M} focus:border-[#4096ff] focus:ring-2 focus:ring-[#1677ff]/10`,R=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${E}`:`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":N}`,_=n.readonly?"bg-gray-50 cursor-not-allowed text-gray-500":"",[O,T]=e.useState(null),A=e.useCallback(e=>{if(!e)return void T(null);const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);T(t?null:"邮箱格式不正确")},[]),D=e.useCallback(e=>{if(!e)return void T(null);const t=/^https?:\/\/.+/i.test(e);T(t?null:"链接格式不正确,需以 http:// 或 https:// 开头")},[]),$=e.useCallback(e=>{if(""===e||null==e)return void T(null);const t=Number(String(e).replace(/,/g,""));isNaN(t)?T(null):null!=n.min&&t<n.min?T(`不能小于 ${n.min}`):null!=n.max&&t>n.max?T(`不能大于 ${n.max}`):T(null)},[n.min,n.max]),L=e.useCallback(e=>{n.minLength&&e&&e.length<n.minLength?T(`长度不能少于 ${n.minLength} 个字符(当前 ${e.length} 字符)`):T(null)},[n.minLength]),j=O?React.createElement(t.Tooltip,{title:O,color:"orange",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 text-amber-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))):null;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){const t="true"===r?"是":"否";return React.createElement("div",{className:e},t)}if("checkboxGroup"===n.type){const t=(Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[]).map(e=>(n.options||[]).find(t=>t.value===e)?.label??e).join(", ");return React.createElement("div",{className:e},t)}if("radio"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label??"")}if("select"===n.type){const t=(n.options||[]).find(e=>e.value===r);return React.createElement("div",{className:e},t?.label||r||"")}if("apiSelect"===n.type){if(n.optionsMultiple){const t=(Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[]).map(e=>h.find(t=>t.value===e)?.label??e).join(", ");return React.createElement("div",{className:e},m?"加载中...":t)}const t=h.find(e=>e.value===r);return React.createElement("div",{className:e},m?"加载中...":t?.label||r||"")}if("file"===n.type)return 0===g.length?React.createElement("div",{className:e}):React.createElement("div",{className:`${e} flex flex-wrap gap-2`},g.map(e=>{const t=e.url||(e.response?._id?Pn(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(Qs,{value:r,isTableMode:i,minimal:a});if("org"===n.type||"orgMulti"===n.type)return React.createElement(ea,{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:()=>S(!0),onKeyDown:e=>{"Enter"===e.key&&S(!0)}},r),React.createElement(t.Modal,{title:"即将离开当前页面",open:k,okText:"继续访问",cancelText:"取消",onOk:()=>{S(!1),window.open(r,"_blank","noopener,noreferrer")},onCancel:()=>S(!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){if("autoNumber"===n.type)return React.createElement("div",{className:`${e} flex items-center gap-1.5 text-gray-400`},React.createElement("span",null,r||jx(n)));if("richtext"===n.type)return React.createElement("div",{className:`${e} rich-text-content`,dangerouslySetInnerHTML:{__html:r||""}});if("datetime"===n.type&&r){const t=u(r);return React.createElement("div",{className:e},t.isValid()?t.format("YYYY-MM-DD HH:mm"):r)}if("number"!==n.type||!n.thousandSeparator&&null==n.precision||null==r||""===r)return"textarea"===n.type?React.createElement("div",{className:e,style:{whiteSpace:"pre-wrap"}},r??""):React.createElement("div",{className:e},r??"");{const t=Number(r),o=isNaN(t)?r:n.thousandSeparator?null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN"):t.toFixed(n.precision);return React.createElement("div",{className:e},o)}}}}}}switch(n.type){case"text":{const e=s||!!O,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":E}`:`w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition ${e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":N}`,a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:"text",value:r,onChange:e=>{o(e.target.value),O&&L(e.target.value)},onBlur:e=>{n.minLength&&L(e.target.value)},placeholder:n.placeholder||"请输入",readOnly:n.readonly,maxLength:n.maxLength,className:`${t} ${_} ${i&&O?"flex-1 min-w-0":""}`}),!i&&(O||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},O?React.createElement("p",{className:"text-[11px] text-red-500"},O):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"email":case"url":{const e="email"===n.type,t=s||!!O,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":E}`:`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":N}`;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:e?"email":"url",value:r,onChange:t=>{o(t.target.value),O&&(e?A(t.target.value):D(t.target.value))},onBlur:t=>{e?A(t.target.value):D(t.target.value)},placeholder:n.placeholder||(e?"请输入邮箱地址":"请输入链接地址"),readOnly:n.readonly,maxLength:n.maxLength,className:`${a} ${_} ${i&&O?"flex-1 min-w-0":""}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O))}case"textarea":{const e=s||!!O,t=i?`w-full h-full px-2.5 py-2 text-[13px] outline-none smooth-transition ${e?"bg-red-100/90 focus:bg-red-50":E}`:`w-full border rounded-md px-3 py-2 text-[13px] outline-none smooth-transition ${e?"border-red-300 bg-red-50 focus:border-red-400 focus:ring-2 focus:ring-red-100":N}`,a=(r||"").length,l=!!n.maxLength&&!i;return React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("textarea",{value:r,onChange:e=>{o(e.target.value),O&&L(e.target.value)},onBlur:e=>{n.minLength&&L(e.target.value)},placeholder:n.placeholder||"请输入内容...",readOnly:n.readonly,maxLength:n.maxLength,rows:3,className:`${t} ${_} resize-none ${i&&O?"flex-1 min-w-0":""}`}),!i&&(O||l)&&React.createElement("div",{className:"flex justify-between items-center mt-0.5 px-1"},O?React.createElement("p",{className:"text-[11px] text-red-500"},O):React.createElement("span",null),l&&React.createElement("span",{className:"text-[11px] "+(a>=(n.maxLength??0)?"text-red-400":a>.85*(n.maxLength??0)?"text-amber-400":"text-gray-300")},a,"/",n.maxLength)))}case"number":{const e=e=>{if(""===e||null==e)return"";const t=Number(String(e).replace(/,/g,""));return isNaN(t)?String(e):n.thousandSeparator?null!=n.precision?t.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):t.toLocaleString("zh-CN"):null!=n.precision?t.toFixed(n.precision):String(t)},t=s||!!O,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":E}`:`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":N}`;return!n.thousandSeparator&&null==n.precision||n.readonly?React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full"},i&&O&&j,React.createElement("input",{type:"number",value:r,onChange:e=>{const t=e.target.value;o(""===t?"":Number(t)),O&&$(t)},onBlur:e=>{null==n.min&&null==n.max||$(e.target.value)},placeholder:n.placeholder||"请输入数字",readOnly:n.readonly,min:n.min,max:n.max,className:`${a} ${_} ${i&&O?"flex-1 min-w-0":""}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O)):React.createElement("div",{className:i&&O?"flex items-center w-full h-full bg-red-100/90":"w-full flex items-center"},i&&O&&j,React.createElement("input",{type:"text",defaultValue:e(r),key:`num-${n._id}-${r}`,onFocus:e=>{e.target.value=null==r?"":String(r),T(null)},onBlur:t=>{const i=t.target.value.replace(/,/g,"");if(""===i)return o(""),t.target.value="",void $("");const s=Number(i);if(isNaN(s))return void(t.target.value=e(r));const a=null!=n.precision?Number(s.toFixed(n.precision)):s;o(a),t.target.value=e(a),$(String(a))},placeholder:n.placeholder||"请输入数字",className:`${a} ${i&&O?"flex-1 min-w-0":"w-full"}`}),!i&&O&&React.createElement("p",{className:"text-[11px] text-red-500 mt-1 px-1"},O))}case"date":return React.createElement(t.ConfigProvider,{locale:Rs},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":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"datetime":return React.createElement(t.ConfigProvider,{locale:Rs},React.createElement(t.DatePicker,{showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",value:r?u(r):null,onChange:e=>o(e?e.second(0).millisecond(0).toISOString():""),disabled:n.readonly,placeholder:"选择日期时间",className:"!w-full "+(i?"picker-table-mode":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"time":return React.createElement(t.ConfigProvider,{locale:Rs},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":n.readonly?"":"picker-editable-bg"),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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0}));case"select":return React.createElement(t.ConfigProvider,{locale:Rs},React.createElement(t.Select,{value:r||void 0,onChange:e=>o(e??""),disabled:n.readonly,placeholder:"请选择",className:"!w-full "+(i?"picker-table-mode":n.readonly?"":"select-editable-bg"),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",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%"}:{height:38,...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"multiSelect":return React.createElement(t.ConfigProvider,{locale:Rs},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":"multiselect-form-mode"+(n.readonly?"":" select-editable-bg")),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0}:{...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,options:(n.options||[]).map(e=>({label:e.label,value:e.value}))}));case"apiSelect":return React.createElement(t.ConfigProvider,{locale:Rs},React.createElement(t.Select,{...n.optionsMultiple?{mode:"multiple"}:{},value:n.optionsMultiple?r?Array.isArray(r)?r:String(r).split(",").filter(Boolean):[]:r||void 0,onChange:n.optionsMultiple?e=>o(e.join(",")):e=>o(e??""),disabled:n.readonly,loading:m,placeholder:m?"加载中...":n.optionsMultiple?"请选择(多选)":"请选择",className:"!w-full "+(i?"picker-table-mode":`${n.optionsMultiple?"multiselect-form-mode":""}${n.readonly?"":" select-editable-bg"}`),variant:i?"borderless":"outlined",popupMatchSelectWidth:!i,popupClassName:"select-popup-high-z",style:{width:"100%",fontSize:13,...i?{backgroundColor:s?"rgba(254,226,226,0.9)":d?"transparent":"rgba(255,251,235,0.8)",borderRadius:0,...n.optionsMultiple?{}:{height:"100%"}}:{...n.optionsMultiple?{}:{height:38},...s?{borderColor:"#fecaca",backgroundColor:"#fef2f2"}:C}},allowClear:!0,showSearch:!0,filterOption:(e,t)=>(t?.label??"").toString().toLowerCase().includes(e.toLowerCase()),options:h}));case"radio":return React.createElement("div",{className:"flex flex-wrap gap-4 py-1 "+(i?"px-2.5 py-2":"px-1 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},(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 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},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"checkboxGroup":{const e=Array.isArray(r)?r:"string"==typeof r&&r?r.split(",").map(e=>e.trim()):[],s=(n.options||[]).map(e=>({label:e.label,value:e.value}));return React.createElement("div",{className:"py-1 "+(i?"px-2.5 py-2":"px-1 "+(n.readonly?"":"border rounded-md border-gray-300 bg-amber-50/80 px-3 py-2"))},s.length>0?React.createElement(t.ConfigProvider,{locale:Rs},React.createElement(t.Checkbox.Group,{value:e,onChange:e=>o(e),disabled:n.readonly,options:s})):React.createElement("span",{className:"text-[12px] text-gray-400 italic"},"未配置选项"))}case"file":{const e=!!n.multiple,r={fileList:g,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 zn(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=>{y(e.fileList),o(Lx(e.fileList))},onRemove:e=>{const t=g.filter(t=>t.uid!==e.uid);y(t),o(Lx(t))}};return React.createElement(t.ConfigProvider,{locale:Rs},i?React.createElement("div",{className:"px-2.5 py-2"},React.createElement(t.Upload,{...r},React.createElement(t.Button,{size:"small",icon:React.createElement(Fi,null),disabled:n.readonly},n.readonly?"仅读":"上传文件"))):React.createElement("div",{className:"mb-2"},React.createElement(t.Upload.Dragger,{...r},React.createElement("p",{className:"ant-upload-drag-icon"},React.createElement(Mi,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||"";x(t),v(!0)},s={listType:"picture-card",fileList:g,accept:"image/*",multiple:e,maxCount:e?void 0:1,disabled:n.readonly,customRequest:async({file:e,onSuccess:n,onError:r})=>{try{const t=await zn(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=Pn(e.response._id,e.name,"cfs.images.filerecord");return{...e,url:t,thumbUrl:t}}return e});y(t),o(Lx(t))},onRemove:e=>{const t=g.filter(t=>t.uid!==e.uid);y(t),o(Lx(t))},onPreview:r};return React.createElement(t.ConfigProvider,{locale:Rs},React.createElement("div",{className:"workflow-image-field "+(i?"px-2.5 py-1.5":"")},React.createElement(t.Upload,{...s},!n.readonly&&React.createElement("div",{className:"flex flex-col items-center justify-center"},React.createElement(Ti,null),React.createElement("span",{className:"text-[11px] mt-1"},"上传")))),w&&React.createElement(t.Image,{wrapperStyle:{display:"none"},preview:{visible:b,onVisibleChange:e=>{v(e),e||x("")}},src:w}))}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(Gs,{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(Gs,{value:r,onChange:o,multiple:!0,isTableMode:i,hasError:s,formalTableMode:d,valueFormat:n.valueFormat});case"lookup":return React.createElement($s,{field:n,value:r,onChange:o,onFillFields:l,isTableMode:i,hasError:s,formValues:c});case"formula":{const e=null==r?"":String(r);let t=e;if(e&&!e.startsWith("#ERR")&&n.thousandSeparator){const r=Number(e);isNaN(r)||(t=null!=n.precision?r.toLocaleString("zh-CN",{minimumFractionDigits:n.precision,maximumFractionDigits:n.precision}):r.toLocaleString("zh-CN"))}else if(e&&!e.startsWith("#ERR")&&null!=n.precision){const r=Number(e);isNaN(r)||(t=r.toFixed(n.precision))}const o=!n.readonly;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 ${e.startsWith("#ERR")?"text-red-400 text-[11px]":e?"text-gray-800":"text-gray-400"} truncate flex items-center`,title:e.startsWith("#ERR")?e:n.formula?`= ${n.formula}`:""},React.createElement("span",{className:"truncate flex-1"},i?e.startsWith("#ERR")?e:t||"":t||"(自动计算)"),o&&React.createElement("span",{className:"shrink-0 ml-1 text-[10px] italic text-gray-300",title:`公式: ${n.formula||""}`},"ƒ"))}case"approvalComments":{const e=n.approvalCommentSteps||[];let t=Array.isArray(f)&&f.length?f: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(U,{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"}:C}}});case"richtext":return React.createElement($x,{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||jx(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:`${R} mt-1`}));default:return React.createElement("input",{type:"text",value:r,onChange:e=>o(e.target.value),placeholder:"请输入",className:R})}}function zx(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 f=(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?f+="整":0===s?f+="零"+l[a]+"分":(f+=l[s]+"角",f+=a>0?l[a]+"分":"整"),(n?"负":"")+f}function Px(e){const t=[],n=e=>{Array.isArray(e)?e.forEach(n):t.push(e)};return e.forEach(n),t}function Fx(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 Bx={SUM:(...e)=>Px(e).reduce((e,t)=>e+Fx(t),0),AVG:(...e)=>{const t=Px(e);return t.length?t.reduce((e,t)=>e+Fx(t),0)/t.length:0},AVERAGE:(...e)=>{const t=Px(e);return t.length?t.reduce((e,t)=>e+Fx(t),0)/t.length:0},MAX:(...e)=>{const t=Px(e);return 0===t.length?0:Math.max(...t.map(Fx))},MIN:(...e)=>{const t=Px(e);return 0===t.length?0:Math.min(...t.map(Fx))},COUNT:(...e)=>Px(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,IFS:(...e)=>{for(let t=0;t<e.length-1;t+=2)if(e[t])return e[t+1];return e.length%2!=0?e[e.length-1]:""},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 zx(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=>zx(e),CNY:e=>zx(e)},Hx=Object.keys(Bx),Vx=Object.values(Bx);function qx(e,t,n){if(!e)return"";const r=e.includes("${")?e:`\${${e}}`;try{const e=Object.keys(t),i=/^[A-Za-z_$][A-Za-z0-9_$]*$/,s=n?e:e.filter(e=>i.test(e)),a=[],l=[];for(const n of s){const e=t[n];if("string"!=typeof e||!e.trim())continue;let r;try{r=JSON.parse(e)}catch{continue}if(!Array.isArray(r)||0===r.length)continue;if(!r.every(e=>e&&"object"==typeof e&&!Array.isArray(e)))continue;const o=new Map;for(const t of r)Object.keys(t).forEach(e=>{o.has(e)||o.set(e,[]),o.get(e).push(t[e])});for(const[t,i]of o.entries()){s.includes(t)||a.includes(t)||(a.push(t),l.push(i));const e=`${n}_${t}`;s.includes(e)||a.includes(e)||(a.push(e),l.push(i))}}if(n){const n={};Hx.forEach((e,t)=>{n[e]=Vx[t]});for(const r of e){const e=t[r];if(null==e||""===e){n[r]=0;continue}const o=Number(e);n[r]=isNaN(o)?e:o}a.forEach((e,t)=>{n[e]=l[t]});const s=new Set([...e,...a]),c=e=>{const t=[];let r=e.replace(/\{([^{}]+)\}/g,(e,n)=>{const r=t.length,o=n.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return t.push(`__v["${o}"]`),`__PLACEHOLDER_${r}__`});const o=new Set([...Hx,...[...s].filter(e=>i.test(e))]);r=r.replace(/(["'])(?:(?!\1)[^\\]|\\.)*\1|\b([A-Za-z_$][A-Za-z0-9_$]*)\b/g,(e,t,r)=>r?r.startsWith("__PLACEHOLDER_")?e:(o.has(r)||(n[r]=0),`__v["${r}"]`):e),r=r.replace(/__PLACEHOLDER_(\d+)__/g,(e,n)=>t[Number(n)]);return new Function("__v",`return (${r});`)(n)},u=r.match(/^\$\{([\s\S]+)\}$/);if(u&&!r.match(/\}\s*[^}]*\$\{/))try{const e=c(u[1]);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?Math.round(1e4*e)/1e4:"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}return r.replace(/\$\{([^}]*(?:\{[^{}]*\}[^}]*)*)\}/g,(e,t)=>{try{const e=c(t);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?String(Math.round(1e4*e)/1e4):"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}})}const c=s.map(e=>{const n=t[e];if(null==n||""===n)return 0;const r=Number(n);return isNaN(r)?n:r}),u=e=>{const t=[],n=[],r=new Set([...Hx,...s,...a]),o=e.match(/\b[A-Za-z_][A-Za-z0-9_]*\b/g)||[];for(const i of o)r.has(i)||(r.add(i),t.push(i),n.push(0));return new Function(...Hx,...s,...a,...t,`return (${e});`)(...Vx,...c,...l,...n)},d=r.match(/^\$\{([^}]+)\}$/);if(d)try{const e=u(d[1]);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?Math.round(1e4*e)/1e4:"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}return r.replace(/\$\{([^}]+)\}/g,(e,t)=>{try{const e=u(t);return null==e?"":"number"==typeof e?isNaN(e)?"":isFinite(e)?String(Math.round(1e4*e)/1e4):"#ERR: 除以零":String(e)}catch(o){return`#ERR: ${o instanceof Error?o.message:String(o)}`}})}catch(o){const t=o instanceof Error?o.message:String(o);return console.warn("[Formula]",e,t),`#ERR: ${t}`}}function Ux(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}_${Math.random().toString(36).slice(2,11)}`}function Wx(e){return e._id?e:{...e,_id:Ux()}}function Yx(e={}){return{...e}}function Jx(e){if(!e)return"";const t=["YYYY-MM-DD","YYYY/MM/DD","YYYY.MM.DD","MM/DD/YYYY","DD/MM/YYYY","YYYY年MM月DD日","YYYY年M月D日"];for(const r of t){const t=u(e,r,!0);if(t.isValid())return t.format("YYYY-MM-DD")}const n=u(e);return n.isValid()&&e.length>=8?n.format("YYYY-MM-DD"):""}function Kx(e){if(!e)return"";const t=["YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm","YYYY/MM/DD HH:mm:ss","YYYY/MM/DD HH:mm","YYYY.MM.DD HH:mm:ss","YYYY.MM.DD HH:mm","YYYY年MM月DD日 HH:mm:ss","YYYY年MM月DD日 HH:mm","YYYY年M月D日 HH:mm","YYYY-MM-DDTHH:mm:ss","YYYY-MM-DDTHH:mm:ssZ"];for(const r of t){const t=u(e,r,!0);if(t.isValid())return t.second(0).millisecond(0).toISOString()}const n=u(e);return n.isValid()&&e.length>=10?n.second(0).millisecond(0).toISOString():""}function Gx(e){if(!e)return"";const t=e.replace(/[¥$€£₹,,\s]/g,"");return""===t||isNaN(Number(t))?e:t}async function Zx(e){const t=[...new Set(e.filter(Boolean))];if(0===t.length)return new Map;const n=`{rows:space_users(filters: [["user_accepted","=",true],["name","in",[${t.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(",")}]]], top: 5000){_id,user,name,organization}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Yx({"Content-Type":"application/json"}),body:JSON.stringify({query:n})}),t=await e.json(),r=t.data?.rows||[],o=[...new Set(r.map(e=>e.organization).filter(Boolean))],i=new Map;if(o.length>0){const e=`{rows:organizations(filters: [["_id","in",${JSON.stringify(o)}]], top: 1000){_id,name,fullname}}`,t=await fetch("/graphql",{method:"POST",headers:Yx({"Content-Type":"application/json"}),body:JSON.stringify({query:e})}),n=await t.json();for(const r of n.data?.rows||[])i.set(r._id,{name:r.name||"",fullname:r.fullname||""})}const s=new Map;for(const n of r){const e=i.get(n.organization)||{name:"",fullname:""},t={id:n.user,name:n.name,sort_no:0,organization:{name:e.name,fullname:e.fullname}};s.has(n.name)||s.set(n.name,t)}return s}catch{return new Map}}async function Qx(e){const t=[...new Set(e.filter(Boolean))];if(0===t.length)return new Map;const n=t.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(","),r=`{byName:organizations(filters: [["name","in",[${n}]]], top: 5000){_id,name,fullname},byFullname:organizations(filters: [["fullname","in",[${n}]]], top: 5000){_id,name,fullname}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Yx({"Content-Type":"application/json"}),body:JSON.stringify({query:r})}),t=await e.json(),n=t.data?.byName||[],o=t.data?.byFullname||[],i=new Map;for(const r of o)i.has(r.fullname)||i.set(r.fullname,{id:r._id,name:r.name,fullname:r.fullname||r.name});for(const r of n)i.has(r.name)||i.set(r.name,{id:r._id,name:r.name,fullname:r.fullname||r.name});return i}catch{return new Map}}async function Xx(e,t){if(0===e.length)return e;const n=new Set,r=new Set,o=new Map;for(const c of t){const t=e.map(e=>e[c.name]).filter(Boolean);if(0!==t.length)if("member"===c.type||"memberMulti"===c.type)for(const e of t)"memberMulti"===c.type?e.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>n.add(e)):n.add(e.trim());else if("org"===c.type||"orgMulti"===c.type)for(const e of t)"orgMulti"===c.type?e.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>r.add(e)):r.add(e.trim());else if("lookup"===c.type&&c.reference_to){const e=c.lookupDisplayFields||["name"],n=("string"==typeof e[0]?e[0]:e[0]?.field)||"name",r=`${c.reference_to}:${n}`;o.has(r)||o.set(r,{field:c,names:new Set});const i=o.get(r);for(const o of t)c.pickerMultiple?o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).forEach(e=>i.names.add(e)):i.names.add(o.trim())}}const[i,s,...a]=await Promise.all([n.size>0?Zx([...n]):Promise.resolve(new Map),r.size>0?Qx([...r]):Promise.resolve(new Map),...Array.from(o.values()).map(({field:e,names:t})=>async function(e,t){const n=[...new Set(e.filter(Boolean))];if(0===n.length||!t.reference_to)return new Map;const r=t.reference_to,o=t.lookupDisplayFields||["name"],i=("string"==typeof o[0]?o[0]:o[0]?.field)||"name",s=`{rows:${r}(filters: [["${i}","in",[${n.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(",")}]]], top: 5000){_id,${i}}}`;try{const e=await fetch("/graphql",{method:"POST",headers:Yx({"Content-Type":"application/json"}),body:JSON.stringify({query:s})}),t=await e.json(),n=t.data?.rows||[],r=new Map;for(const o of n){const e=o[i];e&&!r.has(e)&&r.set(e,o._id)}return r}catch{return new Map}}([...t],e))]),l=new Map;return Array.from(o.keys()).forEach((e,t)=>{l.set(e,a[t])}),e.map(e=>{const n={};for(const r of t){const t=e[r.name];if(null==t)continue;const o="string"==typeof t?t.trim():String(t);if(o)switch(r.type){case"number":n[r.name]=Gx(o);break;case"date":{const e=Jx(o);n[r.name]=e||o;break}case"datetime":{const e=Kx(o);n[r.name]=e||o;break}case"member":{const e=i.get(o);n[r.name]=e||"";break}case"memberMulti":{const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>i.get(e)).filter(Boolean);n[r.name]=e.length>0?e:"";break}case"org":{const e=s.get(o);n[r.name]=e||"";break}case"orgMulti":{const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>s.get(e)).filter(Boolean);n[r.name]=e.length>0?e:"";break}case"lookup":{const e=r.lookupDisplayFields||["name"],t=("string"==typeof e[0]?e[0]:e[0]?.field)||"name",i=`${r.reference_to}:${t}`,s=l.get(i);if(s)if(r.pickerMultiple){const e=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(e=>s.get(e)).filter(Boolean);n[r.name]=e.length>0?e.join(","):""}else{const e=s.get(o);n[r.name]=e||""}else n[r.name]="";break}case"select":{const e=(r.options||[]).find(e=>e.label===o||e.value===o);n[r.name]=e?e.value:"";break}case"multiSelect":{const e=r.options||[],t=o.split(/[,,、]/).map(e=>e.trim()).filter(Boolean).map(t=>{const n=e.find(e=>e.label===t||e.value===t);return n?.value}).filter(Boolean);n[r.name]=t.length>0?t.join(","):"";break}case"checkbox":{const e=o.toLowerCase();["true","是","yes","1","✓","✔"].includes(e)?n[r.name]="true":["false","否","no","0"].includes(e)?n[r.name]="false":n[r.name]=o;break}case"checkboxGroup":{const e=o.split(/[,,]/).map(e=>e.trim()).filter(Boolean).map(e=>{const t=(r.options||[]).find(t=>t.label===e||t.value===e);return t?.value}).filter(Boolean);n[r.name]=e;break}default:n[r.name]=o}else n[r.name]=""}return n})}function ek({field:n,isTableMode:r=!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,value:a,onChange:l,fieldPermissions:c,tableBorderColor:u,rowErrors:d,parentFormValues:f,chineseFieldNames:p=!1}){const h=n.children||[],m=e.useMemo(()=>c?h.filter(e=>"hidden"!==c[e.name]).map(e=>"editable"===c[e.name]?e:{...e,readonly:!0}):h,[h,c]),g=void 0!==l,y=e.useCallback((e,t)=>{const n={...f||{},...t};return e.visibilityExpression?.trim()?fe(e.visibilityExpression,n):!e.visibilityRules?.length||fk(e.visibilityRules,e.visibilityLogic,n)},[f]),b=e.useCallback((e,t)=>{if(e.required)return!0;const n={...f||{},...t};return e.requiredExpression?.trim()?fe(e.requiredExpression,n):!!e.requiredRules?.length&&fk(e.requiredRules,e.requiredLogic,n)},[f]),v=!!c&&"editable"!==c[n.name],[w,x]=e.useState([{_id:Ux()}]),k=g?function(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}(a):[],S=g?k.map(Wx):w,E=e.useRef(S);E.current=S;const[M,C]=e.useState(a);g&&a!==M&&C(a);const N=e=>{g?l(JSON.stringify(e)):x(e)},R=null==n.maxRows||S.length<n.maxRows,_=S.length>0&&(null==n.minRows||S.length>n.minRows),O=m.filter(e=>"formula"===e.type&&e.formula),T=e=>{if(0===O.length)return e;let t={...e};for(const n of O){const e=qx(n.formula,t,p);t[n.name]!==e&&(t={...t,[n.name]:e})}return t},A=e.useRef(f);e.useEffect(()=>{const e=A.current;if(A.current=f,!e||!f||!g)return;const t=m.filter(e=>"lookup"===e.type&&e.lookupFilters);if(0===t.length)return;const n=[];for(const s of t){[...("string"==typeof s.lookupFilters?s.lookupFilters:JSON.stringify(s.lookupFilters)).matchAll(/\{([^{}.]+)\}/g)].map(e=>e[1]).some(t=>e[t]!==f[t])&&n.push(s.name)}if(0===n.length)return;const r=E.current;let o=!1;const i=r.map(e=>{let t=e;for(const r of n)e[r]&&(t===e&&(t={...e}),t[r]="",o=!0);return t});o&&N(i)},[f]);const D=e.useMemo(()=>0===O.length?S:S.map(T),[S,O.map(e=>e.name+":"+e.formula).join(",")]),[$,j]=e.useState(null),[I,z]=e.useState({}),P=e.useCallback(e=>{j(e),z({...S[e]||{}})},[S]),F=e.useCallback((e,t)=>{z(n=>{const r={...n,[e]:t};return T(r)})},[T]),B=e.useCallback(()=>{if(null===$)return;const e=[...S];e[$]=T(I),N(e),j(null)},[$,I,S,N,T]),H=e.useCallback(()=>{j(null)},[]),V=r?"":"border-gray-200",U=r?u||"#000000":void 0,W=U?{borderColor:U}:void 0,J=!!n.readonly,K=n.rowNumberTitle?.trim()||"#",G="#"===K?40:Math.max(56,16*K.length+24),Z={...W||{},width:G,minWidth:G,maxWidth:G},[Q,X]=t.message.useMessage(),[te,ne]=e.useState(!1),re=e.useMemo(()=>(n.children||[]).filter(e=>"formula"!==e.type&&!e.readonly),[n.children]),oe=e.useMemo(()=>n.children||[],[n.children]),ie=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 oe.forEach((e,n)=>{n<t.length&&"formula"!==e.type&&!e.readonly&&(r[e.name]=t[n].trim())}),r})},[oe]),se=e.useMemo(()=>re.some(e=>["member","memberMulti","org","orgMulti","lookup"].includes(e.type)),[re]),ae=e.useCallback(async e=>{if(0===e.length)return;const t=null!=n.maxRows?Math.max(0,n.maxRows-S.length):e.length;if(0===t)return void Q.warning(`已达到最大行数 ${n.maxRows}`);const r=e.slice(0,t);let o;if(se||re.some(e=>["date","datetime","number","checkbox","select","multiSelect"].includes(e.type))){ne(!0);try{o=await Xx(r,re)}finally{ne(!1)}}else o=r;const i=o.map(e=>Wx(T(e)));N([...S,...i]),Q.success(`已粘贴 ${i.length} 行数据`)},[n.maxRows,S,se,re,T,N,Q]),le=e.useCallback(e=>{if(J||te||v)return;const t=e.target?.tagName?.toLowerCase();if("input"===t||"textarea"===t||"select"===t)return;const n=e.clipboardData.getData("text/plain");if(!n?.trim())return;const r=ie(n);0!==r.length&&(e.preventDefault(),ae(r))},[J,te,v,ie,ae]),ce=e.useCallback(async()=>{if(!(J||te||v))try{const e=await navigator.clipboard.readText();if(!e?.trim())return void Q.info("剪贴板为空");const t=ie(e);if(0===t.length)return void Q.info("未解析到有效数据");await ae(t)}catch{Q.error("无法读取剪贴板,请使用 Ctrl+V / ⌘+V 粘贴")}},[J,te,v,ie,ae,Q]);if(0===m.length)return React.createElement("div",{className:"text-[12px] text-gray-400 italic py-2 text-center"},"未配置子字段");const ue=e.useMemo(()=>0===O.length?I:T(I),[I,O.map(e=>e.name+":"+e.formula).join(",")]),de=null!==$&&React.createElement(t.Modal,{open:!0,title:`${n.label} - 第 ${$+1} 行`,onCancel:H,onOk:B,footer:React.createElement("div",{className:"flex justify-end gap-2 pt-2"},React.createElement(t.Button,{onClick:H},"取消"),React.createElement(t.Button,{type:"primary",onClick:B},"确认")),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"},m.map(e=>{if(!y(e,ue))return null;const t=b(e,ue),n=t!==e.required?{...e,required:t}:e,r="textarea"===e.type||"html"===e.type;return React.createElement("div",{key:e._id,className:r?"md:col-span-2":""},React.createElement("label",{className:"block text-[13px] font-medium text-gray-700 mb-1"},n.label,n.required&&!n.readonly&&!J&&React.createElement("span",{className:"text-red-500 ml-0.5"},"*")),React.createElement(Ix,{field:J?{...n,readonly:!0}:n,value:ue[e.name]??"",onChange:t=>F(e.name,t),isTableMode:!1,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,formValues:f,onFillFields:e=>{Object.entries(e).forEach(([e,t])=>F(e,t))}}))})));return React.createElement("div",{className:r?"":"mt-1",onPaste:le},X,React.createElement("div",{className:r?(!1!==n.showLabel?"border-t ":"")+"overflow-hidden":"border border-gray-300 rounded-md overflow-hidden",style:r&&!1!==n.showLabel?{borderColor:U}:void 0},React.createElement("div",{className:"overflow-x-auto"},React.createElement("table",{className:"workflow-subtable w-full text-[13px]",style:{minWidth:m.length>3?120*m.length+80+"px":void 0}},React.createElement("thead",null,React.createElement("tr",{className:`bg-gray-50 border-b ${V}`,style:W},!1!==n.showRowNumber&&React.createElement("th",{className:`px-2 py-2 text-center text-gray-500 font-medium border-r ${V} sticky left-0 bg-gray-50 z-[1]`,style:Z},K),m.map(e=>React.createElement("th",{key:e._id,className:`px-3 py-2 text-left font-medium text-gray-600 border-r ${V} last:border-r-0 whitespace-nowrap`,style:W},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,D.map((e,a)=>React.createElement("tr",{key:a,className:`border-b ${r?"":"border-gray-100"} last:border-b-0 hover:bg-gray-50/50`,style:r?W:void 0},!1!==n.showRowNumber&&React.createElement("td",{className:`px-2 py-1.5 text-center text-gray-600 border-r ${V} sticky left-0 bg-white z-[1]`,style:Z},a+1),m.map(n=>{if(!y(n,e))return React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${V} last:border-r-0`,style:W});const l=d?.[a]?.[n.name],c=b(n,e),u=c!==n.required?{...n,required:c}:n;return React.createElement("td",{key:n._id,className:`${r?"p-0":"px-2 py-1.5"} border-r ${V} last:border-r-0 ${l?"bg-red-50":!r||n.readonly||J?"":"bg-amber-50/80"}`,style:W},React.createElement("div",{className:l?"flex items-center":void 0},l&&React.createElement(t.Tooltip,{title:l,color:"red",placement:"topLeft"},React.createElement("span",{className:"inline-flex items-center justify-center flex-shrink-0 w-4 h-4 ml-1 mr-0.5 text-red-500 cursor-pointer"},React.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-4 h-4"},React.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})))),React.createElement("div",{className:"flex-1 min-w-0"},React.createElement(Ix,{field:J?{...u,readonly:!0}:u,value:e[n.name]??"",onChange:e=>((e,t,n)=>{const r=[...E.current];r[e]={...r[e],[t]:n},r[e]=T(r[e]),E.current=r,N(r)})(a,n.name,e),isTableMode:r,formalTableMode:!l,hasError:!!l,searchUsersFn:o,searchOrgsFn:i,searchObjectFn:s,formValues:f,onFillFields:e=>{const t=[...E.current];t[a]={...t[a]},Object.entries(e).forEach(([e,n])=>{t[a][e]=n}),t[a]=T(t[a]),E.current=t,N(t)}}))))}),!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:()=>P(a),className:"rounded p-0.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 smooth-transition",title:"弹窗编辑"},React.createElement(q,{className:"w-3 h-3"})),_&&!v&&React.createElement("button",{onClick:()=>(e=>{if(!_)return;const t=S.filter((t,n)=>n!==e);N(t),$===e?j(null):null!==$&&$>e&&j($-1)})(a),className:"rounded p-0.5 text-gray-400 hover:text-red-500 hover:bg-red-50 smooth-transition"},React.createElement(ee,{className:"w-3 h-3"}))))))))),!J&&!v&&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"},R&&React.createElement("button",{onClick:()=>{R&&N([...S,{_id:Ux()}])},className:"flex items-center gap-1 text-[12px] text-indigo-600 hover:text-indigo-700 smooth-transition"},React.createElement(Y,{className:"w-3.5 h-3.5"})," 添加一行"),R&&React.createElement("button",{onClick:ce,disabled:te,className:"flex items-center gap-1 text-[12px] smooth-transition "+(te?"text-gray-400 cursor-wait":"text-gray-500 hover:text-indigo-600"),title:"从Excel或CSV粘贴数据(也可以直接 Ctrl+V / ⌘+V)"},React.createElement(L,{className:"w-3.5 h-3.5"})," ",te?"粘贴中...":"粘贴")))),de)}function tk(e,t){return`${e}_${t}`}function nk({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,tableBorderColor:f,chineseFieldNames:p=!1}){const h=e.useMemo(()=>t.gridData||[],[t.gridData]),m=e.useMemo(()=>{let e=t.gridRows||3;for(const t of h){const n=t.row+(t.rowspan||1);n>e&&(e=n)}return e},[t.gridRows,h]),g=e.useMemo(()=>{let e=t.gridCols||4;for(const t of h){const n=t.col+(t.colspan||1);n>e&&(e=n)}return e},[t.gridCols,h]),y=e.useMemo(()=>t.children||[],[t.children]),b=e.useMemo(()=>"editable"!==u?y.map(e=>({...e,readonly:!0})):c?y.map(e=>{const t=c[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t?e:{...e,readonly:!0}}):y,[y,c,u]),v=e.useMemo(()=>{const e=new Map;for(const t of b)e.set(t._id,t);return e},[b]),w=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(tk(n.row+o,n.col+e))}return t}(h),[h]),x=e.useMemo(()=>{const e=h.filter(e=>"formula"===e.cellType&&e.value);if(0===e.length)return{};const t={};for(const n of e){t[tk(n.row,n.col)]=qx(n.value,r,p)}return t},[r,h]),k=n?f||"#000000":"",S=n?"":"border-gray-300",E=e.useMemo(()=>{const e=t.gridColumnWidths;if(!e||0===e.length)return;if(e.length>=g)return e;const n=e.reduce((e,t)=>e+t,0),r=g-e.length,o=n/e.length,i=100/(n+o*r);return[...e.map(e=>+(e*i).toFixed(2)),...Array(r).fill(+(o*i).toFixed(2))]},[t.gridColumnWidths,g]),M=!!t.gridScrollable||d;return React.createElement("div",{className:n?"":"mt-1"},React.createElement("div",{className:n?""+(!1!==t.showLabel?"border-t":""):`border ${S}`,style:n?{overflow:"hidden",...!1!==t.showLabel?{borderColor:k}:{}}:void 0},React.createElement("div",{className:M?"overflow-x-auto":""},React.createElement("table",{className:"w-full text-[13px] border-collapse "+(M?"table-fixed":""),style:{minWidth:M&&g>4?100*g+"px":void 0,...n?{margin:"-1px",width:"calc(100% + 2px)"}:{}}},React.createElement("colgroup",null,Array.from({length:g},(e,t)=>React.createElement("col",{key:t,style:E?.[t]?{width:`${E[t]}%`}:void 0}))),React.createElement("tbody",null,Array.from({length:m},(e,t)=>React.createElement("tr",{key:t,className:""+(t<m-1?`border-b ${S}`:""),style:n?{borderColor:k}:void 0},Array.from({length:g},(e,d)=>{const f=tk(t,d);if(w.has(f))return null;const p=function(e,t,n){return e.find(e=>e.row===t&&e.col===n)}(h,t,d),m=p?.rowspan||1,y=p?.colspan||1,b=d+y>=g,E=p?.cellType||"input",C={textAlign:p?.align||("label"===E?"center":"left")};if(p?.color&&(C.color=p.color),p?.backgroundColor&&(C.backgroundColor=p.backgroundColor),p?.fontWeight&&(C.fontWeight=p.fontWeight),p?.borderStyle&&(C.borderStyle=p.borderStyle),n&&(C.borderColor=k),"label"===E)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${b?"":`border-r ${S}`} ${p?.backgroundColor?"":"bg-white"} ${p?.color?"":"text-gray-600"} ${p?.fontWeight?"":"font-medium"}`,style:C},p?.value??"");if("formula"===E){const e=x[f]??"";return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`px-3 py-2 ${b?"":`border-r ${S}`} ${p?.color?"":"text-gray-700"}`,style:M?{...C,maxWidth:0}:C},React.createElement("div",{className:M?"truncate":"",title:String(e)},e))}const N=p?.fieldId?v.get(p.fieldId):null;if(!N&&!p?.fieldType)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(b?"":`border-r ${S}`),style:C}," ");if(N){if(N.hidden)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"px-3 py-2 "+(b?"":`border-r ${S}`),style:C}," ");const e=N.name,t=r[e]??N.defaultValue??"";if("table"===N.type)return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(b?"":`border-r ${S}`),style:C},React.createElement(ek,{field:N,isTableMode:n,value:t,onChange:t=>o(e,t),searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:c,parentFormValues:r}));const u=!N.readonly&&"formula"!==N.type&&n?"bg-amber-50/80":"",f=N.required&&!N.readonly;return React.createElement("td",{key:d,rowSpan:m>1?m:void 0,colSpan:y>1?y:void 0,className:`p-0 ${b?"":`border-r ${S}`} ${u} ${M?"overflow-hidden":""}`,style:M?{...C,maxWidth:0}:C},React.createElement("div",{className:"relative"},f&&React.createElement("span",{className:"absolute top-0.5 right-1 text-red-500 text-[10px] font-bold z-10"},"*"),React.createElement(Ix,{field:N,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:m>1?m:void 0,colSpan:y>1?y:void 0,className:"p-0 "+(b?"":`border-r ${S}`),style:C},React.createElement("input",{type:"number"===p?.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[f]||"",onChange:e=>!R&&o(f,e.target.value),readOnly:R,placeholder:p?.fieldLabel||p?.value||""}))}))))))))}u.extend(v);const rk=[{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 ok(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 ik(e,t,n){return"#"+[e,t,n].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function sk(e,t){const n=ok(e);return n?ik(n.r+(255-n.r)*t,n.g+(255-n.g)*t,n.b+(255-n.b)*t):e}function ak(e,t){const n=ok(e);return n?ik(n.r*(1-t),n.g*(1-t),n.b*(1-t)):e}function lk(e){if(e.sectionColor){const n={name:"custom",label:"自定义",primary:t=e.sectionColor,title:ak(t,.35),bg:sk(t,.92),border:sk(t,.35),desc:sk(t,.35)};return{...n,title:e.titleColor||n.title}}var t;const n=rk.find(t=>t.name===e.colorScheme)||{name:"default",label:"默认",primary:"#6b7280",title:"#1f2937",bg:"#f3f4f6",border:"#9ca3af",desc:"#6b7280"};return{...n,title:e.titleColor||n.title}}function ck(e,t){for(const n of e){if(n.name===t)return n;if(n.children){const e=ck(n.children,t);if(e)return e}}}async function uk(e){try{const{data:t}=await In("organizations",{filters:JSON.stringify(["_id","=",e]),fields:"_id,name,fullname",top:1});if(t.length>0){const e=t[0];return{id:String(e._id),name:String(e.name||""),fullname:String(e.fullname||"")}}}catch{}return null}async function dk(e){try{let t=null;const n=await In("space_users",{filters:JSON.stringify(["user","=",e]),fields:"_id,user,name,sort_no,organization",top:1});if(n.data.length>0)t=n.data[0];else{const n=await In("space_users",{filters:JSON.stringify(["_id","=",e]),fields:"_id,user,name,sort_no,organization",top:1});n.data.length>0&&(t=n.data[0])}if(!t)return null;const r=t.organization,o="object"==typeof r&&null!==r&&"_id"in r?String(r._id):r?String(r):"";let i={name:"",fullname:""};if(o)try{const e=await In("organizations",{filters:JSON.stringify(["_id","=",o]),fields:"_id,name,fullname",top:1});e.data.length>0&&(i={name:String(e.data[0].name||""),fullname:String(e.data[0].fullname||"")})}catch{}return{id:String(t.user||t._id),name:String(t.name||""),sort_no:t.sort_no||0,organization:i,organizations:{name:i.name?[i.name]:[],fullname:i.fullname?[i.fullname]:[]},hr:{},roles:[]}}catch{}return null}function fk(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 pk({fields:e,columns:t=2,formValues:n,updateValue:r,fieldErrors:o,tableRowErrors:i={},searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,labelClassName:c,onFillFields:u,fieldPermissions:d,formMode:f="editable",resolveValue:p,historyApproves:h,previewMode:m,tableBorderColor:g="#000000",tableShowLeftBorder:y=!0,tableShowRightBorder:b=!0,chineseFieldNames:v=!1}){const w=[];let x=0,k=0;if(e.forEach(e=>{const n=Os(e.type),r=_s(e),o=n||r?t:Math.min(e.tableColspan||1,t);if(x>0&&(n||r||x+o>t)){const e=t-x;e>0&&w.push({type:"empty",cs:e,key:"empty-"+k++}),x=0}w.push({type:"field",field:e}),n||r?x=0:(x+=o,x>=t&&(x=0))}),x>0){const e=t-x;e>0&&w.push({type:"empty",cs:e,key:"empty-"+k++})}const S={minWidth:0,backgroundColor:"#fff"},E=g||"#000000";return React.createElement("div",{className:"overflow-hidden workflow-form-v2-body",style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"1px",backgroundColor:E,borderTop:`2px solid ${E}`,borderBottom:`2px solid ${E}`,borderLeft:y?`2px solid ${E}`:"none",borderRight:b?`2px solid ${E}`:"none"}},w.map(e=>{if("empty"===e.type)return React.createElement("div",{key:e.key,style:{...S,gridColumn:`span ${e.cs}`}});const{field:y}=e,b=Os(y.type),w=_s(y),x={gridColumn:`span ${b||w?t:Math.min(y.tableColspan||1,t)}`,minWidth:0,backgroundColor:"#fff"};if("section"===y.type){const e=lk(y);return React.createElement("div",{key:y._id,style:{...x,backgroundColor:e.bg},"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.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}},y.label)),y.description&&React.createElement("div",{className:"text-[11px] mt-0.5 ml-[22px]",style:{color:e.desc,whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}))}if("table"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?lk(y):null;return React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"#f3f4f6"}},React.createElement("span",{className:"text-[13px] font-semibold table-label",style:{color:e?.title||"#1f2937"}},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-sm"},"*")),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#6b7280",backgroundColor:e?.bg||"#f3f4f6",whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(ek,{field:y,isTableMode:!0,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,value:n[y.name],onChange:e=>r(y.name,e),fieldPermissions:d,tableBorderColor:g,rowErrors:i[y.name],parentFormValues:n,chineseFieldNames:v}))}if("grid"===y.type){const e=!1!==y.showLabel&&(y.colorScheme||y.sectionColor)?lk(y):null;return React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},!1!==y.showLabel&&React.createElement("div",{className:"flex items-center gap-2 px-3 py-2",style:{backgroundColor:e?.bg||"#f3f4f6"}},React.createElement("span",{className:"text-[13px] grid-label font-semibold",style:{color:e?.title||"#1f2937"}},y.label)),!1!==y.showLabel&&y.description&&React.createElement("div",{className:"text-[11px] pl-[34px] pr-3 pb-1",style:{color:e?.desc||"#6b7280",backgroundColor:e?.bg||"#f3f4f6",whiteSpace:"pre-line"},dangerouslySetInnerHTML:{__html:y.description}}),React.createElement(nk,{field:y,isTableMode:!0,formValues:n,onUpdateValue:r,onFillFields:u,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,fieldPermissions:d,formMode:f,tableBorderColor:g,chineseFieldNames:v}))}const k=!!o?.[y.name];return"__applicant__system"===y._id&&y.hidden?React.createElement("div",{key:y._id,style:{...x,display:"none"},"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name},React.createElement(Ix,{field:y,value:(p||mk)(n[y.name]??y.defaultValue??""),onChange:e=>r(y.name,e),isTableMode:!0,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,formValues:n})):React.createElement("div",{key:y._id,style:x,"data-field-cell":"","data-field-type":y.type,"data-field-name":y.name,className:`field-cell field-cell-${y.type} p-0`},React.createElement("div",{className:"flex h-full min-w-0 overflow-hidden"},!1!==y.showLabel&&React.createElement("div",{"data-field-label":"",className:po("field-label w-28 lg:w-32 shrink-0 border-r px-2.5 py-2 flex items-center justify-center",k?"bg-red-50":"bg-gray-50/30",y.labelClassName||c),style:{borderColor:E}},React.createElement("span",{className:po("text-[13px] font-medium break-words text-center leading-snug",k?"text-red-700":"text-gray-600",y.labelClassName||c)},y.label),y.required&&!y.readonly&&React.createElement("span",{className:"text-red-500 text-[10px] font-bold ml-0.5"},"*")),React.createElement("div",{"data-field-item":"",className:po("field-item flex-1 min-w-0 overflow-hidden flex flex-col justify-center",!y.readonly&&"formula"!==y.type&&"__applicant__system"!==y._id&&(k?"bg-red-100/90":"bg-amber-50/80"))},React.createElement(Ix,{field:y,value:(p||mk)(n[y.name]??y.defaultValue??""),onChange:e=>r(y.name,e),isTableMode:!0,hasError:k,searchUsersFn:s,searchOrgsFn:a,searchObjectFn:l,onFillFields:u,formValues:n,historyApproves:h,previewMode:m}),k&&React.createElement("p",{className:"text-[11px] text-red-700 bg-red-100/90 px-2 py-0.5 leading-tight"},o[y.name]))))}))}function hk(e,t){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("__TODAY_AT__"===e){const e=new Date,n=String(t?.defaultHour??9).padStart(2,"0"),r=String(t?.defaultMinute??0).padStart(2,"0");return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${n}:${r}`}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("${")?String(qx(e,{})):e}function mk(e){return null==e||"string"!=typeof e?e:e&&e.includes("${")?hk(e):e}function gk(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 yk=e.forwardRef(({fields:n,values:r,onChange:o,onSubmit:i,formName:s,formTitle:a,viewMode:l="form",readOnly:c=!1,formMode:u="editable",fieldPermissions:d,formEvents:f,showButtons:p=!0,searchUsersFn:h,searchOrgsFn:m,tableColumns:g=2,searchObjectFn:y,className:b,labelClassName:v,onUpdateField:w,compact:x=!1,showFormName:k=!0,currentUser:S,applicant:E,state:M="draft",submitDate:C,context:N,currentStep:R={},currentApprove:_={},instance:O={},historyApproves:T=[],previewMode:A=!1,formColumns:D=2,tableTitleColor:$,tableBorderColor:L="#000000",tableShowLeftBorder:j=!0,tableShowRightBorder:I=!0,noMaxWidth:z=!1,chineseFieldNames:P=!1},F)=>{const[B,H]=t.message.useMessage(),V=e.useCallback(e=>{const t=mk(e??"");return"__CURRENT_USER__"===t?S?.user||"":"__CURRENT_USER_ORG__"===t?S?.organization?._id||"":t},[S?.user,S?.organization?._id]),q=e.useMemo(()=>{const e=S?.organization;if(e?._id)return{id:e._id,name:e.name||"",fullname:e.fullname||""}},[S?.organization]),U=e.useMemo(()=>n.map(e=>{const t=e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:hk(e.defaultValue,e)}:e;if(t.children?.length){const e=t.children.map(e=>e.defaultValue&&e.defaultValue.includes("${")?{...e,defaultValue:hk(e.defaultValue,e)}:e);return{...t,children:e}}return t}),[n.map(e=>`${e.name}:${e.defaultValue??""}:${(e.children||[]).map(e=>`${e.name}:${e.defaultValue??""}`).join(",")}`).join("|")]),W=c||"readonly"===u||"print"===u,Y=W?"print"===u?"print":"readonly":u,J=e.useMemo(()=>U.map(e=>{if(W)return{...e,readonly:!0};if(!d)return e;const t=d[e.name];return"hidden"===t?{...e,hidden:!0}:"editable"===t||["table","grid"].includes(e.type)&&!t&&e.children?.some(e=>d[e.name])?e:{...e,readonly:!0}}),[U,d,W]);console.log("FormRenderer externalValues",r);const K=E||S?.user,G=e.useMemo(()=>{const e={_id:"__applicant__system",name:"__applicant",label:"提交人",type:"member",required:!1,readonly:"draft"!==M,hidden:!1,colspan:12,pickerMultiple:!1,defaultValue:K,valueFormat:"string"};return J.some(e=>"__applicant"===e.name)?J.map(e=>"__applicant"===e.name?{...e,_id:"__applicant__system",type:"member",readonly:"draft"!==M,defaultValue:E||e.defaultValue||S?.user,valueFormat:"string"}:e):[...J,e]},[J,S,M,K,E]),[Z,Q]=e.useState(()=>{const e={};for(const r of n){if(r.defaultValue){const t=hk(r.defaultValue,r);"__CURRENT_USER__"===t?S?.user&&(e[r.name]=S.user):"__CURRENT_USER_ORG__"===t?S?.organization?._id&&(e[r.name]={id:S.organization._id,name:S.organization.name||"",fullname:S.organization.fullname||""}):e[r.name]=t}if(r.children?.length)for(const t of r.children)if(t.defaultValue){const n=hk(t.defaultValue,t);"__CURRENT_USER__"===n?S?.user&&(e[t.name]=S.user):"__CURRENT_USER_ORG__"===n?S?.organization?._id&&(e[t.name]={id:S.organization._id,name:S.organization.name||"",fullname:S.organization.fullname||""}):e[t.name]=n}}const t={...e,...r||{}};return E&&(t.__applicant=E),t}),[X,ee]=e.useState({}),[te,ne]=e.useState({}),re=e.useRef(Z);e.useEffect(()=>{re.current=Z},[Z]),e.useEffect(()=>{Q(e=>{const t={};for(const n of U){if(n.defaultValue&&null==e[n.name]){const e=n.defaultValue;"__CURRENT_USER__"===e?S?.user&&(t[n.name]=S.user):"__CURRENT_USER_ORG__"===e?q&&(t[n.name]=q):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?S?.user&&(t[r.name]=S.user):"__CURRENT_USER_ORG__"===e?q&&(t[r.name]=q):t[r.name]=e}}return Object.keys(t).length>0?{...e,...t}:e})},[U,S?.user,q]);const oe=e.useRef("");e.useEffect(()=>{if(!r)return;const e=JSON.stringify(r);e!==oe.current&&(oe.current=e,Q(e=>{const t={...e};let n=!1;for(const[o,i]of Object.entries(r)){const e=V(i);t[o]!==e&&(t[o]=e,n=!0)}return n?t:e}))},[r,V]),e.useEffect(()=>{E&&Q(e=>e.__applicant===E?e:{...e,__applicant:E})},[E]);const ie=e.useMemo(()=>{const e=String(R?.name??"");return{...Z,stepName:e}},[Z,R]),se=G.filter(e=>(!e.hidden||"__applicant__system"===e._id)&&(e.visibilityExpression?.trim()?fe(e.visibilityExpression,ie):!e.visibilityRules?.length||fk(e.visibilityRules,e.visibilityLogic,ie))),ae=se.filter((e,t)=>{if("section"!==e.type)return!0;if(e.description)return!0;for(let n=t+1;n<se.length;n++){const e=se[n];if("section"===e.type)break;if("__applicant__system"!==e._id)return!0}return!1}).map(e=>{let t=e;if(t.requiredExpression?.trim()){const e=fe(t.requiredExpression,ie);e!==t.required&&(t={...t,required:t.required||e})}else if(t.requiredRules?.length){const e=fk(t.requiredRules,t.requiredLogic,ie);e!==t.required&&(t={...t,required:t.required||e})}if(["table","grid"].includes(t.type)&&t.children?.length)if("table"===t.type){const n=t.children.filter(e=>!e.hidden&&(!d||"hidden"!==d[e.name])).map(e=>(d&&"editable"!==d[e.name]&&(e={...e,readonly:!0}),e));t=t===e?{...e,children:n}:{...t,children:n}}else{const n=t.children.filter(e=>!e.hidden&&((!d||"hidden"!==d[e.name])&&(e.visibilityExpression?.trim()?fe(e.visibilityExpression,ie):!e.visibilityRules?.length||fk(e.visibilityRules,e.visibilityLogic,ie)))).map(e=>{if(d&&"editable"!==d[e.name]&&(e={...e,readonly:!0}),e.requiredExpression?.trim()){const t=fe(e.requiredExpression,ie);return t!==e.required?{...e,required:e.required||t}:e}if(!e.requiredRules?.length)return e;const t=fk(e.requiredRules,e.requiredLogic,ie);return t!==e.required?{...e,required:e.required||t}:e});t=t===e?{...e,children:n}:{...t,children:n}}return t}),le=function(e,t=2){const n=[];let r=[],o=0;for(const i of e)if(!i.hidden)if(_s(i)||Os(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}(ae,"table"===l?g:D),ce=[...G.filter(e=>"formula"===e.type&&e.formula),...G.filter(e=>"grid"===e.type&&e.children).flatMap(e=>e.children.filter(e=>"formula"===e.type&&e.formula))];e.useEffect(()=>{let e=!1;const t={...Z};for(const n of ce){const r=qx(n.formula,Z,P);t[n.name]!==r&&(t[n.name]=r,e=!0)}e&&(Q(t),o?.(t))},[Z,ce.map(e=>e.name+":"+e.formula).join(",")]);const ue=e.useRef(!1);e.useEffect(()=>{if(ue.current)return;if(!f?.onInit)return;ue.current=!0;const e=Wn(re.current,(e,t)=>{Q(n=>{const r={...n,[e]:t};return o?.(r),r})},G,w,B,N,R,_,O);Yn(f.onInit,{form:e,fields:G,values:re.current}).catch(e=>{console.error("[FormRenderer] onInit error:",e)})},[f?.onInit]);const de=e.useMemo(()=>{const e=[];for(const n of ae)"grid"===n.type&&n.children?.length?e.push(...n.children):e.push(n);const t=new Set(e.map(e=>e.name));for(const n of G)if(n.preserveValueWhenHidden&&!t.has(n.name))if("grid"===n.type&&n.children?.length)for(const r of n.children)t.has(r.name)||(e.push(r),t.add(r.name));else e.push(n),t.add(n.name);return e},[ae,G]),pe=e.useRef(async()=>!0);e.useImperativeHandle(F,()=>({getValues:()=>{const e={};return de.forEach(t=>{e[t.name]=Z[t.name]??t.defaultValue??""}),e},validate:async()=>{const e=[],t={},n={},r=e=>{if(!e)return[];try{const t="string"==typeof e?JSON.parse(e):e;return Array.isArray(t)?t:[]}catch{return[]}};if(de.forEach(o=>{const i=Z[o.name]??o.defaultValue??"";if(o.required&&!o.readonly){let n=!1;if("table"===o.type){const e=r(i);n=0===e.length||1===e.length&&!Object.values(e[0]).some(e=>null!=e&&""!==e)}else n=0!==i&&!1!==i&&!i;if(n){const n=`${o.label} 不能为空`;return e.push(n),void(t[o.name]=n)}}if("number"===o.type&&""!==i&&null!=i){const n=Number(i);if(!isNaN(n))if(null!=o.min&&n<o.min){const n=`${o.label} 不能小于 ${o.min}`;e.push(n),t[o.name]=n}else if(null!=o.max&&n>o.max){const n=`${o.label} 不能大于 ${o.max}`;e.push(n),t[o.name]=n}}if(["text","textarea"].includes(o.type)&&"string"==typeof i&&""!==i)if(null!=o.minLength&&i.length<o.minLength){const n=`${o.label} 长度不能少于 ${o.minLength} 个字符`;e.push(n),t[o.name]=n}else if(null!=o.maxLength&&i.length>o.maxLength){const n=`${o.label} 长度不能超过 ${o.maxLength} 个字符`;e.push(n),t[o.name]=n}if("table"===o.type){const s=r(i),a=s.filter(e=>Object.values(e).some(e=>null!=e&&""!==e));if(null!=o.minRows&&a.length<o.minRows){const n=`${o.label} 至少需要填写 ${o.minRows} 行数据`;e.push(n),t[o.name]=n}else if(null!=o.maxRows&&s.length>o.maxRows){const n=`${o.label} 不能超过 ${o.maxRows} 行`;e.push(n),t[o.name]=n}if(o.children?.length){const t=s.map(e=>{const t={};for(const n of o.children){if(n.readonly||"formula"===n.type)continue;const r={...Z,...e};if(n.visibilityExpression?.trim()){if(!fe(n.visibilityExpression,r))continue}else if(n.visibilityRules?.length&&!fk(n.visibilityRules,n.visibilityLogic,r))continue;let o=!!n.required;!o&&n.requiredExpression?.trim()?o=fe(n.requiredExpression,r):!o&&n.requiredRules?.length&&(o=fk(n.requiredRules,n.requiredLogic,r));const i=e[n.name]??"";if(o&&0!==i&&!1!==i&&!i)t[n.name]=`${n.label} 不能为空`;else if("number"===n.type&&""!==i){const e=Number(i);isNaN(e)||(null!=n.min&&e<n.min?t[n.name]=`${n.label} 不能小于 ${n.min}`:null!=n.max&&e>n.max&&(t[n.name]=`${n.label} 不能大于 ${n.max}`))}else if(["text","textarea"].includes(n.type)&&""!==i){const e=String(i);null!=n.minLength&&e.length<n.minLength?t[n.name]=`${n.label} 长度不能少于 ${n.minLength} 个字符`:null!=n.maxLength&&e.length>n.maxLength&&(t[n.name]=`${n.label} 长度不能超过 ${n.maxLength} 个字符`)}}return t});t.some(e=>Object.keys(e).length>0)&&(n[o.name]=t,t.forEach((t,n)=>{Object.keys(t).length>0&&e.push(`${o.label} 第 ${n+1} 行:${Object.values(t).join("、")}`)}))}}}),ee(t),ne(n),e.length>0){B.error({content:1===e.length?e[0]:`表单校验未通过,请检查以下字段:${e.join(";")}`,duration:4});const n=de.find(e=>t[e.name]);n&&setTimeout(()=>{const e=document.querySelector(`[data-field-name="${n.name}"]`);e?.scrollIntoView({behavior:"smooth",block:"center"})},0)}return{isValid:0===e.length,errors:e}},submit:async()=>await pe.current()}),[Z,de,ee,ne,B]);const he=e.useCallback((e,t)=>{ee(t=>{if(!t[e])return t;const n={...t};return delete n[e],n}),Q(n=>{const r={...n,[e]:t};return o?.(r),r})},[o]),me=e.useCallback((e,t)=>{const n=re.current[e]||"";if(he(e,t),f?.onValueChange){let r=G.find(t=>t.name===e);if(!r)for(const t of G)if(t.children){const n=t.children.find(t=>t.name===e);if(n){r=n;break}}const o={...re.current,[e]:t},i=Wn(o,he,G,w,B,N,R,_,O);Yn(f.onValueChange,{field:r?{name:r.name,label:r.label,type:r.type}:{name:e},value:t,oldValue:n,form:i,values:o,fields:G}).catch(e=>{console.error("[FormRenderer] onValueChange error:",e)})}},[f?.onValueChange,G,he,w,B,N,R,_,O]),ge=e.useCallback(async e=>{ee(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});const t={...e},n=[];for(const[r,o]of Object.entries(e)){if(!o||"string"!=typeof o)continue;const e=ck(G,r);e&&("org"===e.type?n.push(uk(o).then(e=>{e&&(t[r]=e)})):"member"===e.type&&n.push(dk(o).then(e=>{e&&(t[r]=e)})))}n.length>0&&await Promise.all(n),Q(e=>{const n={...e,...t};return o?.(n),n})},[o,G]),ye=e.useCallback(async()=>{if(f?.onSubmit){const t=Wn(re.current,he,G,w,B,N,R,_,O);try{if(!1===await Yn(f.onSubmit,{form:t,values:{...re.current},fields:G}))return!1}catch(e){return console.error("[FormRenderer] onSubmit error:",e),!1}}return i?.(re.current),!0},[f?.onSubmit,G,he,w,B,N,R,_,O,i]);if(pe.current=ye,0===G.length)return React.createElement("div",{className:`workflow-form-v2 h-full flex items-center justify-center ${b||""}`},H,React.createElement("p",{className:"text-[13px] text-gray-400"},"表单为空,请先添加字段"));if("table"===l){const e=ae.filter(e=>"__applicant__system"!==e._id),t=ae.find(e=>"__applicant__system"===e._id),n=t?X[t.name]:void 0;return React.createElement("div",{className:`workflow-form-v2 p-6 max-w-4xl m-auto h-full overflow-y-auto custom-scrollbar ${"print"===Y?"workflow-form-print":""} ${b||""}`},H,React.createElement("div",{className:"mx-auto"},k&&(a||s)&&React.createElement("div",{className:"mb-4 text-center"},a?React.createElement("div",{className:"text-xl font-bold",style:$?{color:$}:void 0,dangerouslySetInnerHTML:{__html:a}}):React.createElement("h2",{className:"text-xl font-bold",style:$?{color:$}:void 0},s)),React.createElement(pk,{fields:e,columns:g,formValues:Z,updateValue:me,fieldErrors:X,tableRowErrors:te,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,labelClassName:v,onFillFields:ge,fieldPermissions:d,formMode:Y,resolveValue:V,historyApproves:T,previewMode:A,tableBorderColor:L,tableShowLeftBorder:j,tableShowRightBorder:I,chineseFieldNames:P}),t&&!t.hidden&&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 [&_input]:!pl-0 [&_.field-input-wrapper]:!border-0 [&_.field-input-wrapper]:!shadow-none [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Ix,{field:t,value:V(Z[t.name]??t.defaultValue??""),onChange:e=>me(t.name,e),hasError:!!n,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,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"!==M&&C&&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"},gk(C))))))}return React.createElement("div",{className:`workflow-form-v2 h-full overflow-y-auto custom-scrollbar ${x?"bg-white":"bg-gray-50/50"} ${"print"===Y?"workflow-form-print":""} ${b||""}`},H,React.createElement("div",{className:x?"px-3 py-3":`p-6${z?"":" max-w-3xl"} mx-auto`},k&&(a||s)&&React.createElement("div",{className:x?"mb-3 text-center":"mb-6 text-center"},a?React.createElement("div",{className:x?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800",dangerouslySetInnerHTML:{__html:a}}):React.createElement("h2",{className:x?"text-[15px] font-bold text-gray-800":"text-xl font-bold text-gray-800"},s)),React.createElement("div",{className:"workflow-form-v2-body "+(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(${D}, minmax(0, 1fr))`}},le.map((e,t)=>{const n=e[0];if("section"===n.type){const e=lk(n);return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},React.createElement("div",{className:"flex items-center gap-2 mb-1"},React.createElement("h3",{className:(x?"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:x?"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)?lk(n):null;return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},!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||"#1f2937"}},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||"#6b7280"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(ek,{field:n,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,value:Z[n.name],onChange:e=>me(n.name,e),fieldPermissions:d,rowErrors:te[n.name],parentFormValues:Z,chineseFieldNames:P}))}if("grid"===n.type){const e=!1!==n.showLabel&&(n.colorScheme||n.sectionColor)?lk(n):null;return React.createElement("div",{key:t,className:"",style:x?void 0:{gridColumn:`span ${D}`}},!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||"#1f2937"}},n.label)),!1!==n.showLabel&&n.description&&React.createElement("div",{className:"text-[11px] mb-1",style:{color:e?.desc||"#6b7280"},dangerouslySetInnerHTML:{__html:n.description}}),React.createElement(nk,{field:n,formValues:Z,onUpdateValue:me,onFillFields:ge,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,fieldPermissions:d,formMode:Y,compact:x,chineseFieldNames:P}))}return e.map(e=>{const t=_s(e)||Os(e.type),n=!1!==e.showLabel&&"checkbox"!==e.type,r=X[e.name],o="__applicant__system"===e._id,i=t||o;return o&&e.hidden?React.createElement("div",{key:e._id,"data-field-name":e.name,style:{display:"none"}},React.createElement(Ix,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,formValues:Z})):React.createElement("div",{key:e._id,"data-field-name":e.name,className:x?"":"relative",style:x?void 0:i?{gridColumn:`span ${D}`}:void 0},o&&x?React.createElement(React.Fragment,null,React.createElement("div",{className:"flex items-center gap-2"},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 [&_input]:!pl-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Ix,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,minimal:!0}))),"draft"!==M&&C&&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 whitespace-nowrap"},gk(C)))),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)):o?React.createElement("div",{className:"flex items-center gap-2"},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 [&_input]:!pl-0 [&>div]:!border-0 [&>div]:!shadow-none"},React.createElement(Ix,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A,minimal:!0}))),"draft"!==M&&C&&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"},gk(C))),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"} ${x?"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 "+(x?"mb-1":"mb-1.5")},e.description),React.createElement(Ix,{field:e,value:V(Z[e.name]??e.defaultValue??""),onChange:t=>me(e.name,t),hasError:!!r,searchUsersFn:h,searchOrgsFn:m,searchObjectFn:y,onFillFields:ge,formValues:Z,historyApproves:T,previewMode:A}),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)))})})),p&&"editable"===Y&&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:ye,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`},"提交")))))}),bk={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 vk(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(bk,null,!0),e.locale("zh-cn")),u.extend(p),u.extend(g),u.extend(v),u.locale("zh-cn")}(),function(){try{const e=10,t=[];for(let r=localStorage.length-1;r>=0;r--){const e=localStorage.key(r);if(e&&(e.startsWith("/app/")||e.startsWith("/api/"))){const n=localStorage.getItem(e);t.push({key:e,size:n?n.length:0})}}if(t.length<=e)return;t.sort((e,t)=>t.key.length-e.key.length);const n=t.slice(e);for(const{key:r}of n)localStorage.removeItem(r);n.length>0&&console.log(`[workflow-form-v2] Cleaned up ${n.length} stale amis localStorage entries`)}catch{}}(),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,currentApprove:u,instance:d,applicant:f}=n,p=t.ScopedContext,h=e.useContext(p),m=e.useRef(null),g={getValues:()=>vk(m.current?.getValues()||w,b),validate:async()=>{const e=await(m.current?m.current.validate():Promise.resolve({isValid:!0,errors:[]}));return console.log("[workflow-form-v2] validate result",e),e.isValid},submit:async()=>!m.current||await m.current.submit()},y=e.useRef(null);null===y.current?y.current={...g}:Object.assign(y.current,g),Object.defineProperty(y.current,"props",{get:()=>n,configurable:!0}),e.useEffect(()=>{if(h&&(r.id||n.id))return h.registerComponent(y.current),()=>{h.unRegisterComponent(y.current)}},[r.id||n.id]);let b=[];Array.isArray(r.fields)?b=r.fields:"string"==typeof r.fields&&o&&(b=o[r.fields.replace(/^\$\{|\}$/g,"")]||[]),!b.length&&Array.isArray(o?.fields)&&(b=o.fields);let v={};r.values&&"object"==typeof r.values?v=r.values:"string"==typeof r.values&&o&&(v=o[r.values.replace(/^\$\{|\}$/g,"")]||{}),!Object.keys(v).length&&o?.values&&"object"==typeof o.values&&(v=o.values);const w=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?"":"number"==typeof r||"boolean"==typeof r?r:String(r);return t}(v),[JSON.stringify(v)]),[x,k]=e.useState(!1);e.useEffect(()=>{const e=()=>{k(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const S=x?"form":r.viewMode||"form",E=x?1:r.tableColumns||2,M=r.layout??r.formColumns,N=x||"single"===M?1:"double"===M?2:Math.min(Math.max(Number(M)||2,1),3),R=r.readOnly??r.static??!1,_=r.formMode||"editable",O=r.formName||o?.formName||"",T=r.formTitle||o?.formTitle||"",A=r.showButtons??!0,D=!!x||(r.compact??!1),$=r.showFormName??!0,L=r.formEvents,j=r.tableTitleColor||void 0,I=r.tableBorderColor||"#000000",z=!1!==r.tableShowOuterBorder,P=r.chineseFieldNames??!1,F=f||r.applicant||o?.applicant||void 0;let B,H=[];Array.isArray(r.historyApproves)?H=r.historyApproves:"string"==typeof r.historyApproves&&o&&(H=o[r.historyApproves.replace(/^\$\{|\}$/g,"")]||[]),Array.isArray(H)&&0!==H.length||!Array.isArray(o?.historyApproves)||(H=o.historyApproves),"editable"===_&&(r.fieldPermissions&&"object"==typeof r.fieldPermissions?B=r.fieldPermissions:"string"==typeof r.fieldPermissions&&o&&(B=o[r.fieldPermissions.replace(/^\$\{|\}$/g,"")]),!B&&o?.fieldPermissions&&(B=o.fieldPermissions));const V=r.apiBaseUrl||o?.context?.rootUrl||o?.rootUrl||"",q=r.authToken||o?.context?.authToken||o?.authToken||"",U=r.spaceId||o?.context?.spaceId||o?.spaceId||"",W=e.useCallback(async e=>{if(e=e?.trim()||"",!V)return[];try{const t=`${V}/api/v6/space_users?$top=20&$select=name,user,mobile&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),Y=e.useCallback(async e=>{if(e=e?.trim()||"",!V)return[];try{const t=`${V}/api/v6/organizations?$top=20&$select=name,fullname&$filter=contains(name,'${encodeURIComponent(e)}')`,n=await fetch(t,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),J=e.useCallback((e,t)=>async n=>{if(n=n?.trim()||"",!V||!e)return[];try{const r=n?`&$filter=contains(${encodeURIComponent(t)},'${encodeURIComponent(n)}')`:"",o=`${V}/api/v6/${encodeURIComponent(e)}?$top=20&$select=_id,${encodeURIComponent(t)}${r}`,i=await fetch(o,{headers:{Authorization:`Bearer ${U},${q}`}}),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),[]}},[V,q,U]),K={props:n,getValues:g.getValues,validate:g.validate,submit:g.submit};return e.createElement(yk,{fields:b,values:w,ref:m,onChange:e=>{const t=vk(e,b);i?.("change",t?C(o,{value:t}):o,K)},onSubmit:e=>{const t=vk(e,b);i?.("submit",t?C(o,{value:t}):o,K)},formName:O,formTitle:T||void 0,viewMode:S,tableColumns:E,formColumns:N,readOnly:R,formMode:_,fieldPermissions:B,formEvents:L,showButtons:A,compact:D,showFormName:$,searchUsersFn:W,searchOrgsFn:Y,searchObjectFn:J,currentUser:s,applicant:F,state:a,submitDate:l,currentStep:c||r.currentStep||{},currentApprove:u||r.currentApprove||{},instance:d||r.instance||{},historyApproves:Array.isArray(H)?H:[],tableTitleColor:j,tableBorderColor:I,tableShowLeftBorder:z,tableShowRightBorder:z,noMaxWidth:!0,chineseFieldNames:P,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"));