@zipify/wysiwyg 4.9.1 → 4.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,59 +1,59 @@
1
- "use strict";var Jx=require("node:events"),jx=require("node:child_process"),Yx=require("node:path"),Xx=require("node:fs"),Zx=require("node:process"),Fp=require("path"),zp=require("jsdom"),$o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Tt={},Ho={},Wo={},Bp;function Vo(){if(Bp)return Wo;Bp=1;class n extends Error{constructor(r,i,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=r,this.nestedError=void 0}}class e extends n{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return Wo.CommanderError=n,Wo.InvalidArgumentError=e,Wo}var $p;function $u(){if($p)return Ho;$p=1;const{InvalidArgumentError:n}=Vo();class e{constructor(i,o){switch(this.description=o||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,o){return o===this.defaultValue||!Array.isArray(o)?[i]:o.concat(i)}default(i,o){return this.defaultValue=i,this.defaultValueDescription=o,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(o,a)=>{if(!this.argChoices.includes(o))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(o,a):o},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function t(r){const i=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+i+">":"["+i+"]"}return Ho.Argument=e,Ho.humanReadableArgName=t,Ho}var Hu={},Wu={},Hp;function Wp(){if(Hp)return Wu;Hp=1;const{humanReadableArgName:n}=$u();class e{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(r){const i=r.commands.filter(a=>!a._hidden),o=r._getHelpCommand();return o&&!o._hidden&&i.push(o),this.sortSubcommands&&i.sort((a,u)=>a.name().localeCompare(u.name())),i}compareOptions(r,i){const o=a=>a.short?a.short.replace(/^-/,""):a.long.replace(/^--/,"");return o(r).localeCompare(o(i))}visibleOptions(r){const i=r.options.filter(a=>!a.hidden),o=r._getHelpOption();if(o&&!o.hidden){const a=o.short&&r._findOption(o.short),u=o.long&&r._findOption(o.long);!a&&!u?i.push(o):o.long&&!u?i.push(r.createOption(o.long,o.description)):o.short&&!a&&i.push(r.createOption(o.short,o.description))}return this.sortOptions&&i.sort(this.compareOptions),i}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];const i=[];for(let o=r.parent;o;o=o.parent){const a=o.options.filter(u=>!u.hidden);i.push(...a)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(i=>{i.description=i.description||r._argsDescription[i.name()]||""}),r.registeredArguments.find(i=>i.description)?r.registeredArguments:[]}subcommandTerm(r){const i=r.registeredArguments.map(o=>n(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(i?" "+i:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,i){return i.visibleCommands(r).reduce((o,a)=>Math.max(o,i.subcommandTerm(a).length),0)}longestOptionTermLength(r,i){return i.visibleOptions(r).reduce((o,a)=>Math.max(o,i.optionTerm(a).length),0)}longestGlobalOptionTermLength(r,i){return i.visibleGlobalOptions(r).reduce((o,a)=>Math.max(o,i.optionTerm(a).length),0)}longestArgumentTermLength(r,i){return i.visibleArguments(r).reduce((o,a)=>Math.max(o,i.argumentTerm(a).length),0)}commandUsage(r){let i=r._name;r._aliases[0]&&(i=i+"|"+r._aliases[0]);let o="";for(let a=r.parent;a;a=a.parent)o=a.name()+" "+o;return o+i+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){const i=[];return r.argChoices&&i.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&i.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&i.push(`env: ${r.envVar}`),i.length>0?`${r.description} (${i.join(", ")})`:r.description}argumentDescription(r){const i=[];if(r.argChoices&&i.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),i.length>0){const o=`(${i.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatHelp(r,i){const o=i.padWidth(r,i),a=i.helpWidth||80,u=2,f=2;function h(_,x){if(x){const E=`${_.padEnd(o+f)}${x}`;return i.wrap(E,a-u,o+f)}return _}function m(_){return _.join(`
2
- `).replace(/^/gm," ".repeat(u))}let p=[`Usage: ${i.commandUsage(r)}`,""];const b=i.commandDescription(r);b.length>0&&(p=p.concat([i.wrap(b,a,0),""]));const S=i.visibleArguments(r).map(_=>h(i.argumentTerm(_),i.argumentDescription(_)));S.length>0&&(p=p.concat(["Arguments:",m(S),""]));const k=i.visibleOptions(r).map(_=>h(i.optionTerm(_),i.optionDescription(_)));if(k.length>0&&(p=p.concat(["Options:",m(k),""])),this.showGlobalOptions){const _=i.visibleGlobalOptions(r).map(x=>h(i.optionTerm(x),i.optionDescription(x)));_.length>0&&(p=p.concat(["Global Options:",m(_),""]))}const g=i.visibleCommands(r).map(_=>h(i.subcommandTerm(_),i.subcommandDescription(_)));return g.length>0&&(p=p.concat(["Commands:",m(g),""])),p.join(`
1
+ "use strict";var t5=require("node:events"),n5=require("node:child_process"),r5=require("node:path"),i5=require("node:fs"),s5=require("node:process"),qp=require("path"),Kp=require("jsdom"),qo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function o5(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var It={},Ko={},Go={},Gp;function Jo(){if(Gp)return Go;Gp=1;class n extends Error{constructor(r,i,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=r,this.nestedError=void 0}}class e extends n{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return Go.CommanderError=n,Go.InvalidArgumentError=e,Go}var Jp;function Gu(){if(Jp)return Ko;Jp=1;const{InvalidArgumentError:n}=Jo();class e{constructor(i,o){switch(this.description=o||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(i,o){return o===this.defaultValue||!Array.isArray(o)?[i]:o.concat(i)}default(i,o){return this.defaultValue=i,this.defaultValueDescription=o,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(o,a)=>{if(!this.argChoices.includes(o))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(o,a):o},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function t(r){const i=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+i+">":"["+i+"]"}return Ko.Argument=e,Ko.humanReadableArgName=t,Ko}var Ju={},ju={},jp;function Yp(){if(jp)return ju;jp=1;const{humanReadableArgName:n}=Gu();class e{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(r){const i=r.commands.filter(a=>!a._hidden),o=r._getHelpCommand();return o&&!o._hidden&&i.push(o),this.sortSubcommands&&i.sort((a,u)=>a.name().localeCompare(u.name())),i}compareOptions(r,i){const o=a=>a.short?a.short.replace(/^-/,""):a.long.replace(/^--/,"");return o(r).localeCompare(o(i))}visibleOptions(r){const i=r.options.filter(a=>!a.hidden),o=r._getHelpOption();if(o&&!o.hidden){const a=o.short&&r._findOption(o.short),u=o.long&&r._findOption(o.long);!a&&!u?i.push(o):o.long&&!u?i.push(r.createOption(o.long,o.description)):o.short&&!a&&i.push(r.createOption(o.short,o.description))}return this.sortOptions&&i.sort(this.compareOptions),i}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];const i=[];for(let o=r.parent;o;o=o.parent){const a=o.options.filter(u=>!u.hidden);i.push(...a)}return this.sortOptions&&i.sort(this.compareOptions),i}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(i=>{i.description=i.description||r._argsDescription[i.name()]||""}),r.registeredArguments.find(i=>i.description)?r.registeredArguments:[]}subcommandTerm(r){const i=r.registeredArguments.map(o=>n(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(i?" "+i:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,i){return i.visibleCommands(r).reduce((o,a)=>Math.max(o,i.subcommandTerm(a).length),0)}longestOptionTermLength(r,i){return i.visibleOptions(r).reduce((o,a)=>Math.max(o,i.optionTerm(a).length),0)}longestGlobalOptionTermLength(r,i){return i.visibleGlobalOptions(r).reduce((o,a)=>Math.max(o,i.optionTerm(a).length),0)}longestArgumentTermLength(r,i){return i.visibleArguments(r).reduce((o,a)=>Math.max(o,i.argumentTerm(a).length),0)}commandUsage(r){let i=r._name;r._aliases[0]&&(i=i+"|"+r._aliases[0]);let o="";for(let a=r.parent;a;a=a.parent)o=a.name()+" "+o;return o+i+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){const i=[];return r.argChoices&&i.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&i.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&i.push(`env: ${r.envVar}`),i.length>0?`${r.description} (${i.join(", ")})`:r.description}argumentDescription(r){const i=[];if(r.argChoices&&i.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&i.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),i.length>0){const o=`(${i.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatHelp(r,i){const o=i.padWidth(r,i),a=i.helpWidth||80,u=2,f=2;function h(_,x){if(x){const k=`${_.padEnd(o+f)}${x}`;return i.wrap(k,a-u,o+f)}return _}function m(_){return _.join(`
2
+ `).replace(/^/gm," ".repeat(u))}let p=[`Usage: ${i.commandUsage(r)}`,""];const b=i.commandDescription(r);b.length>0&&(p=p.concat([i.wrap(b,a,0),""]));const S=i.visibleArguments(r).map(_=>h(i.argumentTerm(_),i.argumentDescription(_)));S.length>0&&(p=p.concat(["Arguments:",m(S),""]));const E=i.visibleOptions(r).map(_=>h(i.optionTerm(_),i.optionDescription(_)));if(E.length>0&&(p=p.concat(["Options:",m(E),""])),this.showGlobalOptions){const _=i.visibleGlobalOptions(r).map(x=>h(i.optionTerm(x),i.optionDescription(x)));_.length>0&&(p=p.concat(["Global Options:",m(_),""]))}const g=i.visibleCommands(r).map(_=>h(i.subcommandTerm(_),i.subcommandDescription(_)));return g.length>0&&(p=p.concat(["Commands:",m(g),""])),p.join(`
3
3
  `)}padWidth(r,i){return Math.max(i.longestOptionTermLength(r,i),i.longestGlobalOptionTermLength(r,i),i.longestSubcommandTermLength(r,i),i.longestArgumentTermLength(r,i))}wrap(r,i,o,a=40){const u=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",f=new RegExp(`[\\n][${u}]+`);if(r.match(f))return r;const h=i-o;if(h<a)return r;const m=r.slice(0,o),p=r.slice(o).replace(`\r
4
4
  `,`
5
- `),b=" ".repeat(o),k="\\s\u200B",g=new RegExp(`
6
- |.{1,${h-1}}([${k}]|$)|[^${k}]+?([${k}]|$)`,"g"),_=p.match(g)||[];return m+_.map((x,E)=>x===`
7
- `?"":(E>0?b:"")+x.trimEnd()).join(`
8
- `)}}return Wu.Help=e,Wu}var Uo={},Vp;function Up(){if(Vp)return Uo;Vp=1;const{InvalidArgumentError:n}=Vo();class e{constructor(a,u){this.flags=a,this.description=u||"",this.required=a.includes("<"),this.optional=a.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(a),this.mandatory=!1;const f=i(a);this.short=f.shortFlag,this.long=f.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(a,u){return this.defaultValue=a,this.defaultValueDescription=u,this}preset(a){return this.presetArg=a,this}conflicts(a){return this.conflictsWith=this.conflictsWith.concat(a),this}implies(a){let u=a;return typeof a=="string"&&(u={[a]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(a){return this.envVar=a,this}argParser(a){return this.parseArg=a,this}makeOptionMandatory(a=!0){return this.mandatory=!!a,this}hideHelp(a=!0){return this.hidden=!!a,this}_concatValue(a,u){return u===this.defaultValue||!Array.isArray(u)?[a]:u.concat(a)}choices(a){return this.argChoices=a.slice(),this.parseArg=(u,f)=>{if(!this.argChoices.includes(u))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,f):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return r(this.name().replace(/^no-/,""))}is(a){return this.short===a||this.long===a}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class t{constructor(a){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,a.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,f)=>{this.positiveOptions.has(f)&&this.dualOptions.add(f)})}valueFromOption(a,u){const f=u.attributeName();if(!this.dualOptions.has(f))return!0;const h=this.negativeOptions.get(f).presetArg,m=h!==void 0?h:!1;return u.negate===(m===a)}}function r(o){return o.split("-").reduce((a,u)=>a+u[0].toUpperCase()+u.slice(1))}function i(o){let a,u;const f=o.split(/[ |,]+/);return f.length>1&&!/^[[<]/.test(f[1])&&(a=f.shift()),u=f.shift(),!a&&/^-[^-]$/.test(u)&&(a=u,u=void 0),{shortFlag:a,longFlag:u}}return Uo.Option=e,Uo.DualOptions=t,Uo}var Vu={},qp;function e5(){if(qp)return Vu;qp=1;const n=3;function e(r,i){if(Math.abs(r.length-i.length)>n)return Math.max(r.length,i.length);const o=[];for(let a=0;a<=r.length;a++)o[a]=[a];for(let a=0;a<=i.length;a++)o[0][a]=a;for(let a=1;a<=i.length;a++)for(let u=1;u<=r.length;u++){let f=1;r[u-1]===i[a-1]?f=0:f=1,o[u][a]=Math.min(o[u-1][a]+1,o[u][a-1]+1,o[u-1][a-1]+f),u>1&&a>1&&r[u-1]===i[a-2]&&r[u-2]===i[a-1]&&(o[u][a]=Math.min(o[u][a],o[u-2][a-2]+1))}return o[r.length][i.length]}function t(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const o=r.startsWith("--");o&&(r=r.slice(2),i=i.map(h=>h.slice(2)));let a=[],u=n;const f=.4;return i.forEach(h=>{if(h.length<=1)return;const m=e(r,h),p=Math.max(r.length,h.length);(p-m)/p>f&&(m<u?(u=m,a=[h]):m===u&&a.push(h))}),a.sort((h,m)=>h.localeCompare(m)),o&&(a=a.map(h=>`--${h}`)),a.length>1?`
5
+ `),b=" ".repeat(o),E="\\s\u200B",g=new RegExp(`
6
+ |.{1,${h-1}}([${E}]|$)|[^${E}]+?([${E}]|$)`,"g"),_=p.match(g)||[];return m+_.map((x,k)=>x===`
7
+ `?"":(k>0?b:"")+x.trimEnd()).join(`
8
+ `)}}return ju.Help=e,ju}var jo={},Xp;function Zp(){if(Xp)return jo;Xp=1;const{InvalidArgumentError:n}=Jo();class e{constructor(a,u){this.flags=a,this.description=u||"",this.required=a.includes("<"),this.optional=a.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(a),this.mandatory=!1;const f=i(a);this.short=f.shortFlag,this.long=f.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(a,u){return this.defaultValue=a,this.defaultValueDescription=u,this}preset(a){return this.presetArg=a,this}conflicts(a){return this.conflictsWith=this.conflictsWith.concat(a),this}implies(a){let u=a;return typeof a=="string"&&(u={[a]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(a){return this.envVar=a,this}argParser(a){return this.parseArg=a,this}makeOptionMandatory(a=!0){return this.mandatory=!!a,this}hideHelp(a=!0){return this.hidden=!!a,this}_concatValue(a,u){return u===this.defaultValue||!Array.isArray(u)?[a]:u.concat(a)}choices(a){return this.argChoices=a.slice(),this.parseArg=(u,f)=>{if(!this.argChoices.includes(u))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,f):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return r(this.name().replace(/^no-/,""))}is(a){return this.short===a||this.long===a}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class t{constructor(a){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,a.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,f)=>{this.positiveOptions.has(f)&&this.dualOptions.add(f)})}valueFromOption(a,u){const f=u.attributeName();if(!this.dualOptions.has(f))return!0;const h=this.negativeOptions.get(f).presetArg,m=h!==void 0?h:!1;return u.negate===(m===a)}}function r(o){return o.split("-").reduce((a,u)=>a+u[0].toUpperCase()+u.slice(1))}function i(o){let a,u;const f=o.split(/[ |,]+/);return f.length>1&&!/^[[<]/.test(f[1])&&(a=f.shift()),u=f.shift(),!a&&/^-[^-]$/.test(u)&&(a=u,u=void 0),{shortFlag:a,longFlag:u}}return jo.Option=e,jo.DualOptions=t,jo}var Yu={},Qp;function a5(){if(Qp)return Yu;Qp=1;const n=3;function e(r,i){if(Math.abs(r.length-i.length)>n)return Math.max(r.length,i.length);const o=[];for(let a=0;a<=r.length;a++)o[a]=[a];for(let a=0;a<=i.length;a++)o[0][a]=a;for(let a=1;a<=i.length;a++)for(let u=1;u<=r.length;u++){let f=1;r[u-1]===i[a-1]?f=0:f=1,o[u][a]=Math.min(o[u-1][a]+1,o[u][a-1]+1,o[u-1][a-1]+f),u>1&&a>1&&r[u-1]===i[a-2]&&r[u-2]===i[a-1]&&(o[u][a]=Math.min(o[u][a],o[u-2][a-2]+1))}return o[r.length][i.length]}function t(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const o=r.startsWith("--");o&&(r=r.slice(2),i=i.map(h=>h.slice(2)));let a=[],u=n;const f=.4;return i.forEach(h=>{if(h.length<=1)return;const m=e(r,h),p=Math.max(r.length,h.length);(p-m)/p>f&&(m<u?(u=m,a=[h]):m===u&&a.push(h))}),a.sort((h,m)=>h.localeCompare(m)),o&&(a=a.map(h=>`--${h}`)),a.length>1?`
9
9
  (Did you mean one of ${a.join(", ")}?)`:a.length===1?`
10
- (Did you mean ${a[0]}?)`:""}return Vu.suggestSimilar=t,Vu}var Kp;function t5(){if(Kp)return Hu;Kp=1;const n=Jx.EventEmitter,e=jx,t=Yx,r=Xx,i=Zx,{Argument:o,humanReadableArgName:a}=$u(),{CommanderError:u}=Vo(),{Help:f}=Wp(),{Option:h,DualOptions:m}=Up(),{suggestSimilar:p}=e5();class b extends n{constructor(g){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=g||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:_=>i.stdout.write(_),writeErr:_=>i.stderr.write(_),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,outputError:(_,x)=>x(_)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(g){return this._outputConfiguration=g._outputConfiguration,this._helpOption=g._helpOption,this._helpCommand=g._helpCommand,this._helpConfiguration=g._helpConfiguration,this._exitCallback=g._exitCallback,this._storeOptionsAsProperties=g._storeOptionsAsProperties,this._combineFlagAndOptionalValue=g._combineFlagAndOptionalValue,this._allowExcessArguments=g._allowExcessArguments,this._enablePositionalOptions=g._enablePositionalOptions,this._showHelpAfterError=g._showHelpAfterError,this._showSuggestionAfterError=g._showSuggestionAfterError,this}_getCommandAndAncestors(){const g=[];for(let _=this;_;_=_.parent)g.push(_);return g}command(g,_,x){let E=_,A=x;typeof E=="object"&&E!==null&&(A=E,E=null),A=A||{};const[,N,W]=g.match(/([^ ]+) *(.*)/),L=this.createCommand(N);return E&&(L.description(E),L._executableHandler=!0),A.isDefault&&(this._defaultCommandName=L._name),L._hidden=!!(A.noHelp||A.hidden),L._executableFile=A.executableFile||null,W&&L.arguments(W),this._registerCommand(L),L.parent=this,L.copyInheritedSettings(this),E?this:L}createCommand(g){return new b(g)}createHelp(){return Object.assign(new f,this.configureHelp())}configureHelp(g){return g===void 0?this._helpConfiguration:(this._helpConfiguration=g,this)}configureOutput(g){return g===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,g),this)}showHelpAfterError(g=!0){return typeof g!="string"&&(g=!!g),this._showHelpAfterError=g,this}showSuggestionAfterError(g=!0){return this._showSuggestionAfterError=!!g,this}addCommand(g,_){if(!g._name)throw new Error(`Command passed to .addCommand() must have a name
11
- - specify the name in Command constructor or using .name()`);return _=_||{},_.isDefault&&(this._defaultCommandName=g._name),(_.noHelp||_.hidden)&&(g._hidden=!0),this._registerCommand(g),g.parent=this,g._checkForBrokenPassThrough(),this}createArgument(g,_){return new o(g,_)}argument(g,_,x,E){const A=this.createArgument(g,_);return typeof x=="function"?A.default(E).argParser(x):A.default(x),this.addArgument(A),this}arguments(g){return g.trim().split(/ +/).forEach(_=>{this.argument(_)}),this}addArgument(g){const _=this.registeredArguments.slice(-1)[0];if(_&&_.variadic)throw new Error(`only the last argument can be variadic '${_.name()}'`);if(g.required&&g.defaultValue!==void 0&&g.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${g.name()}'`);return this.registeredArguments.push(g),this}helpCommand(g,_){if(typeof g=="boolean")return this._addImplicitHelpCommand=g,this;g=g??"help [command]";const[,x,E]=g.match(/([^ ]+) *(.*)/),A=_??"display help for command",N=this.createCommand(x);return N.helpOption(!1),E&&N.arguments(E),A&&N.description(A),this._addImplicitHelpCommand=!0,this._helpCommand=N,this}addHelpCommand(g,_){return typeof g!="object"?(this.helpCommand(g,_),this):(this._addImplicitHelpCommand=!0,this._helpCommand=g,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(g,_){const x=["preSubcommand","preAction","postAction"];if(!x.includes(g))throw new Error(`Unexpected value for event passed to hook : '${g}'.
12
- Expecting one of '${x.join("', '")}'`);return this._lifeCycleHooks[g]?this._lifeCycleHooks[g].push(_):this._lifeCycleHooks[g]=[_],this}exitOverride(g){return g?this._exitCallback=g:this._exitCallback=_=>{if(_.code!=="commander.executeSubCommandAsync")throw _},this}_exit(g,_,x){this._exitCallback&&this._exitCallback(new u(g,_,x)),i.exit(g)}action(g){const _=x=>{const E=this.registeredArguments.length,A=x.slice(0,E);return this._storeOptionsAsProperties?A[E]=this:A[E]=this.opts(),A.push(this),g.apply(this,A)};return this._actionHandler=_,this}createOption(g,_){return new h(g,_)}_callParseArg(g,_,x,E){try{return g.parseArg(_,x)}catch(A){if(A.code==="commander.invalidArgument"){const N=`${E} ${A.message}`;this.error(N,{exitCode:A.exitCode,code:A.code})}throw A}}_registerOption(g){const _=g.short&&this._findOption(g.short)||g.long&&this._findOption(g.long);if(_){const x=g.long&&this._findOption(g.long)?g.long:g.short;throw new Error(`Cannot add option '${g.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${x}'
13
- - already used by option '${_.flags}'`)}this.options.push(g)}_registerCommand(g){const _=E=>[E.name()].concat(E.aliases()),x=_(g).find(E=>this._findCommand(E));if(x){const E=_(this._findCommand(x)).join("|"),A=_(g).join("|");throw new Error(`cannot add command '${A}' as already have command '${E}'`)}this.commands.push(g)}addOption(g){this._registerOption(g);const _=g.name(),x=g.attributeName();if(g.negate){const A=g.long.replace(/^--no-/,"--");this._findOption(A)||this.setOptionValueWithSource(x,g.defaultValue===void 0?!0:g.defaultValue,"default")}else g.defaultValue!==void 0&&this.setOptionValueWithSource(x,g.defaultValue,"default");const E=(A,N,W)=>{A==null&&g.presetArg!==void 0&&(A=g.presetArg);const L=this.getOptionValue(x);A!==null&&g.parseArg?A=this._callParseArg(g,A,L,N):A!==null&&g.variadic&&(A=g._concatValue(A,L)),A==null&&(g.negate?A=!1:g.isBoolean()||g.optional?A=!0:A=""),this.setOptionValueWithSource(x,A,W)};return this.on("option:"+_,A=>{const N=`error: option '${g.flags}' argument '${A}' is invalid.`;E(A,N,"cli")}),g.envVar&&this.on("optionEnv:"+_,A=>{const N=`error: option '${g.flags}' value '${A}' from env '${g.envVar}' is invalid.`;E(A,N,"env")}),this}_optionEx(g,_,x,E,A){if(typeof _=="object"&&_ instanceof h)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const N=this.createOption(_,x);if(N.makeOptionMandatory(!!g.mandatory),typeof E=="function")N.default(A).argParser(E);else if(E instanceof RegExp){const W=E;E=(L,U)=>{const j=W.exec(L);return j?j[0]:U},N.default(A).argParser(E)}else N.default(E);return this.addOption(N)}option(g,_,x,E){return this._optionEx({},g,_,x,E)}requiredOption(g,_,x,E){return this._optionEx({mandatory:!0},g,_,x,E)}combineFlagAndOptionalValue(g=!0){return this._combineFlagAndOptionalValue=!!g,this}allowUnknownOption(g=!0){return this._allowUnknownOption=!!g,this}allowExcessArguments(g=!0){return this._allowExcessArguments=!!g,this}enablePositionalOptions(g=!0){return this._enablePositionalOptions=!!g,this}passThroughOptions(g=!0){return this._passThroughOptions=!!g,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(g=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!g,this}getOptionValue(g){return this._storeOptionsAsProperties?this[g]:this._optionValues[g]}setOptionValue(g,_){return this.setOptionValueWithSource(g,_,void 0)}setOptionValueWithSource(g,_,x){return this._storeOptionsAsProperties?this[g]=_:this._optionValues[g]=_,this._optionValueSources[g]=x,this}getOptionValueSource(g){return this._optionValueSources[g]}getOptionValueSourceWithGlobals(g){let _;return this._getCommandAndAncestors().forEach(x=>{x.getOptionValueSource(g)!==void 0&&(_=x.getOptionValueSource(g))}),_}_prepareUserArgs(g,_){if(g!==void 0&&!Array.isArray(g))throw new Error("first parameter to parse must be array or undefined");if(_=_||{},g===void 0&&_.from===void 0){i.versions?.electron&&(_.from="electron");const E=i.execArgv??[];(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))&&(_.from="eval")}g===void 0&&(g=i.argv),this.rawArgs=g.slice();let x;switch(_.from){case void 0:case"node":this._scriptPath=g[1],x=g.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=g[1],x=g.slice(2)):x=g.slice(1);break;case"user":x=g.slice(0);break;case"eval":x=g.slice(1);break;default:throw new Error(`unexpected parse option { from: '${_.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",x}parse(g,_){const x=this._prepareUserArgs(g,_);return this._parseCommand([],x),this}async parseAsync(g,_){const x=this._prepareUserArgs(g,_);return await this._parseCommand([],x),this}_executeSubCommand(g,_){_=_.slice();let x=!1;const E=[".js",".ts",".tsx",".mjs",".cjs"];function A(j,me){const St=t.resolve(j,me);if(r.existsSync(St))return St;if(E.includes(t.extname(me)))return;const dt=E.find(Lt=>r.existsSync(`${St}${Lt}`));if(dt)return`${St}${dt}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let N=g._executableFile||`${this._name}-${g._name}`,W=this._executableDir||"";if(this._scriptPath){let j;try{j=r.realpathSync(this._scriptPath)}catch{j=this._scriptPath}W=t.resolve(t.dirname(j),W)}if(W){let j=A(W,N);if(!j&&!g._executableFile&&this._scriptPath){const me=t.basename(this._scriptPath,t.extname(this._scriptPath));me!==this._name&&(j=A(W,`${me}-${g._name}`))}N=j||N}x=E.includes(t.extname(N));let L;i.platform!=="win32"?x?(_.unshift(N),_=S(i.execArgv).concat(_),L=e.spawn(i.argv[0],_,{stdio:"inherit"})):L=e.spawn(N,_,{stdio:"inherit"}):(_.unshift(N),_=S(i.execArgv).concat(_),L=e.spawn(i.execPath,_,{stdio:"inherit"})),L.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(me=>{i.on(me,()=>{L.killed===!1&&L.exitCode===null&&L.kill(me)})});const U=this._exitCallback;L.on("close",j=>{j=j??1,U?U(new u(j,"commander.executeSubCommandAsync","(close)")):i.exit(j)}),L.on("error",j=>{if(j.code==="ENOENT"){const me=W?`searched for local subcommand relative to directory '${W}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",St=`'${N}' does not exist
10
+ (Did you mean ${a[0]}?)`:""}return Yu.suggestSimilar=t,Yu}var em;function l5(){if(em)return Ju;em=1;const n=t5.EventEmitter,e=n5,t=r5,r=i5,i=s5,{Argument:o,humanReadableArgName:a}=Gu(),{CommanderError:u}=Jo(),{Help:f}=Yp(),{Option:h,DualOptions:m}=Zp(),{suggestSimilar:p}=a5();class b extends n{constructor(g){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=g||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:_=>i.stdout.write(_),writeErr:_=>i.stderr.write(_),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,outputError:(_,x)=>x(_)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(g){return this._outputConfiguration=g._outputConfiguration,this._helpOption=g._helpOption,this._helpCommand=g._helpCommand,this._helpConfiguration=g._helpConfiguration,this._exitCallback=g._exitCallback,this._storeOptionsAsProperties=g._storeOptionsAsProperties,this._combineFlagAndOptionalValue=g._combineFlagAndOptionalValue,this._allowExcessArguments=g._allowExcessArguments,this._enablePositionalOptions=g._enablePositionalOptions,this._showHelpAfterError=g._showHelpAfterError,this._showSuggestionAfterError=g._showSuggestionAfterError,this}_getCommandAndAncestors(){const g=[];for(let _=this;_;_=_.parent)g.push(_);return g}command(g,_,x){let k=_,A=x;typeof k=="object"&&k!==null&&(A=k,k=null),A=A||{};const[,N,V]=g.match(/([^ ]+) *(.*)/),L=this.createCommand(N);return k&&(L.description(k),L._executableHandler=!0),A.isDefault&&(this._defaultCommandName=L._name),L._hidden=!!(A.noHelp||A.hidden),L._executableFile=A.executableFile||null,V&&L.arguments(V),this._registerCommand(L),L.parent=this,L.copyInheritedSettings(this),k?this:L}createCommand(g){return new b(g)}createHelp(){return Object.assign(new f,this.configureHelp())}configureHelp(g){return g===void 0?this._helpConfiguration:(this._helpConfiguration=g,this)}configureOutput(g){return g===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,g),this)}showHelpAfterError(g=!0){return typeof g!="string"&&(g=!!g),this._showHelpAfterError=g,this}showSuggestionAfterError(g=!0){return this._showSuggestionAfterError=!!g,this}addCommand(g,_){if(!g._name)throw new Error(`Command passed to .addCommand() must have a name
11
+ - specify the name in Command constructor or using .name()`);return _=_||{},_.isDefault&&(this._defaultCommandName=g._name),(_.noHelp||_.hidden)&&(g._hidden=!0),this._registerCommand(g),g.parent=this,g._checkForBrokenPassThrough(),this}createArgument(g,_){return new o(g,_)}argument(g,_,x,k){const A=this.createArgument(g,_);return typeof x=="function"?A.default(k).argParser(x):A.default(x),this.addArgument(A),this}arguments(g){return g.trim().split(/ +/).forEach(_=>{this.argument(_)}),this}addArgument(g){const _=this.registeredArguments.slice(-1)[0];if(_&&_.variadic)throw new Error(`only the last argument can be variadic '${_.name()}'`);if(g.required&&g.defaultValue!==void 0&&g.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${g.name()}'`);return this.registeredArguments.push(g),this}helpCommand(g,_){if(typeof g=="boolean")return this._addImplicitHelpCommand=g,this;g=g??"help [command]";const[,x,k]=g.match(/([^ ]+) *(.*)/),A=_??"display help for command",N=this.createCommand(x);return N.helpOption(!1),k&&N.arguments(k),A&&N.description(A),this._addImplicitHelpCommand=!0,this._helpCommand=N,this}addHelpCommand(g,_){return typeof g!="object"?(this.helpCommand(g,_),this):(this._addImplicitHelpCommand=!0,this._helpCommand=g,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(g,_){const x=["preSubcommand","preAction","postAction"];if(!x.includes(g))throw new Error(`Unexpected value for event passed to hook : '${g}'.
12
+ Expecting one of '${x.join("', '")}'`);return this._lifeCycleHooks[g]?this._lifeCycleHooks[g].push(_):this._lifeCycleHooks[g]=[_],this}exitOverride(g){return g?this._exitCallback=g:this._exitCallback=_=>{if(_.code!=="commander.executeSubCommandAsync")throw _},this}_exit(g,_,x){this._exitCallback&&this._exitCallback(new u(g,_,x)),i.exit(g)}action(g){const _=x=>{const k=this.registeredArguments.length,A=x.slice(0,k);return this._storeOptionsAsProperties?A[k]=this:A[k]=this.opts(),A.push(this),g.apply(this,A)};return this._actionHandler=_,this}createOption(g,_){return new h(g,_)}_callParseArg(g,_,x,k){try{return g.parseArg(_,x)}catch(A){if(A.code==="commander.invalidArgument"){const N=`${k} ${A.message}`;this.error(N,{exitCode:A.exitCode,code:A.code})}throw A}}_registerOption(g){const _=g.short&&this._findOption(g.short)||g.long&&this._findOption(g.long);if(_){const x=g.long&&this._findOption(g.long)?g.long:g.short;throw new Error(`Cannot add option '${g.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${x}'
13
+ - already used by option '${_.flags}'`)}this.options.push(g)}_registerCommand(g){const _=k=>[k.name()].concat(k.aliases()),x=_(g).find(k=>this._findCommand(k));if(x){const k=_(this._findCommand(x)).join("|"),A=_(g).join("|");throw new Error(`cannot add command '${A}' as already have command '${k}'`)}this.commands.push(g)}addOption(g){this._registerOption(g);const _=g.name(),x=g.attributeName();if(g.negate){const A=g.long.replace(/^--no-/,"--");this._findOption(A)||this.setOptionValueWithSource(x,g.defaultValue===void 0?!0:g.defaultValue,"default")}else g.defaultValue!==void 0&&this.setOptionValueWithSource(x,g.defaultValue,"default");const k=(A,N,V)=>{A==null&&g.presetArg!==void 0&&(A=g.presetArg);const L=this.getOptionValue(x);A!==null&&g.parseArg?A=this._callParseArg(g,A,L,N):A!==null&&g.variadic&&(A=g._concatValue(A,L)),A==null&&(g.negate?A=!1:g.isBoolean()||g.optional?A=!0:A=""),this.setOptionValueWithSource(x,A,V)};return this.on("option:"+_,A=>{const N=`error: option '${g.flags}' argument '${A}' is invalid.`;k(A,N,"cli")}),g.envVar&&this.on("optionEnv:"+_,A=>{const N=`error: option '${g.flags}' value '${A}' from env '${g.envVar}' is invalid.`;k(A,N,"env")}),this}_optionEx(g,_,x,k,A){if(typeof _=="object"&&_ instanceof h)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const N=this.createOption(_,x);if(N.makeOptionMandatory(!!g.mandatory),typeof k=="function")N.default(A).argParser(k);else if(k instanceof RegExp){const V=k;k=(L,U)=>{const j=V.exec(L);return j?j[0]:U},N.default(A).argParser(k)}else N.default(k);return this.addOption(N)}option(g,_,x,k){return this._optionEx({},g,_,x,k)}requiredOption(g,_,x,k){return this._optionEx({mandatory:!0},g,_,x,k)}combineFlagAndOptionalValue(g=!0){return this._combineFlagAndOptionalValue=!!g,this}allowUnknownOption(g=!0){return this._allowUnknownOption=!!g,this}allowExcessArguments(g=!0){return this._allowExcessArguments=!!g,this}enablePositionalOptions(g=!0){return this._enablePositionalOptions=!!g,this}passThroughOptions(g=!0){return this._passThroughOptions=!!g,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(g=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!g,this}getOptionValue(g){return this._storeOptionsAsProperties?this[g]:this._optionValues[g]}setOptionValue(g,_){return this.setOptionValueWithSource(g,_,void 0)}setOptionValueWithSource(g,_,x){return this._storeOptionsAsProperties?this[g]=_:this._optionValues[g]=_,this._optionValueSources[g]=x,this}getOptionValueSource(g){return this._optionValueSources[g]}getOptionValueSourceWithGlobals(g){let _;return this._getCommandAndAncestors().forEach(x=>{x.getOptionValueSource(g)!==void 0&&(_=x.getOptionValueSource(g))}),_}_prepareUserArgs(g,_){if(g!==void 0&&!Array.isArray(g))throw new Error("first parameter to parse must be array or undefined");if(_=_||{},g===void 0&&_.from===void 0){i.versions?.electron&&(_.from="electron");const k=i.execArgv??[];(k.includes("-e")||k.includes("--eval")||k.includes("-p")||k.includes("--print"))&&(_.from="eval")}g===void 0&&(g=i.argv),this.rawArgs=g.slice();let x;switch(_.from){case void 0:case"node":this._scriptPath=g[1],x=g.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=g[1],x=g.slice(2)):x=g.slice(1);break;case"user":x=g.slice(0);break;case"eval":x=g.slice(1);break;default:throw new Error(`unexpected parse option { from: '${_.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",x}parse(g,_){const x=this._prepareUserArgs(g,_);return this._parseCommand([],x),this}async parseAsync(g,_){const x=this._prepareUserArgs(g,_);return await this._parseCommand([],x),this}_executeSubCommand(g,_){_=_.slice();let x=!1;const k=[".js",".ts",".tsx",".mjs",".cjs"];function A(j,pe){const Et=t.resolve(j,pe);if(r.existsSync(Et))return Et;if(k.includes(t.extname(pe)))return;const yt=k.find(Ft=>r.existsSync(`${Et}${Ft}`));if(yt)return`${Et}${yt}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let N=g._executableFile||`${this._name}-${g._name}`,V=this._executableDir||"";if(this._scriptPath){let j;try{j=r.realpathSync(this._scriptPath)}catch{j=this._scriptPath}V=t.resolve(t.dirname(j),V)}if(V){let j=A(V,N);if(!j&&!g._executableFile&&this._scriptPath){const pe=t.basename(this._scriptPath,t.extname(this._scriptPath));pe!==this._name&&(j=A(V,`${pe}-${g._name}`))}N=j||N}x=k.includes(t.extname(N));let L;i.platform!=="win32"?x?(_.unshift(N),_=S(i.execArgv).concat(_),L=e.spawn(i.argv[0],_,{stdio:"inherit"})):L=e.spawn(N,_,{stdio:"inherit"}):(_.unshift(N),_=S(i.execArgv).concat(_),L=e.spawn(i.execPath,_,{stdio:"inherit"})),L.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(pe=>{i.on(pe,()=>{L.killed===!1&&L.exitCode===null&&L.kill(pe)})});const U=this._exitCallback;L.on("close",j=>{j=j??1,U?U(new u(j,"commander.executeSubCommandAsync","(close)")):i.exit(j)}),L.on("error",j=>{if(j.code==="ENOENT"){const pe=V?`searched for local subcommand relative to directory '${V}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",Et=`'${N}' does not exist
14
14
  - if '${g._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
15
15
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
16
- - ${me}`;throw new Error(St)}else if(j.code==="EACCES")throw new Error(`'${N}' not executable`);if(!U)i.exit(1);else{const me=new u(1,"commander.executeSubCommandAsync","(error)");me.nestedError=j,U(me)}}),this.runningCommand=L}_dispatchSubcommand(g,_,x){const E=this._findCommand(g);E||this.help({error:!0});let A;return A=this._chainOrCallSubCommandHook(A,E,"preSubcommand"),A=this._chainOrCall(A,()=>{if(E._executableHandler)this._executeSubCommand(E,_.concat(x));else return E._parseCommand(_,x)}),A}_dispatchHelpCommand(g){g||this.help();const _=this._findCommand(g);return _&&!_._executableHandler&&_.help(),this._dispatchSubcommand(g,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((g,_)=>{g.required&&this.args[_]==null&&this.missingArgument(g.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const g=(x,E,A)=>{let N=E;if(E!==null&&x.parseArg){const W=`error: command-argument value '${E}' is invalid for argument '${x.name()}'.`;N=this._callParseArg(x,E,A,W)}return N};this._checkNumberOfArguments();const _=[];this.registeredArguments.forEach((x,E)=>{let A=x.defaultValue;x.variadic?E<this.args.length?(A=this.args.slice(E),x.parseArg&&(A=A.reduce((N,W)=>g(x,W,N),x.defaultValue))):A===void 0&&(A=[]):E<this.args.length&&(A=this.args[E],x.parseArg&&(A=g(x,A,x.defaultValue))),_[E]=A}),this.processedArgs=_}_chainOrCall(g,_){return g&&g.then&&typeof g.then=="function"?g.then(()=>_()):_()}_chainOrCallHooks(g,_){let x=g;const E=[];return this._getCommandAndAncestors().reverse().filter(A=>A._lifeCycleHooks[_]!==void 0).forEach(A=>{A._lifeCycleHooks[_].forEach(N=>{E.push({hookedCommand:A,callback:N})})}),_==="postAction"&&E.reverse(),E.forEach(A=>{x=this._chainOrCall(x,()=>A.callback(A.hookedCommand,this))}),x}_chainOrCallSubCommandHook(g,_,x){let E=g;return this._lifeCycleHooks[x]!==void 0&&this._lifeCycleHooks[x].forEach(A=>{E=this._chainOrCall(E,()=>A(this,_))}),E}_parseCommand(g,_){const x=this.parseOptions(_);if(this._parseOptionsEnv(),this._parseOptionsImplied(),g=g.concat(x.operands),_=x.unknown,this.args=g.concat(_),g&&this._findCommand(g[0]))return this._dispatchSubcommand(g[0],g.slice(1),_);if(this._getHelpCommand()&&g[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(g[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(_),this._dispatchSubcommand(this._defaultCommandName,g,_);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(x.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const E=()=>{x.unknown.length>0&&this.unknownOption(x.unknown[0])},A=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let N;return N=this._chainOrCallHooks(N,"preAction"),N=this._chainOrCall(N,()=>this._actionHandler(this.processedArgs)),this.parent&&(N=this._chainOrCall(N,()=>{this.parent.emit(A,g,_)})),N=this._chainOrCallHooks(N,"postAction"),N}if(this.parent&&this.parent.listenerCount(A))E(),this._processArguments(),this.parent.emit(A,g,_);else if(g.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",g,_);this.listenerCount("command:*")?this.emit("command:*",g,_):this.commands.length?this.unknownCommand():(E(),this._processArguments())}else this.commands.length?(E(),this.help({error:!0})):(E(),this._processArguments())}_findCommand(g){if(g)return this.commands.find(_=>_._name===g||_._aliases.includes(g))}_findOption(g){return this.options.find(_=>_.is(g))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(g=>{g.options.forEach(_=>{_.mandatory&&g.getOptionValue(_.attributeName())===void 0&&g.missingMandatoryOptionValue(_)})})}_checkForConflictingLocalOptions(){const g=this.options.filter(x=>{const E=x.attributeName();return this.getOptionValue(E)===void 0?!1:this.getOptionValueSource(E)!=="default"});g.filter(x=>x.conflictsWith.length>0).forEach(x=>{const E=g.find(A=>x.conflictsWith.includes(A.attributeName()));E&&this._conflictingOption(x,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(g=>{g._checkForConflictingLocalOptions()})}parseOptions(g){const _=[],x=[];let E=_;const A=g.slice();function N(L){return L.length>1&&L[0]==="-"}let W=null;for(;A.length;){const L=A.shift();if(L==="--"){E===x&&E.push(L),E.push(...A);break}if(W&&!N(L)){this.emit(`option:${W.name()}`,L);continue}if(W=null,N(L)){const U=this._findOption(L);if(U){if(U.required){const j=A.shift();j===void 0&&this.optionMissingArgument(U),this.emit(`option:${U.name()}`,j)}else if(U.optional){let j=null;A.length>0&&!N(A[0])&&(j=A.shift()),this.emit(`option:${U.name()}`,j)}else this.emit(`option:${U.name()}`);W=U.variadic?U:null;continue}}if(L.length>2&&L[0]==="-"&&L[1]!=="-"){const U=this._findOption(`-${L[1]}`);if(U){U.required||U.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${U.name()}`,L.slice(2)):(this.emit(`option:${U.name()}`),A.unshift(`-${L.slice(2)}`));continue}}if(/^--[^=]+=/.test(L)){const U=L.indexOf("="),j=this._findOption(L.slice(0,U));if(j&&(j.required||j.optional)){this.emit(`option:${j.name()}`,L.slice(U+1));continue}}if(N(L)&&(E=x),(this._enablePositionalOptions||this._passThroughOptions)&&_.length===0&&x.length===0){if(this._findCommand(L)){_.push(L),A.length>0&&x.push(...A);break}else if(this._getHelpCommand()&&L===this._getHelpCommand().name()){_.push(L),A.length>0&&_.push(...A);break}else if(this._defaultCommandName){x.push(L),A.length>0&&x.push(...A);break}}if(this._passThroughOptions){E.push(L),A.length>0&&E.push(...A);break}E.push(L)}return{operands:_,unknown:x}}opts(){if(this._storeOptionsAsProperties){const g={},_=this.options.length;for(let x=0;x<_;x++){const E=this.options[x].attributeName();g[E]=E===this._versionOptionName?this._version:this[E]}return g}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((g,_)=>Object.assign(g,_.opts()),{})}error(g,_){this._outputConfiguration.outputError(`${g}
16
+ - ${pe}`;throw new Error(Et)}else if(j.code==="EACCES")throw new Error(`'${N}' not executable`);if(!U)i.exit(1);else{const pe=new u(1,"commander.executeSubCommandAsync","(error)");pe.nestedError=j,U(pe)}}),this.runningCommand=L}_dispatchSubcommand(g,_,x){const k=this._findCommand(g);k||this.help({error:!0});let A;return A=this._chainOrCallSubCommandHook(A,k,"preSubcommand"),A=this._chainOrCall(A,()=>{if(k._executableHandler)this._executeSubCommand(k,_.concat(x));else return k._parseCommand(_,x)}),A}_dispatchHelpCommand(g){g||this.help();const _=this._findCommand(g);return _&&!_._executableHandler&&_.help(),this._dispatchSubcommand(g,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((g,_)=>{g.required&&this.args[_]==null&&this.missingArgument(g.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const g=(x,k,A)=>{let N=k;if(k!==null&&x.parseArg){const V=`error: command-argument value '${k}' is invalid for argument '${x.name()}'.`;N=this._callParseArg(x,k,A,V)}return N};this._checkNumberOfArguments();const _=[];this.registeredArguments.forEach((x,k)=>{let A=x.defaultValue;x.variadic?k<this.args.length?(A=this.args.slice(k),x.parseArg&&(A=A.reduce((N,V)=>g(x,V,N),x.defaultValue))):A===void 0&&(A=[]):k<this.args.length&&(A=this.args[k],x.parseArg&&(A=g(x,A,x.defaultValue))),_[k]=A}),this.processedArgs=_}_chainOrCall(g,_){return g&&g.then&&typeof g.then=="function"?g.then(()=>_()):_()}_chainOrCallHooks(g,_){let x=g;const k=[];return this._getCommandAndAncestors().reverse().filter(A=>A._lifeCycleHooks[_]!==void 0).forEach(A=>{A._lifeCycleHooks[_].forEach(N=>{k.push({hookedCommand:A,callback:N})})}),_==="postAction"&&k.reverse(),k.forEach(A=>{x=this._chainOrCall(x,()=>A.callback(A.hookedCommand,this))}),x}_chainOrCallSubCommandHook(g,_,x){let k=g;return this._lifeCycleHooks[x]!==void 0&&this._lifeCycleHooks[x].forEach(A=>{k=this._chainOrCall(k,()=>A(this,_))}),k}_parseCommand(g,_){const x=this.parseOptions(_);if(this._parseOptionsEnv(),this._parseOptionsImplied(),g=g.concat(x.operands),_=x.unknown,this.args=g.concat(_),g&&this._findCommand(g[0]))return this._dispatchSubcommand(g[0],g.slice(1),_);if(this._getHelpCommand()&&g[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(g[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(_),this._dispatchSubcommand(this._defaultCommandName,g,_);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(x.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const k=()=>{x.unknown.length>0&&this.unknownOption(x.unknown[0])},A=`command:${this.name()}`;if(this._actionHandler){k(),this._processArguments();let N;return N=this._chainOrCallHooks(N,"preAction"),N=this._chainOrCall(N,()=>this._actionHandler(this.processedArgs)),this.parent&&(N=this._chainOrCall(N,()=>{this.parent.emit(A,g,_)})),N=this._chainOrCallHooks(N,"postAction"),N}if(this.parent&&this.parent.listenerCount(A))k(),this._processArguments(),this.parent.emit(A,g,_);else if(g.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",g,_);this.listenerCount("command:*")?this.emit("command:*",g,_):this.commands.length?this.unknownCommand():(k(),this._processArguments())}else this.commands.length?(k(),this.help({error:!0})):(k(),this._processArguments())}_findCommand(g){if(g)return this.commands.find(_=>_._name===g||_._aliases.includes(g))}_findOption(g){return this.options.find(_=>_.is(g))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(g=>{g.options.forEach(_=>{_.mandatory&&g.getOptionValue(_.attributeName())===void 0&&g.missingMandatoryOptionValue(_)})})}_checkForConflictingLocalOptions(){const g=this.options.filter(x=>{const k=x.attributeName();return this.getOptionValue(k)===void 0?!1:this.getOptionValueSource(k)!=="default"});g.filter(x=>x.conflictsWith.length>0).forEach(x=>{const k=g.find(A=>x.conflictsWith.includes(A.attributeName()));k&&this._conflictingOption(x,k)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(g=>{g._checkForConflictingLocalOptions()})}parseOptions(g){const _=[],x=[];let k=_;const A=g.slice();function N(L){return L.length>1&&L[0]==="-"}let V=null;for(;A.length;){const L=A.shift();if(L==="--"){k===x&&k.push(L),k.push(...A);break}if(V&&!N(L)){this.emit(`option:${V.name()}`,L);continue}if(V=null,N(L)){const U=this._findOption(L);if(U){if(U.required){const j=A.shift();j===void 0&&this.optionMissingArgument(U),this.emit(`option:${U.name()}`,j)}else if(U.optional){let j=null;A.length>0&&!N(A[0])&&(j=A.shift()),this.emit(`option:${U.name()}`,j)}else this.emit(`option:${U.name()}`);V=U.variadic?U:null;continue}}if(L.length>2&&L[0]==="-"&&L[1]!=="-"){const U=this._findOption(`-${L[1]}`);if(U){U.required||U.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${U.name()}`,L.slice(2)):(this.emit(`option:${U.name()}`),A.unshift(`-${L.slice(2)}`));continue}}if(/^--[^=]+=/.test(L)){const U=L.indexOf("="),j=this._findOption(L.slice(0,U));if(j&&(j.required||j.optional)){this.emit(`option:${j.name()}`,L.slice(U+1));continue}}if(N(L)&&(k=x),(this._enablePositionalOptions||this._passThroughOptions)&&_.length===0&&x.length===0){if(this._findCommand(L)){_.push(L),A.length>0&&x.push(...A);break}else if(this._getHelpCommand()&&L===this._getHelpCommand().name()){_.push(L),A.length>0&&_.push(...A);break}else if(this._defaultCommandName){x.push(L),A.length>0&&x.push(...A);break}}if(this._passThroughOptions){k.push(L),A.length>0&&k.push(...A);break}k.push(L)}return{operands:_,unknown:x}}opts(){if(this._storeOptionsAsProperties){const g={},_=this.options.length;for(let x=0;x<_;x++){const k=this.options[x].attributeName();g[k]=k===this._versionOptionName?this._version:this[k]}return g}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((g,_)=>Object.assign(g,_.opts()),{})}error(g,_){this._outputConfiguration.outputError(`${g}
17
17
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
18
18
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
19
- `),this.outputHelp({error:!0}));const x=_||{},E=x.exitCode||1,A=x.code||"commander.error";this._exit(E,A,g)}_parseOptionsEnv(){this.options.forEach(g=>{if(g.envVar&&g.envVar in i.env){const _=g.attributeName();(this.getOptionValue(_)===void 0||["default","config","env"].includes(this.getOptionValueSource(_)))&&(g.required||g.optional?this.emit(`optionEnv:${g.name()}`,i.env[g.envVar]):this.emit(`optionEnv:${g.name()}`))}})}_parseOptionsImplied(){const g=new m(this.options),_=x=>this.getOptionValue(x)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(x));this.options.filter(x=>x.implied!==void 0&&_(x.attributeName())&&g.valueFromOption(this.getOptionValue(x.attributeName()),x)).forEach(x=>{Object.keys(x.implied).filter(E=>!_(E)).forEach(E=>{this.setOptionValueWithSource(E,x.implied[E],"implied")})})}missingArgument(g){const _=`error: missing required argument '${g}'`;this.error(_,{code:"commander.missingArgument"})}optionMissingArgument(g){const _=`error: option '${g.flags}' argument missing`;this.error(_,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(g){const _=`error: required option '${g.flags}' not specified`;this.error(_,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(g,_){const x=N=>{const W=N.attributeName(),L=this.getOptionValue(W),U=this.options.find(me=>me.negate&&W===me.attributeName()),j=this.options.find(me=>!me.negate&&W===me.attributeName());return U&&(U.presetArg===void 0&&L===!1||U.presetArg!==void 0&&L===U.presetArg)?U:j||N},E=N=>{const W=x(N),L=W.attributeName();return this.getOptionValueSource(L)==="env"?`environment variable '${W.envVar}'`:`option '${W.flags}'`},A=`error: ${E(g)} cannot be used with ${E(_)}`;this.error(A,{code:"commander.conflictingOption"})}unknownOption(g){if(this._allowUnknownOption)return;let _="";if(g.startsWith("--")&&this._showSuggestionAfterError){let E=[],A=this;do{const N=A.createHelp().visibleOptions(A).filter(W=>W.long).map(W=>W.long);E=E.concat(N),A=A.parent}while(A&&!A._enablePositionalOptions);_=p(g,E)}const x=`error: unknown option '${g}'${_}`;this.error(x,{code:"commander.unknownOption"})}_excessArguments(g){if(this._allowExcessArguments)return;const _=this.registeredArguments.length,x=_===1?"":"s",A=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${_} argument${x} but got ${g.length}.`;this.error(A,{code:"commander.excessArguments"})}unknownCommand(){const g=this.args[0];let _="";if(this._showSuggestionAfterError){const E=[];this.createHelp().visibleCommands(this).forEach(A=>{E.push(A.name()),A.alias()&&E.push(A.alias())}),_=p(g,E)}const x=`error: unknown command '${g}'${_}`;this.error(x,{code:"commander.unknownCommand"})}version(g,_,x){if(g===void 0)return this._version;this._version=g,_=_||"-V, --version",x=x||"output the version number";const E=this.createOption(_,x);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${g}
20
- `),this._exit(0,"commander.version",g)}),this}description(g,_){return g===void 0&&_===void 0?this._description:(this._description=g,_&&(this._argsDescription=_),this)}summary(g){return g===void 0?this._summary:(this._summary=g,this)}alias(g){if(g===void 0)return this._aliases[0];let _=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(_=this.commands[this.commands.length-1]),g===_._name)throw new Error("Command alias can't be the same as its name");const x=this.parent?._findCommand(g);if(x){const E=[x.name()].concat(x.aliases()).join("|");throw new Error(`cannot add alias '${g}' to command '${this.name()}' as already have command '${E}'`)}return _._aliases.push(g),this}aliases(g){return g===void 0?this._aliases:(g.forEach(_=>this.alias(_)),this)}usage(g){if(g===void 0){if(this._usage)return this._usage;const _=this.registeredArguments.map(x=>a(x));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?_:[]).join(" ")}return this._usage=g,this}name(g){return g===void 0?this._name:(this._name=g,this)}nameFromFilename(g){return this._name=t.basename(g,t.extname(g)),this}executableDir(g){return g===void 0?this._executableDir:(this._executableDir=g,this)}helpInformation(g){const _=this.createHelp();return _.helpWidth===void 0&&(_.helpWidth=g&&g.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),_.formatHelp(this,_)}_getHelpContext(g){g=g||{};const _={error:!!g.error};let x;return _.error?x=E=>this._outputConfiguration.writeErr(E):x=E=>this._outputConfiguration.writeOut(E),_.write=g.write||x,_.command=this,_}outputHelp(g){let _;typeof g=="function"&&(_=g,g=void 0);const x=this._getHelpContext(g);this._getCommandAndAncestors().reverse().forEach(A=>A.emit("beforeAllHelp",x)),this.emit("beforeHelp",x);let E=this.helpInformation(x);if(_&&(E=_(E),typeof E!="string"&&!Buffer.isBuffer(E)))throw new Error("outputHelp callback must return a string or a Buffer");x.write(E),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",x),this._getCommandAndAncestors().forEach(A=>A.emit("afterAllHelp",x))}helpOption(g,_){return typeof g=="boolean"?(g?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(g=g??"-h, --help",_=_??"display help for command",this._helpOption=this.createOption(g,_),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(g){return this._helpOption=g,this}help(g){this.outputHelp(g);let _=i.exitCode||0;_===0&&g&&typeof g!="function"&&g.error&&(_=1),this._exit(_,"commander.help","(outputHelp)")}addHelpText(g,_){const x=["beforeAll","before","after","afterAll"];if(!x.includes(g))throw new Error(`Unexpected value for position to addHelpText.
21
- Expecting one of '${x.join("', '")}'`);const E=`${g}Help`;return this.on(E,A=>{let N;typeof _=="function"?N=_({error:A.error,command:A.command}):N=_,N&&A.write(`${N}
22
- `)}),this}_outputHelpIfRequested(g){const _=this._getHelpOption();_&&g.find(E=>_.is(E))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function S(k){return k.map(g=>{if(!g.startsWith("--inspect"))return g;let _,x="127.0.0.1",E="9229",A;return(A=g.match(/^(--inspect(-brk)?)$/))!==null?_=A[1]:(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(_=A[1],/^\d+$/.test(A[3])?E=A[3]:x=A[3]):(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(_=A[1],x=A[3],E=A[4]),_&&E!=="0"?`${_}=${x}:${parseInt(E)+1}`:g})}return Hu.Command=b,Hu}var Gp;function n5(){if(Gp)return Tt;Gp=1;const{Argument:n}=$u(),{Command:e}=t5(),{CommanderError:t,InvalidArgumentError:r}=Vo(),{Help:i}=Wp(),{Option:o}=Up();return Tt.program=new e,Tt.createCommand=a=>new e(a),Tt.createOption=(a,u)=>new o(a,u),Tt.createArgument=(a,u)=>new n(a,u),Tt.Command=e,Tt.Option=o,Tt.Argument=n,Tt.Help=i,Tt.CommanderError=t,Tt.InvalidArgumentError=r,Tt.InvalidOptionArgumentError=r,Tt}var r5=n5(),i5=Qx(r5);const{program:wI,createCommand:SI,createArgument:xI,createOption:kI,CommanderError:CI,InvalidArgumentError:EI,InvalidOptionArgumentError:AI,Command:s5,Argument:MI,Option:TI,Help:OI}=i5;function o5(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const gs=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const yi=()=>{},a5=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),or=Object.assign,l5=Object.prototype.hasOwnProperty,Uu=(n,e)=>l5.call(n,e),Ne=Array.isArray,bi=n=>qo(n)==="[object Map]",u5=n=>qo(n)==="[object Set]",Xe=n=>typeof n=="function",Ln=n=>typeof n=="string",ys=n=>typeof n=="symbol",bt=n=>n!==null&&typeof n=="object",c5=n=>(bt(n)||Xe(n))&&Xe(n.then)&&Xe(n.catch),f5=Object.prototype.toString,qo=n=>f5.call(n),Jp=n=>qo(n).slice(8,-1),h5=n=>qo(n)==="[object Object]",qu=n=>Ln(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,d5=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},p5=d5(n=>n.charAt(0).toUpperCase()+n.slice(1)),ar=(n,e)=>!Object.is(n,e);let jp;const Ko=()=>jp||(jp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ku(n){if(Ne(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=Ln(r)?b5(r):Ku(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(Ln(n)||bt(n))return n}const m5=/;(?![^(]*\))/g,g5=/:([^]+)/,y5=/\/\*[^]*?\*\//g;function b5(n){const e={};return n.replace(y5,"").split(m5).forEach(t=>{if(t){const r=t.split(g5);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Gu(n){let e="";if(Ln(n))e=n;else if(Ne(n))for(let t=0;t<n.length;t++){const r=Gu(n[t]);r&&(e+=r+" ")}else if(bt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Pn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let ve;const Ju=new WeakSet;class _5{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ju.has(this)&&(Ju.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Xp(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nm(this),Zp(this);const e=ve,t=on;ve=this,on=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&ve!==this&&Pn("Active effect was not restored correctly - this is likely a Vue internal bug."),Qp(this),ve=e,on=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Zu(e);this.deps=this.depsTail=void 0,nm(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ju.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Xu(this)&&this.run()}get dirty(){return Xu(this)}}let Yp=0,bs,_s;function Xp(n,e=!1){if(n.flags|=8,e){n.next=_s,_s=n;return}n.next=bs,bs=n}function ju(){Yp++}function Yu(){if(--Yp>0)return;if(_s){let e=_s;for(_s=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;bs;){let e=bs;for(bs=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function Zp(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Qp(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),Zu(r),v5(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function Xu(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(em(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function em(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===vs))return;n.globalVersion=vs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!Xu(n)){n.flags&=-3;return}const t=ve,r=on;ve=n,on=!0;try{Zp(n);const i=n.fn(n._value);(e.version===0||ar(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{ve=t,on=r,Qp(n),n.flags&=-3}}function Zu(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)Zu(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function v5(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let on=!0;const tm=[];function Go(){tm.push(on),on=!1}function Jo(){const n=tm.pop();on=n===void 0?!0:n}function nm(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ve;ve=void 0;try{e()}finally{ve=t}}}let vs=0,w5=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class Qu{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!ve||!on||ve===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ve)t=this.activeLink=new w5(ve,this),ve.deps?(t.prevDep=ve.depsTail,ve.depsTail.nextDep=t,ve.depsTail=t):ve.deps=ve.depsTail=t,rm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=ve.depsTail,t.nextDep=void 0,ve.depsTail.nextDep=t,ve.depsTail=t,ve.deps===t&&(ve.deps=r)}return process.env.NODE_ENV!=="production"&&ve.onTrack&&ve.onTrack(or({effect:ve},e)),t}trigger(e){this.version++,vs++,this.notify(e)}notify(e){ju();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(or({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Yu()}}}function rm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)rm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const jo=new WeakMap,Pr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),ec=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ws=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function _t(n,e,t){if(on&&ve){let r=jo.get(n);r||jo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new Qu),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function lr(n,e,t,r,i,o){const a=jo.get(n);if(!a){vs++;return}const u=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(ju(),e==="clear")a.forEach(u);else{const f=Ne(n),h=f&&qu(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,b)=>{(b==="length"||b===ws||!ys(b)&&b>=m)&&u(p)})}else switch((t!==void 0||a.has(void 0))&&u(a.get(t)),h&&u(a.get(ws)),e){case"add":f?h&&u(a.get("length")):(u(a.get(Pr)),bi(n)&&u(a.get(ec)));break;case"delete":f||(u(a.get(Pr)),bi(n)&&u(a.get(ec)));break;case"set":bi(n)&&u(a.get(Pr));break}}Yu()}function S5(n,e){const t=jo.get(n);return t&&t.get(e)}function _i(n){const e=fe(n);return e===n?e:(_t(e,"iterate",ws),vt(n)?e:e.map(ut))}function tc(n){return _t(n=fe(n),"iterate",ws),n}const x5={__proto__:null,[Symbol.iterator](){return nc(this,Symbol.iterator,ut)},concat(...n){return _i(this).concat(...n.map(e=>Ne(e)?_i(e):e))},entries(){return nc(this,"entries",n=>(n[1]=ut(n[1]),n))},every(n,e){return Dn(this,"every",n,e,void 0,arguments)},filter(n,e){return Dn(this,"filter",n,e,t=>t.map(ut),arguments)},find(n,e){return Dn(this,"find",n,e,ut,arguments)},findIndex(n,e){return Dn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Dn(this,"findLast",n,e,ut,arguments)},findLastIndex(n,e){return Dn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Dn(this,"forEach",n,e,void 0,arguments)},includes(...n){return rc(this,"includes",n)},indexOf(...n){return rc(this,"indexOf",n)},join(n){return _i(this).join(n)},lastIndexOf(...n){return rc(this,"lastIndexOf",n)},map(n,e){return Dn(this,"map",n,e,void 0,arguments)},pop(){return Ss(this,"pop")},push(...n){return Ss(this,"push",n)},reduce(n,...e){return im(this,"reduce",n,e)},reduceRight(n,...e){return im(this,"reduceRight",n,e)},shift(){return Ss(this,"shift")},some(n,e){return Dn(this,"some",n,e,void 0,arguments)},splice(...n){return Ss(this,"splice",n)},toReversed(){return _i(this).toReversed()},toSorted(n){return _i(this).toSorted(n)},toSpliced(...n){return _i(this).toSpliced(...n)},unshift(...n){return Ss(this,"unshift",n)},values(){return nc(this,"values",ut)}};function nc(n,e,t){const r=tc(n),i=r[e]();return r!==n&&!vt(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const k5=Array.prototype;function Dn(n,e,t,r,i,o){const a=tc(n),u=a!==n&&!vt(n),f=a[e];if(f!==k5[e]){const p=f.apply(n,o);return u?ut(p):p}let h=t;a!==n&&(u?h=function(p,b){return t.call(this,ut(p),b,n)}:t.length>2&&(h=function(p,b){return t.call(this,p,b,n)}));const m=f.call(a,h,r);return u&&i?i(m):m}function im(n,e,t,r){const i=tc(n);let o=t;return i!==n&&(vt(n)?t.length>3&&(o=function(a,u,f){return t.call(this,a,u,f,n)}):o=function(a,u,f){return t.call(this,a,ut(u),f,n)}),i[e](o,...r)}function rc(n,e,t){const r=fe(n);_t(r,"iterate",ws);const i=r[e](...t);return(i===-1||i===!1)&&Zo(t[0])?(t[0]=fe(t[0]),r[e](...t)):i}function Ss(n,e,t=[]){Go(),ju();const r=fe(n)[e].apply(n,t);return Yu(),Jo(),r}const C5=o5("__proto__,__v_isRef,__isVue"),sm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(ys));function E5(n){ys(n)||(n=String(n));const e=fe(this);return _t(e,"has",n),e.hasOwnProperty(n)}class om{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?D5:cm:o?P5:um).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Ne(e);if(!i){let f;if(a&&(f=x5[t]))return f;if(t==="hasOwnProperty")return E5}const u=Reflect.get(e,t,ct(e)?e:r);return(ys(t)?sm.has(t):C5(t))||(i||_t(e,"get",t),o)?u:ct(u)?a&&qu(t)?u:u.value:bt(u)?i?fm(u):sc(u):u}}class A5 extends om{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Fn(o);if(!vt(r)&&!Fn(r)&&(o=fe(o),r=fe(r)),!Ne(e)&&ct(o)&&!ct(r))return f?!1:(o.value=r,!0)}const a=Ne(e)&&qu(t)?Number(t)<e.length:Uu(e,t),u=Reflect.set(e,t,r,ct(e)?e:i);return e===fe(i)&&(a?ar(r,o)&&lr(e,"set",t,r,o):lr(e,"add",t,r)),u}deleteProperty(e,t){const r=Uu(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&lr(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!ys(t)||!sm.has(t))&&_t(e,"has",t),r}ownKeys(e){return _t(e,"iterate",Ne(e)?"length":Pr),Reflect.ownKeys(e)}}class M5 extends om{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&Pn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&Pn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const T5=new A5,O5=new M5,ic=n=>n,Yo=n=>Reflect.getPrototypeOf(n);function I5(n,e,t){return function(...r){const i=this.__v_raw,o=fe(i),a=bi(o),u=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,h=i[n](...r),m=t?ic:e?oc:ut;return!e&&_t(o,"iterate",f?ec:Pr),{next(){const{value:p,done:b}=h.next();return b?{value:p,done:b}:{value:u?[m(p[0]),m(p[1])]:m(p),done:b}},[Symbol.iterator](){return this}}}}function Xo(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Pn(`${p5(n)} operation ${t}failed: target is readonly.`,fe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function N5(n,e){const t={get(i){const o=this.__v_raw,a=fe(o),u=fe(i);n||(ar(i,u)&&_t(a,"get",i),_t(a,"get",u));const{has:f}=Yo(a),h=e?ic:n?oc:ut;if(f.call(a,i))return h(o.get(i));if(f.call(a,u))return h(o.get(u));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&_t(fe(i),"iterate",Pr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=fe(o),u=fe(i);return n||(ar(i,u)&&_t(a,"has",i),_t(a,"has",u)),i===u?o.has(i):o.has(i)||o.has(u)},forEach(i,o){const a=this,u=a.__v_raw,f=fe(u),h=e?ic:n?oc:ut;return!n&&_t(f,"iterate",Pr),u.forEach((m,p)=>i.call(o,h(m),h(p),a))}};return or(t,n?{add:Xo("add"),set:Xo("set"),delete:Xo("delete"),clear:Xo("clear")}:{add(i){!e&&!vt(i)&&!Fn(i)&&(i=fe(i));const o=fe(this);return Yo(o).has.call(o,i)||(o.add(i),lr(o,"add",i,i)),this},set(i,o){!e&&!vt(o)&&!Fn(o)&&(o=fe(o));const a=fe(this),{has:u,get:f}=Yo(a);let h=u.call(a,i);h?process.env.NODE_ENV!=="production"&&lm(a,u,i):(i=fe(i),h=u.call(a,i));const m=f.call(a,i);return a.set(i,o),h?ar(o,m)&&lr(a,"set",i,o,m):lr(a,"add",i,o),this},delete(i){const o=fe(this),{has:a,get:u}=Yo(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&lm(o,a,i):(i=fe(i),f=a.call(o,i));const h=u?u.call(o,i):void 0,m=o.delete(i);return f&&lr(o,"delete",i,void 0,h),m},clear(){const i=fe(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?bi(i)?new Map(i):new Set(i):void 0,u=i.clear();return o&&lr(i,"clear",void 0,void 0,a),u}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=I5(i,n,e)}),t}function am(n,e){const t=N5(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(Uu(t,i)&&i in r?t:r,i,o)}const R5={get:am(!1,!1)},L5={get:am(!0,!1)};function lm(n,e,t){const r=fe(t);if(r!==t&&e.call(n,r)){const i=Jp(n);Pn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const um=new WeakMap,P5=new WeakMap,cm=new WeakMap,D5=new WeakMap;function F5(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function z5(n){return n.__v_skip||!Object.isExtensible(n)?0:F5(Jp(n))}function sc(n){return Fn(n)?n:hm(n,!1,T5,R5,um)}function fm(n){return hm(n,!0,O5,L5,cm)}function hm(n,e,t,r,i){if(!bt(n))return process.env.NODE_ENV!=="production"&&Pn(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=z5(n);if(a===0)return n;const u=new Proxy(n,a===2?r:t);return i.set(n,u),u}function xs(n){return Fn(n)?xs(n.__v_raw):!!(n&&n.__v_isReactive)}function Fn(n){return!!(n&&n.__v_isReadonly)}function vt(n){return!!(n&&n.__v_isShallow)}function Zo(n){return n?!!n.__v_raw:!1}function fe(n){const e=n&&n.__v_raw;return e?fe(e):n}const ut=n=>bt(n)?sc(n):n,oc=n=>bt(n)?fm(n):n;function ct(n){return n?n.__v_isRef===!0:!1}function Qo(n){return B5(n,!1)}function B5(n,e){return ct(n)?n:new $5(n,e)}class $5{constructor(e,t){this.dep=new Qu,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:fe(e),this._value=t?e:ut(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||vt(e)||Fn(e);e=r?e:fe(e),ar(e,t)&&(this._rawValue=e,this._value=r?e:ut(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function H(n){return ct(n)?n.value:n}class H5{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return S5(fe(this._object),this._key)}}class W5{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function vi(n,e,t){return ct(n)?n:Xe(n)?new W5(n):bt(n)&&arguments.length>1?V5(n,e,t):Qo(n)}function V5(n,e,t){const r=n[e];return ct(r)?r:new H5(n,e,t)}class U5{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Qu(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=vs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ve!==this)return Xp(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return em(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&Pn("Write operation failed: computed value is readonly")}}function q5(n,e,t=!1){let r,i;Xe(n)?r=n:(r=n.get,i=n.set);const o=new U5(r,i,t);return process.env.NODE_ENV!=="production"&&e&&!t&&(o.onTrack=e.onTrack,o.onTrigger=e.onTrigger),o}const ea={},ta=new WeakMap;let Dr;function K5(n,e=!1,t=Dr){if(t){let r=ta.get(t);r||ta.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&Pn("onWatcherCleanup() was called when there was no active watcher to associate with.")}function G5(n,e,t=gs){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:u,call:f}=t,h=N=>{(t.onWarn||Pn)("Invalid watch source: ",N,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=N=>i?N:vt(N)||i===!1||i===0?ur(N,1):ur(N);let p,b,S,k,g=!1,_=!1;if(ct(n)?(b=()=>n.value,g=vt(n)):xs(n)?(b=()=>m(n),g=!0):Ne(n)?(_=!0,g=n.some(N=>xs(N)||vt(N)),b=()=>n.map(N=>{if(ct(N))return N.value;if(xs(N))return m(N);if(Xe(N))return f?f(N,2):N();process.env.NODE_ENV!=="production"&&h(N)})):Xe(n)?e?b=f?()=>f(n,2):n:b=()=>{if(S){Go();try{S()}finally{Jo()}}const N=Dr;Dr=p;try{return f?f(n,3,[k]):n(k)}finally{Dr=N}}:(b=yi,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const N=b,W=i===!0?1/0:i;b=()=>ur(N(),W)}const x=()=>{p.stop()};if(o&&e){const N=e;e=(...W)=>{N(...W),x()}}let E=_?new Array(n.length).fill(ea):ea;const A=N=>{if(!(!(p.flags&1)||!p.dirty&&!N))if(e){const W=p.run();if(i||g||(_?W.some((L,U)=>ar(L,E[U])):ar(W,E))){S&&S();const L=Dr;Dr=p;try{const U=[W,E===ea?void 0:_&&E[0]===ea?[]:E,k];f?f(e,3,U):e(...U),E=W}finally{Dr=L}}}else p.run()};return u&&u(A),p=new _5(b),p.scheduler=a?()=>a(A,!1):A,k=N=>K5(N,!1,p),S=p.onStop=()=>{const N=ta.get(p);if(N){if(f)f(N,4);else for(const W of N)W();ta.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?A(!0):E=p.run():a?a(A.bind(null,!0),!0):p.run(),x.pause=p.pause.bind(p),x.resume=p.resume.bind(p),x.stop=x,x}function ur(n,e=1/0,t){if(e<=0||!bt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,ct(n))ur(n.value,e,t);else if(Ne(n))for(let r=0;r<n.length;r++)ur(n[r],e,t);else if(u5(n)||bi(n))n.forEach(r=>{ur(r,e,t)});else if(h5(n)){for(const r in n)ur(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&ur(n[r],e,t)}return n}const Fr=[];function J5(n){Fr.push(n)}function j5(){Fr.pop()}let ac=!1;function ft(n,...e){if(ac)return;ac=!0,Go();const t=Fr.length?Fr[Fr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=Y5();if(r)na(r,t,11,[n+e.map(o=>{var a,u;return(u=(a=o.toString)==null?void 0:a.call(o))!=null?u:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Om(t,o.type)}>`).join(`
19
+ `),this.outputHelp({error:!0}));const x=_||{},k=x.exitCode||1,A=x.code||"commander.error";this._exit(k,A,g)}_parseOptionsEnv(){this.options.forEach(g=>{if(g.envVar&&g.envVar in i.env){const _=g.attributeName();(this.getOptionValue(_)===void 0||["default","config","env"].includes(this.getOptionValueSource(_)))&&(g.required||g.optional?this.emit(`optionEnv:${g.name()}`,i.env[g.envVar]):this.emit(`optionEnv:${g.name()}`))}})}_parseOptionsImplied(){const g=new m(this.options),_=x=>this.getOptionValue(x)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(x));this.options.filter(x=>x.implied!==void 0&&_(x.attributeName())&&g.valueFromOption(this.getOptionValue(x.attributeName()),x)).forEach(x=>{Object.keys(x.implied).filter(k=>!_(k)).forEach(k=>{this.setOptionValueWithSource(k,x.implied[k],"implied")})})}missingArgument(g){const _=`error: missing required argument '${g}'`;this.error(_,{code:"commander.missingArgument"})}optionMissingArgument(g){const _=`error: option '${g.flags}' argument missing`;this.error(_,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(g){const _=`error: required option '${g.flags}' not specified`;this.error(_,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(g,_){const x=N=>{const V=N.attributeName(),L=this.getOptionValue(V),U=this.options.find(pe=>pe.negate&&V===pe.attributeName()),j=this.options.find(pe=>!pe.negate&&V===pe.attributeName());return U&&(U.presetArg===void 0&&L===!1||U.presetArg!==void 0&&L===U.presetArg)?U:j||N},k=N=>{const V=x(N),L=V.attributeName();return this.getOptionValueSource(L)==="env"?`environment variable '${V.envVar}'`:`option '${V.flags}'`},A=`error: ${k(g)} cannot be used with ${k(_)}`;this.error(A,{code:"commander.conflictingOption"})}unknownOption(g){if(this._allowUnknownOption)return;let _="";if(g.startsWith("--")&&this._showSuggestionAfterError){let k=[],A=this;do{const N=A.createHelp().visibleOptions(A).filter(V=>V.long).map(V=>V.long);k=k.concat(N),A=A.parent}while(A&&!A._enablePositionalOptions);_=p(g,k)}const x=`error: unknown option '${g}'${_}`;this.error(x,{code:"commander.unknownOption"})}_excessArguments(g){if(this._allowExcessArguments)return;const _=this.registeredArguments.length,x=_===1?"":"s",A=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${_} argument${x} but got ${g.length}.`;this.error(A,{code:"commander.excessArguments"})}unknownCommand(){const g=this.args[0];let _="";if(this._showSuggestionAfterError){const k=[];this.createHelp().visibleCommands(this).forEach(A=>{k.push(A.name()),A.alias()&&k.push(A.alias())}),_=p(g,k)}const x=`error: unknown command '${g}'${_}`;this.error(x,{code:"commander.unknownCommand"})}version(g,_,x){if(g===void 0)return this._version;this._version=g,_=_||"-V, --version",x=x||"output the version number";const k=this.createOption(_,x);return this._versionOptionName=k.attributeName(),this._registerOption(k),this.on("option:"+k.name(),()=>{this._outputConfiguration.writeOut(`${g}
20
+ `),this._exit(0,"commander.version",g)}),this}description(g,_){return g===void 0&&_===void 0?this._description:(this._description=g,_&&(this._argsDescription=_),this)}summary(g){return g===void 0?this._summary:(this._summary=g,this)}alias(g){if(g===void 0)return this._aliases[0];let _=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(_=this.commands[this.commands.length-1]),g===_._name)throw new Error("Command alias can't be the same as its name");const x=this.parent?._findCommand(g);if(x){const k=[x.name()].concat(x.aliases()).join("|");throw new Error(`cannot add alias '${g}' to command '${this.name()}' as already have command '${k}'`)}return _._aliases.push(g),this}aliases(g){return g===void 0?this._aliases:(g.forEach(_=>this.alias(_)),this)}usage(g){if(g===void 0){if(this._usage)return this._usage;const _=this.registeredArguments.map(x=>a(x));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?_:[]).join(" ")}return this._usage=g,this}name(g){return g===void 0?this._name:(this._name=g,this)}nameFromFilename(g){return this._name=t.basename(g,t.extname(g)),this}executableDir(g){return g===void 0?this._executableDir:(this._executableDir=g,this)}helpInformation(g){const _=this.createHelp();return _.helpWidth===void 0&&(_.helpWidth=g&&g.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),_.formatHelp(this,_)}_getHelpContext(g){g=g||{};const _={error:!!g.error};let x;return _.error?x=k=>this._outputConfiguration.writeErr(k):x=k=>this._outputConfiguration.writeOut(k),_.write=g.write||x,_.command=this,_}outputHelp(g){let _;typeof g=="function"&&(_=g,g=void 0);const x=this._getHelpContext(g);this._getCommandAndAncestors().reverse().forEach(A=>A.emit("beforeAllHelp",x)),this.emit("beforeHelp",x);let k=this.helpInformation(x);if(_&&(k=_(k),typeof k!="string"&&!Buffer.isBuffer(k)))throw new Error("outputHelp callback must return a string or a Buffer");x.write(k),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",x),this._getCommandAndAncestors().forEach(A=>A.emit("afterAllHelp",x))}helpOption(g,_){return typeof g=="boolean"?(g?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(g=g??"-h, --help",_=_??"display help for command",this._helpOption=this.createOption(g,_),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(g){return this._helpOption=g,this}help(g){this.outputHelp(g);let _=i.exitCode||0;_===0&&g&&typeof g!="function"&&g.error&&(_=1),this._exit(_,"commander.help","(outputHelp)")}addHelpText(g,_){const x=["beforeAll","before","after","afterAll"];if(!x.includes(g))throw new Error(`Unexpected value for position to addHelpText.
21
+ Expecting one of '${x.join("', '")}'`);const k=`${g}Help`;return this.on(k,A=>{let N;typeof _=="function"?N=_({error:A.error,command:A.command}):N=_,N&&A.write(`${N}
22
+ `)}),this}_outputHelpIfRequested(g){const _=this._getHelpOption();_&&g.find(k=>_.is(k))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function S(E){return E.map(g=>{if(!g.startsWith("--inspect"))return g;let _,x="127.0.0.1",k="9229",A;return(A=g.match(/^(--inspect(-brk)?)$/))!==null?_=A[1]:(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(_=A[1],/^\d+$/.test(A[3])?k=A[3]:x=A[3]):(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(_=A[1],x=A[3],k=A[4]),_&&k!=="0"?`${_}=${x}:${parseInt(k)+1}`:g})}return Ju.Command=b,Ju}var tm;function u5(){if(tm)return It;tm=1;const{Argument:n}=Gu(),{Command:e}=l5(),{CommanderError:t,InvalidArgumentError:r}=Jo(),{Help:i}=Yp(),{Option:o}=Zp();return It.program=new e,It.createCommand=a=>new e(a),It.createOption=(a,u)=>new o(a,u),It.createArgument=(a,u)=>new n(a,u),It.Command=e,It.Option=o,It.Argument=n,It.Help=i,It.CommanderError=t,It.InvalidArgumentError=r,It.InvalidOptionArgumentError=r,It}var c5=u5(),f5=o5(c5);const{program:JI,createCommand:jI,createArgument:YI,createOption:XI,CommanderError:ZI,InvalidArgumentError:QI,InvalidOptionArgumentError:eN,Command:h5,Argument:tN,Option:nN,Help:rN}=f5;function d5(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const Gt=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Fr=()=>{},p5=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Nt=Object.assign,m5=Object.prototype.hasOwnProperty,Le=(n,e)=>m5.call(n,e),Ae=Array.isArray,vi=n=>Yo(n)==="[object Map]",g5=n=>Yo(n)==="[object Set]",Pe=n=>typeof n=="function",un=n=>typeof n=="string",vs=n=>typeof n=="symbol",dt=n=>n!==null&&typeof n=="object",y5=n=>(dt(n)||Pe(n))&&Pe(n.then)&&Pe(n.catch),b5=Object.prototype.toString,Yo=n=>b5.call(n),nm=n=>Yo(n).slice(8,-1),_5=n=>Yo(n)==="[object Object]",Xu=n=>un(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,v5=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},w5=v5(n=>n.charAt(0).toUpperCase()+n.slice(1)),cr=(n,e)=>!Object.is(n,e),S5=(n,e,t,r=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:r,value:t})};let rm;const Xo=()=>rm||(rm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Zu(n){if(Ae(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=un(r)?k5(r):Zu(r);if(i)for(const o in i)e[o]=i[o]}return e}else if(un(n)||dt(n))return n}const x5=/;(?![^(]*\))/g,E5=/:([^]+)/,C5=/\/\*[^]*?\*\//g;function k5(n){const e={};return n.replace(C5,"").split(x5).forEach(t=>{if(t){const r=t.split(E5);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function Qu(n){let e="";if(un(n))e=n;else if(Ae(n))for(let t=0;t<n.length;t++){const r=Qu(n[t]);r&&(e+=r+" ")}else if(dt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function $n(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let ve;const ec=new WeakSet;class A5{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ec.has(this)&&(ec.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||sm(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,cm(this),om(this);const e=ve,t=cn;ve=this,cn=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&ve!==this&&$n("Active effect was not restored correctly - this is likely a Vue internal bug."),am(this),ve=e,cn=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ic(e);this.deps=this.depsTail=void 0,cm(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ec.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){rc(this)&&this.run()}get dirty(){return rc(this)}}let im=0,ws,Ss;function sm(n,e=!1){if(n.flags|=8,e){n.next=Ss,Ss=n;return}n.next=ws,ws=n}function tc(){im++}function nc(){if(--im>0)return;if(Ss){let e=Ss;for(Ss=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;ws;){let e=ws;for(ws=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function om(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function am(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),ic(r),M5(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function rc(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(lm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function lm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===xs))return;n.globalVersion=xs;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!rc(n)){n.flags&=-3;return}const t=ve,r=cn;ve=n,cn=!0;try{om(n);const i=n.fn(n._value);(e.version===0||cr(i,n._value))&&(n._value=i,e.version++)}catch(i){throw e.version++,i}finally{ve=t,cn=r,am(n),n.flags&=-3}}function ic(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)ic(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function M5(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let cn=!0;const um=[];function Zo(){um.push(cn),cn=!1}function Qo(){const n=um.pop();cn=n===void 0?!0:n}function cm(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ve;ve=void 0;try{e()}finally{ve=t}}}let xs=0,T5=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}};class sc{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!ve||!cn||ve===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ve)t=this.activeLink=new T5(ve,this),ve.deps?(t.prevDep=ve.depsTail,ve.depsTail.nextDep=t,ve.depsTail=t):ve.deps=ve.depsTail=t,fm(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=ve.depsTail,t.nextDep=void 0,ve.depsTail.nextDep=t,ve.depsTail=t,ve.deps===t&&(ve.deps=r)}return process.env.NODE_ENV!=="production"&&ve.onTrack&&ve.onTrack(Nt({effect:ve},e)),t}trigger(e){this.version++,xs++,this.notify(e)}notify(e){tc();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(Nt({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{nc()}}}function fm(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)fm(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const ea=new WeakMap,zr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),oc=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Es=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function Ge(n,e,t){if(cn&&ve){let r=ea.get(n);r||ea.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new sc),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function fr(n,e,t,r,i,o){const a=ea.get(n);if(!a){xs++;return}const u=f=>{f&&(process.env.NODE_ENV!=="production"?f.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:o}):f.trigger())};if(tc(),e==="clear")a.forEach(u);else{const f=Ae(n),h=f&&Xu(t);if(f&&t==="length"){const m=Number(r);a.forEach((p,b)=>{(b==="length"||b===Es||!vs(b)&&b>=m)&&u(p)})}else switch((t!==void 0||a.has(void 0))&&u(a.get(t)),h&&u(a.get(Es)),e){case"add":f?h&&u(a.get("length")):(u(a.get(zr)),vi(n)&&u(a.get(oc)));break;case"delete":f||(u(a.get(zr)),vi(n)&&u(a.get(oc)));break;case"set":vi(n)&&u(a.get(zr));break}}nc()}function O5(n,e){const t=ea.get(n);return t&&t.get(e)}function wi(n){const e=fe(n);return e===n?e:(Ge(e,"iterate",Es),St(n)?e:e.map(pt))}function ac(n){return Ge(n=fe(n),"iterate",Es),n}const I5={__proto__:null,[Symbol.iterator](){return lc(this,Symbol.iterator,pt)},concat(...n){return wi(this).concat(...n.map(e=>Ae(e)?wi(e):e))},entries(){return lc(this,"entries",n=>(n[1]=pt(n[1]),n))},every(n,e){return Hn(this,"every",n,e,void 0,arguments)},filter(n,e){return Hn(this,"filter",n,e,t=>t.map(pt),arguments)},find(n,e){return Hn(this,"find",n,e,pt,arguments)},findIndex(n,e){return Hn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Hn(this,"findLast",n,e,pt,arguments)},findLastIndex(n,e){return Hn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Hn(this,"forEach",n,e,void 0,arguments)},includes(...n){return uc(this,"includes",n)},indexOf(...n){return uc(this,"indexOf",n)},join(n){return wi(this).join(n)},lastIndexOf(...n){return uc(this,"lastIndexOf",n)},map(n,e){return Hn(this,"map",n,e,void 0,arguments)},pop(){return Cs(this,"pop")},push(...n){return Cs(this,"push",n)},reduce(n,...e){return hm(this,"reduce",n,e)},reduceRight(n,...e){return hm(this,"reduceRight",n,e)},shift(){return Cs(this,"shift")},some(n,e){return Hn(this,"some",n,e,void 0,arguments)},splice(...n){return Cs(this,"splice",n)},toReversed(){return wi(this).toReversed()},toSorted(n){return wi(this).toSorted(n)},toSpliced(...n){return wi(this).toSpliced(...n)},unshift(...n){return Cs(this,"unshift",n)},values(){return lc(this,"values",pt)}};function lc(n,e,t){const r=ac(n),i=r[e]();return r!==n&&!St(n)&&(i._next=i.next,i.next=()=>{const o=i._next();return o.value&&(o.value=t(o.value)),o}),i}const N5=Array.prototype;function Hn(n,e,t,r,i,o){const a=ac(n),u=a!==n&&!St(n),f=a[e];if(f!==N5[e]){const p=f.apply(n,o);return u?pt(p):p}let h=t;a!==n&&(u?h=function(p,b){return t.call(this,pt(p),b,n)}:t.length>2&&(h=function(p,b){return t.call(this,p,b,n)}));const m=f.call(a,h,r);return u&&i?i(m):m}function hm(n,e,t,r){const i=ac(n);let o=t;return i!==n&&(St(n)?t.length>3&&(o=function(a,u,f){return t.call(this,a,u,f,n)}):o=function(a,u,f){return t.call(this,a,pt(u),f,n)}),i[e](o,...r)}function uc(n,e,t){const r=fe(n);Ge(r,"iterate",Es);const i=r[e](...t);return(i===-1||i===!1)&&ia(t[0])?(t[0]=fe(t[0]),r[e](...t)):i}function Cs(n,e,t=[]){Zo(),tc();const r=fe(n)[e].apply(n,t);return nc(),Qo(),r}const R5=d5("__proto__,__v_isRef,__isVue"),dm=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(vs));function L5(n){vs(n)||(n=String(n));const e=fe(this);return Ge(e,"has",n),e.hasOwnProperty(n)}class pm{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return o;if(t==="__v_raw")return r===(i?o?_m:bm:o?U5:ym).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Ae(e);if(!i){let f;if(a&&(f=I5[t]))return f;if(t==="hasOwnProperty")return L5}const u=Reflect.get(e,t,tt(e)?e:r);return(vs(t)?dm.has(t):R5(t))||(i||Ge(e,"get",t),o)?u:tt(u)?a&&Xu(t)?u:u.value:dt(u)?i?vm(u):hc(u):u}}class P5 extends pm{constructor(e=!1){super(!1,e)}set(e,t,r,i){let o=e[t];if(!this._isShallow){const f=Vn(o);if(!St(r)&&!Vn(r)&&(o=fe(o),r=fe(r)),!Ae(e)&&tt(o)&&!tt(r))return f?!1:(o.value=r,!0)}const a=Ae(e)&&Xu(t)?Number(t)<e.length:Le(e,t),u=Reflect.set(e,t,r,tt(e)?e:i);return e===fe(i)&&(a?cr(r,o)&&fr(e,"set",t,r,o):fr(e,"add",t,r)),u}deleteProperty(e,t){const r=Le(e,t),i=e[t],o=Reflect.deleteProperty(e,t);return o&&r&&fr(e,"delete",t,void 0,i),o}has(e,t){const r=Reflect.has(e,t);return(!vs(t)||!dm.has(t))&&Ge(e,"has",t),r}ownKeys(e){return Ge(e,"iterate",Ae(e)?"length":zr),Reflect.ownKeys(e)}}class mm extends pm{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&$n(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&$n(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const D5=new P5,F5=new mm,z5=new mm(!0),cc=n=>n,ta=n=>Reflect.getPrototypeOf(n);function B5(n,e,t){return function(...r){const i=this.__v_raw,o=fe(i),a=vi(o),u=n==="entries"||n===Symbol.iterator&&a,f=n==="keys"&&a,h=i[n](...r),m=t?cc:e?pc:pt;return!e&&Ge(o,"iterate",f?oc:zr),{next(){const{value:p,done:b}=h.next();return b?{value:p,done:b}:{value:u?[m(p[0]),m(p[1])]:m(p),done:b}},[Symbol.iterator](){return this}}}}function na(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";$n(`${w5(n)} operation ${t}failed: target is readonly.`,fe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function $5(n,e){const t={get(i){const o=this.__v_raw,a=fe(o),u=fe(i);n||(cr(i,u)&&Ge(a,"get",i),Ge(a,"get",u));const{has:f}=ta(a),h=e?cc:n?pc:pt;if(f.call(a,i))return h(o.get(i));if(f.call(a,u))return h(o.get(u));o!==a&&o.get(i)},get size(){const i=this.__v_raw;return!n&&Ge(fe(i),"iterate",zr),Reflect.get(i,"size",i)},has(i){const o=this.__v_raw,a=fe(o),u=fe(i);return n||(cr(i,u)&&Ge(a,"has",i),Ge(a,"has",u)),i===u?o.has(i):o.has(i)||o.has(u)},forEach(i,o){const a=this,u=a.__v_raw,f=fe(u),h=e?cc:n?pc:pt;return!n&&Ge(f,"iterate",zr),u.forEach((m,p)=>i.call(o,h(m),h(p),a))}};return Nt(t,n?{add:na("add"),set:na("set"),delete:na("delete"),clear:na("clear")}:{add(i){!e&&!St(i)&&!Vn(i)&&(i=fe(i));const o=fe(this);return ta(o).has.call(o,i)||(o.add(i),fr(o,"add",i,i)),this},set(i,o){!e&&!St(o)&&!Vn(o)&&(o=fe(o));const a=fe(this),{has:u,get:f}=ta(a);let h=u.call(a,i);h?process.env.NODE_ENV!=="production"&&gm(a,u,i):(i=fe(i),h=u.call(a,i));const m=f.call(a,i);return a.set(i,o),h?cr(o,m)&&fr(a,"set",i,o,m):fr(a,"add",i,o),this},delete(i){const o=fe(this),{has:a,get:u}=ta(o);let f=a.call(o,i);f?process.env.NODE_ENV!=="production"&&gm(o,a,i):(i=fe(i),f=a.call(o,i));const h=u?u.call(o,i):void 0,m=o.delete(i);return f&&fr(o,"delete",i,void 0,h),m},clear(){const i=fe(this),o=i.size!==0,a=process.env.NODE_ENV!=="production"?vi(i)?new Map(i):new Set(i):void 0,u=i.clear();return o&&fr(i,"clear",void 0,void 0,a),u}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=B5(i,n,e)}),t}function fc(n,e){const t=$5(n,e);return(r,i,o)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(Le(t,i)&&i in r?t:r,i,o)}const H5={get:fc(!1,!1)},V5={get:fc(!0,!1)},W5={get:fc(!0,!0)};function gm(n,e,t){const r=fe(t);if(r!==t&&e.call(n,r)){const i=nm(n);$n(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const ym=new WeakMap,U5=new WeakMap,bm=new WeakMap,_m=new WeakMap;function q5(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function K5(n){return n.__v_skip||!Object.isExtensible(n)?0:q5(nm(n))}function hc(n){return Vn(n)?n:dc(n,!1,D5,H5,ym)}function vm(n){return dc(n,!0,F5,V5,bm)}function ra(n){return dc(n,!0,z5,W5,_m)}function dc(n,e,t,r,i){if(!dt(n))return process.env.NODE_ENV!=="production"&&$n(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const o=i.get(n);if(o)return o;const a=K5(n);if(a===0)return n;const u=new Proxy(n,a===2?r:t);return i.set(n,u),u}function Si(n){return Vn(n)?Si(n.__v_raw):!!(n&&n.__v_isReactive)}function Vn(n){return!!(n&&n.__v_isReadonly)}function St(n){return!!(n&&n.__v_isShallow)}function ia(n){return n?!!n.__v_raw:!1}function fe(n){const e=n&&n.__v_raw;return e?fe(e):n}function G5(n){return!Le(n,"__v_skip")&&Object.isExtensible(n)&&S5(n,"__v_skip",!0),n}const pt=n=>dt(n)?hc(n):n,pc=n=>dt(n)?vm(n):n;function tt(n){return n?n.__v_isRef===!0:!1}function sa(n){return J5(n,!1)}function J5(n,e){return tt(n)?n:new j5(n,e)}class j5{constructor(e,t){this.dep=new sc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:fe(e),this._value=t?e:pt(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||St(e)||Vn(e);e=r?e:fe(e),cr(e,t)&&(this._rawValue=e,this._value=r?e:pt(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function H(n){return tt(n)?n.value:n}const Y5={get:(n,e,t)=>e==="__v_raw"?n:H(Reflect.get(n,e,t)),set:(n,e,t,r)=>{const i=n[e];return tt(i)&&!tt(t)?(i.value=t,!0):Reflect.set(n,e,t,r)}};function X5(n){return Si(n)?n:new Proxy(n,Y5)}class Z5{constructor(e,t,r){this._object=e,this._key=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return O5(fe(this._object),this._key)}}class Q5{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function xi(n,e,t){return tt(n)?n:Pe(n)?new Q5(n):dt(n)&&arguments.length>1?eE(n,e,t):sa(n)}function eE(n,e,t){const r=n[e];return tt(r)?r:new Z5(n,e,t)}class tE{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new sc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=xs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&ve!==this)return sm(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return lm(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&$n("Write operation failed: computed value is readonly")}}function nE(n,e,t=!1){let r,i;Pe(n)?r=n:(r=n.get,i=n.set);const o=new tE(r,i,t);return process.env.NODE_ENV!=="production"&&e&&!t&&(o.onTrack=e.onTrack,o.onTrigger=e.onTrigger),o}const oa={},aa=new WeakMap;let Br;function rE(n,e=!1,t=Br){if(t){let r=aa.get(t);r||aa.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&$n("onWatcherCleanup() was called when there was no active watcher to associate with.")}function iE(n,e,t=Gt){const{immediate:r,deep:i,once:o,scheduler:a,augmentJob:u,call:f}=t,h=N=>{(t.onWarn||$n)("Invalid watch source: ",N,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},m=N=>i?N:St(N)||i===!1||i===0?hr(N,1):hr(N);let p,b,S,E,g=!1,_=!1;if(tt(n)?(b=()=>n.value,g=St(n)):Si(n)?(b=()=>m(n),g=!0):Ae(n)?(_=!0,g=n.some(N=>Si(N)||St(N)),b=()=>n.map(N=>{if(tt(N))return N.value;if(Si(N))return m(N);if(Pe(N))return f?f(N,2):N();process.env.NODE_ENV!=="production"&&h(N)})):Pe(n)?e?b=f?()=>f(n,2):n:b=()=>{if(S){Zo();try{S()}finally{Qo()}}const N=Br;Br=p;try{return f?f(n,3,[E]):n(E)}finally{Br=N}}:(b=Fr,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const N=b,V=i===!0?1/0:i;b=()=>hr(N(),V)}const x=()=>{p.stop()};if(o&&e){const N=e;e=(...V)=>{N(...V),x()}}let k=_?new Array(n.length).fill(oa):oa;const A=N=>{if(!(!(p.flags&1)||!p.dirty&&!N))if(e){const V=p.run();if(i||g||(_?V.some((L,U)=>cr(L,k[U])):cr(V,k))){S&&S();const L=Br;Br=p;try{const U=[V,k===oa?void 0:_&&k[0]===oa?[]:k,E];f?f(e,3,U):e(...U),k=V}finally{Br=L}}}else p.run()};return u&&u(A),p=new A5(b),p.scheduler=a?()=>a(A,!1):A,E=N=>rE(N,!1,p),S=p.onStop=()=>{const N=aa.get(p);if(N){if(f)f(N,4);else for(const V of N)V();aa.delete(p)}},process.env.NODE_ENV!=="production"&&(p.onTrack=t.onTrack,p.onTrigger=t.onTrigger),e?r?A(!0):k=p.run():a?a(A.bind(null,!0),!0):p.run(),x.pause=p.pause.bind(p),x.resume=p.resume.bind(p),x.stop=x,x}function hr(n,e=1/0,t){if(e<=0||!dt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,tt(n))hr(n.value,e,t);else if(Ae(n))for(let r=0;r<n.length;r++)hr(n[r],e,t);else if(g5(n)||vi(n))n.forEach(r=>{hr(r,e,t)});else if(_5(n)){for(const r in n)hr(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&hr(n[r],e,t)}return n}const $r=[];function sE(n){$r.push(n)}function oE(){$r.pop()}let mc=!1;function Te(n,...e){if(mc)return;mc=!0,Zo();const t=$r.length?$r[$r.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=aE();if(r)la(r,t,11,[n+e.map(o=>{var a,u;return(u=(a=o.toString)==null?void 0:a.call(o))!=null?u:JSON.stringify(o)}).join(""),t&&t.proxy,i.map(({vnode:o})=>`at <${Wm(t,o.type)}>`).join(`
23
23
  `),i]);else{const o=[`[Vue warn]: ${n}`,...e];i.length&&o.push(`
24
- `,...X5(i)),console.warn(...o)}Jo(),ac=!1}function Y5(){let n=Fr[Fr.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function X5(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
25
- `],...Z5(t))}),e}function Z5({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Om(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...Q5(n.props),o]:[i+o]}function Q5(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...dm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function dm(n,e,t){return Ln(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:ct(e)?(e=dm(n,fe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Xe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=fe(e),t?e:[`${n}=`,e])}const pm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function na(n,e,t,r){try{return r?n(...r):n()}catch(i){lc(i,e,t)}}function mm(n,e,t,r){if(Xe(n)){const i=na(n,e,t,r);return i&&c5(i)&&i.catch(o=>{lc(o,e,t)}),i}if(Ne(n)){const i=[];for(let o=0;o<n.length;o++)i.push(mm(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ft(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function lc(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||gs;if(e){let u=e.parent;const f=e.proxy,h=process.env.NODE_ENV!=="production"?pm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;u;){const m=u.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,h)===!1)return}u=u.parent}if(o){Go(),na(o,null,10,[n,f,h]),Jo();return}}ek(n,t,i,r,a)}function ek(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=pm[e];if(t&&J5(t),ft(`Unhandled error${o?` during execution of ${o}`:""}`),t&&j5(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const Ut=[];let zn=-1;const wi=[];let cr=null,Si=0;const tk=Promise.resolve();let uc=null;const nk=100;function rk(n){let e=zn+1,t=Ut.length;for(;e<t;){const r=e+t>>>1,i=Ut[r],o=ks(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function gm(n){if(!(n.flags&1)){const e=ks(n),t=Ut[Ut.length-1];!t||!(n.flags&2)&&e>=ks(t)?Ut.push(n):Ut.splice(rk(e),0,n),n.flags|=1,ym()}}function ym(){uc||(uc=tk.then(_m))}function bm(n){Ne(n)?wi.push(...n):cr&&n.id===-1?cr.splice(Si+1,0,n):n.flags&1||(wi.push(n),n.flags|=1),ym()}function ik(n){if(wi.length){const e=[...new Set(wi)].sort((t,r)=>ks(t)-ks(r));if(wi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),Si=0;Si<cr.length;Si++){const t=cr[Si];process.env.NODE_ENV!=="production"&&vm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,Si=0}}const ks=n=>n.id==null?n.flags&2?-1:1/0:n.id;function _m(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>vm(n,t):yi;try{for(zn=0;zn<Ut.length;zn++){const t=Ut[zn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),na(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;zn<Ut.length;zn++){const t=Ut[zn];t&&(t.flags&=-2)}zn=-1,Ut.length=0,ik(n),uc=null,(Ut.length||wi.length)&&_m(n)}}function vm(n,e){const t=n.get(e)||0;if(t>nk){const r=e.i,i=r&&Tm(r.type);return lc(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const cc=new Map;process.env.NODE_ENV!=="production"&&(Ko().__VUE_HMR_RUNTIME__={createRecord:fc(sk),rerender:fc(ok),reload:fc(ak)});const ra=new Map;function sk(n,e){return ra.has(n)?!1:(ra.set(n,{initialDef:ia(e),instances:new Set}),!0)}function ia(n){return Im(n)?n.__vccOpts:n}function ok(n,e){const t=ra.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,ia(r.type).render=e),r.renderCache=[],r.update()}))}function ak(n,e){const t=ra.get(n);if(!t)return;e=ia(e),wm(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=ia(o.type);let u=cc.get(a);u||(a!==t.initialDef&&wm(a,e),cc.set(a,u=new Set)),u.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(u.add(o),o.ceReload(e.styles),u.delete(o)):o.parent?gm(()=>{o.parent.update(),u.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}bm(()=>{cc.clear()})}function wm(n,e){or(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function fc(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let xi,sa=[];function Sm(n,e){var t,r;xi=n,xi?(xi.enabled=!0,sa.forEach(({event:i,args:o})=>xi.emit(i,...o)),sa=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Sm(o,e)}),setTimeout(()=>{xi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,sa=[])},3e3)):sa=[]}let fr=null,lk=null;const uk=n=>n.__isTeleport;function xm(n,e){n.shapeFlag&6&&n.component?(n.transition=e,xm(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}Ko().requestIdleCallback,Ko().cancelIdleCallback;const ck=Symbol.for("v-ndc"),fk={};process.env.NODE_ENV!=="production"&&(fk.ownKeys=n=>(ft("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));let hk=null;function dk(n,e,t=!1){const r=la||fr;if(r||hk){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Xe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ft(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ft("inject() can only be used inside setup() or functional components.")}const pk={},km=n=>Object.getPrototypeOf(n)===pk,mk=wk,gk=Symbol.for("v-scx"),yk=()=>{{const n=dk(gk);return n||process.env.NODE_ENV!=="production"&&ft("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function bk(n,e,t){return process.env.NODE_ENV!=="production"&&!Xe(e)&&ft("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),_k(n,e,t)}function _k(n,e,t=gs){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ft('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ft('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&ft('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const u=or({},t);process.env.NODE_ENV!=="production"&&(u.onWarn=ft);const f=e&&r||!e&&o!=="post";let h;if(ua){if(o==="sync"){const S=yk();h=S.__watcherHandles||(S.__watcherHandles=[])}else if(!f){const S=()=>{};return S.stop=yi,S.resume=yi,S.pause=yi,S}}const m=la;u.call=(S,k,g)=>mm(S,m,k,g);let p=!1;o==="post"?u.scheduler=S=>{mk(S,m&&m.suspense)}:o!=="sync"&&(p=!0,u.scheduler=(S,k)=>{k?S():gm(S)}),u.augmentJob=S=>{e&&(S.flags|=4),p&&(S.flags|=2,m&&(S.id=m.uid,S.i=m))};const b=G5(n,e,u);return ua&&(h?h.push(b):f&&b()),b}const vk=n=>n.__isSuspense;function wk(n,e){e&&e.pendingBranch?Ne(n)?e.effects.push(...n):e.effects.push(n):bm(n)}const Cm=Symbol.for("v-fgt"),Sk=Symbol.for("v-txt"),xk=Symbol.for("v-cmt");let ki=null;function kk(n){return n?n.__v_isVNode===!0:!1}const Ck=(...n)=>Am(...n),Em=({key:n})=>n??null,oa=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Ln(n)||ct(n)||Xe(n)?{i:fr,r:n,k:e,f:!!t}:n:null);function Ek(n,e=null,t=null,r=0,i=null,o=n===Cm?0:1,a=!1,u=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Em(e),ref:e&&oa(e),scopeId:lk,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:fr};return u?(hc(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=Ln(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&ft("VNode created with invalid key (NaN). VNode type:",f.type),!a&&ki&&(f.patchFlag>0||o&6)&&f.patchFlag!==32&&ki.push(f),f}const Ak=process.env.NODE_ENV!=="production"?Ck:Am;function Am(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===ck)&&(process.env.NODE_ENV!=="production"&&!n&&ft(`Invalid vnode type when creating vnode: ${n}.`),n=xk),kk(n)){const u=aa(n,e,!0);return t&&hc(u,t),!o&&ki&&(u.shapeFlag&6?ki[ki.indexOf(n)]=u:ki.push(u)),u.patchFlag=-2,u}if(Im(n)&&(n=n.__vccOpts),e){e=Mk(e);let{class:u,style:f}=e;u&&!Ln(u)&&(e.class=Gu(u)),bt(f)&&(Zo(f)&&!Ne(f)&&(f=or({},f)),e.style=Ku(f))}const a=Ln(n)?1:vk(n)?128:uk(n)?64:bt(n)?4:Xe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&Zo(n)&&(n=fe(n),ft("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
26
- Component that was made reactive: `,n)),Ek(n,e,t,r,i,a,o,!0)}function Mk(n){return n?Zo(n)||km(n)?or({},n):n:null}function aa(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:u,transition:f}=n,h=e?Ok(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Em(h),ref:e&&e.ref?t&&o?Ne(o)?o.concat(oa(e)):[o,oa(e)]:oa(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Ne(u)?u.map(Mm):u,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Cm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&aa(n.ssContent),ssFallback:n.ssFallback&&aa(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&xm(m,f.clone(m)),m}function Mm(n){const e=aa(n);return Ne(n.children)&&(e.children=n.children.map(Mm)),e}function Tk(n=" ",e=0){return Ak(Sk,null,n,e)}function hc(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Ne(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),hc(n,i()),i._c&&(i._d=!0));return}else{t=32;const i=e._;!i&&!km(e)?e._ctx=fr:i===3&&fr&&(fr.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Xe(e)?(e={default:e,_ctx:fr},t=32):(e=String(e),r&64?(t=16,e=[Tk(e)]):t=8);n.children=e,n.shapeFlag|=t}function Ok(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=Gu([e.class,r.class]));else if(i==="style")e.style=Ku([e.style,r.style]);else if(a5(i)){const o=e[i],a=r[i];a&&o!==a&&!(Ne(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let la=null;const Ik=()=>la||fr;{const n=Ko(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};e("__VUE_INSTANCE_SETTERS__",t=>la=t),e("__VUE_SSR_SETTERS__",t=>ua=t)}let ua=!1;process.env.NODE_ENV;const Nk=/(?:^|[-_])(\w)/g,Rk=n=>n.replace(Nk,e=>e.toUpperCase()).replace(/[-_]/g,"");function Tm(n,e=!0){return Xe(n)?n.displayName||n.name:n.name||e&&n.__name}function Om(n,e,t=!1){let r=Tm(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?Rk(r):t?"App":"Anonymous"}function Im(n){return Xe(n)&&"__vccOpts"in n}const ge=(n,e)=>{const t=q5(n,e,ua);if(process.env.NODE_ENV!=="production"){const r=Ik();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function Lk(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return bt(p)?p.__isVue?["div",n,"VueInstance"]:ct(p)?["div",{},["span",n,m(p)],"<",u("_value"in p?p._value:p),">"]:xs(p)?["div",{},["span",n,vt(p)?"ShallowReactive":"Reactive"],"<",u(p),`>${Fn(p)?" (readonly)":""}`]:Fn(p)?["div",{},["span",n,vt(p)?"ShallowReadonly":"Readonly"],"<",u(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const b=[];p.type.props&&p.props&&b.push(a("props",fe(p.props))),p.setupState!==gs&&b.push(a("setup",p.setupState)),p.data!==gs&&b.push(a("data",fe(p.data)));const S=f(p,"computed");S&&b.push(a("computed",S));const k=f(p,"inject");return k&&b.push(a("injected",k)),b.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),b}function a(p,b){return b=or({},b),Object.keys(b).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(b).map(S=>["div",{},["span",r,S+": "],u(b[S],!1)])]]:["span",{}]}function u(p,b=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:bt(p)?["object",{object:b?fe(p):p}]:["span",t,String(p)]}function f(p,b){const S=p.type;if(Xe(S))return;const k={};for(const g in p.ctx)h(S,g,b)&&(k[g]=p.ctx[g]);return k}function h(p,b,S){const k=p[S];if(Ne(k)&&k.includes(b)||bt(k)&&b in k||p.extends&&h(p.extends,b,S)||p.mixins&&p.mixins.some(g=>h(g,b,S)))return!0}function m(p){return vt(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function Pk(){Lk()}process.env.NODE_ENV!=="production"&&Pk();function Ze(n){this.content=n}Ze.prototype={constructor:Ze,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Ze(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ze(t)},addToStart:function(n,e){return new Ze([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ze(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Ze(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ze.from(n),n.size?new Ze(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ze.from(n),n.size?new Ze(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ze.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},get size(){return this.content.length>>1}},Ze.from=function(n){if(n instanceof Ze)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ze(e)};function Nm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=Nm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Rm(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),u=e.child(--o),f=a.nodeSize;if(a==u){t-=f,r-=f;continue}if(!a.sameMarkup(u))return{a:t,b:r};if(a.isText&&a.text!=u.text){let h=0,m=Math.min(a.text.length,u.text.length);for(;h<m&&a.text[a.text.length-h-1]==u.text[u.text.length-h-1];)h++,t--,r--;return{a:t,b:r}}if(a.content.size||u.content.size){let h=Rm(a.content,u.content,t-1,r-1);if(h)return h}t-=f,r-=f}}class z{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,u=0;u<t;a++){let f=this.content[a],h=u+f.nodeSize;if(h>e&&r(f,i+u,o||null,a)!==!1&&f.content.size){let m=u+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(u,f)=>{u.isText?(o+=u.text.slice(Math.max(e,f)-f,t-f),a=!r):u.isLeaf?(i?o+=typeof i=="function"?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new z(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let u=this.content[o],f=a+u.nodeSize;f>e&&((a<e||f>t)&&(u.isText?u=u.cut(Math.max(0,e-a),Math.min(u.text.length,t-a)):u=u.cut(Math.max(0,e-a-1),Math.min(u.content.size,t-a-1))),r.push(u),i+=u.nodeSize),a=f}return new z(r,i)}cutByIndex(e,t){return e==t?z.empty:e==0&&t==this.content.length?this:new z(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new z(i,o)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(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,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return Nm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Rm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return ca(0,e);if(e==this.size)return ca(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?ca(r+1,a):ca(r,i);i=a}}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 z.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new z(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new z(t||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const dc={index:0,offset:0};function ca(n,e){return dc.index=n,dc.offset=e,dc}function fa(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!fa(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!fa(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Ce=class Xf{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||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&&fa(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Xf.none;if(e instanceof Xf)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Ce.none=[];class ha extends Error{}class K{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Pm(this.content,e+this.openStart,t);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,t){return new K(Lm(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 K.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new K(z.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function Lm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:u}=n.findIndex(t);if(i==e||o.isText){if(u!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Lm(o.content,e-i-1,t-i-1)))}function Pm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let u=Pm(a.content,e-o-1,t);return u&&n.replaceChild(i,a.copy(u))}function Dk(n,e,t){if(t.openStart>n.depth)throw new ha("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ha("Inconsistent open depths");return Dm(n,e,t,0)}function Dm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=Dm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,u=a.content;return Br(a,u.cut(0,n.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=Fk(t,n);return Br(o,zm(n,a,u,e,r))}else return Br(o,da(n,e,r))}function Fm(n,e){if(!e.type.compatibleContent(n.type))throw new ha("Cannot join "+e.type.name+" onto "+n.type.name)}function pc(n,e,t){let r=n.node(t);return Fm(r,e.node(t)),r}function zr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Cs(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(zr(n.nodeAfter,r),o++));for(let u=o;u<a;u++)zr(i.child(u),r);e&&e.depth==t&&e.textOffset&&zr(e.nodeBefore,r)}function Br(n,e){return n.type.checkContent(e),n.copy(e)}function zm(n,e,t,r,i){let o=n.depth>i&&pc(n,e,i+1),a=r.depth>i&&pc(t,r,i+1),u=[];return Cs(null,n,i,u),o&&a&&e.index(i)==t.index(i)?(Fm(o,a),zr(Br(o,zm(n,e,t,r,i+1)),u)):(o&&zr(Br(o,da(n,e,i+1)),u),Cs(e,t,i,u),a&&zr(Br(a,da(t,r,i+1)),u)),Cs(r,null,i,u),new z(u)}function da(n,e,t){let r=[];if(Cs(null,n,t,r),n.depth>t){let i=pc(n,e,t+1);zr(Br(i,da(n,e,t+1)),r)}return Cs(e,null,t,r),new z(r)}function Fk(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(z.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class qs{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new pa(this,e,r);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 r=[],i=0,o=t;for(let a=e;;){let{index:u,offset:f}=a.content.findIndex(o),h=o-f;if(r.push(a,u,i+f),!h||(a=a.child(u),a.isText))break;o=h-1,i+=f+1}return new qs(t,r,o)}static resolveCached(e,t){for(let i=0;i<mc.length;i++){let o=mc[i];if(o.pos==t&&o.doc==e)return o}let r=mc[gc]=qs.resolve(e,t);return gc=(gc+1)%zk,r}}let mc=[],gc=0,zk=12;class pa{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 Bk=Object.create(null);let $r=class Zf{constructor(e,t,r,i=Ce.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||z.empty}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,r,i=0){this.content.nodesBetween(e,t,r,i,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,r,i){return this.content.textBetween(e,t,r,i)}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,r){return this.type==e&&fa(this.attrs,t||e.defaultAttrs||Bk)&&Ce.sameSet(this.marks,r||Ce.none)}copy(e=null){return e==this.content?this:new Zf(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Zf(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return K.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),u=i.start(a),h=i.node(a).content.cut(i.pos-u,o.pos-u);return new K(h,i.depth-a,o.depth-a)}replace(e,t,r){return Dk(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return qs.resolveCached(this,e)}resolveNoCache(e){return qs.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Bm(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,r=z.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.validEnd:!1}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);let e=Ce.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=z.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};$r.prototype.text=void 0;class pl extends $r{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bm(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 pl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 Bm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Qr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new $k(e,t);if(r.next==null)return Qr.empty;let i=$m(r);r.next&&r.err("Unexpected trailing text");let o=Gk(Kk(i));return Jk(o,r),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,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,u){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return z.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:m,next:p}=a.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let b=o(p,u.concat(m));if(b)return b}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:f}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!i.type||f.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),t[u.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=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
27
- `)}}Qr.empty=new Qr(!0);class $k{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 $m(n){let e=[];do e.push(Hk(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Hk(n){let e=[];do e.push(Wk(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wk(n){let e=qk(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vk(n,e);else break;return e}function Hm(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vk(n,e){let t=Hm(n),r=t;return n.eat(",")&&(n.next!="}"?r=Hm(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Uk(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.groups.indexOf(e)>-1&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function qk(n){if(n.eat("(")){let e=$m(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Uk(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Kk(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,u,f){let h={term:f,to:u};return e[a].push(h),h}function i(a,u){a.forEach(f=>f.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,u)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],u);if(f==a.exprs.length-1)return h;i(h,u=t())}else if(a.type=="star"){let f=t();return r(u,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,u),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(u)].concat(o(a.expr,u));if(a.type=="range"){let f=u;for(let h=0;h<a.min;h++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function Wm(n,e){return e-n}function Vm(n,e){let t=[];return r(e),t.sort(Wm);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:u,to:f}=o[a];!u&&t.indexOf(f)==-1&&r(f)}}}function Gk(n){let e=Object.create(null);return t(Vm(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:u,to:f})=>{if(!u)return;let h;for(let m=0;m<i.length;m++)i[m][0]==u&&(h=i[m][1]);Vm(n,f).forEach(m=>{h||i.push([u,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let o=e[r.join(",")]=new Qr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(Wm);o.next.push({type:i[a][0],next:e[u.join(",")]||t(u)})}return o}}function Jk(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:f,next:h}=i.next[u];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(h)==-1&&r.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Um(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function qm(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function Km(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new jk(n[t]);return e}let Gm=class ly{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Km(r.attrs),this.defaultAttrs=Um(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:qm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $r(this,this.computeAttrs(e),z.from(t),Ce.setFrom(r))}createChecked(e=null,t,r){return t=z.from(t),this.checkContent(t),new $r(this,this.computeAttrs(e),t,Ce.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=z.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(z.empty,!0);return o?new $r(this,e,t.append(o),Ce.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Ce.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new ly(o,t,a));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class jk{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class ml{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Km(i.attrs),this.excluded=null;let o=Um(this.attrs);this.instance=o?new Ce(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ce(this,qm(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new ml(o,i++,t,a)),r}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class Yk{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Ze.from(e.nodes),t.marks=Ze.from(e.marks||{}),this.nodes=Gm.compile(this.spec.nodes,this),this.marks=ml.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],a=o.spec.content||"",u=o.spec.marks;o.contentMatch=r[a]||(r[a]=Qr.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=u=="_"?null:u?Jm(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:Jm(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Gm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new pl(r,r.defaultAttrs,e,Ce.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return $r.fromJSON(this,e)}markFromJSON(e){return Ce.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Jm(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let u in n.marks){let f=n.marks[u];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}let yc=class Qf{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Zm(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Zm(this,t,!0);return r.addAll(e,t.from,t.to),K.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Qk(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let u=t[a];if((u.priority==null?50:u.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=Qm(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=Qm(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Qf(e,Qf.schemaRules(e)))}};const jm={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},Xk={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ym={ol:!0,ul:!0},ma=1,ga=2,Es=4;function Xm(n,e,t){return e!=null?(e?ma:0)|(e==="full"?ga:0):n&&n.whitespace=="pre"?ma|ga:t&~Es}class ya{constructor(e,t,r,i,o,a,u){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=u,this.content=[],this.activeMarks=Ce.none,this.stashMarks=[],this.match=a||(u&Es?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(z.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ma)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=z.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(z.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):tC(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!jm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zm{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,a=Xm(null,t.preserveWhitespace,0)|(r?Es:0);i?o=new ya(i.type,i.attrs,Ce.none,Ce.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new ya(null,null,Ce.none,Ce.none,!0,null,a):o=new ya(e.schema.topNodeType,null,Ce.none,Ce.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(e.nodeType==3)this.addTextNode(e);else if(e.nodeType==1){let t=e.getAttribute("style");if(!t)this.addElement(e);else{let r=this.readStyles(eC(t));if(!r)return;let[i,o]=r,a=this.top;for(let u=0;u<o.length;u++)this.removePendingMark(o[u],a);for(let u=0;u<i.length;u++)this.addPendingMark(i[u]);this.addElement(e);for(let u=0;u<i.length;u++)this.removePendingMark(i[u],a);for(let u=0;u<o.length;u++)this.addPendingMark(o[u])}}}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&ga||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&ma)r.options&ga?t=t.replace(/\r\n?/g,`
28
- `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=e.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;Ym.hasOwnProperty(r)&&this.parser.normalizeLists&&Zk(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(o?o.ignore:Xk.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let a,u=this.top,f=this.needsBlock;if(jm.hasOwnProperty(r))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),a=!0,u.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}this.addAll(e),a&&this.sync(u),this.needsBlock=f}else this.addElementByRule(e,o,o.consuming===!1?i:void 0)}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
29
- `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=Ce.none,r=Ce.none;e:for(let i=0;i<e.length;i+=2)for(let o=void 0;;){let a=this.parser.matchStyle(e[i],e[i+1],this,o);if(!a)continue e;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.forEach(u=>{a.clearMark(u)&&(r=u.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)o=a;else break}return[t,r]}addElementByRule(e,t,r){let i,o,a;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):i=this.enter(o,t.attrs||null,t.preserveWhitespace)):(a=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(a));let u=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f)}i&&this.sync(u)&&this.open--,a&&this.removePendingMark(a,u)}addAll(e,t,r){let i=t||0;for(let o=t?e.childNodes[t]:e.firstChild,a=r==null?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],a=o.findWrapping(e);if(a&&(!t||t.length>a.length)&&(t=a,r=o,!a.length)||o.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let a=Xm(e,i,o.options);o.options&Es&&o.content.length==0&&(a|=Es),this.nodes.push(new ya(e,t,o.activeMarks,o.pendingMarks,r,null,a)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(u,f)=>{for(;u>=0;u--){let h=t[u];if(h==""){if(u==t.length-1||u==0)continue;for(;f>=o;f--)if(a(u-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=h&&m.groups.indexOf(h)==-1)return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=nC(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let a=i.popFromStashMark(e);a&&i.type&&i.type.allowsMarkType(a.type)&&(i.activeMarks=a.addToSet(i.activeMarks))}if(i==t)break}}}function Zk(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ym.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Qk(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function eC(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function Qm(n){let e={};for(let t in n)e[t]=n[t];return e}function tC(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=u=>{o.push(u);for(let f=0;f<u.edgeCount;f++){let{type:h,next:m}=u.edge(f);if(h==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}function nC(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class ti{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=bc(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let u=0,f=0;for(;u<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[u][0])||h.type.spec.spanning===!1)break;u++,f++}for(;u<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],m=this.serializeMark(h,a.isInline,t);m&&(o.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ti.renderSpec(bc(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ti.renderSpec(bc(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let a,u=r?e.createElementNS(r,i):e.createElement(i),f=t[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let p=m.indexOf(" ");p>0?u.setAttributeNS(m.slice(0,p),m.slice(p+1),f[m]):u.setAttribute(m,f[m])}}for(let m=h;m<t.length;m++){let p=t[m];if(p===0){if(m<t.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:S}=ti.renderSpec(e,p,r);if(u.appendChild(b),S){if(a)throw new RangeError("Multiple content holes");a=S}}}return{dom:u,contentDOM:a}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ti(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=eg(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return eg(e.marks)}}function eg(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function bc(n){return n.document||window.document}const tg=65535,ng=Math.pow(2,16);function rC(n,e){return n+e*ng}function rg(n){return n&tg}function iC(n){return(n-(n&tg))/ng}const ig=1,sg=2,ba=4,og=8;class _c{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&og)>0}get deletedBefore(){return(this.delInfo&(ig|ba))>0}get deletedAfter(){return(this.delInfo&(sg|ba))>0}get deletedAcross(){return(this.delInfo&ba)>0}}class Yt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Yt.empty)return Yt.empty}recover(e){let t=0,r=rg(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+iC(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[u+o],m=this.ranges[u+a],p=f+h;if(e<=p){let b=h?e==f?-1:e==p?1:t:t,S=f+i+(b<0?0:m);if(r)return S;let k=e==(t<0?f:p)?null:rC(u/3,e-f),g=e==f?sg:e==p?ig:ba;return(t<0?e!=f:e!=p)&&(g|=og),new _c(S,g,k)}i+=m-h}return r?e+i:new _c(e+i,0,null)}touches(e,t){let r=0,i=rg(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?r:0);if(f>e)break;let h=this.ranges[u+o],m=f+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+a]-h}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[i+t],m=this.ranges[i+r];e(u,u+h,f,f+m),o+=m-h}}invert(){return new Yt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Yt.empty:new Yt(e<0?[0,-e,0]:[0,0,e])}}Yt.empty=new Yt([]);class Ui{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Ui(this.maps,this.mirror,e,t)}copy(){return new Ui(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i: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,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Ui;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],u=a.mapResult(e,t);if(u.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new _c(e,i,null)}}const vc=Object.create(null);class it{getMap(){return Yt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=vc[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in vc)throw new RangeError("Duplicate use of step JSON ID "+e);return vc[e]=t,t.prototype.jsonID=e,t}}class Le{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Le(e,null)}static fail(e){return new Le(null,e)}static fromReplace(e,t,r,i){try{return Le.ok(e.replace(t,r,i))}catch(o){if(o instanceof ha)return Le.fail(o.message);throw o}}}function wc(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(wc(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return z.fromArray(r)}class kr extends it{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new K(wc(t.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,o)}invert(){return new wn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kr(t.pos,r.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("addMark",kr);class wn extends it{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new K(wc(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Le.fromReplace(e,this.from,this.to,r)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new wn(t.pos,r.pos,this.mark)}merge(e){return e instanceof wn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new wn(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new wn(t.from,t.to,e.markFromJSON(t.mark))}}it.jsonID("removeMark",wn);class Cr extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Cr(this.pos,t.marks[i]);return new Cr(this.pos,this.mark)}}return new qi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Cr(t.pos,e.markFromJSON(t.mark))}}it.jsonID("addNodeMark",Cr);class qi extends it{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Le.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Cr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new qi(t.pos,e.markFromJSON(t.mark))}}it.jsonID("removeNodeMark",qi);class st extends it{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Sc(e,this.from,this.to)?Le.fail("Structure replace would overwrite content"):Le.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Yt([this.from,this.to-this.from,this.slice.size])}invert(e){return new st(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new st(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof st)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?K.empty:new K(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new st(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?K.empty:new K(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new st(e.from,this.to,t,this.structure)}else return null}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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new st(t.from,t.to,K.fromJSON(e,t.slice),!!t.structure)}}it.jsonID("replace",st);class Ge extends it{constructor(e,t,r,i,o,a,u=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Sc(e,this.from,this.gapFrom)||Sc(e,this.gapTo,this.to)))return Le.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Le.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Le.fromReplace(e,this.from,this.to,r):Le.fail("Content does not fit in gap")}getMap(){return new Yt([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 Ge(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),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Ge(t.pos,r.pos,i,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ge(t.from,t.to,t.gapFrom,t.gapTo,K.fromJSON(e,t.slice),t.insert,!!t.structure)}}it.jsonID("replaceAround",Ge);function Sc(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function sC(n,e,t,r){let i=[],o=[],a,u;n.doc.nodesBetween(e,t,(f,h,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let b=Math.max(h,e),S=Math.min(h+f.nodeSize,t),k=r.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(k)||(a&&a.to==b&&a.mark.eq(p[g])?a.to=S:i.push(a=new wn(b,S,p[g])));u&&u.to==b?u.to=S:o.push(u=new kr(b,S,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function oC(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,u)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof ml){let h=a.marks,m;for(;m=r.isInSet(h);)(f||(f=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let h=Math.min(u+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],b;for(let S=0;S<i.length;S++){let k=i[S];k.step==o-1&&p.eq(i[S].style)&&(b=k)}b?(b.to=h,b.step=o):i.push({style:p,from:Math.max(u,e),to:h,step:o})}}}),i.forEach(a=>n.step(new wn(a.from,a.to,a.style)))}function aC(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let u=0;u<i.childCount;u++){let f=i.child(u),h=a+f.nodeSize,m=r.matchType(f.type);if(!m)o.push(new st(a,h,K.empty));else{r=m;for(let p=0;p<f.marks.length;p++)t.allowsMarkType(f.marks[p].type)||n.step(new wn(a,h,f.marks[p]))}a=h}if(!r.validEnd){let u=r.fillBefore(z.empty,!0);n.replace(a,a,new K(u,0,0))}for(let u=o.length-1;u>=0;u--)n.step(o[u])}function lC(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ci(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!lC(i,o,a))break}return null}function uC(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),u=i.after(o+1),f=a,h=u,m=z.empty,p=0;for(let k=o,g=!1;k>t;k--)g||r.index(k)>0?(g=!0,m=z.from(r.node(k).copy(m)),p++):f--;let b=z.empty,S=0;for(let k=o,g=!1;k>t;k--)g||i.after(k+1)<i.end(k)?(g=!0,b=z.from(i.node(k).copy(b)),S++):h++;n.step(new Ge(f,h,a,u,new K(m.append(b),p,S),m.size-p,!0))}function xc(n,e,t=null,r=n){let i=cC(n,e),o=i&&fC(r,e);return o?i.map(ag).concat({type:e,attrs:t}).concat(o.map(ag)):null}function ag(n){return{type:n,attrs:null}}function cC(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function fC(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;f&&h<i;h++)f=f.matchType(t.child(h).type);return!f||!f.validEnd?null:a}function hC(n,e,t){let r=z.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let u=t[a].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=z.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Ge(i,o,i,o,new K(r,0,0),t.length,!0))}function dC(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,u)=>{if(a.isTextblock&&!a.hasMarkup(r,i)&&pC(n.doc,n.mapping.slice(o).map(u),r)){n.clearIncompatible(n.mapping.slice(o).map(u,1),r);let f=n.mapping.slice(o),h=f.map(u,1),m=f.map(u+a.nodeSize,1);return n.step(new Ge(h,m,h+1,m-1,new K(z.from(r.create(i,null,a.marks)),0,0),1,!0)),!1}})}function pC(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function mC(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ge(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new K(z.from(a),0,0),1,!0))}function Bn(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=t-2;h>o;h--,m--){let p=i.node(h),b=i.index(h);if(p.type.spec.isolating)return!1;let S=p.content.cutByIndex(b,p.childCount),k=r&&r[m]||p;if(k!=p&&(S=S.replaceChild(0,k.type.create(k.attrs))),!p.canReplace(b+1,p.childCount)||!k.type.validContent(S))return!1}let u=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(u,u,f?f.type:i.node(o+1).type)}function gC(n,e,t=1,r){let i=n.doc.resolve(e),o=z.empty,a=z.empty;for(let u=i.depth,f=i.depth-t,h=t-1;u>f;u--,h--){o=z.from(i.node(u).copy(o));let m=r&&r[h];a=z.from(m?m.type.create(m.attrs,a):i.node(u).copy(a))}n.step(new st(e,e,new K(o.append(a),t,t),!0))}function hr(n,e){let t=n.resolve(e),r=t.index();return lg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function lg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function _a(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),a=r.node(i+1)),o&&!o.isTextblock&&lg(o,a)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function yC(n,e,t){let r=new st(e-t,e+t,K.empty,!0);n.step(r)}function bC(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function _C(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(u>0?1:0),h=r.node(a),m=!1;if(o==1)m=h.canReplace(f,f,i);else{let p=h.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&h.canReplaceWith(f,f,p[0])}if(m)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function kc(n,e,t=e,r=K.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return ug(i,o,r)?new st(e,t,r):new vC(i,o,r).fit()}function ug(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class vC{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=z.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=z.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,a=r.depth,u=i.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let f=new K(o,a,u);return e>-1?new Ge(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new st(r.pos,i.pos,f):null}findFittable(){for(let e=1;e<=2;e++)for(let t=this.unplaced.openStart;t>=0;t--){let r,i=null;t?(i=Cc(this.unplaced.content,t-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:f}=this.frontier[a],h,m=null;if(e==1&&(o?f.matchType(o.type)||(m=f.fillBefore(z.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:t,frontierDepth:a,parent:i,inject:m};if(e==2&&o&&(h=f.findWrapping(o.type)))return{sliceDepth:t,frontierDepth:a,parent:i,wrap:h};if(i&&f.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Cc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new K(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Cc(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new K(As(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new K(As(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let a=this.unplaced,u=r?r.content:a.content,f=a.openStart-e,h=0,m=[],{match:p,type:b}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)m.push(i.child(g));p=p.matchFragment(i)}let S=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let g=u.child(h),_=p.matchType(g.type);if(!_)break;h++,(h>1||f==0||g.content.size)&&(p=_,m.push(cg(g.mark(b.allowedMarks(g.marks)),h==1?f:0,h==u.childCount?S:-1)))}let k=h==u.childCount;k||(S=-1),this.placed=Ms(this.placed,t,z.from(m)),this.frontier[t].match=p,k&&S<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,_=u;g<S;g++){let x=_.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),_=x.content}this.unplaced=k?e==0?K.empty:new K(As(a.content,e-1,1),e-1,S<0?a.openEnd:e-1):new K(As(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Ec(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Ec(e,t,i,r,o);if(a){for(let u=t-1;u>=0;u--){let{match:f,type:h}=this.frontier[u],m=Ec(e,u,h,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,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=Ms(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ms(this.placed,this.depth,z.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(z.empty,!0);t.childCount&&(this.placed=Ms(this.placed,this.frontier.length,t))}}function As(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(As(n.firstChild.content,e-1,t)))}function Ms(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ms(n.lastChild.content,e-1,t)))}function Cc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function cg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,cg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(z.empty,!0)))),n.copy(r)}function Ec(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,a);return u&&!wC(t,o.content,a)?u:null}function wC(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function SC(n){return n.spec.defining||n.spec.definingForContent}function xC(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(ug(i,o,r))return n.step(new st(e,t,r));let a=hg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let b=i.depth,S=i.pos-1;b>0;b--,S--){let k=i.node(b).type.spec;if(k.defining||k.definingAsContext||k.isolating)break;a.indexOf(b)>-1?u=b:i.before(b)==S&&a.splice(1,0,-b)}let f=a.indexOf(u),h=[],m=r.openStart;for(let b=r.content,S=0;;S++){let k=b.firstChild;if(h.push(k),S==r.openStart)break;b=k.content}for(let b=m-1;b>=0;b--){let S=h[b].type,k=SC(S);if(k&&i.node(f).type!=S)m=b;else if(k||!S.isTextblock)break}for(let b=r.openStart;b>=0;b--){let S=(b+m+1)%(r.openStart+1),k=h[S];if(k)for(let g=0;g<a.length;g++){let _=a[(g+f)%a.length],x=!0;_<0&&(x=!1,_=-_);let E=i.node(_-1),A=i.index(_-1);if(E.canReplaceWith(A,A,k.type,k.marks))return n.replace(i.before(_),x?o.after(_):t,new K(fg(r.content,0,r.openStart,S),S,r.openEnd))}}let p=n.steps.length;for(let b=a.length-1;b>=0&&(n.replace(e,t,r),!(n.steps.length>p));b--){let S=a[b];S<0||(e=i.before(S),t=o.after(S))}}function fg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(fg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(z.empty,!0))}return n}function kC(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=bC(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new K(z.from(r),0,0))}function CC(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=hg(r,i);for(let a=0;a<o.length;a++){let u=o[a],f=a==o.length-1;if(f&&u==0||r.node(u).type.contentMatch.validEnd)return n.delete(r.start(u),i.end(u));if(u>0&&(f||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return n.delete(r.before(u),i.after(u))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a)return n.delete(r.before(a),t);n.delete(e,t)}function hg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Ki extends it{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Le.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Le.fromReplace(e,this.pos,this.pos+1,new K(z.from(i),0,t.isLeaf?0:1))}getMap(){return Yt.empty}invert(e){return new Ki(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 Ki(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ki(t.pos,t.attr,t.value)}}it.jsonID("attr",Ki);let Ei=class extends Error{};Ei=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Ei.prototype=Object.create(Error.prototype),Ei.prototype.constructor=Ei,Ei.prototype.name="TransformError";class EC{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ui}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ei(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}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=K.empty){let i=kc(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new K(z.from(r),0,0))}delete(e,t){return this.replace(e,t,K.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return xC(this,e,t,r),this}replaceRangeWith(e,t,r){return kC(this,e,t,r),this}deleteRange(e,t){return CC(this,e,t),this}lift(e,t){return uC(this,e,t),this}join(e,t=1){return yC(this,e,t),this}wrap(e,t){return hC(this,e,t),this}setBlockType(e,t=e,r,i=null){return dC(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i=[]){return mC(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Ki(e,t,r)),this}addNodeMark(e,t){return this.step(new Cr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Ce)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new qi(e,t)),this}split(e,t=1,r){return gC(this,e,t,r),this}addMark(e,t,r){return sC(this,e,t,r),this}removeMark(e,t,r){return oC(this,e,t,r),this}clearIncompatible(e,t,r){return aC(this,e,t,r),this}}const Ac=Object.create(null);class ye{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new AC(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=K.empty){let r=t.content.lastChild,i=null;for(let u=0;u<t.openEnd;u++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:f,$to:h}=a[u],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(h.pos),u?K.empty:t),u==0&&mg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],f=e.mapping.slice(r),h=f.map(a.pos),m=f.map(u.pos);o?e.deleteRange(h,m):(e.replaceRangeWith(h,m,t),mg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new pe(e):Ai(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?Ai(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Ai(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new jt(e.node(0))}static atStart(e){return Ai(e,e,0,0,1)||new jt(e)}static atEnd(e){return Ai(e,e,e.content.size,e.childCount,-1)||new jt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ac[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ac)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ac[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}}ye.prototype.visible=!0;class AC{constructor(e,t){this.$from=e,this.$to=t}}let dg=!1;function pg(n){!dg&&!n.parent.inlineContent&&(dg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class pe extends ye{constructor(e,t=e){pg(e),pg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return ye.near(r);let i=e.resolve(t.map(this.anchor));return new pe(i.parent.inlineContent?i:r,r)}replace(e,t=K.empty){if(super.replace(e,t),t==K.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof pe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new pe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=ye.findFrom(t,r,!0)||ye.findFrom(t,-r,!0);if(o)t=o.$head;else return ye.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(ye.findFrom(e,-r,!0)||ye.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new pe(e,t)}}ye.jsonID("text",pe);class gl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gl(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ee extends ye{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?ye.near(o):new ee(o)}content(){return new K(z.from(this.node),0,0)}eq(e){return e instanceof ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new eh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ee(e.resolve(t.anchor))}static create(e,t){return new ee(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ee.prototype.visible=!1,ye.jsonID("node",ee);class eh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new gl(r,r):new eh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ee.isSelectable(r)?new ee(t):ye.near(t)}}class jt extends ye{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=K.empty){if(t==K.empty){e.delete(0,e.doc.content.size);let r=ye.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new jt(e)}map(e){return new jt(e)}eq(e){return e instanceof jt}getBookmark(){return MC}}ye.jsonID("all",jt);const MC={map(){return this},resolve(n){return new jt(n)}};function Ai(n,e,t,r,i,o=!1){if(e.inlineContent)return pe.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let u=e.child(a);if(u.isAtom){if(!o&&ee.isSelectable(u))return ee.create(n,t-(i<0?u.nodeSize:0))}else{let f=Ai(n,u,t+i,i<0?u.childCount:0,i,o);if(f)return f}t+=u.nodeSize*i}return null}function mg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof st||i instanceof Ge))return;let o=n.mapping.maps[r],a;o.forEach((u,f,h,m)=>{a==null&&(a=m)}),n.setSelection(ye.near(n.doc.resolve(a),t))}function gg(n,e){return!e||!n?n:n.bind(e)}class va{constructor(e,t,r){this.name=e,this.init=gg(t.init,r),this.apply=gg(t.apply,r)}}new va("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new va("selection",{init(n,e){return n.selection||ye.atStart(e.doc)},apply(n){return n.selection}}),new va("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new va("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function yg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=yg(i,e,{})),t[r]=i}return t}class Ot{constructor(e){this.spec=e,this.props={},e.props&&yg(e.props,this,this.props),this.key=e.key?e.key.key:bg("plugin")}getState(e){return e[this.key]}}const Mc=Object.create(null);function bg(n){return n in Mc?n+"$"+ ++Mc[n]:(Mc[n]=0,n+"$")}class an{constructor(e="key"){this.key=bg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ts=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},_g=function(n,e,t,r){return t&&(vg(n,e,t,r,-1)||vg(n,e,t,r,1))},TC=/^(img|br|input|textarea|hr)$/i;function vg(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:wa(n))){let o=n.parentNode;if(!o||o.nodeType!=1||IC(n)||TC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ts(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?wa(n):0}else return!1}}function wa(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function OC(n,e,t){for(let r=e==0,i=e==wa(n);r||i;){if(n==t)return!0;let o=Ts(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==wa(n)}}function IC(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const wg=function(n){return n.focusNode&&_g(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Sg(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const dr=typeof navigator<"u"?navigator:null,xg=typeof document<"u"?document:null,pr=dr&&dr.userAgent||"",Tc=/Edge\/(\d+)/.exec(pr),kg=/MSIE \d/.exec(pr),Oc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pr),Os=!!(kg||Oc||Tc),Cg=kg?document.documentMode:Oc?+Oc[1]:Tc?+Tc[1]:0,Sa=!Os&&/gecko\/(\d+)/i.test(pr);Sa&&+(/Firefox\/(\d+)/.exec(pr)||[0,0])[1];const Ic=!Os&&/Chrome\/(\d+)/.exec(pr),Mi=!!Ic,NC=Ic?+Ic[1]:0,Hr=!Os&&!!dr&&/Apple Computer/.test(dr.vendor),Nc=Hr&&(/Mobile\/\w+/.test(pr)||!!dr&&dr.maxTouchPoints>2),qt=Nc||(dr?/Mac/.test(dr.platform):!1),Is=/Android \d/.test(pr),Rc=!!xg&&"webkitFontSmoothing"in xg.documentElement.style,RC=Rc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function LC(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let u=r.resolve(a),f,h;if(wg(t)){for(f=u;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&ee.isSelectable(m)&&i.parent&&!(m.isInline&&OC(t.focusNode,t.focusOffset,i.dom))){let p=i.posBefore;h=new ee(a==p?u:r.resolve(p))}}else{let m=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(m<0)return null;f=r.resolve(m)}if(!h){let m=e=="pointer"||n.state.selection.head<u.pos&&!o?1:-1;h=Ig(n,f,u,m)}return h}function Eg(n){return n.editable?n.hasFocus():zC(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Lc(n,e=!1){let t=n.state.selection;if(FC(n,t),!!Eg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Mi){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&_g(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)DC(n);else{let{anchor:r,head:i}=t,o,a;Ag&&!(t instanceof pe)&&(t.$from.parent.inlineContent||(o=Mg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Mg(n,t.to))),n.docView.setSelection(r,i,n.root,e),Ag&&(o&&Tg(o),a&&Tg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&PC(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Ag=Hr||Mi&&NC<63;function Mg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Hr&&i&&i.contentEditable=="false")return Pc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Pc(i);if(o)return Pc(o)}}function Pc(n){return n.contentEditable="true",Hr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Tg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function PC(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Eg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function DC(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,Ts(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Os&&Cg<=11&&(r.disabled=!0,r.disabled=!1)}function FC(n,e){if(e instanceof ee){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Og(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Og(n)}function Og(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ig(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||pe.between(e,t,r)}function zC(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Dc(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ye.findFrom(o,e)}function Wr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ng(n,e,t){let r=n.state.selection;if(r instanceof pe){if(!r.empty||t.indexOf("s")>-1)return!1;if(n.endOfTextblock(e>0?"right":"left")){let i=Dc(n.state,e);return i&&i instanceof ee?Wr(n,i):!1}else if(!(qt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let u=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(u))&&!a.contentDOM?ee.isSelectable(o)?Wr(n,new ee(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Rc?Wr(n,new pe(n.state.doc.resolve(e<0?u:u+o.nodeSize))):!1:!1}}else{if(r instanceof ee&&r.node.isInline)return Wr(n,new pe(e>0?r.$to:r.$from));{let i=Dc(n.state,e);return i?Wr(n,i):!1}}}function xa(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ns(n){let e=n.pmViewDesc;return e&&e.size==0&&(n.nextSibling||n.nodeName!="BR")}function Fc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(Sa&&t.nodeType==1&&r<xa(t)&&Ns(t.childNodes[r])&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let u=t.childNodes[r-1];if(Ns(u))i=t,o=--r;else if(u.nodeType==3)t=u,r=t.nodeValue.length;else break}}else{if(Rg(t))break;{let u=t.previousSibling;for(;u&&Ns(u);)i=t.parentNode,o=Ts(u),u=u.previousSibling;if(u)t=u,r=xa(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?Bc(n,t,r):i&&Bc(n,i,o)}function zc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=xa(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let u=t.childNodes[r];if(Ns(u))o=t,a=++r;else break}else{if(Rg(t))break;{let u=t.nextSibling;for(;u&&Ns(u);)o=u.parentNode,a=Ts(u)+1,u=u.nextSibling;if(u)t=u,r=0,i=xa(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Bc(n,o,a)}function Rg(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Bc(n,e,t){let r=n.domSelection();if(wg(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&Lc(n)},50)}function Lg(n,e,t){let r=n.state.selection;if(r instanceof pe&&!r.empty||t.indexOf("s")>-1||qt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Dc(n.state,e);if(a&&a instanceof ee)return Wr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,u=r instanceof jt?ye.near(a,e):ye.findFrom(a,e);return u?Wr(n,u):!1}return!1}function Pg(n,e){if(!(n.state.selection instanceof pe))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function Dg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function BC(n){if(!Hr||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Dg(n,r,"true"),setTimeout(()=>Dg(n,r,"false"),20)}return!1}function $C(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function HC(n,e){let t=e.keyCode,r=$C(e);return t==8||qt&&t==72&&r=="c"?Pg(n,-1)||Fc(n):t==46||qt&&t==68&&r=="c"?Pg(n,1)||zc(n):t==13||t==27?!0:t==37||qt&&t==66&&r=="c"?Ng(n,-1,r)||Fc(n):t==39||qt&&t==70&&r=="c"?Ng(n,1,r)||zc(n):t==38||qt&&t==80&&r=="c"?Lg(n,-1,r)||Fc(n):t==40||qt&&t==78&&r=="c"?BC(n)||Lg(n,1,r)||zc(n):r==(qt?"m":"c")&&(t==66||t==73||t==89||t==90)}function Fg(n,e){n.someProp("transformCopied",S=>{e=S(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let S=r.firstChild;t.push(S.type.name,S.attrs!=S.type.defaultAttrs?S.attrs:null),r=S.content}let a=n.someProp("clipboardSerializer")||ti.fromSchema(n.state.schema),u=qg(),f=u.createElement("div");f.appendChild(a.serializeFragment(r,{document:u}));let h=f.firstChild,m,p=0;for(;h&&h.nodeType==1&&(m=Vg[h.nodeName.toLowerCase()]);){for(let S=m.length-1;S>=0;S--){let k=u.createElement(m[S]);for(;f.firstChild;)k.appendChild(f.firstChild);f.appendChild(k),p++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let b=n.someProp("clipboardTextSerializer",S=>S(e,n))||e.content.textBetween(0,e.content.size,`
24
+ `,...lE(i)),console.warn(...o)}Qo(),mc=!1}function aE(){let n=$r[$r.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function lE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
25
+ `],...uE(t))}),e}function uE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Wm(n.component,n.type,r)}`,o=">"+t;return n.props?[i,...cE(n.props),o]:[i+o]}function cE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...wm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function wm(n,e,t){return un(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:tt(e)?(e=wm(n,fe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Pe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=fe(e),t?e:[`${n}=`,e])}const Sm={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function la(n,e,t,r){try{return r?n(...r):n()}catch(i){gc(i,e,t)}}function xm(n,e,t,r){if(Pe(n)){const i=la(n,e,t,r);return i&&y5(i)&&i.catch(o=>{gc(o,e,t)}),i}if(Ae(n)){const i=[];for(let o=0;o<n.length;o++)i.push(xm(n[o],e,t,r));return i}else process.env.NODE_ENV!=="production"&&Te(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function gc(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||Gt;if(e){let u=e.parent;const f=e.proxy,h=process.env.NODE_ENV!=="production"?Sm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;u;){const m=u.ec;if(m){for(let p=0;p<m.length;p++)if(m[p](n,f,h)===!1)return}u=u.parent}if(o){Zo(),la(o,null,10,[n,f,h]),Qo();return}}fE(n,t,i,r,a)}function fE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const o=Sm[e];if(t&&sE(t),Te(`Unhandled error${o?` during execution of ${o}`:""}`),t&&oE(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const Jt=[];let Wn=-1;const Ei=[];let dr=null,Ci=0;const Em=Promise.resolve();let ua=null;const hE=100;function dE(n){const e=ua||Em;return n?e.then(this?n.bind(this):n):e}function pE(n){let e=Wn+1,t=Jt.length;for(;e<t;){const r=e+t>>>1,i=Jt[r],o=ks(i);o<n||o===n&&i.flags&2?e=r+1:t=r}return e}function yc(n){if(!(n.flags&1)){const e=ks(n),t=Jt[Jt.length-1];!t||!(n.flags&2)&&e>=ks(t)?Jt.push(n):Jt.splice(pE(e),0,n),n.flags|=1,Cm()}}function Cm(){ua||(ua=Em.then(Am))}function km(n){Ae(n)?Ei.push(...n):dr&&n.id===-1?dr.splice(Ci+1,0,n):n.flags&1||(Ei.push(n),n.flags|=1),Cm()}function mE(n){if(Ei.length){const e=[...new Set(Ei)].sort((t,r)=>ks(t)-ks(r));if(Ei.length=0,dr){dr.push(...e);return}for(dr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),Ci=0;Ci<dr.length;Ci++){const t=dr[Ci];process.env.NODE_ENV!=="production"&&Mm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}dr=null,Ci=0}}const ks=n=>n.id==null?n.flags&2?-1:1/0:n.id;function Am(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>Mm(n,t):Fr;try{for(Wn=0;Wn<Jt.length;Wn++){const t=Jt[Wn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),la(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Wn<Jt.length;Wn++){const t=Jt[Wn];t&&(t.flags&=-2)}Wn=-1,Jt.length=0,mE(n),ua=null,(Jt.length||Ei.length)&&Am(n)}}function Mm(n,e){const t=n.get(e)||0;if(t>hE){const r=e.i,i=r&&Vm(r.type);return gc(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}const bc=new Map;process.env.NODE_ENV!=="production"&&(Xo().__VUE_HMR_RUNTIME__={createRecord:_c(gE),rerender:_c(yE),reload:_c(bE)});const ca=new Map;function gE(n,e){return ca.has(n)?!1:(ca.set(n,{initialDef:fa(e),instances:new Set}),!0)}function fa(n){return Um(n)?n.__vccOpts:n}function yE(n,e){const t=ca.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,fa(r.type).render=e),r.renderCache=[],r.update()}))}function bE(n,e){const t=ca.get(n);if(!t)return;e=fa(e),Tm(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const o=r[i],a=fa(o.type);let u=bc.get(a);u||(a!==t.initialDef&&Tm(a,e),bc.set(a,u=new Set)),u.add(o),o.appContext.propsCache.delete(o.type),o.appContext.emitsCache.delete(o.type),o.appContext.optionsCache.delete(o.type),o.ceReload?(u.add(o),o.ceReload(e.styles),u.delete(o)):o.parent?yc(()=>{o.parent.update(),u.delete(o)}):o.appContext.reload?o.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),o.root.ce&&o!==o.root&&o.root.ce._removeChildStyle(a)}km(()=>{bc.clear()})}function Tm(n,e){Nt(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function _c(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let ki,ha=[];function Om(n,e){var t,r;ki=n,ki?(ki.enabled=!0,ha.forEach(({event:i,args:o})=>ki.emit(i,...o)),ha=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Om(o,e)}),setTimeout(()=>{ki||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ha=[])},3e3)):ha=[]}let vn=null,_E=null;const vE=n=>n.__isTeleport;function Im(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Im(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}Xo().requestIdleCallback,Xo().cancelIdleCallback;const wE=Symbol.for("v-ndc"),vc=n=>n?XE(n)?ZE(n):vc(n.parent):null,As=Nt(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>process.env.NODE_ENV!=="production"?ra(n.props):n.props,$attrs:n=>process.env.NODE_ENV!=="production"?ra(n.attrs):n.attrs,$slots:n=>process.env.NODE_ENV!=="production"?ra(n.slots):n.slots,$refs:n=>process.env.NODE_ENV!=="production"?ra(n.refs):n.refs,$parent:n=>vc(n.parent),$root:n=>vc(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>__VUE_OPTIONS_API__?CE(n):n.type,$forceUpdate:n=>n.f||(n.f=()=>{yc(n.update)}),$nextTick:n=>n.n||(n.n=dE.bind(n.proxy)),$watch:n=>__VUE_OPTIONS_API__?DE.bind(n):Fr}),SE=n=>n==="_"||n==="$",wc=(n,e)=>n!==Gt&&!n.__isScriptSetup&&Le(n,e),xE={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:r,data:i,props:o,accessCache:a,type:u,appContext:f}=n;if(process.env.NODE_ENV!=="production"&&e==="__isVue")return!0;let h;if(e[0]!=="$"){const S=a[e];if(S!==void 0)switch(S){case 1:return r[e];case 2:return i[e];case 4:return t[e];case 3:return o[e]}else{if(wc(r,e))return a[e]=1,r[e];if(i!==Gt&&Le(i,e))return a[e]=2,i[e];if((h=n.propsOptions[0])&&Le(h,e))return a[e]=3,o[e];if(t!==Gt&&Le(t,e))return a[e]=4,t[e];(!__VUE_OPTIONS_API__||EE)&&(a[e]=0)}}const m=As[e];let p,b;if(m)return e==="$attrs"?(Ge(n.attrs,"get",""),process.env.NODE_ENV!=="production"&&void 0):process.env.NODE_ENV!=="production"&&e==="$slots"&&Ge(n,"get",e),m(n);if((p=u.__cssModules)&&(p=p[e]))return p;if(t!==Gt&&Le(t,e))return a[e]=4,t[e];if(b=f.config.globalProperties,Le(b,e))return b[e];process.env.NODE_ENV!=="production"&&vn&&(!un(e)||e.indexOf("__v")!==0)&&(i!==Gt&&SE(e[0])&&Le(i,e)?Te(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):n===vn&&Te(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:n},e,t){const{data:r,setupState:i,ctx:o}=n;return wc(i,e)?(i[e]=t,!0):process.env.NODE_ENV!=="production"&&i.__isScriptSetup&&Le(i,e)?(Te(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):r!==Gt&&Le(r,e)?(r[e]=t,!0):Le(n.props,e)?(process.env.NODE_ENV!=="production"&&Te(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in n?(process.env.NODE_ENV!=="production"&&Te(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(process.env.NODE_ENV!=="production"&&e in n.appContext.config.globalProperties?Object.defineProperty(o,e,{enumerable:!0,configurable:!0,value:t}):o[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:r,appContext:i,propsOptions:o}},a){let u;return!!t[a]||n!==Gt&&Le(n,a)||wc(e,a)||(u=o[0])&&Le(u,a)||Le(r,a)||Le(As,a)||Le(i.config.globalProperties,a)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Le(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};process.env.NODE_ENV!=="production"&&(xE.ownKeys=n=>(Te("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));function Nm(n){return Ae(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let EE=!0;function CE(n){const e=n.type,{mixins:t,extends:r}=e,{mixins:i,optionsCache:o,config:{optionMergeStrategies:a}}=n.appContext,u=o.get(e);let f;return u?f=u:!i.length&&!t&&!r?f=e:(f={},i.length&&i.forEach(h=>da(f,h,a,!0)),da(f,e,a)),dt(e)&&o.set(e,f),f}function da(n,e,t,r=!1){const{mixins:i,extends:o}=e;o&&da(n,o,t,!0),i&&i.forEach(a=>da(n,a,t,!0));for(const a in e)if(r&&a==="expose")process.env.NODE_ENV!=="production"&&Te('"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.');else{const u=kE[a]||t&&t[a];n[a]=u?u(n[a],e[a]):e[a]}return n}const kE={data:Rm,props:Pm,emits:Pm,methods:Ms,computed:Ms,beforeCreate:mt,created:mt,beforeMount:mt,mounted:mt,beforeUpdate:mt,updated:mt,beforeDestroy:mt,beforeUnmount:mt,destroyed:mt,unmounted:mt,activated:mt,deactivated:mt,errorCaptured:mt,serverPrefetch:mt,components:Ms,directives:Ms,watch:ME,provide:Rm,inject:AE};function Rm(n,e){return e?n?function(){return Nt(Pe(n)?n.call(this,this):n,Pe(e)?e.call(this,this):e)}:e:n}function AE(n,e){return Ms(Lm(n),Lm(e))}function Lm(n){if(Ae(n)){const e={};for(let t=0;t<n.length;t++)e[n[t]]=n[t];return e}return n}function mt(n,e){return n?[...new Set([].concat(n,e))]:e}function Ms(n,e){return n?Nt(Object.create(null),n,e):e}function Pm(n,e){return n?Ae(n)&&Ae(e)?[...new Set([...n,...e])]:Nt(Object.create(null),Nm(n),Nm(e??{})):e}function ME(n,e){if(!n)return e;if(!e)return n;const t=Nt(Object.create(null),n);for(const r in e)t[r]=mt(n[r],e[r]);return t}let TE=null;function OE(n,e,t=!1){const r=Ts||vn;if(r||TE){const i=r?r.parent==null?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&Pe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&Te(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&Te("inject() can only be used inside setup() or functional components.")}const IE={},Dm=n=>Object.getPrototypeOf(n)===IE,NE=BE,RE=Symbol.for("v-scx"),LE=()=>{{const n=OE(RE);return n||process.env.NODE_ENV!=="production"&&Te("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function PE(n,e,t){return process.env.NODE_ENV!=="production"&&!Pe(e)&&Te("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),Fm(n,e,t)}function Fm(n,e,t=Gt){const{immediate:r,deep:i,flush:o,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&Te('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&Te('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&Te('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const u=Nt({},t);process.env.NODE_ENV!=="production"&&(u.onWarn=Te);const f=e&&r||!e&&o!=="post";let h;if(ga){if(o==="sync"){const S=LE();h=S.__watcherHandles||(S.__watcherHandles=[])}else if(!f){const S=()=>{};return S.stop=Fr,S.resume=Fr,S.pause=Fr,S}}const m=Ts;u.call=(S,E,g)=>xm(S,m,E,g);let p=!1;o==="post"?u.scheduler=S=>{NE(S,m&&m.suspense)}:o!=="sync"&&(p=!0,u.scheduler=(S,E)=>{E?S():yc(S)}),u.augmentJob=S=>{e&&(S.flags|=4),p&&(S.flags|=2,m&&(S.id=m.uid,S.i=m))};const b=iE(n,e,u);return ga&&(h?h.push(b):f&&b()),b}function DE(n,e,t){const r=this.proxy,i=un(n)?n.includes(".")?FE(r,n):()=>r[n]:n.bind(r,r);let o;Pe(e)?o=e:(o=e.handler,t=e);const a=YE(this),u=Fm(i,o.bind(r),t);return a(),u}function FE(n,e){const t=e.split(".");return()=>{let r=n;for(let i=0;i<t.length&&r;i++)r=r[t[i]];return r}}function sN(){}const zE=n=>n.__isSuspense;function BE(n,e){e&&e.pendingBranch?Ae(n)?e.effects.push(...n):e.effects.push(n):km(n)}const zm=Symbol.for("v-fgt"),$E=Symbol.for("v-txt"),HE=Symbol.for("v-cmt");let Ai=null;function VE(n){return n?n.__v_isVNode===!0:!1}const WE=(...n)=>$m(...n),Bm=({key:n})=>n??null,pa=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?un(n)||tt(n)||Pe(n)?{i:vn,r:n,k:e,f:!!t}:n:null);function UE(n,e=null,t=null,r=0,i=null,o=n===zm?0:1,a=!1,u=!1){const f={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Bm(e),ref:e&&pa(e),scopeId:_E,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:vn};return u?(Sc(f,t),o&128&&n.normalize(f)):t&&(f.shapeFlag|=un(t)?8:16),process.env.NODE_ENV!=="production"&&f.key!==f.key&&Te("VNode created with invalid key (NaN). VNode type:",f.type),!a&&Ai&&(f.patchFlag>0||o&6)&&f.patchFlag!==32&&Ai.push(f),f}const qE=process.env.NODE_ENV!=="production"?WE:$m;function $m(n,e=null,t=null,r=0,i=null,o=!1){if((!n||n===wE)&&(process.env.NODE_ENV!=="production"&&!n&&Te(`Invalid vnode type when creating vnode: ${n}.`),n=HE),VE(n)){const u=ma(n,e,!0);return t&&Sc(u,t),!o&&Ai&&(u.shapeFlag&6?Ai[Ai.indexOf(n)]=u:Ai.push(u)),u.patchFlag=-2,u}if(Um(n)&&(n=n.__vccOpts),e){e=KE(e);let{class:u,style:f}=e;u&&!un(u)&&(e.class=Qu(u)),dt(f)&&(ia(f)&&!Ae(f)&&(f=Nt({},f)),e.style=Zu(f))}const a=un(n)?1:zE(n)?128:vE(n)?64:dt(n)?4:Pe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&ia(n)&&(n=fe(n),Te("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
26
+ Component that was made reactive: `,n)),UE(n,e,t,r,i,a,o,!0)}function KE(n){return n?ia(n)||Dm(n)?Nt({},n):n:null}function ma(n,e,t=!1,r=!1){const{props:i,ref:o,patchFlag:a,children:u,transition:f}=n,h=e?JE(i||{},e):i,m={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Bm(h),ref:e&&e.ref?t&&o?Ae(o)?o.concat(pa(e)):[o,pa(e)]:pa(e):o,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Ae(u)?u.map(Hm):u,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==zm?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:f,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&ma(n.ssContent),ssFallback:n.ssFallback&&ma(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return f&&r&&Im(m,f.clone(m)),m}function Hm(n){const e=ma(n);return Ae(n.children)&&(e.children=n.children.map(Hm)),e}function GE(n=" ",e=0){return qE($E,null,n,e)}function Sc(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Ae(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Sc(n,i()),i._c&&(i._d=!0));return}else{t=32;const i=e._;!i&&!Dm(e)?e._ctx=vn:i===3&&vn&&(vn.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Pe(e)?(e={default:e,_ctx:vn},t=32):(e=String(e),r&64?(t=16,e=[GE(e)]):t=8);n.children=e,n.shapeFlag|=t}function JE(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=Qu([e.class,r.class]));else if(i==="style")e.style=Zu([e.style,r.style]);else if(p5(i)){const o=e[i],a=r[i];a&&o!==a&&!(Ae(o)&&o.includes(a))&&(e[i]=o?[].concat(o,a):a)}else i!==""&&(e[i]=r[i])}return e}let Ts=null;const jE=()=>Ts||vn;let xc;{const n=Xo(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),o=>{i.length>1?i.forEach(a=>a(o)):i[0](o)}};xc=e("__VUE_INSTANCE_SETTERS__",t=>Ts=t),e("__VUE_SSR_SETTERS__",t=>ga=t)}const YE=n=>{const e=Ts;return xc(n),n.scope.on(),()=>{n.scope.off(),xc(e)}};function XE(n){return n.vnode.shapeFlag&4}let ga=!1;process.env.NODE_ENV;function ZE(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(X5(G5(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in As)return As[t](n)},has(e,t){return t in e||t in As}})):n.proxy}const QE=/(?:^|[-_])(\w)/g,eC=n=>n.replace(QE,e=>e.toUpperCase()).replace(/[-_]/g,"");function Vm(n,e=!0){return Pe(n)?n.displayName||n.name:n.name||e&&n.__name}function Wm(n,e,t=!1){let r=Vm(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=o=>{for(const a in o)if(o[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?eC(r):t?"App":"Anonymous"}function Um(n){return Pe(n)&&"__vccOpts"in n}const me=(n,e)=>{const t=nE(n,e,ga);if(process.env.NODE_ENV!=="production"){const r=jE();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function tC(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(p){return dt(p)?p.__isVue?["div",n,"VueInstance"]:tt(p)?["div",{},["span",n,m(p)],"<",u("_value"in p?p._value:p),">"]:Si(p)?["div",{},["span",n,St(p)?"ShallowReactive":"Reactive"],"<",u(p),`>${Vn(p)?" (readonly)":""}`]:Vn(p)?["div",{},["span",n,St(p)?"ShallowReadonly":"Readonly"],"<",u(p),">"]:null:null},hasBody(p){return p&&p.__isVue},body(p){if(p&&p.__isVue)return["div",{},...o(p.$)]}};function o(p){const b=[];p.type.props&&p.props&&b.push(a("props",fe(p.props))),p.setupState!==Gt&&b.push(a("setup",p.setupState)),p.data!==Gt&&b.push(a("data",fe(p.data)));const S=f(p,"computed");S&&b.push(a("computed",S));const E=f(p,"inject");return E&&b.push(a("injected",E)),b.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:p}]]),b}function a(p,b){return b=Nt({},b),Object.keys(b).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},p],["div",{style:"padding-left:1.25em"},...Object.keys(b).map(S=>["div",{},["span",r,S+": "],u(b[S],!1)])]]:["span",{}]}function u(p,b=!0){return typeof p=="number"?["span",e,p]:typeof p=="string"?["span",t,JSON.stringify(p)]:typeof p=="boolean"?["span",r,p]:dt(p)?["object",{object:b?fe(p):p}]:["span",t,String(p)]}function f(p,b){const S=p.type;if(Pe(S))return;const E={};for(const g in p.ctx)h(S,g,b)&&(E[g]=p.ctx[g]);return E}function h(p,b,S){const E=p[S];if(Ae(E)&&E.includes(b)||dt(E)&&b in E||p.extends&&h(p.extends,b,S)||p.mixins&&p.mixins.some(g=>h(g,b,S)))return!0}function m(p){return St(p)?"ShallowRef":p.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;function nC(){tC()}process.env.NODE_ENV!=="production"&&nC();function nt(n){this.content=n}nt.prototype={constructor:nt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new nt(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new nt(t)},addToStart:function(n,e){return new nt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new nt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new nt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=nt.from(n),n.size?new nt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=nt.from(n),n.size?new nt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=nt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},get size(){return this.content.length>>1}},nt.from=function(n){if(n instanceof nt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new nt(e)};function qm(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let a=0;i.text[a]==o.text[a];a++)t++;return t}if(i.content.size||o.content.size){let a=qm(i.content,o.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function Km(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let a=n.child(--i),u=e.child(--o),f=a.nodeSize;if(a==u){t-=f,r-=f;continue}if(!a.sameMarkup(u))return{a:t,b:r};if(a.isText&&a.text!=u.text){let h=0,m=Math.min(a.text.length,u.text.length);for(;h<m&&a.text[a.text.length-h-1]==u.text[u.text.length-h-1];)h++,t--,r--;return{a:t,b:r}}if(a.content.size||u.content.size){let h=Km(a.content,u.content,t-1,r-1);if(h)return h}t-=f,r-=f}}class z{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let a=0,u=0;u<t;a++){let f=this.content[a],h=u+f.nodeSize;if(h>e&&r(f,i+u,o||null,a)!==!1&&f.content.size){let m=u+1;f.nodesBetween(Math.max(0,e-m),Math.min(f.content.size,t-m),r,i+m)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",a=!0;return this.nodesBetween(e,t,(u,f)=>{u.isText?(o+=u.text.slice(Math.max(e,f)-f,t-f),a=!r):u.isLeaf?(i?o+=typeof i=="function"?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new z(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,a=0;a<t;o++){let u=this.content[o],f=a+u.nodeSize;f>e&&((a<e||f>t)&&(u.isText?u=u.cut(Math.max(0,e-a),Math.min(u.text.length,t-a)):u=u.cut(Math.max(0,e-a-1),Math.min(u.content.size,t-a-1))),r.push(u),i+=u.nodeSize),a=f}return new z(r,i)}cutByIndex(e,t){return e==t?z.empty:e==0&&t==this.content.length?this:new z(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new z(i,o)}addToStart(e){return new z([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new z(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,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return qm(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Km(this,e,t,r)}findIndex(e,t=-1){if(e==0)return ya(0,e);if(e==this.size)return ya(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),a=i+o.nodeSize;if(a>=e)return a==e||t>0?ya(r+1,a):ya(r,i);i=a}}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 z.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new z(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return z.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new z(t||e,r)}static from(e){if(!e)return z.empty;if(e instanceof z)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new z([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}z.empty=new z([],0);const Ec={index:0,offset:0};function ya(n,e){return Ec.index=n,Ec.offset=e,Ec}function ba(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ba(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ba(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Ce=class sh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||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&&ba(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 r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return sh.none;if(e instanceof sh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Ce.none=[];class _a extends Error{}class K{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Jm(this.content,e+this.openStart,t);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,t){return new K(Gm(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 K.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new K(z.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function Gm(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:a,offset:u}=n.findIndex(t);if(i==e||o.isText){if(u!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(Gm(o.content,e-i-1,t-i-1)))}function Jm(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),a=n.maybeChild(i);if(o==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let u=Jm(a.content,e-o-1,t);return u&&n.replaceChild(i,a.copy(u))}function rC(n,e,t){if(t.openStart>n.depth)throw new _a("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new _a("Inconsistent open depths");return jm(n,e,t,0)}function jm(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=jm(n,e,t,r+1);return o.copy(o.content.replaceChild(i,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,u=a.content;return Vr(a,u.cut(0,n.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=iC(t,n);return Vr(o,Xm(n,a,u,e,r))}else return Vr(o,va(n,e,r))}function Ym(n,e){if(!e.type.compatibleContent(n.type))throw new _a("Cannot join "+e.type.name+" onto "+n.type.name)}function Cc(n,e,t){let r=n.node(t);return Ym(r,e.node(t)),r}function Hr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Os(n,e,t,r){let i=(e||n).node(t),o=0,a=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Hr(n.nodeAfter,r),o++));for(let u=o;u<a;u++)Hr(i.child(u),r);e&&e.depth==t&&e.textOffset&&Hr(e.nodeBefore,r)}function Vr(n,e){return n.type.checkContent(e),n.copy(e)}function Xm(n,e,t,r,i){let o=n.depth>i&&Cc(n,e,i+1),a=r.depth>i&&Cc(t,r,i+1),u=[];return Os(null,n,i,u),o&&a&&e.index(i)==t.index(i)?(Ym(o,a),Hr(Vr(o,Xm(n,e,t,r,i+1)),u)):(o&&Hr(Vr(o,va(n,e,i+1)),u),Os(e,t,i,u),a&&Hr(Vr(a,va(t,r,i+1)),u)),Os(r,null,i,u),new z(u)}function va(n,e,t){let r=[];if(Os(null,n,t,r),n.depth>t){let i=Cc(n,e,t+1);Hr(Vr(i,va(n,e,t+1)),r)}return Os(e,null,t,r),new z(r)}function iC(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(z.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ys{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ce.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let u=r;r=i,i=u}let o=r.marks;for(var a=0;a<o.length;a++)o[a].type.spec.inclusive===!1&&(!i||!o[a].isInSet(i.marks))&&(o=o[a--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new wa(this,e,r);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 r=[],i=0,o=t;for(let a=e;;){let{index:u,offset:f}=a.content.findIndex(o),h=o-f;if(r.push(a,u,i+f),!h||(a=a.child(u),a.isText))break;o=h-1,i+=f+1}return new Ys(t,r,o)}static resolveCached(e,t){for(let i=0;i<kc.length;i++){let o=kc[i];if(o.pos==t&&o.doc==e)return o}let r=kc[Ac]=Ys.resolve(e,t);return Ac=(Ac+1)%sC,r}}let kc=[],Ac=0,sC=12;class wa{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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 oC=Object.create(null);let Wr=class oh{constructor(e,t,r,i=Ce.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||z.empty}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,r,i=0){this.content.nodesBetween(e,t,r,i,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,r,i){return this.content.textBetween(e,t,r,i)}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,r){return this.type==e&&ba(this.attrs,t||e.defaultAttrs||oC)&&Ce.sameSet(this.marks,r||Ce.none)}copy(e=null){return e==this.content?this:new oh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new oh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return K.empty;let i=this.resolve(e),o=this.resolve(t),a=r?0:i.sharedDepth(t),u=i.start(a),h=i.node(a).content.cut(i.pos-u,o.pos-u);return new K(h,i.depth-a,o.depth-a)}replace(e,t,r){return rC(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return Ys.resolveCached(this,e)}resolveNoCache(e){return Ys.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}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()+")"),Zm(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,r=z.empty,i=0,o=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let f=i;f<o;f++)if(!this.type.allowsMarks(r.child(f).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),a=o&&o.matchFragment(this.content,t);return a?a.validEnd:!1}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);let e=Ce.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!Ce.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=z.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Wr.prototype.text=void 0;class wl extends Wr{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Zm(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 wl(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new wl(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 Zm(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class ni{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new aC(e,t);if(r.next==null)return ni.empty;let i=Qm(r);r.next&&r.err("Unexpected trailing text");let o=pC(dC(i));return mC(o,r),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,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(a,u){let f=a.matchFragment(e,r);if(f&&(!t||f.validEnd))return z.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:m,next:p}=a.next[h];if(!(m.isText||m.hasRequiredAttrs())&&i.indexOf(p)==-1){i.push(p);let b=o(p,u.concat(m));if(b)return b}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let a=0;a<o.next.length;a++){let{type:u,next:f}=o.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!i.type||f.validEnd)&&(r.push({match:u.contentMatch,type:u,via:i}),t[u.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=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)o+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return o}).join(`
27
+ `)}}ni.empty=new ni(!0);class aC{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 Qm(n){let e=[];do e.push(lC(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function lC(n){let e=[];do e.push(uC(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function uC(n){let e=hC(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=cC(n,e);else break;return e}function eg(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function cC(n,e){let t=eg(n),r=t;return n.eat(",")&&(n.next!="}"?r=eg(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function fC(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let a=t[o];a.groups.indexOf(e)>-1&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function hC(n){if(n.eat("(")){let e=Qm(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=fC(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function dC(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(a,u,f){let h={term:f,to:u};return e[a].push(h),h}function i(a,u){a.forEach(f=>f.to=u)}function o(a,u){if(a.type=="choice")return a.exprs.reduce((f,h)=>f.concat(o(h,u)),[]);if(a.type=="seq")for(let f=0;;f++){let h=o(a.exprs[f],u);if(f==a.exprs.length-1)return h;i(h,u=t())}else if(a.type=="star"){let f=t();return r(u,f),i(o(a.expr,f),f),[r(f)]}else if(a.type=="plus"){let f=t();return i(o(a.expr,u),f),i(o(a.expr,f),f),[r(f)]}else{if(a.type=="opt")return[r(u)].concat(o(a.expr,u));if(a.type=="range"){let f=u;for(let h=0;h<a.min;h++){let m=t();i(o(a.expr,f),m),f=m}if(a.max==-1)i(o(a.expr,f),f);else for(let h=a.min;h<a.max;h++){let m=t();r(f,m),i(o(a.expr,f),m),f=m}return[r(f)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function tg(n,e){return e-n}function ng(n,e){let t=[];return r(e),t.sort(tg);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let a=0;a<o.length;a++){let{term:u,to:f}=o[a];!u&&t.indexOf(f)==-1&&r(f)}}}function pC(n){let e=Object.create(null);return t(ng(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:u,to:f})=>{if(!u)return;let h;for(let m=0;m<i.length;m++)i[m][0]==u&&(h=i[m][1]);ng(n,f).forEach(m=>{h||i.push([u,h=[]]),h.indexOf(m)==-1&&h.push(m)})})});let o=e[r.join(",")]=new ni(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(tg);o.next.push({type:i[a][0],next:e[u.join(",")]||t(u)})}return o}}function mC(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:f,next:h}=i.next[u];a.push(f.name),o&&!(f.isText||f.hasRequiredAttrs())&&(o=!1),r.indexOf(h)==-1&&r.push(h)}o&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function rg(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function ig(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function sg(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new gC(n[t]);return e}let og=class my{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=sg(r.attrs),this.defaultAttrs=rg(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ni.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:ig(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wr(this,this.computeAttrs(e),z.from(t),Ce.setFrom(r))}createChecked(e=null,t,r){return t=z.from(t),this.checkContent(t),new Wr(this,this.computeAttrs(e),t,Ce.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=z.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(z.empty,!0);return o?new Wr(this,e,t.append(o),Ce.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Ce.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,a)=>r[o]=new my(o,t,a));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class gC{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Sl{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=sg(i.attrs),this.excluded=null;let o=rg(this.attrs);this.instance=o?new Ce(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ce(this,ig(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,a)=>r[o]=new Sl(o,i++,t,a)),r}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class yC{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=nt.from(e.nodes),t.marks=nt.from(e.marks||{}),this.nodes=og.compile(this.spec.nodes,this),this.marks=Sl.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],a=o.spec.content||"",u=o.spec.marks;o.contentMatch=r[a]||(r[a]=ni.parse(a,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=u=="_"?null:u?ag(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],a=o.spec.excludes;o.excluded=a==null?[o]:a==""?[]:ag(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof og){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new wl(r,r.defaultAttrs,e,Ce.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Wr.fromJSON(this,e)}markFromJSON(e){return Ce.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ag(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],a=o;if(o)t.push(o);else for(let u in n.marks){let f=n.marks[u];(i=="_"||f.spec.group&&f.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=f)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}let Mc=class ah{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new fg(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new fg(this,t,!0);return r.addAll(e,t.from,t.to),K.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(vC(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(e);if(a===!1)continue;o.attrs=a||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(u.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=t))){if(a.getAttrs){let f=a.getAttrs(t);if(f===!1)continue;a.attrs=f||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let u=t[a];if((u.priority==null?50:u.priority)<o)break}t.splice(a,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(a=>{r(a=hg(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(a=>{r(a=hg(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ah(e,ah.schemaRules(e)))}};const lg={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},bC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ug={ol:!0,ul:!0},Sa=1,xa=2,Is=4;function cg(n,e,t){return e!=null?(e?Sa:0)|(e==="full"?xa:0):n&&n.whitespace=="pre"?Sa|xa:t&~Is}class Ea{constructor(e,t,r,i,o,a,u){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=u,this.content=[],this.activeMarks=Ce.none,this.stashMarks=[],this.match=a||(u&Is?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(z.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Sa)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=z.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(z.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):SC(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lg.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class fg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,a=cg(null,t.preserveWhitespace,0)|(r?Is:0);i?o=new Ea(i.type,i.attrs,Ce.none,Ce.none,!0,t.topMatch||i.type.contentMatch,a):r?o=new Ea(null,null,Ce.none,Ce.none,!0,null,a):o=new Ea(e.schema.topNodeType,null,Ce.none,Ce.none,!0,null,a),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){if(e.nodeType==3)this.addTextNode(e);else if(e.nodeType==1){let t=e.getAttribute("style");if(!t)this.addElement(e);else{let r=this.readStyles(wC(t));if(!r)return;let[i,o]=r,a=this.top;for(let u=0;u<o.length;u++)this.removePendingMark(o[u],a);for(let u=0;u<i.length;u++)this.addPendingMark(i[u]);this.addElement(e);for(let u=0;u<i.length;u++)this.removePendingMark(i[u],a);for(let u=0;u<o.length;u++)this.addPendingMark(o[u])}}}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&xa||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Sa)r.options&xa?t=t.replace(/\r\n?/g,`
28
+ `):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=e.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;ug.hasOwnProperty(r)&&this.parser.normalizeLists&&_C(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(o?o.ignore:bC.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let a,u=this.top,f=this.needsBlock;if(lg.hasOwnProperty(r))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),a=!0,u.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}this.addAll(e),a&&this.sync(u),this.needsBlock=f}else this.addElementByRule(e,o,o.consuming===!1?i:void 0)}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
29
+ `))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=Ce.none,r=Ce.none;e:for(let i=0;i<e.length;i+=2)for(let o=void 0;;){let a=this.parser.matchStyle(e[i],e[i+1],this,o);if(!a)continue e;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.forEach(u=>{a.clearMark(u)&&(r=u.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)o=a;else break}return[t,r]}addElementByRule(e,t,r){let i,o,a;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):i=this.enter(o,t.attrs||null,t.preserveWhitespace)):(a=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(a));let u=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(f=>this.insertNode(f));else{let f=e;typeof t.contentElement=="string"?f=e.querySelector(t.contentElement):typeof t.contentElement=="function"?f=t.contentElement(e):t.contentElement&&(f=t.contentElement),this.findAround(e,f,!0),this.addAll(f)}i&&this.sync(u)&&this.open--,a&&this.removePendingMark(a,u)}addAll(e,t,r){let i=t||0;for(let o=t?e.childNodes[t]:e.firstChild,a=r==null?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],a=o.findWrapping(e);if(a&&(!t||t.length>a.length)&&(t=a,r=o,!a.length)||o.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let a=cg(e,i,o.options);o.options&Is&&o.content.length==0&&(a|=Is),this.nodes.push(new Ea(e,t,o.activeMarks,o.pendingMarks,r,null,a)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(u,f)=>{for(;u>=0;u--){let h=t[u];if(h==""){if(u==t.length-1||u==0)continue;for(;f>=o;f--)if(a(u-1,f))return!0;return!1}else{let m=f>0||f==0&&i?this.nodes[f].type:r&&f>=o?r.node(f-o).type:null;if(!m||m.name!=h&&m.groups.indexOf(h)==-1)return!1;f--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=xC(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let a=i.popFromStashMark(e);a&&i.type&&i.type.allowsMarkType(a.type)&&(i.activeMarks=a.addToSet(i.activeMarks))}if(i==t)break}}}function _C(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ug.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function vC(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function wC(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function hg(n){let e={};for(let t in n)e[t]=n[t];return e}function SC(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],a=u=>{o.push(u);for(let f=0;f<u.edgeCount;f++){let{type:h,next:m}=u.edge(f);if(h==e||o.indexOf(m)<0&&a(m))return!0}};if(a(i.contentMatch))return!0}}function xC(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class ii{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Tc(t).createDocumentFragment());let i=r,o=[];return e.forEach(a=>{if(o.length||a.marks.length){let u=0,f=0;for(;u<o.length&&f<a.marks.length;){let h=a.marks[f];if(!this.marks[h.type.name]){f++;continue}if(!h.eq(o[u][0])||h.type.spec.spanning===!1)break;u++,f++}for(;u<o.length;)i=o.pop()[1];for(;f<a.marks.length;){let h=a.marks[f++],m=this.serializeMark(h,a.isInline,t);m&&(o.push([h,i]),i.appendChild(m.dom),i=m.contentDOM||m.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=ii.renderSpec(Tc(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&ii.renderSpec(Tc(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let a,u=r?e.createElementNS(r,i):e.createElement(i),f=t[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let p=m.indexOf(" ");p>0?u.setAttributeNS(m.slice(0,p),m.slice(p+1),f[m]):u.setAttribute(m,f[m])}}for(let m=h;m<t.length;m++){let p=t[m];if(p===0){if(m<t.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:S}=ii.renderSpec(e,p,r);if(u.appendChild(b),S){if(a)throw new RangeError("Multiple content holes");a=S}}}return{dom:u,contentDOM:a}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ii(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dg(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return dg(e.marks)}}function dg(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Tc(n){return n.document||window.document}const pg=65535,mg=Math.pow(2,16);function EC(n,e){return n+e*mg}function gg(n){return n&pg}function CC(n){return(n-(n&pg))/mg}const yg=1,bg=2,Ca=4,_g=8;class Oc{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&_g)>0}get deletedBefore(){return(this.delInfo&(yg|Ca))>0}get deletedAfter(){return(this.delInfo&(bg|Ca))>0}get deletedAcross(){return(this.delInfo&Ca)>0}}class Qt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Qt.empty)return Qt.empty}recover(e){let t=0,r=gg(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+CC(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?i:0);if(f>e)break;let h=this.ranges[u+o],m=this.ranges[u+a],p=f+h;if(e<=p){let b=h?e==f?-1:e==p?1:t:t,S=f+i+(b<0?0:m);if(r)return S;let E=e==(t<0?f:p)?null:EC(u/3,e-f),g=e==f?bg:e==p?yg:Ca;return(t<0?e!=f:e!=p)&&(g|=_g),new Oc(S,g,E)}i+=m-h}return r?e+i:new Oc(e+i,0,null)}touches(e,t){let r=0,i=gg(t),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let f=this.ranges[u]-(this.inverted?r:0);if(f>e)break;let h=this.ranges[u+o],m=f+h;if(e<=m&&u==i*3)return!0;r+=this.ranges[u+a]-h}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),f=a+(this.inverted?0:o),h=this.ranges[i+t],m=this.ranges[i+r];e(u,u+h,f,f+m),o+=m-h}}invert(){return new Qt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qt.empty:new Qt(e<0?[0,-e,0]:[0,0,e])}}Qt.empty=new Qt([]);class Ji{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new Ji(this.maps,this.mirror,e,t)}copy(){return new Ji(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i: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,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new Ji;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o],u=a.mapResult(e,t);if(u.recover!=null){let f=this.getMirror(o);if(f!=null&&f>o&&f<this.to){o=f,e=this.maps[f].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Oc(e,i,null)}}const Ic=Object.create(null);class lt{getMap(){return Qt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ic[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Ic)throw new RangeError("Duplicate use of step JSON ID "+e);return Ic[e]=t,t.prototype.jsonID=e,t}}class Fe{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,t,r,i){try{return Fe.ok(e.replace(t,r,i))}catch(o){if(o instanceof _a)return Fe.fail(o.message);throw o}}}function Nc(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(Nc(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return z.fromArray(r)}class kr extends lt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new K(Nc(t.content,(a,u)=>!a.isAtom||!u.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),i),t.openStart,t.openEnd);return Fe.fromReplace(e,this.from,this.to,o)}invert(){return new An(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kr(t.pos,r.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}lt.jsonID("addMark",kr);class An extends lt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new K(Nc(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new An(t.pos,r.pos,this.mark)}merge(e){return e instanceof An&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new An(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new An(t.from,t.to,e.markFromJSON(t.mark))}}lt.jsonID("removeMark",An);class Ar extends lt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Ar(this.pos,t.marks[i]);return new Ar(this.pos,this.mark)}}return new ji(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ar(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ar(t.pos,e.markFromJSON(t.mark))}}lt.jsonID("addNodeMark",Ar);class ji extends lt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new K(z.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ar(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ji(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ji(t.pos,e.markFromJSON(t.mark))}}lt.jsonID("removeNodeMark",ji);class ut extends lt{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Rc(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ut(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new ut(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof ut)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?K.empty:new K(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ut(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?K.empty:new K(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ut(e.from,this.to,t,this.structure)}else return null}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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ut(t.from,t.to,K.fromJSON(e,t.slice),!!t.structure)}}lt.jsonID("replace",ut);class Xe extends lt{constructor(e,t,r,i,o,a,u=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Rc(e,this.from,this.gapFrom)||Rc(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new Qt([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 Xe(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),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Xe(t.pos,r.pos,i,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xe(t.from,t.to,t.gapFrom,t.gapTo,K.fromJSON(e,t.slice),t.insert,!!t.structure)}}lt.jsonID("replaceAround",Xe);function Rc(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let a=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function kC(n,e,t,r){let i=[],o=[],a,u;n.doc.nodesBetween(e,t,(f,h,m)=>{if(!f.isInline)return;let p=f.marks;if(!r.isInSet(p)&&m.type.allowsMarkType(r.type)){let b=Math.max(h,e),S=Math.min(h+f.nodeSize,t),E=r.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(E)||(a&&a.to==b&&a.mark.eq(p[g])?a.to=S:i.push(a=new An(b,S,p[g])));u&&u.to==b?u.to=S:o.push(u=new kr(b,S,r))}}),i.forEach(f=>n.step(f)),o.forEach(f=>n.step(f))}function AC(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(a,u)=>{if(!a.isInline)return;o++;let f=null;if(r instanceof Sl){let h=a.marks,m;for(;m=r.isInSet(h);)(f||(f=[])).push(m),h=m.removeFromSet(h)}else r?r.isInSet(a.marks)&&(f=[r]):f=a.marks;if(f&&f.length){let h=Math.min(u+a.nodeSize,t);for(let m=0;m<f.length;m++){let p=f[m],b;for(let S=0;S<i.length;S++){let E=i[S];E.step==o-1&&p.eq(i[S].style)&&(b=E)}b?(b.to=h,b.step=o):i.push({style:p,from:Math.max(u,e),to:h,step:o})}}}),i.forEach(a=>n.step(new An(a.from,a.to,a.style)))}function MC(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let u=0;u<i.childCount;u++){let f=i.child(u),h=a+f.nodeSize,m=r.matchType(f.type);if(!m)o.push(new ut(a,h,K.empty));else{r=m;for(let p=0;p<f.marks.length;p++)t.allowsMarkType(f.marks[p].type)||n.step(new An(a,h,f.marks[p]))}a=h}if(!r.validEnd){let u=r.fillBefore(z.empty,!0);n.replace(a,a,new K(u,0,0))}for(let u=o.length-1;u>=0;u--)n.step(o[u])}function TC(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Mi(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,a,t))return r;if(r==0||i.type.spec.isolating||!TC(i,o,a))break}return null}function OC(n,e,t){let{$from:r,$to:i,depth:o}=e,a=r.before(o+1),u=i.after(o+1),f=a,h=u,m=z.empty,p=0;for(let E=o,g=!1;E>t;E--)g||r.index(E)>0?(g=!0,m=z.from(r.node(E).copy(m)),p++):f--;let b=z.empty,S=0;for(let E=o,g=!1;E>t;E--)g||i.after(E+1)<i.end(E)?(g=!0,b=z.from(i.node(E).copy(b)),S++):h++;n.step(new Xe(f,h,a,u,new K(m.append(b),p,S),m.size-p,!0))}function Lc(n,e,t=null,r=n){let i=IC(n,e),o=i&&NC(r,e);return o?i.map(vg).concat({type:e,attrs:t}).concat(o.map(vg)):null}function vg(n){return{type:n,attrs:null}}function IC(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let a=o.length?o[0]:e;return t.canReplaceWith(r,i,a)?o:null}function NC(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),a=e.contentMatch.findWrapping(o.type);if(!a)return null;let f=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;f&&h<i;h++)f=f.matchType(t.child(h).type);return!f||!f.validEnd?null:a}function RC(n,e,t){let r=z.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let u=t[a].type.contentMatch.matchFragment(r);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=z.from(t[a].type.create(t[a].attrs,r))}let i=e.start,o=e.end;n.step(new Xe(i,o,i,o,new K(r,0,0),t.length,!0))}function LC(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(a,u)=>{if(a.isTextblock&&!a.hasMarkup(r,i)&&PC(n.doc,n.mapping.slice(o).map(u),r)){n.clearIncompatible(n.mapping.slice(o).map(u,1),r);let f=n.mapping.slice(o),h=f.map(u,1),m=f.map(u+a.nodeSize,1);return n.step(new Xe(h,m,h+1,m-1,new K(z.from(r.create(i,null,a.marks)),0,0),1,!0)),!1}})}function PC(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function DC(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let a=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,a);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Xe(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new K(z.from(a),0,0),1,!0))}function Ti(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let h=i.depth-1,m=t-2;h>o;h--,m--){let p=i.node(h),b=i.index(h);if(p.type.spec.isolating)return!1;let S=p.content.cutByIndex(b,p.childCount),E=r&&r[m]||p;if(E!=p&&(S=S.replaceChild(0,E.type.create(E.attrs))),!p.canReplace(b+1,p.childCount)||!E.type.validContent(S))return!1}let u=i.indexAfter(o),f=r&&r[0];return i.node(o).canReplaceWith(u,u,f?f.type:i.node(o+1).type)}function FC(n,e,t=1,r){let i=n.doc.resolve(e),o=z.empty,a=z.empty;for(let u=i.depth,f=i.depth-t,h=t-1;u>f;u--,h--){o=z.from(i.node(u).copy(o));let m=r&&r[h];a=z.from(m?m.type.create(m.attrs,a):i.node(u).copy(a))}n.step(new ut(e,e,new K(o.append(a),t,t),!0))}function pr(n,e){let t=n.resolve(e),r=t.index();return wg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function wg(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function ka(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,a,u=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):t>0?(o=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(o=r.node(i).maybeChild(u-1),a=r.node(i+1)),o&&!o.isTextblock&&wg(o,a)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function zC(n,e,t){let r=new ut(e-t,e+t,K.empty,!0);n.step(r)}function BC(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function $C(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let a=r.depth;a>=0;a--){let u=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,f=r.index(a)+(u>0?1:0),h=r.node(a),m=!1;if(o==1)m=h.canReplace(f,f,i);else{let p=h.contentMatchAt(f).findWrapping(i.firstChild.type);m=p&&h.canReplaceWith(f,f,p[0])}if(m)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function Pc(n,e,t=e,r=K.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return Sg(i,o,r)?new ut(e,t,r):new HC(i,o,r).fit()}function Sg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class HC{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=z.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=z.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,a=r.depth,u=i.depth;for(;a&&u&&o.childCount==1;)o=o.firstChild.content,a--,u--;let f=new K(o,a,u);return e>-1?new Xe(r.pos,e,this.$to.pos,this.$to.end(),f,t):f.size||r.pos!=this.$to.pos?new ut(r.pos,i.pos,f):null}findFittable(){for(let e=1;e<=2;e++)for(let t=this.unplaced.openStart;t>=0;t--){let r,i=null;t?(i=Dc(this.unplaced.content,t-1).firstChild,r=i.content):r=this.unplaced.content;let o=r.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:f}=this.frontier[a],h,m=null;if(e==1&&(o?f.matchType(o.type)||(m=f.fillBefore(z.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:t,frontierDepth:a,parent:i,inject:m};if(e==2&&o&&(h=f.findWrapping(o.type)))return{sliceDepth:t,frontierDepth:a,parent:i,wrap:h};if(i&&f.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Dc(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new K(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Dc(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new K(Ns(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new K(Ns(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let g=0;g<o.length;g++)this.openFrontierNode(o[g]);let a=this.unplaced,u=r?r.content:a.content,f=a.openStart-e,h=0,m=[],{match:p,type:b}=this.frontier[t];if(i){for(let g=0;g<i.childCount;g++)m.push(i.child(g));p=p.matchFragment(i)}let S=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let g=u.child(h),_=p.matchType(g.type);if(!_)break;h++,(h>1||f==0||g.content.size)&&(p=_,m.push(xg(g.mark(b.allowedMarks(g.marks)),h==1?f:0,h==u.childCount?S:-1)))}let E=h==u.childCount;E||(S=-1),this.placed=Rs(this.placed,t,z.from(m)),this.frontier[t].match=p,E&&S<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,_=u;g<S;g++){let x=_.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),_=x.content}this.unplaced=E?e==0?K.empty:new K(Ns(a.content,e-1,1),e-1,S<0?a.openEnd:e-1):new K(Ns(a.content,e,h),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Fc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Fc(e,t,i,r,o);if(a){for(let u=t-1;u>=0;u--){let{match:f,type:h}=this.frontier[u],m=Fc(e,u,h,f,!0);if(!m||m.childCount)continue e}return{depth:t,fit:a,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=Rs(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Rs(this.placed,this.depth,z.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(z.empty,!0);t.childCount&&(this.placed=Rs(this.placed,this.frontier.length,t))}}function Ns(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ns(n.firstChild.content,e-1,t)))}function Rs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Rs(n.lastChild.content,e-1,t)))}function Dc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function xg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,xg(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(z.empty,!0)))),n.copy(r)}function Fc(n,e,t,r,i){let o=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==o.childCount&&!t.compatibleContent(o.type))return null;let u=r.fillBefore(o.content,!0,a);return u&&!VC(t,o.content,a)?u:null}function VC(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function WC(n){return n.spec.defining||n.spec.definingForContent}function UC(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(Sg(i,o,r))return n.step(new ut(e,t,r));let a=Cg(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let b=i.depth,S=i.pos-1;b>0;b--,S--){let E=i.node(b).type.spec;if(E.defining||E.definingAsContext||E.isolating)break;a.indexOf(b)>-1?u=b:i.before(b)==S&&a.splice(1,0,-b)}let f=a.indexOf(u),h=[],m=r.openStart;for(let b=r.content,S=0;;S++){let E=b.firstChild;if(h.push(E),S==r.openStart)break;b=E.content}for(let b=m-1;b>=0;b--){let S=h[b].type,E=WC(S);if(E&&i.node(f).type!=S)m=b;else if(E||!S.isTextblock)break}for(let b=r.openStart;b>=0;b--){let S=(b+m+1)%(r.openStart+1),E=h[S];if(E)for(let g=0;g<a.length;g++){let _=a[(g+f)%a.length],x=!0;_<0&&(x=!1,_=-_);let k=i.node(_-1),A=i.index(_-1);if(k.canReplaceWith(A,A,E.type,E.marks))return n.replace(i.before(_),x?o.after(_):t,new K(Eg(r.content,0,r.openStart,S),S,r.openEnd))}}let p=n.steps.length;for(let b=a.length-1;b>=0&&(n.replace(e,t,r),!(n.steps.length>p));b--){let S=a[b];S<0||(e=i.before(S),t=o.after(S))}}function Eg(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(Eg(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),a=o.fillBefore(n).append(n);n=a.append(o.matchFragment(a).fillBefore(z.empty,!0))}return n}function qC(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=BC(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new K(z.from(r),0,0))}function KC(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=Cg(r,i);for(let a=0;a<o.length;a++){let u=o[a],f=a==o.length-1;if(f&&u==0||r.node(u).type.contentMatch.validEnd)return n.delete(r.start(u),i.end(u));if(u>0&&(f||r.node(u-1).canReplace(r.index(u-1),i.indexAfter(u-1))))return n.delete(r.before(u),i.after(u))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&i.end(a)-t!=i.depth-a)return n.delete(r.before(a),t);n.delete(e,t)}function Cg(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class Yi extends lt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Fe.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Fe.fromReplace(e,this.pos,this.pos+1,new K(z.from(i),0,t.isLeaf?0:1))}getMap(){return Qt.empty}invert(e){return new Yi(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 Yi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Yi(t.pos,t.attr,t.value)}}lt.jsonID("attr",Yi);let Oi=class extends Error{};Oi=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Oi.prototype=Object.create(Error.prototype),Oi.prototype.constructor=Oi,Oi.prototype.name="TransformError";class GC{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ji}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Oi(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}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=K.empty){let i=Pc(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new K(z.from(r),0,0))}delete(e,t){return this.replace(e,t,K.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return UC(this,e,t,r),this}replaceRangeWith(e,t,r){return qC(this,e,t,r),this}deleteRange(e,t){return KC(this,e,t),this}lift(e,t){return OC(this,e,t),this}join(e,t=1){return zC(this,e,t),this}wrap(e,t){return RC(this,e,t),this}setBlockType(e,t=e,r,i=null){return LC(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i=[]){return DC(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Yi(e,t,r)),this}addNodeMark(e,t){return this.step(new Ar(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Ce)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new ji(e,t)),this}split(e,t=1,r){return FC(this,e,t,r),this}addMark(e,t,r){return kC(this,e,t,r),this}removeMark(e,t,r){return AC(this,e,t,r),this}clearIncompatible(e,t,r){return MC(this,e,t,r),this}}const zc=Object.create(null);class ge{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new JC(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=K.empty){let r=t.content.lastChild,i=null;for(let u=0;u<t.openEnd;u++)i=r,r=r.lastChild;let o=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:f,$to:h}=a[u],m=e.mapping.slice(o);e.replaceRange(m.map(f.pos),m.map(h.pos),u?K.empty:t),u==0&&Mg(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],f=e.mapping.slice(r),h=f.map(a.pos),m=f.map(u.pos);o?e.deleteRange(h,m):(e.replaceRangeWith(h,m,t),Mg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new ye(e):Ii(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let a=t<0?Ii(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):Ii(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new mn(e.node(0))}static atStart(e){return Ii(e,e,0,0,1)||new mn(e)}static atEnd(e){return Ii(e,e,e.content.size,e.childCount,-1)||new mn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=zc[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in zc)throw new RangeError("Duplicate use of selection JSON ID "+e);return zc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ye.between(this.$anchor,this.$head).getBookmark()}}ge.prototype.visible=!0;class JC{constructor(e,t){this.$from=e,this.$to=t}}let kg=!1;function Ag(n){!kg&&!n.parent.inlineContent&&(kg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ye extends ge{constructor(e,t=e){Ag(e),Ag(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return ge.near(r);let i=e.resolve(t.map(this.anchor));return new ye(i.parent.inlineContent?i:r,r)}replace(e,t=K.empty){if(super.replace(e,t),t==K.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ye&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new xl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ye(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=ge.findFrom(t,r,!0)||ge.findFrom(t,-r,!0);if(o)t=o.$head;else return ge.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(ge.findFrom(e,-r,!0)||ge.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new ye(e,t)}}ge.jsonID("text",ye);class xl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new xl(e.map(this.anchor),e.map(this.head))}resolve(e){return ye.between(e.resolve(this.anchor),e.resolve(this.head))}}class ee extends ge{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?ge.near(o):new ee(o)}content(){return new K(z.from(this.node),0,0)}eq(e){return e instanceof ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ee(e.resolve(t.anchor))}static create(e,t){return new ee(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ee.prototype.visible=!1,ge.jsonID("node",ee);class lh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new xl(r,r):new lh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ee.isSelectable(r)?new ee(t):ge.near(t)}}class mn extends ge{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=K.empty){if(t==K.empty){e.delete(0,e.doc.content.size);let r=ge.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new mn(e)}map(e){return new mn(e)}eq(e){return e instanceof mn}getBookmark(){return jC}}ge.jsonID("all",mn);const jC={map(){return this},resolve(n){return new mn(n)}};function Ii(n,e,t,r,i,o=!1){if(e.inlineContent)return ye.create(n,t);for(let a=r-(i>0?0:1);i>0?a<e.childCount:a>=0;a+=i){let u=e.child(a);if(u.isAtom){if(!o&&ee.isSelectable(u))return ee.create(n,t-(i<0?u.nodeSize:0))}else{let f=Ii(n,u,t+i,i<0?u.childCount:0,i,o);if(f)return f}t+=u.nodeSize*i}return null}function Mg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof ut||i instanceof Xe))return;let o=n.mapping.maps[r],a;o.forEach((u,f,h,m)=>{a==null&&(a=m)}),n.setSelection(ge.near(n.doc.resolve(a),t))}function Tg(n,e){return!e||!n?n:n.bind(e)}class Aa{constructor(e,t,r){this.name=e,this.init=Tg(t.init,r),this.apply=Tg(t.apply,r)}}new Aa("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Aa("selection",{init(n,e){return n.selection||ge.atStart(e.doc)},apply(n){return n.selection}}),new Aa("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Aa("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function Og(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Og(i,e,{})),t[r]=i}return t}class Rt{constructor(e){this.spec=e,this.props={},e.props&&Og(e.props,this,this.props),this.key=e.key?e.key.key:Ig("plugin")}getState(e){return e[this.key]}}const Bc=Object.create(null);function Ig(n){return n in Bc?n+"$"+ ++Bc[n]:(Bc[n]=0,n+"$")}class fn{constructor(e="key"){this.key=Ig(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ls=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ng=function(n,e,t,r){return t&&(Rg(n,e,t,r,-1)||Rg(n,e,t,r,1))},YC=/^(img|br|input|textarea|hr)$/i;function Rg(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ma(n))){let o=n.parentNode;if(!o||o.nodeType!=1||ZC(n)||YC.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ls(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Ma(n):0}else return!1}}function Ma(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function XC(n,e,t){for(let r=e==0,i=e==Ma(n);r||i;){if(n==t)return!0;let o=Ls(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Ma(n)}}function ZC(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Lg=function(n){return n.focusNode&&Ng(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Pg(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const mr=typeof navigator<"u"?navigator:null,Dg=typeof document<"u"?document:null,gr=mr&&mr.userAgent||"",$c=/Edge\/(\d+)/.exec(gr),Fg=/MSIE \d/.exec(gr),Hc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(gr),Ps=!!(Fg||Hc||$c),zg=Fg?document.documentMode:Hc?+Hc[1]:$c?+$c[1]:0,Ta=!Ps&&/gecko\/(\d+)/i.test(gr);Ta&&+(/Firefox\/(\d+)/.exec(gr)||[0,0])[1];const Vc=!Ps&&/Chrome\/(\d+)/.exec(gr),Ni=!!Vc,QC=Vc?+Vc[1]:0,Ur=!Ps&&!!mr&&/Apple Computer/.test(mr.vendor),Wc=Ur&&(/Mobile\/\w+/.test(gr)||!!mr&&mr.maxTouchPoints>2),jt=Wc||(mr?/Mac/.test(mr.platform):!1),Ds=/Android \d/.test(gr),Uc=!!Dg&&"webkitFontSmoothing"in Dg.documentElement.style,ek=Uc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tk(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),o=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let u=r.resolve(a),f,h;if(Lg(t)){for(f=u;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&ee.isSelectable(m)&&i.parent&&!(m.isInline&&XC(t.focusNode,t.focusOffset,i.dom))){let p=i.posBefore;h=new ee(a==p?u:r.resolve(p))}}else{let m=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(m<0)return null;f=r.resolve(m)}if(!h){let m=e=="pointer"||n.state.selection.head<u.pos&&!o?1:-1;h=Ug(n,f,u,m)}return h}function Bg(n){return n.editable?n.hasFocus():sk(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function qc(n,e=!1){let t=n.state.selection;if(ik(n,t),!!Bg(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ni){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ng(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)rk(n);else{let{anchor:r,head:i}=t,o,a;$g&&!(t instanceof ye)&&(t.$from.parent.inlineContent||(o=Hg(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=Hg(n,t.to))),n.docView.setSelection(r,i,n.root,e),$g&&(o&&Vg(o),a&&Vg(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nk(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const $g=Ur||Ni&&QC<63;function Hg(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,o=r?t.childNodes[r-1]:null;if(Ur&&i&&i.contentEditable=="false")return Kc(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Kc(i);if(o)return Kc(o)}}function Kc(n){return n.contentEditable="true",Ur&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Vg(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function nk(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Bg(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function rk(n){let e=n.domSelection(),t=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setEnd(r.parentNode,Ls(r)+1):t.setEnd(r,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Ps&&zg<=11&&(r.disabled=!0,r.disabled=!1)}function ik(n,e){if(e instanceof ee){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Wg(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Wg(n)}function Wg(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ug(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||ye.between(e,t,r)}function sk(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Gc(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ge.findFrom(o,e)}function qr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function qg(n,e,t){let r=n.state.selection;if(r instanceof ye){if(!r.empty||t.indexOf("s")>-1)return!1;if(n.endOfTextblock(e>0?"right":"left")){let i=Gc(n.state,e);return i&&i instanceof ee?qr(n,i):!1}else if(!(jt&&t.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!o||o.isText)return!1;let u=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(a=n.docView.descAt(u))&&!a.contentDOM?ee.isSelectable(o)?qr(n,new ee(e<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Uc?qr(n,new ye(n.state.doc.resolve(e<0?u:u+o.nodeSize))):!1:!1}}else{if(r instanceof ee&&r.node.isInline)return qr(n,new ye(e>0?r.$to:r.$from));{let i=Gc(n.state,e);return i?qr(n,i):!1}}}function Oa(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Fs(n){let e=n.pmViewDesc;return e&&e.size==0&&(n.nextSibling||n.nodeName!="BR")}function Jc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,o,a=!1;for(Ta&&t.nodeType==1&&r<Oa(t)&&Fs(t.childNodes[r])&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let u=t.childNodes[r-1];if(Fs(u))i=t,o=--r;else if(u.nodeType==3)t=u,r=t.nodeValue.length;else break}}else{if(Kg(t))break;{let u=t.previousSibling;for(;u&&Fs(u);)i=t.parentNode,o=Ls(u),u=u.previousSibling;if(u)t=u,r=Oa(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?Yc(n,t,r):i&&Yc(n,i,o)}function jc(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Oa(t),o,a;for(;;)if(r<i){if(t.nodeType!=1)break;let u=t.childNodes[r];if(Fs(u))o=t,a=++r;else break}else{if(Kg(t))break;{let u=t.nextSibling;for(;u&&Fs(u);)o=u.parentNode,a=Ls(u)+1,u=u.nextSibling;if(u)t=u,r=0,i=Oa(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}o&&Yc(n,o,a)}function Kg(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Yc(n,e,t){let r=n.domSelection();if(Lg(r)){let o=document.createRange();o.setEnd(e,t),o.setStart(e,t),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&qc(n)},50)}function Gg(n,e,t){let r=n.state.selection;if(r instanceof ye&&!r.empty||t.indexOf("s")>-1||jt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=Gc(n.state,e);if(a&&a instanceof ee)return qr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:o,u=r instanceof mn?ge.near(a,e):ge.findFrom(a,e);return u?qr(n,u):!1}return!1}function Jg(n,e){if(!(n.state.selection instanceof ye))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(o&&!o.isText){let a=n.state.tr;return e<0?a.delete(t.pos-o.nodeSize,t.pos):a.delete(t.pos,t.pos+o.nodeSize),n.dispatch(a),!0}return!1}function jg(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function ok(n){if(!Ur||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;jg(n,r,"true"),setTimeout(()=>jg(n,r,"false"),20)}return!1}function ak(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function lk(n,e){let t=e.keyCode,r=ak(e);return t==8||jt&&t==72&&r=="c"?Jg(n,-1)||Jc(n):t==46||jt&&t==68&&r=="c"?Jg(n,1)||jc(n):t==13||t==27?!0:t==37||jt&&t==66&&r=="c"?qg(n,-1,r)||Jc(n):t==39||jt&&t==70&&r=="c"?qg(n,1,r)||jc(n):t==38||jt&&t==80&&r=="c"?Gg(n,-1,r)||Jc(n):t==40||jt&&t==78&&r=="c"?ok(n)||Gg(n,1,r)||jc(n):r==(jt?"m":"c")&&(t==66||t==73||t==89||t==90)}function Yg(n,e){n.someProp("transformCopied",S=>{e=S(e,n)});let t=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let S=r.firstChild;t.push(S.type.name,S.attrs!=S.type.defaultAttrs?S.attrs:null),r=S.content}let a=n.someProp("clipboardSerializer")||ii.fromSchema(n.state.schema),u=i0(),f=u.createElement("div");f.appendChild(a.serializeFragment(r,{document:u}));let h=f.firstChild,m,p=0;for(;h&&h.nodeType==1&&(m=n0[h.nodeName.toLowerCase()]);){for(let S=m.length-1;S>=0;S--){let E=u.createElement(m[S]);for(;f.firstChild;)E.appendChild(f.firstChild);f.appendChild(E),p++}h=f.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${o}${p?` -${p}`:""} ${JSON.stringify(t)}`);let b=n.someProp("clipboardTextSerializer",S=>S(e,n))||e.content.textBetween(0,e.content.size,`
30
30
 
31
- `);return{dom:f,text:b}}function zg(n,e,t,r,i){let o=i.parent.type.spec.code,a,u;if(!t&&!e)return null;let f=e&&(r||o||!t);if(f){if(n.someProp("transformPastedText",b=>{e=b(e,o||r,n)}),o)return e?new K(z.from(n.state.schema.text(e.replace(/\r\n?/g,`
32
- `))),0,0):K.empty;let p=n.someProp("clipboardTextParser",b=>b(e,i,r,n));if(p)u=p;else{let b=i.marks(),{schema:S}=n.state,k=ti.fromSchema(S);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let _=a.appendChild(document.createElement("p"));g&&_.appendChild(k.serializeNode(S.text(g,b)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=UC(t),Rc&&qC(a);let h=a&&a.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let b=a.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;a=b}if(u||(u=(n.someProp("clipboardParser")||n.someProp("domParser")||yc.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!WC.test(b.parentNode.nodeName)?{ignore:!0}:null}})),m)u=KC(Wg(u,+m[1],+m[2]),m[4]);else if(u=K.maxOpen(VC(u.content,i),!0),u.openStart||u.openEnd){let p=0,b=0;for(let S=u.content.firstChild;p<u.openStart&&!S.type.spec.isolating;p++,S=S.firstChild);for(let S=u.content.lastChild;b<u.openEnd&&!S.type.spec.isolating;b++,S=S.lastChild);u=Wg(u,p,b)}return n.someProp("transformPasted",p=>{u=p(u,n)}),u}const WC=/^(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 VC(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(u=>{if(!a)return;let f=i.findWrapping(u.type),h;if(!f)return a=null;if(h=a.length&&o.length&&$g(f,o,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=Hg(a[a.length-1],o.length));let m=Bg(u,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return z.from(a)}return n}function Bg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,z.from(n));return n}function $g(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=$g(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(z.from(Bg(t,n,i+1))))}}function Hg(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Hg(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(z.empty,!0);return n.copy(t.append(r))}function $c(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,u=a.content;return i<r-1&&(u=$c(u,e,t,r,i+1,o)),i>=t&&(u=e<0?a.contentMatchAt(0).fillBefore(u,n.childCount>1||o<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(z.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(u))}function Wg(n,e,t){return e<n.openStart&&(n=new K($c(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new K($c(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Vg={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 Ug=null;function qg(){return Ug||(Ug=document.implementation.createHTMLDocument("title"))}function UC(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=qg().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Vg[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=n,i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function qC(n){let e=n.querySelectorAll(Mi?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function KC(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let u=r.length-2;u>=0;u-=2){let f=t.nodes[r[u]];if(!f||f.hasRequiredAttrs())break;i=z.from(f.create(r[u+1],i)),o++,a++}return new K(i,o,a)}const ln={},It={};function mr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}It.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Gg(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Is&&Mi&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Nc&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Sg(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||HC(n,t)?t.preventDefault():mr(n,"key")},It.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},It.keypress=(n,e)=>{let t=e;if(Gg(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||qt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof pe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function ka(n){return{left:n.clientX,top:n.clientY}}function GC(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Hc(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,u=>a>o.depth?u(n,t,o.nodeAfter,o.before(a),i,!0):u(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function Ti(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function JC(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(Ti(n,new ee(t)),!0):!1}function jC(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof ee&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(ee.isSelectable(u)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(Ti(n,ee.create(n.state.doc,i)),!0):!1}function YC(n,e,t,r,i){return Hc(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?jC(n,t):JC(n,t))}function XC(n,e,t,r){return Hc(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function ZC(n,e,t,r){return Hc(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||QC(n,t,r)}function QC(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ti(n,pe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(a.inlineContent)Ti(n,pe.create(r,u+1,u+1+a.content.size));else if(ee.isSelectable(a))Ti(n,ee.create(r,u));else continue;return!0}}function Wc(n){return Ca(n)}const Kg=qt?"metaKey":"ctrlKey";ln.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Wc(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&GC(t,n.input.lastClick)&&!t[Kg]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(ka(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new eE(n,a,t,!!r)):(o=="doubleClick"?XC:ZC)(n,a.pos,a.inside,t)?t.preventDefault():mr(n,"pointer"))};class eE{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Kg],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const u=i?null:r.target,f=u?e.docView.nearestDesc(u,!0):null;this.target=f?f.dom:null;let{selection:h}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof ee&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Sa&&!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)),mr(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(()=>Lc(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(ka(e))),this.updateAllowDefault(e),this.allowDefault||!t?mr(this.view,"pointer"):YC(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Hr&&this.mightDrag&&!this.mightDrag.node.isAtom||Mi&&!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)?(Ti(this.view,ye.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),mr(this.view,"pointer"),e.buttons==0&&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)}}ln.touchstart=n=>{n.input.lastTouch=Date.now(),Wc(n),mr(n,"pointer")},ln.touchmove=n=>{n.input.lastTouch=Date.now(),mr(n,"pointer")},ln.contextmenu=n=>Wc(n);function Gg(n,e){return n.composing?!0:Hr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const tE=Is?5e3:-1;It.compositionstart=It.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ca(n,!0),n.markCursor=null;else if(Ca(n),Sa&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){n.domSelection().collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}Jg(n,tE)},It.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,Jg(n,20))};function Jg(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ca(n),e))}function nE(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=rE());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function rE(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ca(n,e=!1){if(!(Is&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),nE(n),e||n.docView&&n.docView.dirty){let t=LC(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function iE(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Oi=Os&&Cg<15||Nc&&RC<604;ln.copy=It.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Oi?null:t.clipboardData,a=r.content(),{dom:u,text:f}=Fg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",f)):iE(n,u),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function sE(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function oE(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Vc(n,r.value,null,e):Vc(n,r.textContent,r.innerHTML,e)},50)}function Vc(n,e,t,r){let i=zg(n,e,t,n.input.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",u=>u(n,r,i||K.empty)))return!0;if(!i)return!1;let o=sE(i),a=o?n.state.tr.replaceSelectionWith(o,n.input.shiftKey):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}It.paste=(n,e)=>{let t=e;if(n.composing&&!Is)return;let r=Oi?null:t.clipboardData;r&&Vc(n,r.getData("text/plain"),r.getData("text/html"),t)?t.preventDefault():oE(n,t)};class aE{constructor(e,t){this.slice=e,this.move=t}}const jg=qt?"altKey":"ctrlKey";ln.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(ka(t));if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ee?i.to-1:i.to))){if(r&&r.mightDrag)n.dispatch(n.state.tr.setSelection(ee.create(n.state.doc,r.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&n.dispatch(n.state.tr.setSelection(ee.create(n.state.doc,h.posBefore)))}}let a=n.state.selection.content(),{dom:u,text:f}=Fg(n,a);t.dataTransfer.clearData(),t.dataTransfer.setData(Oi?"Text":"text/html",u.innerHTML),t.dataTransfer.effectAllowed="copyMove",Oi||t.dataTransfer.setData("text/plain",f),n.dragging=new aE(a,!t[jg])},ln.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},It.dragover=It.dragenter=(n,e)=>e.preventDefault(),It.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(ka(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",k=>{a=k(a,n)}):a=zg(n,t.dataTransfer.getData(Oi?"Text":"text/plain"),Oi?null:t.dataTransfer.getData("text/html"),!1,o);let u=!!(r&&!t[jg]);if(n.someProp("handleDrop",k=>k(n,t,a||K.empty,u))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?_C(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let h=n.state.tr;u&&h.deleteSelection();let m=h.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,b=h.doc;if(p?h.replaceRangeWith(m,m,a.content.firstChild):h.replaceRange(m,m,a),h.doc.eq(b))return;let S=h.doc.resolve(m);if(p&&ee.isSelectable(a.content.firstChild)&&S.nodeAfter&&S.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new ee(S));else{let k=h.mapping.map(f);h.mapping.maps[h.mapping.maps.length-1].forEach((g,_,x,E)=>k=E),h.setSelection(Ig(n,S,h.doc.resolve(k)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},ln.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Lc(n)},20))},ln.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},ln.beforeinput=(n,e)=>{if(Mi&&Is&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Sg(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in It)ln[n]=It[n];function Rs(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class th{constructor(e,t){this.toDOM=e,this.spec=t||Vr,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new Sn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof th&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class xr{constructor(e,t){this.attrs=e,this.spec=t||Vr}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new Sn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof xr&&Rs(this.attrs,e.attrs)&&Rs(this.spec,e.spec)}static is(e){return e.type instanceof xr}destroy(){}}class nh{constructor(e,t){this.attrs=e,this.spec=t||Vr}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new Sn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof nh&&Rs(this.attrs,e.attrs)&&Rs(this.spec,e.spec)}destroy(){}}class Sn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Sn(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,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Sn(e,e,new th(t,r))}static inline(e,t,r,i){return new Sn(e,t,new xr(r,i))}static node(e,t,r,i){return new Sn(e,t,new nh(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof xr}}const Ii=[],Vr={};class Je{constructor(e,t){this.local=e.length?e:Ii,this.children=t.length?t:Ii}static create(e,t){return t.length?Ea(t,e,0,Vr):ht}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=t&&u.to>=e&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,t-u,r,i+u,o)}}map(e,t,r){return this==ht||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Vr)}mapInner(e,t,r,i,o){let a;for(let u=0;u<this.local.length;u++){let f=this.local[u].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?lE(this.children,a||[],e,t,r,i,o):a?new Je(a.sort(Ur),Ii):ht}add(e,t){return t.length?this==ht?Je.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((u,f)=>{let h=f+r,m;if(m=Xg(t,u,h)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(u,m,h+1):i.splice(o,0,f,f+u.nodeSize,Ea(m,u,h+1,Vr)),o+=3}});let a=Yg(o?Zg(t):t,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Je(a.length?this.local.concat(a).sort(Ur):this.local,i||this.children)}remove(e){return e.length==0||this==ht?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,u=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>u&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[o+2].removeInner(a,u+1);h!=ht?r[o+2]=h:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let u=0;u<i.length;u++)i[u].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Je(i,r):ht}forChild(e,t){if(this==ht)return this;if(t.isLeaf)return Je.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let o=e+1,a=o+t.content.size;for(let u=0;u<this.local.length;u++){let f=this.local[u];if(f.from<a&&f.to>o&&f.type instanceof xr){let h=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;h<m&&(i||(i=[])).push(f.copy(h,m))}}if(i){let u=new Je(i.sort(Ur),Ii);return r?new ei([u,r]):u}return r||ht}eq(e){if(this==e)return!0;if(!(e instanceof Je)||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 Uc(this.localsInner(e))}localsInner(e){if(this==ht)return Ii;if(e.inlineContent||!this.local.some(xr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof xr||t.push(this.local[r]);return t}}Je.empty=new Je([],[]),Je.removeOverlap=Uc;const ht=Je.empty;class ei{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Vr));return ei.from(r)}forChild(e,t){if(t.isLeaf)return Je.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=ht&&(o instanceof ei?r=r.concat(o.members):r.push(o))}return ei.from(r)}eq(e){if(!(e instanceof ei)||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,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?Uc(r?t:t.sort(Ur)):Ii}static from(e){switch(e.length){case 0:return ht;case 1:return e[0];default:return new ei(e.every(t=>t instanceof Je)?e:e.reduce((t,r)=>t.concat(r instanceof Je?r:r.members),[]))}}}function lE(n,e,t,r,i,o,a){let u=n.slice();for(let h=0,m=o;h<t.maps.length;h++){let p=0;t.maps[h].forEach((b,S,k,g)=>{let _=g-k-(S-b);for(let x=0;x<u.length;x+=3){let E=u[x+1];if(E<0||b>E+m-p)continue;let A=u[x]+m-p;S>=A?u[x+1]=b<=A?-2:-1:k>=i&&_&&(u[x]+=_,u[x+1]+=_)}p+=_}),m=t.maps[h].map(m,-1)}let f=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){f=!0,u[h+1]=-1;continue}let m=t.map(n[h]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let b=t.map(n[h+1]+o,-1),S=b-i,{index:k,offset:g}=r.content.findIndex(p),_=r.maybeChild(k);if(_&&g==p&&g+_.nodeSize==S){let x=u[h+2].mapInner(t,_,m+1,n[h]+o+1,a);x!=ht?(u[h]=p,u[h+1]=S,u[h+2]=x):(u[h+1]=-2,f=!0)}else f=!0}if(f){let h=uE(u,n,e,t,i,o,a),m=Ea(h,r,0,a);e=m.local;for(let p=0;p<u.length;p+=3)u[p+1]<0&&(u.splice(p,3),p-=3);for(let p=0,b=0;p<m.children.length;p+=3){let S=m.children[p];for(;b<u.length&&u[b]<S;)b+=3;u.splice(b,0,m.children[p],m.children[p+1],m.children[p+2])}}return new Je(e.sort(Ur),u)}function Yg(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Sn(i.from+e,i.to+e,i.type))}return t}function uE(n,e,t,r,i,o,a){function u(f,h){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,h);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)u(f.children[m+2],f.children[m]+h+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&u(n[f+2],e[f]+o+1);return t}function Xg(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function Zg(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ea(n,e,t,r){let i=[],o=!1;e.forEach((u,f)=>{let h=Xg(n,u,f+t);if(h){o=!0;let m=Ea(h,u,t+f+1,r);m!=ht&&i.push(f,f+u.nodeSize,m)}});let a=Yg(o?Zg(n):n,-t).sort(Ur);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new Je(a,i):ht}function Ur(n,e){return n.from-e.from||n.to-e.to}function Uc(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),Qg(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),Qg(e,i,r.copy(o.from,r.to)));break}}}return e}function Qg(n,e,t){for(;e<n.length&&Ur(t,n[e])>0;)e++;n.splice(e,0,t)}for(var gr={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:"'"},Aa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},e0=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),cE=typeof navigator<"u"&&/Mac/.test(navigator.platform),fE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),hE=cE||e0&&+e0[1]<57,et=0;et<10;et++)gr[48+et]=gr[96+et]=String(et);for(var et=1;et<=24;et++)gr[et+111]="F"+et;for(var et=65;et<=90;et++)gr[et]=String.fromCharCode(et+32),Aa[et]=String.fromCharCode(et);for(var qc in gr)Aa.hasOwnProperty(qc)||(Aa[qc]=gr[qc]);function dE(n){var e=hE&&(n.ctrlKey||n.altKey||n.metaKey)||fE&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Aa:gr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const pE=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function mE(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u++){let f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))pE?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function gE(n){let e=Object.create(null);for(let t in n)e[mE(t)]=n[t];return e}function Kc(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}function yE(n){return new Ot({props:{handleKeyDown:bE(n)}})}function bE(n){let e=gE(n);return function(t,r){let i=dE(r),o=i.length==1&&i!=" ",a,u=e[Kc(i,r,!o)];if(u&&u(t.state,t.dispatch,t))return!0;if(o&&(r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(a=gr[r.keyCode])&&a!=i){let f=e[Kc(a,r,!0)];if(f&&f(t.state,t.dispatch,t))return!0}else if(o&&r.shiftKey){let f=e[Kc(i,r,!0)];if(f&&f(t.state,t.dispatch,t))return!0}return!1}}const Gc=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function _E(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const t0=(n,e,t)=>{let r=_E(n,t);if(!r)return!1;let i=r0(r);if(!i){let a=r.blockRange(),u=a&&Ci(a);return u==null?!1:(e&&e(n.tr.lift(a,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&c0(n,i,e))return!0;if(r.parent.content.size==0&&(Ni(o,"end")||ee.isSelectable(o))){let a=kc(n.doc,r.before(),r.after(),K.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=n.tr.step(a);u.setSelection(Ni(o,"end")?ye.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):ee.create(u.doc,i.pos-o.nodeSize)),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function Ni(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const n0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=r0(r)}let a=o&&o.nodeBefore;return!a||!ee.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function r0(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function vE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const i0=(n,e,t)=>{let r=vE(n,t);if(!r)return!1;let i=o0(r);if(!i)return!1;let o=i.nodeAfter;if(c0(n,i,e))return!0;if(r.parent.content.size==0&&(Ni(o,"start")||ee.isSelectable(o))){let a=kc(n.doc,r.before(),r.after(),K.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=n.tr.step(a);u.setSelection(Ni(o,"start")?ye.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ee.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},s0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=o0(r)}let a=o&&o.nodeAfter;return!a||!ee.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos)).scrollIntoView()),!0)};function o0(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const wE=(n,e)=>{let t=n.selection,r=t instanceof ee,i;if(r){if(t.node.isTextblock||!hr(n.doc,t.from))return!1;i=t.from}else if(i=_a(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(ee.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},SE=(n,e)=>{let t=n.selection,r;if(t instanceof ee){if(t.node.isTextblock||!hr(n.doc,t.to))return!1;r=t.to}else if(r=_a(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},xE=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Ci(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},a0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
33
- `).scrollIntoView()),!0)};function Jc(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const kE=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=Jc(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let u=t.after(),f=n.tr.replaceWith(u,u,a.createAndFill());f.setSelection(ye.near(f.doc.resolve(u),1)),e(f.scrollIntoView())}return!0},l0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof jt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Jc(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=n.tr.insert(a,o.createAndFill());u.setSelection(pe.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},u0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Bn(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Ci(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function CE(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof ee&&e.selection.node.isBlock)return!r.parentOffset||!Bn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(t){let o=i.parentOffset==i.parent.content.size,a=e.tr;(e.selection instanceof pe||e.selection instanceof jt)&&a.deleteSelection();let u=r.depth==0?null:Jc(r.node(-1).contentMatchAt(r.indexAfter(-1))),f=o&&u?[{type:u}]:void 0,h=Bn(a.doc,a.mapping.map(r.pos),1,f);if(!f&&!h&&Bn(a.doc,a.mapping.map(r.pos),1,u?[{type:u}]:void 0)&&(u&&(f=[{type:u}]),h=!0),h&&(a.split(a.mapping.map(r.pos),1,f),!o&&!r.parentOffset&&r.parent.type!=u)){let m=a.mapping.map(r.before()),p=a.doc.resolve(m);u&&r.node(-1).canReplaceWith(p.index(),p.index()+1,u)&&a.setNodeMarkup(a.mapping.map(r.before()),u)}t(a.scrollIntoView())}return!0}}const EE=CE(),AE=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(ee.create(n.doc,i))),!0)};function ME(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||hr(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function c0(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o,a;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(ME(n,e,t))return!0;let u=e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,b=z.empty;for(let g=o.length-1;g>=0;g--)b=z.from(o[g].create(null,b));b=z.from(r.copy(b));let S=n.tr.step(new Ge(e.pos-1,p,e.pos,p,new K(b,1,0),o.length,!0)),k=p+2*o.length;hr(S.doc,k)&&S.join(k),t(S.scrollIntoView())}return!0}let f=ye.findFrom(e,1),h=f&&f.$from.blockRange(f.$to),m=h&&Ci(h);if(m!=null&&m>=e.depth)return t&&t(n.tr.lift(h,m).scrollIntoView()),!0;if(u&&Ni(i,"start",!0)&&Ni(r,"end")){let p=r,b=[];for(;b.push(p),!p.isTextblock;)p=p.lastChild;let S=i,k=1;for(;!S.isTextblock;S=S.firstChild)k++;if(p.canReplace(p.childCount,p.childCount,S.content)){if(t){let g=z.empty;for(let x=b.length-1;x>=0;x--)g=z.from(b[x].copy(g));let _=n.tr.step(new Ge(e.pos-b.length,e.pos+i.nodeSize,e.pos+k,e.pos+i.nodeSize-k,new K(g,b.length,0),0,!0));t(_.scrollIntoView())}return!0}}return!1}function f0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(pe.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const TE=f0(-1),OE=f0(1);function IE(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),u=a&&xc(a,n,e);return u?(r&&r(t.tr.wrap(a,u).scrollIntoView()),!0):!1}}function h0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:u}}=t.selection.ranges[o];t.doc.nodesBetween(a,u,(f,h)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(h),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(u,f,n,e)}r(o.scrollIntoView())}return!0}}function jc(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}jc(Gc,t0,n0),jc(Gc,i0,s0),jc(a0,l0,u0,EE),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function NE(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),u=!1,f=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(n)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;let m=t.doc.resolve(a.start-2);f=new pa(m,m,a.depth),a.endIndex<a.parent.childCount&&(a=new pa(i,t.doc.resolve(o.end(a.depth)),a.depth)),u=!0}let h=xc(f,n,e,a);return h?(r&&r(RE(t.tr,a,h,u,n).scrollIntoView()),!0):!1}}function RE(n,e,t,r,i){let o=z.empty;for(let m=t.length-1;m>=0;m--)o=z.from(t[m].type.create(t[m].attrs,o));n.step(new Ge(e.start-(r?2:0),e.end,e.start,e.end,new K(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let u=t.length-a,f=e.start+t.length-(r?2:0),h=e.parent;for(let m=e.startIndex,p=e.endIndex,b=!0;m<p;m++,b=!1)!b&&Bn(n.doc,f,u)&&(n.split(f,u),f+=2*u),f+=h.child(m).nodeSize;return n}function LE(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?PE(e,t,n,o):DE(e,t,o):!0:!1}}function PE(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Ge(o-1,a,o,a,new K(z.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new pa(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Ci(r);if(u==null)return!1;i.lift(r,u);let f=i.mapping.map(o,-1)-1;return hr(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function DE(n,e,t){let r=n.tr,i=t.parent;for(let S=t.end,k=t.endIndex-1,g=t.startIndex;k>g;k--)S-=i.child(k).nodeSize,r.delete(S-1,S+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let u=t.startIndex==0,f=t.endIndex==i.childCount,h=o.node(-1),m=o.index(-1);if(!h.canReplace(m+(u?0:1),m+1,a.content.append(f?z.empty:z.from(i))))return!1;let p=o.pos,b=p+a.nodeSize;return r.step(new Ge(p-(u?1:0),b+(f?1:0),p+1,b-1,new K((u?z.empty:z.from(i.copy(z.empty))).append(f?z.empty:z.from(i.copy(z.empty))),u?0:1,f?0:1),u?0:1)),e(r.scrollIntoView()),!0}function FE(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,f=u.child(a-1);if(f.type!=n)return!1;if(t){let h=f.lastChild&&f.lastChild.type==u.type,m=z.from(h?n.create():null),p=new K(z.from(n.create(null,z.from(u.type.create(null,m)))),h?3:1,0),b=o.start,S=o.end;t(e.tr.step(new Ge(b-(h?3:1),S,b,S,p,1,!0)).scrollIntoView())}return!0}}function Ma(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class Yc{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:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([u,f])=>[u,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u=[],f=!!e,h=e||o.tr,m=()=>(!f&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),u.every(b=>b===!0)),p={...Object.fromEntries(Object.entries(r).map(([b,S])=>[b,(...g)=>{const _=this.buildProps(h,t),x=S(...g)(_);return u.push(x),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>h(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u={tr:e,editor:i,view:a,state:Ma({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>h(...m)(u)]))}};return u}}function G(n,e,t){return n.config[e]===void 0&&n.parent?G(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?G(n.parent,e,t):null}):n.config[e]}function Ta(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function d0(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ta(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},f=G(a,"addGlobalAttributes",u);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([b,S])=>{e.push({type:p,name:b,attribute:{...o,...S}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},f=G(a,"addAttributes",u);if(!f)return;const h=f();Object.entries(h).forEach(([m,p])=>{const b={...o,...p};typeof b?.default=="function"&&(b.default=b.default()),b?.isRequired&&b?.default===void 0&&delete b.default,e.push({type:a.name,name:m,attribute:b})})}),e}function Ue(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Ri(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const u=o?o.split(" "):[],f=r[i]?r[i].split(" "):[],h=u.filter(m=>!f.includes(m));r[i]=[...f,...h].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function Xc(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ri(t,r),{})}function zE(n){return typeof n=="function"}function ue(n,e=void 0,...t){return zE(n)?e?n.bind(e)(...t):n(...t):n}function BE(n={}){return Object.keys(n).length===0&&n.constructor===Object}function $E(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function p0(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(t):$E(t.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...r,...i}}}}function m0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&BE(t)?!1:t!=null))}function g0(n,e){var t;const r=d0(n),{nodeExtensions:i,markExtensions:o}=Ta(n),a=(t=i.find(h=>G(h,"topNode")))===null||t===void 0?void 0:t.name,u=Object.fromEntries(i.map(h=>{const m=r.filter(x=>x.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},b=n.reduce((x,E)=>{const A=G(E,"extendNodeSchema",p);return{...x,...A?A(h):{}}},{}),S=m0({...b,content:ue(G(h,"content",p)),marks:ue(G(h,"marks",p)),group:ue(G(h,"group",p)),inline:ue(G(h,"inline",p)),atom:ue(G(h,"atom",p)),selectable:ue(G(h,"selectable",p)),draggable:ue(G(h,"draggable",p)),code:ue(G(h,"code",p)),defining:ue(G(h,"defining",p)),isolating:ue(G(h,"isolating",p)),attrs:Object.fromEntries(m.map(x=>{var E;return[x.name,{default:(E=x?.attribute)===null||E===void 0?void 0:E.default}]}))}),k=ue(G(h,"parseHTML",p));k&&(S.parseDOM=k.map(x=>p0(x,m)));const g=G(h,"renderHTML",p);g&&(S.toDOM=x=>g({node:x,HTMLAttributes:Xc(x,m)}));const _=G(h,"renderText",p);return _&&(S.toText=_),[h.name,S]})),f=Object.fromEntries(o.map(h=>{const m=r.filter(_=>_.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},b=n.reduce((_,x)=>{const E=G(x,"extendMarkSchema",p);return{..._,...E?E(h):{}}},{}),S=m0({...b,inclusive:ue(G(h,"inclusive",p)),excludes:ue(G(h,"excludes",p)),group:ue(G(h,"group",p)),spanning:ue(G(h,"spanning",p)),code:ue(G(h,"code",p)),attrs:Object.fromEntries(m.map(_=>{var x;return[_.name,{default:(x=_?.attribute)===null||x===void 0?void 0:x.default}]}))}),k=ue(G(h,"parseHTML",p));k&&(S.parseDOM=k.map(_=>p0(_,m)));const g=G(h,"renderHTML",p);return g&&(S.toDOM=_=>g({mark:_,HTMLAttributes:Xc(_,m)})),[h.name,S]}));return new Yk({topNode:a,nodes:u,marks:f})}function Zc(n,e){return e.nodes[n]||e.marks[n]||null}function y0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const HE=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,u)=>{var f,h;const m=((h=(f=i.type.spec).toText)===null||h===void 0?void 0:h.call(f,{node:i,pos:o,parent:a,index:u}))||i.textContent||"%leaf%";t+=m.slice(0,Math.max(0,r-o))}),t};function Qc(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class b0{constructor(e){this.find=e.find,this.handler=e.handler}}const WE=(n,e)=>{if(Qc(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function ef(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:u}=n,{view:f}=t;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(b=>b.type.spec.code))return!1;let m=!1;const p=HE(h)+o;return a.forEach(b=>{if(m)return;const S=WE(p,b.find);if(!S)return;const k=f.state.tr,g=Ma({state:f.state,transaction:k}),_={from:r-(S[0].length-o.length),to:i},{commands:x,chain:E,can:A}=new Yc({editor:t,state:g});b.handler({state:g,range:_,match:S,commands:x,chain:E,can:A})===null||!k.steps.length||(k.setMeta(u,{transform:k,from:r,to:i,text:o}),f.dispatch(k),m=!0)}),m}function VE(n){const{editor:e,rules:t}=n,r=new Ot({state:{init(){return null},apply(i,o){const a=i.getMeta(r);return a||(i.selectionSet||i.docChanged?null:o)}},props:{handleTextInput(i,o,a,u){return ef({editor:e,from:o,to:a,text:u,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ef({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?ef({editor:e,from:a.pos,to:a.pos,text:`
34
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function UE(n){return typeof n=="number"}class qE{constructor(e){this.find=e.find,this.handler=e.handler}}const KE=(n,e)=>{if(Qc(e))return[...n.matchAll(e)];const t=e(n);return t?t.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function GE(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:u}=n,{commands:f,chain:h,can:m}=new Yc({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(S,k)=>{if(!S.isTextblock||S.type.spec.code)return;const g=Math.max(r,k),_=Math.min(i,k+S.content.size),x=S.textBetween(g-k,_-k,void 0,"\uFFFC");KE(x,o.find).forEach(A=>{if(A.index===void 0)return;const N=g+A.index+1,W=N+A[0].length,L={from:t.tr.mapping.map(N),to:t.tr.mapping.map(W)},U=o.handler({state:t,range:L,match:A,commands:f,chain:h,can:m,pasteEvent:a,dropEvent:u});p.push(U)})}),p.every(S=>S!==null)}function JE(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=new ClipboardEvent("paste"),u=new DragEvent("drop");return t.map(h=>new Ot({view(m){const p=b=>{var S;r=!((S=m.dom.parentElement)===null||S===void 0)&&S.contains(b.target)?m.dom.parentElement:null};return window.addEventListener("dragstart",p),{destroy(){window.removeEventListener("dragstart",p)}}},props:{handleDOMEvents:{drop:(m,p)=>(o=r===m.dom.parentElement,u=p,!1),paste:(m,p)=>{var b;const S=(b=p.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=p,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,p,b)=>{const S=m[0],k=S.getMeta("uiEvent")==="paste"&&!i,g=S.getMeta("uiEvent")==="drop"&&!o;if(!k&&!g)return;const _=p.doc.content.findDiffStart(b.doc.content),x=p.doc.content.findDiffEnd(b.doc.content);if(!UE(_)||!x||_===x.b)return;const E=b.tr,A=Ma({state:b,transaction:E});if(!(!GE({editor:e,state:A,from:Math.max(_-1,0),to:x.b-1,rule:h,pasteEvent:a,dropEvent:u})||!E.steps.length))return u=new DragEvent("drop"),a=new ClipboardEvent("paste"),E}}))}function jE(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Vi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Vi.resolve(e),this.schema=g0(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const o={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:Zc(r.name,this.schema)};r.type==="mark"&&(!((i=ue(G(r,"keepOnSplit",o)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const a=G(r,"onBeforeCreate",o);a&&this.editor.on("beforeCreate",a);const u=G(r,"onCreate",o);u&&this.editor.on("create",u);const f=G(r,"onUpdate",o);f&&this.editor.on("update",f);const h=G(r,"onSelectionUpdate",o);h&&this.editor.on("selectionUpdate",h);const m=G(r,"onTransaction",o);m&&this.editor.on("transaction",m);const p=G(r,"onFocus",o);p&&this.editor.on("focus",p);const b=G(r,"onBlur",o);b&&this.editor.on("blur",b);const S=G(r,"onDestroy",o);S&&this.editor.on("destroy",S)})}static resolve(e){const t=Vi.sort(Vi.flatten(e)),r=jE(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=G(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=G(r,"priority")||100,a=G(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Zc(t.name,this.schema)},i=G(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Vi.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:e,type:Zc(a.name,this.schema)},f=[],h=G(a,"addKeyboardShortcuts",u);let m={};if(a.type==="mark"&&a.config.exitable&&(m.ArrowRight=()=>Nt.handleExit({editor:e,mark:a})),h){const g=Object.fromEntries(Object.entries(h()).map(([_,x])=>[_,()=>x({editor:e})]));m={...m,...g}}const p=yE(m);f.push(p);const b=G(a,"addInputRules",u);y0(a,e.options.enableInputRules)&&b&&r.push(...b());const S=G(a,"addPasteRules",u);y0(a,e.options.enablePasteRules)&&S&&i.push(...S());const k=G(a,"addProseMirrorPlugins",u);if(k){const g=k();f.push(...g)}return f}).flat();return[VE({editor:e,rules:r}),...JE({editor:e,rules:i}),...o]}get attributes(){return d0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ta(this.extensions);return Object.fromEntries(t.filter(r=>!!G(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ue(r.name,this.schema)},a=G(r,"addNodeView",o);if(!a)return[];const u=(f,h,m,p)=>{const b=Xc(f,i);return a()({editor:e,node:f,getPos:m,decorations:p,HTMLAttributes:b,extension:r})};return[r.name,u]}))}}function YE(n){return Object.prototype.toString.call(n).slice(8,-1)}function tf(n){return YE(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Oa(n,e){const t={...n};return tf(n)&&tf(e)&&Object.keys(e).forEach(r=>{tf(e[r])?r in n?t[r]=Oa(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class Re{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Re(e)}configure(e={}){const t=this.extend();return t.options=Oa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Re(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}}function XE(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
31
+ `);return{dom:f,text:b}}function Xg(n,e,t,r,i){let o=i.parent.type.spec.code,a,u;if(!t&&!e)return null;let f=e&&(r||o||!t);if(f){if(n.someProp("transformPastedText",b=>{e=b(e,o||r,n)}),o)return e?new K(z.from(n.state.schema.text(e.replace(/\r\n?/g,`
32
+ `))),0,0):K.empty;let p=n.someProp("clipboardTextParser",b=>b(e,i,r,n));if(p)u=p;else{let b=i.marks(),{schema:S}=n.state,E=ii.fromSchema(S);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let _=a.appendChild(document.createElement("p"));g&&_.appendChild(E.serializeNode(S.text(g,b)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=fk(t),Uc&&hk(a);let h=a&&a.querySelector("[data-pm-slice]"),m=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(m&&m[3])for(let p=+m[3];p>0;p--){let b=a.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;a=b}if(u||(u=(n.someProp("clipboardParser")||n.someProp("domParser")||Mc.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(f||m),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!uk.test(b.parentNode.nodeName)?{ignore:!0}:null}})),m)u=dk(t0(u,+m[1],+m[2]),m[4]);else if(u=K.maxOpen(ck(u.content,i),!0),u.openStart||u.openEnd){let p=0,b=0;for(let S=u.content.firstChild;p<u.openStart&&!S.type.spec.isolating;p++,S=S.firstChild);for(let S=u.content.lastChild;b<u.openEnd&&!S.type.spec.isolating;b++,S=S.lastChild);u=t0(u,p,b)}return n.someProp("transformPasted",p=>{u=p(u,n)}),u}const uk=/^(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 ck(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),o,a=[];if(n.forEach(u=>{if(!a)return;let f=i.findWrapping(u.type),h;if(!f)return a=null;if(h=a.length&&o.length&&Qg(f,o,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=e0(a[a.length-1],o.length));let m=Zg(u,f);a.push(m),i=i.matchType(m.type),o=f}}),a)return z.from(a)}return n}function Zg(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,z.from(n));return n}function Qg(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let o=Qg(n,e,t,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(z.from(Zg(t,n,i+1))))}}function e0(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,e0(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(z.empty,!0);return n.copy(t.append(r))}function Xc(n,e,t,r,i,o){let a=e<0?n.firstChild:n.lastChild,u=a.content;return i<r-1&&(u=Xc(u,e,t,r,i+1,o)),i>=t&&(u=e<0?a.contentMatchAt(0).fillBefore(u,n.childCount>1||o<=i).append(u):u.append(a.contentMatchAt(a.childCount).fillBefore(z.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(u))}function t0(n,e,t){return e<n.openStart&&(n=new K(Xc(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new K(Xc(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const n0={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 r0=null;function i0(){return r0||(r0=document.implementation.createHTMLDocument("title"))}function fk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=i0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&n0[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),t.innerHTML=n,i)for(let o=0;o<i.length;o++)t=t.querySelector(i[o])||t;return t}function hk(n){let e=n.querySelectorAll(Ni?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function dk(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:o,openEnd:a}=n;for(let u=r.length-2;u>=0;u-=2){let f=t.nodes[r[u]];if(!f||f.hasRequiredAttrs())break;i=z.from(f.create(r[u+1],i)),o++,a++}return new K(i,o,a)}const hn={},Lt={};function yr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Lt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!o0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ds&&Ni&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Wc&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Pg(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||lk(n,t)?t.preventDefault():yr(n,"key")},Lt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Lt.keypress=(n,e)=>{let t=e;if(o0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||jt&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof ye)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Ia(n){return{left:n.clientX,top:n.clientY}}function pk(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Zc(n,e,t,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let a=o.depth+1;a>0;a--)if(n.someProp(e,u=>a>o.depth?u(n,t,o.nodeAfter,o.before(a),i,!0):u(n,t,o.node(a),o.before(a),i,!1)))return!0;return!1}function Ri(n,e,t){n.focused||n.focus();let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function mk(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ee.isSelectable(r)?(Ri(n,new ee(t)),!0):!1}function gk(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof ee&&(r=t.node);let o=n.state.doc.resolve(e);for(let a=o.depth+1;a>0;a--){let u=a>o.depth?o.nodeAfter:o.node(a);if(ee.isSelectable(u)){r&&t.$from.depth>0&&a>=t.$from.depth&&o.before(t.$from.depth+1)==t.$from.pos?i=o.before(t.$from.depth):i=o.before(a);break}}return i!=null?(Ri(n,ee.create(n.state.doc,i)),!0):!1}function yk(n,e,t,r,i){return Zc(n,"handleClickOn",e,t,r)||n.someProp("handleClick",o=>o(n,e,r))||(i?gk(n,t):mk(n,t))}function bk(n,e,t,r){return Zc(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function _k(n,e,t,r){return Zc(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||vk(n,t,r)}function vk(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Ri(n,ye.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o),u=i.before(o);if(a.inlineContent)Ri(n,ye.create(r,u+1,u+1+a.content.size));else if(ee.isSelectable(a))Ri(n,ee.create(r,u));else continue;return!0}}function Qc(n){return Na(n)}const s0=jt?"metaKey":"ctrlKey";hn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Qc(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&pk(t,n.input.lastClick)&&!t[s0]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:o};let a=n.posAtCoords(Ia(t));a&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new wk(n,a,t,!!r)):(o=="doubleClick"?bk:_k)(n,a.pos,a.inside,t)?t.preventDefault():yr(n,"pointer"))};class wk{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[s0],this.allowDefault=r.shiftKey;let o,a;if(t.inside>-1)o=e.state.doc.nodeAt(t.inside),a=t.inside;else{let m=e.state.doc.resolve(t.pos);o=m.parent,a=m.depth?m.before():0}const u=i?null:r.target,f=u?e.docView.nearestDesc(u,!0):null;this.target=f?f.dom:null;let{selection:h}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||h instanceof ee&&h.from<=a&&h.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ta&&!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)),yr(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(()=>qc(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(Ia(e))),this.updateAllowDefault(e),this.allowDefault||!t?yr(this.view,"pointer"):yk(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ur&&this.mightDrag&&!this.mightDrag.node.isAtom||Ni&&!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)?(Ri(this.view,ge.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),yr(this.view,"pointer"),e.buttons==0&&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)}}hn.touchstart=n=>{n.input.lastTouch=Date.now(),Qc(n),yr(n,"pointer")},hn.touchmove=n=>{n.input.lastTouch=Date.now(),yr(n,"pointer")},hn.contextmenu=n=>Qc(n);function o0(n,e){return n.composing?!0:Ur&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Sk=Ds?5e3:-1;Lt.compositionstart=Lt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Na(n,!0),n.markCursor=null;else if(Na(n),Ta&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(a.nodeType==3){n.domSelection().collapse(a,a.nodeValue.length);break}else i=a,o=-1}}n.input.composing=!0}a0(n,Sk)},Lt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,a0(n,20))};function a0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Na(n),e))}function xk(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Ek());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Ek(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Na(n,e=!1){if(!(Ds&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),xk(n),e||n.docView&&n.docView.dirty){let t=tk(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):n.updateState(n.state),!0}return!1}}function Ck(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Li=Ps&&zg<15||Wc&&ek<604;hn.copy=Lt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let o=Li?null:t.clipboardData,a=r.content(),{dom:u,text:f}=Yg(n,a);o?(t.preventDefault(),o.clearData(),o.setData("text/html",u.innerHTML),o.setData("text/plain",f)):Ck(n,u),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function kk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Ak(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?ef(n,r.value,null,e):ef(n,r.textContent,r.innerHTML,e)},50)}function ef(n,e,t,r){let i=Xg(n,e,t,n.input.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",u=>u(n,r,i||K.empty)))return!0;if(!i)return!1;let o=kk(i),a=o?n.state.tr.replaceSelectionWith(o,n.input.shiftKey):n.state.tr.replaceSelection(i);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}Lt.paste=(n,e)=>{let t=e;if(n.composing&&!Ds)return;let r=Li?null:t.clipboardData;r&&ef(n,r.getData("text/plain"),r.getData("text/html"),t)?t.preventDefault():Ak(n,t)};class Mk{constructor(e,t){this.slice=e,this.move=t}}const l0=jt?"altKey":"ctrlKey";hn.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Ia(t));if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof ee?i.to-1:i.to))){if(r&&r.mightDrag)n.dispatch(n.state.tr.setSelection(ee.create(n.state.doc,r.mightDrag.pos)));else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&n.dispatch(n.state.tr.setSelection(ee.create(n.state.doc,h.posBefore)))}}let a=n.state.selection.content(),{dom:u,text:f}=Yg(n,a);t.dataTransfer.clearData(),t.dataTransfer.setData(Li?"Text":"text/html",u.innerHTML),t.dataTransfer.effectAllowed="copyMove",Li||t.dataTransfer.setData("text/plain",f),n.dragging=new Mk(a,!t[l0])},hn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Lt.dragover=Lt.dragenter=(n,e)=>e.preventDefault(),Lt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Ia(t));if(!i)return;let o=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",E=>{a=E(a,n)}):a=Xg(n,t.dataTransfer.getData(Li?"Text":"text/plain"),Li?null:t.dataTransfer.getData("text/html"),!1,o);let u=!!(r&&!t[l0]);if(n.someProp("handleDrop",E=>E(n,t,a||K.empty,u))){t.preventDefault();return}if(!a)return;t.preventDefault();let f=a?$C(n.state.doc,o.pos,a):o.pos;f==null&&(f=o.pos);let h=n.state.tr;u&&h.deleteSelection();let m=h.mapping.map(f),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,b=h.doc;if(p?h.replaceRangeWith(m,m,a.content.firstChild):h.replaceRange(m,m,a),h.doc.eq(b))return;let S=h.doc.resolve(m);if(p&&ee.isSelectable(a.content.firstChild)&&S.nodeAfter&&S.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new ee(S));else{let E=h.mapping.map(f);h.mapping.maps[h.mapping.maps.length-1].forEach((g,_,x,k)=>E=k),h.setSelection(Ug(n,S,h.doc.resolve(E)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},hn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&qc(n)},20))},hn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},hn.beforeinput=(n,e)=>{if(Ni&&Ds&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Pg(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in Lt)hn[n]=Lt[n];function zs(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class uh{constructor(e,t){this.toDOM=e,this.spec=t||Kr,this.side=this.spec.side||0}map(e,t,r,i){let{pos:o,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new Mn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof uh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&zs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Cr{constructor(e,t){this.attrs=e,this.spec=t||Kr}map(e,t,r,i){let o=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=a?null:new Mn(o,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Cr&&zs(this.attrs,e.attrs)&&zs(this.spec,e.spec)}static is(e){return e.type instanceof Cr}destroy(){}}class ch{constructor(e,t){this.attrs=e,this.spec=t||Kr}map(e,t,r,i){let o=e.mapResult(t.from+i,1);if(o.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=o.pos?null:new Mn(o.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),o;return i==t.from&&!(o=e.child(r)).isText&&i+o.nodeSize==t.to}eq(e){return this==e||e instanceof ch&&zs(this.attrs,e.attrs)&&zs(this.spec,e.spec)}destroy(){}}class Mn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Mn(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,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Mn(e,e,new uh(t,r))}static inline(e,t,r,i){return new Mn(e,t,new Cr(r,i))}static node(e,t,r,i){return new Mn(e,t,new ch(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Cr}}const Pi=[],Kr={};class Ze{constructor(e,t){this.local=e.length?e:Pi,this.children=t.length?t:Pi}static create(e,t){return t.length?Ra(t,e,0,Kr):gt}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,o){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=t&&u.to>=e&&(!o||o(u.spec))&&r.push(u.copy(u.from+i,u.to+i))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let u=this.children[a]+1;this.children[a+2].findInner(e-u,t-u,r,i+u,o)}}map(e,t,r){return this==gt||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Kr)}mapInner(e,t,r,i,o){let a;for(let u=0;u<this.local.length;u++){let f=this.local[u].map(e,r,i);f&&f.type.valid(t,f)?(a||(a=[])).push(f):o.onRemove&&o.onRemove(this.local[u].spec)}return this.children.length?Tk(this.children,a||[],e,t,r,i,o):a?new Ze(a.sort(Gr),Pi):gt}add(e,t){return t.length?this==gt?Ze.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,o=0;e.forEach((u,f)=>{let h=f+r,m;if(m=c0(t,u,h)){for(i||(i=this.children.slice());o<i.length&&i[o]<f;)o+=3;i[o]==f?i[o+2]=i[o+2].addInner(u,m,h+1):i.splice(o,0,f,f+u.nodeSize,Ra(m,u,h+1,Kr)),o+=3}});let a=u0(o?f0(t):t,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Ze(a.length?this.local.concat(a).sort(Gr):this.local,i||this.children)}remove(e){return e.length==0||this==gt?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let a,u=r[o]+t,f=r[o+1]+t;for(let m=0,p;m<e.length;m++)(p=e[m])&&p.from>u&&p.to<f&&(e[m]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[o+2].removeInner(a,u+1);h!=gt?r[o+2]=h:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,a;o<e.length;o++)if(a=e[o])for(let u=0;u<i.length;u++)i[u].eq(a,t)&&(i==this.local&&(i=this.local.slice()),i.splice(u--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Ze(i,r):gt}forChild(e,t){if(this==gt)return this;if(t.isLeaf)return Ze.empty;let r,i;for(let u=0;u<this.children.length;u+=3)if(this.children[u]>=e){this.children[u]==e&&(r=this.children[u+2]);break}let o=e+1,a=o+t.content.size;for(let u=0;u<this.local.length;u++){let f=this.local[u];if(f.from<a&&f.to>o&&f.type instanceof Cr){let h=Math.max(o,f.from)-o,m=Math.min(a,f.to)-o;h<m&&(i||(i=[])).push(f.copy(h,m))}}if(i){let u=new Ze(i.sort(Gr),Pi);return r?new ri([u,r]):u}return r||gt}eq(e){if(this==e)return!0;if(!(e instanceof Ze)||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 tf(this.localsInner(e))}localsInner(e){if(this==gt)return Pi;if(e.inlineContent||!this.local.some(Cr.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Cr||t.push(this.local[r]);return t}}Ze.empty=new Ze([],[]),Ze.removeOverlap=tf;const gt=Ze.empty;class ri{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Kr));return ri.from(r)}forChild(e,t){if(t.isLeaf)return Ze.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,t);o!=gt&&(o instanceof ri?r=r.concat(o.members):r.push(o))}return ri.from(r)}eq(e){if(!(e instanceof ri)||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,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!t)t=o;else{r&&(t=t.slice(),r=!1);for(let a=0;a<o.length;a++)t.push(o[a])}}return t?tf(r?t:t.sort(Gr)):Pi}static from(e){switch(e.length){case 0:return gt;case 1:return e[0];default:return new ri(e.every(t=>t instanceof Ze)?e:e.reduce((t,r)=>t.concat(r instanceof Ze?r:r.members),[]))}}}function Tk(n,e,t,r,i,o,a){let u=n.slice();for(let h=0,m=o;h<t.maps.length;h++){let p=0;t.maps[h].forEach((b,S,E,g)=>{let _=g-E-(S-b);for(let x=0;x<u.length;x+=3){let k=u[x+1];if(k<0||b>k+m-p)continue;let A=u[x]+m-p;S>=A?u[x+1]=b<=A?-2:-1:E>=i&&_&&(u[x]+=_,u[x+1]+=_)}p+=_}),m=t.maps[h].map(m,-1)}let f=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){f=!0,u[h+1]=-1;continue}let m=t.map(n[h]+o),p=m-i;if(p<0||p>=r.content.size){f=!0;continue}let b=t.map(n[h+1]+o,-1),S=b-i,{index:E,offset:g}=r.content.findIndex(p),_=r.maybeChild(E);if(_&&g==p&&g+_.nodeSize==S){let x=u[h+2].mapInner(t,_,m+1,n[h]+o+1,a);x!=gt?(u[h]=p,u[h+1]=S,u[h+2]=x):(u[h+1]=-2,f=!0)}else f=!0}if(f){let h=Ok(u,n,e,t,i,o,a),m=Ra(h,r,0,a);e=m.local;for(let p=0;p<u.length;p+=3)u[p+1]<0&&(u.splice(p,3),p-=3);for(let p=0,b=0;p<m.children.length;p+=3){let S=m.children[p];for(;b<u.length&&u[b]<S;)b+=3;u.splice(b,0,m.children[p],m.children[p+1],m.children[p+2])}}return new Ze(e.sort(Gr),u)}function u0(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new Mn(i.from+e,i.to+e,i.type))}return t}function Ok(n,e,t,r,i,o,a){function u(f,h){for(let m=0;m<f.local.length;m++){let p=f.local[m].map(r,i,h);p?t.push(p):a.onRemove&&a.onRemove(f.local[m].spec)}for(let m=0;m<f.children.length;m+=3)u(f.children[m+2],f.children[m]+h+1)}for(let f=0;f<n.length;f+=3)n[f+1]==-1&&u(n[f+2],e[f]+o+1);return t}function c0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let o=0,a;o<n.length;o++)(a=n[o])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[o]=null);return i}function f0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ra(n,e,t,r){let i=[],o=!1;e.forEach((u,f)=>{let h=c0(n,u,f+t);if(h){o=!0;let m=Ra(h,u,t+f+1,r);m!=gt&&i.push(f,f+u.nodeSize,m)}});let a=u0(o?f0(n):n,-t).sort(Gr);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||(r.onRemove&&r.onRemove(a[u].spec),a.splice(u--,1));return a.length||i.length?new Ze(a,i):gt}function Gr(n,e){return n.from-e.from||n.to-e.to}function tf(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==n&&(e=n.slice()),e[i]=o.copy(o.from,r.to),h0(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,o.from),h0(e,i,r.copy(o.from,r.to)));break}}}return e}function h0(n,e,t){for(;e<n.length&&Gr(t,n[e])>0;)e++;n.splice(e,0,t)}for(var br={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:"'"},La={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},d0=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),Ik=typeof navigator<"u"&&/Mac/.test(navigator.platform),Nk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Rk=Ik||d0&&+d0[1]<57,it=0;it<10;it++)br[48+it]=br[96+it]=String(it);for(var it=1;it<=24;it++)br[it+111]="F"+it;for(var it=65;it<=90;it++)br[it]=String.fromCharCode(it+32),La[it]=String.fromCharCode(it);for(var nf in br)La.hasOwnProperty(nf)||(La[nf]=br[nf]);function Lk(n){var e=Rk&&(n.ctrlKey||n.altKey||n.metaKey)||Nk&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?La:br)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Pk=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Dk(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u++){let f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))Pk?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+f)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),o&&(t="Shift-"+t),t}function Fk(n){let e=Object.create(null);for(let t in n)e[Dk(t)]=n[t];return e}function rf(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}function zk(n){return new Rt({props:{handleKeyDown:Bk(n)}})}function Bk(n){let e=Fk(n);return function(t,r){let i=Lk(r),o=i.length==1&&i!=" ",a,u=e[rf(i,r,!o)];if(u&&u(t.state,t.dispatch,t))return!0;if(o&&(r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(a=br[r.keyCode])&&a!=i){let f=e[rf(a,r,!0)];if(f&&f(t.state,t.dispatch,t))return!0}else if(o&&r.shiftKey){let f=e[rf(i,r,!0)];if(f&&f(t.state,t.dispatch,t))return!0}return!1}}const $k=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Hk(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Vk=(n,e,t)=>{let r=Hk(n,t);if(!r)return!1;let i=p0(r);if(!i){let a=r.blockRange(),u=a&&Mi(a);return u==null?!1:(e&&e(n.tr.lift(a,u).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&y0(n,i,e))return!0;if(r.parent.content.size==0&&(Di(o,"end")||ee.isSelectable(o))){let a=Pc(n.doc,r.before(),r.after(),K.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=n.tr.step(a);u.setSelection(Di(o,"end")?ge.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):ee.create(u.doc,i.pos-o.nodeSize)),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1};function Di(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Wk=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=p0(r)}let a=o&&o.nodeBefore;return!a||!ee.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function p0(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Uk(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const qk=(n,e,t)=>{let r=Uk(n,t);if(!r)return!1;let i=m0(r);if(!i)return!1;let o=i.nodeAfter;if(y0(n,i,e))return!0;if(r.parent.content.size==0&&(Di(o,"start")||ee.isSelectable(o))){let a=Pc(n.doc,r.before(),r.after(),K.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=n.tr.step(a);u.setSelection(Di(o,"start")?ge.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):ee.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Kk=(n,e,t)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=m0(r)}let a=o&&o.nodeAfter;return!a||!ee.isSelectable(a)?!1:(e&&e(n.tr.setSelection(ee.create(n.doc,o.pos)).scrollIntoView()),!0)};function m0(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Gk=(n,e)=>{let t=n.selection,r=t instanceof ee,i;if(r){if(t.node.isTextblock||!pr(n.doc,t.from))return!1;i=t.from}else if(i=ka(n.doc,t.from,-1),i==null)return!1;if(e){let o=n.tr.join(i);r&&o.setSelection(ee.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Jk=(n,e)=>{let t=n.selection,r;if(t instanceof ee){if(t.node.isTextblock||!pr(n.doc,t.to))return!1;r=t.to}else if(r=ka(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},jk=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),o=i&&Mi(i);return o==null?!1:(e&&e(n.tr.lift(i,o).scrollIntoView()),!0)},Yk=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
33
+ `).scrollIntoView()),!0)};function g0(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Xk=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),o=t.indexAfter(-1),a=g0(i.contentMatchAt(o));if(!a||!i.canReplaceWith(o,o,a))return!1;if(e){let u=t.after(),f=n.tr.replaceWith(u,u,a.createAndFill());f.setSelection(ge.near(f.doc.resolve(u),1)),e(f.scrollIntoView())}return!0},Zk=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof mn||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=g0(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=n.tr.insert(a,o.createAndFill());u.setSelection(ye.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},Qk=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let o=t.before();if(Ti(n.doc,o))return e&&e(n.tr.split(o).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Mi(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},eA=(n,e)=>{let{$from:t,to:r}=n.selection,i,o=t.sharedDepth(r);return o==0?!1:(i=t.before(o),e&&e(n.tr.setSelection(ee.create(n.doc,i))),!0)};function tA(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||pr(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function y0(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,o,a;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(tA(n,e,t))return!0;let u=e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(t){let p=e.pos+i.nodeSize,b=z.empty;for(let g=o.length-1;g>=0;g--)b=z.from(o[g].create(null,b));b=z.from(r.copy(b));let S=n.tr.step(new Xe(e.pos-1,p,e.pos,p,new K(b,1,0),o.length,!0)),E=p+2*o.length;pr(S.doc,E)&&S.join(E),t(S.scrollIntoView())}return!0}let f=ge.findFrom(e,1),h=f&&f.$from.blockRange(f.$to),m=h&&Mi(h);if(m!=null&&m>=e.depth)return t&&t(n.tr.lift(h,m).scrollIntoView()),!0;if(u&&Di(i,"start",!0)&&Di(r,"end")){let p=r,b=[];for(;b.push(p),!p.isTextblock;)p=p.lastChild;let S=i,E=1;for(;!S.isTextblock;S=S.firstChild)E++;if(p.canReplace(p.childCount,p.childCount,S.content)){if(t){let g=z.empty;for(let x=b.length-1;x>=0;x--)g=z.from(b[x].copy(g));let _=n.tr.step(new Xe(e.pos-b.length,e.pos+i.nodeSize,e.pos+E,e.pos+i.nodeSize-E,new K(g,b.length,0),0,!0));t(_.scrollIntoView())}return!0}}return!1}function b0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(t&&t(e.tr.setSelection(ye.create(e.doc,n<0?i.start(o):i.end(o)))),!0):!1}}const nA=b0(-1),rA=b0(1);function iA(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),u=a&&Lc(a,n,e);return u?(r&&r(t.tr.wrap(a,u).scrollIntoView()),!0):!1}}function _0(n,e=null){return function(t,r){let i=!1;for(let o=0;o<t.selection.ranges.length&&!i;o++){let{$from:{pos:a},$to:{pos:u}}=t.selection.ranges[o];t.doc.nodesBetween(a,u,(f,h)=>{if(i)return!1;if(!(!f.isTextblock||f.hasMarkup(n,e)))if(f.type==n)i=!0;else{let m=t.doc.resolve(h),p=m.index();i=m.parent.canReplaceWith(p,p+1,n)}})}if(!i)return!1;if(r){let o=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:f}}=t.selection.ranges[a];o.setBlockType(u,f,n,e)}r(o.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function sA(n,e=null){return function(t,r){let{$from:i,$to:o}=t.selection,a=i.blockRange(o),u=!1,f=a;if(!a)return!1;if(a.depth>=2&&i.node(a.depth-1).type.compatibleContent(n)&&a.startIndex==0){if(i.index(a.depth-1)==0)return!1;let m=t.doc.resolve(a.start-2);f=new wa(m,m,a.depth),a.endIndex<a.parent.childCount&&(a=new wa(i,t.doc.resolve(o.end(a.depth)),a.depth)),u=!0}let h=Lc(f,n,e,a);return h?(r&&r(oA(t.tr,a,h,u,n).scrollIntoView()),!0):!1}}function oA(n,e,t,r,i){let o=z.empty;for(let m=t.length-1;m>=0;m--)o=z.from(t[m].type.create(t[m].attrs,o));n.step(new Xe(e.start-(r?2:0),e.end,e.start,e.end,new K(o,0,0),t.length,!0));let a=0;for(let m=0;m<t.length;m++)t[m].type==i&&(a=m+1);let u=t.length-a,f=e.start+t.length-(r?2:0),h=e.parent;for(let m=e.startIndex,p=e.endIndex,b=!0;m<p;m++,b=!1)!b&&Ti(n.doc,f,u)&&(n.split(f,u),f+=2*u),f+=h.child(m).nodeSize;return n}function aA(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return o?t?r.node(o.depth-1).type==n?lA(e,t,n,o):uA(e,t,o):!0:!1}}function lA(n,e,t,r){let i=n.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new Xe(o-1,a,o,a,new K(z.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new wa(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Mi(r);if(u==null)return!1;i.lift(r,u);let f=i.mapping.map(o,-1)-1;return pr(i.doc,f)&&i.join(f),e(i.scrollIntoView()),!0}function uA(n,e,t){let r=n.tr,i=t.parent;for(let S=t.end,E=t.endIndex-1,g=t.startIndex;E>g;E--)S-=i.child(E).nodeSize,r.delete(S-1,S+1);let o=r.doc.resolve(t.start),a=o.nodeAfter;if(r.mapping.map(t.end)!=t.start+o.nodeAfter.nodeSize)return!1;let u=t.startIndex==0,f=t.endIndex==i.childCount,h=o.node(-1),m=o.index(-1);if(!h.canReplace(m+(u?0:1),m+1,a.content.append(f?z.empty:z.from(i))))return!1;let p=o.pos,b=p+a.nodeSize;return r.step(new Xe(p-(u?1:0),b+(f?1:0),p+1,b-1,new K((u?z.empty:z.from(i.copy(z.empty))).append(f?z.empty:z.from(i.copy(z.empty))),u?0:1,f?0:1),u?0:1)),e(r.scrollIntoView()),!0}function cA(n){return function(e,t){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!o)return!1;let a=o.startIndex;if(a==0)return!1;let u=o.parent,f=u.child(a-1);if(f.type!=n)return!1;if(t){let h=f.lastChild&&f.lastChild.type==u.type,m=z.from(h?n.create():null),p=new K(z.from(n.create(null,z.from(u.type.create(null,m)))),h?3:1,0),b=o.start,S=o.end;t(e.tr.step(new Xe(b-(h?3:1),S,b,S,p,1,!0)).scrollIntoView())}return!0}}function Pa(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,o=t.storedMarks,t}}}class sf{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:r}=this,{view:i}=t,{tr:o}=r,a=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([u,f])=>[u,(...m)=>{const p=f(...m)(a);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u=[],f=!!e,h=e||o.tr,m=()=>(!f&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),u.every(b=>b===!0)),p={...Object.fromEntries(Object.entries(r).map(([b,S])=>[b,(...g)=>{const _=this.buildProps(h,t),x=S(...g)(_);return u.push(x),p}])),run:m};return p}createCan(e){const{rawCommands:t,state:r}=this,i=!1,o=e||r.tr,a=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(t).map(([f,h])=>[f,(...m)=>h(...m)({...a,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:o}=this,{view:a}=i,u={tr:e,editor:i,view:a,state:Pa({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>h(...m)(u)]))}};return u}}function G(n,e,t){return n.config[e]===void 0&&n.parent?G(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?G(n.parent,e,t):null}):n.config[e]}function Da(n){const e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function v0(n){const e=[],{nodeExtensions:t,markExtensions:r}=Da(n),i=[...t,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},f=G(a,"addGlobalAttributes",u);if(!f)return;f().forEach(m=>{m.types.forEach(p=>{Object.entries(m.attributes).forEach(([b,S])=>{e.push({type:p,name:b,attribute:{...o,...S}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},f=G(a,"addAttributes",u);if(!f)return;const h=f();Object.entries(h).forEach(([m,p])=>{const b={...o,...p};typeof b?.default=="function"&&(b.default=b.default()),b?.isRequired&&b?.default===void 0&&delete b.default,e.push({type:a.name,name:m,attribute:b})})}),e}function Je(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Fi(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const u=o?o.split(" "):[],f=r[i]?r[i].split(" "):[],h=u.filter(m=>!f.includes(m));r[i]=[...f,...h].join(" ")}else i==="style"?r[i]=[r[i],o].join("; "):r[i]=o}),r},{})}function of(n,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Fi(t,r),{})}function fA(n){return typeof n=="function"}function ue(n,e=void 0,...t){return fA(n)?e?n.bind(e)(...t):n(...t):n}function hA(n={}){return Object.keys(n).length===0&&n.constructor===Object}function dA(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function w0(n,e){return n.style?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((o,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(t):dA(t.getAttribute(a.name));return u==null?o:{...o,[a.name]:u}},{});return{...r,...i}}}}function S0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&hA(t)?!1:t!=null))}function x0(n,e){var t;const r=v0(n),{nodeExtensions:i,markExtensions:o}=Da(n),a=(t=i.find(h=>G(h,"topNode")))===null||t===void 0?void 0:t.name,u=Object.fromEntries(i.map(h=>{const m=r.filter(x=>x.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},b=n.reduce((x,k)=>{const A=G(k,"extendNodeSchema",p);return{...x,...A?A(h):{}}},{}),S=S0({...b,content:ue(G(h,"content",p)),marks:ue(G(h,"marks",p)),group:ue(G(h,"group",p)),inline:ue(G(h,"inline",p)),atom:ue(G(h,"atom",p)),selectable:ue(G(h,"selectable",p)),draggable:ue(G(h,"draggable",p)),code:ue(G(h,"code",p)),defining:ue(G(h,"defining",p)),isolating:ue(G(h,"isolating",p)),attrs:Object.fromEntries(m.map(x=>{var k;return[x.name,{default:(k=x?.attribute)===null||k===void 0?void 0:k.default}]}))}),E=ue(G(h,"parseHTML",p));E&&(S.parseDOM=E.map(x=>w0(x,m)));const g=G(h,"renderHTML",p);g&&(S.toDOM=x=>g({node:x,HTMLAttributes:of(x,m)}));const _=G(h,"renderText",p);return _&&(S.toText=_),[h.name,S]})),f=Object.fromEntries(o.map(h=>{const m=r.filter(_=>_.type===h.name),p={name:h.name,options:h.options,storage:h.storage,editor:e},b=n.reduce((_,x)=>{const k=G(x,"extendMarkSchema",p);return{..._,...k?k(h):{}}},{}),S=S0({...b,inclusive:ue(G(h,"inclusive",p)),excludes:ue(G(h,"excludes",p)),group:ue(G(h,"group",p)),spanning:ue(G(h,"spanning",p)),code:ue(G(h,"code",p)),attrs:Object.fromEntries(m.map(_=>{var x;return[_.name,{default:(x=_?.attribute)===null||x===void 0?void 0:x.default}]}))}),E=ue(G(h,"parseHTML",p));E&&(S.parseDOM=E.map(_=>w0(_,m)));const g=G(h,"renderHTML",p);return g&&(S.toDOM=_=>g({mark:_,HTMLAttributes:of(_,m)})),[h.name,S]}));return new yC({topNode:a,nodes:u,marks:f})}function af(n,e){return e.nodes[n]||e.marks[n]||null}function E0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}const pA=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,o,a,u)=>{var f,h;const m=((h=(f=i.type.spec).toText)===null||h===void 0?void 0:h.call(f,{node:i,pos:o,parent:a,index:u}))||i.textContent||"%leaf%";t+=m.slice(0,Math.max(0,r-o))}),t};function lf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class C0{constructor(e){this.find=e.find,this.handler=e.handler}}const mA=(n,e)=>{if(lf(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function uf(n){var e;const{editor:t,from:r,to:i,text:o,rules:a,plugin:u}=n,{view:f}=t;if(f.composing)return!1;const h=f.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(b=>b.type.spec.code))return!1;let m=!1;const p=pA(h)+o;return a.forEach(b=>{if(m)return;const S=mA(p,b.find);if(!S)return;const E=f.state.tr,g=Pa({state:f.state,transaction:E}),_={from:r-(S[0].length-o.length),to:i},{commands:x,chain:k,can:A}=new sf({editor:t,state:g});b.handler({state:g,range:_,match:S,commands:x,chain:k,can:A})===null||!E.steps.length||(E.setMeta(u,{transform:E,from:r,to:i,text:o}),f.dispatch(E),m=!0)}),m}function gA(n){const{editor:e,rules:t}=n,r=new Rt({state:{init(){return null},apply(i,o){const a=i.getMeta(r);return a||(i.selectionSet||i.docChanged?null:o)}},props:{handleTextInput(i,o,a,u){return uf({editor:e,from:o,to:a,text:u,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&uf({editor:e,from:o.pos,to:o.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?uf({editor:e,from:a.pos,to:a.pos,text:`
34
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function yA(n){return typeof n=="number"}class bA{constructor(e){this.find=e.find,this.handler=e.handler}}const _A=(n,e)=>{if(lf(e))return[...n.matchAll(e)];const t=e(n);return t?t.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function vA(n){const{editor:e,state:t,from:r,to:i,rule:o,pasteEvent:a,dropEvent:u}=n,{commands:f,chain:h,can:m}=new sf({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,i,(S,E)=>{if(!S.isTextblock||S.type.spec.code)return;const g=Math.max(r,E),_=Math.min(i,E+S.content.size),x=S.textBetween(g-E,_-E,void 0,"\uFFFC");_A(x,o.find).forEach(A=>{if(A.index===void 0)return;const N=g+A.index+1,V=N+A[0].length,L={from:t.tr.mapping.map(N),to:t.tr.mapping.map(V)},U=o.handler({state:t,range:L,match:A,commands:f,chain:h,can:m,pasteEvent:a,dropEvent:u});p.push(U)})}),p.every(S=>S!==null)}function wA(n){const{editor:e,rules:t}=n;let r=null,i=!1,o=!1,a=new ClipboardEvent("paste"),u=new DragEvent("drop");return t.map(h=>new Rt({view(m){const p=b=>{var S;r=!((S=m.dom.parentElement)===null||S===void 0)&&S.contains(b.target)?m.dom.parentElement:null};return window.addEventListener("dragstart",p),{destroy(){window.removeEventListener("dragstart",p)}}},props:{handleDOMEvents:{drop:(m,p)=>(o=r===m.dom.parentElement,u=p,!1),paste:(m,p)=>{var b;const S=(b=p.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return a=p,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,p,b)=>{const S=m[0],E=S.getMeta("uiEvent")==="paste"&&!i,g=S.getMeta("uiEvent")==="drop"&&!o;if(!E&&!g)return;const _=p.doc.content.findDiffStart(b.doc.content),x=p.doc.content.findDiffEnd(b.doc.content);if(!yA(_)||!x||_===x.b)return;const k=b.tr,A=Pa({state:b,transaction:k});if(!(!vA({editor:e,state:A,from:Math.max(_-1,0),to:x.b-1,rule:h,pasteEvent:a,dropEvent:u})||!k.steps.length))return u=new DragEvent("drop"),a=new ClipboardEvent("paste"),k}}))}function SA(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class Gi{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Gi.resolve(e),this.schema=x0(this.extensions,t),this.extensions.forEach(r=>{var i;this.editor.extensionStorage[r.name]=r.storage;const o={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:af(r.name,this.schema)};r.type==="mark"&&(!((i=ue(G(r,"keepOnSplit",o)))!==null&&i!==void 0)||i)&&this.splittableMarks.push(r.name);const a=G(r,"onBeforeCreate",o);a&&this.editor.on("beforeCreate",a);const u=G(r,"onCreate",o);u&&this.editor.on("create",u);const f=G(r,"onUpdate",o);f&&this.editor.on("update",f);const h=G(r,"onSelectionUpdate",o);h&&this.editor.on("selectionUpdate",h);const m=G(r,"onTransaction",o);m&&this.editor.on("transaction",m);const p=G(r,"onFocus",o);p&&this.editor.on("focus",p);const b=G(r,"onBlur",o);b&&this.editor.on("blur",b);const S=G(r,"onDestroy",o);S&&this.editor.on("destroy",S)})}static resolve(e){const t=Gi.sort(Gi.flatten(e)),r=SA(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=G(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const o=G(r,"priority")||100,a=G(i,"priority")||100;return o>a?-1:o<a?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:af(t.name,this.schema)},i=G(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Gi.sort([...this.extensions].reverse()),r=[],i=[],o=t.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:e,type:af(a.name,this.schema)},f=[],h=G(a,"addKeyboardShortcuts",u);let m={};if(a.type==="mark"&&a.config.exitable&&(m.ArrowRight=()=>Pt.handleExit({editor:e,mark:a})),h){const g=Object.fromEntries(Object.entries(h()).map(([_,x])=>[_,()=>x({editor:e})]));m={...m,...g}}const p=zk(m);f.push(p);const b=G(a,"addInputRules",u);E0(a,e.options.enableInputRules)&&b&&r.push(...b());const S=G(a,"addPasteRules",u);E0(a,e.options.enablePasteRules)&&S&&i.push(...S());const E=G(a,"addProseMirrorPlugins",u);if(E){const g=E();f.push(...g)}return f}).flat();return[gA({editor:e,rules:r}),...wA({editor:e,rules:i}),...o]}get attributes(){return v0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Da(this.extensions);return Object.fromEntries(t.filter(r=>!!G(r,"addNodeView")).map(r=>{const i=this.attributes.filter(f=>f.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:e,type:Je(r.name,this.schema)},a=G(r,"addNodeView",o);if(!a)return[];const u=(f,h,m,p)=>{const b=of(f,i);return a()({editor:e,node:f,getPos:m,decorations:p,HTMLAttributes:b,extension:r})};return[r.name,u]}))}}function xA(n){return Object.prototype.toString.call(n).slice(8,-1)}function cf(n){return xA(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Fa(n,e){const t={...n};return cf(n)&&cf(e)&&Object.keys(e).forEach(r=>{cf(e[r])?r in n?t[r]=Fa(n[r],e[r]):Object.assign(t,{[r]:e[r]}):Object.assign(t,{[r]:e[r]})}),t}class De{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new De(e)}configure(e={}){const t=this.extend();return t.options=Fa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new De(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}}function EA(n,e,t){const{from:r,to:i}=e,{blockSeparator:o=`
35
35
 
36
- `,textSerializers:a={}}=t||{};let u="",f=!0;return n.nodesBetween(r,i,(h,m,p,b)=>{var S;const k=a?.[h.type.name];k?(h.isBlock&&!f&&(u+=o,f=!0),p&&(u+=k({node:h,pos:m,parent:p,index:b,range:e}))):h.isText?(u+=(S=h?.text)===null||S===void 0?void 0:S.slice(Math.max(r,m)-m,i-m),f=!1):h.isBlock&&!f&&(u+=o,f=!0)}),u}function ZE(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Re.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),u=Math.max(...o.map(m=>m.$to.pos)),f=ZE(t);return XE(r,{from:a,to:u},{textSerializers:f})}}})]}});const QE=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),eA=(n=!1)=>({commands:e})=>e.setContent("",n),tA=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(u,f)=>{if(u.type.isText)return;const{doc:h,mapping:m}=e,p=h.resolve(m.map(f)),b=h.resolve(m.map(f+u.nodeSize)),S=p.blockRange(b);if(!S)return;const k=Ci(S);if(u.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(S.start,g)}(k||k===0)&&e.lift(S,k)})}),!0},nA=n=>e=>n(e),rA=()=>({state:n,dispatch:e})=>l0(n,e),iA=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new pe(r.doc.resolve(a-1))),!0},sA=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const u=i.before(o),f=i.after(o);n.delete(u,f).scrollIntoView()}return!0}return!1},oA=n=>({tr:e,state:t,dispatch:r})=>{const i=Ue(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},aA=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},lA=()=>({state:n,dispatch:e})=>Gc(n,e),uA=()=>({commands:n})=>n.keyboardShortcut("Enter"),cA=()=>({state:n,dispatch:e})=>kE(n,e);function Ia(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Qc(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function nf(n,e,t={}){return n.find(r=>r.type===e&&Ia(r.attrs,t))}function fA(n,e,t={}){return!!nf(n,e,t)}function rf(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=nf([...r.node.marks],e,t);if(!i)return;let o=r.index,a=n.start()+r.offset,u=o+1,f=a+r.node.nodeSize;for(nf([...r.node.marks],e,t);o>0&&i.isInSet(n.parent.child(o-1).marks);)o-=1,a-=n.parent.child(o).nodeSize;for(;u<n.parent.childCount&&fA([...n.parent.child(u).marks],e,t);)f+=n.parent.child(u).nodeSize,u+=1;return{from:a,to:f}}function mn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const hA=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=mn(n,r.schema),{doc:a,selection:u}=t,{$from:f,from:h,to:m}=u;if(i){const p=rf(f,o,e);if(p&&p.from<=h&&p.to>=m){const b=pe.create(a,p.from,p.to);t.setSelection(b)}}return!0},dA=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function _0(n){return n instanceof pe}function qr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function pA(n,e=null){if(!e)return null;const t=ye.atStart(n),r=ye.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?pe.create(n,qr(0,i,o),qr(n.content.size,i,o)):pe.create(n,qr(e,i,o),qr(e,i,o))}function sf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const mA=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{sf()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!_0(t.state.selection))return a(),!0;const u=pA(i.doc,n)||t.state.selection,f=t.state.selection.eq(u);return o&&(f||i.setSelection(u),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},gA=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),yA=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e);function v0(n){const e=`<body>${n}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function Na(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?z.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Na("",e,t)}if(typeof n=="string"){const r=yc.fromSchema(e);return t.slice?r.parseSlice(v0(n),t.parseOptions).content:r.parse(v0(n),t.parseOptions)}return Na("",e,t)}function bA(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof st||i instanceof Ge))return;const o=n.mapping.maps[r];let a=0;o.forEach((u,f,h,m)=>{a===0&&(a=m)}),n.setSelection(ye.near(n.doc.resolve(a),t))}const _A=n=>n.toString().startsWith("<"),vA=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const a=Na(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(a.toString()==="<>")return!0;let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,m=!0;if((_A(a)?a:[a]).forEach(b=>{b.check(),h=h?b.isText&&b.marks.length===0:!1,m=m?b.isBlock:!1}),u===f&&m){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,f+=1)}h?Array.isArray(e)?r.insertText(e.map(b=>b.text||"").join(""),u,f):typeof e=="object"&&e&&e.text?r.insertText(e.text,u,f):r.insertText(e,u,f):r.replaceWith(u,f,a),t.updateSelection&&bA(r,r.steps.length-1,-1)}return!0},wA=()=>({state:n,dispatch:e})=>wE(n,e),SA=()=>({state:n,dispatch:e})=>SE(n,e),xA=()=>({state:n,dispatch:e})=>t0(n,e),kA=()=>({state:n,dispatch:e})=>i0(n,e),CA=()=>({tr:n,state:e,dispatch:t})=>{try{const r=_a(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},EA=()=>({state:n,dispatch:e,tr:t})=>{try{const r=_a(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}};function w0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function AA(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u+=1){const f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))sf()||w0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const MA=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=AA(n).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,u))});return f?.steps.forEach(h=>{const m=h.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function of(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?Ue(e,n.schema):null,u=[];n.doc.nodesBetween(r,i,(p,b)=>{if(p.isText)return;const S=Math.max(r,b),k=Math.min(i,b+p.nodeSize);u.push({node:p,from:S,to:k})});const f=i-r,h=u.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>Ia(p.node.attrs,t,{strict:!1}));return o?!!h.length:h.reduce((p,b)=>p+b.to-b.from,0)>=f}const TA=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return of(t,i,e)?xE(t,r):!1},OA=()=>({state:n,dispatch:e})=>u0(n,e),IA=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return LE(r)(e,t)},NA=()=>({state:n,dispatch:e})=>a0(n,e);function af(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function S0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const RA=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=af(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=Ue(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{o&&o===h.type&&t.setNodeMarkup(m,void 0,S0(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(p=>{a===p.type&&t.addMark(m,m+h.nodeSize,a.create(S0(p.attrs,e)))})})}),!0):!1},LA=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),PA=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),DA=()=>({state:n,dispatch:e})=>n0(n,e),FA=()=>({state:n,dispatch:e})=>s0(n,e),zA=()=>({state:n,dispatch:e})=>AE(n,e),BA=()=>({state:n,dispatch:e})=>OE(n,e),$A=()=>({state:n,dispatch:e})=>TE(n,e);function HA(n,e,t={}){return Na(n,e,{slice:!1,parseOptions:t})}const WA=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,u=HA(n,i.schema,t);return o&&r.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!e),!0};function x0(n,e){const t=mn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const u=a.find(f=>f.type.name===t.name);return u?{...u.attrs}:{}}function VA(n,e){const t=new EC(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function UA(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function qA(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function KA(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function lf(n){return e=>KA(e.$from,n)}function GA(n,e){const t=Vi.resolve(n);return g0(t,e)}function JA(n,e){const t=Ue(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===t.name);return a?{...a.attrs}:{}}function jA(n,e){const t=af(typeof e=="string"?e:e.name,n.schema);return t==="node"?JA(n,e):t==="mark"?x0(n,e):{}}function YA(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function XA(n){const e=YA(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function ZA(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((u,f)=>{a.push({from:u,to:f})});else{const{from:u,to:f}=t[o];if(u===void 0||f===void 0)return;a.push({from:u,to:f})}a.forEach(({from:u,to:f})=>{const h=e.slice(o).map(u,-1),m=e.slice(o).map(f),p=e.invert().map(h,-1),b=e.invert().map(m);r.push({oldRange:{from:p,to:b},newRange:{from:h,to:m}})})}),XA(r)}function k0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n-1),a=rf(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function Ra(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function QA(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?mn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>Ia(p.attrs,t,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:p,$to:b})=>{const S=p.pos,k=b.pos;n.doc.nodesBetween(S,k,(g,_)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(S,_),E=Math.min(k,_+g.nodeSize),A=E-x;a+=A,u.push(...g.marks.map(N=>({mark:N,from:x,to:E})))})}),a===0)return!1;const f=u.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>Ia(p.mark.attrs,t,{strict:!1})).reduce((p,b)=>p+b.to-b.from,0),h=u.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,b)=>p+b.to-b.from,0);return(f>0?f+h:f)>=a}function C0(n,e){const{nodeExtensions:t}=Ta(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=ue(G(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function eM(n,e,t){var r;const{selection:i}=e;let o=null;if(_0(i)&&(o=i.$cursor),o){const u=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(u)||!u.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:u,$to:f})=>{let h=u.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(u.pos,f.pos,(m,p,b)=>{if(h)return!1;if(m.isInline){const S=!b||b.type.allowsMarkType(t),k=!!t.isInSet(m.marks)||!m.marks.some(g=>g.type.excludes(t));h=S&&k}return!h}),h})}const tM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:u}=o,f=mn(n,r.schema);if(i)if(a){const h=x0(r,f);t.addStoredMark(f.create({...h,...e}))}else u.forEach(h=>{const m=h.$from.pos,p=h.$to.pos;r.doc.nodesBetween(m,p,(b,S)=>{const k=Math.max(S,m),g=Math.min(S+b.nodeSize,p);b.marks.find(x=>x.type===f)?b.marks.forEach(x=>{f===x.type&&t.addMark(k,g,f.create({...x.attrs,...e}))}):t.addMark(k,g,f.create(e))})});return eM(r,t,f)},nM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),rM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Ue(n,t.schema);return o.isTextblock?i().command(({commands:a})=>h0(o,e)(t)?!0:a.clearNodes()).command(({state:a})=>h0(o,e)(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},iM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=qr(n,0,r.content.size),o=ee.create(r,i);e.setSelection(o)}return!0},sM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=pe.atStart(r).from,u=pe.atEnd(r).to,f=qr(i,a,u),h=qr(o,a,u),m=pe.create(r,f,h);e.setSelection(m)}return!0},oM=n=>({state:e,dispatch:t})=>{const r=Ue(n,e.schema);return FE(r)(e,t)};function E0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const aM=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:u,$to:f}=o,h=i.extensionManager.attributes,m=Ra(h,u.node().type.name,u.node().attrs);if(o instanceof ee&&o.node.isBlock)return!u.parentOffset||!Bn(a,u.pos)?!1:(r&&(n&&E0(t,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;if(r){const p=f.parentOffset===f.parent.content.size;o instanceof pe&&e.deleteSelection();const b=u.depth===0?void 0:UA(u.node(-1).contentMatchAt(u.indexAfter(-1)));let S=p&&b?[{type:b,attrs:m}]:void 0,k=Bn(e.doc,e.mapping.map(u.pos),1,S);if(!S&&!k&&Bn(e.doc,e.mapping.map(u.pos),1,b?[{type:b}]:void 0)&&(k=!0,S=b?[{type:b,attrs:m}]:void 0),k&&(e.split(e.mapping.map(u.pos),1,S),b&&!p&&!u.parentOffset&&u.parent.type!==b)){const g=e.mapping.map(u.before()),_=e.doc.resolve(g);u.node(-1).canReplaceWith(_.index(),_.index()+1,b)&&e.setNodeMarkup(e.mapping.map(u.before()),b)}n&&E0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},lM=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var o;const a=Ue(n,t.schema),{$from:u,$to:f}=t.selection,h=t.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==a)return!1;const p=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let _=z.empty;const x=u.index(-1)?1:u.index(-2)?2:3;for(let U=u.depth-x;U>=u.depth-3;U-=1)_=z.from(u.node(U).copy(_));const E=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,A=Ra(p,u.node().type.name,u.node().attrs),N=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(A))||void 0;_=_.append(z.from(a.createAndFill(null,N)||void 0));const W=u.before(u.depth-(x-1));e.replace(W,u.after(-E),new K(_,4-x,0));let L=-1;e.doc.nodesBetween(W,e.doc.content.size,(U,j)=>{if(L>-1)return!1;U.isTextblock&&U.content.size===0&&(L=j+1)}),L>-1&&e.setSelection(pe.near(e.doc.resolve(L))),e.scrollIntoView()}return!0}const b=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,S=Ra(p,m.type.name,m.attrs),k=Ra(p,u.node().type.name,u.node().attrs);e.delete(u.pos,f.pos);const g=b?[{type:a,attrs:S},{type:b,attrs:k}]:[{type:a,attrs:S}];if(!Bn(e.doc,u.pos,2))return!1;if(r){const{selection:_,storedMarks:x}=t,{splittableMarks:E}=i.extensionManager,A=x||_.$to.parentOffset&&_.$from.marks();if(e.split(u.pos,2,g).scrollIntoView(),!A||!r)return!0;const N=A.filter(W=>E.includes(W.type.name));e.ensureMarks(N)}return!0},uf=(n,e)=>{const t=lf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&hr(n.doc,t.pos)&&n.join(t.pos),!0},cf=(n,e)=>{const t=lf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&hr(n.doc,r)&&n.join(r),!0},uM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:u,chain:f,commands:h,can:m})=>{const{extensions:p,splittableMarks:b}=i.extensionManager,S=Ue(n,a.schema),k=Ue(e,a.schema),{selection:g,storedMarks:_}=a,{$from:x,$to:E}=g,A=x.blockRange(E),N=_||g.$to.parentOffset&&g.$from.marks();if(!A)return!1;const W=lf(L=>C0(L.type.name,p))(g);if(A.depth>=1&&W&&A.depth-W.depth<=1){if(W.node.type===S)return h.liftListItem(k);if(C0(W.node.type.name,p)&&S.validContent(W.node.content)&&u)return f().command(()=>(o.setNodeMarkup(W.pos,S),!0)).command(()=>uf(o,S)).command(()=>cf(o,S)).run()}return!t||!N||!u?f().command(()=>m().wrapInList(S,r)?!0:h.clearNodes()).wrapInList(S,r).command(()=>uf(o,S)).command(()=>cf(o,S)).run():f().command(()=>{const L=m().wrapInList(S,r),U=N.filter(j=>b.includes(j.type.name));return o.ensureMarks(U),L?!0:h.clearNodes()}).wrapInList(S,r).command(()=>uf(o,S)).command(()=>cf(o,S)).run()},cM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=mn(n,r.schema);return QA(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},fM=(n,e,t={})=>({state:r,commands:i})=>{const o=Ue(n,r.schema),a=Ue(e,r.schema);return of(r,o,t)?i.setNode(a):i.setNode(o,t)},hM=(n,e={})=>({state:t,commands:r})=>{const i=Ue(n,t.schema);return of(t,i,e)?r.lift(i):r.wrapIn(i,e)},dM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,u=o.transform;for(let f=u.steps.length-1;f>=0;f-=1)a.step(u.steps[f].invert(u.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},pM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},mM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=t,f=mn(n,r.schema),{$from:h,empty:m,ranges:p}=u;if(!i)return!0;if(m&&a){let{from:b,to:S}=u;const k=(o=h.marks().find(_=>_.type===f))===null||o===void 0?void 0:o.attrs,g=rf(h,f,k);g&&(b=g.from,S=g.to),t.removeMark(b,S,f)}else p.forEach(b=>{t.removeMark(b.$from.pos,b.$to.pos,f)});return t.removeStoredMark(f),!0},gM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=af(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=Ue(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(p,b)=>{o&&o===p.type&&t.setNodeMarkup(b,void 0,{...p.attrs,...e}),a&&p.marks.length&&p.marks.forEach(S=>{if(a===S.type){const k=Math.max(b,h),g=Math.min(b+p.nodeSize,m);t.addMark(k,g,a.create({...S.attrs,...e}))}})})}),!0):!1},yM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return IE(i,e)(t,r)},bM=(n,e={})=>({state:t,dispatch:r})=>{const i=Ue(n,t.schema);return NE(i,e)(t,r)};var _M=Object.freeze({__proto__:null,blur:QE,clearContent:eA,clearNodes:tA,command:nA,createParagraphNear:rA,cut:iA,deleteCurrentNode:sA,deleteNode:oA,deleteRange:aA,deleteSelection:lA,enter:uA,exitCode:cA,extendMarkRange:hA,first:dA,focus:mA,forEach:gA,insertContent:yA,insertContentAt:vA,joinUp:wA,joinDown:SA,joinBackward:xA,joinForward:kA,joinItemBackward:CA,joinItemForward:EA,keyboardShortcut:MA,lift:TA,liftEmptyBlock:OA,liftListItem:IA,newlineInCode:NA,resetAttributes:RA,scrollIntoView:LA,selectAll:PA,selectNodeBackward:DA,selectNodeForward:FA,selectParentNode:zA,selectTextblockEnd:BA,selectTextblockStart:$A,setContent:WA,setMark:tM,setMeta:nM,setNode:rM,setNodeSelection:iM,setTextSelection:sM,sinkListItem:oM,splitBlock:aM,splitListItem:lM,toggleList:uM,toggleMark:cM,toggleNode:fM,toggleWrap:hM,undoInputRule:dM,unsetAllMarks:pM,unsetMark:mM,updateAttributes:gM,wrapIn:yM,wrapInList:bM});Re.create({name:"commands",addCommands(){return{..._M}}}),Re.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Re.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Ot({key:new an("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Re.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:f,doc:h}=u,{empty:m,$anchor:p}=f,{pos:b,parent:S}=p,k=p.parent.isTextblock?u.doc.resolve(b-1):p,g=k.parent.type.spec.isolating,_=p.pos-p.parentOffset,x=g&&k.parent.childCount===1?_===p.pos:ye.atStart(h).from===b;return!m||!x||!S.type.isTextblock||S.textContent.length?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return sf()||w0()?o:i},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(k=>k.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:o,to:a}=e.selection,u=ye.atStart(e.doc).from,f=ye.atEnd(e.doc).to;if(i||!(o===u&&a===f)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const p=t.tr,b=Ma({state:t,transaction:p}),{commands:S}=new Yc({editor:this.editor,state:b});if(S.clearNodes(),!!p.steps.length)return p}})]}}),Re.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});function vM(n){return new b0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=ue(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function wM(n){return new b0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=ue(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),h=f&&xc(f,n.type,o);if(!h)return null;if(a.wrap(f,h),n.keepMarks&&n.editor){const{selection:p,storedMarks:b}=e,{splittableMarks:S}=n.editor.extensionManager,k=b||p.$to.parentOffset&&p.$from.marks();if(k){const g=k.filter(_=>S.includes(_.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&hr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Nt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Nt(e)}configure(e={}){const t=this.extend();return t.options=Oa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Nt(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(h=>h?.type.name===t.name))return!1;const f=a.find(h=>h?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class Gn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Gn(e)}configure(e={}){const t=this.extend();return t.options=Oa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Gn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}}function SM(n){return new qE({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=ue(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,u=r[r.length-1],f=r[0];let h=t.to;if(u){const m=f.search(/\S/),p=t.from+f.indexOf(u),b=p+u.length;if(k0(t.from,t.to,e.doc).filter(k=>k.mark.type.excluded.find(_=>_===n.type&&_!==k.mark.type)).filter(k=>k.to>p).length)return null;b<t.to&&a.delete(b,t.to),p>t.from&&a.delete(t.from+m,p),h=t.from+m+u.length,a.addMark(t.from+m,h,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const xM=Gn.create({name:"text",group:"inline"});var La=200,Qe=function(){};Qe.prototype.append=function(e){return e.length?(e=Qe.from(e),!this.length&&e||e.length<La&&this.leafAppend(e)||this.length<La&&e.leafPrepend(this)||this.appendInner(e)):this},Qe.prototype.prepend=function(e){return e.length?Qe.from(e).append(this):this},Qe.prototype.appendInner=function(e){return new kM(this,e)},Qe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Qe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Qe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Qe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Qe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},Qe.from=function(e){return e instanceof Qe?e:e&&e.length?new A0(e):Qe.empty};var A0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,u){for(var f=o;f<a;f++)if(i(this.values[f],u+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,u){for(var f=o-1;f>=a;f--)if(i(this.values[f],u+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=La)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=La)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(Qe);Qe.empty=new A0([]);var kM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Qe),M0=Qe;const CM=500;class fn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,u,f,h=[],m=[];return this.items.forEach((p,b)=>{if(!p.step){i||(i=this.remapping(r,b+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new _n(p.map));let S=p.step.map(i.slice(o)),k;S&&a.maybeStep(S).doc&&(k=a.mapping.maps[a.mapping.maps.length-1],h.push(new _n(k,void 0,void 0,h.length+m.length))),o--,k&&i.appendMap(k,o)}else a.maybeStep(p.step);if(p.selection)return u=i?p.selection.map(i.slice(o)):p.selection,f=new fn(this.items.slice(0,r).append(m.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:u}}addTransform(e,t,r,i){let o=[],a=this.eventCount,u=this.items,f=!i&&u.length?u.get(u.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),b=new _n(e.mapping.maps[m],p,t),S;(S=f&&f.merge(b))&&(b=S,m?o.pop():u=u.slice(0,u.length-1)),o.push(b),t&&(a++,t=void 0),i||(f=b)}let h=a-r.depth;return h>AM&&(u=EM(u,h),a-=h),new fn(u.append(o),a)}remapping(e,t){let r=new Ui;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new fn(this.items.append(e.map(t=>new _n(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(b=>{b.selection&&u--},i);let f=t;this.items.forEach(b=>{let S=o.getMirror(--f);if(S==null)return;a=Math.min(a,S);let k=o.maps[S];if(b.step){let g=e.steps[S].invert(e.docs[S]),_=b.selection&&b.selection.map(o.slice(f+1,S));_&&u++,r.push(new _n(k,g,_))}else r.push(new _n(k))},i);let h=[];for(let b=t;b<a;b++)h.push(new _n(o.maps[b]));let m=this.items.slice(0,i).append(h).append(r),p=new fn(m,u);return p.emptyItemCount()>CM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),h=f&&f.getMap();if(r--,h&&t.appendMap(h,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new _n(h.invert(),f,m),b,S=i.length-1;(b=i.length&&i[S].merge(p))?i[S]=b:i.push(p)}}else a.map&&r--},this.items.length,0),new fn(M0.from(i.reverse()),o)}}fn.empty=new fn(M0.empty,0);function EM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class _n{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new _n(t.getMap().invert(),t,this.selection)}}}class yr{constructor(e,t,r,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i}}const AM=20;function MM(n,e,t,r){let i=t.getMeta(br),o;if(i)return i.historyState;t.getMeta(OM)&&(n=new yr(n.done,n.undone,null,0));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(br))return a.getMeta(br).redo?new yr(n.done.addTransform(t,void 0,r,Pa(e)),n.undone,T0(t.mapping.maps[t.steps.length-1]),n.prevTime):new yr(n.done,n.undone.addTransform(t,void 0,r,Pa(e)),null,n.prevTime);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.prevTime==0||!a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!TM(t,n.prevRanges)),f=a?ff(n.prevRanges,t.mapping):T0(t.mapping.maps[t.steps.length-1]);return new yr(n.done.addTransform(t,u?e.selection.getBookmark():void 0,r,Pa(e)),fn.empty,f,t.time)}else return(o=t.getMeta("rebased"))?new yr(n.done.rebased(t,o),n.undone.rebased(t,o),ff(n.prevRanges,t.mapping),n.prevTime):new yr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),ff(n.prevRanges,t.mapping),n.prevTime)}function TM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function T0(n){let e=[];return n.forEach((t,r,i,o)=>e.push(i,o)),e}function ff(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function O0(n,e,t,r){let i=Pa(e),o=br.get(e).spec.config,a=(r?n.undone:n.done).popEvent(e,i);if(!a)return;let u=a.selection.resolve(a.transform.doc),f=(r?n.done:n.undone).addTransform(a.transform,e.selection.getBookmark(),o,i),h=new yr(r?f:a.remaining,r?a.remaining:f,null,0);t(a.transform.setSelection(u).setMeta(br,{redo:r,historyState:h}).scrollIntoView())}let hf=!1,I0=null;function Pa(n){let e=n.plugins;if(I0!=e){hf=!1,I0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){hf=!0;break}}return hf}const br=new an("history"),OM=new an("closeHistory");function IM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Ot({key:br,state:{init(){return new yr(fn.empty,fn.empty,null,0)},apply(e,t,r){return MM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?N0:r=="historyRedo"?R0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}const N0=(n,e)=>{let t=br.getState(n);return!t||t.done.eventCount==0?!1:(e&&O0(t,n,e,!1),!0)},R0=(n,e)=>{let t=br.getState(n);return!t||t.undone.eventCount==0?!1:(e&&O0(t,n,e,!0),!0)},NM=Re.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>N0(n,e),redo:()=>({state:n,dispatch:e})=>R0(n,e)}},addProseMirrorPlugins(){return[IM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}}),df=Object.freeze({COMMON:"common",DESKTOP:"desktop",TABLET:"tablet",MOBILE:"mobile",get values(){return[this.COMMON,this.MOBILE,this.TABLET,this.DESKTOP]}}),pf=Object.freeze({UPPERCASE:"uppercase",LOWERCASE:"lowercase",CAPITALIZE:"capitalize"}),_r=Object.freeze({LEFT:"left",CENTER:"center",RIGHT:"right",JUSTIFY:"justify",get values(){return[this.LEFT,this.CENTER,this.RIGHT,this.JUSTIFY]}}),ie=Object.freeze({DOCUMENT:"doc",PARAGRAPH:"paragraph",HEADING:"heading",LIST:"list",LIST_ITEM:"listItem",TEXT:"text",get blocks(){return[this.PARAGRAPH,this.LIST,this.HEADING]}}),Kt=Object.freeze({DISC:"disc",CIRCLE:"circle",SQUARE:"square",DECIMAL:"decimal",ROMAN:"roman",LATIN:"latin",get values(){return[this.DISC,this.CIRCLE,this.SQUARE,this.DECIMAL,this.ROMAN,this.LATIN]},get ordered(){return[this.DECIMAL,this.ROMAN,this.LATIN]}}),de=Object.freeze({ALIGNMENT:"alignment",BACKGROUND_COLOR:"background_color",FONT_COLOR:"font_color",FONT_FAMILY:"font_family",FONT_SIZE:"font_size",FONT_STYLE:"font_style",FONT_WEIGHT:"font_weight",LINE_HEIGHT:"line_height",TEXT_DECORATION:"text_decoration",SUPERSCRIPT:"superscript",MARGIN:"margin",LINK:"link",STYLE_PRESET:"style_preset",get attributes(){return[this.ALIGNMENT,this.LINE_HEIGHT,this.MARGIN]},get presetAttributes(){return[this.LINE_HEIGHT]},get inlineMarks(){return[this.TEXT_DECORATION,this.LINK,this.SUPERSCRIPT,this.BACKGROUND_COLOR]},get marks(){return[this.BACKGROUND_COLOR,this.FONT_COLOR,this.FONT_FAMILY,this.FONT_SIZE,this.FONT_STYLE,this.FONT_WEIGHT,this.TEXT_DECORATION,this.SUPERSCRIPT]}}),un=Object.freeze({SETTINGS:"settings",ALL:"_"}),L0=Object.freeze({BLANK:"_blank",SELF:"_self"}),Ls=Object.freeze({URL:"url",BLOCK:"block"});class mf{static create(e,t){const r=new this(e,t||{});return new Ot({key:new an(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class RM extends mf{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=yl.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,u)=>{u.type.name===ie.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class LM extends mf{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=Sn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),Je.create(e,t)}}const PM="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",DM="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u062A\u0635\u0627\u0644\u0627\u062A6\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Li=(n,e)=>{for(const t in e)n[t]=e[t];return n},gf="numeric",yf="ascii",bf="alpha",Da="asciinumeric",Fa="alphanumeric",_f="domain",P0="emoji",FM="scheme",zM="slashscheme",D0="whitespace";function BM(n,e){return n in e||(e[n]=[]),e[n]}function Kr(n,e,t){e[gf]&&(e[Da]=!0,e[Fa]=!0),e[yf]&&(e[Da]=!0,e[bf]=!0),e[Da]&&(e[Fa]=!0),e[bf]&&(e[Fa]=!0),e[Fa]&&(e[_f]=!0),e[P0]&&(e[_f]=!0);for(const r in e){const i=BM(r,t);i.indexOf(n)<0&&i.push(n)}}function $M(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function wt(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}wt.groups={},wt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e){return e===void 0&&(e=!1),e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||wt.groups;let i;return e&&e.j?i=e:(i=new wt(e),t&&r&&Kr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||wt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,u=i.go(n);if(u?(a=new wt,Li(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new wt,o){if(r)if(a.t&&typeof a.t=="string"){const f=Li($M(a.t,r),t);Kr(o,f,r)}else t&&Kr(o,t,r);a.t=o}return i.j[n]=a,a}};const Y=(n,e,t,r,i)=>n.ta(e,t,r,i),Gt=(n,e,t,r,i)=>n.tr(e,t,r,i),F0=(n,e,t,r,i)=>n.ts(e,t,r,i),$=(n,e,t,r,i)=>n.tt(e,t,r,i),$n="WORD",vf="UWORD",Ps="LOCALHOST",wf="TLD",Sf="UTLD",za="SCHEME",Pi="SLASH_SCHEME",xf="NUM",z0="WS",kf="NL",Di="OPENBRACE",Ds="OPENBRACKET",Fs="OPENANGLEBRACKET",zs="OPENPAREN",Gr="CLOSEBRACE",Fi="CLOSEBRACKET",zi="CLOSEANGLEBRACKET",Jr="CLOSEPAREN",Ba="AMPERSAND",$a="APOSTROPHE",Ha="ASTERISK",vr="AT",Wa="BACKSLASH",Va="BACKTICK",Ua="CARET",wr="COLON",Cf="COMMA",qa="DOLLAR",gn="DOT",Ka="EQUALS",Ef="EXCLAMATION",yn="HYPHEN",Ga="PERCENT",Ja="PIPE",ja="PLUS",Ya="POUND",Xa="QUERY",Af="QUOTE",Mf="SEMI",bn="SLASH",Bs="TILDE",Za="UNDERSCORE",B0="EMOJI",Qa="SYM";var $0=Object.freeze({__proto__:null,WORD:$n,UWORD:vf,LOCALHOST:Ps,TLD:wf,UTLD:Sf,SCHEME:za,SLASH_SCHEME:Pi,NUM:xf,WS:z0,NL:kf,OPENBRACE:Di,OPENBRACKET:Ds,OPENANGLEBRACKET:Fs,OPENPAREN:zs,CLOSEBRACE:Gr,CLOSEBRACKET:Fi,CLOSEANGLEBRACKET:zi,CLOSEPAREN:Jr,AMPERSAND:Ba,APOSTROPHE:$a,ASTERISK:Ha,AT:vr,BACKSLASH:Wa,BACKTICK:Va,CARET:Ua,COLON:wr,COMMA:Cf,DOLLAR:qa,DOT:gn,EQUALS:Ka,EXCLAMATION:Ef,HYPHEN:yn,PERCENT:Ga,PIPE:Ja,PLUS:ja,POUND:Ya,QUERY:Xa,QUOTE:Af,SEMI:Mf,SLASH:bn,TILDE:Bs,UNDERSCORE:Za,EMOJI:B0,SYM:Qa});const Bi=/[a-z]/,Tf=/\p{L}/u,Of=/\p{Emoji}/u,If=/\d/,H0=/\s/,W0=`
37
- `,HM="\uFE0F",WM="\u200D";let el=null,tl=null;function VM(n){n===void 0&&(n=[]);const e={};wt.groups=e;const t=new wt;el==null&&(el=V0(PM)),tl==null&&(tl=V0(DM)),$(t,"'",$a),$(t,"{",Di),$(t,"[",Ds),$(t,"<",Fs),$(t,"(",zs),$(t,"}",Gr),$(t,"]",Fi),$(t,">",zi),$(t,")",Jr),$(t,"&",Ba),$(t,"*",Ha),$(t,"@",vr),$(t,"`",Va),$(t,"^",Ua),$(t,":",wr),$(t,",",Cf),$(t,"$",qa),$(t,".",gn),$(t,"=",Ka),$(t,"!",Ef),$(t,"-",yn),$(t,"%",Ga),$(t,"|",Ja),$(t,"+",ja),$(t,"#",Ya),$(t,"?",Xa),$(t,'"',Af),$(t,"/",bn),$(t,";",Mf),$(t,"~",Bs),$(t,"_",Za),$(t,"\\",Wa);const r=Gt(t,If,xf,{[gf]:!0});Gt(r,If,r);const i=Gt(t,Bi,$n,{[yf]:!0});Gt(i,Bi,i);const o=Gt(t,Tf,vf,{[bf]:!0});Gt(o,Bi),Gt(o,Tf,o);const a=Gt(t,H0,z0,{[D0]:!0});$(t,W0,kf,{[D0]:!0}),$(a,W0),Gt(a,H0,a);const u=Gt(t,Of,B0,{[P0]:!0});Gt(u,Of,u),$(u,HM,u);const f=$(u,WM);Gt(f,Of,u);const h=[[Bi,i]],m=[[Bi,null],[Tf,o]];for(let p=0;p<el.length;p++)Sr(t,el[p],wf,$n,h);for(let p=0;p<tl.length;p++)Sr(t,tl[p],Sf,vf,m);Kr(wf,{tld:!0,ascii:!0},e),Kr(Sf,{utld:!0,alpha:!0},e),Sr(t,"file",za,$n,h),Sr(t,"mailto",za,$n,h),Sr(t,"http",Pi,$n,h),Sr(t,"https",Pi,$n,h),Sr(t,"ftp",Pi,$n,h),Sr(t,"ftps",Pi,$n,h),Kr(za,{scheme:!0,ascii:!0},e),Kr(Pi,{slashscheme:!0,ascii:!0},e),n=n.sort((p,b)=>p[0]>b[0]?1:-1);for(let p=0;p<n.length;p++){const b=n[p][0],k=n[p][1]?{[FM]:!0}:{[zM]:!0};b.indexOf("-")>=0?k[_f]=!0:Bi.test(b)?If.test(b)?k[Da]=!0:k[yf]=!0:k[gf]=!0,F0(t,b,b,k)}return F0(t,"localhost",Ps,{ascii:!0}),t.jd=new wt(Qa),{start:t,tokens:Li({groups:e},$0)}}function UM(n,e){const t=qM(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let u=n,f=null,h=0,m=null,p=-1,b=-1;for(;a<r&&(f=u.go(t[a]));)u=f,u.accepts()?(p=0,b=0,m=u):p>=0&&(p+=t[a].length,b++),h+=t[a].length,o+=t[a].length,a++;o-=p,a-=b,h-=p,i.push({t:m.t,v:e.slice(o-h,o),s:o-h,e:o})}return i}function qM(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Sr(n,e,t,r,i){let o;const a=e.length;for(let u=0;u<a-1;u++){const f=e[u];n.j[f]?o=n.j[f]:(o=new wt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new wt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function V0(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const $s={defaultProtocol:"http",events:null,format:U0,formatHref:U0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Nf(n,e){e===void 0&&(e=null);let t=Li({},$s);n&&(t=Li(t,n instanceof Nf?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Nf.prototype={o:$s,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:$s[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function U0(n){return n}function q0(n,e){this.t="token",this.v=n,this.tk=e}q0.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=$s.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},u=n.get("className",t,e),f=n.get("target",t,e),h=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,u&&(a.class=u),f&&(a.target=f),h&&(a.rel=h),m&&Li(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function nl(n,e){class t extends q0{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const K0=nl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),G0=nl("text"),KM=nl("nl"),jr=nl("url",{isLink:!0,toHref(n){return n===void 0&&(n=$s.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ps&&n[1].t===wr}}),qe=n=>new wt(n);function GM(n){let{groups:e}=n;const t=e.domain.concat([Ba,Ha,vr,Wa,Va,Ua,qa,Ka,yn,xf,Ga,Ja,ja,Ya,bn,Qa,Bs,Za]),r=[$a,zi,Gr,Fi,Jr,wr,Cf,gn,Ef,Fs,Di,Ds,zs,Xa,Af,Mf],i=[Ba,$a,Ha,Wa,Va,Ua,Gr,qa,Ka,yn,Di,Ga,Ja,ja,Ya,Xa,bn,Qa,Bs,Za],o=qe(),a=$(o,Bs);Y(a,i,a),Y(a,e.domain,a);const u=qe(),f=qe(),h=qe();Y(o,e.domain,u),Y(o,e.scheme,f),Y(o,e.slashscheme,h),Y(u,i,a),Y(u,e.domain,u);const m=$(u,vr);$(a,vr,m),$(f,vr,m),$(h,vr,m);const p=$(a,gn);Y(p,i,a),Y(p,e.domain,a);const b=qe();Y(m,e.domain,b),Y(b,e.domain,b);const S=$(b,gn);Y(S,e.domain,b);const k=qe(K0);Y(S,e.tld,k),Y(S,e.utld,k),$(m,Ps,k);const g=$(b,yn);Y(g,e.domain,b),Y(k,e.domain,b),$(k,gn,S),$(k,yn,g);const _=$(k,wr);Y(_,e.numeric,K0);const x=$(u,yn),E=$(u,gn);Y(x,e.domain,u),Y(E,i,a),Y(E,e.domain,u);const A=qe(jr);Y(E,e.tld,A),Y(E,e.utld,A),Y(A,e.domain,u),Y(A,i,a),$(A,gn,E),$(A,yn,x),$(A,vr,m);const N=$(A,wr),W=qe(jr);Y(N,e.numeric,W);const L=qe(jr),U=qe();Y(L,t,L),Y(L,r,U),Y(U,t,L),Y(U,r,U),$(A,bn,L),$(W,bn,L);const j=$(f,wr),me=$(h,wr),St=$(me,bn),dt=$(St,bn);Y(f,e.domain,u),$(f,gn,E),$(f,yn,x),Y(h,e.domain,u),$(h,gn,E),$(h,yn,x),Y(j,e.domain,L),$(j,bn,L),Y(dt,e.domain,L),Y(dt,t,L),$(dt,bn,L);const Lt=$(L,Di),Jn=$(L,Ds),Xt=$(L,Fs),xn=$(L,zs);$(U,Di,Lt),$(U,Ds,Jn),$(U,Fs,Xt),$(U,zs,xn),$(Lt,Gr,L),$(Jn,Fi,L),$(Xt,zi,L),$(xn,Jr,L),$(Lt,Gr,L);const Be=qe(jr),$e=qe(jr),He=qe(jr),Pt=qe(jr);Y(Lt,t,Be),Y(Jn,t,$e),Y(Xt,t,He),Y(xn,t,Pt);const tt=qe(),We=qe(),jn=qe(),Yn=qe();return Y(Lt,r),Y(Jn,r),Y(Xt,r),Y(xn,r),Y(Be,t,Be),Y($e,t,$e),Y(He,t,He),Y(Pt,t,Pt),Y(Be,r,Be),Y($e,r,$e),Y(He,r,He),Y(Pt,r,Pt),Y(tt,t,tt),Y(We,t,$e),Y(jn,t,He),Y(Yn,t,Pt),Y(tt,r,tt),Y(We,r,We),Y(jn,r,jn),Y(Yn,r,Yn),$($e,Fi,L),$(He,zi,L),$(Pt,Jr,L),$(Be,Gr,L),$(We,Fi,L),$(jn,zi,L),$(Yn,Jr,L),$(tt,Jr,L),$(o,Ps,A),$(o,kf,KM),{start:o,tokens:$0}}function JM(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let u=n,f=null,h=null,m=0,p=null,b=-1;for(;i<r&&!(f=u.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=f||u.go(t[i].t));)f=null,u=h,u.accepts()?(b=0,p=u):b>=0&&b++,i++,m++;if(b<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Rf(G0,e,a)),a=[]),i-=b,m-=b;const S=p.t,k=t.slice(i-m,i);o.push(Rf(S,e,k))}}return a.length>0&&o.push(Rf(G0,e,a)),o}function Rf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const jM=typeof console<"u"&&console&&console.warn||(()=>{}),YM="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Me={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function XM(){wt.groups={},Me.scanner=null,Me.parser=null,Me.tokenQueue=[],Me.pluginQueue=[],Me.customSchemes=[],Me.initialized=!1}function J0(n,e){if(e===void 0&&(e=!1),Me.initialized&&jM(`linkifyjs: already initialized - will not register custom scheme "${n}" ${YM}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
36
+ `,textSerializers:a={}}=t||{};let u="",f=!0;return n.nodesBetween(r,i,(h,m,p,b)=>{var S;const E=a?.[h.type.name];E?(h.isBlock&&!f&&(u+=o,f=!0),p&&(u+=E({node:h,pos:m,parent:p,index:b,range:e}))):h.isText?(u+=(S=h?.text)===null||S===void 0?void 0:S.slice(Math.max(r,m)-m,i-m),f=!1):h.isBlock&&!f&&(u+=o,f=!0)}),u}function CA(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}De.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new Rt({key:new fn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:o}=i,a=Math.min(...o.map(m=>m.$from.pos)),u=Math.max(...o.map(m=>m.$to.pos)),f=CA(t);return EA(r,{from:a,to:u},{textSerializers:f})}}})]}});const kA=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),AA=(n=!1)=>({commands:e})=>e.setContent("",n),MA=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:o,$to:a})=>{n.doc.nodesBetween(o.pos,a.pos,(u,f)=>{if(u.type.isText)return;const{doc:h,mapping:m}=e,p=h.resolve(m.map(f)),b=h.resolve(m.map(f+u.nodeSize)),S=p.blockRange(b);if(!S)return;const E=Mi(S);if(u.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(S.start,g)}(E||E===0)&&e.lift(S,E)})}),!0},TA=n=>e=>n(e),OA=()=>({state:n,dispatch:e})=>Zk(n,e),IA=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,o.content),r.setSelection(new ye(r.doc.resolve(a-1))),!0},NA=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const u=i.before(o),f=i.after(o);n.delete(u,f).scrollIntoView()}return!0}return!1},RA=n=>({tr:e,state:t,dispatch:r})=>{const i=Je(n,t.schema),o=e.selection.$anchor;for(let a=o.depth;a>0;a-=1)if(o.node(a).type===i){if(r){const f=o.before(a),h=o.after(a);e.delete(f,h).scrollIntoView()}return!0}return!1},LA=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},PA=()=>({state:n,dispatch:e})=>$k(n,e),DA=()=>({commands:n})=>n.keyboardShortcut("Enter"),FA=()=>({state:n,dispatch:e})=>Xk(n,e);function za(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:lf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function ff(n,e,t={}){return n.find(r=>r.type===e&&za(r.attrs,t))}function zA(n,e,t={}){return!!ff(n,e,t)}function hf(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=ff([...r.node.marks],e,t);if(!i)return;let o=r.index,a=n.start()+r.offset,u=o+1,f=a+r.node.nodeSize;for(ff([...r.node.marks],e,t);o>0&&i.isInSet(n.parent.child(o-1).marks);)o-=1,a-=n.parent.child(o).nodeSize;for(;u<n.parent.childCount&&zA([...n.parent.child(u).marks],e,t);)f+=n.parent.child(u).nodeSize,u+=1;return{from:a,to:f}}function wn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const BA=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const o=wn(n,r.schema),{doc:a,selection:u}=t,{$from:f,from:h,to:m}=u;if(i){const p=hf(f,o,e);if(p&&p.from<=h&&p.to>=m){const b=ye.create(a,p.from,p.to);t.setSelection(b)}}return!0},$A=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function k0(n){return n instanceof ye}function Jr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function HA(n,e=null){if(!e)return null;const t=ge.atStart(n),r=ge.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,o=r.to;return e==="all"?ye.create(n,Jr(0,i,o),Jr(n.content.size,i,o)):ye.create(n,Jr(e,i,o),Jr(e,i,o))}function df(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const VA=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const a=()=>{df()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!k0(t.state.selection))return a(),!0;const u=HA(i.doc,n)||t.state.selection,f=t.state.selection.eq(u);return o&&(f||i.setSelection(u),f&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},WA=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),UA=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e);function A0(n){const e=`<body>${n}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function Ba(n,e,t){if(t={slice:!0,parseOptions:{},...t},typeof n=="object"&&n!==null)try{return Array.isArray(n)&&n.length>0?z.fromArray(n.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(n)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",r),Ba("",e,t)}if(typeof n=="string"){const r=Mc.fromSchema(e);return t.slice?r.parseSlice(A0(n),t.parseOptions).content:r.parse(A0(n),t.parseOptions)}return Ba("",e,t)}function qA(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof ut||i instanceof Xe))return;const o=n.mapping.maps[r];let a=0;o.forEach((u,f,h,m)=>{a===0&&(a=m)}),n.setSelection(ge.near(n.doc.resolve(a),t))}const KA=n=>n.toString().startsWith("<"),GA=(n,e,t)=>({tr:r,dispatch:i,editor:o})=>{if(i){t={parseOptions:{},updateSelection:!0,...t};const a=Ba(e,o.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions}});if(a.toString()==="<>")return!0;let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,m=!0;if((KA(a)?a:[a]).forEach(b=>{b.check(),h=h?b.isText&&b.marks.length===0:!1,m=m?b.isBlock:!1}),u===f&&m){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,f+=1)}h?Array.isArray(e)?r.insertText(e.map(b=>b.text||"").join(""),u,f):typeof e=="object"&&e&&e.text?r.insertText(e.text,u,f):r.insertText(e,u,f):r.replaceWith(u,f,a),t.updateSelection&&qA(r,r.steps.length-1,-1)}return!0},JA=()=>({state:n,dispatch:e})=>Gk(n,e),jA=()=>({state:n,dispatch:e})=>Jk(n,e),YA=()=>({state:n,dispatch:e})=>Vk(n,e),XA=()=>({state:n,dispatch:e})=>qk(n,e),ZA=()=>({tr:n,state:e,dispatch:t})=>{try{const r=ka(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},QA=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ka(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}};function M0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function eM(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,o,a;for(let u=0;u<e.length-1;u+=1){const f=e[u];if(/^(cmd|meta|m)$/i.test(f))a=!0;else if(/^a(lt)?$/i.test(f))r=!0;else if(/^(c|ctrl|control)$/i.test(f))i=!0;else if(/^s(hift)?$/i.test(f))o=!0;else if(/^mod$/i.test(f))df()||M0()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${f}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),o&&(t=`Shift-${t}`),t}const tM=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const o=eM(n).split(/-(?!$)/),a=o.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),f=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,u))});return f?.steps.forEach(h=>{const m=h.map(r.mapping);m&&i&&r.maybeStep(m)}),!0};function pf(n,e,t={}){const{from:r,to:i,empty:o}=n.selection,a=e?Je(e,n.schema):null,u=[];n.doc.nodesBetween(r,i,(p,b)=>{if(p.isText)return;const S=Math.max(r,b),E=Math.min(i,b+p.nodeSize);u.push({node:p,from:S,to:E})});const f=i-r,h=u.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>za(p.node.attrs,t,{strict:!1}));return o?!!h.length:h.reduce((p,b)=>p+b.to-b.from,0)>=f}const nM=(n,e={})=>({state:t,dispatch:r})=>{const i=Je(n,t.schema);return pf(t,i,e)?jk(t,r):!1},rM=()=>({state:n,dispatch:e})=>Qk(n,e),iM=n=>({state:e,dispatch:t})=>{const r=Je(n,e.schema);return aA(r)(e,t)},sM=()=>({state:n,dispatch:e})=>Yk(n,e);function mf(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function T0(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}const oM=(n,e)=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=mf(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=Je(n,r.schema)),u==="mark"&&(a=wn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(h,m)=>{o&&o===h.type&&t.setNodeMarkup(m,void 0,T0(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(p=>{a===p.type&&t.addMark(m,m+h.nodeSize,a.create(T0(p.attrs,e)))})})}),!0):!1},aM=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),lM=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),uM=()=>({state:n,dispatch:e})=>Wk(n,e),cM=()=>({state:n,dispatch:e})=>Kk(n,e),fM=()=>({state:n,dispatch:e})=>eA(n,e),hM=()=>({state:n,dispatch:e})=>rA(n,e),dM=()=>({state:n,dispatch:e})=>nA(n,e);function pM(n,e,t={}){return Ba(n,e,{slice:!1,parseOptions:t})}const mM=(n,e=!1,t={})=>({tr:r,editor:i,dispatch:o})=>{const{doc:a}=r,u=pM(n,i.schema,t);return o&&r.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!e),!0};function O0(n,e){const t=wn(e,n.schema),{from:r,to:i,empty:o}=n.selection,a=[];o?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,f=>{a.push(...f.marks)});const u=a.find(f=>f.type.name===t.name);return u?{...u.attrs}:{}}function gM(n,e){const t=new GC(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function yM(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function bM(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,o)=>{t(i)&&r.push({node:i,pos:o})}),r}function _M(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function gf(n){return e=>_M(e.$from,n)}function vM(n,e){const t=Gi.resolve(n);return x0(t,e)}function wM(n,e){const t=Je(e,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,u=>{o.push(u)});const a=o.reverse().find(u=>u.type.name===t.name);return a?{...a.attrs}:{}}function SM(n,e){const t=mf(typeof e=="string"?e:e.name,n.schema);return t==="node"?wM(n,e):t==="mark"?O0(n,e):{}}function xM(n,e=JSON.stringify){const t={};return n.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function EM(n){const e=xM(n);return e.length===1?e:e.filter((t,r)=>!e.filter((o,a)=>a!==r).some(o=>t.oldRange.from>=o.oldRange.from&&t.oldRange.to<=o.oldRange.to&&t.newRange.from>=o.newRange.from&&t.newRange.to<=o.newRange.to))}function CM(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,o)=>{const a=[];if(i.ranges.length)i.forEach((u,f)=>{a.push({from:u,to:f})});else{const{from:u,to:f}=t[o];if(u===void 0||f===void 0)return;a.push({from:u,to:f})}a.forEach(({from:u,to:f})=>{const h=e.slice(o).map(u,-1),m=e.slice(o).map(f),p=e.invert().map(h,-1),b=e.invert().map(m);r.push({oldRange:{from:p,to:b},newRange:{from:h,to:m}})})}),EM(r)}function I0(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const o=t.resolve(n-1),a=hf(o,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,o)=>{r.push(...i.marks.map(a=>({from:o,to:o+i.nodeSize,mark:a})))}),r}function $a(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function kM(n,e,t={}){const{empty:r,ranges:i}=n.selection,o=e?wn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(p=>o?o.name===p.type.name:!0).find(p=>za(p.attrs,t,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:p,$to:b})=>{const S=p.pos,E=b.pos;n.doc.nodesBetween(S,E,(g,_)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(S,_),k=Math.min(E,_+g.nodeSize),A=k-x;a+=A,u.push(...g.marks.map(N=>({mark:N,from:x,to:k})))})}),a===0)return!1;const f=u.filter(p=>o?o.name===p.mark.type.name:!0).filter(p=>za(p.mark.attrs,t,{strict:!1})).reduce((p,b)=>p+b.to-b.from,0),h=u.filter(p=>o?p.mark.type!==o&&p.mark.type.excludes(o):!0).reduce((p,b)=>p+b.to-b.from,0);return(f>0?f+h:f)>=a}function N0(n,e){const{nodeExtensions:t}=Da(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=ue(G(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function AM(n,e,t){var r;const{selection:i}=e;let o=null;if(k0(i)&&(o=i.$cursor),o){const u=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!t.isInSet(u)||!u.some(f=>f.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:u,$to:f})=>{let h=u.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(u.pos,f.pos,(m,p,b)=>{if(h)return!1;if(m.isInline){const S=!b||b.type.allowsMarkType(t),E=!!t.isInSet(m.marks)||!m.marks.some(g=>g.type.excludes(t));h=S&&E}return!h}),h})}const MM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:o}=t,{empty:a,ranges:u}=o,f=wn(n,r.schema);if(i)if(a){const h=O0(r,f);t.addStoredMark(f.create({...h,...e}))}else u.forEach(h=>{const m=h.$from.pos,p=h.$to.pos;r.doc.nodesBetween(m,p,(b,S)=>{const E=Math.max(S,m),g=Math.min(S+b.nodeSize,p);b.marks.find(x=>x.type===f)?b.marks.forEach(x=>{f===x.type&&t.addMark(E,g,f.create({...x.attrs,...e}))}):t.addMark(E,g,f.create(e))})});return AM(r,t,f)},TM=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),OM=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const o=Je(n,t.schema);return o.isTextblock?i().command(({commands:a})=>_0(o,e)(t)?!0:a.clearNodes()).command(({state:a})=>_0(o,e)(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Jr(n,0,r.content.size),o=ee.create(r,i);e.setSelection(o)}return!0},NM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,a=ye.atStart(r).from,u=ye.atEnd(r).to,f=Jr(i,a,u),h=Jr(o,a,u),m=ye.create(r,f,h);e.setSelection(m)}return!0},RM=n=>({state:e,dispatch:t})=>{const r=Je(n,e.schema);return cA(r)(e,t)};function R0(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(i=>e?.includes(i.type.name));n.tr.ensureMarks(r)}}const LM=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:o,doc:a}=e,{$from:u,$to:f}=o,h=i.extensionManager.attributes,m=$a(h,u.node().type.name,u.node().attrs);if(o instanceof ee&&o.node.isBlock)return!u.parentOffset||!Ti(a,u.pos)?!1:(r&&(n&&R0(t,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;if(r){const p=f.parentOffset===f.parent.content.size;o instanceof ye&&e.deleteSelection();const b=u.depth===0?void 0:yM(u.node(-1).contentMatchAt(u.indexAfter(-1)));let S=p&&b?[{type:b,attrs:m}]:void 0,E=Ti(e.doc,e.mapping.map(u.pos),1,S);if(!S&&!E&&Ti(e.doc,e.mapping.map(u.pos),1,b?[{type:b}]:void 0)&&(E=!0,S=b?[{type:b,attrs:m}]:void 0),E&&(e.split(e.mapping.map(u.pos),1,S),b&&!p&&!u.parentOffset&&u.parent.type!==b)){const g=e.mapping.map(u.before()),_=e.doc.resolve(g);u.node(-1).canReplaceWith(_.index(),_.index()+1,b)&&e.setNodeMarkup(e.mapping.map(u.before()),b)}n&&R0(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},PM=n=>({tr:e,state:t,dispatch:r,editor:i})=>{var o;const a=Je(n,t.schema),{$from:u,$to:f}=t.selection,h=t.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==a)return!1;const p=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let _=z.empty;const x=u.index(-1)?1:u.index(-2)?2:3;for(let U=u.depth-x;U>=u.depth-3;U-=1)_=z.from(u.node(U).copy(_));const k=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,A=$a(p,u.node().type.name,u.node().attrs),N=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(A))||void 0;_=_.append(z.from(a.createAndFill(null,N)||void 0));const V=u.before(u.depth-(x-1));e.replace(V,u.after(-k),new K(_,4-x,0));let L=-1;e.doc.nodesBetween(V,e.doc.content.size,(U,j)=>{if(L>-1)return!1;U.isTextblock&&U.content.size===0&&(L=j+1)}),L>-1&&e.setSelection(ye.near(e.doc.resolve(L))),e.scrollIntoView()}return!0}const b=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,S=$a(p,m.type.name,m.attrs),E=$a(p,u.node().type.name,u.node().attrs);e.delete(u.pos,f.pos);const g=b?[{type:a,attrs:S},{type:b,attrs:E}]:[{type:a,attrs:S}];if(!Ti(e.doc,u.pos,2))return!1;if(r){const{selection:_,storedMarks:x}=t,{splittableMarks:k}=i.extensionManager,A=x||_.$to.parentOffset&&_.$from.marks();if(e.split(u.pos,2,g).scrollIntoView(),!A||!r)return!0;const N=A.filter(V=>k.includes(V.type.name));e.ensureMarks(N)}return!0},yf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&pr(n.doc,t.pos)&&n.join(t.pos),!0},bf=(n,e)=>{const t=gf(a=>a.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const i=n.doc.nodeAt(r);return t.node.type===i?.type&&pr(n.doc,r)&&n.join(r),!0},DM=(n,e,t,r={})=>({editor:i,tr:o,state:a,dispatch:u,chain:f,commands:h,can:m})=>{const{extensions:p,splittableMarks:b}=i.extensionManager,S=Je(n,a.schema),E=Je(e,a.schema),{selection:g,storedMarks:_}=a,{$from:x,$to:k}=g,A=x.blockRange(k),N=_||g.$to.parentOffset&&g.$from.marks();if(!A)return!1;const V=gf(L=>N0(L.type.name,p))(g);if(A.depth>=1&&V&&A.depth-V.depth<=1){if(V.node.type===S)return h.liftListItem(E);if(N0(V.node.type.name,p)&&S.validContent(V.node.content)&&u)return f().command(()=>(o.setNodeMarkup(V.pos,S),!0)).command(()=>yf(o,S)).command(()=>bf(o,S)).run()}return!t||!N||!u?f().command(()=>m().wrapInList(S,r)?!0:h.clearNodes()).wrapInList(S,r).command(()=>yf(o,S)).command(()=>bf(o,S)).run():f().command(()=>{const L=m().wrapInList(S,r),U=N.filter(j=>b.includes(j.type.name));return o.ensureMarks(U),L?!0:h.clearNodes()}).wrapInList(S,r).command(()=>yf(o,S)).command(()=>bf(o,S)).run()},FM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=t,a=wn(n,r.schema);return kM(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:o}):i.setMark(a,e)},zM=(n,e,t={})=>({state:r,commands:i})=>{const o=Je(n,r.schema),a=Je(e,r.schema);return pf(r,o,t)?i.setNode(a):i.setNode(o,t)},BM=(n,e={})=>({state:t,commands:r})=>{const i=Je(n,t.schema);return pf(t,i,e)?r.lift(i):r.wrapIn(i,e)},$M=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let o;if(i.spec.isInputRules&&(o=i.getState(n))){if(e){const a=n.tr,u=o.transform;for(let f=u.steps.length-1;f>=0;f-=1)a.step(u.steps[f].invert(u.docs[f]));if(o.text){const f=a.doc.resolve(o.from).marks();a.replaceWith(o.from,o.to,n.schema.text(o.text,f))}else a.delete(o.from,o.to)}return!0}}return!1},HM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},VM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=t,f=wn(n,r.schema),{$from:h,empty:m,ranges:p}=u;if(!i)return!0;if(m&&a){let{from:b,to:S}=u;const E=(o=h.marks().find(_=>_.type===f))===null||o===void 0?void 0:o.attrs,g=hf(h,f,E);g&&(b=g.from,S=g.to),t.removeMark(b,S,f)}else p.forEach(b=>{t.removeMark(b.$from.pos,b.$to.pos,f)});return t.removeStoredMark(f),!0},WM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let o=null,a=null;const u=mf(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(o=Je(n,r.schema)),u==="mark"&&(a=wn(n,r.schema)),i&&t.selection.ranges.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(p,b)=>{o&&o===p.type&&t.setNodeMarkup(b,void 0,{...p.attrs,...e}),a&&p.marks.length&&p.marks.forEach(S=>{if(a===S.type){const E=Math.max(b,h),g=Math.min(b+p.nodeSize,m);t.addMark(E,g,a.create({...S.attrs,...e}))}})})}),!0):!1},UM=(n,e={})=>({state:t,dispatch:r})=>{const i=Je(n,t.schema);return iA(i,e)(t,r)},qM=(n,e={})=>({state:t,dispatch:r})=>{const i=Je(n,t.schema);return sA(i,e)(t,r)};var KM=Object.freeze({__proto__:null,blur:kA,clearContent:AA,clearNodes:MA,command:TA,createParagraphNear:OA,cut:IA,deleteCurrentNode:NA,deleteNode:RA,deleteRange:LA,deleteSelection:PA,enter:DA,exitCode:FA,extendMarkRange:BA,first:$A,focus:VA,forEach:WA,insertContent:UA,insertContentAt:GA,joinUp:JA,joinDown:jA,joinBackward:YA,joinForward:XA,joinItemBackward:ZA,joinItemForward:QA,keyboardShortcut:tM,lift:nM,liftEmptyBlock:rM,liftListItem:iM,newlineInCode:sM,resetAttributes:oM,scrollIntoView:aM,selectAll:lM,selectNodeBackward:uM,selectNodeForward:cM,selectParentNode:fM,selectTextblockEnd:hM,selectTextblockStart:dM,setContent:mM,setMark:MM,setMeta:TM,setNode:OM,setNodeSelection:IM,setTextSelection:NM,sinkListItem:RM,splitBlock:LM,splitListItem:PM,toggleList:DM,toggleMark:FM,toggleNode:zM,toggleWrap:BM,undoInputRule:$M,unsetAllMarks:HM,unsetMark:VM,updateAttributes:WM,wrapIn:UM,wrapInList:qM});De.create({name:"commands",addCommands(){return{...KM}}}),De.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new fn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),De.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Rt({key:new fn("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),De.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:u})=>{const{selection:f,doc:h}=u,{empty:m,$anchor:p}=f,{pos:b,parent:S}=p,E=p.parent.isTextblock?u.doc.resolve(b-1):p,g=E.parent.type.spec.isolating,_=p.pos-p.parentOffset,x=g&&E.parent.childCount===1?_===p.pos:ge.atStart(h).from===b;return!m||!x||!S.type.isTextblock||S.textContent.length?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return df()||M0()?o:i},addProseMirrorPlugins(){return[new Rt({key:new fn("clearDocument"),appendTransaction:(n,e,t)=>{if(!(n.some(E=>E.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:o,to:a}=e.selection,u=ge.atStart(e.doc).from,f=ge.atEnd(e.doc).to;if(i||!(o===u&&a===f)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const p=t.tr,b=Pa({state:t,transaction:p}),{commands:S}=new sf({editor:this.editor,state:b});if(S.clearNodes(),!!p.steps.length)return p}})]}}),De.create({name:"tabindex",addProseMirrorPlugins(){return[new Rt({key:new fn("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});function GM(n){return new C0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),o=ue(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,o)}})}function JM(n){return new C0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const o=ue(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),f=a.doc.resolve(t.from).blockRange(),h=f&&Lc(f,n.type,o);if(!h)return null;if(a.wrap(f,h),n.keepMarks&&n.editor){const{selection:p,storedMarks:b}=e,{splittableMarks:S}=n.editor.extensionManager,E=b||p.$to.parentOffset&&p.$from.marks();if(E){const g=E.filter(_=>S.includes(_.type.name));a.ensureMarks(g)}}if(n.keepAttributes){const p=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(p,o).run()}const m=a.doc.resolve(t.from-1).nodeBefore;m&&m.type===n.type&&pr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,m))&&a.join(t.from-1)}})}class Pt{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Pt(e)}configure(e={}){const t=this.extend();return t.options=Fa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Pt(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const a=i.marks();if(!!!a.find(h=>h?.type.name===t.name))return!1;const f=a.find(h=>h?.type.name===t.name);return f&&r.removeStoredMark(f),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}class Xn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ue(G(this,"addOptions",{name:this.name}))),this.storage=ue(G(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Xn(e)}configure(e={}){const t=this.extend();return t.options=Fa(this.options,e),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new Xn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ue(G(t,"addOptions",{name:t.name})),t.storage=ue(G(t,"addStorage",{name:t.name,options:t.options})),t}}function jM(n){return new bA({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const o=ue(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:a}=e,u=r[r.length-1],f=r[0];let h=t.to;if(u){const m=f.search(/\S/),p=t.from+f.indexOf(u),b=p+u.length;if(I0(t.from,t.to,e.doc).filter(E=>E.mark.type.excluded.find(_=>_===n.type&&_!==E.mark.type)).filter(E=>E.to>p).length)return null;b<t.to&&a.delete(b,t.to),p>t.from&&a.delete(t.from+m,p),h=t.from+m+u.length,a.addMark(t.from+m,h,n.type.create(o||{})),a.removeStoredMark(n.type)}}})}const YM=Xn.create({name:"text",group:"inline"});var Ha=200,rt=function(){};rt.prototype.append=function(e){return e.length?(e=rt.from(e),!this.length&&e||e.length<Ha&&this.leafAppend(e)||this.length<Ha&&e.leafPrepend(this)||this.appendInner(e)):this},rt.prototype.prepend=function(e){return e.length?rt.from(e).append(this):this},rt.prototype.appendInner=function(e){return new XM(this,e)},rt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?rt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},rt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},rt.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},rt.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,a){return i.push(e(o,a))},t,r),i},rt.from=function(e){return e instanceof rt?e:e&&e.length?new L0(e):rt.empty};var L0=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,a,u){for(var f=o;f<a;f++)if(i(this.values[f],u+f)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,a,u){for(var f=o-1;f>=a;f--)if(i(this.values[f],u+f)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ha)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ha)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(rt);rt.empty=new L0([]);var XM=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(o,u),a)===!1||o>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,o)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(o,u)-u,a+u)===!1||o<u&&this.left.forEachInvertedInner(r,Math.min(i,u),o,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(rt),P0=rt;const ZM=500;class gn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;t&&(i=this.remapping(r,this.items.length),o=i.maps.length);let a=e.tr,u,f,h=[],m=[];return this.items.forEach((p,b)=>{if(!p.step){i||(i=this.remapping(r,b+1),o=i.maps.length),o--,m.push(p);return}if(i){m.push(new Cn(p.map));let S=p.step.map(i.slice(o)),E;S&&a.maybeStep(S).doc&&(E=a.mapping.maps[a.mapping.maps.length-1],h.push(new Cn(E,void 0,void 0,h.length+m.length))),o--,E&&i.appendMap(E,o)}else a.maybeStep(p.step);if(p.selection)return u=i?p.selection.map(i.slice(o)):p.selection,f=new gn(this.items.slice(0,r).append(m.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:f,transform:a,selection:u}}addTransform(e,t,r,i){let o=[],a=this.eventCount,u=this.items,f=!i&&u.length?u.get(u.length-1):null;for(let m=0;m<e.steps.length;m++){let p=e.steps[m].invert(e.docs[m]),b=new Cn(e.mapping.maps[m],p,t),S;(S=f&&f.merge(b))&&(b=S,m?o.pop():u=u.slice(0,u.length-1)),o.push(b),t&&(a++,t=void 0),i||(f=b)}let h=a-r.depth;return h>eT&&(u=QM(u,h),a-=h),new gn(u.append(o),a)}remapping(e,t){let r=new Ji;return this.items.forEach((i,o)=>{let a=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new gn(this.items.append(e.map(t=>new Cn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),o=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(b=>{b.selection&&u--},i);let f=t;this.items.forEach(b=>{let S=o.getMirror(--f);if(S==null)return;a=Math.min(a,S);let E=o.maps[S];if(b.step){let g=e.steps[S].invert(e.docs[S]),_=b.selection&&b.selection.map(o.slice(f+1,S));_&&u++,r.push(new Cn(E,g,_))}else r.push(new Cn(E))},i);let h=[];for(let b=t;b<a;b++)h.push(new Cn(o.maps[b]));let m=this.items.slice(0,i).append(h).append(r),p=new gn(m,u);return p.emptyItemCount()>ZM&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&o++;else if(a.step){let f=a.step.map(t.slice(r)),h=f&&f.getMap();if(r--,h&&t.appendMap(h,r),f){let m=a.selection&&a.selection.map(t.slice(r));m&&o++;let p=new Cn(h.invert(),f,m),b,S=i.length-1;(b=i.length&&i[S].merge(p))?i[S]=b:i.push(p)}}else a.map&&r--},this.items.length,0),new gn(P0.from(i.reverse()),o)}}gn.empty=new gn(P0.empty,0);function QM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class Cn{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Cn(t.getMap().invert(),t,this.selection)}}}class _r{constructor(e,t,r,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i}}const eT=20;function tT(n,e,t,r){let i=t.getMeta(vr),o;if(i)return i.historyState;t.getMeta(rT)&&(n=new _r(n.done,n.undone,null,0));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(vr))return a.getMeta(vr).redo?new _r(n.done.addTransform(t,void 0,r,Va(e)),n.undone,D0(t.mapping.maps[t.steps.length-1]),n.prevTime):new _r(n.done,n.undone.addTransform(t,void 0,r,Va(e)),null,n.prevTime);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=n.prevTime==0||!a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!nT(t,n.prevRanges)),f=a?_f(n.prevRanges,t.mapping):D0(t.mapping.maps[t.steps.length-1]);return new _r(n.done.addTransform(t,u?e.selection.getBookmark():void 0,r,Va(e)),gn.empty,f,t.time)}else return(o=t.getMeta("rebased"))?new _r(n.done.rebased(t,o),n.undone.rebased(t,o),_f(n.prevRanges,t.mapping),n.prevTime):new _r(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),_f(n.prevRanges,t.mapping),n.prevTime)}function nT(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(t=!0)}),t}function D0(n){let e=[];return n.forEach((t,r,i,o)=>e.push(i,o)),e}function _f(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),o=e.map(n[r+1],-1);i<=o&&t.push(i,o)}return t}function F0(n,e,t,r){let i=Va(e),o=vr.get(e).spec.config,a=(r?n.undone:n.done).popEvent(e,i);if(!a)return;let u=a.selection.resolve(a.transform.doc),f=(r?n.done:n.undone).addTransform(a.transform,e.selection.getBookmark(),o,i),h=new _r(r?f:a.remaining,r?a.remaining:f,null,0);t(a.transform.setSelection(u).setMeta(vr,{redo:r,historyState:h}).scrollIntoView())}let vf=!1,z0=null;function Va(n){let e=n.plugins;if(z0!=e){vf=!1,z0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){vf=!0;break}}return vf}const vr=new fn("history"),rT=new fn("closeHistory");function iT(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Rt({key:vr,state:{init(){return new _r(gn.empty,gn.empty,null,0)},apply(e,t,r){return tT(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?B0:r=="historyRedo"?$0:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}const B0=(n,e)=>{let t=vr.getState(n);return!t||t.done.eventCount==0?!1:(e&&F0(t,n,e,!1),!0)},$0=(n,e)=>{let t=vr.getState(n);return!t||t.undone.eventCount==0?!1:(e&&F0(t,n,e,!0),!0)},sT=De.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>B0(n,e),redo:()=>({state:n,dispatch:e})=>$0(n,e)}},addProseMirrorPlugins(){return[iT(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}}),wf=Object.freeze({COMMON:"common",DESKTOP:"desktop",TABLET:"tablet",MOBILE:"mobile",get values(){return[this.COMMON,this.MOBILE,this.TABLET,this.DESKTOP]}}),Sf=Object.freeze({UPPERCASE:"uppercase",LOWERCASE:"lowercase",CAPITALIZE:"capitalize"}),wr=Object.freeze({LEFT:"left",CENTER:"center",RIGHT:"right",JUSTIFY:"justify",get values(){return[this.LEFT,this.CENTER,this.RIGHT,this.JUSTIFY]}}),ie=Object.freeze({DOCUMENT:"doc",PARAGRAPH:"paragraph",HEADING:"heading",LIST:"list",LIST_ITEM:"listItem",TEXT:"text",get blocks(){return[this.PARAGRAPH,this.LIST,this.HEADING]}}),Yt=Object.freeze({DISC:"disc",CIRCLE:"circle",SQUARE:"square",DECIMAL:"decimal",ROMAN:"roman",LATIN:"latin",get values(){return[this.DISC,this.CIRCLE,this.SQUARE,this.DECIMAL,this.ROMAN,this.LATIN]},get ordered(){return[this.DECIMAL,this.ROMAN,this.LATIN]}}),de=Object.freeze({ALIGNMENT:"alignment",BACKGROUND_COLOR:"background_color",FONT_COLOR:"font_color",FONT_FAMILY:"font_family",FONT_SIZE:"font_size",FONT_STYLE:"font_style",FONT_WEIGHT:"font_weight",LINE_HEIGHT:"line_height",TEXT_DECORATION:"text_decoration",SUPERSCRIPT:"superscript",MARGIN:"margin",LINK:"link",STYLE_PRESET:"style_preset",get attributes(){return[this.ALIGNMENT,this.LINE_HEIGHT,this.MARGIN]},get presetAttributes(){return[this.LINE_HEIGHT]},get inlineMarks(){return[this.TEXT_DECORATION,this.LINK,this.SUPERSCRIPT,this.BACKGROUND_COLOR]},get marks(){return[this.BACKGROUND_COLOR,this.FONT_COLOR,this.FONT_FAMILY,this.FONT_SIZE,this.FONT_STYLE,this.FONT_WEIGHT,this.TEXT_DECORATION,this.SUPERSCRIPT]}}),dn=Object.freeze({SETTINGS:"settings",ALL:"_"}),H0=Object.freeze({BLANK:"_blank",SELF:"_self"}),Bs=Object.freeze({URL:"url",BLOCK:"block"});class xf{static create(e,t){const r=new this(e,t||{});return new Rt({key:new fn(this.name),props:r._buildProps()})}constructor(e,t){this.options=t,this.editor=e}_buildProps(){const t=Object.entries(this.addProps()).map(([r,i])=>[r,i.bind(this)]);return Object.fromEntries(t)}addProps(){return{}}}class oT extends xf{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=El.build(e);return t.normalizeHTML(),this._removeDeprecatedStyles(t),t.normalizedHTML}_removeDeprecatedStyles(e){const t=e.dom.querySelectorAll('[style*="margin"]');for(const r of Array.from(t))r.style.removeProperty("margin"),r.style.removeProperty("margin-top"),r.style.removeProperty("margin-right"),r.style.removeProperty("margin-bottom"),r.style.removeProperty("margin-left")}_handlePaste(e,t,r){const i=this._insertPastedContent(e,r).scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste");return e.dispatch(i),!0}_insertPastedContent({state:e},t){return this._isFullBlockSelected(e)?e.tr.replaceSelectionWith(t.content,!1):e.tr.replaceSelection(t)}_isFullBlockSelected(e){const t=this._expandSelectionToBlocks(e),r=this._isMatchPosition(t.from,e.selection.from),i=this._isMatchPosition(t.to,e.selection.to);return r&&i}_expandSelectionToBlocks({selection:e,doc:t}){let r=e.from,i=e.to;return t.nodesBetween(r,i,(o,a,u)=>{u.type.name===ie.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+o.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class aT extends xf{addProps(){return{decorations:this._buildDecorations}}_buildDecorations({doc:e}){const t=[];if(!this.editor.isEditable)return null;if(!(e.childCount>1))return e.descendants((r,i)=>{if(!r.childCount){const o=Mn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(o)}return!1}),Ze.create(e,t)}}const lT="aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",uT="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u062A\u0635\u0627\u0644\u0627\u062A6\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",zi=(n,e)=>{for(const t in e)n[t]=e[t];return n},Ef="numeric",Cf="ascii",kf="alpha",Wa="asciinumeric",Ua="alphanumeric",Af="domain",V0="emoji",cT="scheme",fT="slashscheme",W0="whitespace";function hT(n,e){return n in e||(e[n]=[]),e[n]}function jr(n,e,t){e[Ef]&&(e[Wa]=!0,e[Ua]=!0),e[Cf]&&(e[Wa]=!0,e[kf]=!0),e[Wa]&&(e[Ua]=!0),e[kf]&&(e[Ua]=!0),e[Ua]&&(e[Af]=!0),e[V0]&&(e[Af]=!0);for(const r in e){const i=hT(r,t);i.indexOf(n)<0&&i.push(n)}}function dT(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function xt(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}xt.groups={},xt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(n))return o}return e.jd},has(n,e){return e===void 0&&(e=!1),e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let i=0;i<n.length;i++)this.tt(n[i],e,t,r)},tr(n,e,t,r){r=r||xt.groups;let i;return e&&e.j?i=e:(i=new xt(e),t&&r&&jr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const o=n.length;if(!o)return i;for(let a=0;a<o-1;a++)i=i.tt(n[a]);return i.tt(n[o-1],e,t,r)},tt(n,e,t,r){r=r||xt.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const o=e;let a,u=i.go(n);if(u?(a=new xt,zi(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new xt,o){if(r)if(a.t&&typeof a.t=="string"){const f=zi(dT(a.t,r),t);jr(o,f,r)}else t&&jr(o,t,r);a.t=o}return i.j[n]=a,a}};const Y=(n,e,t,r,i)=>n.ta(e,t,r,i),Xt=(n,e,t,r,i)=>n.tr(e,t,r,i),U0=(n,e,t,r,i)=>n.ts(e,t,r,i),$=(n,e,t,r,i)=>n.tt(e,t,r,i),Un="WORD",Mf="UWORD",$s="LOCALHOST",Tf="TLD",Of="UTLD",qa="SCHEME",Bi="SLASH_SCHEME",If="NUM",q0="WS",Nf="NL",$i="OPENBRACE",Hs="OPENBRACKET",Vs="OPENANGLEBRACKET",Ws="OPENPAREN",Yr="CLOSEBRACE",Hi="CLOSEBRACKET",Vi="CLOSEANGLEBRACKET",Xr="CLOSEPAREN",Ka="AMPERSAND",Ga="APOSTROPHE",Ja="ASTERISK",Sr="AT",ja="BACKSLASH",Ya="BACKTICK",Xa="CARET",xr="COLON",Rf="COMMA",Za="DOLLAR",Sn="DOT",Qa="EQUALS",Lf="EXCLAMATION",xn="HYPHEN",el="PERCENT",tl="PIPE",nl="PLUS",rl="POUND",il="QUERY",Pf="QUOTE",Df="SEMI",En="SLASH",Us="TILDE",sl="UNDERSCORE",K0="EMOJI",ol="SYM";var G0=Object.freeze({__proto__:null,WORD:Un,UWORD:Mf,LOCALHOST:$s,TLD:Tf,UTLD:Of,SCHEME:qa,SLASH_SCHEME:Bi,NUM:If,WS:q0,NL:Nf,OPENBRACE:$i,OPENBRACKET:Hs,OPENANGLEBRACKET:Vs,OPENPAREN:Ws,CLOSEBRACE:Yr,CLOSEBRACKET:Hi,CLOSEANGLEBRACKET:Vi,CLOSEPAREN:Xr,AMPERSAND:Ka,APOSTROPHE:Ga,ASTERISK:Ja,AT:Sr,BACKSLASH:ja,BACKTICK:Ya,CARET:Xa,COLON:xr,COMMA:Rf,DOLLAR:Za,DOT:Sn,EQUALS:Qa,EXCLAMATION:Lf,HYPHEN:xn,PERCENT:el,PIPE:tl,PLUS:nl,POUND:rl,QUERY:il,QUOTE:Pf,SEMI:Df,SLASH:En,TILDE:Us,UNDERSCORE:sl,EMOJI:K0,SYM:ol});const Wi=/[a-z]/,Ff=/\p{L}/u,zf=/\p{Emoji}/u,Bf=/\d/,J0=/\s/,j0=`
37
+ `,pT="\uFE0F",mT="\u200D";let al=null,ll=null;function gT(n){n===void 0&&(n=[]);const e={};xt.groups=e;const t=new xt;al==null&&(al=Y0(lT)),ll==null&&(ll=Y0(uT)),$(t,"'",Ga),$(t,"{",$i),$(t,"[",Hs),$(t,"<",Vs),$(t,"(",Ws),$(t,"}",Yr),$(t,"]",Hi),$(t,">",Vi),$(t,")",Xr),$(t,"&",Ka),$(t,"*",Ja),$(t,"@",Sr),$(t,"`",Ya),$(t,"^",Xa),$(t,":",xr),$(t,",",Rf),$(t,"$",Za),$(t,".",Sn),$(t,"=",Qa),$(t,"!",Lf),$(t,"-",xn),$(t,"%",el),$(t,"|",tl),$(t,"+",nl),$(t,"#",rl),$(t,"?",il),$(t,'"',Pf),$(t,"/",En),$(t,";",Df),$(t,"~",Us),$(t,"_",sl),$(t,"\\",ja);const r=Xt(t,Bf,If,{[Ef]:!0});Xt(r,Bf,r);const i=Xt(t,Wi,Un,{[Cf]:!0});Xt(i,Wi,i);const o=Xt(t,Ff,Mf,{[kf]:!0});Xt(o,Wi),Xt(o,Ff,o);const a=Xt(t,J0,q0,{[W0]:!0});$(t,j0,Nf,{[W0]:!0}),$(a,j0),Xt(a,J0,a);const u=Xt(t,zf,K0,{[V0]:!0});Xt(u,zf,u),$(u,pT,u);const f=$(u,mT);Xt(f,zf,u);const h=[[Wi,i]],m=[[Wi,null],[Ff,o]];for(let p=0;p<al.length;p++)Er(t,al[p],Tf,Un,h);for(let p=0;p<ll.length;p++)Er(t,ll[p],Of,Mf,m);jr(Tf,{tld:!0,ascii:!0},e),jr(Of,{utld:!0,alpha:!0},e),Er(t,"file",qa,Un,h),Er(t,"mailto",qa,Un,h),Er(t,"http",Bi,Un,h),Er(t,"https",Bi,Un,h),Er(t,"ftp",Bi,Un,h),Er(t,"ftps",Bi,Un,h),jr(qa,{scheme:!0,ascii:!0},e),jr(Bi,{slashscheme:!0,ascii:!0},e),n=n.sort((p,b)=>p[0]>b[0]?1:-1);for(let p=0;p<n.length;p++){const b=n[p][0],E=n[p][1]?{[cT]:!0}:{[fT]:!0};b.indexOf("-")>=0?E[Af]=!0:Wi.test(b)?Bf.test(b)?E[Wa]=!0:E[Cf]=!0:E[Ef]=!0,U0(t,b,b,E)}return U0(t,"localhost",$s,{ascii:!0}),t.jd=new xt(ol),{start:t,tokens:zi({groups:e},G0)}}function yT(n,e){const t=bT(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=t.length,i=[];let o=0,a=0;for(;a<r;){let u=n,f=null,h=0,m=null,p=-1,b=-1;for(;a<r&&(f=u.go(t[a]));)u=f,u.accepts()?(p=0,b=0,m=u):p>=0&&(p+=t[a].length,b++),h+=t[a].length,o+=t[a].length,a++;o-=p,a-=b,h-=p,i.push({t:m.t,v:e.slice(o-h,o),s:o-h,e:o})}return i}function bT(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),o,a=i<55296||i>56319||r+1===t||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Er(n,e,t,r,i){let o;const a=e.length;for(let u=0;u<a-1;u++){const f=e[u];n.j[f]?o=n.j[f]:(o=new xt(r),o.jr=i.slice(),n.j[f]=o),n=o}return o=new xt(t),o.jr=i.slice(),n.j[e[a-1]]=o,o}function Y0(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+o),10);a>0;a--)t.pop();r+=o}else t.push(n[r]),r++}return e}const qs={defaultProtocol:"http",events:null,format:X0,formatHref:X0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function $f(n,e){e===void 0&&(e=null);let t=zi({},qs);n&&(t=zi(t,n instanceof $f?n.o:n));const r=t.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}$f.prototype={o:qs,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:qs[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function X0(n){return n}function Z0(n,e){this.t="token",this.v=n,this.tk=e}Z0.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=qs.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),o=this.toFormattedString(n),a={},u=n.get("className",t,e),f=n.get("target",t,e),h=n.get("rel",t,e),m=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,u&&(a.class=u),f&&(a.target=f),h&&(a.rel=h),m&&zi(a,m),{tagName:i,attributes:a,content:o,eventListeners:p}}};function ul(n,e){class t extends Z0{constructor(i,o){super(i,o),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Q0=ul("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),e1=ul("text"),_T=ul("nl"),Zr=ul("url",{isLink:!0,toHref(n){return n===void 0&&(n=qs.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==$s&&n[1].t===xr}}),je=n=>new xt(n);function vT(n){let{groups:e}=n;const t=e.domain.concat([Ka,Ja,Sr,ja,Ya,Xa,Za,Qa,xn,If,el,tl,nl,rl,En,ol,Us,sl]),r=[Ga,Vi,Yr,Hi,Xr,xr,Rf,Sn,Lf,Vs,$i,Hs,Ws,il,Pf,Df],i=[Ka,Ga,Ja,ja,Ya,Xa,Yr,Za,Qa,xn,$i,el,tl,nl,rl,il,En,ol,Us,sl],o=je(),a=$(o,Us);Y(a,i,a),Y(a,e.domain,a);const u=je(),f=je(),h=je();Y(o,e.domain,u),Y(o,e.scheme,f),Y(o,e.slashscheme,h),Y(u,i,a),Y(u,e.domain,u);const m=$(u,Sr);$(a,Sr,m),$(f,Sr,m),$(h,Sr,m);const p=$(a,Sn);Y(p,i,a),Y(p,e.domain,a);const b=je();Y(m,e.domain,b),Y(b,e.domain,b);const S=$(b,Sn);Y(S,e.domain,b);const E=je(Q0);Y(S,e.tld,E),Y(S,e.utld,E),$(m,$s,E);const g=$(b,xn);Y(g,e.domain,b),Y(E,e.domain,b),$(E,Sn,S),$(E,xn,g);const _=$(E,xr);Y(_,e.numeric,Q0);const x=$(u,xn),k=$(u,Sn);Y(x,e.domain,u),Y(k,i,a),Y(k,e.domain,u);const A=je(Zr);Y(k,e.tld,A),Y(k,e.utld,A),Y(A,e.domain,u),Y(A,i,a),$(A,Sn,k),$(A,xn,x),$(A,Sr,m);const N=$(A,xr),V=je(Zr);Y(N,e.numeric,V);const L=je(Zr),U=je();Y(L,t,L),Y(L,r,U),Y(U,t,L),Y(U,r,U),$(A,En,L),$(V,En,L);const j=$(f,xr),pe=$(h,xr),Et=$(pe,En),yt=$(Et,En);Y(f,e.domain,u),$(f,Sn,k),$(f,xn,x),Y(h,e.domain,u),$(h,Sn,k),$(h,xn,x),Y(j,e.domain,L),$(j,En,L),Y(yt,e.domain,L),Y(yt,t,L),$(yt,En,L);const Ft=$(L,$i),Zn=$(L,Hs),en=$(L,Vs),Tn=$(L,Ws);$(U,$i,Ft),$(U,Hs,Zn),$(U,Vs,en),$(U,Ws,Tn),$(Ft,Yr,L),$(Zn,Hi,L),$(en,Vi,L),$(Tn,Xr,L),$(Ft,Yr,L);const Ve=je(Zr),We=je(Zr),Ue=je(Zr),zt=je(Zr);Y(Ft,t,Ve),Y(Zn,t,We),Y(en,t,Ue),Y(Tn,t,zt);const st=je(),qe=je(),Qn=je(),er=je();return Y(Ft,r),Y(Zn,r),Y(en,r),Y(Tn,r),Y(Ve,t,Ve),Y(We,t,We),Y(Ue,t,Ue),Y(zt,t,zt),Y(Ve,r,Ve),Y(We,r,We),Y(Ue,r,Ue),Y(zt,r,zt),Y(st,t,st),Y(qe,t,We),Y(Qn,t,Ue),Y(er,t,zt),Y(st,r,st),Y(qe,r,qe),Y(Qn,r,Qn),Y(er,r,er),$(We,Hi,L),$(Ue,Vi,L),$(zt,Xr,L),$(Ve,Yr,L),$(qe,Hi,L),$(Qn,Vi,L),$(er,Xr,L),$(st,Xr,L),$(o,$s,A),$(o,Nf,_T),{start:o,tokens:G0}}function wT(n,e,t){let r=t.length,i=0,o=[],a=[];for(;i<r;){let u=n,f=null,h=null,m=0,p=null,b=-1;for(;i<r&&!(f=u.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=f||u.go(t[i].t));)f=null,u=h,u.accepts()?(b=0,p=u):b>=0&&b++,i++,m++;if(b<0)i-=m,i<r&&(a.push(t[i]),i++);else{a.length>0&&(o.push(Hf(e1,e,a)),a=[]),i-=b,m-=b;const S=p.t,E=t.slice(i-m,i);o.push(Hf(S,e,E))}}return a.length>0&&o.push(Hf(e1,e,a)),o}function Hf(n,e,t){const r=t[0].s,i=t[t.length-1].e,o=e.slice(r,i);return new n(o,t)}const ST=typeof console<"u"&&console&&console.warn||(()=>{}),xT="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function ET(){xt.groups={},Oe.scanner=null,Oe.parser=null,Oe.tokenQueue=[],Oe.pluginQueue=[],Oe.customSchemes=[],Oe.initialized=!1}function t1(n,e){if(e===void 0&&(e=!1),Oe.initialized&&ST(`linkifyjs: already initialized - will not register custom scheme "${n}" ${xT}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
38
38
  1. Must only contain digits, lowercase ASCII letters or "-"
39
39
  2. Cannot start or end with "-"
40
- 3. "-" cannot repeat`);Me.customSchemes.push([n,e])}function ZM(){Me.scanner=VM(Me.customSchemes);for(let n=0;n<Me.tokenQueue.length;n++)Me.tokenQueue[n][1]({scanner:Me.scanner});Me.parser=GM(Me.scanner.tokens);for(let n=0;n<Me.pluginQueue.length;n++)Me.pluginQueue[n][1]({scanner:Me.scanner,parser:Me.parser});Me.initialized=!0}function j0(n){return Me.initialized||ZM(),JM(Me.parser.start,n,UM(Me.scanner.start,n))}function Lf(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Nf(t),i=j0(n),o=[];for(let a=0;a<i.length;a++){const u=i[a];u.isLink&&(!e||u.t===e)&&o.push(u.toFormattedObject(r))}return o}function QM(n,e){e===void 0&&(e=null);const t=j0(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class eT extends mf{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=QM(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return sh.query(t,{typeName:ie.TEXT,mark:{typeName:de.LINK},getMark:{typeName:de.LINK}})?.attrs||{href:e}}}function B(n){return(...e)=>t=>n(t,...e)}function rl(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Yr(n){const e=rl(n);return["span",e?{...e,class:"zw-style"}:{},0]}function tT(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Jt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var nT=Object.defineProperty,rT=(n,e,t)=>e in n?nT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hn=(n,e,t)=>rT(n,typeof e!="symbol"?e+"":e,t),Y0,X0,Z0;function Fe(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,u)=>e.map(f=>f[u])),o=n.map(a=>i.map(u=>{let f=0;if(!Array.isArray(a)){for(let h of u)f+=a*h;return f}for(let h=0;h<a.length;h++)f+=a[h]*(u[h]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function Q0(n){return Hs(n)==="string"}function Hs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Pf(n,{precision:e,unit:t}){return Df(n)?"none":iT(n,e)+(t??"")}function Df(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function iT(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const sT={deg:1,grad:.9,rad:180/Math.PI,turn:360};function oT(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(u,f)=>{let h=f.match(r),m=f;if(h){let p=h[0],b=m.slice(0,-p.length);p==="%"?(m=new Number(b/100),m.type="<percentage>"):(m=new Number(b*sT[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);u.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function aT(n){return n[n.length-1]}function e1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function lT(n,e,t){return(t-n)/(e-n)}function t1(n,e,t){return e1(e[0],e[1],lT(n[0],n[1],t))}function uT(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function cT(n,e,t){return Math.max(Math.min(t,e),n)}function Ff(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function Wn(n,e){return Ff(Math.abs(n)**e,n)}function n1(n,e){return e===0?0:n/e}function fT(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class hT{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const il=new hT,Vn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function zf(n){return Array.isArray(n)?n:Vn[n]}function sl(n,e,t,r={}){if(n=zf(n),e=zf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(il.run("chromatic-adaptation-start",i),i.M||(i.W1===Vn.D65&&i.W2===Vn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Vn.D50&&i.W2===Vn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),il.run("chromatic-adaptation-end",i),i.M)return Fe(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Ws={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((Z0=(X0=(Y0=globalThis?.process)==null?void 0:Y0.env)==null?void 0:X0.NODE_ENV)==null?void 0:Z0.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},dT=new Set(["<number>","<percentage>","<angle>"]);function r1(n,e,t,r){return Object.entries(n.coords).map(([o,a],u)=>{let f=e.coordGrammar[u],h=r[u],m=h?.type,p;if(h.none?p=f.find(k=>dT.has(k)):p=f.find(k=>k==m),!p){let k=a.name||o;throw new TypeError(`${m??h.raw} not allowed for ${k} in ${t}()`)}let b=p.range;m==="<percentage>"&&(b||(b=[0,1]));let S=a.range||a.refRange;return b&&S&&(r[u]=t1(b,S,r[u])),p})}function i1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(il.run("parse-start",a),a.color)return a.color;if(a.parsed=oT(a.str),a.parsed){let u=a.parsed.name;if(u==="color"){let f=a.parsed.args.shift(),h=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,h],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let k of ae.all){let g=k.getFormat("color");if(g&&(m.includes(g.id)||(r=g.ids)!=null&&r.filter(_=>m.includes(_)).length)){const _=Object.keys(k.coords).map((E,A)=>a.parsed.args[A]||0);let x;return g.coordGrammar&&(x=r1(k,g,"color",_)),e&&Object.assign(e,{formatId:"color",types:x}),g.id.startsWith("--")&&!f.startsWith("--")&&Ws.warn(`${k.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${g.id}) instead of color(${f}).`),f.startsWith("--")&&!g.id.startsWith("--")&&Ws.warn(`${k.name} is a standard space and supported in the CSS spec. Use color(${g.id}) instead of prefixed color(${f}).`),{spaceId:k.id,coords:_,alpha:p}}}let b="",S=f in ae.registry?f:h;if(S in ae.registry){let k=(o=(i=ae.registry[S].formats)==null?void 0:i.color)==null?void 0:o.id;k&&(b=`Did you mean color(${k})?`)}throw new TypeError(`Cannot parse color(${f}). `+(b||"Missing a plugin?"))}else for(let f of ae.all){let h=f.getFormat(u);if(h&&h.type==="function"){let m=1;(h.lastAlpha||aT(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,b;return h.coordGrammar&&(b=r1(f,h,u,p)),e&&Object.assign(e,{formatId:h.name,types:b}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let u of ae.all)for(let f in u.formats){let h=u.formats[f];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let m=h.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ke(n){if(Array.isArray(n))return n.map(Ke);if(!n)throw new TypeError("Empty color reference");Q0(n)&&(n=i1(n));let e=n.space||n.spaceId;return e instanceof ae||(n.space=ae.get(e)),n.alpha===void 0&&(n.alpha=1),n}const pT=75e-6,Bf=class cn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?cn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=zf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:cn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:mT(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),il.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=pT}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[u,f]=a.range;return(u===void 0||i>=u-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=s1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=s1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const u=Ke(e);[e,t]=[u.space,u.coords]}if(e=cn.get(e),this.equals(e))return t;t=t.map(u=>Number.isNaN(u)?0:u);let r=this.path,i=e.path,o,a;for(let u=0;u<r.length&&r[u].equals(i[u]);u++)o=r[u],a=u;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let u=r.length-1;u>a;u--)t=r[u].toBase(t);for(let u=a+1;u<i.length;u++)t=i[u].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ke(e);[e,t]=[r.space,r.coords]}return e=cn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(cn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof cn)return e;if(Hs(e)==="string"){let i=cn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return cn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Hs(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=cn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Hs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(o.coords)[a];if(h)return{space:o,id:h[0],index:a,...h[1]}}o=cn.get(o);let u=a.toLowerCase(),f=0;for(let h in o.coords){let m=o.coords[h];if(h.toLowerCase()===u||((r=m.name)==null?void 0:r.toLowerCase())===u)return{space:o,id:h,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};Hn(Bf,"registry",{}),Hn(Bf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let ae=Bf;function mT(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function s1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=uT(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],u=i.range||i.refRange,f=a.range,h="";return a=="<percentage>"?(f=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:u,toRange:f,suffix:h}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:u,toRange:f,suffix:h}=t[a];return u&&f&&(o=t1(u,f,o)),o=Pf(o,{precision:i,unit:h}),o})}return n}const Un=new ae({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class o1 extends ae{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Un),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=Fe(e.toXYZ_M,t);return this.white!==this.base.white&&(r=sl(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=sl(this.base.white,this.white,t),Fe(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function $f(n,e){return n=Ke(n),!e||n.space.equals(e)?n.coords.slice():(e=ae.get(e),e.from(n))}function qn(n,e){n=Ke(n);let{space:t,index:r}=ae.resolveCoord(e,n.space);return $f(n,t)[r]}function a1(n,e,t){return n=Ke(n),e=ae.get(e),n.coords=e.to(n.space,t),n}a1.returns="color";function Hf(n,e,t){if(n=Ke(n),arguments.length===2&&Hs(arguments[1])==="object"){let r=arguments[1];for(let i in r)Hf(n,i,r[i])}else{typeof t=="function"&&(t=t(qn(n,e)));let{space:r,index:i}=ae.resolveCoord(e,n.space),o=$f(n,r);o[i]=t,a1(n,r,o)}return n}Hf.returns="color";const gT=new ae({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Un,fromBase:n=>sl(Un.white,"D50",n),toBase:n=>sl("D50",Un.white,n)}),yT=216/24389,l1=24/116,ol=24389/27;let Wf=Vn.D50;const Kn=new ae({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Wf,base:gT,fromBase(n){let t=n.map((r,i)=>r/Wf[i]).map(r=>r>yT?Math.cbrt(r):(ol*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>l1?Math.pow(e[0],3):(116*e[0]-16)/ol,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/ol,e[2]>l1?Math.pow(e[2],3):(116*e[2]-16)/ol].map((r,i)=>r*Wf[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Xr(n){return(n%360+360)%360}const al=new ae({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Kn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Xr(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),u1=25**7,ll=Math.PI,c1=180/ll,$i=ll/180;function f1(n){const e=n*n;return e*e*e*n}function h1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ke([n,e]);let[o,a,u]=Kn.from(n),f=al.from(Kn,[o,a,u])[1],[h,m,p]=Kn.from(e),b=al.from(Kn,[h,m,p])[1];f<0&&(f=0),b<0&&(b=0);let S=(f+b)/2,k=f1(S),g=.5*(1-Math.sqrt(k/(k+u1))),_=(1+g)*a,x=(1+g)*m,E=Math.sqrt(_**2+u**2),A=Math.sqrt(x**2+p**2),N=_===0&&u===0?0:Math.atan2(u,_),W=x===0&&p===0?0:Math.atan2(p,x);N<0&&(N+=2*ll),W<0&&(W+=2*ll),N*=c1,W*=c1;let L=h-o,U=A-E,j=W-N,me=N+W,St=Math.abs(j),dt;E*A===0?dt=0:St<=180?dt=j:j>180?dt=j-360:j<-180?dt=j+360:Ws.warn("the unthinkable has happened");let Lt=2*Math.sqrt(A*E)*Math.sin(dt*$i/2),Jn=(o+h)/2,Xt=(E+A)/2,xn=f1(Xt),Be;E*A===0?Be=me:St<=180?Be=me/2:me<360?Be=(me+360)/2:Be=(me-360)/2;let $e=(Jn-50)**2,He=1+.015*$e/Math.sqrt(20+$e),Pt=1+.045*Xt,tt=1;tt-=.17*Math.cos((Be-30)*$i),tt+=.24*Math.cos(2*Be*$i),tt+=.32*Math.cos((3*Be+6)*$i),tt-=.2*Math.cos((4*Be-63)*$i);let We=1+.015*Xt*tt,jn=30*Math.exp(-1*((Be-275)/25)**2),Yn=2*Math.sqrt(xn/(xn+u1)),bl=-1*Math.sin(2*jn*$i)*Yn,Zt=(L/(t*He))**2;return Zt+=(U/(r*Pt))**2,Zt+=(Lt/(i*We))**2,Zt+=bl*(U/(r*Pt))*(Lt/(i*We)),Math.sqrt(Zt)}const bT=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],_T=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],vT=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],wT=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],ul=new ae({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Un,fromBase(n){let t=Fe(bT,n).map(r=>Math.cbrt(r));return Fe(vT,t)},toBase(n){let t=Fe(wT,n).map(r=>r**3);return Fe(_T,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Vf(n,e){[n,e]=Ke([n,e]);let[t,r,i]=ul.from(n),[o,a,u]=ul.from(e),f=t-o,h=r-a,m=i-u;return Math.sqrt(f**2+h**2+m**2)}const ST=75e-6;function Hi(n,e,{epsilon:t=ST}={}){n=Ke(n),e||(e=n.space),e=ae.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function Uf(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function xT(n,e,t="lab"){t=ae.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,u)=>{let f=i[u];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function kT(n,e){return xT(n,e,"lab")}const CT=Math.PI,d1=CT/180;function ET(n,e,{l:t=2,c:r=1}={}){[n,e]=Ke([n,e]);let[i,o,a]=Kn.from(n),[,u,f]=al.from(Kn,[i,o,a]),[h,m,p]=Kn.from(e),b=al.from(Kn,[h,m,p])[1];u<0&&(u=0),b<0&&(b=0);let S=i-h,k=u-b,g=o-m,_=a-p,x=g**2+_**2-k**2,E=.511;i>=16&&(E=.040975*i/(1+.01765*i));let A=.0638*u/(1+.0131*u)+.638,N;Number.isNaN(f)&&(f=0),f>=164&&f<=345?N=.56+Math.abs(.2*Math.cos((f+168)*d1)):N=.36+Math.abs(.4*Math.cos((f+35)*d1));let W=Math.pow(u,4),L=Math.sqrt(W/(W+1900)),U=A*(L*N+1-L),j=(S/(t*E))**2;return j+=(k/(r*A))**2,j+=x/U**2,Math.sqrt(j)}const p1=203,m1=new ae({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Un,fromBase(n){return n.map(e=>Math.max(e*p1,0))},toBase(n){return n.map(e=>Math.max(e/p1,0))}}),cl=1.15,fl=.66,g1=2610/2**14,AT=2**14/2610,y1=3424/2**12,b1=2413/2**7,_1=2392/2**7,MT=1.7*2523/2**5,v1=2**5/(1.7*2523),hl=-.56,qf=16295499532821565e-27,TT=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],OT=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],IT=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],NT=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],RT=new ae({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:m1,fromBase(n){let[e,t,r]=n,i=cl*e-(cl-1)*r,o=fl*t-(fl-1)*e,u=Fe(TT,[i,o,r]).map(function(b){let S=y1+b1*(b/1e4)**g1,k=1+_1*(b/1e4)**g1;return(S/k)**MT}),[f,h,m]=Fe(IT,u);return[(1+hl)*f/(1+hl*f)-qf,h,m]},toBase(n){let[e,t,r]=n,i=(e+qf)/(1+hl-hl*(e+qf)),a=Fe(NT,[i,t,r]).map(function(b){let S=y1-b**v1,k=_1*b**v1-b1;return 1e4*(S/k)**AT}),[u,f,h]=Fe(OT,a),m=(u+(cl-1)*h)/cl,p=(f+(fl-1)*m)/fl;return[m,p,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),w1=new ae({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:RT,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Xr(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function LT(n,e){[n,e]=Ke([n,e]);let[t,r,i]=w1.from(n),[o,a,u]=w1.from(e),f=t-o,h=r-a;Number.isNaN(i)&&Number.isNaN(u)?(i=0,u=0):Number.isNaN(i)?i=u:Number.isNaN(u)&&(u=i);let m=i-u,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+h**2+p**2)}const S1=3424/4096,x1=2413/128,k1=2392/128,C1=2610/16384,PT=2523/32,DT=16384/2610,E1=32/2523,FT=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],zT=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],BT=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],$T=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],A1=new ae({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:m1,fromBase(n){let e=Fe(FT,n);return HT(e)},toBase(n){let e=WT(n);return Fe($T,e)}});function HT(n){let e=n.map(function(t){let r=S1+x1*(t/1e4)**C1,i=1+k1*(t/1e4)**C1;return(r/i)**PT});return Fe(zT,e)}function WT(n){return Fe(BT,n).map(function(r){let i=Math.max(r**E1-S1,0),o=x1-k1*r**E1;return 1e4*(i/o)**DT})}function VT(n,e){[n,e]=Ke([n,e]);let[t,r,i]=A1.from(n),[o,a,u]=A1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-u)**2)}const UT=Vn.D65,M1=.42,T1=1/M1,Kf=2*Math.PI,O1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],qT=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],KT=[[460,451,288],[460,-891,-261],[460,-220,-6300]],GT={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Zr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},JT=180/Math.PI,I1=Math.PI/180;function N1(n,e){return n.map(r=>{const i=Wn(e*Math.abs(r)*.01,M1);return 400*Ff(i,r)/(i+27.13)})}function jT(n,e){const t=100/e*27.13**T1;return n.map(r=>{const i=Math.abs(r);return Ff(t*Wn(i/(400-i),T1),r)})}function YT(n){let e=Xr(n);e<=Zr.h[0]&&(e+=360);const t=fT(Zr.h,e)-1,[r,i]=Zr.h.slice(t,t+2),[o,a]=Zr.e.slice(t,t+2),u=Zr.H[t],f=(e-r)/o;return u+100*f/(f+(i-e)/a)}function XT(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=Zr.h.slice(t,t+2),[o,a]=Zr.e.slice(t,t+2);return Xr((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function R1(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(g=>g*100);o.la=e,o.yb=t;const u=a[1],f=Fe(O1,a);r=GT[o.surround];const h=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/u,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const b=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(g=>e1(1,u/g,b)),o.dRgbInv=o.dRgb.map(g=>1/g);const S=f.map((g,_)=>g*o.dRgb[_]),k=N1(S,o.fl);return o.aW=o.nbb*(2*k[0]+k[1]+.05*k[2]),o}const L1=R1(UT,64/Math.PI*.2,20,"average",!1);function Gf(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=Xr(n.h)*I1:t=XT(n.H)*I1;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=Wn(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const u=Wn(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),h=e.aW*Wn(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=h/e.nbb,b=23*(p+.305)*n1(u,23*m+u*(11*r+108*i)),S=b*r,k=b*i,g=jT(Fe(KT,[p,S,k]).map(_=>_*1/1403),e.fl);return Fe(qT,g.map((_,x)=>_*e.dRgbInv[x])).map(_=>_/100)}function P1(n,e){const t=n.map(A=>A*100),r=N1(Fe(O1,t).map((A,N)=>A*e.dRgb[N]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%Kf+Kf)%Kf,u=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*n1(u*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),h=Wn(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=Wn(m/e.aW,.5*e.c*e.z),b=100*Wn(p,2),S=4/e.c*p*(e.aW+4)*e.flRoot,k=h*p,g=k*e.flRoot,_=Xr(a*JT),x=YT(_),E=50*Wn(e.c*h/(e.aW+4),1/2);return{J:b,C:k,h:_,s:E,Q:S,M:g,H:x}}new ae({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Un,fromBase(n){const e=P1(n,L1);return[e.J,e.M,e.h]},toBase(n){return Gf({J:n[0],M:n[1],h:n[2]},L1)}});const ZT=Vn.D65,QT=216/24389,D1=24389/27;function eO(n){return 116*(n>QT?Math.cbrt(n):(D1*n+16)/116)-16}function Jf(n){return n>8?Math.pow((n+16)/116,3):n/D1}function tO(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let u=Jf(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,h=15;let m=0,p=1/0;for(;m<=h;){o=Gf({J:a,C:r,h:t},e);const b=Math.abs(o[1]-u);if(b<p){if(b<=f)return o;p=b}a=a-(o[1]-u)*a/(2*o[1]),m+=1}return Gf({J:a,C:r,h:t},e)}function nO(n,e){const t=eO(n[1]);if(t===0)return[0,0,0];const r=P1(n,jf);return[Xr(r.h),r.C,t]}const jf=R1(ZT,200/Math.PI*Jf(50),Jf(50)*100,"average",!1),dl=new ae({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Un,fromBase(n){return nO(n)},toBase(n){return tO(n,jf)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),rO=Math.PI/180,F1=[1,.007,.0228];function z1(n){n[1]<0&&(n=dl.fromBase(dl.toBase(n)));const e=Math.log(Math.max(1+F1[2]*n[1]*jf.flRoot,1))/F1[2],t=n[0]*rO,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function iO(n,e){[n,e]=Ke([n,e]);let[t,r,i]=z1(dl.from(n)),[o,a,u]=z1(dl.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-u)**2)}const B1={deltaE76:kT,deltaECMC:ET,deltaE2000:h1,deltaEJz:LT,deltaEITP:VT,deltaEOK:Vf,deltaEHCT:iO};function sO(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const $1={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Vs(n,{method:e=Ws.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ke(n),Q0(arguments[1])?t=arguments[1]:t||(t=n.space),t=ae.get(t),Hi(n,t,{epsilon:0}))return n;let a;if(e==="css")a=oO(n,{space:t});else{if(e!=="clip"&&!Hi(n,t)){Object.prototype.hasOwnProperty.call($1,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=$1[e]);let u=h1;if(r!==""){for(let h in B1)if("deltae"+r.toLowerCase()===h.toLowerCase()){u=B1[h];break}}let f=Vs(ze(n,t),{method:"clip",space:t});if(u(n,f)>i){if(Object.keys(o).length===3){let E=ae.resolveCoord(o.channel),A=qn(ze(n,E.space),E.id);if(Df(A)&&(A=0),A>=o.max)return ze({space:"xyz-d65",coords:Vn.D65},n.space);if(A<=o.min)return ze({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=ae.resolveCoord(e),m=h.space,p=h.id,b=ze(n,m);b.coords.forEach((E,A)=>{Df(E)&&(b.coords[A]=0)});let k=(h.range||h.refRange)[0],g=sO(i),_=k,x=qn(b,p);for(;x-_>g;){let E=Uf(b);E=Vs(E,{space:t,method:"clip"}),u(b,E)-i<g?_=qn(b,p):x=qn(b,p),Hf(b,p,(_+x)/2)}a=ze(b,t)}else a=f}else a=ze(n,t);if(e==="clip"||!Hi(a,t,{epsilon:0})){let u=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,h)=>{let[m,p]=u[h];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=ze(a,n.space)),n.coords=a.coords,n}Vs.returns="color";const H1={WHITE:{space:ul,coords:[1,0,0]},BLACK:{space:ul,coords:[0,0,0]}};function oO(n,{space:e}={}){n=Ke(n),e||(e=n.space),e=ae.get(e);const i=ae.get("oklch");if(e.isUnbounded)return ze(n,e);const o=ze(n,i);let a=o.coords[0];if(a>=1){const k=ze(H1.WHITE,e);return k.alpha=n.alpha,ze(k,e)}if(a<=0){const k=ze(H1.BLACK,e);return k.alpha=n.alpha,ze(k,e)}if(Hi(o,e,{epsilon:0}))return ze(o,e);function u(k){const g=ze(k,e),_=Object.values(e.coords);return g.coords=g.coords.map((x,E)=>{if("range"in _[E]){const[A,N]=_[E].range;return cT(A,x,N)}return x}),g}let f=0,h=o.coords[1],m=!0,p=Uf(o),b=u(p),S=Vf(b,p);if(S<.02)return b;for(;h-f>1e-4;){const k=(f+h)/2;if(p.coords[1]=k,m&&Hi(p,e,{epsilon:0}))f=k;else if(b=u(p),S=Vf(b,p),S<.02){if(.02-S<1e-4)break;m=!1,f=k}else h=k}return b}function ze(n,e,{inGamut:t}={}){n=Ke(n),e=ae.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Vs(i,t===!0?void 0:t)),i}ze.returns="color";function aO(n,{precision:e=Ws.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ke(n);let u=t;t=n.space.getFormat(t)??n.space.getFormat("default")??ae.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!Hi(n)&&(f=Vs(Uf(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${u} can only be used to parse colors, not for serialization`);else{let h=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(S=>Pf(S,{precision:e})));let m=[...f];if(h==="color"){let S=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(S)}let p=n.alpha;e!==null&&(p=Pf(p,{precision:e}));let b=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${h}(${m.join(t.commas?", ":" ")}${b})`}return a}const lO=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],uO=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],cO=new o1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:lO,fromXYZ_M:uO}),W1={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let V1=Array(3).fill("<percentage> | <number>[0, 255]"),U1=Array(3).fill("<number>[0, 255]");const q1=new o1({id:"srgb",name:"sRGB",base:cO,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:V1},rgb_number:{name:"rgb",commas:!0,coords:U1,noAlpha:!0},color:{},rgba:{coords:V1,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:U1},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=W1.black,e.alpha=0):e.coords=W1[n],e.coords)return e}}}});function fO(n){return qn(n,[Un,"y"])}const K1=new ae({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:q1,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,u,f]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(u=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/h+(i<o?6:0);break;case i:a=(o-r)/h+2;break;case o:a=(r-i)/h+4}a=a*60}return u<0&&(a+=180,u=Math.abs(u)),a>=360&&(a-=360),[a,u*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,u=t*Math.min(r,1-r);return r-u*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),hO=new ae({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:K1,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});class Rt{constructor(e){Hn(this,"data"),this.data=ze(e,"srgb")}static fromTransparent(){return new Rt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Rt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Rt({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return qn(this.data,"hsv.h")}get s(){return qn(this.data,"hsv.s")}get v(){return qn(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return fO(this.data)<.5}withAlpha(e){return new Rt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Rt({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=$f(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Rt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=aO(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Rt(this.data)}}class dO{constructor(e){Hn(this,"_color"),Hn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let G1=999;function pO(){return G1+=1,G1}function mO(n){return n?n.startsWith("linear-gradient("):!1}function gO(){const n=Rt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}ae.register(q1),ae.register(hO),ae.register(K1);function J1(n){if(!n)return Rt.fromTransparent();try{return new Rt(ze(i1(n),"srgb"))}catch(e){return console.warn(e),Rt.fromBlack()}}function yO(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function bO(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:J1(t),offset:Number.parseFloat(r.replace("%",""))}})}function _O(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=bO(i),a=yO(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function vO(n){const e=J1(n),t=Rt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function wO(n,e=!0){if(!n)return gO();const t=mO(n)?_O(n):vO(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class rh{constructor(e,t=0){Hn(this,"id"),this.color=e,this.offset=t,this.id=pO()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new rh(this.color.clone(),e)}}class SO{constructor(e){Hn(this,"isEmpty",!1),Hn(this,"_angle",0),Hn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new rh(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function xO(n){const e=wO(n);return(e.isGradient?new SO(e):new dO(e)).toString()}function j1(n){return xO(n)}function Y1(n,e){if(!n.includes("em"))return parseInt(n);const t=Wi.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function kO(n,e){return(n.firstElementChild||n).style.fontSize||Wi.getComputedStyle(e).fontSize}function CO(n,e,t){if(!n.includes("px"))return n;const r=kO(e,t),i=Y1(r,t);return i?(parseInt(n)/i).toFixed(2):null}const EO={start:_r.LEFT,end:_r.RIGHT};function AO(n){const e=EO[n]||n;return _r.values.includes(e)?e:null}const X1=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function Z1(n,e){return n.resolve(e).depth+1}function MO(n,e,t,r){const i=Z1(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const TO=(n,e)=>n.eq(e);function OO(n,e,t,r=TO){const i=n.resolve(e).path.reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function IO(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var Us={exports:{}};var NO=Us.exports,Q1;function RO(){return Q1||(Q1=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",p=1,b=2,S=4,k=1,g=2,_=1,x=2,E=4,A=8,N=16,W=32,L=64,U=128,j=256,me=512,St=30,dt="...",Lt=800,Jn=16,Xt=1,xn=2,Be=3,$e=1/0,He=9007199254740991,Pt=17976931348623157e292,tt=NaN,We=4294967295,jn=We-1,Yn=We>>>1,bl=[["ary",U],["bind",_],["bindKey",x],["curry",A],["curryRight",N],["flip",me],["partial",W],["partialRight",L],["rearg",j]],Zt="[object Arguments]",Gs="[object Array]",uy="[object AsyncFunction]",Gi="[object Boolean]",Ji="[object Date]",cy="[object DOMException]",Js="[object Error]",js="[object Function]",oh="[object GeneratorFunction]",Qt="[object Map]",ji="[object Number]",fy="[object Null]",kn="[object Object]",ah="[object Promise]",hy="[object Proxy]",Yi="[object RegExp]",en="[object Set]",Xi="[object String]",Ys="[object Symbol]",dy="[object Undefined]",Zi="[object WeakMap]",py="[object WeakSet]",Qi="[object ArrayBuffer]",ni="[object DataView]",_l="[object Float32Array]",vl="[object Float64Array]",wl="[object Int8Array]",Sl="[object Int16Array]",xl="[object Int32Array]",kl="[object Uint8Array]",Cl="[object Uint8ClampedArray]",El="[object Uint16Array]",Al="[object Uint32Array]",my=/\b__p \+= '';/g,gy=/\b(__p \+=) '' \+/g,yy=/(__e\(.*?\)|\b__t\)) \+\n'';/g,lh=/&(?:amp|lt|gt|quot|#39);/g,uh=/[&<>"']/g,by=RegExp(lh.source),_y=RegExp(uh.source),vy=/<%-([\s\S]+?)%>/g,wy=/<%([\s\S]+?)%>/g,ch=/<%=([\s\S]+?)%>/g,Sy=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xy=/^\w*$/,ky=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ml=/[\\^$.*+?()[\]{}|]/g,Cy=RegExp(Ml.source),Tl=/^\s+/,Ey=/\s/,Ay=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,My=/\{\n\/\* \[wrapped with (.+)\] \*/,Ty=/,? & /,Oy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Iy=/[()=,{}\[\]\/\s]/,Ny=/\\(\\)?/g,Ry=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fh=/\w*$/,Ly=/^[-+]0x[0-9a-f]+$/i,Py=/^0b[01]+$/i,Dy=/^\[object .+?Constructor\]$/,Fy=/^0o[0-7]+$/i,zy=/^(?:0|[1-9]\d*)$/,By=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xs=/($^)/,$y=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",Hy="\\u0300-\\u036f",Wy="\\ufe20-\\ufe2f",Vy="\\u20d0-\\u20ff",hh=Hy+Wy+Vy,dh="\\u2700-\\u27bf",ph="a-z\\xdf-\\xf6\\xf8-\\xff",Uy="\\xac\\xb1\\xd7\\xf7",qy="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ky="\\u2000-\\u206f",Gy=" \\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",mh="A-Z\\xc0-\\xd6\\xd8-\\xde",gh="\\ufe0e\\ufe0f",yh=Uy+qy+Ky+Gy,Ol="['\u2019]",Jy="["+Zs+"]",bh="["+yh+"]",Qs="["+hh+"]",_h="\\d+",jy="["+dh+"]",vh="["+ph+"]",wh="[^"+Zs+yh+_h+dh+ph+mh+"]",Il="\\ud83c[\\udffb-\\udfff]",Yy="(?:"+Qs+"|"+Il+")",Sh="[^"+Zs+"]",Nl="(?:\\ud83c[\\udde6-\\uddff]){2}",Rl="[\\ud800-\\udbff][\\udc00-\\udfff]",ri="["+mh+"]",xh="\\u200d",kh="(?:"+vh+"|"+wh+")",Xy="(?:"+ri+"|"+wh+")",Ch="(?:"+Ol+"(?:d|ll|m|re|s|t|ve))?",Eh="(?:"+Ol+"(?:D|LL|M|RE|S|T|VE))?",Ah=Yy+"?",Mh="["+gh+"]?",Zy="(?:"+xh+"(?:"+[Sh,Nl,Rl].join("|")+")"+Mh+Ah+")*",Qy="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Th=Mh+Ah+Zy,tb="(?:"+[jy,Nl,Rl].join("|")+")"+Th,nb="(?:"+[Sh+Qs+"?",Qs,Nl,Rl,Jy].join("|")+")",rb=RegExp(Ol,"g"),ib=RegExp(Qs,"g"),Ll=RegExp(Il+"(?="+Il+")|"+nb+Th,"g"),sb=RegExp([ri+"?"+vh+"+"+Ch+"(?="+[bh,ri,"$"].join("|")+")",Xy+"+"+Eh+"(?="+[bh,ri+kh,"$"].join("|")+")",ri+"?"+kh+"+"+Ch,ri+"+"+Eh,eb,Qy,_h,tb].join("|"),"g"),ob=RegExp("["+xh+Zs+hh+gh+"]"),ab=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,lb=["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"],ub=-1,ke={};ke[_l]=ke[vl]=ke[wl]=ke[Sl]=ke[xl]=ke[kl]=ke[Cl]=ke[El]=ke[Al]=!0,ke[Zt]=ke[Gs]=ke[Qi]=ke[Gi]=ke[ni]=ke[Ji]=ke[Js]=ke[js]=ke[Qt]=ke[ji]=ke[kn]=ke[Yi]=ke[en]=ke[Xi]=ke[Zi]=!1;var xe={};xe[Zt]=xe[Gs]=xe[Qi]=xe[ni]=xe[Gi]=xe[Ji]=xe[_l]=xe[vl]=xe[wl]=xe[Sl]=xe[xl]=xe[Qt]=xe[ji]=xe[kn]=xe[Yi]=xe[en]=xe[Xi]=xe[Ys]=xe[kl]=xe[Cl]=xe[El]=xe[Al]=!0,xe[Js]=xe[js]=xe[Zi]=!1;var cb={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},fb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},db={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},pb=parseFloat,mb=parseInt,Oh=typeof $o=="object"&&$o&&$o.Object===Object&&$o,gb=typeof self=="object"&&self&&self.Object===Object&&self,je=Oh||gb||Function("return this")(),Pl=e&&!e.nodeType&&e,Er=Pl&&!0&&n&&!n.nodeType&&n,Ih=Er&&Er.exports===Pl,Dl=Ih&&Oh.process,Dt=function(){try{var T=Er&&Er.require&&Er.require("util").types;return T||Dl&&Dl.binding&&Dl.binding("util")}catch{}}(),Nh=Dt&&Dt.isArrayBuffer,Rh=Dt&&Dt.isDate,Lh=Dt&&Dt.isMap,Ph=Dt&&Dt.isRegExp,Dh=Dt&&Dt.isSet,Fh=Dt&&Dt.isTypedArray;function xt(T,R,I){switch(I.length){case 0:return T.call(R);case 1:return T.call(R,I[0]);case 2:return T.call(R,I[0],I[1]);case 3:return T.call(R,I[0],I[1],I[2])}return T.apply(R,I)}function yb(T,R,I,q){for(var te=-1,be=T==null?0:T.length;++te<be;){var Pe=T[te];R(q,Pe,I(Pe),T)}return q}function Ft(T,R){for(var I=-1,q=T==null?0:T.length;++I<q&&R(T[I],I,T)!==!1;);return T}function bb(T,R){for(var I=T==null?0:T.length;I--&&R(T[I],I,T)!==!1;);return T}function zh(T,R){for(var I=-1,q=T==null?0:T.length;++I<q;)if(!R(T[I],I,T))return!1;return!0}function Xn(T,R){for(var I=-1,q=T==null?0:T.length,te=0,be=[];++I<q;){var Pe=T[I];R(Pe,I,T)&&(be[te++]=Pe)}return be}function eo(T,R){var I=T==null?0:T.length;return!!I&&ii(T,R,0)>-1}function Fl(T,R,I){for(var q=-1,te=T==null?0:T.length;++q<te;)if(I(R,T[q]))return!0;return!1}function Ee(T,R){for(var I=-1,q=T==null?0:T.length,te=Array(q);++I<q;)te[I]=R(T[I],I,T);return te}function Zn(T,R){for(var I=-1,q=R.length,te=T.length;++I<q;)T[te+I]=R[I];return T}function zl(T,R,I,q){var te=-1,be=T==null?0:T.length;for(q&&be&&(I=T[++te]);++te<be;)I=R(I,T[te],te,T);return I}function _b(T,R,I,q){var te=T==null?0:T.length;for(q&&te&&(I=T[--te]);te--;)I=R(I,T[te],te,T);return I}function Bl(T,R){for(var I=-1,q=T==null?0:T.length;++I<q;)if(R(T[I],I,T))return!0;return!1}var vb=$l("length");function wb(T){return T.split("")}function Sb(T){return T.match(Oy)||[]}function Bh(T,R,I){var q;return I(T,function(te,be,Pe){if(R(te,be,Pe))return q=be,!1}),q}function to(T,R,I,q){for(var te=T.length,be=I+(q?1:-1);q?be--:++be<te;)if(R(T[be],be,T))return be;return-1}function ii(T,R,I){return R===R?Lb(T,R,I):to(T,$h,I)}function xb(T,R,I,q){for(var te=I-1,be=T.length;++te<be;)if(q(T[te],R))return te;return-1}function $h(T){return T!==T}function Hh(T,R){var I=T==null?0:T.length;return I?Wl(T,R)/I:tt}function $l(T){return function(R){return R==null?t:R[T]}}function Hl(T){return function(R){return T==null?t:T[R]}}function Wh(T,R,I,q,te){return te(T,function(be,Pe,Se){I=q?(q=!1,be):R(I,be,Pe,Se)}),I}function kb(T,R){var I=T.length;for(T.sort(R);I--;)T[I]=T[I].value;return T}function Wl(T,R){for(var I,q=-1,te=T.length;++q<te;){var be=R(T[q]);be!==t&&(I=I===t?be:I+be)}return I}function Vl(T,R){for(var I=-1,q=Array(T);++I<T;)q[I]=R(I);return q}function Cb(T,R){return Ee(R,function(I){return[I,T[I]]})}function Vh(T){return T&&T.slice(0,Gh(T)+1).replace(Tl,"")}function kt(T){return function(R){return T(R)}}function Ul(T,R){return Ee(R,function(I){return T[I]})}function es(T,R){return T.has(R)}function Uh(T,R){for(var I=-1,q=T.length;++I<q&&ii(R,T[I],0)>-1;);return I}function qh(T,R){for(var I=T.length;I--&&ii(R,T[I],0)>-1;);return I}function Eb(T,R){for(var I=T.length,q=0;I--;)T[I]===R&&++q;return q}var Ab=Hl(cb),Mb=Hl(fb);function Tb(T){return"\\"+db[T]}function Ob(T,R){return T==null?t:T[R]}function si(T){return ob.test(T)}function Ib(T){return ab.test(T)}function Nb(T){for(var R,I=[];!(R=T.next()).done;)I.push(R.value);return I}function ql(T){var R=-1,I=Array(T.size);return T.forEach(function(q,te){I[++R]=[te,q]}),I}function Kh(T,R){return function(I){return T(R(I))}}function Qn(T,R){for(var I=-1,q=T.length,te=0,be=[];++I<q;){var Pe=T[I];(Pe===R||Pe===m)&&(T[I]=m,be[te++]=I)}return be}function no(T){var R=-1,I=Array(T.size);return T.forEach(function(q){I[++R]=q}),I}function Rb(T){var R=-1,I=Array(T.size);return T.forEach(function(q){I[++R]=[q,q]}),I}function Lb(T,R,I){for(var q=I-1,te=T.length;++q<te;)if(T[q]===R)return q;return-1}function Pb(T,R,I){for(var q=I+1;q--;)if(T[q]===R)return q;return q}function oi(T){return si(T)?Fb(T):vb(T)}function tn(T){return si(T)?zb(T):wb(T)}function Gh(T){for(var R=T.length;R--&&Ey.test(T.charAt(R)););return R}var Db=Hl(hb);function Fb(T){for(var R=Ll.lastIndex=0;Ll.test(T);)++R;return R}function zb(T){return T.match(Ll)||[]}function Bb(T){return T.match(sb)||[]}var $b=function T(R){R=R==null?je:ai.defaults(je.Object(),R,ai.pick(je,lb));var I=R.Array,q=R.Date,te=R.Error,be=R.Function,Pe=R.Math,Se=R.Object,Kl=R.RegExp,Hb=R.String,zt=R.TypeError,ro=I.prototype,Wb=be.prototype,li=Se.prototype,io=R["__core-js_shared__"],so=Wb.toString,we=li.hasOwnProperty,Vb=0,Jh=function(){var s=/[^.]+$/.exec(io&&io.keys&&io.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),oo=li.toString,Ub=so.call(Se),qb=je._,Kb=Kl("^"+so.call(we).replace(Ml,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ao=Ih?R.Buffer:t,er=R.Symbol,lo=R.Uint8Array,jh=ao?ao.allocUnsafe:t,uo=Kh(Se.getPrototypeOf,Se),Yh=Se.create,Xh=li.propertyIsEnumerable,co=ro.splice,Zh=er?er.isConcatSpreadable:t,ts=er?er.iterator:t,Ar=er?er.toStringTag:t,fo=function(){try{var s=Nr(Se,"defineProperty");return s({},"",{}),s}catch{}}(),Gb=R.clearTimeout!==je.clearTimeout&&R.clearTimeout,Jb=q&&q.now!==je.Date.now&&q.now,jb=R.setTimeout!==je.setTimeout&&R.setTimeout,ho=Pe.ceil,po=Pe.floor,Gl=Se.getOwnPropertySymbols,Yb=ao?ao.isBuffer:t,Qh=R.isFinite,Xb=ro.join,Zb=Kh(Se.keys,Se),De=Pe.max,nt=Pe.min,Qb=q.now,e2=R.parseInt,ed=Pe.random,t2=ro.reverse,Jl=Nr(R,"DataView"),ns=Nr(R,"Map"),jl=Nr(R,"Promise"),ui=Nr(R,"Set"),rs=Nr(R,"WeakMap"),is=Nr(Se,"create"),mo=rs&&new rs,ci={},n2=Rr(Jl),r2=Rr(ns),i2=Rr(jl),s2=Rr(ui),o2=Rr(rs),go=er?er.prototype:t,ss=go?go.valueOf:t,td=go?go.toString:t;function v(s){if(Te(s)&&!ne(s)&&!(s instanceof ce)){if(s instanceof Bt)return s;if(we.call(s,"__wrapped__"))return np(s)}return new Bt(s)}var fi=function(){function s(){}return function(l){if(!Ae(l))return{};if(Yh)return Yh(l);s.prototype=l;var c=new s;return s.prototype=t,c}}();function yo(){}function Bt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}v.templateSettings={escape:vy,evaluate:wy,interpolate:ch,variable:"",imports:{_:v}},v.prototype=yo.prototype,v.prototype.constructor=v,Bt.prototype=fi(yo.prototype),Bt.prototype.constructor=Bt;function ce(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=We,this.__views__=[]}function a2(){var s=new ce(this.__wrapped__);return s.__actions__=pt(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=pt(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=pt(this.__views__),s}function l2(){if(this.__filtered__){var s=new ce(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function u2(){var s=this.__wrapped__.value(),l=this.__dir__,c=ne(s),d=l<0,y=c?s.length:0,w=w_(0,y,this.__views__),C=w.start,M=w.end,O=M-C,P=d?M:C-1,D=this.__iteratees__,F=D.length,V=0,J=nt(O,this.__takeCount__);if(!c||!d&&y==O&&J==O)return Cd(s,this.__actions__);var Z=[];e:for(;O--&&V<J;){P+=l;for(var se=-1,Q=s[P];++se<F;){var le=D[se],he=le.iteratee,At=le.type,lt=he(Q);if(At==xn)Q=lt;else if(!lt){if(At==Xt)continue e;break e}}Z[V++]=Q}return Z}ce.prototype=fi(yo.prototype),ce.prototype.constructor=ce;function Mr(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function c2(){this.__data__=is?is(null):{},this.size=0}function f2(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function h2(s){var l=this.__data__;if(is){var c=l[s];return c===f?t:c}return we.call(l,s)?l[s]:t}function d2(s){var l=this.__data__;return is?l[s]!==t:we.call(l,s)}function p2(s,l){var c=this.__data__;return this.size+=this.has(s)?0:1,c[s]=is&&l===t?f:l,this}Mr.prototype.clear=c2,Mr.prototype.delete=f2,Mr.prototype.get=h2,Mr.prototype.has=d2,Mr.prototype.set=p2;function Cn(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function m2(){this.__data__=[],this.size=0}function g2(s){var l=this.__data__,c=bo(l,s);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():co.call(l,c,1),--this.size,!0}function y2(s){var l=this.__data__,c=bo(l,s);return c<0?t:l[c][1]}function b2(s){return bo(this.__data__,s)>-1}function _2(s,l){var c=this.__data__,d=bo(c,s);return d<0?(++this.size,c.push([s,l])):c[d][1]=l,this}Cn.prototype.clear=m2,Cn.prototype.delete=g2,Cn.prototype.get=y2,Cn.prototype.has=b2,Cn.prototype.set=_2;function En(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function v2(){this.size=0,this.__data__={hash:new Mr,map:new(ns||Cn),string:new Mr}}function w2(s){var l=Oo(this,s).delete(s);return this.size-=l?1:0,l}function S2(s){return Oo(this,s).get(s)}function x2(s){return Oo(this,s).has(s)}function k2(s,l){var c=Oo(this,s),d=c.size;return c.set(s,l),this.size+=c.size==d?0:1,this}En.prototype.clear=v2,En.prototype.delete=w2,En.prototype.get=S2,En.prototype.has=x2,En.prototype.set=k2;function Tr(s){var l=-1,c=s==null?0:s.length;for(this.__data__=new En;++l<c;)this.add(s[l])}function C2(s){return this.__data__.set(s,f),this}function E2(s){return this.__data__.has(s)}Tr.prototype.add=Tr.prototype.push=C2,Tr.prototype.has=E2;function nn(s){var l=this.__data__=new Cn(s);this.size=l.size}function A2(){this.__data__=new Cn,this.size=0}function M2(s){var l=this.__data__,c=l.delete(s);return this.size=l.size,c}function T2(s){return this.__data__.get(s)}function O2(s){return this.__data__.has(s)}function I2(s,l){var c=this.__data__;if(c instanceof Cn){var d=c.__data__;if(!ns||d.length<i-1)return d.push([s,l]),this.size=++c.size,this;c=this.__data__=new En(d)}return c.set(s,l),this.size=c.size,this}nn.prototype.clear=A2,nn.prototype.delete=M2,nn.prototype.get=T2,nn.prototype.has=O2,nn.prototype.set=I2;function nd(s,l){var c=ne(s),d=!c&&Lr(s),y=!c&&!d&&sr(s),w=!c&&!d&&!y&&mi(s),C=c||d||y||w,M=C?Vl(s.length,Hb):[],O=M.length;for(var P in s)(l||we.call(s,P))&&!(C&&(P=="length"||y&&(P=="offset"||P=="parent")||w&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||On(P,O)))&&M.push(P);return M}function rd(s){var l=s.length;return l?s[ou(0,l-1)]:t}function N2(s,l){return Io(pt(s),Or(l,0,s.length))}function R2(s){return Io(pt(s))}function Yl(s,l,c){(c!==t&&!rn(s[l],c)||c===t&&!(l in s))&&An(s,l,c)}function as(s,l,c){var d=s[l];(!(we.call(s,l)&&rn(d,c))||c===t&&!(l in s))&&An(s,l,c)}function bo(s,l){for(var c=s.length;c--;)if(rn(s[c][0],l))return c;return-1}function L2(s,l,c,d){return tr(s,function(y,w,C){l(d,y,c(y),C)}),d}function id(s,l){return s&&dn(l,Ve(l),s)}function P2(s,l){return s&&dn(l,gt(l),s)}function An(s,l,c){l=="__proto__"&&fo?fo(s,l,{configurable:!0,enumerable:!0,value:c,writable:!0}):s[l]=c}function Xl(s,l){for(var c=-1,d=l.length,y=I(d),w=s==null;++c<d;)y[c]=w?t:Iu(s,l[c]);return y}function Or(s,l,c){return s===s&&(c!==t&&(s=s<=c?s:c),l!==t&&(s=s>=l?s:l)),s}function $t(s,l,c,d,y,w){var C,M=l&p,O=l&b,P=l&S;if(c&&(C=y?c(s,d,y,w):c(s)),C!==t)return C;if(!Ae(s))return s;var D=ne(s);if(D){if(C=x_(s),!M)return pt(s,C)}else{var F=rt(s),V=F==js||F==oh;if(sr(s))return Md(s,M);if(F==kn||F==Zt||V&&!y){if(C=O||V?{}:Gd(s),!M)return O?h_(s,P2(C,s)):f_(s,id(C,s))}else{if(!xe[F])return y?s:{};C=k_(s,F,M)}}w||(w=new nn);var J=w.get(s);if(J)return J;w.set(s,C),Sp(s)?s.forEach(function(Q){C.add($t(Q,l,c,Q,s,w))}):vp(s)&&s.forEach(function(Q,le){C.set(le,$t(Q,l,c,le,s,w))});var Z=P?O?yu:gu:O?gt:Ve,se=D?t:Z(s);return Ft(se||s,function(Q,le){se&&(le=Q,Q=s[le]),as(C,le,$t(Q,l,c,le,s,w))}),C}function D2(s){var l=Ve(s);return function(c){return sd(c,s,l)}}function sd(s,l,c){var d=c.length;if(s==null)return!d;for(s=Se(s);d--;){var y=c[d],w=l[y],C=s[y];if(C===t&&!(y in s)||!w(C))return!1}return!0}function od(s,l,c){if(typeof s!="function")throw new zt(a);return ps(function(){s.apply(t,c)},l)}function ls(s,l,c,d){var y=-1,w=eo,C=!0,M=s.length,O=[],P=l.length;if(!M)return O;c&&(l=Ee(l,kt(c))),d?(w=Fl,C=!1):l.length>=i&&(w=es,C=!1,l=new Tr(l));e:for(;++y<M;){var D=s[y],F=c==null?D:c(D);if(D=d||D!==0?D:0,C&&F===F){for(var V=P;V--;)if(l[V]===F)continue e;O.push(D)}else w(l,F,d)||O.push(D)}return O}var tr=Rd(hn),ad=Rd(Ql,!0);function F2(s,l){var c=!0;return tr(s,function(d,y,w){return c=!!l(d,y,w),c}),c}function _o(s,l,c){for(var d=-1,y=s.length;++d<y;){var w=s[d],C=l(w);if(C!=null&&(M===t?C===C&&!Et(C):c(C,M)))var M=C,O=w}return O}function z2(s,l,c,d){var y=s.length;for(c=re(c),c<0&&(c=-c>y?0:y+c),d=d===t||d>y?y:re(d),d<0&&(d+=y),d=c>d?0:kp(d);c<d;)s[c++]=l;return s}function ld(s,l){var c=[];return tr(s,function(d,y,w){l(d,y,w)&&c.push(d)}),c}function Ye(s,l,c,d,y){var w=-1,C=s.length;for(c||(c=E_),y||(y=[]);++w<C;){var M=s[w];l>0&&c(M)?l>1?Ye(M,l-1,c,d,y):Zn(y,M):d||(y[y.length]=M)}return y}var Zl=Ld(),ud=Ld(!0);function hn(s,l){return s&&Zl(s,l,Ve)}function Ql(s,l){return s&&ud(s,l,Ve)}function vo(s,l){return Xn(l,function(c){return In(s[c])})}function Ir(s,l){l=rr(l,s);for(var c=0,d=l.length;s!=null&&c<d;)s=s[pn(l[c++])];return c&&c==d?s:t}function cd(s,l,c){var d=l(s);return ne(s)?d:Zn(d,c(s))}function ot(s){return s==null?s===t?dy:fy:Ar&&Ar in Se(s)?v_(s):R_(s)}function eu(s,l){return s>l}function B2(s,l){return s!=null&&we.call(s,l)}function $2(s,l){return s!=null&&l in Se(s)}function H2(s,l,c){return s>=nt(l,c)&&s<De(l,c)}function tu(s,l,c){for(var d=c?Fl:eo,y=s[0].length,w=s.length,C=w,M=I(w),O=1/0,P=[];C--;){var D=s[C];C&&l&&(D=Ee(D,kt(l))),O=nt(D.length,O),M[C]=!c&&(l||y>=120&&D.length>=120)?new Tr(C&&D):t}D=s[0];var F=-1,V=M[0];e:for(;++F<y&&P.length<O;){var J=D[F],Z=l?l(J):J;if(J=c||J!==0?J:0,!(V?es(V,Z):d(P,Z,c))){for(C=w;--C;){var se=M[C];if(!(se?es(se,Z):d(s[C],Z,c)))continue e}V&&V.push(Z),P.push(J)}}return P}function W2(s,l,c,d){return hn(s,function(y,w,C){l(d,c(y),w,C)}),d}function us(s,l,c){l=rr(l,s),s=Xd(s,l);var d=s==null?s:s[pn(Wt(l))];return d==null?t:xt(d,s,c)}function fd(s){return Te(s)&&ot(s)==Zt}function V2(s){return Te(s)&&ot(s)==Qi}function U2(s){return Te(s)&&ot(s)==Ji}function cs(s,l,c,d,y){return s===l?!0:s==null||l==null||!Te(s)&&!Te(l)?s!==s&&l!==l:q2(s,l,c,d,cs,y)}function q2(s,l,c,d,y,w){var C=ne(s),M=ne(l),O=C?Gs:rt(s),P=M?Gs:rt(l);O=O==Zt?kn:O,P=P==Zt?kn:P;var D=O==kn,F=P==kn,V=O==P;if(V&&sr(s)){if(!sr(l))return!1;C=!0,D=!1}if(V&&!D)return w||(w=new nn),C||mi(s)?Ud(s,l,c,d,y,w):b_(s,l,O,c,d,y,w);if(!(c&k)){var J=D&&we.call(s,"__wrapped__"),Z=F&&we.call(l,"__wrapped__");if(J||Z){var se=J?s.value():s,Q=Z?l.value():l;return w||(w=new nn),y(se,Q,c,d,w)}}return V?(w||(w=new nn),__(s,l,c,d,y,w)):!1}function K2(s){return Te(s)&&rt(s)==Qt}function nu(s,l,c,d){var y=c.length,w=y,C=!d;if(s==null)return!w;for(s=Se(s);y--;){var M=c[y];if(C&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++y<w;){M=c[y];var O=M[0],P=s[O],D=M[1];if(C&&M[2]){if(P===t&&!(O in s))return!1}else{var F=new nn;if(d)var V=d(P,D,O,s,l,F);if(!(V===t?cs(D,P,k|g,d,F):V))return!1}}return!0}function hd(s){if(!Ae(s)||M_(s))return!1;var l=In(s)?Kb:Dy;return l.test(Rr(s))}function G2(s){return Te(s)&&ot(s)==Yi}function J2(s){return Te(s)&&rt(s)==en}function j2(s){return Te(s)&&Fo(s.length)&&!!ke[ot(s)]}function dd(s){return typeof s=="function"?s:s==null?yt:typeof s=="object"?ne(s)?gd(s[0],s[1]):md(s):Pp(s)}function ru(s){if(!ds(s))return Zb(s);var l=[];for(var c in Se(s))we.call(s,c)&&c!="constructor"&&l.push(c);return l}function Y2(s){if(!Ae(s))return N_(s);var l=ds(s),c=[];for(var d in s)d=="constructor"&&(l||!we.call(s,d))||c.push(d);return c}function iu(s,l){return s<l}function pd(s,l){var c=-1,d=mt(s)?I(s.length):[];return tr(s,function(y,w,C){d[++c]=l(y,w,C)}),d}function md(s){var l=_u(s);return l.length==1&&l[0][2]?jd(l[0][0],l[0][1]):function(c){return c===s||nu(c,s,l)}}function gd(s,l){return wu(s)&&Jd(l)?jd(pn(s),l):function(c){var d=Iu(c,s);return d===t&&d===l?Nu(c,s):cs(l,d,k|g)}}function wo(s,l,c,d,y){s!==l&&Zl(l,function(w,C){if(y||(y=new nn),Ae(w))X2(s,l,C,c,wo,d,y);else{var M=d?d(xu(s,C),w,C+"",s,l,y):t;M===t&&(M=w),Yl(s,C,M)}},gt)}function X2(s,l,c,d,y,w,C){var M=xu(s,c),O=xu(l,c),P=C.get(O);if(P){Yl(s,c,P);return}var D=w?w(M,O,c+"",s,l,C):t,F=D===t;if(F){var V=ne(O),J=!V&&sr(O),Z=!V&&!J&&mi(O);D=O,V||J||Z?ne(M)?D=M:Oe(M)?D=pt(M):J?(F=!1,D=Md(O,!0)):Z?(F=!1,D=Td(O,!0)):D=[]:ms(O)||Lr(O)?(D=M,Lr(M)?D=Cp(M):(!Ae(M)||In(M))&&(D=Gd(O))):F=!1}F&&(C.set(O,D),y(D,O,d,w,C),C.delete(O)),Yl(s,c,D)}function yd(s,l){var c=s.length;if(c)return l+=l<0?c:0,On(l,c)?s[l]:t}function bd(s,l,c){l.length?l=Ee(l,function(w){return ne(w)?function(C){return Ir(C,w.length===1?w[0]:w)}:w}):l=[yt];var d=-1;l=Ee(l,kt(X()));var y=pd(s,function(w,C,M){var O=Ee(l,function(P){return P(w)});return{criteria:O,index:++d,value:w}});return kb(y,function(w,C){return c_(w,C,c)})}function Z2(s,l){return _d(s,l,function(c,d){return Nu(s,d)})}function _d(s,l,c){for(var d=-1,y=l.length,w={};++d<y;){var C=l[d],M=Ir(s,C);c(M,C)&&fs(w,rr(C,s),M)}return w}function Q2(s){return function(l){return Ir(l,s)}}function su(s,l,c,d){var y=d?xb:ii,w=-1,C=l.length,M=s;for(s===l&&(l=pt(l)),c&&(M=Ee(s,kt(c)));++w<C;)for(var O=0,P=l[w],D=c?c(P):P;(O=y(M,D,O,d))>-1;)M!==s&&co.call(M,O,1),co.call(s,O,1);return s}function vd(s,l){for(var c=s?l.length:0,d=c-1;c--;){var y=l[c];if(c==d||y!==w){var w=y;On(y)?co.call(s,y,1):uu(s,y)}}return s}function ou(s,l){return s+po(ed()*(l-s+1))}function e_(s,l,c,d){for(var y=-1,w=De(ho((l-s)/(c||1)),0),C=I(w);w--;)C[d?w:++y]=s,s+=c;return C}function au(s,l){var c="";if(!s||l<1||l>He)return c;do l%2&&(c+=s),l=po(l/2),l&&(s+=s);while(l);return c}function oe(s,l){return ku(Yd(s,l,yt),s+"")}function t_(s){return rd(gi(s))}function n_(s,l){var c=gi(s);return Io(c,Or(l,0,c.length))}function fs(s,l,c,d){if(!Ae(s))return s;l=rr(l,s);for(var y=-1,w=l.length,C=w-1,M=s;M!=null&&++y<w;){var O=pn(l[y]),P=c;if(O==="__proto__"||O==="constructor"||O==="prototype")return s;if(y!=C){var D=M[O];P=d?d(D,O,M):t,P===t&&(P=Ae(D)?D:On(l[y+1])?[]:{})}as(M,O,P),M=M[O]}return s}var wd=mo?function(s,l){return mo.set(s,l),s}:yt,r_=fo?function(s,l){return fo(s,"toString",{configurable:!0,enumerable:!1,value:Lu(l),writable:!0})}:yt;function i_(s){return Io(gi(s))}function Ht(s,l,c){var d=-1,y=s.length;l<0&&(l=-l>y?0:y+l),c=c>y?y:c,c<0&&(c+=y),y=l>c?0:c-l>>>0,l>>>=0;for(var w=I(y);++d<y;)w[d]=s[d+l];return w}function s_(s,l){var c;return tr(s,function(d,y,w){return c=l(d,y,w),!c}),!!c}function So(s,l,c){var d=0,y=s==null?d:s.length;if(typeof l=="number"&&l===l&&y<=Yn){for(;d<y;){var w=d+y>>>1,C=s[w];C!==null&&!Et(C)&&(c?C<=l:C<l)?d=w+1:y=w}return y}return lu(s,l,yt,c)}function lu(s,l,c,d){var y=0,w=s==null?0:s.length;if(w===0)return 0;l=c(l);for(var C=l!==l,M=l===null,O=Et(l),P=l===t;y<w;){var D=po((y+w)/2),F=c(s[D]),V=F!==t,J=F===null,Z=F===F,se=Et(F);if(C)var Q=d||Z;else P?Q=Z&&(d||V):M?Q=Z&&V&&(d||!J):O?Q=Z&&V&&!J&&(d||!se):J||se?Q=!1:Q=d?F<=l:F<l;Q?y=D+1:w=D}return nt(w,jn)}function Sd(s,l){for(var c=-1,d=s.length,y=0,w=[];++c<d;){var C=s[c],M=l?l(C):C;if(!c||!rn(M,O)){var O=M;w[y++]=C===0?0:C}}return w}function xd(s){return typeof s=="number"?s:Et(s)?tt:+s}function Ct(s){if(typeof s=="string")return s;if(ne(s))return Ee(s,Ct)+"";if(Et(s))return td?td.call(s):"";var l=s+"";return l=="0"&&1/s==-$e?"-0":l}function nr(s,l,c){var d=-1,y=eo,w=s.length,C=!0,M=[],O=M;if(c)C=!1,y=Fl;else if(w>=i){var P=l?null:g_(s);if(P)return no(P);C=!1,y=es,O=new Tr}else O=l?[]:M;e:for(;++d<w;){var D=s[d],F=l?l(D):D;if(D=c||D!==0?D:0,C&&F===F){for(var V=O.length;V--;)if(O[V]===F)continue e;l&&O.push(F),M.push(D)}else y(O,F,c)||(O!==M&&O.push(F),M.push(D))}return M}function uu(s,l){return l=rr(l,s),s=Xd(s,l),s==null||delete s[pn(Wt(l))]}function kd(s,l,c,d){return fs(s,l,c(Ir(s,l)),d)}function xo(s,l,c,d){for(var y=s.length,w=d?y:-1;(d?w--:++w<y)&&l(s[w],w,s););return c?Ht(s,d?0:w,d?w+1:y):Ht(s,d?w+1:0,d?y:w)}function Cd(s,l){var c=s;return c instanceof ce&&(c=c.value()),zl(l,function(d,y){return y.func.apply(y.thisArg,Zn([d],y.args))},c)}function cu(s,l,c){var d=s.length;if(d<2)return d?nr(s[0]):[];for(var y=-1,w=I(d);++y<d;)for(var C=s[y],M=-1;++M<d;)M!=y&&(w[y]=ls(w[y]||C,s[M],l,c));return nr(Ye(w,1),l,c)}function Ed(s,l,c){for(var d=-1,y=s.length,w=l.length,C={};++d<y;){var M=d<w?l[d]:t;c(C,s[d],M)}return C}function fu(s){return Oe(s)?s:[]}function hu(s){return typeof s=="function"?s:yt}function rr(s,l){return ne(s)?s:wu(s,l)?[s]:tp(_e(s))}var o_=oe;function ir(s,l,c){var d=s.length;return c=c===t?d:c,!l&&c>=d?s:Ht(s,l,c)}var Ad=Gb||function(s){return je.clearTimeout(s)};function Md(s,l){if(l)return s.slice();var c=s.length,d=jh?jh(c):new s.constructor(c);return s.copy(d),d}function du(s){var l=new s.constructor(s.byteLength);return new lo(l).set(new lo(s)),l}function a_(s,l){var c=l?du(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.byteLength)}function l_(s){var l=new s.constructor(s.source,fh.exec(s));return l.lastIndex=s.lastIndex,l}function u_(s){return ss?Se(ss.call(s)):{}}function Td(s,l){var c=l?du(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.length)}function Od(s,l){if(s!==l){var c=s!==t,d=s===null,y=s===s,w=Et(s),C=l!==t,M=l===null,O=l===l,P=Et(l);if(!M&&!P&&!w&&s>l||w&&C&&O&&!M&&!P||d&&C&&O||!c&&O||!y)return 1;if(!d&&!w&&!P&&s<l||P&&c&&y&&!d&&!w||M&&c&&y||!C&&y||!O)return-1}return 0}function c_(s,l,c){for(var d=-1,y=s.criteria,w=l.criteria,C=y.length,M=c.length;++d<C;){var O=Od(y[d],w[d]);if(O){if(d>=M)return O;var P=c[d];return O*(P=="desc"?-1:1)}}return s.index-l.index}function Id(s,l,c,d){for(var y=-1,w=s.length,C=c.length,M=-1,O=l.length,P=De(w-C,0),D=I(O+P),F=!d;++M<O;)D[M]=l[M];for(;++y<C;)(F||y<w)&&(D[c[y]]=s[y]);for(;P--;)D[M++]=s[y++];return D}function Nd(s,l,c,d){for(var y=-1,w=s.length,C=-1,M=c.length,O=-1,P=l.length,D=De(w-M,0),F=I(D+P),V=!d;++y<D;)F[y]=s[y];for(var J=y;++O<P;)F[J+O]=l[O];for(;++C<M;)(V||y<w)&&(F[J+c[C]]=s[y++]);return F}function pt(s,l){var c=-1,d=s.length;for(l||(l=I(d));++c<d;)l[c]=s[c];return l}function dn(s,l,c,d){var y=!c;c||(c={});for(var w=-1,C=l.length;++w<C;){var M=l[w],O=d?d(c[M],s[M],M,c,s):t;O===t&&(O=s[M]),y?An(c,M,O):as(c,M,O)}return c}function f_(s,l){return dn(s,vu(s),l)}function h_(s,l){return dn(s,qd(s),l)}function ko(s,l){return function(c,d){var y=ne(c)?yb:L2,w=l?l():{};return y(c,s,X(d,2),w)}}function hi(s){return oe(function(l,c){var d=-1,y=c.length,w=y>1?c[y-1]:t,C=y>2?c[2]:t;for(w=s.length>3&&typeof w=="function"?(y--,w):t,C&&at(c[0],c[1],C)&&(w=y<3?t:w,y=1),l=Se(l);++d<y;){var M=c[d];M&&s(l,M,d,w)}return l})}function Rd(s,l){return function(c,d){if(c==null)return c;if(!mt(c))return s(c,d);for(var y=c.length,w=l?y:-1,C=Se(c);(l?w--:++w<y)&&d(C[w],w,C)!==!1;);return c}}function Ld(s){return function(l,c,d){for(var y=-1,w=Se(l),C=d(l),M=C.length;M--;){var O=C[s?M:++y];if(c(w[O],O,w)===!1)break}return l}}function d_(s,l,c){var d=l&_,y=hs(s);function w(){var C=this&&this!==je&&this instanceof w?y:s;return C.apply(d?c:this,arguments)}return w}function Pd(s){return function(l){l=_e(l);var c=si(l)?tn(l):t,d=c?c[0]:l.charAt(0),y=c?ir(c,1).join(""):l.slice(1);return d[s]()+y}}function di(s){return function(l){return zl(Rp(Np(l).replace(rb,"")),s,"")}}function hs(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var c=fi(s.prototype),d=s.apply(c,l);return Ae(d)?d:c}}function p_(s,l,c){var d=hs(s);function y(){for(var w=arguments.length,C=I(w),M=w,O=pi(y);M--;)C[M]=arguments[M];var P=w<3&&C[0]!==O&&C[w-1]!==O?[]:Qn(C,O);if(w-=P.length,w<c)return $d(s,l,Co,y.placeholder,t,C,P,t,t,c-w);var D=this&&this!==je&&this instanceof y?d:s;return xt(D,this,C)}return y}function Dd(s){return function(l,c,d){var y=Se(l);if(!mt(l)){var w=X(c,3);l=Ve(l),c=function(M){return w(y[M],M,y)}}var C=s(l,c,d);return C>-1?y[w?l[C]:C]:t}}function Fd(s){return Tn(function(l){var c=l.length,d=c,y=Bt.prototype.thru;for(s&&l.reverse();d--;){var w=l[d];if(typeof w!="function")throw new zt(a);if(y&&!C&&To(w)=="wrapper")var C=new Bt([],!0)}for(d=C?d:c;++d<c;){w=l[d];var M=To(w),O=M=="wrapper"?bu(w):t;O&&Su(O[0])&&O[1]==(U|A|W|j)&&!O[4].length&&O[9]==1?C=C[To(O[0])].apply(C,O[3]):C=w.length==1&&Su(w)?C[M]():C.thru(w)}return function(){var P=arguments,D=P[0];if(C&&P.length==1&&ne(D))return C.plant(D).value();for(var F=0,V=c?l[F].apply(this,P):D;++F<c;)V=l[F].call(this,V);return V}})}function Co(s,l,c,d,y,w,C,M,O,P){var D=l&U,F=l&_,V=l&x,J=l&(A|N),Z=l&me,se=V?t:hs(s);function Q(){for(var le=arguments.length,he=I(le),At=le;At--;)he[At]=arguments[At];if(J)var lt=pi(Q),Mt=Eb(he,lt);if(d&&(he=Id(he,d,y,J)),w&&(he=Nd(he,w,C,J)),le-=Mt,J&&le<P){var Ie=Qn(he,lt);return $d(s,l,Co,Q.placeholder,c,he,Ie,M,O,P-le)}var sn=F?c:this,Rn=V?sn[s]:s;return le=he.length,M?he=L_(he,M):Z&&le>1&&he.reverse(),D&&O<le&&(he.length=O),this&&this!==je&&this instanceof Q&&(Rn=se||hs(Rn)),Rn.apply(sn,he)}return Q}function zd(s,l){return function(c,d){return W2(c,s,l(d),{})}}function Eo(s,l){return function(c,d){var y;if(c===t&&d===t)return l;if(c!==t&&(y=c),d!==t){if(y===t)return d;typeof c=="string"||typeof d=="string"?(c=Ct(c),d=Ct(d)):(c=xd(c),d=xd(d)),y=s(c,d)}return y}}function pu(s){return Tn(function(l){return l=Ee(l,kt(X())),oe(function(c){var d=this;return s(l,function(y){return xt(y,d,c)})})})}function Ao(s,l){l=l===t?" ":Ct(l);var c=l.length;if(c<2)return c?au(l,s):l;var d=au(l,ho(s/oi(l)));return si(l)?ir(tn(d),0,s).join(""):d.slice(0,s)}function m_(s,l,c,d){var y=l&_,w=hs(s);function C(){for(var M=-1,O=arguments.length,P=-1,D=d.length,F=I(D+O),V=this&&this!==je&&this instanceof C?w:s;++P<D;)F[P]=d[P];for(;O--;)F[P++]=arguments[++M];return xt(V,y?c:this,F)}return C}function Bd(s){return function(l,c,d){return d&&typeof d!="number"&&at(l,c,d)&&(c=d=t),l=Nn(l),c===t?(c=l,l=0):c=Nn(c),d=d===t?l<c?1:-1:Nn(d),e_(l,c,d,s)}}function Mo(s){return function(l,c){return typeof l=="string"&&typeof c=="string"||(l=Vt(l),c=Vt(c)),s(l,c)}}function $d(s,l,c,d,y,w,C,M,O,P){var D=l&A,F=D?C:t,V=D?t:C,J=D?w:t,Z=D?t:w;l|=D?W:L,l&=~(D?L:W),l&E||(l&=~(_|x));var se=[s,l,y,J,F,Z,V,M,O,P],Q=c.apply(t,se);return Su(s)&&Zd(Q,se),Q.placeholder=d,Qd(Q,s,l)}function mu(s){var l=Pe[s];return function(c,d){if(c=Vt(c),d=d==null?0:nt(re(d),292),d&&Qh(c)){var y=(_e(c)+"e").split("e"),w=l(y[0]+"e"+(+y[1]+d));return y=(_e(w)+"e").split("e"),+(y[0]+"e"+(+y[1]-d))}return l(c)}}var g_=ui&&1/no(new ui([,-0]))[1]==$e?function(s){return new ui(s)}:Fu;function Hd(s){return function(l){var c=rt(l);return c==Qt?ql(l):c==en?Rb(l):Cb(l,s(l))}}function Mn(s,l,c,d,y,w,C,M){var O=l&x;if(!O&&typeof s!="function")throw new zt(a);var P=d?d.length:0;if(P||(l&=~(W|L),d=y=t),C=C===t?C:De(re(C),0),M=M===t?M:re(M),P-=y?y.length:0,l&L){var D=d,F=y;d=y=t}var V=O?t:bu(s),J=[s,l,c,d,y,D,F,w,C,M];if(V&&I_(J,V),s=J[0],l=J[1],c=J[2],d=J[3],y=J[4],M=J[9]=J[9]===t?O?0:s.length:De(J[9]-P,0),!M&&l&(A|N)&&(l&=~(A|N)),!l||l==_)var Z=d_(s,l,c);else l==A||l==N?Z=p_(s,l,M):(l==W||l==(_|W))&&!y.length?Z=m_(s,l,c,d):Z=Co.apply(t,J);var se=V?wd:Zd;return Qd(se(Z,J),s,l)}function Wd(s,l,c,d){return s===t||rn(s,li[c])&&!we.call(d,c)?l:s}function Vd(s,l,c,d,y,w){return Ae(s)&&Ae(l)&&(w.set(l,s),wo(s,l,t,Vd,w),w.delete(l)),s}function y_(s){return ms(s)?t:s}function Ud(s,l,c,d,y,w){var C=c&k,M=s.length,O=l.length;if(M!=O&&!(C&&O>M))return!1;var P=w.get(s),D=w.get(l);if(P&&D)return P==l&&D==s;var F=-1,V=!0,J=c&g?new Tr:t;for(w.set(s,l),w.set(l,s);++F<M;){var Z=s[F],se=l[F];if(d)var Q=C?d(se,Z,F,l,s,w):d(Z,se,F,s,l,w);if(Q!==t){if(Q)continue;V=!1;break}if(J){if(!Bl(l,function(le,he){if(!es(J,he)&&(Z===le||y(Z,le,c,d,w)))return J.push(he)})){V=!1;break}}else if(!(Z===se||y(Z,se,c,d,w))){V=!1;break}}return w.delete(s),w.delete(l),V}function b_(s,l,c,d,y,w,C){switch(c){case ni:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case Qi:return!(s.byteLength!=l.byteLength||!w(new lo(s),new lo(l)));case Gi:case Ji:case ji:return rn(+s,+l);case Js:return s.name==l.name&&s.message==l.message;case Yi:case Xi:return s==l+"";case Qt:var M=ql;case en:var O=d&k;if(M||(M=no),s.size!=l.size&&!O)return!1;var P=C.get(s);if(P)return P==l;d|=g,C.set(s,l);var D=Ud(M(s),M(l),d,y,w,C);return C.delete(s),D;case Ys:if(ss)return ss.call(s)==ss.call(l)}return!1}function __(s,l,c,d,y,w){var C=c&k,M=gu(s),O=M.length,P=gu(l),D=P.length;if(O!=D&&!C)return!1;for(var F=O;F--;){var V=M[F];if(!(C?V in l:we.call(l,V)))return!1}var J=w.get(s),Z=w.get(l);if(J&&Z)return J==l&&Z==s;var se=!0;w.set(s,l),w.set(l,s);for(var Q=C;++F<O;){V=M[F];var le=s[V],he=l[V];if(d)var At=C?d(he,le,V,l,s,w):d(le,he,V,s,l,w);if(!(At===t?le===he||y(le,he,c,d,w):At)){se=!1;break}Q||(Q=V=="constructor")}if(se&&!Q){var lt=s.constructor,Mt=l.constructor;lt!=Mt&&"constructor"in s&&"constructor"in l&&!(typeof lt=="function"&&lt instanceof lt&&typeof Mt=="function"&&Mt instanceof Mt)&&(se=!1)}return w.delete(s),w.delete(l),se}function Tn(s){return ku(Yd(s,t,sp),s+"")}function gu(s){return cd(s,Ve,vu)}function yu(s){return cd(s,gt,qd)}var bu=mo?function(s){return mo.get(s)}:Fu;function To(s){for(var l=s.name+"",c=ci[l],d=we.call(ci,l)?c.length:0;d--;){var y=c[d],w=y.func;if(w==null||w==s)return y.name}return l}function pi(s){var l=we.call(v,"placeholder")?v:s;return l.placeholder}function X(){var s=v.iteratee||Pu;return s=s===Pu?dd:s,arguments.length?s(arguments[0],arguments[1]):s}function Oo(s,l){var c=s.__data__;return A_(l)?c[typeof l=="string"?"string":"hash"]:c.map}function _u(s){for(var l=Ve(s),c=l.length;c--;){var d=l[c],y=s[d];l[c]=[d,y,Jd(y)]}return l}function Nr(s,l){var c=Ob(s,l);return hd(c)?c:t}function v_(s){var l=we.call(s,Ar),c=s[Ar];try{s[Ar]=t;var d=!0}catch{}var y=oo.call(s);return d&&(l?s[Ar]=c:delete s[Ar]),y}var vu=Gl?function(s){return s==null?[]:(s=Se(s),Xn(Gl(s),function(l){return Xh.call(s,l)}))}:zu,qd=Gl?function(s){for(var l=[];s;)Zn(l,vu(s)),s=uo(s);return l}:zu,rt=ot;(Jl&&rt(new Jl(new ArrayBuffer(1)))!=ni||ns&&rt(new ns)!=Qt||jl&&rt(jl.resolve())!=ah||ui&&rt(new ui)!=en||rs&&rt(new rs)!=Zi)&&(rt=function(s){var l=ot(s),c=l==kn?s.constructor:t,d=c?Rr(c):"";if(d)switch(d){case n2:return ni;case r2:return Qt;case i2:return ah;case s2:return en;case o2:return Zi}return l});function w_(s,l,c){for(var d=-1,y=c.length;++d<y;){var w=c[d],C=w.size;switch(w.type){case"drop":s+=C;break;case"dropRight":l-=C;break;case"take":l=nt(l,s+C);break;case"takeRight":s=De(s,l-C);break}}return{start:s,end:l}}function S_(s){var l=s.match(My);return l?l[1].split(Ty):[]}function Kd(s,l,c){l=rr(l,s);for(var d=-1,y=l.length,w=!1;++d<y;){var C=pn(l[d]);if(!(w=s!=null&&c(s,C)))break;s=s[C]}return w||++d!=y?w:(y=s==null?0:s.length,!!y&&Fo(y)&&On(C,y)&&(ne(s)||Lr(s)))}function x_(s){var l=s.length,c=new s.constructor(l);return l&&typeof s[0]=="string"&&we.call(s,"index")&&(c.index=s.index,c.input=s.input),c}function Gd(s){return typeof s.constructor=="function"&&!ds(s)?fi(uo(s)):{}}function k_(s,l,c){var d=s.constructor;switch(l){case Qi:return du(s);case Gi:case Ji:return new d(+s);case ni:return a_(s,c);case _l:case vl:case wl:case Sl:case xl:case kl:case Cl:case El:case Al:return Td(s,c);case Qt:return new d;case ji:case Xi:return new d(s);case Yi:return l_(s);case en:return new d;case Ys:return u_(s)}}function C_(s,l){var c=l.length;if(!c)return s;var d=c-1;return l[d]=(c>1?"& ":"")+l[d],l=l.join(c>2?", ":" "),s.replace(Ay,`{
40
+ 3. "-" cannot repeat`);Oe.customSchemes.push([n,e])}function CT(){Oe.scanner=gT(Oe.customSchemes);for(let n=0;n<Oe.tokenQueue.length;n++)Oe.tokenQueue[n][1]({scanner:Oe.scanner});Oe.parser=vT(Oe.scanner.tokens);for(let n=0;n<Oe.pluginQueue.length;n++)Oe.pluginQueue[n][1]({scanner:Oe.scanner,parser:Oe.parser});Oe.initialized=!0}function n1(n){return Oe.initialized||CT(),wT(Oe.parser.start,n,yT(Oe.scanner.start,n))}function Vf(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new $f(t),i=n1(n),o=[];for(let a=0;a<i.length;a++){const u=i[a];u.isLink&&(!e||u.t===e)&&o.push(u.toFormattedObject(r))}return o}function kT(n,e){e===void 0&&(e=null);const t=n1(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class AT extends xf{addProps(){return{handlePaste:this._handlePaste}}_handlePaste(e,t,r){if(e.state.selection.empty)return!1;const i=r.content.textBetween(0,r.content.size).trim(),o=kT(i);if(!i||!o)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return dh.query(t,{typeName:ie.TEXT,mark:{typeName:de.LINK},getMark:{typeName:de.LINK}})?.attrs||{href:e}}}function B(n){return(...e)=>t=>n(t,...e)}function cl(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const o=r.replace(/_/g,"-");return`${t}--zw-${o}:${i};`},"");return e?{style:e}:null}function Qr(n){const e=cl(n);return["span",e?{...e,class:"zw-style"}:{},0]}function MT(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Zt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var TT=Object.defineProperty,OT=(n,e,t)=>e in n?TT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,qn=(n,e,t)=>OT(n,typeof e!="symbol"?e+"":e,t),r1,i1,s1;function $e(n,e){let t=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(e[0])||(e=e.map(a=>[a]));let r=e[0].length,i=e[0].map((a,u)=>e.map(f=>f[u])),o=n.map(a=>i.map(u=>{let f=0;if(!Array.isArray(a)){for(let h of u)f+=a*h;return f}for(let h=0;h<a.length;h++)f+=a[h]*(u[h]||0);return f}));return t===1&&(o=o[0]),r===1?o.map(a=>a[0]):o}function o1(n){return Ks(n)==="string"}function Ks(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Wf(n,{precision:e,unit:t}){return Uf(n)?"none":IT(n,e)+(t??"")}function Uf(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function IT(n,e){if(n===0)return 0;let t=~~n,r=0;t&&e&&(r=~~Math.log10(Math.abs(t))+1);const i=10**(e-r);return Math.floor(n*i+.5)/i}const NT={deg:1,grad:.9,rad:180/Math.PI,turn:360};function RT(n){if(!n)return;n=n.trim();const e=/^([a-z]+)\((.+?)\)$/i,t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let o=n.match(e);if(o){let a=[];return o[2].replace(i,(u,f)=>{let h=f.match(r),m=f;if(h){let p=h[0],b=m.slice(0,-p.length);p==="%"?(m=new Number(b/100),m.type="<percentage>"):(m=new Number(b*NT[p]),m.type="<angle>",m.unit=p)}else t.test(m)?(m=new Number(m),m.type="<number>"):m==="none"&&(m=new Number(NaN),m.none=!0);u.startsWith("/")&&(m=m instanceof Number?m:new Number(m),m.alpha=!0),typeof m=="object"&&m instanceof Number&&(m.raw=f),a.push(m)}),{name:o[1].toLowerCase(),rawName:o[1],rawArgs:o[2],args:a}}}function LT(n){return n[n.length-1]}function a1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function PT(n,e,t){return(t-n)/(e-n)}function l1(n,e,t){return a1(e[0],e[1],PT(n[0],n[1],t))}function DT(n){return n.map(e=>e.split("|").map(t=>{t=t.trim();let r=t.match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(r){let i=new String(r[1]);return i.range=[+r[2],+r[3]],i}return t}))}function FT(n,e,t){return Math.max(Math.min(t,e),n)}function qf(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function Kn(n,e){return qf(Math.abs(n)**e,n)}function u1(n,e){return e===0?0:n/e}function zT(n,e,t=0,r=n.length){for(;t<r;){const i=t+r>>1;n[i]<e?t=i+1:r=i}return t}class BT{add(e,t,r){if(typeof arguments[0]!="string"){for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1]);return}(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],t&&this[i][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(r){r.call(t&&t.context?t.context:t,t)})}}const fl=new BT,Gn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function Kf(n){return Array.isArray(n)?n:Gn[n]}function hl(n,e,t,r={}){if(n=Kf(n),e=Kf(e),!n||!e)throw new TypeError(`Missing white point to convert ${n?"":"from"}${!n&&!e?"/":""}${e?"":"to"}`);if(n===e)return t;let i={W1:n,W2:e,XYZ:t,options:r};if(fl.run("chromatic-adaptation-start",i),i.M||(i.W1===Gn.D65&&i.W2===Gn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===Gn.D50&&i.W2===Gn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),fl.run("chromatic-adaptation-end",i),i.M)return $e(i.M,i.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}const Gs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((s1=(i1=(r1=globalThis?.process)==null?void 0:r1.env)==null?void 0:i1.NODE_ENV)==null?void 0:s1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},$T=new Set(["<number>","<percentage>","<angle>"]);function c1(n,e,t,r){return Object.entries(n.coords).map(([o,a],u)=>{let f=e.coordGrammar[u],h=r[u],m=h?.type,p;if(h.none?p=f.find(E=>$T.has(E)):p=f.find(E=>E==m),!p){let E=a.name||o;throw new TypeError(`${m??h.raw} not allowed for ${E} in ${t}()`)}let b=p.range;m==="<percentage>"&&(b||(b=[0,1]));let S=a.range||a.refRange;return b&&S&&(r[u]=l1(b,S,r[u])),p})}function f1(n,{meta:e}={}){var t,r,i,o;let a={str:(t=String(n))==null?void 0:t.trim()};if(fl.run("parse-start",a),a.color)return a.color;if(a.parsed=RT(a.str),a.parsed){let u=a.parsed.name;if(u==="color"){let f=a.parsed.args.shift(),h=f.startsWith("--")?f.substring(2):`--${f}`,m=[f,h],p=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let E of ae.all){let g=E.getFormat("color");if(g&&(m.includes(g.id)||(r=g.ids)!=null&&r.filter(_=>m.includes(_)).length)){const _=Object.keys(E.coords).map((k,A)=>a.parsed.args[A]||0);let x;return g.coordGrammar&&(x=c1(E,g,"color",_)),e&&Object.assign(e,{formatId:"color",types:x}),g.id.startsWith("--")&&!f.startsWith("--")&&Gs.warn(`${E.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${g.id}) instead of color(${f}).`),f.startsWith("--")&&!g.id.startsWith("--")&&Gs.warn(`${E.name} is a standard space and supported in the CSS spec. Use color(${g.id}) instead of prefixed color(${f}).`),{spaceId:E.id,coords:_,alpha:p}}}let b="",S=f in ae.registry?f:h;if(S in ae.registry){let E=(o=(i=ae.registry[S].formats)==null?void 0:i.color)==null?void 0:o.id;E&&(b=`Did you mean color(${E})?`)}throw new TypeError(`Cannot parse color(${f}). `+(b||"Missing a plugin?"))}else for(let f of ae.all){let h=f.getFormat(u);if(h&&h.type==="function"){let m=1;(h.lastAlpha||LT(a.parsed.args).alpha)&&(m=a.parsed.args.pop());let p=a.parsed.args,b;return h.coordGrammar&&(b=c1(f,h,u,p)),e&&Object.assign(e,{formatId:h.name,types:b}),{spaceId:f.id,coords:p,alpha:m}}}}else for(let u of ae.all)for(let f in u.formats){let h=u.formats[f];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let m=h.parse(a.str);if(m)return m.alpha??(m.alpha=1),e&&(e.formatId=f),m}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ye(n){if(Array.isArray(n))return n.map(Ye);if(!n)throw new TypeError("Empty color reference");o1(n)&&(n=f1(n));let e=n.space||n.spaceId;return e instanceof ae||(n.space=ae.get(e)),n.alpha===void 0&&(n.alpha=1),n}const HT=75e-6,Gf=class pn{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?pn.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let r=e.coords??this.base.coords;for(let o in r)"name"in r[o]||(r[o].name=o);this.coords=r;let i=e.white??this.base.white??"D65";this.white=Kf(i),this.formats=e.formats??{};for(let o in this.formats){let a=this.formats[o];a.type||(a.type="function"),a.name||(a.name=o)}(t=this.formats.color)!=null&&t.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace=e.gamutSpace==="self"?this:pn.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(o,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:VT(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),fl.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=HT}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every((i,o)=>{let a=r[o];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[u,f]=a.range;return(u===void 0||i>=u-t)&&(f===void 0||i<=f+t)}return!0})}get isUnbounded(){return Object.values(this.coords).every(e=>!("range"in e))}get cssId(){var e,t;return((t=(e=this.formats)==null?void 0:e.color)==null?void 0:t.id)||this.id}get isPolar(){for(let e in this.coords)if(this.coords[e].type==="angle")return!0;return!1}getFormat(e){if(typeof e=="object")return e=h1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=h1(t,this),t):null}equals(e){return e?this===e||this.id===e||this.id===e.id:!1}to(e,t){if(arguments.length===1){const u=Ye(e);[e,t]=[u.space,u.coords]}if(e=pn.get(e),this.equals(e))return t;t=t.map(u=>Number.isNaN(u)?0:u);let r=this.path,i=e.path,o,a;for(let u=0;u<r.length&&r[u].equals(i[u]);u++)o=r[u],a=u;if(!o)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let u=r.length-1;u>a;u--)t=r[u].toBase(t);for(let u=a+1;u<i.length;u++)t=i[u].fromBase(t);return t}from(e,t){if(arguments.length===1){const r=Ye(e);[e,t]=[r.space,r.coords]}return e=pn.get(e),e.to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static get all(){return[...new Set(Object.values(pn.registry))]}static register(e,t){if(arguments.length===1&&(t=arguments[0],e=t.id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,arguments.length===1&&t.aliases)for(let r of t.aliases)this.register(r,t);return t}static get(e,...t){if(!e||e instanceof pn)return e;if(Ks(e)==="string"){let i=pn.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return pn.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Ks(e),o,a;if(i==="string"?e.includes(".")?[o,a]=e.split("."):[o,a]=[,e]:Array.isArray(e)?[o,a]=e:(o=e.space,a=e.coordId),o=pn.get(o),o||(o=t),!o)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Ks(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(o.coords)[a];if(h)return{space:o,id:h[0],index:a,...h[1]}}o=pn.get(o);let u=a.toLowerCase(),f=0;for(let h in o.coords){let m=o.coords[h];if(h.toLowerCase()===u||((r=m.name)==null?void 0:r.toLowerCase())===u)return{space:o,id:h,index:f,...m};f++}throw new TypeError(`No "${a}" coordinate found in ${o.name}. Its coordinates are: ${Object.keys(o.coords).join(", ")}`)}};qn(Gf,"registry",{}),qn(Gf,"DEFAULT_FORMAT",{type:"functions",name:"color"});let ae=Gf;function VT(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function h1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=DT(n.coords);let t=Object.entries(e).map(([r,i],o)=>{let a=n.coordGrammar[o][0],u=i.range||i.refRange,f=a.range,h="";return a=="<percentage>"?(f=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:u,toRange:f,suffix:h}});n.serializeCoords=(r,i)=>r.map((o,a)=>{let{fromRange:u,toRange:f,suffix:h}=t[a];return u&&f&&(o=l1(u,f,o)),o=Wf(o,{precision:i,unit:h}),o})}return n}const Jn=new ae({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class d1 extends ae{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=Jn),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??(e.toBase=t=>{let r=$e(e.toXYZ_M,t);return this.white!==this.base.white&&(r=hl(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=hl(this.base.white,this.white,t),$e(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function Jf(n,e){return n=Ye(n),!e||n.space.equals(e)?n.coords.slice():(e=ae.get(e),e.from(n))}function jn(n,e){n=Ye(n);let{space:t,index:r}=ae.resolveCoord(e,n.space);return Jf(n,t)[r]}function p1(n,e,t){return n=Ye(n),e=ae.get(e),n.coords=e.to(n.space,t),n}p1.returns="color";function jf(n,e,t){if(n=Ye(n),arguments.length===2&&Ks(arguments[1])==="object"){let r=arguments[1];for(let i in r)jf(n,i,r[i])}else{typeof t=="function"&&(t=t(jn(n,e)));let{space:r,index:i}=ae.resolveCoord(e,n.space),o=Jf(n,r);o[i]=t,p1(n,r,o)}return n}jf.returns="color";const WT=new ae({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Jn,fromBase:n=>hl(Jn.white,"D50",n),toBase:n=>hl("D50",Jn.white,n)}),UT=216/24389,m1=24/116,dl=24389/27;let Yf=Gn.D50;const Yn=new ae({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:Yf,base:WT,fromBase(n){let t=n.map((r,i)=>r/Yf[i]).map(r=>r>UT?Math.cbrt(r):(dl*r+16)/116);return[116*t[1]-16,500*(t[0]-t[1]),200*(t[1]-t[2])]},toBase(n){let e=[];return e[1]=(n[0]+16)/116,e[0]=n[1]/500+e[1],e[2]=e[1]-n[2]/200,[e[0]>m1?Math.pow(e[0],3):(116*e[0]-16)/dl,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/dl,e[2]>m1?Math.pow(e[2],3):(116*e[2]-16)/dl].map((r,i)=>r*Yf[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function ei(n){return(n%360+360)%360}const pl=new ae({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Yn,fromBase(n){let[e,t,r]=n,i;const o=.02;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),ei(i)]},toBase(n){let[e,t,r]=n;return t<0&&(t=0),isNaN(r)&&(r=0),[e,t*Math.cos(r*Math.PI/180),t*Math.sin(r*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}}),g1=25**7,ml=Math.PI,y1=180/ml,Ui=ml/180;function b1(n){const e=n*n;return e*e*e*n}function _1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ye([n,e]);let[o,a,u]=Yn.from(n),f=pl.from(Yn,[o,a,u])[1],[h,m,p]=Yn.from(e),b=pl.from(Yn,[h,m,p])[1];f<0&&(f=0),b<0&&(b=0);let S=(f+b)/2,E=b1(S),g=.5*(1-Math.sqrt(E/(E+g1))),_=(1+g)*a,x=(1+g)*m,k=Math.sqrt(_**2+u**2),A=Math.sqrt(x**2+p**2),N=_===0&&u===0?0:Math.atan2(u,_),V=x===0&&p===0?0:Math.atan2(p,x);N<0&&(N+=2*ml),V<0&&(V+=2*ml),N*=y1,V*=y1;let L=h-o,U=A-k,j=V-N,pe=N+V,Et=Math.abs(j),yt;k*A===0?yt=0:Et<=180?yt=j:j>180?yt=j-360:j<-180?yt=j+360:Gs.warn("the unthinkable has happened");let Ft=2*Math.sqrt(A*k)*Math.sin(yt*Ui/2),Zn=(o+h)/2,en=(k+A)/2,Tn=b1(en),Ve;k*A===0?Ve=pe:Et<=180?Ve=pe/2:pe<360?Ve=(pe+360)/2:Ve=(pe-360)/2;let We=(Zn-50)**2,Ue=1+.015*We/Math.sqrt(20+We),zt=1+.045*en,st=1;st-=.17*Math.cos((Ve-30)*Ui),st+=.24*Math.cos(2*Ve*Ui),st+=.32*Math.cos((3*Ve+6)*Ui),st-=.2*Math.cos((4*Ve-63)*Ui);let qe=1+.015*en*st,Qn=30*Math.exp(-1*((Ve-275)/25)**2),er=2*Math.sqrt(Tn/(Tn+g1)),Cl=-1*Math.sin(2*Qn*Ui)*er,tn=(L/(t*Ue))**2;return tn+=(U/(r*zt))**2,tn+=(Ft/(i*qe))**2,tn+=Cl*(U/(r*zt))*(Ft/(i*qe)),Math.sqrt(tn)}const qT=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],KT=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],GT=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],JT=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],gl=new ae({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Jn,fromBase(n){let t=$e(qT,n).map(r=>Math.cbrt(r));return $e(GT,t)},toBase(n){let t=$e(JT,n).map(r=>r**3);return $e(KT,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Xf(n,e){[n,e]=Ye([n,e]);let[t,r,i]=gl.from(n),[o,a,u]=gl.from(e),f=t-o,h=r-a,m=i-u;return Math.sqrt(f**2+h**2+m**2)}const jT=75e-6;function qi(n,e,{epsilon:t=jT}={}){n=Ye(n),e||(e=n.space),e=ae.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function Zf(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function YT(n,e,t="lab"){t=ae.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((o,a,u)=>{let f=i[u];return isNaN(a)||isNaN(f)?o:o+(f-a)**2},0))}function XT(n,e){return YT(n,e,"lab")}const ZT=Math.PI,v1=ZT/180;function QT(n,e,{l:t=2,c:r=1}={}){[n,e]=Ye([n,e]);let[i,o,a]=Yn.from(n),[,u,f]=pl.from(Yn,[i,o,a]),[h,m,p]=Yn.from(e),b=pl.from(Yn,[h,m,p])[1];u<0&&(u=0),b<0&&(b=0);let S=i-h,E=u-b,g=o-m,_=a-p,x=g**2+_**2-E**2,k=.511;i>=16&&(k=.040975*i/(1+.01765*i));let A=.0638*u/(1+.0131*u)+.638,N;Number.isNaN(f)&&(f=0),f>=164&&f<=345?N=.56+Math.abs(.2*Math.cos((f+168)*v1)):N=.36+Math.abs(.4*Math.cos((f+35)*v1));let V=Math.pow(u,4),L=Math.sqrt(V/(V+1900)),U=A*(L*N+1-L),j=(S/(t*k))**2;return j+=(E/(r*A))**2,j+=x/U**2,Math.sqrt(j)}const w1=203,S1=new ae({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:Jn,fromBase(n){return n.map(e=>Math.max(e*w1,0))},toBase(n){return n.map(e=>Math.max(e/w1,0))}}),yl=1.15,bl=.66,x1=2610/2**14,eO=2**14/2610,E1=3424/2**12,C1=2413/2**7,k1=2392/2**7,tO=1.7*2523/2**5,A1=2**5/(1.7*2523),_l=-.56,Qf=16295499532821565e-27,nO=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],rO=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],iO=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],sO=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],oO=new ae({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:S1,fromBase(n){let[e,t,r]=n,i=yl*e-(yl-1)*r,o=bl*t-(bl-1)*e,u=$e(nO,[i,o,r]).map(function(b){let S=E1+C1*(b/1e4)**x1,E=1+k1*(b/1e4)**x1;return(S/E)**tO}),[f,h,m]=$e(iO,u);return[(1+_l)*f/(1+_l*f)-Qf,h,m]},toBase(n){let[e,t,r]=n,i=(e+Qf)/(1+_l-_l*(e+Qf)),a=$e(sO,[i,t,r]).map(function(b){let S=E1-b**A1,E=k1*b**A1-C1;return 1e4*(S/E)**eO}),[u,f,h]=$e(rO,a),m=(u+(yl-1)*h)/yl,p=(f+(bl-1)*m)/bl;return[m,p,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),M1=new ae({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:oO,fromBase(n){let[e,t,r]=n,i;const o=2e-4;return Math.abs(t)<o&&Math.abs(r)<o?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),ei(i)]},toBase(n){return[n[0],n[1]*Math.cos(n[2]*Math.PI/180),n[1]*Math.sin(n[2]*Math.PI/180)]}});function aO(n,e){[n,e]=Ye([n,e]);let[t,r,i]=M1.from(n),[o,a,u]=M1.from(e),f=t-o,h=r-a;Number.isNaN(i)&&Number.isNaN(u)?(i=0,u=0):Number.isNaN(i)?i=u:Number.isNaN(u)&&(u=i);let m=i-u,p=2*Math.sqrt(r*a)*Math.sin(m/2*(Math.PI/180));return Math.sqrt(f**2+h**2+p**2)}const T1=3424/4096,O1=2413/128,I1=2392/128,N1=2610/16384,lO=2523/32,uO=16384/2610,R1=32/2523,cO=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],fO=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],hO=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],dO=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],L1=new ae({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:S1,fromBase(n){let e=$e(cO,n);return pO(e)},toBase(n){let e=mO(n);return $e(dO,e)}});function pO(n){let e=n.map(function(t){let r=T1+O1*(t/1e4)**N1,i=1+I1*(t/1e4)**N1;return(r/i)**lO});return $e(fO,e)}function mO(n){return $e(hO,n).map(function(r){let i=Math.max(r**R1-T1,0),o=O1-I1*r**R1;return 1e4*(i/o)**uO})}function gO(n,e){[n,e]=Ye([n,e]);let[t,r,i]=L1.from(n),[o,a,u]=L1.from(e);return 720*Math.sqrt((t-o)**2+.25*(r-a)**2+(i-u)**2)}const yO=Gn.D65,P1=.42,D1=1/P1,eh=2*Math.PI,F1=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],bO=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],_O=[[460,451,288],[460,-891,-261],[460,-220,-6300]],vO={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},ti={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},wO=180/Math.PI,z1=Math.PI/180;function B1(n,e){return n.map(r=>{const i=Kn(e*Math.abs(r)*.01,P1);return 400*qf(i,r)/(i+27.13)})}function SO(n,e){const t=100/e*27.13**D1;return n.map(r=>{const i=Math.abs(r);return qf(t*Kn(i/(400-i),D1),r)})}function xO(n){let e=ei(n);e<=ti.h[0]&&(e+=360);const t=zT(ti.h,e)-1,[r,i]=ti.h.slice(t,t+2),[o,a]=ti.e.slice(t,t+2),u=ti.H[t],f=(e-r)/o;return u+100*f/(f+(i-e)/a)}function EO(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=ti.h.slice(t,t+2),[o,a]=ti.e.slice(t,t+2);return ei((e*(a*r-o*i)-100*r*a)/(e*(a-o)-100*a))}function $1(n,e,t,r,i){const o={};o.discounting=i,o.refWhite=n,o.surround=r;const a=n.map(g=>g*100);o.la=e,o.yb=t;const u=a[1],f=$e(F1,a);r=vO[o.surround];const h=r[0];o.c=r[1],o.nc=r[2];const p=(1/(5*o.la+1))**4;o.fl=p*o.la+.1*(1-p)*(1-p)*Math.cbrt(5*o.la),o.flRoot=o.fl**.25,o.n=o.yb/u,o.z=1.48+Math.sqrt(o.n),o.nbb=.725*o.n**-.2,o.ncb=o.nbb;const b=Math.max(Math.min(h*(1-1/3.6*Math.exp((-o.la-42)/92)),1),0);o.dRgb=f.map(g=>a1(1,u/g,b)),o.dRgbInv=o.dRgb.map(g=>1/g);const S=f.map((g,_)=>g*o.dRgb[_]),E=B1(S,o.fl);return o.aW=o.nbb*(2*E[0]+E[1]+.05*E[2]),o}const H1=$1(yO,64/Math.PI*.2,20,"average",!1);function th(n,e){if(!(n.J!==void 0^n.Q!==void 0))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(n.C!==void 0^n.M!==void 0^n.s!==void 0))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(n.h!==void 0^n.H!==void 0))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(n.J===0||n.Q===0)return[0,0,0];let t=0;n.h!==void 0?t=ei(n.h)*z1:t=EO(n.H)*z1;const r=Math.cos(t),i=Math.sin(t);let o=0;n.J!==void 0?o=Kn(n.J,1/2)*.1:n.Q!==void 0&&(o=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/o:n.M!==void 0?a=n.M/e.flRoot/o:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const u=Kn(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),f=.25*(Math.cos(t+2)+3.8),h=e.aW*Kn(o,2/e.c/e.z),m=5e4/13*e.nc*e.ncb*f,p=h/e.nbb,b=23*(p+.305)*u1(u,23*m+u*(11*r+108*i)),S=b*r,E=b*i,g=SO($e(_O,[p,S,E]).map(_=>_*1/1403),e.fl);return $e(bO,g.map((_,x)=>_*e.dRgbInv[x])).map(_=>_/100)}function V1(n,e){const t=n.map(A=>A*100),r=B1($e(F1,t).map((A,N)=>A*e.dRgb[N]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,o=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(o,i)%eh+eh)%eh,u=.25*(Math.cos(a+2)+3.8),f=5e4/13*e.nc*e.ncb*u1(u*Math.sqrt(i**2+o**2),r[0]+r[1]+1.05*r[2]+.305),h=Kn(f,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),m=e.nbb*(2*r[0]+r[1]+.05*r[2]),p=Kn(m/e.aW,.5*e.c*e.z),b=100*Kn(p,2),S=4/e.c*p*(e.aW+4)*e.flRoot,E=h*p,g=E*e.flRoot,_=ei(a*wO),x=xO(_),k=50*Kn(e.c*h/(e.aW+4),1/2);return{J:b,C:E,h:_,s:k,Q:S,M:g,H:x}}new ae({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:Jn,fromBase(n){const e=V1(n,H1);return[e.J,e.M,e.h]},toBase(n){return th({J:n[0],M:n[1],h:n[2]},H1)}});const CO=Gn.D65,kO=216/24389,W1=24389/27;function AO(n){return 116*(n>kO?Math.cbrt(n):(W1*n+16)/116)-16}function nh(n){return n>8?Math.pow((n+16)/116,3):n/W1}function MO(n,e){let[t,r,i]=n,o=[],a=0;if(i===0)return[0,0,0];let u=nh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const f=2e-12,h=15;let m=0,p=1/0;for(;m<=h;){o=th({J:a,C:r,h:t},e);const b=Math.abs(o[1]-u);if(b<p){if(b<=f)return o;p=b}a=a-(o[1]-u)*a/(2*o[1]),m+=1}return th({J:a,C:r,h:t},e)}function TO(n,e){const t=AO(n[1]);if(t===0)return[0,0,0];const r=V1(n,rh);return[ei(r.h),r.C,t]}const rh=$1(CO,200/Math.PI*nh(50),nh(50)*100,"average",!1),vl=new ae({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:Jn,fromBase(n){return TO(n)},toBase(n){return MO(n,rh)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),OO=Math.PI/180,U1=[1,.007,.0228];function q1(n){n[1]<0&&(n=vl.fromBase(vl.toBase(n)));const e=Math.log(Math.max(1+U1[2]*n[1]*rh.flRoot,1))/U1[2],t=n[0]*OO,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function IO(n,e){[n,e]=Ye([n,e]);let[t,r,i]=q1(vl.from(n)),[o,a,u]=q1(vl.from(e));return Math.sqrt((t-o)**2+(r-a)**2+(i-u)**2)}const K1={deltaE76:XT,deltaECMC:QT,deltaE2000:_1,deltaEJz:aO,deltaEITP:gO,deltaEOK:Xf,deltaEHCT:IO};function NO(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const G1={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Js(n,{method:e=Gs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:o={}}={}){if(n=Ye(n),o1(arguments[1])?t=arguments[1]:t||(t=n.space),t=ae.get(t),qi(n,t,{epsilon:0}))return n;let a;if(e==="css")a=RO(n,{space:t});else{if(e!=="clip"&&!qi(n,t)){Object.prototype.hasOwnProperty.call(G1,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:o}=G1[e]);let u=_1;if(r!==""){for(let h in K1)if("deltae"+r.toLowerCase()===h.toLowerCase()){u=K1[h];break}}let f=Js(He(n,t),{method:"clip",space:t});if(u(n,f)>i){if(Object.keys(o).length===3){let k=ae.resolveCoord(o.channel),A=jn(He(n,k.space),k.id);if(Uf(A)&&(A=0),A>=o.max)return He({space:"xyz-d65",coords:Gn.D65},n.space);if(A<=o.min)return He({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=ae.resolveCoord(e),m=h.space,p=h.id,b=He(n,m);b.coords.forEach((k,A)=>{Uf(k)&&(b.coords[A]=0)});let E=(h.range||h.refRange)[0],g=NO(i),_=E,x=jn(b,p);for(;x-_>g;){let k=Zf(b);k=Js(k,{space:t,method:"clip"}),u(b,k)-i<g?_=jn(b,p):x=jn(b,p),jf(b,p,(_+x)/2)}a=He(b,t)}else a=f}else a=He(n,t);if(e==="clip"||!qi(a,t,{epsilon:0})){let u=Object.values(t.coords).map(f=>f.range||[]);a.coords=a.coords.map((f,h)=>{let[m,p]=u[h];return m!==void 0&&(f=Math.max(m,f)),p!==void 0&&(f=Math.min(f,p)),f})}}return t!==n.space&&(a=He(a,n.space)),n.coords=a.coords,n}Js.returns="color";const J1={WHITE:{space:gl,coords:[1,0,0]},BLACK:{space:gl,coords:[0,0,0]}};function RO(n,{space:e}={}){n=Ye(n),e||(e=n.space),e=ae.get(e);const i=ae.get("oklch");if(e.isUnbounded)return He(n,e);const o=He(n,i);let a=o.coords[0];if(a>=1){const E=He(J1.WHITE,e);return E.alpha=n.alpha,He(E,e)}if(a<=0){const E=He(J1.BLACK,e);return E.alpha=n.alpha,He(E,e)}if(qi(o,e,{epsilon:0}))return He(o,e);function u(E){const g=He(E,e),_=Object.values(e.coords);return g.coords=g.coords.map((x,k)=>{if("range"in _[k]){const[A,N]=_[k].range;return FT(A,x,N)}return x}),g}let f=0,h=o.coords[1],m=!0,p=Zf(o),b=u(p),S=Xf(b,p);if(S<.02)return b;for(;h-f>1e-4;){const E=(f+h)/2;if(p.coords[1]=E,m&&qi(p,e,{epsilon:0}))f=E;else if(b=u(p),S=Xf(b,p),S<.02){if(.02-S<1e-4)break;m=!1,f=E}else h=E}return b}function He(n,e,{inGamut:t}={}){n=Ye(n),e=ae.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Js(i,t===!0?void 0:t)),i}He.returns="color";function LO(n,{precision:e=Gs.precision,format:t="default",inGamut:r=!0,...i}={}){var o;let a;n=Ye(n);let u=t;t=n.space.getFormat(t)??n.space.getFormat("default")??ae.DEFAULT_FORMAT;let f=n.coords.slice();if(r||(r=t.toGamut),r&&!qi(n)&&(f=Js(Zf(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(f,n.alpha,i);else throw new TypeError(`format ${u} can only be used to parse colors, not for serialization`);else{let h=t.name||"color";t.serializeCoords?f=t.serializeCoords(f,e):e!==null&&(f=f.map(S=>Wf(S,{precision:e})));let m=[...f];if(h==="color"){let S=t.id||((o=t.ids)==null?void 0:o[0])||n.space.id;m.unshift(S)}let p=n.alpha;e!==null&&(p=Wf(p,{precision:e}));let b=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${p}`;a=`${h}(${m.join(t.commas?", ":" ")}${b})`}return a}const PO=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],DO=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],FO=new d1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:PO,fromXYZ_M:DO}),j1={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[153/255,50/255,204/255],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,153/255],lightslategrey:[119/255,136/255,153/255],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[102/255,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,204/255],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/255,0,128/255],rebeccapurple:[102/255,51/255,153/255],red:[1,0,0],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],silver:[192/255,192/255,192/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],teal:[0,128/255,128/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],white:[1,1,1],whitesmoke:[245/255,245/255,245/255],yellow:[1,1,0],yellowgreen:[154/255,205/255,50/255]};let Y1=Array(3).fill("<percentage> | <number>[0, 255]"),X1=Array(3).fill("<number>[0, 255]");const Z1=new d1({id:"srgb",name:"sRGB",base:FO,fromBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r>.0031308?t*(1.055*r**(1/2.4)-.055):12.92*e}),toBase:n=>n.map(e=>{let t=e<0?-1:1,r=e*t;return r<=.04045?e/12.92:t*((r+.055)/1.055)**2.4}),formats:{rgb:{coords:Y1},rgb_number:{name:"rgb",commas:!0,coords:X1,noAlpha:!0},color:{},rgba:{coords:Y1,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:X1},hex:{type:"custom",toGamut:!0,test:n=>/^#([a-f0-9]{3,4}){1,2}$/i.test(n),parse(n){n.length<=5&&(n=n.replace(/[a-f0-9]/gi,"$&$&"));let e=[];return n.replace(/[a-f0-9]{2}/gi,t=>{e.push(parseInt(t,16)/255)}),{spaceId:"srgb",coords:e.slice(0,3),alpha:e.slice(3)[0]}},serialize:(n,e,{collapse:t=!0}={})=>{e<1&&n.push(e),n=n.map(o=>Math.round(o*255));let r=t&&n.every(o=>o%17===0);return"#"+n.map(o=>r?(o/17).toString(16):o.toString(16).padStart(2,"0")).join("")}},keyword:{type:"custom",test:n=>/^[a-z]+$/i.test(n),parse(n){n=n.toLowerCase();let e={spaceId:"srgb",coords:null,alpha:1};if(n==="transparent"?(e.coords=j1.black,e.alpha=0):e.coords=j1[n],e.coords)return e}}}});function zO(n){return jn(n,[Jn,"y"])}const Q1=new ae({id:"hsl",name:"HSL",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},l:{range:[0,100],name:"Lightness"}},base:Z1,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,o]=n,[a,u,f]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(u=f===0||f===1?0:(e-f)/Math.min(f,1-f),e){case r:a=(i-o)/h+(i<o?6:0);break;case i:a=(o-r)/h+2;break;case o:a=(r-i)/h+4}a=a*60}return u<0&&(a+=180,u=Math.abs(u)),a>=360&&(a-=360),[a,u*100,f*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(o){let a=(o+e/30)%12,u=t*Math.min(r,1-r);return r-u*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4)]},formats:{hsl:{coords:["<number> | <angle>","<percentage>","<percentage>"]},hsla:{coords:["<number> | <angle>","<percentage>","<percentage>"],commas:!0,lastAlpha:!0}}}),BO=new ae({id:"hsv",name:"HSV",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},s:{range:[0,100],name:"Saturation"},v:{range:[0,100],name:"Value"}},base:Q1,fromBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r+t*Math.min(r,1-r);return[e,i===0?0:200*(1-r/i),100*i]},toBase(n){let[e,t,r]=n;t/=100,r/=100;let i=r*(1-t/2);return[e,i===0||i===1?0:(r-i)/Math.min(i,1-i)*100,i*100]},formats:{color:{id:"--hsv",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});class Dt{constructor(e){qn(this,"data"),this.data=He(e,"srgb")}static fromTransparent(){return new Dt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Dt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Dt({spaceId:"srgb",coords:[1,1,1],alpha:1})}get r(){return Math.round(this.data.coords[0]*255)}get g(){return Math.round(this.data.coords[1]*255)}get b(){return Math.round(this.data.coords[2]*255)}get h(){return jn(this.data,"hsv.h")}get s(){return jn(this.data,"hsv.s")}get v(){return jn(this.data,"hsv.v")}get alpha(){return this.data.alpha.valueOf()}get alphaPercent(){return Math.round(this.alpha*100)}get isTransparent(){return this.alpha===0}get isDark(){return zO(this.data)<.5}withAlpha(e){return new Dt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Dt({spaceId:"srgb",alpha:e.a??t,coords:[e.r?e.r/255:this.data.coords[0],e.g?e.g/255:this.data.coords[1],e.b?e.b/255:this.data.coords[2]]})}withHsv(e){const r=Jf(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),o=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Dt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,o]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=LO(this.data,{format:"hex"}).toUpperCase();return e.length===4?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e.slice(0,7)}toRgbaString(){return`rgba(${this.r}, ${this.g}, ${this.b}, ${this.alphaPercent}%)`}clone(){return new Dt(this.data)}}class $O{constructor(e){qn(this,"_color"),qn(this,"isEmpty",!1),this.update(e)}get color(){return this._color}setColor(e){this._color=e}setEmpty(e){this.isEmpty=e}toString(){return this.isEmpty?"":this.color.toString()}isEqual(e){return this.toString()===e}update({solidColor:e,isEmpty:t}){this.setColor(e),this.setEmpty(t)}}let ey=999;function HO(){return ey+=1,ey}function VO(n){return n?n.startsWith("linear-gradient("):!1}function WO(){const n=Dt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}ae.register(Z1),ae.register(BO),ae.register(Q1);function ty(n){if(!n)return Dt.fromTransparent();try{return new Dt(He(f1(n),"srgb"))}catch(e){return console.warn(e),Dt.fromBlack()}}function UO(n){const e={"to top":0,"to top right":45,"to right":90,"to bottom right":135,"to bottom":180,"to bottom left":225,"to left":270,"to top left":315};return e[n]?e[n]:n.includes("deg")?Number.parseInt(n.trim().replace("deg","")):0}function qO(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:ty(t),offset:Number.parseFloat(r.replace("%",""))}})}function KO(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),o=qO(i),a=UO(r);return{isEmpty:!1,isGradient:!0,solidColor:o[0].color,angle:a,transitions:o}}function GO(n){const e=ty(n),t=Dt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function JO(n,e=!0){if(!n)return WO();const t=VO(n)?KO(n):GO(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class fh{constructor(e,t=0){qn(this,"id"),this.color=e,this.offset=t,this.id=HO()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new fh(this.color.clone(),e)}}class jO{constructor(e){qn(this,"isEmpty",!1),qn(this,"_angle",0),qn(this,"_transitions",[]),this.update(e)}get transitions(){return this._transitions}get canAddTransition(){return this.transitions.length<5}get canRemoveTransition(){return this.transitions.length>2}get angle(){return this._angle}setAngle(e){this._angle=e}setEmpty(e){this.isEmpty=e}addTransition(e){this.transitions.push(e),this.sortTransitions()}removeTransition(e){this._transitions=this.transitions.filter(({id:t})=>t!==e.id)}sortTransitions(){this._transitions=this.transitions.sort((e,t)=>e.offset-t.offset)}toString(e){if(this.isEmpty)return"";const t=this.transitions.map(r=>r.toString());return`linear-gradient(${e??this.angle}deg, ${t.join(", ")})`}isEqual(e){return this.toString()===e}update(e){this._angle=e.angle,this._transitions=e.transitions.map(({color:t,offset:r})=>new fh(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function YO(n){const e=JO(n);return(e.isGradient?new jO(e):new $O(e)).toString()}function ny(n){return YO(n)}function ry(n,e){if(!n.includes("em"))return parseInt(n);const t=Ki.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function XO(n,e){return(n.firstElementChild||n).style.fontSize||Ki.getComputedStyle(e).fontSize}function ZO(n,e,t){if(!n.includes("px"))return n;const r=XO(e,t),i=ry(r,t);return i?(parseInt(n)/i).toFixed(2):null}const QO={start:wr.LEFT,end:wr.RIGHT};function eI(n){const e=QO[n]||n;return wr.values.includes(e)?e:null}const iy=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function sy(n,e){return n.resolve(e).depth+1}function tI(n,e,t,r){const i=sy(n,r),o=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return o&&a}const nI=(n,e)=>n.eq(e);function rI(n,e,t,r=nI){const i=n.resolve(e).path.reverse();for(const o of i)if(typeof o!="number"){for(const a of o.marks)if(r(a,t))return!0}return!1}function iI(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var js={exports:{}};var sI=js.exports,oy;function oI(){return oy||(oy=1,function(n,e){(function(){var t,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",p=1,b=2,S=4,E=1,g=2,_=1,x=2,k=4,A=8,N=16,V=32,L=64,U=128,j=256,pe=512,Et=30,yt="...",Ft=800,Zn=16,en=1,Tn=2,Ve=3,We=1/0,Ue=9007199254740991,zt=17976931348623157e292,st=NaN,qe=4294967295,Qn=qe-1,er=qe>>>1,Cl=[["ary",U],["bind",_],["bindKey",x],["curry",A],["curryRight",N],["flip",pe],["partial",V],["partialRight",L],["rearg",j]],tn="[object Arguments]",Zs="[object Array]",gy="[object AsyncFunction]",Xi="[object Boolean]",Zi="[object Date]",yy="[object DOMException]",Qs="[object Error]",eo="[object Function]",ph="[object GeneratorFunction]",nn="[object Map]",Qi="[object Number]",by="[object Null]",On="[object Object]",mh="[object Promise]",_y="[object Proxy]",es="[object RegExp]",rn="[object Set]",ts="[object String]",to="[object Symbol]",vy="[object Undefined]",ns="[object WeakMap]",wy="[object WeakSet]",rs="[object ArrayBuffer]",si="[object DataView]",kl="[object Float32Array]",Al="[object Float64Array]",Ml="[object Int8Array]",Tl="[object Int16Array]",Ol="[object Int32Array]",Il="[object Uint8Array]",Nl="[object Uint8ClampedArray]",Rl="[object Uint16Array]",Ll="[object Uint32Array]",Sy=/\b__p \+= '';/g,xy=/\b(__p \+=) '' \+/g,Ey=/(__e\(.*?\)|\b__t\)) \+\n'';/g,gh=/&(?:amp|lt|gt|quot|#39);/g,yh=/[&<>"']/g,Cy=RegExp(gh.source),ky=RegExp(yh.source),Ay=/<%-([\s\S]+?)%>/g,My=/<%([\s\S]+?)%>/g,bh=/<%=([\s\S]+?)%>/g,Ty=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Oy=/^\w*$/,Iy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pl=/[\\^$.*+?()[\]{}|]/g,Ny=RegExp(Pl.source),Dl=/^\s+/,Ry=/\s/,Ly=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Py=/\{\n\/\* \[wrapped with (.+)\] \*/,Dy=/,? & /,Fy=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,zy=/[()=,{}\[\]\/\s]/,By=/\\(\\)?/g,$y=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_h=/\w*$/,Hy=/^[-+]0x[0-9a-f]+$/i,Vy=/^0b[01]+$/i,Wy=/^\[object .+?Constructor\]$/,Uy=/^0o[0-7]+$/i,qy=/^(?:0|[1-9]\d*)$/,Ky=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,no=/($^)/,Gy=/['\n\r\u2028\u2029\\]/g,ro="\\ud800-\\udfff",Jy="\\u0300-\\u036f",jy="\\ufe20-\\ufe2f",Yy="\\u20d0-\\u20ff",vh=Jy+jy+Yy,wh="\\u2700-\\u27bf",Sh="a-z\\xdf-\\xf6\\xf8-\\xff",Xy="\\xac\\xb1\\xd7\\xf7",Zy="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Qy="\\u2000-\\u206f",eb=" \\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",xh="A-Z\\xc0-\\xd6\\xd8-\\xde",Eh="\\ufe0e\\ufe0f",Ch=Xy+Zy+Qy+eb,Fl="['\u2019]",tb="["+ro+"]",kh="["+Ch+"]",io="["+vh+"]",Ah="\\d+",nb="["+wh+"]",Mh="["+Sh+"]",Th="[^"+ro+Ch+Ah+wh+Sh+xh+"]",zl="\\ud83c[\\udffb-\\udfff]",rb="(?:"+io+"|"+zl+")",Oh="[^"+ro+"]",Bl="(?:\\ud83c[\\udde6-\\uddff]){2}",$l="[\\ud800-\\udbff][\\udc00-\\udfff]",oi="["+xh+"]",Ih="\\u200d",Nh="(?:"+Mh+"|"+Th+")",ib="(?:"+oi+"|"+Th+")",Rh="(?:"+Fl+"(?:d|ll|m|re|s|t|ve))?",Lh="(?:"+Fl+"(?:D|LL|M|RE|S|T|VE))?",Ph=rb+"?",Dh="["+Eh+"]?",sb="(?:"+Ih+"(?:"+[Oh,Bl,$l].join("|")+")"+Dh+Ph+")*",ob="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ab="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Fh=Dh+Ph+sb,lb="(?:"+[nb,Bl,$l].join("|")+")"+Fh,ub="(?:"+[Oh+io+"?",io,Bl,$l,tb].join("|")+")",cb=RegExp(Fl,"g"),fb=RegExp(io,"g"),Hl=RegExp(zl+"(?="+zl+")|"+ub+Fh,"g"),hb=RegExp([oi+"?"+Mh+"+"+Rh+"(?="+[kh,oi,"$"].join("|")+")",ib+"+"+Lh+"(?="+[kh,oi+Nh,"$"].join("|")+")",oi+"?"+Nh+"+"+Rh,oi+"+"+Lh,ab,ob,Ah,lb].join("|"),"g"),db=RegExp("["+Ih+ro+vh+Eh+"]"),pb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,mb=["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"],gb=-1,Ee={};Ee[kl]=Ee[Al]=Ee[Ml]=Ee[Tl]=Ee[Ol]=Ee[Il]=Ee[Nl]=Ee[Rl]=Ee[Ll]=!0,Ee[tn]=Ee[Zs]=Ee[rs]=Ee[Xi]=Ee[si]=Ee[Zi]=Ee[Qs]=Ee[eo]=Ee[nn]=Ee[Qi]=Ee[On]=Ee[es]=Ee[rn]=Ee[ts]=Ee[ns]=!1;var xe={};xe[tn]=xe[Zs]=xe[rs]=xe[si]=xe[Xi]=xe[Zi]=xe[kl]=xe[Al]=xe[Ml]=xe[Tl]=xe[Ol]=xe[nn]=xe[Qi]=xe[On]=xe[es]=xe[rn]=xe[ts]=xe[to]=xe[Il]=xe[Nl]=xe[Rl]=xe[Ll]=!0,xe[Qs]=xe[eo]=xe[ns]=!1;var yb={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},bb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_b={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},vb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},wb=parseFloat,Sb=parseInt,zh=typeof qo=="object"&&qo&&qo.Object===Object&&qo,xb=typeof self=="object"&&self&&self.Object===Object&&self,Qe=zh||xb||Function("return this")(),Vl=e&&!e.nodeType&&e,Mr=Vl&&!0&&n&&!n.nodeType&&n,Bh=Mr&&Mr.exports===Vl,Wl=Bh&&zh.process,Bt=function(){try{var T=Mr&&Mr.require&&Mr.require("util").types;return T||Wl&&Wl.binding&&Wl.binding("util")}catch{}}(),$h=Bt&&Bt.isArrayBuffer,Hh=Bt&&Bt.isDate,Vh=Bt&&Bt.isMap,Wh=Bt&&Bt.isRegExp,Uh=Bt&&Bt.isSet,qh=Bt&&Bt.isTypedArray;function Ct(T,R,I){switch(I.length){case 0:return T.call(R);case 1:return T.call(R,I[0]);case 2:return T.call(R,I[0],I[1]);case 3:return T.call(R,I[0],I[1],I[2])}return T.apply(R,I)}function Eb(T,R,I,q){for(var te=-1,be=T==null?0:T.length;++te<be;){var ze=T[te];R(q,ze,I(ze),T)}return q}function $t(T,R){for(var I=-1,q=T==null?0:T.length;++I<q&&R(T[I],I,T)!==!1;);return T}function Cb(T,R){for(var I=T==null?0:T.length;I--&&R(T[I],I,T)!==!1;);return T}function Kh(T,R){for(var I=-1,q=T==null?0:T.length;++I<q;)if(!R(T[I],I,T))return!1;return!0}function tr(T,R){for(var I=-1,q=T==null?0:T.length,te=0,be=[];++I<q;){var ze=T[I];R(ze,I,T)&&(be[te++]=ze)}return be}function so(T,R){var I=T==null?0:T.length;return!!I&&ai(T,R,0)>-1}function Ul(T,R,I){for(var q=-1,te=T==null?0:T.length;++q<te;)if(I(R,T[q]))return!0;return!1}function ke(T,R){for(var I=-1,q=T==null?0:T.length,te=Array(q);++I<q;)te[I]=R(T[I],I,T);return te}function nr(T,R){for(var I=-1,q=R.length,te=T.length;++I<q;)T[te+I]=R[I];return T}function ql(T,R,I,q){var te=-1,be=T==null?0:T.length;for(q&&be&&(I=T[++te]);++te<be;)I=R(I,T[te],te,T);return I}function kb(T,R,I,q){var te=T==null?0:T.length;for(q&&te&&(I=T[--te]);te--;)I=R(I,T[te],te,T);return I}function Kl(T,R){for(var I=-1,q=T==null?0:T.length;++I<q;)if(R(T[I],I,T))return!0;return!1}var Ab=Gl("length");function Mb(T){return T.split("")}function Tb(T){return T.match(Fy)||[]}function Gh(T,R,I){var q;return I(T,function(te,be,ze){if(R(te,be,ze))return q=be,!1}),q}function oo(T,R,I,q){for(var te=T.length,be=I+(q?1:-1);q?be--:++be<te;)if(R(T[be],be,T))return be;return-1}function ai(T,R,I){return R===R?Hb(T,R,I):oo(T,Jh,I)}function Ob(T,R,I,q){for(var te=I-1,be=T.length;++te<be;)if(q(T[te],R))return te;return-1}function Jh(T){return T!==T}function jh(T,R){var I=T==null?0:T.length;return I?jl(T,R)/I:st}function Gl(T){return function(R){return R==null?t:R[T]}}function Jl(T){return function(R){return T==null?t:T[R]}}function Yh(T,R,I,q,te){return te(T,function(be,ze,Se){I=q?(q=!1,be):R(I,be,ze,Se)}),I}function Ib(T,R){var I=T.length;for(T.sort(R);I--;)T[I]=T[I].value;return T}function jl(T,R){for(var I,q=-1,te=T.length;++q<te;){var be=R(T[q]);be!==t&&(I=I===t?be:I+be)}return I}function Yl(T,R){for(var I=-1,q=Array(T);++I<T;)q[I]=R(I);return q}function Nb(T,R){return ke(R,function(I){return[I,T[I]]})}function Xh(T){return T&&T.slice(0,td(T)+1).replace(Dl,"")}function kt(T){return function(R){return T(R)}}function Xl(T,R){return ke(R,function(I){return T[I]})}function is(T,R){return T.has(R)}function Zh(T,R){for(var I=-1,q=T.length;++I<q&&ai(R,T[I],0)>-1;);return I}function Qh(T,R){for(var I=T.length;I--&&ai(R,T[I],0)>-1;);return I}function Rb(T,R){for(var I=T.length,q=0;I--;)T[I]===R&&++q;return q}var Lb=Jl(yb),Pb=Jl(bb);function Db(T){return"\\"+vb[T]}function Fb(T,R){return T==null?t:T[R]}function li(T){return db.test(T)}function zb(T){return pb.test(T)}function Bb(T){for(var R,I=[];!(R=T.next()).done;)I.push(R.value);return I}function Zl(T){var R=-1,I=Array(T.size);return T.forEach(function(q,te){I[++R]=[te,q]}),I}function ed(T,R){return function(I){return T(R(I))}}function rr(T,R){for(var I=-1,q=T.length,te=0,be=[];++I<q;){var ze=T[I];(ze===R||ze===m)&&(T[I]=m,be[te++]=I)}return be}function ao(T){var R=-1,I=Array(T.size);return T.forEach(function(q){I[++R]=q}),I}function $b(T){var R=-1,I=Array(T.size);return T.forEach(function(q){I[++R]=[q,q]}),I}function Hb(T,R,I){for(var q=I-1,te=T.length;++q<te;)if(T[q]===R)return q;return-1}function Vb(T,R,I){for(var q=I+1;q--;)if(T[q]===R)return q;return q}function ui(T){return li(T)?Ub(T):Ab(T)}function sn(T){return li(T)?qb(T):Mb(T)}function td(T){for(var R=T.length;R--&&Ry.test(T.charAt(R)););return R}var Wb=Jl(_b);function Ub(T){for(var R=Hl.lastIndex=0;Hl.test(T);)++R;return R}function qb(T){return T.match(Hl)||[]}function Kb(T){return T.match(hb)||[]}var Gb=function T(R){R=R==null?Qe:ci.defaults(Qe.Object(),R,ci.pick(Qe,mb));var I=R.Array,q=R.Date,te=R.Error,be=R.Function,ze=R.Math,Se=R.Object,Ql=R.RegExp,Jb=R.String,Ht=R.TypeError,lo=I.prototype,jb=be.prototype,fi=Se.prototype,uo=R["__core-js_shared__"],co=jb.toString,we=fi.hasOwnProperty,Yb=0,nd=function(){var s=/[^.]+$/.exec(uo&&uo.keys&&uo.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),fo=fi.toString,Xb=co.call(Se),Zb=Qe._,Qb=Ql("^"+co.call(we).replace(Pl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ho=Bh?R.Buffer:t,ir=R.Symbol,po=R.Uint8Array,rd=ho?ho.allocUnsafe:t,mo=ed(Se.getPrototypeOf,Se),id=Se.create,sd=fi.propertyIsEnumerable,go=lo.splice,od=ir?ir.isConcatSpreadable:t,ss=ir?ir.iterator:t,Tr=ir?ir.toStringTag:t,yo=function(){try{var s=Lr(Se,"defineProperty");return s({},"",{}),s}catch{}}(),e2=R.clearTimeout!==Qe.clearTimeout&&R.clearTimeout,t2=q&&q.now!==Qe.Date.now&&q.now,n2=R.setTimeout!==Qe.setTimeout&&R.setTimeout,bo=ze.ceil,_o=ze.floor,eu=Se.getOwnPropertySymbols,r2=ho?ho.isBuffer:t,ad=R.isFinite,i2=lo.join,s2=ed(Se.keys,Se),Be=ze.max,ot=ze.min,o2=q.now,a2=R.parseInt,ld=ze.random,l2=lo.reverse,tu=Lr(R,"DataView"),as=Lr(R,"Map"),nu=Lr(R,"Promise"),hi=Lr(R,"Set"),ls=Lr(R,"WeakMap"),us=Lr(Se,"create"),vo=ls&&new ls,di={},u2=Pr(tu),c2=Pr(as),f2=Pr(nu),h2=Pr(hi),d2=Pr(ls),wo=ir?ir.prototype:t,cs=wo?wo.valueOf:t,ud=wo?wo.toString:t;function v(s){if(Ie(s)&&!ne(s)&&!(s instanceof ce)){if(s instanceof Vt)return s;if(we.call(s,"__wrapped__"))return cp(s)}return new Vt(s)}var pi=function(){function s(){}return function(l){if(!Me(l))return{};if(id)return id(l);s.prototype=l;var c=new s;return s.prototype=t,c}}();function So(){}function Vt(s,l){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}v.templateSettings={escape:Ay,evaluate:My,interpolate:bh,variable:"",imports:{_:v}},v.prototype=So.prototype,v.prototype.constructor=v,Vt.prototype=pi(So.prototype),Vt.prototype.constructor=Vt;function ce(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=qe,this.__views__=[]}function p2(){var s=new ce(this.__wrapped__);return s.__actions__=bt(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=bt(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=bt(this.__views__),s}function m2(){if(this.__filtered__){var s=new ce(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function g2(){var s=this.__wrapped__.value(),l=this.__dir__,c=ne(s),d=l<0,y=c?s.length:0,w=M_(0,y,this.__views__),C=w.start,M=w.end,O=M-C,P=d?M:C-1,D=this.__iteratees__,F=D.length,W=0,J=ot(O,this.__takeCount__);if(!c||!d&&y==O&&J==O)return Rd(s,this.__actions__);var Z=[];e:for(;O--&&W<J;){P+=l;for(var se=-1,Q=s[P];++se<F;){var le=D[se],he=le.iteratee,Tt=le.type,ht=he(Q);if(Tt==Tn)Q=ht;else if(!ht){if(Tt==en)continue e;break e}}Z[W++]=Q}return Z}ce.prototype=pi(So.prototype),ce.prototype.constructor=ce;function Or(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function y2(){this.__data__=us?us(null):{},this.size=0}function b2(s){var l=this.has(s)&&delete this.__data__[s];return this.size-=l?1:0,l}function _2(s){var l=this.__data__;if(us){var c=l[s];return c===f?t:c}return we.call(l,s)?l[s]:t}function v2(s){var l=this.__data__;return us?l[s]!==t:we.call(l,s)}function w2(s,l){var c=this.__data__;return this.size+=this.has(s)?0:1,c[s]=us&&l===t?f:l,this}Or.prototype.clear=y2,Or.prototype.delete=b2,Or.prototype.get=_2,Or.prototype.has=v2,Or.prototype.set=w2;function In(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function S2(){this.__data__=[],this.size=0}function x2(s){var l=this.__data__,c=xo(l,s);if(c<0)return!1;var d=l.length-1;return c==d?l.pop():go.call(l,c,1),--this.size,!0}function E2(s){var l=this.__data__,c=xo(l,s);return c<0?t:l[c][1]}function C2(s){return xo(this.__data__,s)>-1}function k2(s,l){var c=this.__data__,d=xo(c,s);return d<0?(++this.size,c.push([s,l])):c[d][1]=l,this}In.prototype.clear=S2,In.prototype.delete=x2,In.prototype.get=E2,In.prototype.has=C2,In.prototype.set=k2;function Nn(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var d=s[l];this.set(d[0],d[1])}}function A2(){this.size=0,this.__data__={hash:new Or,map:new(as||In),string:new Or}}function M2(s){var l=Po(this,s).delete(s);return this.size-=l?1:0,l}function T2(s){return Po(this,s).get(s)}function O2(s){return Po(this,s).has(s)}function I2(s,l){var c=Po(this,s),d=c.size;return c.set(s,l),this.size+=c.size==d?0:1,this}Nn.prototype.clear=A2,Nn.prototype.delete=M2,Nn.prototype.get=T2,Nn.prototype.has=O2,Nn.prototype.set=I2;function Ir(s){var l=-1,c=s==null?0:s.length;for(this.__data__=new Nn;++l<c;)this.add(s[l])}function N2(s){return this.__data__.set(s,f),this}function R2(s){return this.__data__.has(s)}Ir.prototype.add=Ir.prototype.push=N2,Ir.prototype.has=R2;function on(s){var l=this.__data__=new In(s);this.size=l.size}function L2(){this.__data__=new In,this.size=0}function P2(s){var l=this.__data__,c=l.delete(s);return this.size=l.size,c}function D2(s){return this.__data__.get(s)}function F2(s){return this.__data__.has(s)}function z2(s,l){var c=this.__data__;if(c instanceof In){var d=c.__data__;if(!as||d.length<i-1)return d.push([s,l]),this.size=++c.size,this;c=this.__data__=new Nn(d)}return c.set(s,l),this.size=c.size,this}on.prototype.clear=L2,on.prototype.delete=P2,on.prototype.get=D2,on.prototype.has=F2,on.prototype.set=z2;function cd(s,l){var c=ne(s),d=!c&&Dr(s),y=!c&&!d&&ur(s),w=!c&&!d&&!y&&bi(s),C=c||d||y||w,M=C?Yl(s.length,Jb):[],O=M.length;for(var P in s)(l||we.call(s,P))&&!(C&&(P=="length"||y&&(P=="offset"||P=="parent")||w&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||Dn(P,O)))&&M.push(P);return M}function fd(s){var l=s.length;return l?s[du(0,l-1)]:t}function B2(s,l){return Do(bt(s),Nr(l,0,s.length))}function $2(s){return Do(bt(s))}function ru(s,l,c){(c!==t&&!an(s[l],c)||c===t&&!(l in s))&&Rn(s,l,c)}function fs(s,l,c){var d=s[l];(!(we.call(s,l)&&an(d,c))||c===t&&!(l in s))&&Rn(s,l,c)}function xo(s,l){for(var c=s.length;c--;)if(an(s[c][0],l))return c;return-1}function H2(s,l,c,d){return sr(s,function(y,w,C){l(d,y,c(y),C)}),d}function hd(s,l){return s&&bn(l,Ke(l),s)}function V2(s,l){return s&&bn(l,vt(l),s)}function Rn(s,l,c){l=="__proto__"&&yo?yo(s,l,{configurable:!0,enumerable:!0,value:c,writable:!0}):s[l]=c}function iu(s,l){for(var c=-1,d=l.length,y=I(d),w=s==null;++c<d;)y[c]=w?t:zu(s,l[c]);return y}function Nr(s,l,c){return s===s&&(c!==t&&(s=s<=c?s:c),l!==t&&(s=s>=l?s:l)),s}function Wt(s,l,c,d,y,w){var C,M=l&p,O=l&b,P=l&S;if(c&&(C=y?c(s,d,y,w):c(s)),C!==t)return C;if(!Me(s))return s;var D=ne(s);if(D){if(C=O_(s),!M)return bt(s,C)}else{var F=at(s),W=F==eo||F==ph;if(ur(s))return Dd(s,M);if(F==On||F==tn||W&&!y){if(C=O||W?{}:tp(s),!M)return O?__(s,V2(C,s)):b_(s,hd(C,s))}else{if(!xe[F])return y?s:{};C=I_(s,F,M)}}w||(w=new on);var J=w.get(s);if(J)return J;w.set(s,C),Op(s)?s.forEach(function(Q){C.add(Wt(Q,l,c,Q,s,w))}):Mp(s)&&s.forEach(function(Q,le){C.set(le,Wt(Q,l,c,le,s,w))});var Z=P?O?Eu:xu:O?vt:Ke,se=D?t:Z(s);return $t(se||s,function(Q,le){se&&(le=Q,Q=s[le]),fs(C,le,Wt(Q,l,c,le,s,w))}),C}function W2(s){var l=Ke(s);return function(c){return dd(c,s,l)}}function dd(s,l,c){var d=c.length;if(s==null)return!d;for(s=Se(s);d--;){var y=c[d],w=l[y],C=s[y];if(C===t&&!(y in s)||!w(C))return!1}return!0}function pd(s,l,c){if(typeof s!="function")throw new Ht(a);return bs(function(){s.apply(t,c)},l)}function hs(s,l,c,d){var y=-1,w=so,C=!0,M=s.length,O=[],P=l.length;if(!M)return O;c&&(l=ke(l,kt(c))),d?(w=Ul,C=!1):l.length>=i&&(w=is,C=!1,l=new Ir(l));e:for(;++y<M;){var D=s[y],F=c==null?D:c(D);if(D=d||D!==0?D:0,C&&F===F){for(var W=P;W--;)if(l[W]===F)continue e;O.push(D)}else w(l,F,d)||O.push(D)}return O}var sr=Hd(yn),md=Hd(ou,!0);function U2(s,l){var c=!0;return sr(s,function(d,y,w){return c=!!l(d,y,w),c}),c}function Eo(s,l,c){for(var d=-1,y=s.length;++d<y;){var w=s[d],C=l(w);if(C!=null&&(M===t?C===C&&!Mt(C):c(C,M)))var M=C,O=w}return O}function q2(s,l,c,d){var y=s.length;for(c=re(c),c<0&&(c=-c>y?0:y+c),d=d===t||d>y?y:re(d),d<0&&(d+=y),d=c>d?0:Np(d);c<d;)s[c++]=l;return s}function gd(s,l){var c=[];return sr(s,function(d,y,w){l(d,y,w)&&c.push(d)}),c}function et(s,l,c,d,y){var w=-1,C=s.length;for(c||(c=R_),y||(y=[]);++w<C;){var M=s[w];l>0&&c(M)?l>1?et(M,l-1,c,d,y):nr(y,M):d||(y[y.length]=M)}return y}var su=Vd(),yd=Vd(!0);function yn(s,l){return s&&su(s,l,Ke)}function ou(s,l){return s&&yd(s,l,Ke)}function Co(s,l){return tr(l,function(c){return Fn(s[c])})}function Rr(s,l){l=ar(l,s);for(var c=0,d=l.length;s!=null&&c<d;)s=s[_n(l[c++])];return c&&c==d?s:t}function bd(s,l,c){var d=l(s);return ne(s)?d:nr(d,c(s))}function ct(s){return s==null?s===t?vy:by:Tr&&Tr in Se(s)?A_(s):$_(s)}function au(s,l){return s>l}function K2(s,l){return s!=null&&we.call(s,l)}function G2(s,l){return s!=null&&l in Se(s)}function J2(s,l,c){return s>=ot(l,c)&&s<Be(l,c)}function lu(s,l,c){for(var d=c?Ul:so,y=s[0].length,w=s.length,C=w,M=I(w),O=1/0,P=[];C--;){var D=s[C];C&&l&&(D=ke(D,kt(l))),O=ot(D.length,O),M[C]=!c&&(l||y>=120&&D.length>=120)?new Ir(C&&D):t}D=s[0];var F=-1,W=M[0];e:for(;++F<y&&P.length<O;){var J=D[F],Z=l?l(J):J;if(J=c||J!==0?J:0,!(W?is(W,Z):d(P,Z,c))){for(C=w;--C;){var se=M[C];if(!(se?is(se,Z):d(s[C],Z,c)))continue e}W&&W.push(Z),P.push(J)}}return P}function j2(s,l,c,d){return yn(s,function(y,w,C){l(d,c(y),w,C)}),d}function ds(s,l,c){l=ar(l,s),s=sp(s,l);var d=s==null?s:s[_n(qt(l))];return d==null?t:Ct(d,s,c)}function _d(s){return Ie(s)&&ct(s)==tn}function Y2(s){return Ie(s)&&ct(s)==rs}function X2(s){return Ie(s)&&ct(s)==Zi}function ps(s,l,c,d,y){return s===l?!0:s==null||l==null||!Ie(s)&&!Ie(l)?s!==s&&l!==l:Z2(s,l,c,d,ps,y)}function Z2(s,l,c,d,y,w){var C=ne(s),M=ne(l),O=C?Zs:at(s),P=M?Zs:at(l);O=O==tn?On:O,P=P==tn?On:P;var D=O==On,F=P==On,W=O==P;if(W&&ur(s)){if(!ur(l))return!1;C=!0,D=!1}if(W&&!D)return w||(w=new on),C||bi(s)?Zd(s,l,c,d,y,w):C_(s,l,O,c,d,y,w);if(!(c&E)){var J=D&&we.call(s,"__wrapped__"),Z=F&&we.call(l,"__wrapped__");if(J||Z){var se=J?s.value():s,Q=Z?l.value():l;return w||(w=new on),y(se,Q,c,d,w)}}return W?(w||(w=new on),k_(s,l,c,d,y,w)):!1}function Q2(s){return Ie(s)&&at(s)==nn}function uu(s,l,c,d){var y=c.length,w=y,C=!d;if(s==null)return!w;for(s=Se(s);y--;){var M=c[y];if(C&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++y<w;){M=c[y];var O=M[0],P=s[O],D=M[1];if(C&&M[2]){if(P===t&&!(O in s))return!1}else{var F=new on;if(d)var W=d(P,D,O,s,l,F);if(!(W===t?ps(D,P,E|g,d,F):W))return!1}}return!0}function vd(s){if(!Me(s)||P_(s))return!1;var l=Fn(s)?Qb:Wy;return l.test(Pr(s))}function e_(s){return Ie(s)&&ct(s)==es}function t_(s){return Ie(s)&&at(s)==rn}function n_(s){return Ie(s)&&Vo(s.length)&&!!Ee[ct(s)]}function wd(s){return typeof s=="function"?s:s==null?wt:typeof s=="object"?ne(s)?Ed(s[0],s[1]):xd(s):Wp(s)}function cu(s){if(!ys(s))return s2(s);var l=[];for(var c in Se(s))we.call(s,c)&&c!="constructor"&&l.push(c);return l}function r_(s){if(!Me(s))return B_(s);var l=ys(s),c=[];for(var d in s)d=="constructor"&&(l||!we.call(s,d))||c.push(d);return c}function fu(s,l){return s<l}function Sd(s,l){var c=-1,d=_t(s)?I(s.length):[];return sr(s,function(y,w,C){d[++c]=l(y,w,C)}),d}function xd(s){var l=ku(s);return l.length==1&&l[0][2]?rp(l[0][0],l[0][1]):function(c){return c===s||uu(c,s,l)}}function Ed(s,l){return Mu(s)&&np(l)?rp(_n(s),l):function(c){var d=zu(c,s);return d===t&&d===l?Bu(c,s):ps(l,d,E|g)}}function ko(s,l,c,d,y){s!==l&&su(l,function(w,C){if(y||(y=new on),Me(w))i_(s,l,C,c,ko,d,y);else{var M=d?d(Ou(s,C),w,C+"",s,l,y):t;M===t&&(M=w),ru(s,C,M)}},vt)}function i_(s,l,c,d,y,w,C){var M=Ou(s,c),O=Ou(l,c),P=C.get(O);if(P){ru(s,c,P);return}var D=w?w(M,O,c+"",s,l,C):t,F=D===t;if(F){var W=ne(O),J=!W&&ur(O),Z=!W&&!J&&bi(O);D=O,W||J||Z?ne(M)?D=M:Ne(M)?D=bt(M):J?(F=!1,D=Dd(O,!0)):Z?(F=!1,D=Fd(O,!0)):D=[]:_s(O)||Dr(O)?(D=M,Dr(M)?D=Rp(M):(!Me(M)||Fn(M))&&(D=tp(O))):F=!1}F&&(C.set(O,D),y(D,O,d,w,C),C.delete(O)),ru(s,c,D)}function Cd(s,l){var c=s.length;if(c)return l+=l<0?c:0,Dn(l,c)?s[l]:t}function kd(s,l,c){l.length?l=ke(l,function(w){return ne(w)?function(C){return Rr(C,w.length===1?w[0]:w)}:w}):l=[wt];var d=-1;l=ke(l,kt(X()));var y=Sd(s,function(w,C,M){var O=ke(l,function(P){return P(w)});return{criteria:O,index:++d,value:w}});return Ib(y,function(w,C){return y_(w,C,c)})}function s_(s,l){return Ad(s,l,function(c,d){return Bu(s,d)})}function Ad(s,l,c){for(var d=-1,y=l.length,w={};++d<y;){var C=l[d],M=Rr(s,C);c(M,C)&&ms(w,ar(C,s),M)}return w}function o_(s){return function(l){return Rr(l,s)}}function hu(s,l,c,d){var y=d?Ob:ai,w=-1,C=l.length,M=s;for(s===l&&(l=bt(l)),c&&(M=ke(s,kt(c)));++w<C;)for(var O=0,P=l[w],D=c?c(P):P;(O=y(M,D,O,d))>-1;)M!==s&&go.call(M,O,1),go.call(s,O,1);return s}function Md(s,l){for(var c=s?l.length:0,d=c-1;c--;){var y=l[c];if(c==d||y!==w){var w=y;Dn(y)?go.call(s,y,1):gu(s,y)}}return s}function du(s,l){return s+_o(ld()*(l-s+1))}function a_(s,l,c,d){for(var y=-1,w=Be(bo((l-s)/(c||1)),0),C=I(w);w--;)C[d?w:++y]=s,s+=c;return C}function pu(s,l){var c="";if(!s||l<1||l>Ue)return c;do l%2&&(c+=s),l=_o(l/2),l&&(s+=s);while(l);return c}function oe(s,l){return Iu(ip(s,l,wt),s+"")}function l_(s){return fd(_i(s))}function u_(s,l){var c=_i(s);return Do(c,Nr(l,0,c.length))}function ms(s,l,c,d){if(!Me(s))return s;l=ar(l,s);for(var y=-1,w=l.length,C=w-1,M=s;M!=null&&++y<w;){var O=_n(l[y]),P=c;if(O==="__proto__"||O==="constructor"||O==="prototype")return s;if(y!=C){var D=M[O];P=d?d(D,O,M):t,P===t&&(P=Me(D)?D:Dn(l[y+1])?[]:{})}fs(M,O,P),M=M[O]}return s}var Td=vo?function(s,l){return vo.set(s,l),s}:wt,c_=yo?function(s,l){return yo(s,"toString",{configurable:!0,enumerable:!1,value:Hu(l),writable:!0})}:wt;function f_(s){return Do(_i(s))}function Ut(s,l,c){var d=-1,y=s.length;l<0&&(l=-l>y?0:y+l),c=c>y?y:c,c<0&&(c+=y),y=l>c?0:c-l>>>0,l>>>=0;for(var w=I(y);++d<y;)w[d]=s[d+l];return w}function h_(s,l){var c;return sr(s,function(d,y,w){return c=l(d,y,w),!c}),!!c}function Ao(s,l,c){var d=0,y=s==null?d:s.length;if(typeof l=="number"&&l===l&&y<=er){for(;d<y;){var w=d+y>>>1,C=s[w];C!==null&&!Mt(C)&&(c?C<=l:C<l)?d=w+1:y=w}return y}return mu(s,l,wt,c)}function mu(s,l,c,d){var y=0,w=s==null?0:s.length;if(w===0)return 0;l=c(l);for(var C=l!==l,M=l===null,O=Mt(l),P=l===t;y<w;){var D=_o((y+w)/2),F=c(s[D]),W=F!==t,J=F===null,Z=F===F,se=Mt(F);if(C)var Q=d||Z;else P?Q=Z&&(d||W):M?Q=Z&&W&&(d||!J):O?Q=Z&&W&&!J&&(d||!se):J||se?Q=!1:Q=d?F<=l:F<l;Q?y=D+1:w=D}return ot(w,Qn)}function Od(s,l){for(var c=-1,d=s.length,y=0,w=[];++c<d;){var C=s[c],M=l?l(C):C;if(!c||!an(M,O)){var O=M;w[y++]=C===0?0:C}}return w}function Id(s){return typeof s=="number"?s:Mt(s)?st:+s}function At(s){if(typeof s=="string")return s;if(ne(s))return ke(s,At)+"";if(Mt(s))return ud?ud.call(s):"";var l=s+"";return l=="0"&&1/s==-We?"-0":l}function or(s,l,c){var d=-1,y=so,w=s.length,C=!0,M=[],O=M;if(c)C=!1,y=Ul;else if(w>=i){var P=l?null:x_(s);if(P)return ao(P);C=!1,y=is,O=new Ir}else O=l?[]:M;e:for(;++d<w;){var D=s[d],F=l?l(D):D;if(D=c||D!==0?D:0,C&&F===F){for(var W=O.length;W--;)if(O[W]===F)continue e;l&&O.push(F),M.push(D)}else y(O,F,c)||(O!==M&&O.push(F),M.push(D))}return M}function gu(s,l){return l=ar(l,s),s=sp(s,l),s==null||delete s[_n(qt(l))]}function Nd(s,l,c,d){return ms(s,l,c(Rr(s,l)),d)}function Mo(s,l,c,d){for(var y=s.length,w=d?y:-1;(d?w--:++w<y)&&l(s[w],w,s););return c?Ut(s,d?0:w,d?w+1:y):Ut(s,d?w+1:0,d?y:w)}function Rd(s,l){var c=s;return c instanceof ce&&(c=c.value()),ql(l,function(d,y){return y.func.apply(y.thisArg,nr([d],y.args))},c)}function yu(s,l,c){var d=s.length;if(d<2)return d?or(s[0]):[];for(var y=-1,w=I(d);++y<d;)for(var C=s[y],M=-1;++M<d;)M!=y&&(w[y]=hs(w[y]||C,s[M],l,c));return or(et(w,1),l,c)}function Ld(s,l,c){for(var d=-1,y=s.length,w=l.length,C={};++d<y;){var M=d<w?l[d]:t;c(C,s[d],M)}return C}function bu(s){return Ne(s)?s:[]}function _u(s){return typeof s=="function"?s:wt}function ar(s,l){return ne(s)?s:Mu(s,l)?[s]:up(_e(s))}var d_=oe;function lr(s,l,c){var d=s.length;return c=c===t?d:c,!l&&c>=d?s:Ut(s,l,c)}var Pd=e2||function(s){return Qe.clearTimeout(s)};function Dd(s,l){if(l)return s.slice();var c=s.length,d=rd?rd(c):new s.constructor(c);return s.copy(d),d}function vu(s){var l=new s.constructor(s.byteLength);return new po(l).set(new po(s)),l}function p_(s,l){var c=l?vu(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.byteLength)}function m_(s){var l=new s.constructor(s.source,_h.exec(s));return l.lastIndex=s.lastIndex,l}function g_(s){return cs?Se(cs.call(s)):{}}function Fd(s,l){var c=l?vu(s.buffer):s.buffer;return new s.constructor(c,s.byteOffset,s.length)}function zd(s,l){if(s!==l){var c=s!==t,d=s===null,y=s===s,w=Mt(s),C=l!==t,M=l===null,O=l===l,P=Mt(l);if(!M&&!P&&!w&&s>l||w&&C&&O&&!M&&!P||d&&C&&O||!c&&O||!y)return 1;if(!d&&!w&&!P&&s<l||P&&c&&y&&!d&&!w||M&&c&&y||!C&&y||!O)return-1}return 0}function y_(s,l,c){for(var d=-1,y=s.criteria,w=l.criteria,C=y.length,M=c.length;++d<C;){var O=zd(y[d],w[d]);if(O){if(d>=M)return O;var P=c[d];return O*(P=="desc"?-1:1)}}return s.index-l.index}function Bd(s,l,c,d){for(var y=-1,w=s.length,C=c.length,M=-1,O=l.length,P=Be(w-C,0),D=I(O+P),F=!d;++M<O;)D[M]=l[M];for(;++y<C;)(F||y<w)&&(D[c[y]]=s[y]);for(;P--;)D[M++]=s[y++];return D}function $d(s,l,c,d){for(var y=-1,w=s.length,C=-1,M=c.length,O=-1,P=l.length,D=Be(w-M,0),F=I(D+P),W=!d;++y<D;)F[y]=s[y];for(var J=y;++O<P;)F[J+O]=l[O];for(;++C<M;)(W||y<w)&&(F[J+c[C]]=s[y++]);return F}function bt(s,l){var c=-1,d=s.length;for(l||(l=I(d));++c<d;)l[c]=s[c];return l}function bn(s,l,c,d){var y=!c;c||(c={});for(var w=-1,C=l.length;++w<C;){var M=l[w],O=d?d(c[M],s[M],M,c,s):t;O===t&&(O=s[M]),y?Rn(c,M,O):fs(c,M,O)}return c}function b_(s,l){return bn(s,Au(s),l)}function __(s,l){return bn(s,Qd(s),l)}function To(s,l){return function(c,d){var y=ne(c)?Eb:H2,w=l?l():{};return y(c,s,X(d,2),w)}}function mi(s){return oe(function(l,c){var d=-1,y=c.length,w=y>1?c[y-1]:t,C=y>2?c[2]:t;for(w=s.length>3&&typeof w=="function"?(y--,w):t,C&&ft(c[0],c[1],C)&&(w=y<3?t:w,y=1),l=Se(l);++d<y;){var M=c[d];M&&s(l,M,d,w)}return l})}function Hd(s,l){return function(c,d){if(c==null)return c;if(!_t(c))return s(c,d);for(var y=c.length,w=l?y:-1,C=Se(c);(l?w--:++w<y)&&d(C[w],w,C)!==!1;);return c}}function Vd(s){return function(l,c,d){for(var y=-1,w=Se(l),C=d(l),M=C.length;M--;){var O=C[s?M:++y];if(c(w[O],O,w)===!1)break}return l}}function v_(s,l,c){var d=l&_,y=gs(s);function w(){var C=this&&this!==Qe&&this instanceof w?y:s;return C.apply(d?c:this,arguments)}return w}function Wd(s){return function(l){l=_e(l);var c=li(l)?sn(l):t,d=c?c[0]:l.charAt(0),y=c?lr(c,1).join(""):l.slice(1);return d[s]()+y}}function gi(s){return function(l){return ql(Hp($p(l).replace(cb,"")),s,"")}}function gs(s){return function(){var l=arguments;switch(l.length){case 0:return new s;case 1:return new s(l[0]);case 2:return new s(l[0],l[1]);case 3:return new s(l[0],l[1],l[2]);case 4:return new s(l[0],l[1],l[2],l[3]);case 5:return new s(l[0],l[1],l[2],l[3],l[4]);case 6:return new s(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new s(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var c=pi(s.prototype),d=s.apply(c,l);return Me(d)?d:c}}function w_(s,l,c){var d=gs(s);function y(){for(var w=arguments.length,C=I(w),M=w,O=yi(y);M--;)C[M]=arguments[M];var P=w<3&&C[0]!==O&&C[w-1]!==O?[]:rr(C,O);if(w-=P.length,w<c)return Jd(s,l,Oo,y.placeholder,t,C,P,t,t,c-w);var D=this&&this!==Qe&&this instanceof y?d:s;return Ct(D,this,C)}return y}function Ud(s){return function(l,c,d){var y=Se(l);if(!_t(l)){var w=X(c,3);l=Ke(l),c=function(M){return w(y[M],M,y)}}var C=s(l,c,d);return C>-1?y[w?l[C]:C]:t}}function qd(s){return Pn(function(l){var c=l.length,d=c,y=Vt.prototype.thru;for(s&&l.reverse();d--;){var w=l[d];if(typeof w!="function")throw new Ht(a);if(y&&!C&&Lo(w)=="wrapper")var C=new Vt([],!0)}for(d=C?d:c;++d<c;){w=l[d];var M=Lo(w),O=M=="wrapper"?Cu(w):t;O&&Tu(O[0])&&O[1]==(U|A|V|j)&&!O[4].length&&O[9]==1?C=C[Lo(O[0])].apply(C,O[3]):C=w.length==1&&Tu(w)?C[M]():C.thru(w)}return function(){var P=arguments,D=P[0];if(C&&P.length==1&&ne(D))return C.plant(D).value();for(var F=0,W=c?l[F].apply(this,P):D;++F<c;)W=l[F].call(this,W);return W}})}function Oo(s,l,c,d,y,w,C,M,O,P){var D=l&U,F=l&_,W=l&x,J=l&(A|N),Z=l&pe,se=W?t:gs(s);function Q(){for(var le=arguments.length,he=I(le),Tt=le;Tt--;)he[Tt]=arguments[Tt];if(J)var ht=yi(Q),Ot=Rb(he,ht);if(d&&(he=Bd(he,d,y,J)),w&&(he=$d(he,w,C,J)),le-=Ot,J&&le<P){var Re=rr(he,ht);return Jd(s,l,Oo,Q.placeholder,c,he,Re,M,O,P-le)}var ln=F?c:this,Bn=W?ln[s]:s;return le=he.length,M?he=H_(he,M):Z&&le>1&&he.reverse(),D&&O<le&&(he.length=O),this&&this!==Qe&&this instanceof Q&&(Bn=se||gs(Bn)),Bn.apply(ln,he)}return Q}function Kd(s,l){return function(c,d){return j2(c,s,l(d),{})}}function Io(s,l){return function(c,d){var y;if(c===t&&d===t)return l;if(c!==t&&(y=c),d!==t){if(y===t)return d;typeof c=="string"||typeof d=="string"?(c=At(c),d=At(d)):(c=Id(c),d=Id(d)),y=s(c,d)}return y}}function wu(s){return Pn(function(l){return l=ke(l,kt(X())),oe(function(c){var d=this;return s(l,function(y){return Ct(y,d,c)})})})}function No(s,l){l=l===t?" ":At(l);var c=l.length;if(c<2)return c?pu(l,s):l;var d=pu(l,bo(s/ui(l)));return li(l)?lr(sn(d),0,s).join(""):d.slice(0,s)}function S_(s,l,c,d){var y=l&_,w=gs(s);function C(){for(var M=-1,O=arguments.length,P=-1,D=d.length,F=I(D+O),W=this&&this!==Qe&&this instanceof C?w:s;++P<D;)F[P]=d[P];for(;O--;)F[P++]=arguments[++M];return Ct(W,y?c:this,F)}return C}function Gd(s){return function(l,c,d){return d&&typeof d!="number"&&ft(l,c,d)&&(c=d=t),l=zn(l),c===t?(c=l,l=0):c=zn(c),d=d===t?l<c?1:-1:zn(d),a_(l,c,d,s)}}function Ro(s){return function(l,c){return typeof l=="string"&&typeof c=="string"||(l=Kt(l),c=Kt(c)),s(l,c)}}function Jd(s,l,c,d,y,w,C,M,O,P){var D=l&A,F=D?C:t,W=D?t:C,J=D?w:t,Z=D?t:w;l|=D?V:L,l&=~(D?L:V),l&k||(l&=~(_|x));var se=[s,l,y,J,F,Z,W,M,O,P],Q=c.apply(t,se);return Tu(s)&&op(Q,se),Q.placeholder=d,ap(Q,s,l)}function Su(s){var l=ze[s];return function(c,d){if(c=Kt(c),d=d==null?0:ot(re(d),292),d&&ad(c)){var y=(_e(c)+"e").split("e"),w=l(y[0]+"e"+(+y[1]+d));return y=(_e(w)+"e").split("e"),+(y[0]+"e"+(+y[1]-d))}return l(c)}}var x_=hi&&1/ao(new hi([,-0]))[1]==We?function(s){return new hi(s)}:Uu;function jd(s){return function(l){var c=at(l);return c==nn?Zl(l):c==rn?$b(l):Nb(l,s(l))}}function Ln(s,l,c,d,y,w,C,M){var O=l&x;if(!O&&typeof s!="function")throw new Ht(a);var P=d?d.length:0;if(P||(l&=~(V|L),d=y=t),C=C===t?C:Be(re(C),0),M=M===t?M:re(M),P-=y?y.length:0,l&L){var D=d,F=y;d=y=t}var W=O?t:Cu(s),J=[s,l,c,d,y,D,F,w,C,M];if(W&&z_(J,W),s=J[0],l=J[1],c=J[2],d=J[3],y=J[4],M=J[9]=J[9]===t?O?0:s.length:Be(J[9]-P,0),!M&&l&(A|N)&&(l&=~(A|N)),!l||l==_)var Z=v_(s,l,c);else l==A||l==N?Z=w_(s,l,M):(l==V||l==(_|V))&&!y.length?Z=S_(s,l,c,d):Z=Oo.apply(t,J);var se=W?Td:op;return ap(se(Z,J),s,l)}function Yd(s,l,c,d){return s===t||an(s,fi[c])&&!we.call(d,c)?l:s}function Xd(s,l,c,d,y,w){return Me(s)&&Me(l)&&(w.set(l,s),ko(s,l,t,Xd,w),w.delete(l)),s}function E_(s){return _s(s)?t:s}function Zd(s,l,c,d,y,w){var C=c&E,M=s.length,O=l.length;if(M!=O&&!(C&&O>M))return!1;var P=w.get(s),D=w.get(l);if(P&&D)return P==l&&D==s;var F=-1,W=!0,J=c&g?new Ir:t;for(w.set(s,l),w.set(l,s);++F<M;){var Z=s[F],se=l[F];if(d)var Q=C?d(se,Z,F,l,s,w):d(Z,se,F,s,l,w);if(Q!==t){if(Q)continue;W=!1;break}if(J){if(!Kl(l,function(le,he){if(!is(J,he)&&(Z===le||y(Z,le,c,d,w)))return J.push(he)})){W=!1;break}}else if(!(Z===se||y(Z,se,c,d,w))){W=!1;break}}return w.delete(s),w.delete(l),W}function C_(s,l,c,d,y,w,C){switch(c){case si:if(s.byteLength!=l.byteLength||s.byteOffset!=l.byteOffset)return!1;s=s.buffer,l=l.buffer;case rs:return!(s.byteLength!=l.byteLength||!w(new po(s),new po(l)));case Xi:case Zi:case Qi:return an(+s,+l);case Qs:return s.name==l.name&&s.message==l.message;case es:case ts:return s==l+"";case nn:var M=Zl;case rn:var O=d&E;if(M||(M=ao),s.size!=l.size&&!O)return!1;var P=C.get(s);if(P)return P==l;d|=g,C.set(s,l);var D=Zd(M(s),M(l),d,y,w,C);return C.delete(s),D;case to:if(cs)return cs.call(s)==cs.call(l)}return!1}function k_(s,l,c,d,y,w){var C=c&E,M=xu(s),O=M.length,P=xu(l),D=P.length;if(O!=D&&!C)return!1;for(var F=O;F--;){var W=M[F];if(!(C?W in l:we.call(l,W)))return!1}var J=w.get(s),Z=w.get(l);if(J&&Z)return J==l&&Z==s;var se=!0;w.set(s,l),w.set(l,s);for(var Q=C;++F<O;){W=M[F];var le=s[W],he=l[W];if(d)var Tt=C?d(he,le,W,l,s,w):d(le,he,W,s,l,w);if(!(Tt===t?le===he||y(le,he,c,d,w):Tt)){se=!1;break}Q||(Q=W=="constructor")}if(se&&!Q){var ht=s.constructor,Ot=l.constructor;ht!=Ot&&"constructor"in s&&"constructor"in l&&!(typeof ht=="function"&&ht instanceof ht&&typeof Ot=="function"&&Ot instanceof Ot)&&(se=!1)}return w.delete(s),w.delete(l),se}function Pn(s){return Iu(ip(s,t,dp),s+"")}function xu(s){return bd(s,Ke,Au)}function Eu(s){return bd(s,vt,Qd)}var Cu=vo?function(s){return vo.get(s)}:Uu;function Lo(s){for(var l=s.name+"",c=di[l],d=we.call(di,l)?c.length:0;d--;){var y=c[d],w=y.func;if(w==null||w==s)return y.name}return l}function yi(s){var l=we.call(v,"placeholder")?v:s;return l.placeholder}function X(){var s=v.iteratee||Vu;return s=s===Vu?wd:s,arguments.length?s(arguments[0],arguments[1]):s}function Po(s,l){var c=s.__data__;return L_(l)?c[typeof l=="string"?"string":"hash"]:c.map}function ku(s){for(var l=Ke(s),c=l.length;c--;){var d=l[c],y=s[d];l[c]=[d,y,np(y)]}return l}function Lr(s,l){var c=Fb(s,l);return vd(c)?c:t}function A_(s){var l=we.call(s,Tr),c=s[Tr];try{s[Tr]=t;var d=!0}catch{}var y=fo.call(s);return d&&(l?s[Tr]=c:delete s[Tr]),y}var Au=eu?function(s){return s==null?[]:(s=Se(s),tr(eu(s),function(l){return sd.call(s,l)}))}:qu,Qd=eu?function(s){for(var l=[];s;)nr(l,Au(s)),s=mo(s);return l}:qu,at=ct;(tu&&at(new tu(new ArrayBuffer(1)))!=si||as&&at(new as)!=nn||nu&&at(nu.resolve())!=mh||hi&&at(new hi)!=rn||ls&&at(new ls)!=ns)&&(at=function(s){var l=ct(s),c=l==On?s.constructor:t,d=c?Pr(c):"";if(d)switch(d){case u2:return si;case c2:return nn;case f2:return mh;case h2:return rn;case d2:return ns}return l});function M_(s,l,c){for(var d=-1,y=c.length;++d<y;){var w=c[d],C=w.size;switch(w.type){case"drop":s+=C;break;case"dropRight":l-=C;break;case"take":l=ot(l,s+C);break;case"takeRight":s=Be(s,l-C);break}}return{start:s,end:l}}function T_(s){var l=s.match(Py);return l?l[1].split(Dy):[]}function ep(s,l,c){l=ar(l,s);for(var d=-1,y=l.length,w=!1;++d<y;){var C=_n(l[d]);if(!(w=s!=null&&c(s,C)))break;s=s[C]}return w||++d!=y?w:(y=s==null?0:s.length,!!y&&Vo(y)&&Dn(C,y)&&(ne(s)||Dr(s)))}function O_(s){var l=s.length,c=new s.constructor(l);return l&&typeof s[0]=="string"&&we.call(s,"index")&&(c.index=s.index,c.input=s.input),c}function tp(s){return typeof s.constructor=="function"&&!ys(s)?pi(mo(s)):{}}function I_(s,l,c){var d=s.constructor;switch(l){case rs:return vu(s);case Xi:case Zi:return new d(+s);case si:return p_(s,c);case kl:case Al:case Ml:case Tl:case Ol:case Il:case Nl:case Rl:case Ll:return Fd(s,c);case nn:return new d;case Qi:case ts:return new d(s);case es:return m_(s);case rn:return new d;case to:return g_(s)}}function N_(s,l){var c=l.length;if(!c)return s;var d=c-1;return l[d]=(c>1?"& ":"")+l[d],l=l.join(c>2?", ":" "),s.replace(Ly,`{
41
41
  /* [wrapped with `+l+`] */
42
- `)}function E_(s){return ne(s)||Lr(s)||!!(Zh&&s&&s[Zh])}function On(s,l){var c=typeof s;return l=l??He,!!l&&(c=="number"||c!="symbol"&&zy.test(s))&&s>-1&&s%1==0&&s<l}function at(s,l,c){if(!Ae(c))return!1;var d=typeof l;return(d=="number"?mt(c)&&On(l,c.length):d=="string"&&l in c)?rn(c[l],s):!1}function wu(s,l){if(ne(s))return!1;var c=typeof s;return c=="number"||c=="symbol"||c=="boolean"||s==null||Et(s)?!0:xy.test(s)||!Sy.test(s)||l!=null&&s in Se(l)}function A_(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function Su(s){var l=To(s),c=v[l];if(typeof c!="function"||!(l in ce.prototype))return!1;if(s===c)return!0;var d=bu(c);return!!d&&s===d[0]}function M_(s){return!!Jh&&Jh in s}var T_=io?In:Bu;function ds(s){var l=s&&s.constructor,c=typeof l=="function"&&l.prototype||li;return s===c}function Jd(s){return s===s&&!Ae(s)}function jd(s,l){return function(c){return c==null?!1:c[s]===l&&(l!==t||s in Se(c))}}function O_(s){var l=Po(s,function(d){return c.size===h&&c.clear(),d}),c=l.cache;return l}function I_(s,l){var c=s[1],d=l[1],y=c|d,w=y<(_|x|U),C=d==U&&c==A||d==U&&c==j&&s[7].length<=l[8]||d==(U|j)&&l[7].length<=l[8]&&c==A;if(!(w||C))return s;d&_&&(s[2]=l[2],y|=c&_?0:E);var M=l[3];if(M){var O=s[3];s[3]=O?Id(O,M,l[4]):M,s[4]=O?Qn(s[3],m):l[4]}return M=l[5],M&&(O=s[5],s[5]=O?Nd(O,M,l[6]):M,s[6]=O?Qn(s[5],m):l[6]),M=l[7],M&&(s[7]=M),d&U&&(s[8]=s[8]==null?l[8]:nt(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function N_(s){var l=[];if(s!=null)for(var c in Se(s))l.push(c);return l}function R_(s){return oo.call(s)}function Yd(s,l,c){return l=De(l===t?s.length-1:l,0),function(){for(var d=arguments,y=-1,w=De(d.length-l,0),C=I(w);++y<w;)C[y]=d[l+y];y=-1;for(var M=I(l+1);++y<l;)M[y]=d[y];return M[l]=c(C),xt(s,this,M)}}function Xd(s,l){return l.length<2?s:Ir(s,Ht(l,0,-1))}function L_(s,l){for(var c=s.length,d=nt(l.length,c),y=pt(s);d--;){var w=l[d];s[d]=On(w,c)?y[w]:t}return s}function xu(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var Zd=ep(wd),ps=jb||function(s,l){return je.setTimeout(s,l)},ku=ep(r_);function Qd(s,l,c){var d=l+"";return ku(s,C_(d,P_(S_(d),c)))}function ep(s){var l=0,c=0;return function(){var d=Qb(),y=Jn-(d-c);if(c=d,y>0){if(++l>=Lt)return arguments[0]}else l=0;return s.apply(t,arguments)}}function Io(s,l){var c=-1,d=s.length,y=d-1;for(l=l===t?d:l;++c<l;){var w=ou(c,y),C=s[w];s[w]=s[c],s[c]=C}return s.length=l,s}var tp=O_(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(ky,function(c,d,y,w){l.push(y?w.replace(Ny,"$1"):d||c)}),l});function pn(s){if(typeof s=="string"||Et(s))return s;var l=s+"";return l=="0"&&1/s==-$e?"-0":l}function Rr(s){if(s!=null){try{return so.call(s)}catch{}try{return s+""}catch{}}return""}function P_(s,l){return Ft(bl,function(c){var d="_."+c[0];l&c[1]&&!eo(s,d)&&s.push(d)}),s.sort()}function np(s){if(s instanceof ce)return s.clone();var l=new Bt(s.__wrapped__,s.__chain__);return l.__actions__=pt(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function D_(s,l,c){(c?at(s,l,c):l===t)?l=1:l=De(re(l),0);var d=s==null?0:s.length;if(!d||l<1)return[];for(var y=0,w=0,C=I(ho(d/l));y<d;)C[w++]=Ht(s,y,y+=l);return C}function F_(s){for(var l=-1,c=s==null?0:s.length,d=0,y=[];++l<c;){var w=s[l];w&&(y[d++]=w)}return y}function z_(){var s=arguments.length;if(!s)return[];for(var l=I(s-1),c=arguments[0],d=s;d--;)l[d-1]=arguments[d];return Zn(ne(c)?pt(c):[c],Ye(l,1))}var B_=oe(function(s,l){return Oe(s)?ls(s,Ye(l,1,Oe,!0)):[]}),$_=oe(function(s,l){var c=Wt(l);return Oe(c)&&(c=t),Oe(s)?ls(s,Ye(l,1,Oe,!0),X(c,2)):[]}),H_=oe(function(s,l){var c=Wt(l);return Oe(c)&&(c=t),Oe(s)?ls(s,Ye(l,1,Oe,!0),t,c):[]});function W_(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),Ht(s,l<0?0:l,d)):[]}function V_(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),l=d-l,Ht(s,0,l<0?0:l)):[]}function U_(s,l){return s&&s.length?xo(s,X(l,3),!0,!0):[]}function q_(s,l){return s&&s.length?xo(s,X(l,3),!0):[]}function K_(s,l,c,d){var y=s==null?0:s.length;return y?(c&&typeof c!="number"&&at(s,l,c)&&(c=0,d=y),z2(s,l,c,d)):[]}function rp(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=c==null?0:re(c);return y<0&&(y=De(d+y,0)),to(s,X(l,3),y)}function ip(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=d-1;return c!==t&&(y=re(c),y=c<0?De(d+y,0):nt(y,d-1)),to(s,X(l,3),y,!0)}function sp(s){var l=s==null?0:s.length;return l?Ye(s,1):[]}function G_(s){var l=s==null?0:s.length;return l?Ye(s,$e):[]}function J_(s,l){var c=s==null?0:s.length;return c?(l=l===t?1:re(l),Ye(s,l)):[]}function j_(s){for(var l=-1,c=s==null?0:s.length,d={};++l<c;){var y=s[l];d[y[0]]=y[1]}return d}function op(s){return s&&s.length?s[0]:t}function Y_(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=c==null?0:re(c);return y<0&&(y=De(d+y,0)),ii(s,l,y)}function X_(s){var l=s==null?0:s.length;return l?Ht(s,0,-1):[]}var Z_=oe(function(s){var l=Ee(s,fu);return l.length&&l[0]===s[0]?tu(l):[]}),Q_=oe(function(s){var l=Wt(s),c=Ee(s,fu);return l===Wt(c)?l=t:c.pop(),c.length&&c[0]===s[0]?tu(c,X(l,2)):[]}),ev=oe(function(s){var l=Wt(s),c=Ee(s,fu);return l=typeof l=="function"?l:t,l&&c.pop(),c.length&&c[0]===s[0]?tu(c,t,l):[]});function tv(s,l){return s==null?"":Xb.call(s,l)}function Wt(s){var l=s==null?0:s.length;return l?s[l-1]:t}function nv(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=d;return c!==t&&(y=re(c),y=y<0?De(d+y,0):nt(y,d-1)),l===l?Pb(s,l,y):to(s,$h,y,!0)}function rv(s,l){return s&&s.length?yd(s,re(l)):t}var iv=oe(ap);function ap(s,l){return s&&s.length&&l&&l.length?su(s,l):s}function sv(s,l,c){return s&&s.length&&l&&l.length?su(s,l,X(c,2)):s}function ov(s,l,c){return s&&s.length&&l&&l.length?su(s,l,t,c):s}var av=Tn(function(s,l){var c=s==null?0:s.length,d=Xl(s,l);return vd(s,Ee(l,function(y){return On(y,c)?+y:y}).sort(Od)),d});function lv(s,l){var c=[];if(!(s&&s.length))return c;var d=-1,y=[],w=s.length;for(l=X(l,3);++d<w;){var C=s[d];l(C,d,s)&&(c.push(C),y.push(d))}return vd(s,y),c}function Cu(s){return s==null?s:t2.call(s)}function uv(s,l,c){var d=s==null?0:s.length;return d?(c&&typeof c!="number"&&at(s,l,c)?(l=0,c=d):(l=l==null?0:re(l),c=c===t?d:re(c)),Ht(s,l,c)):[]}function cv(s,l){return So(s,l)}function fv(s,l,c){return lu(s,l,X(c,2))}function hv(s,l){var c=s==null?0:s.length;if(c){var d=So(s,l);if(d<c&&rn(s[d],l))return d}return-1}function dv(s,l){return So(s,l,!0)}function pv(s,l,c){return lu(s,l,X(c,2),!0)}function mv(s,l){var c=s==null?0:s.length;if(c){var d=So(s,l,!0)-1;if(rn(s[d],l))return d}return-1}function gv(s){return s&&s.length?Sd(s):[]}function yv(s,l){return s&&s.length?Sd(s,X(l,2)):[]}function bv(s){var l=s==null?0:s.length;return l?Ht(s,1,l):[]}function _v(s,l,c){return s&&s.length?(l=c||l===t?1:re(l),Ht(s,0,l<0?0:l)):[]}function vv(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),l=d-l,Ht(s,l<0?0:l,d)):[]}function wv(s,l){return s&&s.length?xo(s,X(l,3),!1,!0):[]}function Sv(s,l){return s&&s.length?xo(s,X(l,3)):[]}var xv=oe(function(s){return nr(Ye(s,1,Oe,!0))}),kv=oe(function(s){var l=Wt(s);return Oe(l)&&(l=t),nr(Ye(s,1,Oe,!0),X(l,2))}),Cv=oe(function(s){var l=Wt(s);return l=typeof l=="function"?l:t,nr(Ye(s,1,Oe,!0),t,l)});function Ev(s){return s&&s.length?nr(s):[]}function Av(s,l){return s&&s.length?nr(s,X(l,2)):[]}function Mv(s,l){return l=typeof l=="function"?l:t,s&&s.length?nr(s,t,l):[]}function Eu(s){if(!(s&&s.length))return[];var l=0;return s=Xn(s,function(c){if(Oe(c))return l=De(c.length,l),!0}),Vl(l,function(c){return Ee(s,$l(c))})}function lp(s,l){if(!(s&&s.length))return[];var c=Eu(s);return l==null?c:Ee(c,function(d){return xt(l,t,d)})}var Tv=oe(function(s,l){return Oe(s)?ls(s,l):[]}),Ov=oe(function(s){return cu(Xn(s,Oe))}),Iv=oe(function(s){var l=Wt(s);return Oe(l)&&(l=t),cu(Xn(s,Oe),X(l,2))}),Nv=oe(function(s){var l=Wt(s);return l=typeof l=="function"?l:t,cu(Xn(s,Oe),t,l)}),Rv=oe(Eu);function Lv(s,l){return Ed(s||[],l||[],as)}function Pv(s,l){return Ed(s||[],l||[],fs)}var Dv=oe(function(s){var l=s.length,c=l>1?s[l-1]:t;return c=typeof c=="function"?(s.pop(),c):t,lp(s,c)});function up(s){var l=v(s);return l.__chain__=!0,l}function Fv(s,l){return l(s),s}function No(s,l){return l(s)}var zv=Tn(function(s){var l=s.length,c=l?s[0]:0,d=this.__wrapped__,y=function(w){return Xl(w,s)};return l>1||this.__actions__.length||!(d instanceof ce)||!On(c)?this.thru(y):(d=d.slice(c,+c+(l?1:0)),d.__actions__.push({func:No,args:[y],thisArg:t}),new Bt(d,this.__chain__).thru(function(w){return l&&!w.length&&w.push(t),w}))});function Bv(){return up(this)}function $v(){return new Bt(this.value(),this.__chain__)}function Hv(){this.__values__===t&&(this.__values__=xp(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function Wv(){return this}function Vv(s){for(var l,c=this;c instanceof yo;){var d=np(c);d.__index__=0,d.__values__=t,l?y.__wrapped__=d:l=d;var y=d;c=c.__wrapped__}return y.__wrapped__=s,l}function Uv(){var s=this.__wrapped__;if(s instanceof ce){var l=s;return this.__actions__.length&&(l=new ce(this)),l=l.reverse(),l.__actions__.push({func:No,args:[Cu],thisArg:t}),new Bt(l,this.__chain__)}return this.thru(Cu)}function qv(){return Cd(this.__wrapped__,this.__actions__)}var Kv=ko(function(s,l,c){we.call(s,c)?++s[c]:An(s,c,1)});function Gv(s,l,c){var d=ne(s)?zh:F2;return c&&at(s,l,c)&&(l=t),d(s,X(l,3))}function Jv(s,l){var c=ne(s)?Xn:ld;return c(s,X(l,3))}var jv=Dd(rp),Yv=Dd(ip);function Xv(s,l){return Ye(Ro(s,l),1)}function Zv(s,l){return Ye(Ro(s,l),$e)}function Qv(s,l,c){return c=c===t?1:re(c),Ye(Ro(s,l),c)}function cp(s,l){var c=ne(s)?Ft:tr;return c(s,X(l,3))}function fp(s,l){var c=ne(s)?bb:ad;return c(s,X(l,3))}var ew=ko(function(s,l,c){we.call(s,c)?s[c].push(l):An(s,c,[l])});function tw(s,l,c,d){s=mt(s)?s:gi(s),c=c&&!d?re(c):0;var y=s.length;return c<0&&(c=De(y+c,0)),zo(s)?c<=y&&s.indexOf(l,c)>-1:!!y&&ii(s,l,c)>-1}var nw=oe(function(s,l,c){var d=-1,y=typeof l=="function",w=mt(s)?I(s.length):[];return tr(s,function(C){w[++d]=y?xt(l,C,c):us(C,l,c)}),w}),rw=ko(function(s,l,c){An(s,c,l)});function Ro(s,l){var c=ne(s)?Ee:pd;return c(s,X(l,3))}function iw(s,l,c,d){return s==null?[]:(ne(l)||(l=l==null?[]:[l]),c=d?t:c,ne(c)||(c=c==null?[]:[c]),bd(s,l,c))}var sw=ko(function(s,l,c){s[c?0:1].push(l)},function(){return[[],[]]});function ow(s,l,c){var d=ne(s)?zl:Wh,y=arguments.length<3;return d(s,X(l,4),c,y,tr)}function aw(s,l,c){var d=ne(s)?_b:Wh,y=arguments.length<3;return d(s,X(l,4),c,y,ad)}function lw(s,l){var c=ne(s)?Xn:ld;return c(s,Do(X(l,3)))}function uw(s){var l=ne(s)?rd:t_;return l(s)}function cw(s,l,c){(c?at(s,l,c):l===t)?l=1:l=re(l);var d=ne(s)?N2:n_;return d(s,l)}function fw(s){var l=ne(s)?R2:i_;return l(s)}function hw(s){if(s==null)return 0;if(mt(s))return zo(s)?oi(s):s.length;var l=rt(s);return l==Qt||l==en?s.size:ru(s).length}function dw(s,l,c){var d=ne(s)?Bl:s_;return c&&at(s,l,c)&&(l=t),d(s,X(l,3))}var pw=oe(function(s,l){if(s==null)return[];var c=l.length;return c>1&&at(s,l[0],l[1])?l=[]:c>2&&at(l[0],l[1],l[2])&&(l=[l[0]]),bd(s,Ye(l,1),[])}),Lo=Jb||function(){return je.Date.now()};function mw(s,l){if(typeof l!="function")throw new zt(a);return s=re(s),function(){if(--s<1)return l.apply(this,arguments)}}function hp(s,l,c){return l=c?t:l,l=s&&l==null?s.length:l,Mn(s,U,t,t,t,t,l)}function dp(s,l){var c;if(typeof l!="function")throw new zt(a);return s=re(s),function(){return--s>0&&(c=l.apply(this,arguments)),s<=1&&(l=t),c}}var Au=oe(function(s,l,c){var d=_;if(c.length){var y=Qn(c,pi(Au));d|=W}return Mn(s,d,l,c,y)}),pp=oe(function(s,l,c){var d=_|x;if(c.length){var y=Qn(c,pi(pp));d|=W}return Mn(l,d,s,c,y)});function mp(s,l,c){l=c?t:l;var d=Mn(s,A,t,t,t,t,t,l);return d.placeholder=mp.placeholder,d}function gp(s,l,c){l=c?t:l;var d=Mn(s,N,t,t,t,t,t,l);return d.placeholder=gp.placeholder,d}function yp(s,l,c){var d,y,w,C,M,O,P=0,D=!1,F=!1,V=!0;if(typeof s!="function")throw new zt(a);l=Vt(l)||0,Ae(c)&&(D=!!c.leading,F="maxWait"in c,w=F?De(Vt(c.maxWait)||0,l):w,V="trailing"in c?!!c.trailing:V);function J(Ie){var sn=d,Rn=y;return d=y=t,P=Ie,C=s.apply(Rn,sn),C}function Z(Ie){return P=Ie,M=ps(le,l),D?J(Ie):C}function se(Ie){var sn=Ie-O,Rn=Ie-P,Dp=l-sn;return F?nt(Dp,w-Rn):Dp}function Q(Ie){var sn=Ie-O,Rn=Ie-P;return O===t||sn>=l||sn<0||F&&Rn>=w}function le(){var Ie=Lo();if(Q(Ie))return he(Ie);M=ps(le,se(Ie))}function he(Ie){return M=t,V&&d?J(Ie):(d=y=t,C)}function At(){M!==t&&Ad(M),P=0,d=O=y=M=t}function lt(){return M===t?C:he(Lo())}function Mt(){var Ie=Lo(),sn=Q(Ie);if(d=arguments,y=this,O=Ie,sn){if(M===t)return Z(O);if(F)return Ad(M),M=ps(le,l),J(O)}return M===t&&(M=ps(le,l)),C}return Mt.cancel=At,Mt.flush=lt,Mt}var gw=oe(function(s,l){return od(s,1,l)}),yw=oe(function(s,l,c){return od(s,Vt(l)||0,c)});function bw(s){return Mn(s,me)}function Po(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new zt(a);var c=function(){var d=arguments,y=l?l.apply(this,d):d[0],w=c.cache;if(w.has(y))return w.get(y);var C=s.apply(this,d);return c.cache=w.set(y,C)||w,C};return c.cache=new(Po.Cache||En),c}Po.Cache=En;function Do(s){if(typeof s!="function")throw new zt(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function _w(s){return dp(2,s)}var vw=o_(function(s,l){l=l.length==1&&ne(l[0])?Ee(l[0],kt(X())):Ee(Ye(l,1),kt(X()));var c=l.length;return oe(function(d){for(var y=-1,w=nt(d.length,c);++y<w;)d[y]=l[y].call(this,d[y]);return xt(s,this,d)})}),Mu=oe(function(s,l){var c=Qn(l,pi(Mu));return Mn(s,W,t,l,c)}),bp=oe(function(s,l){var c=Qn(l,pi(bp));return Mn(s,L,t,l,c)}),ww=Tn(function(s,l){return Mn(s,j,t,t,t,l)});function Sw(s,l){if(typeof s!="function")throw new zt(a);return l=l===t?l:re(l),oe(s,l)}function xw(s,l){if(typeof s!="function")throw new zt(a);return l=l==null?0:De(re(l),0),oe(function(c){var d=c[l],y=ir(c,0,l);return d&&Zn(y,d),xt(s,this,y)})}function kw(s,l,c){var d=!0,y=!0;if(typeof s!="function")throw new zt(a);return Ae(c)&&(d="leading"in c?!!c.leading:d,y="trailing"in c?!!c.trailing:y),yp(s,l,{leading:d,maxWait:l,trailing:y})}function Cw(s){return hp(s,1)}function Ew(s,l){return Mu(hu(l),s)}function Aw(){if(!arguments.length)return[];var s=arguments[0];return ne(s)?s:[s]}function Mw(s){return $t(s,S)}function Tw(s,l){return l=typeof l=="function"?l:t,$t(s,S,l)}function Ow(s){return $t(s,p|S)}function Iw(s,l){return l=typeof l=="function"?l:t,$t(s,p|S,l)}function Nw(s,l){return l==null||sd(s,l,Ve(l))}function rn(s,l){return s===l||s!==s&&l!==l}var Rw=Mo(eu),Lw=Mo(function(s,l){return s>=l}),Lr=fd(function(){return arguments}())?fd:function(s){return Te(s)&&we.call(s,"callee")&&!Xh.call(s,"callee")},ne=I.isArray,Pw=Nh?kt(Nh):V2;function mt(s){return s!=null&&Fo(s.length)&&!In(s)}function Oe(s){return Te(s)&&mt(s)}function Dw(s){return s===!0||s===!1||Te(s)&&ot(s)==Gi}var sr=Yb||Bu,Fw=Rh?kt(Rh):U2;function zw(s){return Te(s)&&s.nodeType===1&&!ms(s)}function Bw(s){if(s==null)return!0;if(mt(s)&&(ne(s)||typeof s=="string"||typeof s.splice=="function"||sr(s)||mi(s)||Lr(s)))return!s.length;var l=rt(s);if(l==Qt||l==en)return!s.size;if(ds(s))return!ru(s).length;for(var c in s)if(we.call(s,c))return!1;return!0}function $w(s,l){return cs(s,l)}function Hw(s,l,c){c=typeof c=="function"?c:t;var d=c?c(s,l):t;return d===t?cs(s,l,t,c):!!d}function Tu(s){if(!Te(s))return!1;var l=ot(s);return l==Js||l==cy||typeof s.message=="string"&&typeof s.name=="string"&&!ms(s)}function Ww(s){return typeof s=="number"&&Qh(s)}function In(s){if(!Ae(s))return!1;var l=ot(s);return l==js||l==oh||l==uy||l==hy}function _p(s){return typeof s=="number"&&s==re(s)}function Fo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=He}function Ae(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Te(s){return s!=null&&typeof s=="object"}var vp=Lh?kt(Lh):K2;function Vw(s,l){return s===l||nu(s,l,_u(l))}function Uw(s,l,c){return c=typeof c=="function"?c:t,nu(s,l,_u(l),c)}function qw(s){return wp(s)&&s!=+s}function Kw(s){if(T_(s))throw new te(o);return hd(s)}function Gw(s){return s===null}function Jw(s){return s==null}function wp(s){return typeof s=="number"||Te(s)&&ot(s)==ji}function ms(s){if(!Te(s)||ot(s)!=kn)return!1;var l=uo(s);if(l===null)return!0;var c=we.call(l,"constructor")&&l.constructor;return typeof c=="function"&&c instanceof c&&so.call(c)==Ub}var Ou=Ph?kt(Ph):G2;function jw(s){return _p(s)&&s>=-He&&s<=He}var Sp=Dh?kt(Dh):J2;function zo(s){return typeof s=="string"||!ne(s)&&Te(s)&&ot(s)==Xi}function Et(s){return typeof s=="symbol"||Te(s)&&ot(s)==Ys}var mi=Fh?kt(Fh):j2;function Yw(s){return s===t}function Xw(s){return Te(s)&&rt(s)==Zi}function Zw(s){return Te(s)&&ot(s)==py}var Qw=Mo(iu),eS=Mo(function(s,l){return s<=l});function xp(s){if(!s)return[];if(mt(s))return zo(s)?tn(s):pt(s);if(ts&&s[ts])return Nb(s[ts]());var l=rt(s),c=l==Qt?ql:l==en?no:gi;return c(s)}function Nn(s){if(!s)return s===0?s:0;if(s=Vt(s),s===$e||s===-$e){var l=s<0?-1:1;return l*Pt}return s===s?s:0}function re(s){var l=Nn(s),c=l%1;return l===l?c?l-c:l:0}function kp(s){return s?Or(re(s),0,We):0}function Vt(s){if(typeof s=="number")return s;if(Et(s))return tt;if(Ae(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Ae(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=Vh(s);var c=Py.test(s);return c||Fy.test(s)?mb(s.slice(2),c?2:8):Ly.test(s)?tt:+s}function Cp(s){return dn(s,gt(s))}function tS(s){return s?Or(re(s),-He,He):s===0?s:0}function _e(s){return s==null?"":Ct(s)}var nS=hi(function(s,l){if(ds(l)||mt(l)){dn(l,Ve(l),s);return}for(var c in l)we.call(l,c)&&as(s,c,l[c])}),Ep=hi(function(s,l){dn(l,gt(l),s)}),Bo=hi(function(s,l,c,d){dn(l,gt(l),s,d)}),rS=hi(function(s,l,c,d){dn(l,Ve(l),s,d)}),iS=Tn(Xl);function sS(s,l){var c=fi(s);return l==null?c:id(c,l)}var oS=oe(function(s,l){s=Se(s);var c=-1,d=l.length,y=d>2?l[2]:t;for(y&&at(l[0],l[1],y)&&(d=1);++c<d;)for(var w=l[c],C=gt(w),M=-1,O=C.length;++M<O;){var P=C[M],D=s[P];(D===t||rn(D,li[P])&&!we.call(s,P))&&(s[P]=w[P])}return s}),aS=oe(function(s){return s.push(t,Vd),xt(Ap,t,s)});function lS(s,l){return Bh(s,X(l,3),hn)}function uS(s,l){return Bh(s,X(l,3),Ql)}function cS(s,l){return s==null?s:Zl(s,X(l,3),gt)}function fS(s,l){return s==null?s:ud(s,X(l,3),gt)}function hS(s,l){return s&&hn(s,X(l,3))}function dS(s,l){return s&&Ql(s,X(l,3))}function pS(s){return s==null?[]:vo(s,Ve(s))}function mS(s){return s==null?[]:vo(s,gt(s))}function Iu(s,l,c){var d=s==null?t:Ir(s,l);return d===t?c:d}function gS(s,l){return s!=null&&Kd(s,l,B2)}function Nu(s,l){return s!=null&&Kd(s,l,$2)}var yS=zd(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),s[l]=c},Lu(yt)),bS=zd(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=oo.call(l)),we.call(s,l)?s[l].push(c):s[l]=[c]},X),_S=oe(us);function Ve(s){return mt(s)?nd(s):ru(s)}function gt(s){return mt(s)?nd(s,!0):Y2(s)}function vS(s,l){var c={};return l=X(l,3),hn(s,function(d,y,w){An(c,l(d,y,w),d)}),c}function wS(s,l){var c={};return l=X(l,3),hn(s,function(d,y,w){An(c,y,l(d,y,w))}),c}var SS=hi(function(s,l,c){wo(s,l,c)}),Ap=hi(function(s,l,c,d){wo(s,l,c,d)}),xS=Tn(function(s,l){var c={};if(s==null)return c;var d=!1;l=Ee(l,function(w){return w=rr(w,s),d||(d=w.length>1),w}),dn(s,yu(s),c),d&&(c=$t(c,p|b|S,y_));for(var y=l.length;y--;)uu(c,l[y]);return c});function kS(s,l){return Mp(s,Do(X(l)))}var CS=Tn(function(s,l){return s==null?{}:Z2(s,l)});function Mp(s,l){if(s==null)return{};var c=Ee(yu(s),function(d){return[d]});return l=X(l),_d(s,c,function(d,y){return l(d,y[0])})}function ES(s,l,c){l=rr(l,s);var d=-1,y=l.length;for(y||(y=1,s=t);++d<y;){var w=s==null?t:s[pn(l[d])];w===t&&(d=y,w=c),s=In(w)?w.call(s):w}return s}function AS(s,l,c){return s==null?s:fs(s,l,c)}function MS(s,l,c,d){return d=typeof d=="function"?d:t,s==null?s:fs(s,l,c,d)}var Tp=Hd(Ve),Op=Hd(gt);function TS(s,l,c){var d=ne(s),y=d||sr(s)||mi(s);if(l=X(l,4),c==null){var w=s&&s.constructor;y?c=d?new w:[]:Ae(s)?c=In(w)?fi(uo(s)):{}:c={}}return(y?Ft:hn)(s,function(C,M,O){return l(c,C,M,O)}),c}function OS(s,l){return s==null?!0:uu(s,l)}function IS(s,l,c){return s==null?s:kd(s,l,hu(c))}function NS(s,l,c,d){return d=typeof d=="function"?d:t,s==null?s:kd(s,l,hu(c),d)}function gi(s){return s==null?[]:Ul(s,Ve(s))}function RS(s){return s==null?[]:Ul(s,gt(s))}function LS(s,l,c){return c===t&&(c=l,l=t),c!==t&&(c=Vt(c),c=c===c?c:0),l!==t&&(l=Vt(l),l=l===l?l:0),Or(Vt(s),l,c)}function PS(s,l,c){return l=Nn(l),c===t?(c=l,l=0):c=Nn(c),s=Vt(s),H2(s,l,c)}function DS(s,l,c){if(c&&typeof c!="boolean"&&at(s,l,c)&&(l=c=t),c===t&&(typeof l=="boolean"?(c=l,l=t):typeof s=="boolean"&&(c=s,s=t)),s===t&&l===t?(s=0,l=1):(s=Nn(s),l===t?(l=s,s=0):l=Nn(l)),s>l){var d=s;s=l,l=d}if(c||s%1||l%1){var y=ed();return nt(s+y*(l-s+pb("1e-"+((y+"").length-1))),l)}return ou(s,l)}var FS=di(function(s,l,c){return l=l.toLowerCase(),s+(c?Ip(l):l)});function Ip(s){return Ru(_e(s).toLowerCase())}function Np(s){return s=_e(s),s&&s.replace(By,Ab).replace(ib,"")}function zS(s,l,c){s=_e(s),l=Ct(l);var d=s.length;c=c===t?d:Or(re(c),0,d);var y=c;return c-=l.length,c>=0&&s.slice(c,y)==l}function BS(s){return s=_e(s),s&&_y.test(s)?s.replace(uh,Mb):s}function $S(s){return s=_e(s),s&&Cy.test(s)?s.replace(Ml,"\\$&"):s}var HS=di(function(s,l,c){return s+(c?"-":"")+l.toLowerCase()}),WS=di(function(s,l,c){return s+(c?" ":"")+l.toLowerCase()}),VS=Pd("toLowerCase");function US(s,l,c){s=_e(s),l=re(l);var d=l?oi(s):0;if(!l||d>=l)return s;var y=(l-d)/2;return Ao(po(y),c)+s+Ao(ho(y),c)}function qS(s,l,c){s=_e(s),l=re(l);var d=l?oi(s):0;return l&&d<l?s+Ao(l-d,c):s}function KS(s,l,c){s=_e(s),l=re(l);var d=l?oi(s):0;return l&&d<l?Ao(l-d,c)+s:s}function GS(s,l,c){return c||l==null?l=0:l&&(l=+l),e2(_e(s).replace(Tl,""),l||0)}function JS(s,l,c){return(c?at(s,l,c):l===t)?l=1:l=re(l),au(_e(s),l)}function jS(){var s=arguments,l=_e(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var YS=di(function(s,l,c){return s+(c?"_":"")+l.toLowerCase()});function XS(s,l,c){return c&&typeof c!="number"&&at(s,l,c)&&(l=c=t),c=c===t?We:c>>>0,c?(s=_e(s),s&&(typeof l=="string"||l!=null&&!Ou(l))&&(l=Ct(l),!l&&si(s))?ir(tn(s),0,c):s.split(l,c)):[]}var ZS=di(function(s,l,c){return s+(c?" ":"")+Ru(l)});function QS(s,l,c){return s=_e(s),c=c==null?0:Or(re(c),0,s.length),l=Ct(l),s.slice(c,c+l.length)==l}function ex(s,l,c){var d=v.templateSettings;c&&at(s,l,c)&&(l=t),s=_e(s),l=Bo({},l,d,Wd);var y=Bo({},l.imports,d.imports,Wd),w=Ve(y),C=Ul(y,w),M,O,P=0,D=l.interpolate||Xs,F="__p += '",V=Kl((l.escape||Xs).source+"|"+D.source+"|"+(D===ch?Ry:Xs).source+"|"+(l.evaluate||Xs).source+"|$","g"),J="//# sourceURL="+(we.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ub+"]")+`
43
- `;s.replace(V,function(Q,le,he,At,lt,Mt){return he||(he=At),F+=s.slice(P,Mt).replace($y,Tb),le&&(M=!0,F+=`' +
42
+ `)}function R_(s){return ne(s)||Dr(s)||!!(od&&s&&s[od])}function Dn(s,l){var c=typeof s;return l=l??Ue,!!l&&(c=="number"||c!="symbol"&&qy.test(s))&&s>-1&&s%1==0&&s<l}function ft(s,l,c){if(!Me(c))return!1;var d=typeof l;return(d=="number"?_t(c)&&Dn(l,c.length):d=="string"&&l in c)?an(c[l],s):!1}function Mu(s,l){if(ne(s))return!1;var c=typeof s;return c=="number"||c=="symbol"||c=="boolean"||s==null||Mt(s)?!0:Oy.test(s)||!Ty.test(s)||l!=null&&s in Se(l)}function L_(s){var l=typeof s;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?s!=="__proto__":s===null}function Tu(s){var l=Lo(s),c=v[l];if(typeof c!="function"||!(l in ce.prototype))return!1;if(s===c)return!0;var d=Cu(c);return!!d&&s===d[0]}function P_(s){return!!nd&&nd in s}var D_=uo?Fn:Ku;function ys(s){var l=s&&s.constructor,c=typeof l=="function"&&l.prototype||fi;return s===c}function np(s){return s===s&&!Me(s)}function rp(s,l){return function(c){return c==null?!1:c[s]===l&&(l!==t||s in Se(c))}}function F_(s){var l=$o(s,function(d){return c.size===h&&c.clear(),d}),c=l.cache;return l}function z_(s,l){var c=s[1],d=l[1],y=c|d,w=y<(_|x|U),C=d==U&&c==A||d==U&&c==j&&s[7].length<=l[8]||d==(U|j)&&l[7].length<=l[8]&&c==A;if(!(w||C))return s;d&_&&(s[2]=l[2],y|=c&_?0:k);var M=l[3];if(M){var O=s[3];s[3]=O?Bd(O,M,l[4]):M,s[4]=O?rr(s[3],m):l[4]}return M=l[5],M&&(O=s[5],s[5]=O?$d(O,M,l[6]):M,s[6]=O?rr(s[5],m):l[6]),M=l[7],M&&(s[7]=M),d&U&&(s[8]=s[8]==null?l[8]:ot(s[8],l[8])),s[9]==null&&(s[9]=l[9]),s[0]=l[0],s[1]=y,s}function B_(s){var l=[];if(s!=null)for(var c in Se(s))l.push(c);return l}function $_(s){return fo.call(s)}function ip(s,l,c){return l=Be(l===t?s.length-1:l,0),function(){for(var d=arguments,y=-1,w=Be(d.length-l,0),C=I(w);++y<w;)C[y]=d[l+y];y=-1;for(var M=I(l+1);++y<l;)M[y]=d[y];return M[l]=c(C),Ct(s,this,M)}}function sp(s,l){return l.length<2?s:Rr(s,Ut(l,0,-1))}function H_(s,l){for(var c=s.length,d=ot(l.length,c),y=bt(s);d--;){var w=l[d];s[d]=Dn(w,c)?y[w]:t}return s}function Ou(s,l){if(!(l==="constructor"&&typeof s[l]=="function")&&l!="__proto__")return s[l]}var op=lp(Td),bs=n2||function(s,l){return Qe.setTimeout(s,l)},Iu=lp(c_);function ap(s,l,c){var d=l+"";return Iu(s,N_(d,V_(T_(d),c)))}function lp(s){var l=0,c=0;return function(){var d=o2(),y=Zn-(d-c);if(c=d,y>0){if(++l>=Ft)return arguments[0]}else l=0;return s.apply(t,arguments)}}function Do(s,l){var c=-1,d=s.length,y=d-1;for(l=l===t?d:l;++c<l;){var w=du(c,y),C=s[w];s[w]=s[c],s[c]=C}return s.length=l,s}var up=F_(function(s){var l=[];return s.charCodeAt(0)===46&&l.push(""),s.replace(Iy,function(c,d,y,w){l.push(y?w.replace(By,"$1"):d||c)}),l});function _n(s){if(typeof s=="string"||Mt(s))return s;var l=s+"";return l=="0"&&1/s==-We?"-0":l}function Pr(s){if(s!=null){try{return co.call(s)}catch{}try{return s+""}catch{}}return""}function V_(s,l){return $t(Cl,function(c){var d="_."+c[0];l&c[1]&&!so(s,d)&&s.push(d)}),s.sort()}function cp(s){if(s instanceof ce)return s.clone();var l=new Vt(s.__wrapped__,s.__chain__);return l.__actions__=bt(s.__actions__),l.__index__=s.__index__,l.__values__=s.__values__,l}function W_(s,l,c){(c?ft(s,l,c):l===t)?l=1:l=Be(re(l),0);var d=s==null?0:s.length;if(!d||l<1)return[];for(var y=0,w=0,C=I(bo(d/l));y<d;)C[w++]=Ut(s,y,y+=l);return C}function U_(s){for(var l=-1,c=s==null?0:s.length,d=0,y=[];++l<c;){var w=s[l];w&&(y[d++]=w)}return y}function q_(){var s=arguments.length;if(!s)return[];for(var l=I(s-1),c=arguments[0],d=s;d--;)l[d-1]=arguments[d];return nr(ne(c)?bt(c):[c],et(l,1))}var K_=oe(function(s,l){return Ne(s)?hs(s,et(l,1,Ne,!0)):[]}),G_=oe(function(s,l){var c=qt(l);return Ne(c)&&(c=t),Ne(s)?hs(s,et(l,1,Ne,!0),X(c,2)):[]}),J_=oe(function(s,l){var c=qt(l);return Ne(c)&&(c=t),Ne(s)?hs(s,et(l,1,Ne,!0),t,c):[]});function j_(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),Ut(s,l<0?0:l,d)):[]}function Y_(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),l=d-l,Ut(s,0,l<0?0:l)):[]}function X_(s,l){return s&&s.length?Mo(s,X(l,3),!0,!0):[]}function Z_(s,l){return s&&s.length?Mo(s,X(l,3),!0):[]}function Q_(s,l,c,d){var y=s==null?0:s.length;return y?(c&&typeof c!="number"&&ft(s,l,c)&&(c=0,d=y),q2(s,l,c,d)):[]}function fp(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=c==null?0:re(c);return y<0&&(y=Be(d+y,0)),oo(s,X(l,3),y)}function hp(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=d-1;return c!==t&&(y=re(c),y=c<0?Be(d+y,0):ot(y,d-1)),oo(s,X(l,3),y,!0)}function dp(s){var l=s==null?0:s.length;return l?et(s,1):[]}function ev(s){var l=s==null?0:s.length;return l?et(s,We):[]}function tv(s,l){var c=s==null?0:s.length;return c?(l=l===t?1:re(l),et(s,l)):[]}function nv(s){for(var l=-1,c=s==null?0:s.length,d={};++l<c;){var y=s[l];d[y[0]]=y[1]}return d}function pp(s){return s&&s.length?s[0]:t}function rv(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=c==null?0:re(c);return y<0&&(y=Be(d+y,0)),ai(s,l,y)}function iv(s){var l=s==null?0:s.length;return l?Ut(s,0,-1):[]}var sv=oe(function(s){var l=ke(s,bu);return l.length&&l[0]===s[0]?lu(l):[]}),ov=oe(function(s){var l=qt(s),c=ke(s,bu);return l===qt(c)?l=t:c.pop(),c.length&&c[0]===s[0]?lu(c,X(l,2)):[]}),av=oe(function(s){var l=qt(s),c=ke(s,bu);return l=typeof l=="function"?l:t,l&&c.pop(),c.length&&c[0]===s[0]?lu(c,t,l):[]});function lv(s,l){return s==null?"":i2.call(s,l)}function qt(s){var l=s==null?0:s.length;return l?s[l-1]:t}function uv(s,l,c){var d=s==null?0:s.length;if(!d)return-1;var y=d;return c!==t&&(y=re(c),y=y<0?Be(d+y,0):ot(y,d-1)),l===l?Vb(s,l,y):oo(s,Jh,y,!0)}function cv(s,l){return s&&s.length?Cd(s,re(l)):t}var fv=oe(mp);function mp(s,l){return s&&s.length&&l&&l.length?hu(s,l):s}function hv(s,l,c){return s&&s.length&&l&&l.length?hu(s,l,X(c,2)):s}function dv(s,l,c){return s&&s.length&&l&&l.length?hu(s,l,t,c):s}var pv=Pn(function(s,l){var c=s==null?0:s.length,d=iu(s,l);return Md(s,ke(l,function(y){return Dn(y,c)?+y:y}).sort(zd)),d});function mv(s,l){var c=[];if(!(s&&s.length))return c;var d=-1,y=[],w=s.length;for(l=X(l,3);++d<w;){var C=s[d];l(C,d,s)&&(c.push(C),y.push(d))}return Md(s,y),c}function Nu(s){return s==null?s:l2.call(s)}function gv(s,l,c){var d=s==null?0:s.length;return d?(c&&typeof c!="number"&&ft(s,l,c)?(l=0,c=d):(l=l==null?0:re(l),c=c===t?d:re(c)),Ut(s,l,c)):[]}function yv(s,l){return Ao(s,l)}function bv(s,l,c){return mu(s,l,X(c,2))}function _v(s,l){var c=s==null?0:s.length;if(c){var d=Ao(s,l);if(d<c&&an(s[d],l))return d}return-1}function vv(s,l){return Ao(s,l,!0)}function wv(s,l,c){return mu(s,l,X(c,2),!0)}function Sv(s,l){var c=s==null?0:s.length;if(c){var d=Ao(s,l,!0)-1;if(an(s[d],l))return d}return-1}function xv(s){return s&&s.length?Od(s):[]}function Ev(s,l){return s&&s.length?Od(s,X(l,2)):[]}function Cv(s){var l=s==null?0:s.length;return l?Ut(s,1,l):[]}function kv(s,l,c){return s&&s.length?(l=c||l===t?1:re(l),Ut(s,0,l<0?0:l)):[]}function Av(s,l,c){var d=s==null?0:s.length;return d?(l=c||l===t?1:re(l),l=d-l,Ut(s,l<0?0:l,d)):[]}function Mv(s,l){return s&&s.length?Mo(s,X(l,3),!1,!0):[]}function Tv(s,l){return s&&s.length?Mo(s,X(l,3)):[]}var Ov=oe(function(s){return or(et(s,1,Ne,!0))}),Iv=oe(function(s){var l=qt(s);return Ne(l)&&(l=t),or(et(s,1,Ne,!0),X(l,2))}),Nv=oe(function(s){var l=qt(s);return l=typeof l=="function"?l:t,or(et(s,1,Ne,!0),t,l)});function Rv(s){return s&&s.length?or(s):[]}function Lv(s,l){return s&&s.length?or(s,X(l,2)):[]}function Pv(s,l){return l=typeof l=="function"?l:t,s&&s.length?or(s,t,l):[]}function Ru(s){if(!(s&&s.length))return[];var l=0;return s=tr(s,function(c){if(Ne(c))return l=Be(c.length,l),!0}),Yl(l,function(c){return ke(s,Gl(c))})}function gp(s,l){if(!(s&&s.length))return[];var c=Ru(s);return l==null?c:ke(c,function(d){return Ct(l,t,d)})}var Dv=oe(function(s,l){return Ne(s)?hs(s,l):[]}),Fv=oe(function(s){return yu(tr(s,Ne))}),zv=oe(function(s){var l=qt(s);return Ne(l)&&(l=t),yu(tr(s,Ne),X(l,2))}),Bv=oe(function(s){var l=qt(s);return l=typeof l=="function"?l:t,yu(tr(s,Ne),t,l)}),$v=oe(Ru);function Hv(s,l){return Ld(s||[],l||[],fs)}function Vv(s,l){return Ld(s||[],l||[],ms)}var Wv=oe(function(s){var l=s.length,c=l>1?s[l-1]:t;return c=typeof c=="function"?(s.pop(),c):t,gp(s,c)});function yp(s){var l=v(s);return l.__chain__=!0,l}function Uv(s,l){return l(s),s}function Fo(s,l){return l(s)}var qv=Pn(function(s){var l=s.length,c=l?s[0]:0,d=this.__wrapped__,y=function(w){return iu(w,s)};return l>1||this.__actions__.length||!(d instanceof ce)||!Dn(c)?this.thru(y):(d=d.slice(c,+c+(l?1:0)),d.__actions__.push({func:Fo,args:[y],thisArg:t}),new Vt(d,this.__chain__).thru(function(w){return l&&!w.length&&w.push(t),w}))});function Kv(){return yp(this)}function Gv(){return new Vt(this.value(),this.__chain__)}function Jv(){this.__values__===t&&(this.__values__=Ip(this.value()));var s=this.__index__>=this.__values__.length,l=s?t:this.__values__[this.__index__++];return{done:s,value:l}}function jv(){return this}function Yv(s){for(var l,c=this;c instanceof So;){var d=cp(c);d.__index__=0,d.__values__=t,l?y.__wrapped__=d:l=d;var y=d;c=c.__wrapped__}return y.__wrapped__=s,l}function Xv(){var s=this.__wrapped__;if(s instanceof ce){var l=s;return this.__actions__.length&&(l=new ce(this)),l=l.reverse(),l.__actions__.push({func:Fo,args:[Nu],thisArg:t}),new Vt(l,this.__chain__)}return this.thru(Nu)}function Zv(){return Rd(this.__wrapped__,this.__actions__)}var Qv=To(function(s,l,c){we.call(s,c)?++s[c]:Rn(s,c,1)});function ew(s,l,c){var d=ne(s)?Kh:U2;return c&&ft(s,l,c)&&(l=t),d(s,X(l,3))}function tw(s,l){var c=ne(s)?tr:gd;return c(s,X(l,3))}var nw=Ud(fp),rw=Ud(hp);function iw(s,l){return et(zo(s,l),1)}function sw(s,l){return et(zo(s,l),We)}function ow(s,l,c){return c=c===t?1:re(c),et(zo(s,l),c)}function bp(s,l){var c=ne(s)?$t:sr;return c(s,X(l,3))}function _p(s,l){var c=ne(s)?Cb:md;return c(s,X(l,3))}var aw=To(function(s,l,c){we.call(s,c)?s[c].push(l):Rn(s,c,[l])});function lw(s,l,c,d){s=_t(s)?s:_i(s),c=c&&!d?re(c):0;var y=s.length;return c<0&&(c=Be(y+c,0)),Wo(s)?c<=y&&s.indexOf(l,c)>-1:!!y&&ai(s,l,c)>-1}var uw=oe(function(s,l,c){var d=-1,y=typeof l=="function",w=_t(s)?I(s.length):[];return sr(s,function(C){w[++d]=y?Ct(l,C,c):ds(C,l,c)}),w}),cw=To(function(s,l,c){Rn(s,c,l)});function zo(s,l){var c=ne(s)?ke:Sd;return c(s,X(l,3))}function fw(s,l,c,d){return s==null?[]:(ne(l)||(l=l==null?[]:[l]),c=d?t:c,ne(c)||(c=c==null?[]:[c]),kd(s,l,c))}var hw=To(function(s,l,c){s[c?0:1].push(l)},function(){return[[],[]]});function dw(s,l,c){var d=ne(s)?ql:Yh,y=arguments.length<3;return d(s,X(l,4),c,y,sr)}function pw(s,l,c){var d=ne(s)?kb:Yh,y=arguments.length<3;return d(s,X(l,4),c,y,md)}function mw(s,l){var c=ne(s)?tr:gd;return c(s,Ho(X(l,3)))}function gw(s){var l=ne(s)?fd:l_;return l(s)}function yw(s,l,c){(c?ft(s,l,c):l===t)?l=1:l=re(l);var d=ne(s)?B2:u_;return d(s,l)}function bw(s){var l=ne(s)?$2:f_;return l(s)}function _w(s){if(s==null)return 0;if(_t(s))return Wo(s)?ui(s):s.length;var l=at(s);return l==nn||l==rn?s.size:cu(s).length}function vw(s,l,c){var d=ne(s)?Kl:h_;return c&&ft(s,l,c)&&(l=t),d(s,X(l,3))}var ww=oe(function(s,l){if(s==null)return[];var c=l.length;return c>1&&ft(s,l[0],l[1])?l=[]:c>2&&ft(l[0],l[1],l[2])&&(l=[l[0]]),kd(s,et(l,1),[])}),Bo=t2||function(){return Qe.Date.now()};function Sw(s,l){if(typeof l!="function")throw new Ht(a);return s=re(s),function(){if(--s<1)return l.apply(this,arguments)}}function vp(s,l,c){return l=c?t:l,l=s&&l==null?s.length:l,Ln(s,U,t,t,t,t,l)}function wp(s,l){var c;if(typeof l!="function")throw new Ht(a);return s=re(s),function(){return--s>0&&(c=l.apply(this,arguments)),s<=1&&(l=t),c}}var Lu=oe(function(s,l,c){var d=_;if(c.length){var y=rr(c,yi(Lu));d|=V}return Ln(s,d,l,c,y)}),Sp=oe(function(s,l,c){var d=_|x;if(c.length){var y=rr(c,yi(Sp));d|=V}return Ln(l,d,s,c,y)});function xp(s,l,c){l=c?t:l;var d=Ln(s,A,t,t,t,t,t,l);return d.placeholder=xp.placeholder,d}function Ep(s,l,c){l=c?t:l;var d=Ln(s,N,t,t,t,t,t,l);return d.placeholder=Ep.placeholder,d}function Cp(s,l,c){var d,y,w,C,M,O,P=0,D=!1,F=!1,W=!0;if(typeof s!="function")throw new Ht(a);l=Kt(l)||0,Me(c)&&(D=!!c.leading,F="maxWait"in c,w=F?Be(Kt(c.maxWait)||0,l):w,W="trailing"in c?!!c.trailing:W);function J(Re){var ln=d,Bn=y;return d=y=t,P=Re,C=s.apply(Bn,ln),C}function Z(Re){return P=Re,M=bs(le,l),D?J(Re):C}function se(Re){var ln=Re-O,Bn=Re-P,Up=l-ln;return F?ot(Up,w-Bn):Up}function Q(Re){var ln=Re-O,Bn=Re-P;return O===t||ln>=l||ln<0||F&&Bn>=w}function le(){var Re=Bo();if(Q(Re))return he(Re);M=bs(le,se(Re))}function he(Re){return M=t,W&&d?J(Re):(d=y=t,C)}function Tt(){M!==t&&Pd(M),P=0,d=O=y=M=t}function ht(){return M===t?C:he(Bo())}function Ot(){var Re=Bo(),ln=Q(Re);if(d=arguments,y=this,O=Re,ln){if(M===t)return Z(O);if(F)return Pd(M),M=bs(le,l),J(O)}return M===t&&(M=bs(le,l)),C}return Ot.cancel=Tt,Ot.flush=ht,Ot}var xw=oe(function(s,l){return pd(s,1,l)}),Ew=oe(function(s,l,c){return pd(s,Kt(l)||0,c)});function Cw(s){return Ln(s,pe)}function $o(s,l){if(typeof s!="function"||l!=null&&typeof l!="function")throw new Ht(a);var c=function(){var d=arguments,y=l?l.apply(this,d):d[0],w=c.cache;if(w.has(y))return w.get(y);var C=s.apply(this,d);return c.cache=w.set(y,C)||w,C};return c.cache=new($o.Cache||Nn),c}$o.Cache=Nn;function Ho(s){if(typeof s!="function")throw new Ht(a);return function(){var l=arguments;switch(l.length){case 0:return!s.call(this);case 1:return!s.call(this,l[0]);case 2:return!s.call(this,l[0],l[1]);case 3:return!s.call(this,l[0],l[1],l[2])}return!s.apply(this,l)}}function kw(s){return wp(2,s)}var Aw=d_(function(s,l){l=l.length==1&&ne(l[0])?ke(l[0],kt(X())):ke(et(l,1),kt(X()));var c=l.length;return oe(function(d){for(var y=-1,w=ot(d.length,c);++y<w;)d[y]=l[y].call(this,d[y]);return Ct(s,this,d)})}),Pu=oe(function(s,l){var c=rr(l,yi(Pu));return Ln(s,V,t,l,c)}),kp=oe(function(s,l){var c=rr(l,yi(kp));return Ln(s,L,t,l,c)}),Mw=Pn(function(s,l){return Ln(s,j,t,t,t,l)});function Tw(s,l){if(typeof s!="function")throw new Ht(a);return l=l===t?l:re(l),oe(s,l)}function Ow(s,l){if(typeof s!="function")throw new Ht(a);return l=l==null?0:Be(re(l),0),oe(function(c){var d=c[l],y=lr(c,0,l);return d&&nr(y,d),Ct(s,this,y)})}function Iw(s,l,c){var d=!0,y=!0;if(typeof s!="function")throw new Ht(a);return Me(c)&&(d="leading"in c?!!c.leading:d,y="trailing"in c?!!c.trailing:y),Cp(s,l,{leading:d,maxWait:l,trailing:y})}function Nw(s){return vp(s,1)}function Rw(s,l){return Pu(_u(l),s)}function Lw(){if(!arguments.length)return[];var s=arguments[0];return ne(s)?s:[s]}function Pw(s){return Wt(s,S)}function Dw(s,l){return l=typeof l=="function"?l:t,Wt(s,S,l)}function Fw(s){return Wt(s,p|S)}function zw(s,l){return l=typeof l=="function"?l:t,Wt(s,p|S,l)}function Bw(s,l){return l==null||dd(s,l,Ke(l))}function an(s,l){return s===l||s!==s&&l!==l}var $w=Ro(au),Hw=Ro(function(s,l){return s>=l}),Dr=_d(function(){return arguments}())?_d:function(s){return Ie(s)&&we.call(s,"callee")&&!sd.call(s,"callee")},ne=I.isArray,Vw=$h?kt($h):Y2;function _t(s){return s!=null&&Vo(s.length)&&!Fn(s)}function Ne(s){return Ie(s)&&_t(s)}function Ww(s){return s===!0||s===!1||Ie(s)&&ct(s)==Xi}var ur=r2||Ku,Uw=Hh?kt(Hh):X2;function qw(s){return Ie(s)&&s.nodeType===1&&!_s(s)}function Kw(s){if(s==null)return!0;if(_t(s)&&(ne(s)||typeof s=="string"||typeof s.splice=="function"||ur(s)||bi(s)||Dr(s)))return!s.length;var l=at(s);if(l==nn||l==rn)return!s.size;if(ys(s))return!cu(s).length;for(var c in s)if(we.call(s,c))return!1;return!0}function Gw(s,l){return ps(s,l)}function Jw(s,l,c){c=typeof c=="function"?c:t;var d=c?c(s,l):t;return d===t?ps(s,l,t,c):!!d}function Du(s){if(!Ie(s))return!1;var l=ct(s);return l==Qs||l==yy||typeof s.message=="string"&&typeof s.name=="string"&&!_s(s)}function jw(s){return typeof s=="number"&&ad(s)}function Fn(s){if(!Me(s))return!1;var l=ct(s);return l==eo||l==ph||l==gy||l==_y}function Ap(s){return typeof s=="number"&&s==re(s)}function Vo(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Ue}function Me(s){var l=typeof s;return s!=null&&(l=="object"||l=="function")}function Ie(s){return s!=null&&typeof s=="object"}var Mp=Vh?kt(Vh):Q2;function Yw(s,l){return s===l||uu(s,l,ku(l))}function Xw(s,l,c){return c=typeof c=="function"?c:t,uu(s,l,ku(l),c)}function Zw(s){return Tp(s)&&s!=+s}function Qw(s){if(D_(s))throw new te(o);return vd(s)}function eS(s){return s===null}function tS(s){return s==null}function Tp(s){return typeof s=="number"||Ie(s)&&ct(s)==Qi}function _s(s){if(!Ie(s)||ct(s)!=On)return!1;var l=mo(s);if(l===null)return!0;var c=we.call(l,"constructor")&&l.constructor;return typeof c=="function"&&c instanceof c&&co.call(c)==Xb}var Fu=Wh?kt(Wh):e_;function nS(s){return Ap(s)&&s>=-Ue&&s<=Ue}var Op=Uh?kt(Uh):t_;function Wo(s){return typeof s=="string"||!ne(s)&&Ie(s)&&ct(s)==ts}function Mt(s){return typeof s=="symbol"||Ie(s)&&ct(s)==to}var bi=qh?kt(qh):n_;function rS(s){return s===t}function iS(s){return Ie(s)&&at(s)==ns}function sS(s){return Ie(s)&&ct(s)==wy}var oS=Ro(fu),aS=Ro(function(s,l){return s<=l});function Ip(s){if(!s)return[];if(_t(s))return Wo(s)?sn(s):bt(s);if(ss&&s[ss])return Bb(s[ss]());var l=at(s),c=l==nn?Zl:l==rn?ao:_i;return c(s)}function zn(s){if(!s)return s===0?s:0;if(s=Kt(s),s===We||s===-We){var l=s<0?-1:1;return l*zt}return s===s?s:0}function re(s){var l=zn(s),c=l%1;return l===l?c?l-c:l:0}function Np(s){return s?Nr(re(s),0,qe):0}function Kt(s){if(typeof s=="number")return s;if(Mt(s))return st;if(Me(s)){var l=typeof s.valueOf=="function"?s.valueOf():s;s=Me(l)?l+"":l}if(typeof s!="string")return s===0?s:+s;s=Xh(s);var c=Vy.test(s);return c||Uy.test(s)?Sb(s.slice(2),c?2:8):Hy.test(s)?st:+s}function Rp(s){return bn(s,vt(s))}function lS(s){return s?Nr(re(s),-Ue,Ue):s===0?s:0}function _e(s){return s==null?"":At(s)}var uS=mi(function(s,l){if(ys(l)||_t(l)){bn(l,Ke(l),s);return}for(var c in l)we.call(l,c)&&fs(s,c,l[c])}),Lp=mi(function(s,l){bn(l,vt(l),s)}),Uo=mi(function(s,l,c,d){bn(l,vt(l),s,d)}),cS=mi(function(s,l,c,d){bn(l,Ke(l),s,d)}),fS=Pn(iu);function hS(s,l){var c=pi(s);return l==null?c:hd(c,l)}var dS=oe(function(s,l){s=Se(s);var c=-1,d=l.length,y=d>2?l[2]:t;for(y&&ft(l[0],l[1],y)&&(d=1);++c<d;)for(var w=l[c],C=vt(w),M=-1,O=C.length;++M<O;){var P=C[M],D=s[P];(D===t||an(D,fi[P])&&!we.call(s,P))&&(s[P]=w[P])}return s}),pS=oe(function(s){return s.push(t,Xd),Ct(Pp,t,s)});function mS(s,l){return Gh(s,X(l,3),yn)}function gS(s,l){return Gh(s,X(l,3),ou)}function yS(s,l){return s==null?s:su(s,X(l,3),vt)}function bS(s,l){return s==null?s:yd(s,X(l,3),vt)}function _S(s,l){return s&&yn(s,X(l,3))}function vS(s,l){return s&&ou(s,X(l,3))}function wS(s){return s==null?[]:Co(s,Ke(s))}function SS(s){return s==null?[]:Co(s,vt(s))}function zu(s,l,c){var d=s==null?t:Rr(s,l);return d===t?c:d}function xS(s,l){return s!=null&&ep(s,l,K2)}function Bu(s,l){return s!=null&&ep(s,l,G2)}var ES=Kd(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=fo.call(l)),s[l]=c},Hu(wt)),CS=Kd(function(s,l,c){l!=null&&typeof l.toString!="function"&&(l=fo.call(l)),we.call(s,l)?s[l].push(c):s[l]=[c]},X),kS=oe(ds);function Ke(s){return _t(s)?cd(s):cu(s)}function vt(s){return _t(s)?cd(s,!0):r_(s)}function AS(s,l){var c={};return l=X(l,3),yn(s,function(d,y,w){Rn(c,l(d,y,w),d)}),c}function MS(s,l){var c={};return l=X(l,3),yn(s,function(d,y,w){Rn(c,y,l(d,y,w))}),c}var TS=mi(function(s,l,c){ko(s,l,c)}),Pp=mi(function(s,l,c,d){ko(s,l,c,d)}),OS=Pn(function(s,l){var c={};if(s==null)return c;var d=!1;l=ke(l,function(w){return w=ar(w,s),d||(d=w.length>1),w}),bn(s,Eu(s),c),d&&(c=Wt(c,p|b|S,E_));for(var y=l.length;y--;)gu(c,l[y]);return c});function IS(s,l){return Dp(s,Ho(X(l)))}var NS=Pn(function(s,l){return s==null?{}:s_(s,l)});function Dp(s,l){if(s==null)return{};var c=ke(Eu(s),function(d){return[d]});return l=X(l),Ad(s,c,function(d,y){return l(d,y[0])})}function RS(s,l,c){l=ar(l,s);var d=-1,y=l.length;for(y||(y=1,s=t);++d<y;){var w=s==null?t:s[_n(l[d])];w===t&&(d=y,w=c),s=Fn(w)?w.call(s):w}return s}function LS(s,l,c){return s==null?s:ms(s,l,c)}function PS(s,l,c,d){return d=typeof d=="function"?d:t,s==null?s:ms(s,l,c,d)}var Fp=jd(Ke),zp=jd(vt);function DS(s,l,c){var d=ne(s),y=d||ur(s)||bi(s);if(l=X(l,4),c==null){var w=s&&s.constructor;y?c=d?new w:[]:Me(s)?c=Fn(w)?pi(mo(s)):{}:c={}}return(y?$t:yn)(s,function(C,M,O){return l(c,C,M,O)}),c}function FS(s,l){return s==null?!0:gu(s,l)}function zS(s,l,c){return s==null?s:Nd(s,l,_u(c))}function BS(s,l,c,d){return d=typeof d=="function"?d:t,s==null?s:Nd(s,l,_u(c),d)}function _i(s){return s==null?[]:Xl(s,Ke(s))}function $S(s){return s==null?[]:Xl(s,vt(s))}function HS(s,l,c){return c===t&&(c=l,l=t),c!==t&&(c=Kt(c),c=c===c?c:0),l!==t&&(l=Kt(l),l=l===l?l:0),Nr(Kt(s),l,c)}function VS(s,l,c){return l=zn(l),c===t?(c=l,l=0):c=zn(c),s=Kt(s),J2(s,l,c)}function WS(s,l,c){if(c&&typeof c!="boolean"&&ft(s,l,c)&&(l=c=t),c===t&&(typeof l=="boolean"?(c=l,l=t):typeof s=="boolean"&&(c=s,s=t)),s===t&&l===t?(s=0,l=1):(s=zn(s),l===t?(l=s,s=0):l=zn(l)),s>l){var d=s;s=l,l=d}if(c||s%1||l%1){var y=ld();return ot(s+y*(l-s+wb("1e-"+((y+"").length-1))),l)}return du(s,l)}var US=gi(function(s,l,c){return l=l.toLowerCase(),s+(c?Bp(l):l)});function Bp(s){return $u(_e(s).toLowerCase())}function $p(s){return s=_e(s),s&&s.replace(Ky,Lb).replace(fb,"")}function qS(s,l,c){s=_e(s),l=At(l);var d=s.length;c=c===t?d:Nr(re(c),0,d);var y=c;return c-=l.length,c>=0&&s.slice(c,y)==l}function KS(s){return s=_e(s),s&&ky.test(s)?s.replace(yh,Pb):s}function GS(s){return s=_e(s),s&&Ny.test(s)?s.replace(Pl,"\\$&"):s}var JS=gi(function(s,l,c){return s+(c?"-":"")+l.toLowerCase()}),jS=gi(function(s,l,c){return s+(c?" ":"")+l.toLowerCase()}),YS=Wd("toLowerCase");function XS(s,l,c){s=_e(s),l=re(l);var d=l?ui(s):0;if(!l||d>=l)return s;var y=(l-d)/2;return No(_o(y),c)+s+No(bo(y),c)}function ZS(s,l,c){s=_e(s),l=re(l);var d=l?ui(s):0;return l&&d<l?s+No(l-d,c):s}function QS(s,l,c){s=_e(s),l=re(l);var d=l?ui(s):0;return l&&d<l?No(l-d,c)+s:s}function ex(s,l,c){return c||l==null?l=0:l&&(l=+l),a2(_e(s).replace(Dl,""),l||0)}function tx(s,l,c){return(c?ft(s,l,c):l===t)?l=1:l=re(l),pu(_e(s),l)}function nx(){var s=arguments,l=_e(s[0]);return s.length<3?l:l.replace(s[1],s[2])}var rx=gi(function(s,l,c){return s+(c?"_":"")+l.toLowerCase()});function ix(s,l,c){return c&&typeof c!="number"&&ft(s,l,c)&&(l=c=t),c=c===t?qe:c>>>0,c?(s=_e(s),s&&(typeof l=="string"||l!=null&&!Fu(l))&&(l=At(l),!l&&li(s))?lr(sn(s),0,c):s.split(l,c)):[]}var sx=gi(function(s,l,c){return s+(c?" ":"")+$u(l)});function ox(s,l,c){return s=_e(s),c=c==null?0:Nr(re(c),0,s.length),l=At(l),s.slice(c,c+l.length)==l}function ax(s,l,c){var d=v.templateSettings;c&&ft(s,l,c)&&(l=t),s=_e(s),l=Uo({},l,d,Yd);var y=Uo({},l.imports,d.imports,Yd),w=Ke(y),C=Xl(y,w),M,O,P=0,D=l.interpolate||no,F="__p += '",W=Ql((l.escape||no).source+"|"+D.source+"|"+(D===bh?$y:no).source+"|"+(l.evaluate||no).source+"|$","g"),J="//# sourceURL="+(we.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++gb+"]")+`
43
+ `;s.replace(W,function(Q,le,he,Tt,ht,Ot){return he||(he=Tt),F+=s.slice(P,Ot).replace(Gy,Db),le&&(M=!0,F+=`' +
44
44
  __e(`+le+`) +
45
- '`),lt&&(O=!0,F+=`';
46
- `+lt+`;
45
+ '`),ht&&(O=!0,F+=`';
46
+ `+ht+`;
47
47
  __p += '`),he&&(F+=`' +
48
48
  ((__t = (`+he+`)) == null ? '' : __t) +
49
- '`),P=Mt+Q.length,Q}),F+=`';
49
+ '`),P=Ot+Q.length,Q}),F+=`';
50
50
  `;var Z=we.call(l,"variable")&&l.variable;if(!Z)F=`with (obj) {
51
51
  `+F+`
52
52
  }
53
- `;else if(Iy.test(Z))throw new te(u);F=(O?F.replace(my,""):F).replace(gy,"$1").replace(yy,"$1;"),F="function("+(Z||"obj")+`) {
53
+ `;else if(zy.test(Z))throw new te(u);F=(O?F.replace(Sy,""):F).replace(xy,"$1").replace(Ey,"$1;"),F="function("+(Z||"obj")+`) {
54
54
  `+(Z?"":`obj || (obj = {});
55
55
  `)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(O?`, __j = Array.prototype.join;
56
56
  function print() { __p += __j.call(arguments, '') }
57
57
  `:`;
58
58
  `)+F+`return __p
59
- }`;var se=Lp(function(){return be(w,J+"return "+F).apply(t,C)});if(se.source=F,Tu(se))throw se;return se}function tx(s){return _e(s).toLowerCase()}function nx(s){return _e(s).toUpperCase()}function rx(s,l,c){if(s=_e(s),s&&(c||l===t))return Vh(s);if(!s||!(l=Ct(l)))return s;var d=tn(s),y=tn(l),w=Uh(d,y),C=qh(d,y)+1;return ir(d,w,C).join("")}function ix(s,l,c){if(s=_e(s),s&&(c||l===t))return s.slice(0,Gh(s)+1);if(!s||!(l=Ct(l)))return s;var d=tn(s),y=qh(d,tn(l))+1;return ir(d,0,y).join("")}function sx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.replace(Tl,"");if(!s||!(l=Ct(l)))return s;var d=tn(s),y=Uh(d,tn(l));return ir(d,y).join("")}function ox(s,l){var c=St,d=dt;if(Ae(l)){var y="separator"in l?l.separator:y;c="length"in l?re(l.length):c,d="omission"in l?Ct(l.omission):d}s=_e(s);var w=s.length;if(si(s)){var C=tn(s);w=C.length}if(c>=w)return s;var M=c-oi(d);if(M<1)return d;var O=C?ir(C,0,M).join(""):s.slice(0,M);if(y===t)return O+d;if(C&&(M+=O.length-M),Ou(y)){if(s.slice(M).search(y)){var P,D=O;for(y.global||(y=Kl(y.source,_e(fh.exec(y))+"g")),y.lastIndex=0;P=y.exec(D);)var F=P.index;O=O.slice(0,F===t?M:F)}}else if(s.indexOf(Ct(y),M)!=M){var V=O.lastIndexOf(y);V>-1&&(O=O.slice(0,V))}return O+d}function ax(s){return s=_e(s),s&&by.test(s)?s.replace(lh,Db):s}var lx=di(function(s,l,c){return s+(c?" ":"")+l.toUpperCase()}),Ru=Pd("toUpperCase");function Rp(s,l,c){return s=_e(s),l=c?t:l,l===t?Ib(s)?Bb(s):Sb(s):s.match(l)||[]}var Lp=oe(function(s,l){try{return xt(s,t,l)}catch(c){return Tu(c)?c:new te(c)}}),ux=Tn(function(s,l){return Ft(l,function(c){c=pn(c),An(s,c,Au(s[c],s))}),s});function cx(s){var l=s==null?0:s.length,c=X();return s=l?Ee(s,function(d){if(typeof d[1]!="function")throw new zt(a);return[c(d[0]),d[1]]}):[],oe(function(d){for(var y=-1;++y<l;){var w=s[y];if(xt(w[0],this,d))return xt(w[1],this,d)}})}function fx(s){return D2($t(s,p))}function Lu(s){return function(){return s}}function hx(s,l){return s==null||s!==s?l:s}var dx=Fd(),px=Fd(!0);function yt(s){return s}function Pu(s){return dd(typeof s=="function"?s:$t(s,p))}function mx(s){return md($t(s,p))}function gx(s,l){return gd(s,$t(l,p))}var yx=oe(function(s,l){return function(c){return us(c,s,l)}}),bx=oe(function(s,l){return function(c){return us(s,c,l)}});function Du(s,l,c){var d=Ve(l),y=vo(l,d);c==null&&!(Ae(l)&&(y.length||!d.length))&&(c=l,l=s,s=this,y=vo(l,Ve(l)));var w=!(Ae(c)&&"chain"in c)||!!c.chain,C=In(s);return Ft(y,function(M){var O=l[M];s[M]=O,C&&(s.prototype[M]=function(){var P=this.__chain__;if(w||P){var D=s(this.__wrapped__),F=D.__actions__=pt(this.__actions__);return F.push({func:O,args:arguments,thisArg:s}),D.__chain__=P,D}return O.apply(s,Zn([this.value()],arguments))})}),s}function _x(){return je._===this&&(je._=qb),this}function Fu(){}function vx(s){return s=re(s),oe(function(l){return yd(l,s)})}var wx=pu(Ee),Sx=pu(zh),xx=pu(Bl);function Pp(s){return wu(s)?$l(pn(s)):Q2(s)}function kx(s){return function(l){return s==null?t:Ir(s,l)}}var Cx=Bd(),Ex=Bd(!0);function zu(){return[]}function Bu(){return!1}function Ax(){return{}}function Mx(){return""}function Tx(){return!0}function Ox(s,l){if(s=re(s),s<1||s>He)return[];var c=We,d=nt(s,We);l=X(l),s-=We;for(var y=Vl(d,l);++c<s;)l(c);return y}function Ix(s){return ne(s)?Ee(s,pn):Et(s)?[s]:pt(tp(_e(s)))}function Nx(s){var l=++Vb;return _e(s)+l}var Rx=Eo(function(s,l){return s+l},0),Lx=mu("ceil"),Px=Eo(function(s,l){return s/l},1),Dx=mu("floor");function Fx(s){return s&&s.length?_o(s,yt,eu):t}function zx(s,l){return s&&s.length?_o(s,X(l,2),eu):t}function Bx(s){return Hh(s,yt)}function $x(s,l){return Hh(s,X(l,2))}function Hx(s){return s&&s.length?_o(s,yt,iu):t}function Wx(s,l){return s&&s.length?_o(s,X(l,2),iu):t}var Vx=Eo(function(s,l){return s*l},1),Ux=mu("round"),qx=Eo(function(s,l){return s-l},0);function Kx(s){return s&&s.length?Wl(s,yt):0}function Gx(s,l){return s&&s.length?Wl(s,X(l,2)):0}return v.after=mw,v.ary=hp,v.assign=nS,v.assignIn=Ep,v.assignInWith=Bo,v.assignWith=rS,v.at=iS,v.before=dp,v.bind=Au,v.bindAll=ux,v.bindKey=pp,v.castArray=Aw,v.chain=up,v.chunk=D_,v.compact=F_,v.concat=z_,v.cond=cx,v.conforms=fx,v.constant=Lu,v.countBy=Kv,v.create=sS,v.curry=mp,v.curryRight=gp,v.debounce=yp,v.defaults=oS,v.defaultsDeep=aS,v.defer=gw,v.delay=yw,v.difference=B_,v.differenceBy=$_,v.differenceWith=H_,v.drop=W_,v.dropRight=V_,v.dropRightWhile=U_,v.dropWhile=q_,v.fill=K_,v.filter=Jv,v.flatMap=Xv,v.flatMapDeep=Zv,v.flatMapDepth=Qv,v.flatten=sp,v.flattenDeep=G_,v.flattenDepth=J_,v.flip=bw,v.flow=dx,v.flowRight=px,v.fromPairs=j_,v.functions=pS,v.functionsIn=mS,v.groupBy=ew,v.initial=X_,v.intersection=Z_,v.intersectionBy=Q_,v.intersectionWith=ev,v.invert=yS,v.invertBy=bS,v.invokeMap=nw,v.iteratee=Pu,v.keyBy=rw,v.keys=Ve,v.keysIn=gt,v.map=Ro,v.mapKeys=vS,v.mapValues=wS,v.matches=mx,v.matchesProperty=gx,v.memoize=Po,v.merge=SS,v.mergeWith=Ap,v.method=yx,v.methodOf=bx,v.mixin=Du,v.negate=Do,v.nthArg=vx,v.omit=xS,v.omitBy=kS,v.once=_w,v.orderBy=iw,v.over=wx,v.overArgs=vw,v.overEvery=Sx,v.overSome=xx,v.partial=Mu,v.partialRight=bp,v.partition=sw,v.pick=CS,v.pickBy=Mp,v.property=Pp,v.propertyOf=kx,v.pull=iv,v.pullAll=ap,v.pullAllBy=sv,v.pullAllWith=ov,v.pullAt=av,v.range=Cx,v.rangeRight=Ex,v.rearg=ww,v.reject=lw,v.remove=lv,v.rest=Sw,v.reverse=Cu,v.sampleSize=cw,v.set=AS,v.setWith=MS,v.shuffle=fw,v.slice=uv,v.sortBy=pw,v.sortedUniq=gv,v.sortedUniqBy=yv,v.split=XS,v.spread=xw,v.tail=bv,v.take=_v,v.takeRight=vv,v.takeRightWhile=wv,v.takeWhile=Sv,v.tap=Fv,v.throttle=kw,v.thru=No,v.toArray=xp,v.toPairs=Tp,v.toPairsIn=Op,v.toPath=Ix,v.toPlainObject=Cp,v.transform=TS,v.unary=Cw,v.union=xv,v.unionBy=kv,v.unionWith=Cv,v.uniq=Ev,v.uniqBy=Av,v.uniqWith=Mv,v.unset=OS,v.unzip=Eu,v.unzipWith=lp,v.update=IS,v.updateWith=NS,v.values=gi,v.valuesIn=RS,v.without=Tv,v.words=Rp,v.wrap=Ew,v.xor=Ov,v.xorBy=Iv,v.xorWith=Nv,v.zip=Rv,v.zipObject=Lv,v.zipObjectDeep=Pv,v.zipWith=Dv,v.entries=Tp,v.entriesIn=Op,v.extend=Ep,v.extendWith=Bo,Du(v,v),v.add=Rx,v.attempt=Lp,v.camelCase=FS,v.capitalize=Ip,v.ceil=Lx,v.clamp=LS,v.clone=Mw,v.cloneDeep=Ow,v.cloneDeepWith=Iw,v.cloneWith=Tw,v.conformsTo=Nw,v.deburr=Np,v.defaultTo=hx,v.divide=Px,v.endsWith=zS,v.eq=rn,v.escape=BS,v.escapeRegExp=$S,v.every=Gv,v.find=jv,v.findIndex=rp,v.findKey=lS,v.findLast=Yv,v.findLastIndex=ip,v.findLastKey=uS,v.floor=Dx,v.forEach=cp,v.forEachRight=fp,v.forIn=cS,v.forInRight=fS,v.forOwn=hS,v.forOwnRight=dS,v.get=Iu,v.gt=Rw,v.gte=Lw,v.has=gS,v.hasIn=Nu,v.head=op,v.identity=yt,v.includes=tw,v.indexOf=Y_,v.inRange=PS,v.invoke=_S,v.isArguments=Lr,v.isArray=ne,v.isArrayBuffer=Pw,v.isArrayLike=mt,v.isArrayLikeObject=Oe,v.isBoolean=Dw,v.isBuffer=sr,v.isDate=Fw,v.isElement=zw,v.isEmpty=Bw,v.isEqual=$w,v.isEqualWith=Hw,v.isError=Tu,v.isFinite=Ww,v.isFunction=In,v.isInteger=_p,v.isLength=Fo,v.isMap=vp,v.isMatch=Vw,v.isMatchWith=Uw,v.isNaN=qw,v.isNative=Kw,v.isNil=Jw,v.isNull=Gw,v.isNumber=wp,v.isObject=Ae,v.isObjectLike=Te,v.isPlainObject=ms,v.isRegExp=Ou,v.isSafeInteger=jw,v.isSet=Sp,v.isString=zo,v.isSymbol=Et,v.isTypedArray=mi,v.isUndefined=Yw,v.isWeakMap=Xw,v.isWeakSet=Zw,v.join=tv,v.kebabCase=HS,v.last=Wt,v.lastIndexOf=nv,v.lowerCase=WS,v.lowerFirst=VS,v.lt=Qw,v.lte=eS,v.max=Fx,v.maxBy=zx,v.mean=Bx,v.meanBy=$x,v.min=Hx,v.minBy=Wx,v.stubArray=zu,v.stubFalse=Bu,v.stubObject=Ax,v.stubString=Mx,v.stubTrue=Tx,v.multiply=Vx,v.nth=rv,v.noConflict=_x,v.noop=Fu,v.now=Lo,v.pad=US,v.padEnd=qS,v.padStart=KS,v.parseInt=GS,v.random=DS,v.reduce=ow,v.reduceRight=aw,v.repeat=JS,v.replace=jS,v.result=ES,v.round=Ux,v.runInContext=T,v.sample=uw,v.size=hw,v.snakeCase=YS,v.some=dw,v.sortedIndex=cv,v.sortedIndexBy=fv,v.sortedIndexOf=hv,v.sortedLastIndex=dv,v.sortedLastIndexBy=pv,v.sortedLastIndexOf=mv,v.startCase=ZS,v.startsWith=QS,v.subtract=qx,v.sum=Kx,v.sumBy=Gx,v.template=ex,v.times=Ox,v.toFinite=Nn,v.toInteger=re,v.toLength=kp,v.toLower=tx,v.toNumber=Vt,v.toSafeInteger=tS,v.toString=_e,v.toUpper=nx,v.trim=rx,v.trimEnd=ix,v.trimStart=sx,v.truncate=ox,v.unescape=ax,v.uniqueId=Nx,v.upperCase=lx,v.upperFirst=Ru,v.each=cp,v.eachRight=fp,v.first=op,Du(v,function(){var s={};return hn(v,function(l,c){we.call(v.prototype,c)||(s[c]=l)}),s}(),{chain:!1}),v.VERSION=r,Ft(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),Ft(["drop","take"],function(s,l){ce.prototype[s]=function(c){c=c===t?1:De(re(c),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=nt(c,d.__takeCount__):d.__views__.push({size:nt(c,We),type:s+(d.__dir__<0?"Right":"")}),d},ce.prototype[s+"Right"]=function(c){return this.reverse()[s](c).reverse()}}),Ft(["filter","map","takeWhile"],function(s,l){var c=l+1,d=c==Xt||c==Be;ce.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:X(y,3),type:c}),w.__filtered__=w.__filtered__||d,w}}),Ft(["head","last"],function(s,l){var c="take"+(l?"Right":"");ce.prototype[s]=function(){return this[c](1).value()[0]}}),Ft(["initial","tail"],function(s,l){var c="drop"+(l?"":"Right");ce.prototype[s]=function(){return this.__filtered__?new ce(this):this[c](1)}}),ce.prototype.compact=function(){return this.filter(yt)},ce.prototype.find=function(s){return this.filter(s).head()},ce.prototype.findLast=function(s){return this.reverse().find(s)},ce.prototype.invokeMap=oe(function(s,l){return typeof s=="function"?new ce(this):this.map(function(c){return us(c,s,l)})}),ce.prototype.reject=function(s){return this.filter(Do(X(s)))},ce.prototype.slice=function(s,l){s=re(s);var c=this;return c.__filtered__&&(s>0||l<0)?new ce(c):(s<0?c=c.takeRight(-s):s&&(c=c.drop(s)),l!==t&&(l=re(l),c=l<0?c.dropRight(-l):c.take(l-s)),c)},ce.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},ce.prototype.toArray=function(){return this.take(We)},hn(ce.prototype,function(s,l){var c=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var C=this.__wrapped__,M=d?[1]:arguments,O=C instanceof ce,P=M[0],D=O||ne(C),F=function(le){var he=y.apply(v,Zn([le],M));return d&&V?he[0]:he};D&&c&&typeof P=="function"&&P.length!=1&&(O=D=!1);var V=this.__chain__,J=!!this.__actions__.length,Z=w&&!V,se=O&&!J;if(!w&&D){C=se?C:new ce(this);var Q=s.apply(C,M);return Q.__actions__.push({func:No,args:[F],thisArg:t}),new Bt(Q,V)}return Z&&se?s.apply(this,M):(Q=this.thru(F),Z?d?Q.value()[0]:Q.value():Q)})}),Ft(["pop","push","shift","sort","splice","unshift"],function(s){var l=ro[s],c=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(ne(w)?w:[],y)}return this[c](function(C){return l.apply(ne(C)?C:[],y)})}}),hn(ce.prototype,function(s,l){var c=v[l];if(c){var d=c.name+"";we.call(ci,d)||(ci[d]=[]),ci[d].push({name:l,func:c})}}),ci[Co(t,x).name]=[{name:"wrapper",func:t}],ce.prototype.clone=a2,ce.prototype.reverse=l2,ce.prototype.value=u2,v.prototype.at=zv,v.prototype.chain=Bv,v.prototype.commit=$v,v.prototype.next=Hv,v.prototype.plant=Vv,v.prototype.reverse=Uv,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=qv,v.prototype.first=v.prototype.head,ts&&(v.prototype[ts]=Wv),v},ai=$b();Er?((Er.exports=ai)._=ai,Pl._=ai):je._=ai}).call(NO)}(Us,Us.exports)),Us.exports}var ey=RO();function Yf(n){return n.type.create(ey.cloneDeep(n.attrs))}const LO=Re.create({name:"node_processor",addCommands(){return{setBlockAttributes:B(({commands:n,state:e},t,r,i={})=>{const o=H(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:f,to:h}=u.selection;a.nodesBetween(f,h,(m,p)=>{ie.blocks.includes(m.type.name)&&u.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:B(({editor:n},e,t)=>ge(()=>{let r=Object.assign({},t||{});for(const i of ie.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:B(({commands:n},e)=>{for(const t of ie.blocks)n.resetAttributes(t,e)}),applyMark:B(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:u}=n,{$from:f,$to:h}=o.selection,m=mn(de.LINK,u),p=mn(t,u);if(!(p.spec.group||"").includes(un.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const S=k=>{if(!i.onAppliedToParent||i.onAppliedToParent(k)===!1){const{tr:g,node:_,position:x,mark:E}=k;e._removeNodeMark({tr:g,node:_,position:x,mark:E.type})}};a.nodesBetween(f.pos,h.pos,(k,g)=>{if(k.type.name===ie.LIST)return;const _=IO(k.marks,t),x=p.create({..._?.attrs||{},...r}),E=X1(f,h,k,g);if(!m.isInSet(k.marks)&&OO(o.doc,g,x,i.isAppliedToParent))return S({tr:o,node:k,position:g,mark:x});if(k.isText){o.addMark(E.from,E.to,x);return}MO(o.doc,o.selection,k,g)&&o.addNodeMark(g,x)})}),getMarks:B(({editor:n},e)=>{const t=vi(n,"state");return ge(()=>{const{selection:r,doc:i}=H(t),{from:o,to:a}=H(r),u=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:B(({commands:n},e)=>{const t=n.getMarks(e);return ge(()=>H(t)[0]??null)}),hasMark:B(({commands:n},e)=>{const t=n.getMark(e);return ge(()=>!!H(t))}),getCommonSettingMark:B(({commands:n},e,t)=>{const r=n.getMark(e);return ge(()=>H(r)?.value??H(t))}),getDeviceSettingMark:B(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return ge(()=>{for(const o of H(r)){const a=o[H(i)];if(a)return a}return H(t)})}),removeAllMarks:B(({state:n,commands:e})=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,u)=>{for(const f of a.marks)e._removeNodeMark({tr:t,node:a,position:u,mark:f})})}),removeMarks:B(({state:n,commands:e},t)=>{const{tr:r,doc:i}=n,{from:o,to:a}=r.selection;i.nodesBetween(o,a,(u,f)=>{const h=u.marks.filter(m=>t.includes(m.type.name));for(const m of h)e._removeNodeMark({tr:r,node:u,position:f,mark:m})})}),_removeNodeMark:B((n,{tr:e,node:t,position:r,mark:i})=>t.isText?e.removeMark(r,r+t.nodeSize,i):e.removeNodeMark(r,i))}}}),PO=Re.create({name:"text_processor",addCommands(){return{getSelectedText:B(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:B(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=X1(t,r,i,o),u=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(u,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),DO=Re.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:B(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:B(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:B(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;n.doc.nodesBetween(r,i,(o,a,u)=>{if(t({node:o,parent:u})){const f=o.isText?0:Z1(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:B(({commands:n})=>{n.expandSelection(({parent:e})=>e.type.name===ie.DOCUMENT)})}}}),FO=Gn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends it{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=$r.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Le.ok(t)}invert(){return new Ks(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Ks(e.key,e.value,e.stepType)}}it.jsonID("setDocAttr",Ks);const zO=FO.extend({marks:un.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:B(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),BO=Gn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ri(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$O=BO.extend({marks:un.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),HO=Gn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Ri(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>vM({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),WO=HO.extend({marks:un.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),VO=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[RM.create(this.editor),LM.create(this.editor)]}}),UO=()=>[zO,$O,WO,xM,NM,LO,PO,DO,VO],qO=Nt.create({name:de.FONT_FAMILY,group:un.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:B(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=H(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(de.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:B(({commands:n})=>{const e=H(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return ge(()=>n.findFontByName(H(r))||t)}),findFontByName:B((n,e)=>H(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:B(({commands:n})=>{const e=n.getPreset();return ge(()=>H(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Yr({font_family:e})}}),KO=Re.create({name:de.STYLE_PRESET,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{preset:{isRequired:!1,default:{id:H(this.options.defaultId)},parseHTML:n=>{const e=H(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=H(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:H(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:H(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],u=r[o],f=!u||u.toLowerCase()==="inherit";i[o]=f?a:u}return i}return{getPresetList:B(()=>ge(()=>H(this.options.presets).filter(t=>!t.hidden))),getPreset:B(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:H(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return ge(()=>{const u=n(H(i),H(r).id);if(!H(o))return u;const f=H(a);return{id:u.id,common:e(u.common,f.common),mobile:e(u.mobile,f.mobile),tablet:e(u.tablet,f.tablet),desktop:e(u.desktop,f.desktop)}})}),applyPreset:B(({commands:t,chain:r},i)=>{const o=H(t.getPresetList()),a=n(o,i),u=a.node?.type??ie.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of de.attributes)f[h]=H(t.getBlockAttributes(h));r().removeList().setNode(u,f).run()}),applyDefaultPreset:B(({commands:t})=>{t.applyPreset(H(this.options.defaultId))}),removePreset:B(({commands:t})=>{t.setNode(ie.PARAGRAPH,{preset:null})}),getPresetCustomization:B(({editor:t,commands:r})=>{const i=vi(t,"state");return ge(()=>{const{selection:o,doc:a}=H(i),{from:u,to:f}=o;return r._getSettingCustomization(a,u,f)})}),isSettingCustomized:B(({commands:t},r)=>{const i=t.getPresetCustomization(),o=de.presetAttributes.includes(r)?"attributes":"marks";return ge(()=>H(i)[o]?.includes(r)??!1)}),getContentCustomization:B(({editor:t,commands:r})=>{const i=vi(t,"state");return ge(()=>{const{doc:o}=H(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:B((t,r,i,o)=>{const a=new Set,u=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))de.presetAttributes.includes(h)&&m&&u.add(h);for(const{type:h}of f.marks)de.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(de.marks).resetAttributes(ie.PARAGRAPH,de.presetAttributes).resetAttributes(ie.HEADING,de.presetAttributes).restoreSelection().run()}),removeFormat:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Wi.head,H(this.options.presets))}}),GO=Nt.create({name:de.FONT_WEIGHT,group:un.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:B(({commands:n},e)=>{n.applyMark(this.name,{value:e}),H(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:B(({commands:n})=>{const e=H(n.getFontWeight()),t=H(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:B(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return ge(()=>{const r=H(e),i=H(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:B(({commands:n})=>{const e=n.getPreset();return ge(()=>H(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Jt("toggleBold"),"Mod-B":Jt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Yr({font_weight:n.value})}}),JO=Nt.create({name:de.FONT_SIZE,group:un.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:B(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].font_size.replace("px",""))}),applyFontSize:B(({commands:n},e)=>{const t=H(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(m=>!!m))return!1;const h=a.type.create(u);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.min(e+1,H(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.max(e-1,H(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Jt("increaseFontSize"),"Mod-Shift--":Jt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef),r=Y1(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Yr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),jO=Nt.create({name:de.FONT_COLOR,group:un.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:B(({commands:n})=>{const e=n.getPreset();return ge(()=>H(e).common.color)}),applyFontColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:j1(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Yr({font_color:n.value})}}),YO=Nt.create({name:de.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:B(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:j1(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Yr({background_color:n.value})}}),XO=Re.create({name:"device_manager",addCommands(){return{getDevice:B(()=>vi(this.options,"device"))}}}),ZO=Nt.create({name:de.FONT_STYLE,group:un.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return ge(()=>H(e)?.italic??H(t).italic)}),isItalicAvailable:B(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return ge(()=>{const r=H(e),i=H(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:B(({commands:n})=>{const e=n.getPreset();return ge(()=>({italic:H(e).common.font_style==="italic"}))}),toggleItalic:B(({commands:n})=>{H(n.isItalicAvailable())&&(H(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Jt("toggleItalic"),"Mod-I":Jt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Yr({font_style:e})}}),QO=Nt.create({name:de.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:B(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>H(e).underline)}),isStrikeThrough:B(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>H(e).strike_through)}),getTextDecoration:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return ge(()=>{const r=H(e)??{},i=H(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:B(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return ge(()=>H(e)!==H(t).underline)}),getDefaultTextDecoration:B(({commands:n})=>{const e=n.getPreset();return ge(()=>{const{text_decoration:t}=H(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:B(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:B(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:B(({commands:n},e,t=null)=>{const r=H(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Jt("toggleUnderline"),"Mod-U":Jt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Yr({text_decoration:e.join(" ")})}}),eI=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:B(({commands:n},e)=>{switch(e){case pf.CAPITALIZE:return n.applyCapitalize();case pf.LOWERCASE:return n.applyLowerCase();case pf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:B(({commands:n})=>{n.transformText(({text:e})=>tT(e))}),applyLowerCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ty={mobile:null,tablet:null,desktop:null},tI=Re.create({name:de.ALIGNMENT,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=AO(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?rl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ty)}),removeAlignment:B(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,ty),t=n.getDevice(),r=n.getDefaultAlignment();return ge(()=>H(e)?.[H(t)]??H(r))}),getDefaultAlignment:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].alignment??_r.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Jt("applyAlignment",_r.LEFT),"Mod-Shift-e":Jt("applyAlignment",_r.CENTER),"Mod-Shift-r":Jt("applyAlignment",_r.RIGHT),"Mod-Shift-j":Jt("applyAlignment",_r.JUSTIFY)})}),ny={mobile:null,tablet:null,desktop:null},nI=Re.create({name:de.LINE_HEIGHT,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=H(this.options.wrapperRef),r=CO(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?rl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,ny),t=n.getDevice(),r=n.getDefaultLineHeight();return ge(()=>H(e)?.[H(t)]??H(r))}),getDefaultLineHeight:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].line_height)}),applyLineHeight:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ny)})}}}),rI=Gn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ri(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),iI=rI.extend({name:ie.LIST_ITEM,marks:un.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:B(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,Yf(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===ie.LIST))return t.listItemNewline()}})}),sI=Gn.create({name:ie.LIST,content:`${ie.LIST_ITEM}+`,group:"block list",marks:un.SETTINGS,addExtensions:()=>[iI],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Kt.DISC}}}),parseHTML(){const n={a:Kt.ROMAN,i:Kt.LATIN,1:Kt.DECIMAL},e=t=>{for(const r of Kt.values){const i=`.${H(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Kt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Kt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[H(this.options.baseClass)+n.bullet.type,H(this.options.presetClass)];return[Kt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:B(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return ge(()=>H(e).type??null)}),applyList:B(({commands:n,chain:e},t)=>{if(H(n.getListType())===t){n.removeList();return}return e().applyDefaultPreset().toggleList(ie.LIST,ie.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({commands:i,tr:o})=>i._bubbleListItemMarks(o)).run()}),_bubbleListItemMarks:B((n,e)=>{const{doc:t,selection:r}=e,i=r.$from.start(),o=r.$to.end();function a(u,f){if(de.inlineMarks.includes(f.type)||f.type.isInSet(u.marks))return!1;for(const h of u.content.content)if(h.childCount&&(!h.marks||!f.isInSet(h.marks)))return!1;return!0}t.nodesBetween(i,o,(u,f)=>{if(u.type.name===ie.LIST)return;if(u.type.name!==ie.LIST_ITEM)return!1;const h=[];return u.forEach(m=>{for(const p of m.marks){if(p.isInSet(h)){e.removeNodeMark(f+1,p);continue}a(u,p)&&(e.removeNodeMark(f+1,p),e.addNodeMark(f,Yf(p)),h.push(p))}}),!1})}),removeList:B(({commands:n,state:e})=>{const{tr:t,doc:r,selection:i}=e,o=i.$from.start(),a=i.$to.end();r.nodesBetween(o,a,(u,f,h)=>{if([ie.LIST,ie.LIST_ITEM].includes(u.type.name))return;if(h.type.name!==ie.LIST_ITEM)return!1;const m=h.marks.filter(function(p){return!p.type.isInSet(u.marks)});for(const p of m)t.addNodeMark(f,Yf(p));return!1}),n.liftListItem(ie.LIST_ITEM)})}},addInputRules(){const n=(e,t)=>wM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Kt.DISC,/^\s*([-+*])\s$/),n(Kt.DECIMAL,/^(\d+)\.\s$/),n(Kt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Kt.ROMAN,/^([a-z])\.\s$/i)]}});function oI(n){return new Ot({key:new an("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,u=VA(t.doc,[...e]);if(ZA(u).forEach(({newRange:h})=>{const m=qA(r.doc,h,S=>S.isTextblock);let p,b;if(m.length>1?(p=m[0],b=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],b=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&b){const S=b.split(" ").filter(_=>_!=="");if(S.length<=0)return!1;const k=S[S.length-1],g=p.pos+b.lastIndexOf(k);if(!k)return!1;Lf(k).filter(_=>_.isLink).map(_=>({..._,from:g+_.start+1,to:g+_.end+1})).filter(_=>r.schema.marks.code?!r.doc.rangeHasMark(_.from,_.to,r.schema.marks.code):!0).filter(_=>n.validate?n.validate(_.value):!0).forEach(_=>{k0(_.from,_.to,r.doc).some(x=>x.mark.type===n.type)||a.addMark(_.from,_.to,n.type.create({href:_.href}))})}}),!!a.steps.length)return a}})}function aI(n){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||r.target.nodeName!=="A")return!1;const u=jA(e.state,n.type.name),f=r.target,h=(i=f?.href)!==null&&i!==void 0?i:u.href,m=(o=f?.target)!==null&&o!==void 0?o:u.target;return f&&h?(e.editable&&window.open(h,m),!0):!1}}})}function lI(n){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:o}=e,{selection:a}=o,{empty:u}=a;if(u)return!1;let f="";r.content.forEach(k=>{f+=k.textContent});const h=Lf(f).find(k=>k.isLink&&k.value===f);if(!f||!h)return!1;const m=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),p=/href="([^"]*)"/,b=m?.match(p),S=b?b[1]:h.href;return n.editor.commands.setMark(n.type,{href:S}),!0}}})}const uI=Nt.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){J0(n);return}J0(n.scheme,n.optionalSlashes)})},onDestroy(){XM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",Ri(this.options.HTMLAttributes,{...n,href:""}),0]:["a",Ri(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[SM({find:n=>Lf(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e?.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),o=/href="([^"]*)"/,a=i?.match(o);return a?{href:a[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(oI({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(aI({type:this.type})),this.options.linkOnPaste&&n.push(lI({editor:this.editor,type:this.type})),n}}),cI=uI.extend({name:de.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:L0.SELF,parseHTML:n=>n.getAttribute("target")||L0.SELF},destination:{default:Ls.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Ls.URL;const t=e.replace("#","");return H(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Ls.BLOCK:Ls.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:B(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(iy.text(r.text,[iy.mark(de.LINK,r)])))),expandSelectionToLink:B(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:B(({commands:e})=>e.hasMark(this.name)),getLinkPreset:B(()=>ge(()=>H(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),eT.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Ls.BLOCK?`#${n.href}`:n.href,t=H(this.options.basePresetClass)+H(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),fI=Nt.create({name:de.SUPERSCRIPT,addCommands(){return{applySuperscript:B(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:B(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:B(({commands:n})=>{H(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:B(({commands:n})=>{const e=n.getMark(this.name);return ge(()=>!!H(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),hI=Re.create({name:de.MARGIN,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?rl({margin:n.margin.value}):null}}}}]});function dI(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=sc({default:null,link:null});return bk(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),UO().concat([KO.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new gI({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),sI.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),XO.configure({device:n.deviceRef}),JO.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),qO.configure({fonts:n.fonts,defaultPreset:vi(t,"default"),defaultFont:n.defaultFont}),GO,jO,YO,ZO,QO,eI,fI,tI,nI.configure({wrapperRef:n.wrapperRef}),cI.configure({preset:vi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),hI])}class pI{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class ry{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class vn extends ry{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=vn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=u=>{this._assignElementProperties(u,e,vn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,vn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,o=u;continue}if(u.tagName==="BR"&&o&&o?.tagName!=="BR"){u.remove(),o=u;continue}if(u.tagName==="BR"){const f=this.dom.createElement("p");f.append(u),a(f),i=null,o=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),o=u}e.append(t),this._removeStyleProperties(e,vn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,vn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return vn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return vn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,vn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(u)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class mI extends ry{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==ie.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(de.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===ie.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>ey.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===ie.TEXT&&this._includesMarkType(e,de.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class yl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new vn({content:e,parser:t.parser||new pI})}static _buildJson(e){return new mI({content:e})}static normalize(e,t={}){return yl.build(e,t).normalize()}}class Wi{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class ih{static build({config:e,nodeDomParser:t}){const r=dI({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:Qo(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:Qo(df.DESKTOP),pageBlocksRef:Qo([]),wrapperRef:Wi.document.createElement("p")}),i=GA(r);return new ih({schema:i,domParser:yc.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=yl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}class iy{static doc(e){return{type:ie.DOCUMENT,content:e}}static list(e,t){return{type:ie.LIST,attrs:{bullet:{type:e}},content:t.map(r=>r.type===ie.LIST_ITEM?r:this.listItem([].concat(r)))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{type:ie.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[].concat(r).map(o=>typeof o=="string"?this.paragraph(o):o)}}static heading(e,...t){const r=this._textBlock(t,this.text);return r.attrs??={},r.attrs.level=e,{type:ie.HEADING,...r}}static paragraph(...e){return{type:ie.PARAGRAPH,...this._textBlock(e,this.text)}}static _textBlock(e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:r,...t?{attrs:t}:{},...i?{marks:i}:{}}}static _normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:ie.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(de.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class gI{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Wi.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of df.values)for(const u of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${f}, inherit);`,i&&!de.attributes.includes(u)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===df.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class sh{static _instance;static get instance(){return this._instance??=new sh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class sy{static createWindow(){return new zp.JSDOM().window}types;parse(e){const{window:t}=new zp.JSDOM(e);return this.types=t,t.document}}class oy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){console.log(e)}}class yI extends oy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:Fp.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Wi.use(sy.createWindow());const i=Fp.resolve(process.cwd(),t),o=ih.build({config:require(i).editor,nodeDomParser:new sy}),a=e.map(h=>o.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,f=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(f):f)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var bI="4.9.1";class _I extends oy{name="version";description="display cli version";doCommand(){this.output(bI)}}const ay=new s5,vI=[yI,_I];for(const n of vI)new n().install(ay);ay.parse();
59
+ }`;var se=Vp(function(){return be(w,J+"return "+F).apply(t,C)});if(se.source=F,Du(se))throw se;return se}function lx(s){return _e(s).toLowerCase()}function ux(s){return _e(s).toUpperCase()}function cx(s,l,c){if(s=_e(s),s&&(c||l===t))return Xh(s);if(!s||!(l=At(l)))return s;var d=sn(s),y=sn(l),w=Zh(d,y),C=Qh(d,y)+1;return lr(d,w,C).join("")}function fx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.slice(0,td(s)+1);if(!s||!(l=At(l)))return s;var d=sn(s),y=Qh(d,sn(l))+1;return lr(d,0,y).join("")}function hx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.replace(Dl,"");if(!s||!(l=At(l)))return s;var d=sn(s),y=Zh(d,sn(l));return lr(d,y).join("")}function dx(s,l){var c=Et,d=yt;if(Me(l)){var y="separator"in l?l.separator:y;c="length"in l?re(l.length):c,d="omission"in l?At(l.omission):d}s=_e(s);var w=s.length;if(li(s)){var C=sn(s);w=C.length}if(c>=w)return s;var M=c-ui(d);if(M<1)return d;var O=C?lr(C,0,M).join(""):s.slice(0,M);if(y===t)return O+d;if(C&&(M+=O.length-M),Fu(y)){if(s.slice(M).search(y)){var P,D=O;for(y.global||(y=Ql(y.source,_e(_h.exec(y))+"g")),y.lastIndex=0;P=y.exec(D);)var F=P.index;O=O.slice(0,F===t?M:F)}}else if(s.indexOf(At(y),M)!=M){var W=O.lastIndexOf(y);W>-1&&(O=O.slice(0,W))}return O+d}function px(s){return s=_e(s),s&&Cy.test(s)?s.replace(gh,Wb):s}var mx=gi(function(s,l,c){return s+(c?" ":"")+l.toUpperCase()}),$u=Wd("toUpperCase");function Hp(s,l,c){return s=_e(s),l=c?t:l,l===t?zb(s)?Kb(s):Tb(s):s.match(l)||[]}var Vp=oe(function(s,l){try{return Ct(s,t,l)}catch(c){return Du(c)?c:new te(c)}}),gx=Pn(function(s,l){return $t(l,function(c){c=_n(c),Rn(s,c,Lu(s[c],s))}),s});function yx(s){var l=s==null?0:s.length,c=X();return s=l?ke(s,function(d){if(typeof d[1]!="function")throw new Ht(a);return[c(d[0]),d[1]]}):[],oe(function(d){for(var y=-1;++y<l;){var w=s[y];if(Ct(w[0],this,d))return Ct(w[1],this,d)}})}function bx(s){return W2(Wt(s,p))}function Hu(s){return function(){return s}}function _x(s,l){return s==null||s!==s?l:s}var vx=qd(),wx=qd(!0);function wt(s){return s}function Vu(s){return wd(typeof s=="function"?s:Wt(s,p))}function Sx(s){return xd(Wt(s,p))}function xx(s,l){return Ed(s,Wt(l,p))}var Ex=oe(function(s,l){return function(c){return ds(c,s,l)}}),Cx=oe(function(s,l){return function(c){return ds(s,c,l)}});function Wu(s,l,c){var d=Ke(l),y=Co(l,d);c==null&&!(Me(l)&&(y.length||!d.length))&&(c=l,l=s,s=this,y=Co(l,Ke(l)));var w=!(Me(c)&&"chain"in c)||!!c.chain,C=Fn(s);return $t(y,function(M){var O=l[M];s[M]=O,C&&(s.prototype[M]=function(){var P=this.__chain__;if(w||P){var D=s(this.__wrapped__),F=D.__actions__=bt(this.__actions__);return F.push({func:O,args:arguments,thisArg:s}),D.__chain__=P,D}return O.apply(s,nr([this.value()],arguments))})}),s}function kx(){return Qe._===this&&(Qe._=Zb),this}function Uu(){}function Ax(s){return s=re(s),oe(function(l){return Cd(l,s)})}var Mx=wu(ke),Tx=wu(Kh),Ox=wu(Kl);function Wp(s){return Mu(s)?Gl(_n(s)):o_(s)}function Ix(s){return function(l){return s==null?t:Rr(s,l)}}var Nx=Gd(),Rx=Gd(!0);function qu(){return[]}function Ku(){return!1}function Lx(){return{}}function Px(){return""}function Dx(){return!0}function Fx(s,l){if(s=re(s),s<1||s>Ue)return[];var c=qe,d=ot(s,qe);l=X(l),s-=qe;for(var y=Yl(d,l);++c<s;)l(c);return y}function zx(s){return ne(s)?ke(s,_n):Mt(s)?[s]:bt(up(_e(s)))}function Bx(s){var l=++Yb;return _e(s)+l}var $x=Io(function(s,l){return s+l},0),Hx=Su("ceil"),Vx=Io(function(s,l){return s/l},1),Wx=Su("floor");function Ux(s){return s&&s.length?Eo(s,wt,au):t}function qx(s,l){return s&&s.length?Eo(s,X(l,2),au):t}function Kx(s){return jh(s,wt)}function Gx(s,l){return jh(s,X(l,2))}function Jx(s){return s&&s.length?Eo(s,wt,fu):t}function jx(s,l){return s&&s.length?Eo(s,X(l,2),fu):t}var Yx=Io(function(s,l){return s*l},1),Xx=Su("round"),Zx=Io(function(s,l){return s-l},0);function Qx(s){return s&&s.length?jl(s,wt):0}function e5(s,l){return s&&s.length?jl(s,X(l,2)):0}return v.after=Sw,v.ary=vp,v.assign=uS,v.assignIn=Lp,v.assignInWith=Uo,v.assignWith=cS,v.at=fS,v.before=wp,v.bind=Lu,v.bindAll=gx,v.bindKey=Sp,v.castArray=Lw,v.chain=yp,v.chunk=W_,v.compact=U_,v.concat=q_,v.cond=yx,v.conforms=bx,v.constant=Hu,v.countBy=Qv,v.create=hS,v.curry=xp,v.curryRight=Ep,v.debounce=Cp,v.defaults=dS,v.defaultsDeep=pS,v.defer=xw,v.delay=Ew,v.difference=K_,v.differenceBy=G_,v.differenceWith=J_,v.drop=j_,v.dropRight=Y_,v.dropRightWhile=X_,v.dropWhile=Z_,v.fill=Q_,v.filter=tw,v.flatMap=iw,v.flatMapDeep=sw,v.flatMapDepth=ow,v.flatten=dp,v.flattenDeep=ev,v.flattenDepth=tv,v.flip=Cw,v.flow=vx,v.flowRight=wx,v.fromPairs=nv,v.functions=wS,v.functionsIn=SS,v.groupBy=aw,v.initial=iv,v.intersection=sv,v.intersectionBy=ov,v.intersectionWith=av,v.invert=ES,v.invertBy=CS,v.invokeMap=uw,v.iteratee=Vu,v.keyBy=cw,v.keys=Ke,v.keysIn=vt,v.map=zo,v.mapKeys=AS,v.mapValues=MS,v.matches=Sx,v.matchesProperty=xx,v.memoize=$o,v.merge=TS,v.mergeWith=Pp,v.method=Ex,v.methodOf=Cx,v.mixin=Wu,v.negate=Ho,v.nthArg=Ax,v.omit=OS,v.omitBy=IS,v.once=kw,v.orderBy=fw,v.over=Mx,v.overArgs=Aw,v.overEvery=Tx,v.overSome=Ox,v.partial=Pu,v.partialRight=kp,v.partition=hw,v.pick=NS,v.pickBy=Dp,v.property=Wp,v.propertyOf=Ix,v.pull=fv,v.pullAll=mp,v.pullAllBy=hv,v.pullAllWith=dv,v.pullAt=pv,v.range=Nx,v.rangeRight=Rx,v.rearg=Mw,v.reject=mw,v.remove=mv,v.rest=Tw,v.reverse=Nu,v.sampleSize=yw,v.set=LS,v.setWith=PS,v.shuffle=bw,v.slice=gv,v.sortBy=ww,v.sortedUniq=xv,v.sortedUniqBy=Ev,v.split=ix,v.spread=Ow,v.tail=Cv,v.take=kv,v.takeRight=Av,v.takeRightWhile=Mv,v.takeWhile=Tv,v.tap=Uv,v.throttle=Iw,v.thru=Fo,v.toArray=Ip,v.toPairs=Fp,v.toPairsIn=zp,v.toPath=zx,v.toPlainObject=Rp,v.transform=DS,v.unary=Nw,v.union=Ov,v.unionBy=Iv,v.unionWith=Nv,v.uniq=Rv,v.uniqBy=Lv,v.uniqWith=Pv,v.unset=FS,v.unzip=Ru,v.unzipWith=gp,v.update=zS,v.updateWith=BS,v.values=_i,v.valuesIn=$S,v.without=Dv,v.words=Hp,v.wrap=Rw,v.xor=Fv,v.xorBy=zv,v.xorWith=Bv,v.zip=$v,v.zipObject=Hv,v.zipObjectDeep=Vv,v.zipWith=Wv,v.entries=Fp,v.entriesIn=zp,v.extend=Lp,v.extendWith=Uo,Wu(v,v),v.add=$x,v.attempt=Vp,v.camelCase=US,v.capitalize=Bp,v.ceil=Hx,v.clamp=HS,v.clone=Pw,v.cloneDeep=Fw,v.cloneDeepWith=zw,v.cloneWith=Dw,v.conformsTo=Bw,v.deburr=$p,v.defaultTo=_x,v.divide=Vx,v.endsWith=qS,v.eq=an,v.escape=KS,v.escapeRegExp=GS,v.every=ew,v.find=nw,v.findIndex=fp,v.findKey=mS,v.findLast=rw,v.findLastIndex=hp,v.findLastKey=gS,v.floor=Wx,v.forEach=bp,v.forEachRight=_p,v.forIn=yS,v.forInRight=bS,v.forOwn=_S,v.forOwnRight=vS,v.get=zu,v.gt=$w,v.gte=Hw,v.has=xS,v.hasIn=Bu,v.head=pp,v.identity=wt,v.includes=lw,v.indexOf=rv,v.inRange=VS,v.invoke=kS,v.isArguments=Dr,v.isArray=ne,v.isArrayBuffer=Vw,v.isArrayLike=_t,v.isArrayLikeObject=Ne,v.isBoolean=Ww,v.isBuffer=ur,v.isDate=Uw,v.isElement=qw,v.isEmpty=Kw,v.isEqual=Gw,v.isEqualWith=Jw,v.isError=Du,v.isFinite=jw,v.isFunction=Fn,v.isInteger=Ap,v.isLength=Vo,v.isMap=Mp,v.isMatch=Yw,v.isMatchWith=Xw,v.isNaN=Zw,v.isNative=Qw,v.isNil=tS,v.isNull=eS,v.isNumber=Tp,v.isObject=Me,v.isObjectLike=Ie,v.isPlainObject=_s,v.isRegExp=Fu,v.isSafeInteger=nS,v.isSet=Op,v.isString=Wo,v.isSymbol=Mt,v.isTypedArray=bi,v.isUndefined=rS,v.isWeakMap=iS,v.isWeakSet=sS,v.join=lv,v.kebabCase=JS,v.last=qt,v.lastIndexOf=uv,v.lowerCase=jS,v.lowerFirst=YS,v.lt=oS,v.lte=aS,v.max=Ux,v.maxBy=qx,v.mean=Kx,v.meanBy=Gx,v.min=Jx,v.minBy=jx,v.stubArray=qu,v.stubFalse=Ku,v.stubObject=Lx,v.stubString=Px,v.stubTrue=Dx,v.multiply=Yx,v.nth=cv,v.noConflict=kx,v.noop=Uu,v.now=Bo,v.pad=XS,v.padEnd=ZS,v.padStart=QS,v.parseInt=ex,v.random=WS,v.reduce=dw,v.reduceRight=pw,v.repeat=tx,v.replace=nx,v.result=RS,v.round=Xx,v.runInContext=T,v.sample=gw,v.size=_w,v.snakeCase=rx,v.some=vw,v.sortedIndex=yv,v.sortedIndexBy=bv,v.sortedIndexOf=_v,v.sortedLastIndex=vv,v.sortedLastIndexBy=wv,v.sortedLastIndexOf=Sv,v.startCase=sx,v.startsWith=ox,v.subtract=Zx,v.sum=Qx,v.sumBy=e5,v.template=ax,v.times=Fx,v.toFinite=zn,v.toInteger=re,v.toLength=Np,v.toLower=lx,v.toNumber=Kt,v.toSafeInteger=lS,v.toString=_e,v.toUpper=ux,v.trim=cx,v.trimEnd=fx,v.trimStart=hx,v.truncate=dx,v.unescape=px,v.uniqueId=Bx,v.upperCase=mx,v.upperFirst=$u,v.each=bp,v.eachRight=_p,v.first=pp,Wu(v,function(){var s={};return yn(v,function(l,c){we.call(v.prototype,c)||(s[c]=l)}),s}(),{chain:!1}),v.VERSION=r,$t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),$t(["drop","take"],function(s,l){ce.prototype[s]=function(c){c=c===t?1:Be(re(c),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=ot(c,d.__takeCount__):d.__views__.push({size:ot(c,qe),type:s+(d.__dir__<0?"Right":"")}),d},ce.prototype[s+"Right"]=function(c){return this.reverse()[s](c).reverse()}}),$t(["filter","map","takeWhile"],function(s,l){var c=l+1,d=c==en||c==Ve;ce.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:X(y,3),type:c}),w.__filtered__=w.__filtered__||d,w}}),$t(["head","last"],function(s,l){var c="take"+(l?"Right":"");ce.prototype[s]=function(){return this[c](1).value()[0]}}),$t(["initial","tail"],function(s,l){var c="drop"+(l?"":"Right");ce.prototype[s]=function(){return this.__filtered__?new ce(this):this[c](1)}}),ce.prototype.compact=function(){return this.filter(wt)},ce.prototype.find=function(s){return this.filter(s).head()},ce.prototype.findLast=function(s){return this.reverse().find(s)},ce.prototype.invokeMap=oe(function(s,l){return typeof s=="function"?new ce(this):this.map(function(c){return ds(c,s,l)})}),ce.prototype.reject=function(s){return this.filter(Ho(X(s)))},ce.prototype.slice=function(s,l){s=re(s);var c=this;return c.__filtered__&&(s>0||l<0)?new ce(c):(s<0?c=c.takeRight(-s):s&&(c=c.drop(s)),l!==t&&(l=re(l),c=l<0?c.dropRight(-l):c.take(l-s)),c)},ce.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},ce.prototype.toArray=function(){return this.take(qe)},yn(ce.prototype,function(s,l){var c=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var C=this.__wrapped__,M=d?[1]:arguments,O=C instanceof ce,P=M[0],D=O||ne(C),F=function(le){var he=y.apply(v,nr([le],M));return d&&W?he[0]:he};D&&c&&typeof P=="function"&&P.length!=1&&(O=D=!1);var W=this.__chain__,J=!!this.__actions__.length,Z=w&&!W,se=O&&!J;if(!w&&D){C=se?C:new ce(this);var Q=s.apply(C,M);return Q.__actions__.push({func:Fo,args:[F],thisArg:t}),new Vt(Q,W)}return Z&&se?s.apply(this,M):(Q=this.thru(F),Z?d?Q.value()[0]:Q.value():Q)})}),$t(["pop","push","shift","sort","splice","unshift"],function(s){var l=lo[s],c=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(ne(w)?w:[],y)}return this[c](function(C){return l.apply(ne(C)?C:[],y)})}}),yn(ce.prototype,function(s,l){var c=v[l];if(c){var d=c.name+"";we.call(di,d)||(di[d]=[]),di[d].push({name:l,func:c})}}),di[Oo(t,x).name]=[{name:"wrapper",func:t}],ce.prototype.clone=p2,ce.prototype.reverse=m2,ce.prototype.value=g2,v.prototype.at=qv,v.prototype.chain=Kv,v.prototype.commit=Gv,v.prototype.next=Jv,v.prototype.plant=Yv,v.prototype.reverse=Xv,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=Zv,v.prototype.first=v.prototype.head,ss&&(v.prototype[ss]=jv),v},ci=Gb();Mr?((Mr.exports=ci)._=ci,Vl._=ci):Qe._=ci}).call(sI)}(js,js.exports)),js.exports}var ay=oI();function ih(n){return n.type.create(ay.cloneDeep(n.attrs))}const aI=De.create({name:"node_processor",addCommands(){return{setBlockAttributes:B(({commands:n,state:e},t,r,i={})=>{const o=H(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:f,to:h}=u.selection;a.nodesBetween(f,h,(m,p)=>{ie.blocks.includes(m.type.name)&&u.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:B(({editor:n},e,t)=>me(()=>{let r=Object.assign({},t||{});for(const i of ie.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:B(({commands:n},e)=>{for(const t of ie.blocks)n.resetAttributes(t,e)}),applyMark:B(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:u}=n,{$from:f,$to:h}=o.selection,m=wn(de.LINK,u),p=wn(t,u);if(!(p.spec.group||"").includes(dn.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const S=E=>{if(!i.onAppliedToParent||i.onAppliedToParent(E)===!1){const{tr:g,node:_,position:x,mark:k}=E;e._removeNodeMark({tr:g,node:_,position:x,mark:k.type})}};a.nodesBetween(f.pos,h.pos,(E,g)=>{if(E.type.name===ie.LIST)return;const _=iI(E.marks,t),x=p.create({..._?.attrs||{},...r}),k=iy(f,h,E,g);if(!m.isInSet(E.marks)&&rI(o.doc,g,x,i.isAppliedToParent))return S({tr:o,node:E,position:g,mark:x});if(E.isText){o.addMark(k.from,k.to,x);return}tI(o.doc,o.selection,E,g)&&o.addNodeMark(g,x)})}),getMarks:B(({editor:n},e)=>{const t=xi(n,"state");return me(()=>{const{selection:r,doc:i}=H(t),{from:o,to:a}=H(r),u=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:B(({commands:n},e)=>{const t=n.getMarks(e);return me(()=>H(t)[0]??null)}),hasMark:B(({commands:n},e)=>{const t=n.getMark(e);return me(()=>!!H(t))}),getCommonSettingMark:B(({commands:n},e,t)=>{const r=n.getMark(e);return me(()=>H(r)?.value??H(t))}),getDeviceSettingMark:B(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return me(()=>{for(const o of H(r)){const a=o[H(i)];if(a)return a}return H(t)})}),removeAllMarks:B(({state:n,commands:e})=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,u)=>{for(const f of a.marks)e._removeNodeMark({tr:t,node:a,position:u,mark:f})})}),removeMarks:B(({state:n,commands:e},t)=>{const{tr:r,doc:i}=n,{from:o,to:a}=r.selection;i.nodesBetween(o,a,(u,f)=>{const h=u.marks.filter(m=>t.includes(m.type.name));for(const m of h)e._removeNodeMark({tr:r,node:u,position:f,mark:m})})}),_removeNodeMark:B((n,{tr:e,node:t,position:r,mark:i})=>t.isText?e.removeMark(r,r+t.nodeSize,i):e.removeNodeMark(r,i))}}}),lI=De.create({name:"text_processor",addCommands(){return{getSelectedText:B(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:B(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=iy(t,r,i,o),u=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(u,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),uI=De.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:B(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:B(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:B(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;n.doc.nodesBetween(r,i,(o,a,u)=>{if(t({node:o,parent:u})){const f=o.isText?0:sy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:B(({commands:n})=>{n.expandSelection(({parent:e})=>e.type.name===ie.DOCUMENT)})}}}),cI=Xn.create({name:"doc",topNode:!0,content:"block+"});class Xs extends lt{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=Wr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Fe.ok(t)}invert(){return new Xs(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Xs(e.key,e.value,e.stepType)}}lt.jsonID("setDocAttr",Xs);const fI=cI.extend({marks:dn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:B(({state:n},e,t)=>{n.tr.step(new Xs(e,t,n.schema))})}}}),hI=Xn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dI=hI.extend({marks:dn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),pI=Xn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Fi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>GM({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),mI=pI.extend({marks:dn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),gI=De.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[oT.create(this.editor),aT.create(this.editor)]}}),yI=()=>[fI,dI,mI,YM,sT,aI,lI,uI,gI],bI=Pt.create({name:de.FONT_FAMILY,group:dn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:B(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=H(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(de.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:B(({commands:n})=>{const e=H(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return me(()=>n.findFontByName(H(r))||t)}),findFontByName:B((n,e)=>H(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Qr({font_family:e})}}),_I=De.create({name:de.STYLE_PRESET,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{preset:{isRequired:!1,default:{id:H(this.options.defaultId)},parseHTML:n=>{const e=H(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=H(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:H(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:H(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],u=r[o],f=!u||u.toLowerCase()==="inherit";i[o]=f?a:u}return i}return{getPresetList:B(()=>me(()=>H(this.options.presets).filter(t=>!t.hidden))),getPreset:B(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:H(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return me(()=>{const u=n(H(i),H(r).id);if(!H(o))return u;const f=H(a);return{id:u.id,common:e(u.common,f.common),mobile:e(u.mobile,f.mobile),tablet:e(u.tablet,f.tablet),desktop:e(u.desktop,f.desktop)}})}),applyPreset:B(({commands:t,chain:r},i)=>{const o=H(t.getPresetList()),a=n(o,i),u=a.node?.type??ie.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of de.attributes)f[h]=H(t.getBlockAttributes(h));r().removeList().setNode(u,f).run()}),applyDefaultPreset:B(({commands:t})=>{t.applyPreset(H(this.options.defaultId))}),removePreset:B(({commands:t})=>{t.setNode(ie.PARAGRAPH,{preset:null})}),getPresetCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{selection:o,doc:a}=H(i),{from:u,to:f}=o;return r._getSettingCustomization(a,u,f)})}),isSettingCustomized:B(({commands:t},r)=>{const i=t.getPresetCustomization(),o=de.presetAttributes.includes(r)?"attributes":"marks";return me(()=>H(i)[o]?.includes(r)??!1)}),getContentCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{doc:o}=H(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:B((t,r,i,o)=>{const a=new Set,u=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))de.presetAttributes.includes(h)&&m&&u.add(h);for(const{type:h}of f.marks)de.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(de.marks).resetAttributes(ie.PARAGRAPH,de.presetAttributes).resetAttributes(ie.HEADING,de.presetAttributes).restoreSelection().run()}),removeFormat:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Ki.head,H(this.options.presets))}}),vI=Pt.create({name:de.FONT_WEIGHT,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:B(({commands:n},e)=>{n.applyMark(this.name,{value:e}),H(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:B(({commands:n})=>{const e=H(n.getFontWeight()),t=H(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:B(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return me(()=>{const r=H(e),i=H(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Zt("toggleBold"),"Mod-B":Zt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Qr({font_weight:n.value})}}),wI=Pt.create({name:de.FONT_SIZE,group:dn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:B(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].font_size.replace("px",""))}),applyFontSize:B(({commands:n},e)=>{const t=H(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(m=>!!m))return!1;const h=a.type.create(u);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.min(e+1,H(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.max(e-1,H(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Zt("increaseFontSize"),"Mod-Shift--":Zt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef),r=ry(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Qr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),SI=Pt.create({name:de.FONT_COLOR,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.color)}),applyFontColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({font_color:n.value})}}),xI=Pt.create({name:de.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:B(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({background_color:n.value})}}),EI=De.create({name:"device_manager",addCommands(){return{getDevice:B(()=>xi(this.options,"device"))}}}),CI=Pt.create({name:de.FONT_STYLE,group:dn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return me(()=>H(e)?.italic??H(t).italic)}),isItalicAvailable:B(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return me(()=>{const r=H(e),i=H(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:B(({commands:n})=>{const e=n.getPreset();return me(()=>({italic:H(e).common.font_style==="italic"}))}),toggleItalic:B(({commands:n})=>{H(n.isItalicAvailable())&&(H(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Zt("toggleItalic"),"Mod-I":Zt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Qr({font_style:e})}}),kI=Pt.create({name:de.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).underline)}),isStrikeThrough:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).strike_through)}),getTextDecoration:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return me(()=>{const r=H(e)??{},i=H(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:B(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return me(()=>H(e)!==H(t).underline)}),getDefaultTextDecoration:B(({commands:n})=>{const e=n.getPreset();return me(()=>{const{text_decoration:t}=H(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:B(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:B(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:B(({commands:n},e,t=null)=>{const r=H(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Zt("toggleUnderline"),"Mod-U":Zt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Qr({text_decoration:e.join(" ")})}}),AI=De.create({name:"case_style",addCommands(){return{applyCaseStyle:B(({commands:n},e)=>{switch(e){case Sf.CAPITALIZE:return n.applyCapitalize();case Sf.LOWERCASE:return n.applyLowerCase();case Sf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:B(({commands:n})=>{n.transformText(({text:e})=>MT(e))}),applyLowerCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ly={mobile:null,tablet:null,desktop:null},MI=De.create({name:de.ALIGNMENT,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=eI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?cl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ly)}),removeAlignment:B(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,ly),t=n.getDevice(),r=n.getDefaultAlignment();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultAlignment:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Zt("applyAlignment",wr.LEFT),"Mod-Shift-e":Zt("applyAlignment",wr.CENTER),"Mod-Shift-r":Zt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Zt("applyAlignment",wr.JUSTIFY)})}),uy={mobile:null,tablet:null,desktop:null},TI=De.create({name:de.LINE_HEIGHT,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=H(this.options.wrapperRef),r=ZO(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?cl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,uy),t=n.getDevice(),r=n.getDefaultLineHeight();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultLineHeight:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].line_height)}),applyLineHeight:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},uy)})}}}),OI=Xn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Fi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),II=OI.extend({name:ie.LIST_ITEM,marks:dn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:B(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ih(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===ie.LIST))return t.listItemNewline()}})}),NI=Xn.create({name:ie.LIST,content:`${ie.LIST_ITEM}+`,group:"block list",marks:dn.SETTINGS,addExtensions:()=>[II],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Yt.DISC}}}),parseHTML(){const n={a:Yt.ROMAN,i:Yt.LATIN,1:Yt.DECIMAL},e=t=>{for(const r of Yt.values){const i=`.${H(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Yt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Yt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[H(this.options.baseClass)+n.bullet.type,H(this.options.presetClass)];return[Yt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:B(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return me(()=>H(e).type??null)}),applyList:B(({commands:n,chain:e},t)=>{if(H(n.getListType())===t){n.removeList();return}return e().applyDefaultPreset().toggleList(ie.LIST,ie.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({commands:i,tr:o})=>i._bubbleListItemMarks(o)).run()}),_bubbleListItemMarks:B((n,e)=>{const{doc:t,selection:r}=e,i=r.$from.start(),o=r.$to.end();function a(u,f){if(de.inlineMarks.includes(f.type)||f.type.isInSet(u.marks))return!1;for(const h of u.content.content)if(h.childCount&&(!h.marks||!f.isInSet(h.marks)))return!1;return!0}t.nodesBetween(i,o,(u,f)=>{if(u.type.name===ie.LIST)return;if(u.type.name!==ie.LIST_ITEM)return!1;const h=[];return u.forEach(m=>{for(const p of m.marks){if(p.isInSet(h)){e.removeNodeMark(f+1,p);continue}a(u,p)&&(e.removeNodeMark(f+1,p),e.addNodeMark(f,ih(p)),h.push(p))}}),!1})}),removeList:B(({commands:n,state:e})=>{const{tr:t,doc:r,selection:i}=e,o=i.$from.start(),a=i.$to.end();r.nodesBetween(o,a,(u,f,h)=>{if([ie.LIST,ie.LIST_ITEM].includes(u.type.name))return;if(h.type.name!==ie.LIST_ITEM)return!1;const m=h.marks.filter(function(p){return!p.type.isInSet(u.marks)});for(const p of m)t.addNodeMark(f,ih(p));return!1}),n.liftListItem(ie.LIST_ITEM)})}},addInputRules(){const n=(e,t)=>JM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Yt.DISC,/^\s*([-+*])\s$/),n(Yt.DECIMAL,/^(\d+)\.\s$/),n(Yt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Yt.ROMAN,/^([a-z])\.\s$/i)]}});function RI(n){return new Rt({key:new fn("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,u=gM(t.doc,[...e]);if(CM(u).forEach(({newRange:h})=>{const m=bM(r.doc,h,S=>S.isTextblock);let p,b;if(m.length>1?(p=m[0],b=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],b=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&b){const S=b.split(" ").filter(_=>_!=="");if(S.length<=0)return!1;const E=S[S.length-1],g=p.pos+b.lastIndexOf(E);if(!E)return!1;Vf(E).filter(_=>_.isLink).map(_=>({..._,from:g+_.start+1,to:g+_.end+1})).filter(_=>r.schema.marks.code?!r.doc.rangeHasMark(_.from,_.to,r.schema.marks.code):!0).filter(_=>n.validate?n.validate(_.value):!0).forEach(_=>{I0(_.from,_.to,r.doc).some(x=>x.mark.type===n.type)||a.addMark(_.from,_.to,n.type.create({href:_.href}))})}}),!!a.steps.length)return a}})}function LI(n){return new Rt({key:new fn("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||r.target.nodeName!=="A")return!1;const u=SM(e.state,n.type.name),f=r.target,h=(i=f?.href)!==null&&i!==void 0?i:u.href,m=(o=f?.target)!==null&&o!==void 0?o:u.target;return f&&h?(e.editable&&window.open(h,m),!0):!1}}})}function PI(n){return new Rt({key:new fn("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:o}=e,{selection:a}=o,{empty:u}=a;if(u)return!1;let f="";r.content.forEach(E=>{f+=E.textContent});const h=Vf(f).find(E=>E.isLink&&E.value===f);if(!f||!h)return!1;const m=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),p=/href="([^"]*)"/,b=m?.match(p),S=b?b[1]:h.href;return n.editor.commands.setMark(n.type,{href:S}),!0}}})}const DI=Pt.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){t1(n);return}t1(n.scheme,n.optionalSlashes)})},onDestroy(){ET()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",Fi(this.options.HTMLAttributes,{...n,href:""}),0]:["a",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[jM({find:n=>Vf(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e?.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),o=/href="([^"]*)"/,a=i?.match(o);return a?{href:a[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(RI({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(LI({type:this.type})),this.options.linkOnPaste&&n.push(PI({editor:this.editor,type:this.type})),n}}),FI=DI.extend({name:de.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:H0.SELF,parseHTML:n=>n.getAttribute("target")||H0.SELF},destination:{default:Bs.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Bs.URL;const t=e.replace("#","");return H(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Bs.BLOCK:Bs.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:B(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(fy.text(r.text,[fy.mark(de.LINK,r)])))),expandSelectionToLink:B(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:B(({commands:e})=>e.hasMark(this.name)),getLinkPreset:B(()=>me(()=>H(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),AT.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Bs.BLOCK?`#${n.href}`:n.href,t=H(this.options.basePresetClass)+H(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),zI=Pt.create({name:de.SUPERSCRIPT,addCommands(){return{applySuperscript:B(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:B(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:B(({commands:n})=>{H(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:B(({commands:n})=>{const e=n.getMark(this.name);return me(()=>!!H(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),BI=De.create({name:de.MARGIN,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?cl({margin:n.margin.value}):null}}}}]});function $I(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=hc({default:null,link:null});return PE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),yI().concat([_I.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new WI({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),NI.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),EI.configure({device:n.deviceRef}),wI.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),bI.configure({fonts:n.fonts,defaultPreset:xi(t,"default"),defaultFont:n.defaultFont}),vI,SI,xI,CI,kI,AI,zI,MI,TI.configure({wrapperRef:n.wrapperRef}),FI.configure({preset:xi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),BI])}class HI{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class cy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class kn extends cy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=kn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,kn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,o=u;continue}if(u.tagName==="BR"&&o&&o?.tagName!=="BR"){u.remove(),o=u;continue}if(u.tagName==="BR"){const f=this.dom.createElement("p");f.append(u),a(f),i=null,o=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),o=u}e.append(t),this._removeStyleProperties(e,kn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,kn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return kn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return kn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(u)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class VI extends cy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==ie.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(de.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===ie.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>ay.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===ie.TEXT&&this._includesMarkType(e,de.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class El{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new kn({content:e,parser:t.parser||new HI})}static _buildJson(e){return new VI({content:e})}static normalize(e,t={}){return El.build(e,t).normalize()}}class Ki{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class hh{static build({config:e,nodeDomParser:t}){const r=$I({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:sa(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:sa(wf.DESKTOP),pageBlocksRef:sa([]),wrapperRef:Ki.document.createElement("p")}),i=vM(r);return new hh({schema:i,domParser:Mc.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=El.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}class fy{static doc(e){return{type:ie.DOCUMENT,content:e}}static list(e,t){return{type:ie.LIST,attrs:{bullet:{type:e}},content:t.map(r=>r.type===ie.LIST_ITEM?r:this.listItem([].concat(r)))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{type:ie.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[].concat(r).map(o=>typeof o=="string"?this.paragraph(o):o)}}static heading(e,...t){const r=this._textBlock(t,this.text);return r.attrs??={},r.attrs.level=e,{type:ie.HEADING,...r}}static paragraph(...e){return{type:ie.PARAGRAPH,...this._textBlock(e,this.text)}}static _textBlock(e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:r,...t?{attrs:t}:{},...i?{marks:i}:{}}}static _normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:ie.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(de.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class WI{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Ki.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of wf.values)for(const u of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${f}, inherit);`,i&&!de.attributes.includes(u)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===wf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class dh{static _instance;static get instance(){return this._instance??=new dh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class hy{static createWindow(){return new Kp.JSDOM().window}types;parse(e){const{window:t}=new Kp.JSDOM(e);return this.types=t,t.document}}class dy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){}}class UI extends dy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:qp.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Ki.use(hy.createWindow());const i=qp.resolve(process.cwd(),t),o=hh.build({config:require(i).editor,nodeDomParser:new hy}),a=e.map(h=>o.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,f=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(f):f)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var qI="4.9.2";class KI extends dy{name="version";description="display cli version";doCommand(){this.output(qI)}}const py=new h5,GI=[UI,KI];for(const n of GI)new n().install(py);py.parse();