@zipify/wysiwyg 4.11.5 → 4.12.0-beta.1

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,4 +1,4 @@
1
- "use strict";var NC=require("node:events"),RC=require("node:child_process"),LC=require("node:path"),PC=require("node:fs"),DC=require("node:process"),im=require("path"),sm=require("jsdom"),Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function FC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ot={},Wo={},Vo={},om;function Uo(){if(om)return Vo;om=1;class n extends Error{constructor(r,i,s){super(s),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 Vo.CommanderError=n,Vo.InvalidArgumentError=e,Vo}var am;function uc(){if(am)return Wo;am=1;const{InvalidArgumentError:n}=Uo();class e{constructor(i,s){switch(this.description=s||"",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,s){return s===this.defaultValue||!Array.isArray(s)?[i]:s.concat(i)}default(i,s){return this.defaultValue=i,this.defaultValueDescription=s,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(s,a)=>{if(!this.argChoices.includes(s))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(s,a):s},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 Wo.Argument=e,Wo.humanReadableArgName=t,Wo}var qo={},Ko={},lm;function um(){if(lm)return Ko;lm=1;const{humanReadableArgName:n}=uc();class e{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(i){this.helpWidth=this.helpWidth??i.helpWidth??80}visibleCommands(i){const s=i.commands.filter(u=>!u._hidden),a=i._getHelpCommand();return a&&!a._hidden&&s.push(a),this.sortSubcommands&&s.sort((u,c)=>u.name().localeCompare(c.name())),s}compareOptions(i,s){const a=u=>u.short?u.short.replace(/^-/,""):u.long.replace(/^--/,"");return a(i).localeCompare(a(s))}visibleOptions(i){const s=i.options.filter(u=>!u.hidden),a=i._getHelpOption();if(a&&!a.hidden){const u=a.short&&i._findOption(a.short),c=a.long&&i._findOption(a.long);!u&&!c?s.push(a):a.long&&!c?s.push(i.createOption(a.long,a.description)):a.short&&!u&&s.push(i.createOption(a.short,a.description))}return this.sortOptions&&s.sort(this.compareOptions),s}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];const s=[];for(let a=i.parent;a;a=a.parent){const u=a.options.filter(c=>!c.hidden);s.push(...u)}return this.sortOptions&&s.sort(this.compareOptions),s}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(s=>{s.description=s.description||i._argsDescription[s.name()]||""}),i.registeredArguments.find(s=>s.description)?i.registeredArguments:[]}subcommandTerm(i){const s=i.registeredArguments.map(a=>n(a)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(s?" "+s:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,s){return s.visibleCommands(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleSubcommandTerm(s.subcommandTerm(u)))),0)}longestOptionTermLength(i,s){return s.visibleOptions(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleOptionTerm(s.optionTerm(u)))),0)}longestGlobalOptionTermLength(i,s){return s.visibleGlobalOptions(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleOptionTerm(s.optionTerm(u)))),0)}longestArgumentTermLength(i,s){return s.visibleArguments(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleArgumentTerm(s.argumentTerm(u)))),0)}commandUsage(i){let s=i._name;i._aliases[0]&&(s=s+"|"+i._aliases[0]);let a="";for(let u=i.parent;u;u=u.parent)a=u.name()+" "+a;return a+s+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){const s=[];return i.argChoices&&s.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&s.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&s.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&s.push(`env: ${i.envVar}`),s.length>0?`${i.description} (${s.join(", ")})`:i.description}argumentDescription(i){const s=[];if(i.argChoices&&s.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&s.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),s.length>0){const a=`(${s.join(", ")})`;return i.description?`${i.description} ${a}`:a}return i.description}formatHelp(i,s){const a=s.padWidth(i,s),u=s.helpWidth??80;function c(S,E){return s.formatItem(S,a,E,s)}let h=[`${s.styleTitle("Usage:")} ${s.styleUsage(s.commandUsage(i))}`,""];const p=s.commandDescription(i);p.length>0&&(h=h.concat([s.boxWrap(s.styleCommandDescription(p),u),""]));const m=s.visibleArguments(i).map(S=>c(s.styleArgumentTerm(s.argumentTerm(S)),s.styleArgumentDescription(s.argumentDescription(S))));m.length>0&&(h=h.concat([s.styleTitle("Arguments:"),...m,""]));const y=s.visibleOptions(i).map(S=>c(s.styleOptionTerm(s.optionTerm(S)),s.styleOptionDescription(s.optionDescription(S))));if(y.length>0&&(h=h.concat([s.styleTitle("Options:"),...y,""])),s.showGlobalOptions){const S=s.visibleGlobalOptions(i).map(E=>c(s.styleOptionTerm(s.optionTerm(E)),s.styleOptionDescription(s.optionDescription(E))));S.length>0&&(h=h.concat([s.styleTitle("Global Options:"),...S,""]))}const _=s.visibleCommands(i).map(S=>c(s.styleSubcommandTerm(s.subcommandTerm(S)),s.styleSubcommandDescription(s.subcommandDescription(S))));return _.length>0&&(h=h.concat([s.styleTitle("Commands:"),..._,""])),h.join(`
1
+ "use strict";var RC=require("node:events"),LC=require("node:child_process"),PC=require("node:path"),DC=require("node:fs"),FC=require("node:process"),im=require("path"),sm=require("jsdom"),Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function BC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ot={},Wo={},Vo={},om;function Uo(){if(om)return Vo;om=1;class n extends Error{constructor(r,i,s){super(s),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 Vo.CommanderError=n,Vo.InvalidArgumentError=e,Vo}var am;function uc(){if(am)return Wo;am=1;const{InvalidArgumentError:n}=Uo();class e{constructor(i,s){switch(this.description=s||"",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,s){return s===this.defaultValue||!Array.isArray(s)?[i]:s.concat(i)}default(i,s){return this.defaultValue=i,this.defaultValueDescription=s,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(s,a)=>{if(!this.argChoices.includes(s))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(s,a):s},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 Wo.Argument=e,Wo.humanReadableArgName=t,Wo}var qo={},Ko={},lm;function um(){if(lm)return Ko;lm=1;const{humanReadableArgName:n}=uc();class e{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(i){this.helpWidth=this.helpWidth??i.helpWidth??80}visibleCommands(i){const s=i.commands.filter(u=>!u._hidden),a=i._getHelpCommand();return a&&!a._hidden&&s.push(a),this.sortSubcommands&&s.sort((u,c)=>u.name().localeCompare(c.name())),s}compareOptions(i,s){const a=u=>u.short?u.short.replace(/^-/,""):u.long.replace(/^--/,"");return a(i).localeCompare(a(s))}visibleOptions(i){const s=i.options.filter(u=>!u.hidden),a=i._getHelpOption();if(a&&!a.hidden){const u=a.short&&i._findOption(a.short),c=a.long&&i._findOption(a.long);!u&&!c?s.push(a):a.long&&!c?s.push(i.createOption(a.long,a.description)):a.short&&!u&&s.push(i.createOption(a.short,a.description))}return this.sortOptions&&s.sort(this.compareOptions),s}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];const s=[];for(let a=i.parent;a;a=a.parent){const u=a.options.filter(c=>!c.hidden);s.push(...u)}return this.sortOptions&&s.sort(this.compareOptions),s}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(s=>{s.description=s.description||i._argsDescription[s.name()]||""}),i.registeredArguments.find(s=>s.description)?i.registeredArguments:[]}subcommandTerm(i){const s=i.registeredArguments.map(a=>n(a)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(s?" "+s:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,s){return s.visibleCommands(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleSubcommandTerm(s.subcommandTerm(u)))),0)}longestOptionTermLength(i,s){return s.visibleOptions(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleOptionTerm(s.optionTerm(u)))),0)}longestGlobalOptionTermLength(i,s){return s.visibleGlobalOptions(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleOptionTerm(s.optionTerm(u)))),0)}longestArgumentTermLength(i,s){return s.visibleArguments(i).reduce((a,u)=>Math.max(a,this.displayWidth(s.styleArgumentTerm(s.argumentTerm(u)))),0)}commandUsage(i){let s=i._name;i._aliases[0]&&(s=s+"|"+i._aliases[0]);let a="";for(let u=i.parent;u;u=u.parent)a=u.name()+" "+a;return a+s+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){const s=[];return i.argChoices&&s.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&s.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&s.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&s.push(`env: ${i.envVar}`),s.length>0?`${i.description} (${s.join(", ")})`:i.description}argumentDescription(i){const s=[];if(i.argChoices&&s.push(`choices: ${i.argChoices.map(a=>JSON.stringify(a)).join(", ")}`),i.defaultValue!==void 0&&s.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),s.length>0){const a=`(${s.join(", ")})`;return i.description?`${i.description} ${a}`:a}return i.description}formatHelp(i,s){const a=s.padWidth(i,s),u=s.helpWidth??80;function c(S,E){return s.formatItem(S,a,E,s)}let h=[`${s.styleTitle("Usage:")} ${s.styleUsage(s.commandUsage(i))}`,""];const p=s.commandDescription(i);p.length>0&&(h=h.concat([s.boxWrap(s.styleCommandDescription(p),u),""]));const m=s.visibleArguments(i).map(S=>c(s.styleArgumentTerm(s.argumentTerm(S)),s.styleArgumentDescription(s.argumentDescription(S))));m.length>0&&(h=h.concat([s.styleTitle("Arguments:"),...m,""]));const y=s.visibleOptions(i).map(S=>c(s.styleOptionTerm(s.optionTerm(S)),s.styleOptionDescription(s.optionDescription(S))));if(y.length>0&&(h=h.concat([s.styleTitle("Options:"),...y,""])),s.showGlobalOptions){const S=s.visibleGlobalOptions(i).map(E=>c(s.styleOptionTerm(s.optionTerm(E)),s.styleOptionDescription(s.optionDescription(E))));S.length>0&&(h=h.concat([s.styleTitle("Global Options:"),...S,""]))}const _=s.visibleCommands(i).map(S=>c(s.styleSubcommandTerm(s.subcommandTerm(S)),s.styleSubcommandDescription(s.subcommandDescription(S))));return _.length>0&&(h=h.concat([s.styleTitle("Commands:"),..._,""])),h.join(`
2
2
  `)}displayWidth(i){return t(i).length}styleTitle(i){return i}styleUsage(i){return i.split(" ").map(s=>s==="[options]"?this.styleOptionText(s):s==="[command]"?this.styleSubcommandText(s):s[0]==="["||s[0]==="<"?this.styleArgumentText(s):this.styleCommandText(s)).join(" ")}styleCommandDescription(i){return this.styleDescriptionText(i)}styleOptionDescription(i){return this.styleDescriptionText(i)}styleSubcommandDescription(i){return this.styleDescriptionText(i)}styleArgumentDescription(i){return this.styleDescriptionText(i)}styleDescriptionText(i){return i}styleOptionTerm(i){return this.styleOptionText(i)}styleSubcommandTerm(i){return i.split(" ").map(s=>s==="[options]"?this.styleOptionText(s):s[0]==="["||s[0]==="<"?this.styleArgumentText(s):this.styleSubcommandText(s)).join(" ")}styleArgumentTerm(i){return this.styleArgumentText(i)}styleOptionText(i){return i}styleArgumentText(i){return i}styleSubcommandText(i){return i}styleCommandText(i){return i}padWidth(i,s){return Math.max(s.longestOptionTermLength(i,s),s.longestGlobalOptionTermLength(i,s),s.longestSubcommandTermLength(i,s),s.longestArgumentTermLength(i,s))}preformatted(i){return/\n[^\S\r\n]/.test(i)}formatItem(i,s,a,u){const h=" ".repeat(2);if(!a)return h+i;const p=i.padEnd(s+i.length-u.displayWidth(i)),m=2,_=(this.helpWidth??80)-s-m-2;let S;return _<this.minWidthToWrap||u.preformatted(a)?S=a:S=u.boxWrap(a,_).replace(/\n/g,`
3
3
  `+" ".repeat(s+m)),h+p+" ".repeat(m)+S.replace(/\n/g,`
4
4
  ${h}`)}boxWrap(i,s){if(s<this.minWidthToWrap)return i;const a=i.split(/\r\n|\n/),u=/[\s]*[^\s]+/g,c=[];return a.forEach(h=>{const p=h.match(u);if(p===null){c.push("");return}let m=[p.shift()],y=this.displayWidth(m[0]);p.forEach(_=>{const S=this.displayWidth(_);if(y+S<=s){m.push(_),y+=S;return}c.push(m.join(""));const E=_.trimStart();m=[E],y=this.displayWidth(E)}),c.push(m.join(""))}),c.join(`
@@ -8,57 +8,57 @@ ${h}`)}boxWrap(i,s){if(s<this.minWidthToWrap)return i;const a=i.split(/\r\n|\n/)
8
8
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):c.test(m)?new Error(`${y}
9
9
  - too many short flags`):h.test(m)?new Error(`${y}
10
10
  - too many long flags`):new Error(`${y}
11
- - unrecognised flag format`)}if(a===void 0&&u===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:a,longFlag:u}}return Go.Option=e,Go.DualOptions=t,Go}var cc={},hm;function BC(){if(hm)return cc;hm=1;const n=3;function e(r,i){if(Math.abs(r.length-i.length)>n)return Math.max(r.length,i.length);const s=[];for(let a=0;a<=r.length;a++)s[a]=[a];for(let a=0;a<=i.length;a++)s[0][a]=a;for(let a=1;a<=i.length;a++)for(let u=1;u<=r.length;u++){let c=1;r[u-1]===i[a-1]?c=0:c=1,s[u][a]=Math.min(s[u-1][a]+1,s[u][a-1]+1,s[u-1][a-1]+c),u>1&&a>1&&r[u-1]===i[a-2]&&r[u-2]===i[a-1]&&(s[u][a]=Math.min(s[u][a],s[u-2][a-2]+1))}return s[r.length][i.length]}function t(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const s=r.startsWith("--");s&&(r=r.slice(2),i=i.map(h=>h.slice(2)));let a=[],u=n;const c=.4;return i.forEach(h=>{if(h.length<=1)return;const p=e(r,h),m=Math.max(r.length,h.length);(m-p)/m>c&&(p<u?(u=p,a=[h]):p===u&&a.push(h))}),a.sort((h,p)=>h.localeCompare(p)),s&&(a=a.map(h=>`--${h}`)),a.length>1?`
11
+ - unrecognised flag format`)}if(a===void 0&&u===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:a,longFlag:u}}return Go.Option=e,Go.DualOptions=t,Go}var cc={},hm;function zC(){if(hm)return cc;hm=1;const n=3;function e(r,i){if(Math.abs(r.length-i.length)>n)return Math.max(r.length,i.length);const s=[];for(let a=0;a<=r.length;a++)s[a]=[a];for(let a=0;a<=i.length;a++)s[0][a]=a;for(let a=1;a<=i.length;a++)for(let u=1;u<=r.length;u++){let c=1;r[u-1]===i[a-1]?c=0:c=1,s[u][a]=Math.min(s[u-1][a]+1,s[u][a-1]+1,s[u-1][a-1]+c),u>1&&a>1&&r[u-1]===i[a-2]&&r[u-2]===i[a-1]&&(s[u][a]=Math.min(s[u][a],s[u-2][a-2]+1))}return s[r.length][i.length]}function t(r,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const s=r.startsWith("--");s&&(r=r.slice(2),i=i.map(h=>h.slice(2)));let a=[],u=n;const c=.4;return i.forEach(h=>{if(h.length<=1)return;const p=e(r,h),m=Math.max(r.length,h.length);(m-p)/m>c&&(p<u?(u=p,a=[h]):p===u&&a.push(h))}),a.sort((h,p)=>h.localeCompare(p)),s&&(a=a.map(h=>`--${h}`)),a.length>1?`
12
12
  (Did you mean one of ${a.join(", ")}?)`:a.length===1?`
13
- (Did you mean ${a[0]}?)`:""}return cc.suggestSimilar=t,cc}var dm;function zC(){if(dm)return qo;dm=1;const n=NC.EventEmitter,e=RC,t=LC,r=PC,i=DC,{Argument:s,humanReadableArgName:a}=uc(),{CommanderError:u}=Uo(),{Help:c,stripColor:h}=um(),{Option:p,DualOptions:m}=fm(),{suggestSimilar:y}=BC();class _ extends n{constructor(g){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:v=>i.stdout.write(v),writeErr:v=>i.stderr.write(v),outputError:(v,k)=>k(v),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,getOutHasColors:()=>E()??(i.stdout.isTTY&&i.stdout.hasColors?.()),getErrHasColors:()=>E()??(i.stderr.isTTY&&i.stderr.hasColors?.()),stripColor:v=>h(v)},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 v=this;v;v=v.parent)g.push(v);return g}command(g,v,k){let A=v,T=k;typeof A=="object"&&A!==null&&(T=A,A=null),T=T||{};const[,F,U]=g.match(/([^ ]+) *(.*)/),H=this.createCommand(F);return A&&(H.description(A),H._executableHandler=!0),T.isDefault&&(this._defaultCommandName=H._name),H._hidden=!!(T.noHelp||T.hidden),H._executableFile=T.executableFile||null,U&&H.arguments(U),this._registerCommand(H),H.parent=this,H.copyInheritedSettings(this),A?this:H}createCommand(g){return new _(g)}createHelp(){return Object.assign(new c,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,v){if(!g._name)throw new Error(`Command passed to .addCommand() must have a name
14
- - specify the name in Command constructor or using .name()`);return v=v||{},v.isDefault&&(this._defaultCommandName=g._name),(v.noHelp||v.hidden)&&(g._hidden=!0),this._registerCommand(g),g.parent=this,g._checkForBrokenPassThrough(),this}createArgument(g,v){return new s(g,v)}argument(g,v,k,A){const T=this.createArgument(g,v);return typeof k=="function"?T.default(A).argParser(k):T.default(k),this.addArgument(T),this}arguments(g){return g.trim().split(/ +/).forEach(v=>{this.argument(v)}),this}addArgument(g){const v=this.registeredArguments.slice(-1)[0];if(v&&v.variadic)throw new Error(`only the last argument can be variadic '${v.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,v){if(typeof g=="boolean")return this._addImplicitHelpCommand=g,this;g=g??"help [command]";const[,k,A]=g.match(/([^ ]+) *(.*)/),T=v??"display help for command",F=this.createCommand(k);return F.helpOption(!1),A&&F.arguments(A),T&&F.description(T),this._addImplicitHelpCommand=!0,this._helpCommand=F,this}addHelpCommand(g,v){return typeof g!="object"?(this.helpCommand(g,v),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,v){const k=["preSubcommand","preAction","postAction"];if(!k.includes(g))throw new Error(`Unexpected value for event passed to hook : '${g}'.
15
- Expecting one of '${k.join("', '")}'`);return this._lifeCycleHooks[g]?this._lifeCycleHooks[g].push(v):this._lifeCycleHooks[g]=[v],this}exitOverride(g){return g?this._exitCallback=g:this._exitCallback=v=>{if(v.code!=="commander.executeSubCommandAsync")throw v},this}_exit(g,v,k){this._exitCallback&&this._exitCallback(new u(g,v,k)),i.exit(g)}action(g){const v=k=>{const A=this.registeredArguments.length,T=k.slice(0,A);return this._storeOptionsAsProperties?T[A]=this:T[A]=this.opts(),T.push(this),g.apply(this,T)};return this._actionHandler=v,this}createOption(g,v){return new p(g,v)}_callParseArg(g,v,k,A){try{return g.parseArg(v,k)}catch(T){if(T.code==="commander.invalidArgument"){const F=`${A} ${T.message}`;this.error(F,{exitCode:T.exitCode,code:T.code})}throw T}}_registerOption(g){const v=g.short&&this._findOption(g.short)||g.long&&this._findOption(g.long);if(v){const k=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 '${k}'
16
- - already used by option '${v.flags}'`)}this.options.push(g)}_registerCommand(g){const v=A=>[A.name()].concat(A.aliases()),k=v(g).find(A=>this._findCommand(A));if(k){const A=v(this._findCommand(k)).join("|"),T=v(g).join("|");throw new Error(`cannot add command '${T}' as already have command '${A}'`)}this.commands.push(g)}addOption(g){this._registerOption(g);const v=g.name(),k=g.attributeName();if(g.negate){const T=g.long.replace(/^--no-/,"--");this._findOption(T)||this.setOptionValueWithSource(k,g.defaultValue===void 0?!0:g.defaultValue,"default")}else g.defaultValue!==void 0&&this.setOptionValueWithSource(k,g.defaultValue,"default");const A=(T,F,U)=>{T==null&&g.presetArg!==void 0&&(T=g.presetArg);const H=this.getOptionValue(k);T!==null&&g.parseArg?T=this._callParseArg(g,T,H,F):T!==null&&g.variadic&&(T=g._concatValue(T,H)),T==null&&(g.negate?T=!1:g.isBoolean()||g.optional?T=!0:T=""),this.setOptionValueWithSource(k,T,U)};return this.on("option:"+v,T=>{const F=`error: option '${g.flags}' argument '${T}' is invalid.`;A(T,F,"cli")}),g.envVar&&this.on("optionEnv:"+v,T=>{const F=`error: option '${g.flags}' value '${T}' from env '${g.envVar}' is invalid.`;A(T,F,"env")}),this}_optionEx(g,v,k,A,T){if(typeof v=="object"&&v instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const F=this.createOption(v,k);if(F.makeOptionMandatory(!!g.mandatory),typeof A=="function")F.default(T).argParser(A);else if(A instanceof RegExp){const U=A;A=(H,ee)=>{const te=U.exec(H);return te?te[0]:ee},F.default(T).argParser(A)}else F.default(A);return this.addOption(F)}option(g,v,k,A){return this._optionEx({},g,v,k,A)}requiredOption(g,v,k,A){return this._optionEx({mandatory:!0},g,v,k,A)}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,v){return this.setOptionValueWithSource(g,v,void 0)}setOptionValueWithSource(g,v,k){return this._storeOptionsAsProperties?this[g]=v:this._optionValues[g]=v,this._optionValueSources[g]=k,this}getOptionValueSource(g){return this._optionValueSources[g]}getOptionValueSourceWithGlobals(g){let v;return this._getCommandAndAncestors().forEach(k=>{k.getOptionValueSource(g)!==void 0&&(v=k.getOptionValueSource(g))}),v}_prepareUserArgs(g,v){if(g!==void 0&&!Array.isArray(g))throw new Error("first parameter to parse must be array or undefined");if(v=v||{},g===void 0&&v.from===void 0){i.versions?.electron&&(v.from="electron");const A=i.execArgv??[];(A.includes("-e")||A.includes("--eval")||A.includes("-p")||A.includes("--print"))&&(v.from="eval")}g===void 0&&(g=i.argv),this.rawArgs=g.slice();let k;switch(v.from){case void 0:case"node":this._scriptPath=g[1],k=g.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=g[1],k=g.slice(2)):k=g.slice(1);break;case"user":k=g.slice(0);break;case"eval":k=g.slice(1);break;default:throw new Error(`unexpected parse option { from: '${v.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",k}parse(g,v){this._prepareForParse();const k=this._prepareUserArgs(g,v);return this._parseCommand([],k),this}async parseAsync(g,v){this._prepareForParse();const k=this._prepareUserArgs(g,v);return await this._parseCommand([],k),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
17
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(g,v,k){if(r.existsSync(g))return;const A=v?`searched for local subcommand relative to directory '${v}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",T=`'${g}' does not exist
13
+ (Did you mean ${a[0]}?)`:""}return cc.suggestSimilar=t,cc}var dm;function $C(){if(dm)return qo;dm=1;const n=RC.EventEmitter,e=LC,t=PC,r=DC,i=FC,{Argument:s,humanReadableArgName:a}=uc(),{CommanderError:u}=Uo(),{Help:c,stripColor:h}=um(),{Option:p,DualOptions:m}=fm(),{suggestSimilar:y}=zC();class _ extends n{constructor(g){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,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._savedState=null,this._outputConfiguration={writeOut:v=>i.stdout.write(v),writeErr:v=>i.stderr.write(v),outputError:(v,k)=>k(v),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,getOutHasColors:()=>E()??(i.stdout.isTTY&&i.stdout.hasColors?.()),getErrHasColors:()=>E()??(i.stderr.isTTY&&i.stderr.hasColors?.()),stripColor:v=>h(v)},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 v=this;v;v=v.parent)g.push(v);return g}command(g,v,k){let T=v,A=k;typeof T=="object"&&T!==null&&(A=T,T=null),A=A||{};const[,F,U]=g.match(/([^ ]+) *(.*)/),V=this.createCommand(F);return T&&(V.description(T),V._executableHandler=!0),A.isDefault&&(this._defaultCommandName=V._name),V._hidden=!!(A.noHelp||A.hidden),V._executableFile=A.executableFile||null,U&&V.arguments(U),this._registerCommand(V),V.parent=this,V.copyInheritedSettings(this),T?this:V}createCommand(g){return new _(g)}createHelp(){return Object.assign(new c,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,v){if(!g._name)throw new Error(`Command passed to .addCommand() must have a name
14
+ - specify the name in Command constructor or using .name()`);return v=v||{},v.isDefault&&(this._defaultCommandName=g._name),(v.noHelp||v.hidden)&&(g._hidden=!0),this._registerCommand(g),g.parent=this,g._checkForBrokenPassThrough(),this}createArgument(g,v){return new s(g,v)}argument(g,v,k,T){const A=this.createArgument(g,v);return typeof k=="function"?A.default(T).argParser(k):A.default(k),this.addArgument(A),this}arguments(g){return g.trim().split(/ +/).forEach(v=>{this.argument(v)}),this}addArgument(g){const v=this.registeredArguments.slice(-1)[0];if(v&&v.variadic)throw new Error(`only the last argument can be variadic '${v.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,v){if(typeof g=="boolean")return this._addImplicitHelpCommand=g,this;g=g??"help [command]";const[,k,T]=g.match(/([^ ]+) *(.*)/),A=v??"display help for command",F=this.createCommand(k);return F.helpOption(!1),T&&F.arguments(T),A&&F.description(A),this._addImplicitHelpCommand=!0,this._helpCommand=F,this}addHelpCommand(g,v){return typeof g!="object"?(this.helpCommand(g,v),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,v){const k=["preSubcommand","preAction","postAction"];if(!k.includes(g))throw new Error(`Unexpected value for event passed to hook : '${g}'.
15
+ Expecting one of '${k.join("', '")}'`);return this._lifeCycleHooks[g]?this._lifeCycleHooks[g].push(v):this._lifeCycleHooks[g]=[v],this}exitOverride(g){return g?this._exitCallback=g:this._exitCallback=v=>{if(v.code!=="commander.executeSubCommandAsync")throw v},this}_exit(g,v,k){this._exitCallback&&this._exitCallback(new u(g,v,k)),i.exit(g)}action(g){const v=k=>{const T=this.registeredArguments.length,A=k.slice(0,T);return this._storeOptionsAsProperties?A[T]=this:A[T]=this.opts(),A.push(this),g.apply(this,A)};return this._actionHandler=v,this}createOption(g,v){return new p(g,v)}_callParseArg(g,v,k,T){try{return g.parseArg(v,k)}catch(A){if(A.code==="commander.invalidArgument"){const F=`${T} ${A.message}`;this.error(F,{exitCode:A.exitCode,code:A.code})}throw A}}_registerOption(g){const v=g.short&&this._findOption(g.short)||g.long&&this._findOption(g.long);if(v){const k=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 '${k}'
16
+ - already used by option '${v.flags}'`)}this.options.push(g)}_registerCommand(g){const v=T=>[T.name()].concat(T.aliases()),k=v(g).find(T=>this._findCommand(T));if(k){const T=v(this._findCommand(k)).join("|"),A=v(g).join("|");throw new Error(`cannot add command '${A}' as already have command '${T}'`)}this.commands.push(g)}addOption(g){this._registerOption(g);const v=g.name(),k=g.attributeName();if(g.negate){const A=g.long.replace(/^--no-/,"--");this._findOption(A)||this.setOptionValueWithSource(k,g.defaultValue===void 0?!0:g.defaultValue,"default")}else g.defaultValue!==void 0&&this.setOptionValueWithSource(k,g.defaultValue,"default");const T=(A,F,U)=>{A==null&&g.presetArg!==void 0&&(A=g.presetArg);const V=this.getOptionValue(k);A!==null&&g.parseArg?A=this._callParseArg(g,A,V,F):A!==null&&g.variadic&&(A=g._concatValue(A,V)),A==null&&(g.negate?A=!1:g.isBoolean()||g.optional?A=!0:A=""),this.setOptionValueWithSource(k,A,U)};return this.on("option:"+v,A=>{const F=`error: option '${g.flags}' argument '${A}' is invalid.`;T(A,F,"cli")}),g.envVar&&this.on("optionEnv:"+v,A=>{const F=`error: option '${g.flags}' value '${A}' from env '${g.envVar}' is invalid.`;T(A,F,"env")}),this}_optionEx(g,v,k,T,A){if(typeof v=="object"&&v instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const F=this.createOption(v,k);if(F.makeOptionMandatory(!!g.mandatory),typeof T=="function")F.default(A).argParser(T);else if(T instanceof RegExp){const U=T;T=(V,ee)=>{const te=U.exec(V);return te?te[0]:ee},F.default(A).argParser(T)}else F.default(T);return this.addOption(F)}option(g,v,k,T){return this._optionEx({},g,v,k,T)}requiredOption(g,v,k,T){return this._optionEx({mandatory:!0},g,v,k,T)}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,v){return this.setOptionValueWithSource(g,v,void 0)}setOptionValueWithSource(g,v,k){return this._storeOptionsAsProperties?this[g]=v:this._optionValues[g]=v,this._optionValueSources[g]=k,this}getOptionValueSource(g){return this._optionValueSources[g]}getOptionValueSourceWithGlobals(g){let v;return this._getCommandAndAncestors().forEach(k=>{k.getOptionValueSource(g)!==void 0&&(v=k.getOptionValueSource(g))}),v}_prepareUserArgs(g,v){if(g!==void 0&&!Array.isArray(g))throw new Error("first parameter to parse must be array or undefined");if(v=v||{},g===void 0&&v.from===void 0){i.versions?.electron&&(v.from="electron");const T=i.execArgv??[];(T.includes("-e")||T.includes("--eval")||T.includes("-p")||T.includes("--print"))&&(v.from="eval")}g===void 0&&(g=i.argv),this.rawArgs=g.slice();let k;switch(v.from){case void 0:case"node":this._scriptPath=g[1],k=g.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=g[1],k=g.slice(2)):k=g.slice(1);break;case"user":k=g.slice(0);break;case"eval":k=g.slice(1);break;default:throw new Error(`unexpected parse option { from: '${v.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",k}parse(g,v){this._prepareForParse();const k=this._prepareUserArgs(g,v);return this._parseCommand([],k),this}async parseAsync(g,v){this._prepareForParse();const k=this._prepareUserArgs(g,v);return await this._parseCommand([],k),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
17
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(g,v,k){if(r.existsSync(g))return;const T=v?`searched for local subcommand relative to directory '${v}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",A=`'${g}' does not exist
18
18
  - if '${k}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
19
19
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
20
- - ${A}`;throw new Error(T)}_executeSubCommand(g,v){v=v.slice();let k=!1;const A=[".js",".ts",".tsx",".mjs",".cjs"];function T(te,Se){const wt=t.resolve(te,Se);if(r.existsSync(wt))return wt;if(A.includes(t.extname(Se)))return;const Sn=A.find(Dt=>r.existsSync(`${wt}${Dt}`));if(Sn)return`${wt}${Sn}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let F=g._executableFile||`${this._name}-${g._name}`,U=this._executableDir||"";if(this._scriptPath){let te;try{te=r.realpathSync(this._scriptPath)}catch{te=this._scriptPath}U=t.resolve(t.dirname(te),U)}if(U){let te=T(U,F);if(!te&&!g._executableFile&&this._scriptPath){const Se=t.basename(this._scriptPath,t.extname(this._scriptPath));Se!==this._name&&(te=T(U,`${Se}-${g._name}`))}F=te||F}k=A.includes(t.extname(F));let H;i.platform!=="win32"?k?(v.unshift(F),v=S(i.execArgv).concat(v),H=e.spawn(i.argv[0],v,{stdio:"inherit"})):H=e.spawn(F,v,{stdio:"inherit"}):(this._checkForMissingExecutable(F,U,g._name),v.unshift(F),v=S(i.execArgv).concat(v),H=e.spawn(i.execPath,v,{stdio:"inherit"})),H.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(Se=>{i.on(Se,()=>{H.killed===!1&&H.exitCode===null&&H.kill(Se)})});const ee=this._exitCallback;H.on("close",te=>{te=te??1,ee?ee(new u(te,"commander.executeSubCommandAsync","(close)")):i.exit(te)}),H.on("error",te=>{if(te.code==="ENOENT")this._checkForMissingExecutable(F,U,g._name);else if(te.code==="EACCES")throw new Error(`'${F}' not executable`);if(!ee)i.exit(1);else{const Se=new u(1,"commander.executeSubCommandAsync","(error)");Se.nestedError=te,ee(Se)}}),this.runningCommand=H}_dispatchSubcommand(g,v,k){const A=this._findCommand(g);A||this.help({error:!0}),A._prepareForParse();let T;return T=this._chainOrCallSubCommandHook(T,A,"preSubcommand"),T=this._chainOrCall(T,()=>{if(A._executableHandler)this._executeSubCommand(A,v.concat(k));else return A._parseCommand(v,k)}),T}_dispatchHelpCommand(g){g||this.help();const v=this._findCommand(g);return v&&!v._executableHandler&&v.help(),this._dispatchSubcommand(g,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((g,v)=>{g.required&&this.args[v]==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=(k,A,T)=>{let F=A;if(A!==null&&k.parseArg){const U=`error: command-argument value '${A}' is invalid for argument '${k.name()}'.`;F=this._callParseArg(k,A,T,U)}return F};this._checkNumberOfArguments();const v=[];this.registeredArguments.forEach((k,A)=>{let T=k.defaultValue;k.variadic?A<this.args.length?(T=this.args.slice(A),k.parseArg&&(T=T.reduce((F,U)=>g(k,U,F),k.defaultValue))):T===void 0&&(T=[]):A<this.args.length&&(T=this.args[A],k.parseArg&&(T=g(k,T,k.defaultValue))),v[A]=T}),this.processedArgs=v}_chainOrCall(g,v){return g&&g.then&&typeof g.then=="function"?g.then(()=>v()):v()}_chainOrCallHooks(g,v){let k=g;const A=[];return this._getCommandAndAncestors().reverse().filter(T=>T._lifeCycleHooks[v]!==void 0).forEach(T=>{T._lifeCycleHooks[v].forEach(F=>{A.push({hookedCommand:T,callback:F})})}),v==="postAction"&&A.reverse(),A.forEach(T=>{k=this._chainOrCall(k,()=>T.callback(T.hookedCommand,this))}),k}_chainOrCallSubCommandHook(g,v,k){let A=g;return this._lifeCycleHooks[k]!==void 0&&this._lifeCycleHooks[k].forEach(T=>{A=this._chainOrCall(A,()=>T(this,v))}),A}_parseCommand(g,v){const k=this.parseOptions(v);if(this._parseOptionsEnv(),this._parseOptionsImplied(),g=g.concat(k.operands),v=k.unknown,this.args=g.concat(v),g&&this._findCommand(g[0]))return this._dispatchSubcommand(g[0],g.slice(1),v);if(this._getHelpCommand()&&g[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(g[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(v),this._dispatchSubcommand(this._defaultCommandName,g,v);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(k.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const A=()=>{k.unknown.length>0&&this.unknownOption(k.unknown[0])},T=`command:${this.name()}`;if(this._actionHandler){A(),this._processArguments();let F;return F=this._chainOrCallHooks(F,"preAction"),F=this._chainOrCall(F,()=>this._actionHandler(this.processedArgs)),this.parent&&(F=this._chainOrCall(F,()=>{this.parent.emit(T,g,v)})),F=this._chainOrCallHooks(F,"postAction"),F}if(this.parent&&this.parent.listenerCount(T))A(),this._processArguments(),this.parent.emit(T,g,v);else if(g.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",g,v);this.listenerCount("command:*")?this.emit("command:*",g,v):this.commands.length?this.unknownCommand():(A(),this._processArguments())}else this.commands.length?(A(),this.help({error:!0})):(A(),this._processArguments())}_findCommand(g){if(g)return this.commands.find(v=>v._name===g||v._aliases.includes(g))}_findOption(g){return this.options.find(v=>v.is(g))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(g=>{g.options.forEach(v=>{v.mandatory&&g.getOptionValue(v.attributeName())===void 0&&g.missingMandatoryOptionValue(v)})})}_checkForConflictingLocalOptions(){const g=this.options.filter(k=>{const A=k.attributeName();return this.getOptionValue(A)===void 0?!1:this.getOptionValueSource(A)!=="default"});g.filter(k=>k.conflictsWith.length>0).forEach(k=>{const A=g.find(T=>k.conflictsWith.includes(T.attributeName()));A&&this._conflictingOption(k,A)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(g=>{g._checkForConflictingLocalOptions()})}parseOptions(g){const v=[],k=[];let A=v;const T=g.slice();function F(H){return H.length>1&&H[0]==="-"}let U=null;for(;T.length;){const H=T.shift();if(H==="--"){A===k&&A.push(H),A.push(...T);break}if(U&&!F(H)){this.emit(`option:${U.name()}`,H);continue}if(U=null,F(H)){const ee=this._findOption(H);if(ee){if(ee.required){const te=T.shift();te===void 0&&this.optionMissingArgument(ee),this.emit(`option:${ee.name()}`,te)}else if(ee.optional){let te=null;T.length>0&&!F(T[0])&&(te=T.shift()),this.emit(`option:${ee.name()}`,te)}else this.emit(`option:${ee.name()}`);U=ee.variadic?ee:null;continue}}if(H.length>2&&H[0]==="-"&&H[1]!=="-"){const ee=this._findOption(`-${H[1]}`);if(ee){ee.required||ee.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${ee.name()}`,H.slice(2)):(this.emit(`option:${ee.name()}`),T.unshift(`-${H.slice(2)}`));continue}}if(/^--[^=]+=/.test(H)){const ee=H.indexOf("="),te=this._findOption(H.slice(0,ee));if(te&&(te.required||te.optional)){this.emit(`option:${te.name()}`,H.slice(ee+1));continue}}if(F(H)&&(A=k),(this._enablePositionalOptions||this._passThroughOptions)&&v.length===0&&k.length===0){if(this._findCommand(H)){v.push(H),T.length>0&&k.push(...T);break}else if(this._getHelpCommand()&&H===this._getHelpCommand().name()){v.push(H),T.length>0&&v.push(...T);break}else if(this._defaultCommandName){k.push(H),T.length>0&&k.push(...T);break}}if(this._passThroughOptions){A.push(H),T.length>0&&A.push(...T);break}A.push(H)}return{operands:v,unknown:k}}opts(){if(this._storeOptionsAsProperties){const g={},v=this.options.length;for(let k=0;k<v;k++){const A=this.options[k].attributeName();g[A]=A===this._versionOptionName?this._version:this[A]}return g}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((g,v)=>Object.assign(g,v.opts()),{})}error(g,v){this._outputConfiguration.outputError(`${g}
20
+ - ${T}`;throw new Error(A)}_executeSubCommand(g,v){v=v.slice();let k=!1;const T=[".js",".ts",".tsx",".mjs",".cjs"];function A(te,Se){const vt=t.resolve(te,Se);if(r.existsSync(vt))return vt;if(T.includes(t.extname(Se)))return;const Sn=T.find(Ft=>r.existsSync(`${vt}${Ft}`));if(Sn)return`${vt}${Sn}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let F=g._executableFile||`${this._name}-${g._name}`,U=this._executableDir||"";if(this._scriptPath){let te;try{te=r.realpathSync(this._scriptPath)}catch{te=this._scriptPath}U=t.resolve(t.dirname(te),U)}if(U){let te=A(U,F);if(!te&&!g._executableFile&&this._scriptPath){const Se=t.basename(this._scriptPath,t.extname(this._scriptPath));Se!==this._name&&(te=A(U,`${Se}-${g._name}`))}F=te||F}k=T.includes(t.extname(F));let V;i.platform!=="win32"?k?(v.unshift(F),v=S(i.execArgv).concat(v),V=e.spawn(i.argv[0],v,{stdio:"inherit"})):V=e.spawn(F,v,{stdio:"inherit"}):(this._checkForMissingExecutable(F,U,g._name),v.unshift(F),v=S(i.execArgv).concat(v),V=e.spawn(i.execPath,v,{stdio:"inherit"})),V.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(Se=>{i.on(Se,()=>{V.killed===!1&&V.exitCode===null&&V.kill(Se)})});const ee=this._exitCallback;V.on("close",te=>{te=te??1,ee?ee(new u(te,"commander.executeSubCommandAsync","(close)")):i.exit(te)}),V.on("error",te=>{if(te.code==="ENOENT")this._checkForMissingExecutable(F,U,g._name);else if(te.code==="EACCES")throw new Error(`'${F}' not executable`);if(!ee)i.exit(1);else{const Se=new u(1,"commander.executeSubCommandAsync","(error)");Se.nestedError=te,ee(Se)}}),this.runningCommand=V}_dispatchSubcommand(g,v,k){const T=this._findCommand(g);T||this.help({error:!0}),T._prepareForParse();let A;return A=this._chainOrCallSubCommandHook(A,T,"preSubcommand"),A=this._chainOrCall(A,()=>{if(T._executableHandler)this._executeSubCommand(T,v.concat(k));else return T._parseCommand(v,k)}),A}_dispatchHelpCommand(g){g||this.help();const v=this._findCommand(g);return v&&!v._executableHandler&&v.help(),this._dispatchSubcommand(g,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((g,v)=>{g.required&&this.args[v]==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=(k,T,A)=>{let F=T;if(T!==null&&k.parseArg){const U=`error: command-argument value '${T}' is invalid for argument '${k.name()}'.`;F=this._callParseArg(k,T,A,U)}return F};this._checkNumberOfArguments();const v=[];this.registeredArguments.forEach((k,T)=>{let A=k.defaultValue;k.variadic?T<this.args.length?(A=this.args.slice(T),k.parseArg&&(A=A.reduce((F,U)=>g(k,U,F),k.defaultValue))):A===void 0&&(A=[]):T<this.args.length&&(A=this.args[T],k.parseArg&&(A=g(k,A,k.defaultValue))),v[T]=A}),this.processedArgs=v}_chainOrCall(g,v){return g&&g.then&&typeof g.then=="function"?g.then(()=>v()):v()}_chainOrCallHooks(g,v){let k=g;const T=[];return this._getCommandAndAncestors().reverse().filter(A=>A._lifeCycleHooks[v]!==void 0).forEach(A=>{A._lifeCycleHooks[v].forEach(F=>{T.push({hookedCommand:A,callback:F})})}),v==="postAction"&&T.reverse(),T.forEach(A=>{k=this._chainOrCall(k,()=>A.callback(A.hookedCommand,this))}),k}_chainOrCallSubCommandHook(g,v,k){let T=g;return this._lifeCycleHooks[k]!==void 0&&this._lifeCycleHooks[k].forEach(A=>{T=this._chainOrCall(T,()=>A(this,v))}),T}_parseCommand(g,v){const k=this.parseOptions(v);if(this._parseOptionsEnv(),this._parseOptionsImplied(),g=g.concat(k.operands),v=k.unknown,this.args=g.concat(v),g&&this._findCommand(g[0]))return this._dispatchSubcommand(g[0],g.slice(1),v);if(this._getHelpCommand()&&g[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(g[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(v),this._dispatchSubcommand(this._defaultCommandName,g,v);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(k.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const T=()=>{k.unknown.length>0&&this.unknownOption(k.unknown[0])},A=`command:${this.name()}`;if(this._actionHandler){T(),this._processArguments();let F;return F=this._chainOrCallHooks(F,"preAction"),F=this._chainOrCall(F,()=>this._actionHandler(this.processedArgs)),this.parent&&(F=this._chainOrCall(F,()=>{this.parent.emit(A,g,v)})),F=this._chainOrCallHooks(F,"postAction"),F}if(this.parent&&this.parent.listenerCount(A))T(),this._processArguments(),this.parent.emit(A,g,v);else if(g.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",g,v);this.listenerCount("command:*")?this.emit("command:*",g,v):this.commands.length?this.unknownCommand():(T(),this._processArguments())}else this.commands.length?(T(),this.help({error:!0})):(T(),this._processArguments())}_findCommand(g){if(g)return this.commands.find(v=>v._name===g||v._aliases.includes(g))}_findOption(g){return this.options.find(v=>v.is(g))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(g=>{g.options.forEach(v=>{v.mandatory&&g.getOptionValue(v.attributeName())===void 0&&g.missingMandatoryOptionValue(v)})})}_checkForConflictingLocalOptions(){const g=this.options.filter(k=>{const T=k.attributeName();return this.getOptionValue(T)===void 0?!1:this.getOptionValueSource(T)!=="default"});g.filter(k=>k.conflictsWith.length>0).forEach(k=>{const T=g.find(A=>k.conflictsWith.includes(A.attributeName()));T&&this._conflictingOption(k,T)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(g=>{g._checkForConflictingLocalOptions()})}parseOptions(g){const v=[],k=[];let T=v;const A=g.slice();function F(V){return V.length>1&&V[0]==="-"}let U=null;for(;A.length;){const V=A.shift();if(V==="--"){T===k&&T.push(V),T.push(...A);break}if(U&&!F(V)){this.emit(`option:${U.name()}`,V);continue}if(U=null,F(V)){const ee=this._findOption(V);if(ee){if(ee.required){const te=A.shift();te===void 0&&this.optionMissingArgument(ee),this.emit(`option:${ee.name()}`,te)}else if(ee.optional){let te=null;A.length>0&&!F(A[0])&&(te=A.shift()),this.emit(`option:${ee.name()}`,te)}else this.emit(`option:${ee.name()}`);U=ee.variadic?ee:null;continue}}if(V.length>2&&V[0]==="-"&&V[1]!=="-"){const ee=this._findOption(`-${V[1]}`);if(ee){ee.required||ee.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${ee.name()}`,V.slice(2)):(this.emit(`option:${ee.name()}`),A.unshift(`-${V.slice(2)}`));continue}}if(/^--[^=]+=/.test(V)){const ee=V.indexOf("="),te=this._findOption(V.slice(0,ee));if(te&&(te.required||te.optional)){this.emit(`option:${te.name()}`,V.slice(ee+1));continue}}if(F(V)&&(T=k),(this._enablePositionalOptions||this._passThroughOptions)&&v.length===0&&k.length===0){if(this._findCommand(V)){v.push(V),A.length>0&&k.push(...A);break}else if(this._getHelpCommand()&&V===this._getHelpCommand().name()){v.push(V),A.length>0&&v.push(...A);break}else if(this._defaultCommandName){k.push(V),A.length>0&&k.push(...A);break}}if(this._passThroughOptions){T.push(V),A.length>0&&T.push(...A);break}T.push(V)}return{operands:v,unknown:k}}opts(){if(this._storeOptionsAsProperties){const g={},v=this.options.length;for(let k=0;k<v;k++){const T=this.options[k].attributeName();g[T]=T===this._versionOptionName?this._version:this[T]}return g}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((g,v)=>Object.assign(g,v.opts()),{})}error(g,v){this._outputConfiguration.outputError(`${g}
21
21
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
22
22
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
23
- `),this.outputHelp({error:!0}));const k=v||{},A=k.exitCode||1,T=k.code||"commander.error";this._exit(A,T,g)}_parseOptionsEnv(){this.options.forEach(g=>{if(g.envVar&&g.envVar in i.env){const v=g.attributeName();(this.getOptionValue(v)===void 0||["default","config","env"].includes(this.getOptionValueSource(v)))&&(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),v=k=>this.getOptionValue(k)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(k));this.options.filter(k=>k.implied!==void 0&&v(k.attributeName())&&g.valueFromOption(this.getOptionValue(k.attributeName()),k)).forEach(k=>{Object.keys(k.implied).filter(A=>!v(A)).forEach(A=>{this.setOptionValueWithSource(A,k.implied[A],"implied")})})}missingArgument(g){const v=`error: missing required argument '${g}'`;this.error(v,{code:"commander.missingArgument"})}optionMissingArgument(g){const v=`error: option '${g.flags}' argument missing`;this.error(v,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(g){const v=`error: required option '${g.flags}' not specified`;this.error(v,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(g,v){const k=F=>{const U=F.attributeName(),H=this.getOptionValue(U),ee=this.options.find(Se=>Se.negate&&U===Se.attributeName()),te=this.options.find(Se=>!Se.negate&&U===Se.attributeName());return ee&&(ee.presetArg===void 0&&H===!1||ee.presetArg!==void 0&&H===ee.presetArg)?ee:te||F},A=F=>{const U=k(F),H=U.attributeName();return this.getOptionValueSource(H)==="env"?`environment variable '${U.envVar}'`:`option '${U.flags}'`},T=`error: ${A(g)} cannot be used with ${A(v)}`;this.error(T,{code:"commander.conflictingOption"})}unknownOption(g){if(this._allowUnknownOption)return;let v="";if(g.startsWith("--")&&this._showSuggestionAfterError){let A=[],T=this;do{const F=T.createHelp().visibleOptions(T).filter(U=>U.long).map(U=>U.long);A=A.concat(F),T=T.parent}while(T&&!T._enablePositionalOptions);v=y(g,A)}const k=`error: unknown option '${g}'${v}`;this.error(k,{code:"commander.unknownOption"})}_excessArguments(g){if(this._allowExcessArguments)return;const v=this.registeredArguments.length,k=v===1?"":"s",T=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${v} argument${k} but got ${g.length}.`;this.error(T,{code:"commander.excessArguments"})}unknownCommand(){const g=this.args[0];let v="";if(this._showSuggestionAfterError){const A=[];this.createHelp().visibleCommands(this).forEach(T=>{A.push(T.name()),T.alias()&&A.push(T.alias())}),v=y(g,A)}const k=`error: unknown command '${g}'${v}`;this.error(k,{code:"commander.unknownCommand"})}version(g,v,k){if(g===void 0)return this._version;this._version=g,v=v||"-V, --version",k=k||"output the version number";const A=this.createOption(v,k);return this._versionOptionName=A.attributeName(),this._registerOption(A),this.on("option:"+A.name(),()=>{this._outputConfiguration.writeOut(`${g}
24
- `),this._exit(0,"commander.version",g)}),this}description(g,v){return g===void 0&&v===void 0?this._description:(this._description=g,v&&(this._argsDescription=v),this)}summary(g){return g===void 0?this._summary:(this._summary=g,this)}alias(g){if(g===void 0)return this._aliases[0];let v=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(v=this.commands[this.commands.length-1]),g===v._name)throw new Error("Command alias can't be the same as its name");const k=this.parent?._findCommand(g);if(k){const A=[k.name()].concat(k.aliases()).join("|");throw new Error(`cannot add alias '${g}' to command '${this.name()}' as already have command '${A}'`)}return v._aliases.push(g),this}aliases(g){return g===void 0?this._aliases:(g.forEach(v=>this.alias(v)),this)}usage(g){if(g===void 0){if(this._usage)return this._usage;const v=this.registeredArguments.map(k=>a(k));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?v:[]).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 v=this.createHelp(),k=this._getOutputContext(g);v.prepareContext({error:k.error,helpWidth:k.helpWidth,outputHasColors:k.hasColors});const A=v.formatHelp(this,v);return k.hasColors?A:this._outputConfiguration.stripColor(A)}_getOutputContext(g){g=g||{};const v=!!g.error;let k,A,T;return v?(k=U=>this._outputConfiguration.writeErr(U),A=this._outputConfiguration.getErrHasColors(),T=this._outputConfiguration.getErrHelpWidth()):(k=U=>this._outputConfiguration.writeOut(U),A=this._outputConfiguration.getOutHasColors(),T=this._outputConfiguration.getOutHelpWidth()),{error:v,write:U=>(A||(U=this._outputConfiguration.stripColor(U)),k(U)),hasColors:A,helpWidth:T}}outputHelp(g){let v;typeof g=="function"&&(v=g,g=void 0);const k=this._getOutputContext(g),A={error:k.error,write:k.write,command:this};this._getCommandAndAncestors().reverse().forEach(F=>F.emit("beforeAllHelp",A)),this.emit("beforeHelp",A);let T=this.helpInformation({error:k.error});if(v&&(T=v(T),typeof T!="string"&&!Buffer.isBuffer(T)))throw new Error("outputHelp callback must return a string or a Buffer");k.write(T),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",A),this._getCommandAndAncestors().forEach(F=>F.emit("afterAllHelp",A))}helpOption(g,v){return typeof g=="boolean"?(g?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(g=g??"-h, --help",v=v??"display help for command",this._helpOption=this.createOption(g,v),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 v=Number(i.exitCode??0);v===0&&g&&typeof g!="function"&&g.error&&(v=1),this._exit(v,"commander.help","(outputHelp)")}addHelpText(g,v){const k=["beforeAll","before","after","afterAll"];if(!k.includes(g))throw new Error(`Unexpected value for position to addHelpText.
25
- Expecting one of '${k.join("', '")}'`);const A=`${g}Help`;return this.on(A,T=>{let F;typeof v=="function"?F=v({error:T.error,command:T.command}):F=v,F&&T.write(`${F}
26
- `)}),this}_outputHelpIfRequested(g){const v=this._getHelpOption();v&&g.find(A=>v.is(A))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function S(N){return N.map(g=>{if(!g.startsWith("--inspect"))return g;let v,k="127.0.0.1",A="9229",T;return(T=g.match(/^(--inspect(-brk)?)$/))!==null?v=T[1]:(T=g.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(v=T[1],/^\d+$/.test(T[3])?A=T[3]:k=T[3]):(T=g.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(v=T[1],k=T[3],A=T[4]),v&&A!=="0"?`${v}=${k}:${parseInt(A)+1}`:g})}function E(){if(i.env.NO_COLOR||i.env.FORCE_COLOR==="0"||i.env.FORCE_COLOR==="false")return!1;if(i.env.FORCE_COLOR||i.env.CLICOLOR_FORCE!==void 0)return!0}return qo.Command=_,qo.useColor=E,qo}var pm;function $C(){if(pm)return Ot;pm=1;const{Argument:n}=uc(),{Command:e}=zC(),{CommanderError:t,InvalidArgumentError:r}=Uo(),{Help:i}=um(),{Option:s}=fm();return Ot.program=new e,Ot.createCommand=a=>new e(a),Ot.createOption=(a,u)=>new s(a,u),Ot.createArgument=(a,u)=>new n(a,u),Ot.Command=e,Ot.Option=s,Ot.Argument=n,Ot.Help=i,Ot.CommanderError=t,Ot.InvalidArgumentError=r,Ot.InvalidOptionArgumentError=r,Ot}var HC=$C(),WC=FC(HC);const{program:kN,createCommand:AN,createArgument:TN,createOption:ON,CommanderError:MN,InvalidArgumentError:IN,InvalidOptionArgumentError:NN,Command:VC,Argument:RN,Option:LN,Help:PN}=WC;function UC(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const us=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const pi=()=>{},qC=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),or=Object.assign,KC=Object.prototype.hasOwnProperty,fc=(n,e)=>KC.call(n,e),Fe=Array.isArray,mi=n=>Jo(n)==="[object Map]",GC=n=>Jo(n)==="[object Set]",Qe=n=>typeof n=="function",Ln=n=>typeof n=="string",cs=n=>typeof n=="symbol",gt=n=>n!==null&&typeof n=="object",JC=n=>(gt(n)||Qe(n))&&Qe(n.then)&&Qe(n.catch),jC=Object.prototype.toString,Jo=n=>jC.call(n),mm=n=>Jo(n).slice(8,-1),YC=n=>Jo(n)==="[object Object]",hc=n=>Ln(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,XC=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},ZC=XC(n=>n.charAt(0).toUpperCase()+n.slice(1)),ar=(n,e)=>!Object.is(n,e);let gm;const jo=()=>gm||(gm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function dc(n){if(Fe(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=Ln(r)?nE(r):dc(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(Ln(n)||gt(n))return n}const QC=/;(?![^(]*\))/g,eE=/:([^]+)/,tE=/\/\*[^]*?\*\//g;function nE(n){const e={};return n.replace(tE,"").split(QC).forEach(t=>{if(t){const r=t.split(eE);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function pc(n){let e="";if(Ln(n))e=n;else if(Fe(n))for(let t=0;t<n.length;t++){const r=pc(n[t]);r&&(e+=r+" ")}else if(gt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Pn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let we;const mc=new WeakSet;class rE{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,mc.has(this)&&(mc.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bm(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,xm(this),_m(this);const e=we,t=sn;we=this,sn=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&we!==this&&Pn("Active effect was not restored correctly - this is likely a Vue internal bug."),wm(this),we=e,sn=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)_c(e);this.deps=this.depsTail=void 0,xm(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?mc.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){bc(this)&&this.run()}get dirty(){return bc(this)}}let ym=0,fs,hs;function bm(n,e=!1){if(n.flags|=8,e){n.next=hs,hs=n;return}n.next=fs,fs=n}function gc(){ym++}function yc(){if(--ym>0)return;if(hs){let e=hs;for(hs=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;fs;){let e=fs;for(fs=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 _m(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function wm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),_c(r),iE(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function bc(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(vm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function vm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ds))return;n.globalVersion=ds;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!bc(n)){n.flags&=-3;return}const t=we,r=sn;we=n,sn=!0;try{_m(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{we=t,sn=r,wm(n),n.flags&=-3}}function _c(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 s=t.computed.deps;s;s=s.nextDep)_c(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function iE(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let sn=!0;const Sm=[];function Yo(){Sm.push(sn),sn=!1}function Xo(){const n=Sm.pop();sn=n===void 0?!0:n}function xm(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=we;we=void 0;try{e()}finally{we=t}}}let ds=0,sE=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 wc{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(!we||!sn||we===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==we)t=this.activeLink=new sE(we,this),we.deps?(t.prevDep=we.depsTail,we.depsTail.nextDep=t,we.depsTail=t):we.deps=we.depsTail=t,Cm(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=we.depsTail,t.nextDep=void 0,we.depsTail.nextDep=t,we.depsTail=t,we.deps===t&&(we.deps=r)}return process.env.NODE_ENV!=="production"&&we.onTrack&&we.onTrack(or({effect:we},e)),t}trigger(e){this.version++,ds++,this.notify(e)}notify(e){gc();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{yc()}}}function Cm(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)Cm(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 Zo=new WeakMap,Dr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),vc=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ps=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function yt(n,e,t){if(sn&&we){let r=Zo.get(n);r||Zo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new wc),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,s){const a=Zo.get(n);if(!a){ds++;return}const u=c=>{c&&(process.env.NODE_ENV!=="production"?c.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:s}):c.trigger())};if(gc(),e==="clear")a.forEach(u);else{const c=Fe(n),h=c&&hc(t);if(c&&t==="length"){const p=Number(r);a.forEach((m,y)=>{(y==="length"||y===ps||!cs(y)&&y>=p)&&u(m)})}else switch((t!==void 0||a.has(void 0))&&u(a.get(t)),h&&u(a.get(ps)),e){case"add":c?h&&u(a.get("length")):(u(a.get(Dr)),mi(n)&&u(a.get(vc)));break;case"delete":c||(u(a.get(Dr)),mi(n)&&u(a.get(vc)));break;case"set":mi(n)&&u(a.get(Dr));break}}yc()}function oE(n,e){const t=Zo.get(n);return t&&t.get(e)}function gi(n){const e=he(n);return e===n?e:(yt(e,"iterate",ps),bt(n)?e:e.map(at))}function Sc(n){return yt(n=he(n),"iterate",ps),n}const aE={__proto__:null,[Symbol.iterator](){return xc(this,Symbol.iterator,at)},concat(...n){return gi(this).concat(...n.map(e=>Fe(e)?gi(e):e))},entries(){return xc(this,"entries",n=>(n[1]=at(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(at),arguments)},find(n,e){return Dn(this,"find",n,e,at,arguments)},findIndex(n,e){return Dn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Dn(this,"findLast",n,e,at,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 Cc(this,"includes",n)},indexOf(...n){return Cc(this,"indexOf",n)},join(n){return gi(this).join(n)},lastIndexOf(...n){return Cc(this,"lastIndexOf",n)},map(n,e){return Dn(this,"map",n,e,void 0,arguments)},pop(){return ms(this,"pop")},push(...n){return ms(this,"push",n)},reduce(n,...e){return Em(this,"reduce",n,e)},reduceRight(n,...e){return Em(this,"reduceRight",n,e)},shift(){return ms(this,"shift")},some(n,e){return Dn(this,"some",n,e,void 0,arguments)},splice(...n){return ms(this,"splice",n)},toReversed(){return gi(this).toReversed()},toSorted(n){return gi(this).toSorted(n)},toSpliced(...n){return gi(this).toSpliced(...n)},unshift(...n){return ms(this,"unshift",n)},values(){return xc(this,"values",at)}};function xc(n,e,t){const r=Sc(n),i=r[e]();return r!==n&&!bt(n)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.value&&(s.value=t(s.value)),s}),i}const lE=Array.prototype;function Dn(n,e,t,r,i,s){const a=Sc(n),u=a!==n&&!bt(n),c=a[e];if(c!==lE[e]){const m=c.apply(n,s);return u?at(m):m}let h=t;a!==n&&(u?h=function(m,y){return t.call(this,at(m),y,n)}:t.length>2&&(h=function(m,y){return t.call(this,m,y,n)}));const p=c.call(a,h,r);return u&&i?i(p):p}function Em(n,e,t,r){const i=Sc(n);let s=t;return i!==n&&(bt(n)?t.length>3&&(s=function(a,u,c){return t.call(this,a,u,c,n)}):s=function(a,u,c){return t.call(this,a,at(u),c,n)}),i[e](s,...r)}function Cc(n,e,t){const r=he(n);yt(r,"iterate",ps);const i=r[e](...t);return(i===-1||i===!1)&&ta(t[0])?(t[0]=he(t[0]),r[e](...t)):i}function ms(n,e,t=[]){Yo(),gc();const r=he(n)[e].apply(n,t);return yc(),Xo(),r}const uE=UC("__proto__,__v_isRef,__isVue"),km=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function cE(n){cs(n)||(n=String(n));const e=he(this);return yt(e,"has",n),e.hasOwnProperty(n)}class Am{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,s=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return s;if(t==="__v_raw")return r===(i?s?wE:Im:s?_E:Mm).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Fe(e);if(!i){let c;if(a&&(c=aE[t]))return c;if(t==="hasOwnProperty")return cE}const u=Reflect.get(e,t,lt(e)?e:r);return(cs(t)?km.has(t):uE(t))||(i||yt(e,"get",t),s)?u:lt(u)?a&&hc(t)?u:u.value:gt(u)?i?Nm(u):kc(u):u}}class fE extends Am{constructor(e=!1){super(!1,e)}set(e,t,r,i){let s=e[t];if(!this._isShallow){const c=Fn(s);if(!bt(r)&&!Fn(r)&&(s=he(s),r=he(r)),!Fe(e)&&lt(s)&&!lt(r))return c?!1:(s.value=r,!0)}const a=Fe(e)&&hc(t)?Number(t)<e.length:fc(e,t),u=Reflect.set(e,t,r,lt(e)?e:i);return e===he(i)&&(a?ar(r,s)&&lr(e,"set",t,r,s):lr(e,"add",t,r)),u}deleteProperty(e,t){const r=fc(e,t),i=e[t],s=Reflect.deleteProperty(e,t);return s&&r&&lr(e,"delete",t,void 0,i),s}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!km.has(t))&&yt(e,"has",t),r}ownKeys(e){return yt(e,"iterate",Fe(e)?"length":Dr),Reflect.ownKeys(e)}}class hE extends Am{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 dE=new fE,pE=new hE,Ec=n=>n,Qo=n=>Reflect.getPrototypeOf(n);function mE(n,e,t){return function(...r){const i=this.__v_raw,s=he(i),a=mi(s),u=n==="entries"||n===Symbol.iterator&&a,c=n==="keys"&&a,h=i[n](...r),p=t?Ec:e?Ac:at;return!e&&yt(s,"iterate",c?vc:Dr),{next(){const{value:m,done:y}=h.next();return y?{value:m,done:y}:{value:u?[p(m[0]),p(m[1])]:p(m),done:y}},[Symbol.iterator](){return this}}}}function ea(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Pn(`${ZC(n)} operation ${t}failed: target is readonly.`,he(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function gE(n,e){const t={get(i){const s=this.__v_raw,a=he(s),u=he(i);n||(ar(i,u)&&yt(a,"get",i),yt(a,"get",u));const{has:c}=Qo(a),h=e?Ec:n?Ac:at;if(c.call(a,i))return h(s.get(i));if(c.call(a,u))return h(s.get(u));s!==a&&s.get(i)},get size(){const i=this.__v_raw;return!n&&yt(he(i),"iterate",Dr),Reflect.get(i,"size",i)},has(i){const s=this.__v_raw,a=he(s),u=he(i);return n||(ar(i,u)&&yt(a,"has",i),yt(a,"has",u)),i===u?s.has(i):s.has(i)||s.has(u)},forEach(i,s){const a=this,u=a.__v_raw,c=he(u),h=e?Ec:n?Ac:at;return!n&&yt(c,"iterate",Dr),u.forEach((p,m)=>i.call(s,h(p),h(m),a))}};return or(t,n?{add:ea("add"),set:ea("set"),delete:ea("delete"),clear:ea("clear")}:{add(i){!e&&!bt(i)&&!Fn(i)&&(i=he(i));const s=he(this);return Qo(s).has.call(s,i)||(s.add(i),lr(s,"add",i,i)),this},set(i,s){!e&&!bt(s)&&!Fn(s)&&(s=he(s));const a=he(this),{has:u,get:c}=Qo(a);let h=u.call(a,i);h?process.env.NODE_ENV!=="production"&&Om(a,u,i):(i=he(i),h=u.call(a,i));const p=c.call(a,i);return a.set(i,s),h?ar(s,p)&&lr(a,"set",i,s,p):lr(a,"add",i,s),this},delete(i){const s=he(this),{has:a,get:u}=Qo(s);let c=a.call(s,i);c?process.env.NODE_ENV!=="production"&&Om(s,a,i):(i=he(i),c=a.call(s,i));const h=u?u.call(s,i):void 0,p=s.delete(i);return c&&lr(s,"delete",i,void 0,h),p},clear(){const i=he(this),s=i.size!==0,a=process.env.NODE_ENV!=="production"?mi(i)?new Map(i):new Set(i):void 0,u=i.clear();return s&&lr(i,"clear",void 0,void 0,a),u}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=mE(i,n,e)}),t}function Tm(n,e){const t=gE(n,e);return(r,i,s)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(fc(t,i)&&i in r?t:r,i,s)}const yE={get:Tm(!1,!1)},bE={get:Tm(!0,!1)};function Om(n,e,t){const r=he(t);if(r!==t&&e.call(n,r)){const i=mm(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 Mm=new WeakMap,_E=new WeakMap,Im=new WeakMap,wE=new WeakMap;function vE(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function SE(n){return n.__v_skip||!Object.isExtensible(n)?0:vE(mm(n))}function kc(n){return Fn(n)?n:Rm(n,!1,dE,yE,Mm)}function Nm(n){return Rm(n,!0,pE,bE,Im)}function Rm(n,e,t,r,i){if(!gt(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 s=i.get(n);if(s)return s;const a=SE(n);if(a===0)return n;const u=new Proxy(n,a===2?r:t);return i.set(n,u),u}function gs(n){return Fn(n)?gs(n.__v_raw):!!(n&&n.__v_isReactive)}function Fn(n){return!!(n&&n.__v_isReadonly)}function bt(n){return!!(n&&n.__v_isShallow)}function ta(n){return n?!!n.__v_raw:!1}function he(n){const e=n&&n.__v_raw;return e?he(e):n}const at=n=>gt(n)?kc(n):n,Ac=n=>gt(n)?Nm(n):n;function lt(n){return n?n.__v_isRef===!0:!1}function na(n){return xE(n,!1)}function xE(n,e){return lt(n)?n:new CE(n,e)}class CE{constructor(e,t){this.dep=new wc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:he(e),this._value=t?e:at(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||bt(e)||Fn(e);e=r?e:he(e),ar(e,t)&&(this._rawValue=e,this._value=r?e:at(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function V(n){return lt(n)?n.value:n}class EE{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 oE(he(this._object),this._key)}}class kE{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 yi(n,e,t){return lt(n)?n:Qe(n)?new kE(n):gt(n)&&arguments.length>1?AE(n,e,t):na(n)}function AE(n,e,t){const r=n[e];return lt(r)?r:new EE(n,e,t)}class TE{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new wc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ds-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return bm(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 vm(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 OE(n,e,t=!1){let r,i;Qe(n)?r=n:(r=n.get,i=n.set);const s=new TE(r,i,t);return process.env.NODE_ENV,s}const ra={},ia=new WeakMap;let Fr;function ME(n,e=!1,t=Fr){if(t){let r=ia.get(t);r||ia.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 IE(n,e,t=us){const{immediate:r,deep:i,once:s,scheduler:a,augmentJob:u,call:c}=t,h=A=>{(t.onWarn||Pn)("Invalid watch source: ",A,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},p=A=>i?A:bt(A)||i===!1||i===0?ur(A,1):ur(A);let m,y,_,S,E=!1,N=!1;if(lt(n)?(y=()=>n.value,E=bt(n)):gs(n)?(y=()=>p(n),E=!0):Fe(n)?(N=!0,E=n.some(A=>gs(A)||bt(A)),y=()=>n.map(A=>{if(lt(A))return A.value;if(gs(A))return p(A);if(Qe(A))return c?c(A,2):A();process.env.NODE_ENV!=="production"&&h(A)})):Qe(n)?e?y=c?()=>c(n,2):n:y=()=>{if(_){Yo();try{_()}finally{Xo()}}const A=Fr;Fr=m;try{return c?c(n,3,[S]):n(S)}finally{Fr=A}}:(y=pi,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const A=y,T=i===!0?1/0:i;y=()=>ur(A(),T)}const g=()=>{m.stop()};if(s&&e){const A=e;e=(...T)=>{A(...T),g()}}let v=N?new Array(n.length).fill(ra):ra;const k=A=>{if(!(!(m.flags&1)||!m.dirty&&!A))if(e){const T=m.run();if(i||E||(N?T.some((F,U)=>ar(F,v[U])):ar(T,v))){_&&_();const F=Fr;Fr=m;try{const U=[T,v===ra?void 0:N&&v[0]===ra?[]:v,S];c?c(e,3,U):e(...U),v=T}finally{Fr=F}}}else m.run()};return u&&u(k),m=new rE(y),m.scheduler=a?()=>a(k,!1):k,S=A=>ME(A,!1,m),_=m.onStop=()=>{const A=ia.get(m);if(A){if(c)c(A,4);else for(const T of A)T();ia.delete(m)}},process.env.NODE_ENV!=="production"&&(m.onTrack=t.onTrack,m.onTrigger=t.onTrigger),e?r?k(!0):v=m.run():a?a(k.bind(null,!0),!0):m.run(),g.pause=m.pause.bind(m),g.resume=m.resume.bind(m),g.stop=g,g}function ur(n,e=1/0,t){if(e<=0||!gt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,lt(n))ur(n.value,e,t);else if(Fe(n))for(let r=0;r<n.length;r++)ur(n[r],e,t);else if(GC(n)||mi(n))n.forEach(r=>{ur(r,e,t)});else if(YC(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 Br=[];function NE(n){Br.push(n)}function RE(){Br.pop()}let Tc=!1;function ut(n,...e){if(Tc)return;Tc=!0,Yo();const t=Br.length?Br[Br.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=LE();if(r)sa(r,t,11,[n+e.map(s=>{var a,u;return(u=(a=s.toString)==null?void 0:a.call(s))!=null?u:JSON.stringify(s)}).join(""),t&&t.proxy,i.map(({vnode:s})=>`at <${Xm(t,s.type)}>`).join(`
23
+ `),this.outputHelp({error:!0}));const k=v||{},T=k.exitCode||1,A=k.code||"commander.error";this._exit(T,A,g)}_parseOptionsEnv(){this.options.forEach(g=>{if(g.envVar&&g.envVar in i.env){const v=g.attributeName();(this.getOptionValue(v)===void 0||["default","config","env"].includes(this.getOptionValueSource(v)))&&(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),v=k=>this.getOptionValue(k)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(k));this.options.filter(k=>k.implied!==void 0&&v(k.attributeName())&&g.valueFromOption(this.getOptionValue(k.attributeName()),k)).forEach(k=>{Object.keys(k.implied).filter(T=>!v(T)).forEach(T=>{this.setOptionValueWithSource(T,k.implied[T],"implied")})})}missingArgument(g){const v=`error: missing required argument '${g}'`;this.error(v,{code:"commander.missingArgument"})}optionMissingArgument(g){const v=`error: option '${g.flags}' argument missing`;this.error(v,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(g){const v=`error: required option '${g.flags}' not specified`;this.error(v,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(g,v){const k=F=>{const U=F.attributeName(),V=this.getOptionValue(U),ee=this.options.find(Se=>Se.negate&&U===Se.attributeName()),te=this.options.find(Se=>!Se.negate&&U===Se.attributeName());return ee&&(ee.presetArg===void 0&&V===!1||ee.presetArg!==void 0&&V===ee.presetArg)?ee:te||F},T=F=>{const U=k(F),V=U.attributeName();return this.getOptionValueSource(V)==="env"?`environment variable '${U.envVar}'`:`option '${U.flags}'`},A=`error: ${T(g)} cannot be used with ${T(v)}`;this.error(A,{code:"commander.conflictingOption"})}unknownOption(g){if(this._allowUnknownOption)return;let v="";if(g.startsWith("--")&&this._showSuggestionAfterError){let T=[],A=this;do{const F=A.createHelp().visibleOptions(A).filter(U=>U.long).map(U=>U.long);T=T.concat(F),A=A.parent}while(A&&!A._enablePositionalOptions);v=y(g,T)}const k=`error: unknown option '${g}'${v}`;this.error(k,{code:"commander.unknownOption"})}_excessArguments(g){if(this._allowExcessArguments)return;const v=this.registeredArguments.length,k=v===1?"":"s",A=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${v} argument${k} but got ${g.length}.`;this.error(A,{code:"commander.excessArguments"})}unknownCommand(){const g=this.args[0];let v="";if(this._showSuggestionAfterError){const T=[];this.createHelp().visibleCommands(this).forEach(A=>{T.push(A.name()),A.alias()&&T.push(A.alias())}),v=y(g,T)}const k=`error: unknown command '${g}'${v}`;this.error(k,{code:"commander.unknownCommand"})}version(g,v,k){if(g===void 0)return this._version;this._version=g,v=v||"-V, --version",k=k||"output the version number";const T=this.createOption(v,k);return this._versionOptionName=T.attributeName(),this._registerOption(T),this.on("option:"+T.name(),()=>{this._outputConfiguration.writeOut(`${g}
24
+ `),this._exit(0,"commander.version",g)}),this}description(g,v){return g===void 0&&v===void 0?this._description:(this._description=g,v&&(this._argsDescription=v),this)}summary(g){return g===void 0?this._summary:(this._summary=g,this)}alias(g){if(g===void 0)return this._aliases[0];let v=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(v=this.commands[this.commands.length-1]),g===v._name)throw new Error("Command alias can't be the same as its name");const k=this.parent?._findCommand(g);if(k){const T=[k.name()].concat(k.aliases()).join("|");throw new Error(`cannot add alias '${g}' to command '${this.name()}' as already have command '${T}'`)}return v._aliases.push(g),this}aliases(g){return g===void 0?this._aliases:(g.forEach(v=>this.alias(v)),this)}usage(g){if(g===void 0){if(this._usage)return this._usage;const v=this.registeredArguments.map(k=>a(k));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?v:[]).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 v=this.createHelp(),k=this._getOutputContext(g);v.prepareContext({error:k.error,helpWidth:k.helpWidth,outputHasColors:k.hasColors});const T=v.formatHelp(this,v);return k.hasColors?T:this._outputConfiguration.stripColor(T)}_getOutputContext(g){g=g||{};const v=!!g.error;let k,T,A;return v?(k=U=>this._outputConfiguration.writeErr(U),T=this._outputConfiguration.getErrHasColors(),A=this._outputConfiguration.getErrHelpWidth()):(k=U=>this._outputConfiguration.writeOut(U),T=this._outputConfiguration.getOutHasColors(),A=this._outputConfiguration.getOutHelpWidth()),{error:v,write:U=>(T||(U=this._outputConfiguration.stripColor(U)),k(U)),hasColors:T,helpWidth:A}}outputHelp(g){let v;typeof g=="function"&&(v=g,g=void 0);const k=this._getOutputContext(g),T={error:k.error,write:k.write,command:this};this._getCommandAndAncestors().reverse().forEach(F=>F.emit("beforeAllHelp",T)),this.emit("beforeHelp",T);let A=this.helpInformation({error:k.error});if(v&&(A=v(A),typeof A!="string"&&!Buffer.isBuffer(A)))throw new Error("outputHelp callback must return a string or a Buffer");k.write(A),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",T),this._getCommandAndAncestors().forEach(F=>F.emit("afterAllHelp",T))}helpOption(g,v){return typeof g=="boolean"?(g?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(g=g??"-h, --help",v=v??"display help for command",this._helpOption=this.createOption(g,v),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 v=Number(i.exitCode??0);v===0&&g&&typeof g!="function"&&g.error&&(v=1),this._exit(v,"commander.help","(outputHelp)")}addHelpText(g,v){const k=["beforeAll","before","after","afterAll"];if(!k.includes(g))throw new Error(`Unexpected value for position to addHelpText.
25
+ Expecting one of '${k.join("', '")}'`);const T=`${g}Help`;return this.on(T,A=>{let F;typeof v=="function"?F=v({error:A.error,command:A.command}):F=v,F&&A.write(`${F}
26
+ `)}),this}_outputHelpIfRequested(g){const v=this._getHelpOption();v&&g.find(T=>v.is(T))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function S(N){return N.map(g=>{if(!g.startsWith("--inspect"))return g;let v,k="127.0.0.1",T="9229",A;return(A=g.match(/^(--inspect(-brk)?)$/))!==null?v=A[1]:(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(v=A[1],/^\d+$/.test(A[3])?T=A[3]:k=A[3]):(A=g.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(v=A[1],k=A[3],T=A[4]),v&&T!=="0"?`${v}=${k}:${parseInt(T)+1}`:g})}function E(){if(i.env.NO_COLOR||i.env.FORCE_COLOR==="0"||i.env.FORCE_COLOR==="false")return!1;if(i.env.FORCE_COLOR||i.env.CLICOLOR_FORCE!==void 0)return!0}return qo.Command=_,qo.useColor=E,qo}var pm;function HC(){if(pm)return Ot;pm=1;const{Argument:n}=uc(),{Command:e}=$C(),{CommanderError:t,InvalidArgumentError:r}=Uo(),{Help:i}=um(),{Option:s}=fm();return Ot.program=new e,Ot.createCommand=a=>new e(a),Ot.createOption=(a,u)=>new s(a,u),Ot.createArgument=(a,u)=>new n(a,u),Ot.Command=e,Ot.Option=s,Ot.Argument=n,Ot.Help=i,Ot.CommanderError=t,Ot.InvalidArgumentError=r,Ot.InvalidOptionArgumentError=r,Ot}var WC=HC(),VC=BC(WC);const{program:MN,createCommand:ON,createArgument:IN,createOption:NN,CommanderError:RN,InvalidArgumentError:LN,InvalidOptionArgumentError:PN,Command:UC,Argument:DN,Option:FN,Help:BN}=VC;function qC(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const us=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const pi=()=>{},KC=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),or=Object.assign,GC=Object.prototype.hasOwnProperty,fc=(n,e)=>GC.call(n,e),Fe=Array.isArray,mi=n=>Jo(n)==="[object Map]",JC=n=>Jo(n)==="[object Set]",Qe=n=>typeof n=="function",Ln=n=>typeof n=="string",cs=n=>typeof n=="symbol",gt=n=>n!==null&&typeof n=="object",jC=n=>(gt(n)||Qe(n))&&Qe(n.then)&&Qe(n.catch),YC=Object.prototype.toString,Jo=n=>YC.call(n),mm=n=>Jo(n).slice(8,-1),XC=n=>Jo(n)==="[object Object]",hc=n=>Ln(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,ZC=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},QC=ZC(n=>n.charAt(0).toUpperCase()+n.slice(1)),ar=(n,e)=>!Object.is(n,e);let gm;const jo=()=>gm||(gm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function dc(n){if(Fe(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=Ln(r)?rE(r):dc(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(Ln(n)||gt(n))return n}const eE=/;(?![^(]*\))/g,tE=/:([^]+)/,nE=/\/\*[^]*?\*\//g;function rE(n){const e={};return n.replace(nE,"").split(eE).forEach(t=>{if(t){const r=t.split(tE);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function pc(n){let e="";if(Ln(n))e=n;else if(Fe(n))for(let t=0;t<n.length;t++){const r=pc(n[t]);r&&(e+=r+" ")}else if(gt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function Pn(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let we;const mc=new WeakSet;class iE{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,mc.has(this)&&(mc.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bm(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,xm(this),_m(this);const e=we,t=sn;we=this,sn=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&we!==this&&Pn("Active effect was not restored correctly - this is likely a Vue internal bug."),wm(this),we=e,sn=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)_c(e);this.deps=this.depsTail=void 0,xm(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?mc.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){bc(this)&&this.run()}get dirty(){return bc(this)}}let ym=0,fs,hs;function bm(n,e=!1){if(n.flags|=8,e){n.next=hs,hs=n;return}n.next=fs,fs=n}function gc(){ym++}function yc(){if(--ym>0)return;if(hs){let e=hs;for(hs=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;fs;){let e=fs;for(fs=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 _m(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function wm(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),_c(r),sE(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function bc(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(vm(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function vm(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ds))return;n.globalVersion=ds;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!bc(n)){n.flags&=-3;return}const t=we,r=sn;we=n,sn=!0;try{_m(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{we=t,sn=r,wm(n),n.flags&=-3}}function _c(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 s=t.computed.deps;s;s=s.nextDep)_c(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function sE(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let sn=!0;const Sm=[];function Yo(){Sm.push(sn),sn=!1}function Xo(){const n=Sm.pop();sn=n===void 0?!0:n}function xm(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=we;we=void 0;try{e()}finally{we=t}}}let ds=0,oE=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 wc{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(!we||!sn||we===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==we)t=this.activeLink=new oE(we,this),we.deps?(t.prevDep=we.depsTail,we.depsTail.nextDep=t,we.depsTail=t):we.deps=we.depsTail=t,Cm(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=we.depsTail,t.nextDep=void 0,we.depsTail.nextDep=t,we.depsTail=t,we.deps===t&&(we.deps=r)}return process.env.NODE_ENV!=="production"&&we.onTrack&&we.onTrack(or({effect:we},e)),t}trigger(e){this.version++,ds++,this.notify(e)}notify(e){gc();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{yc()}}}function Cm(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)Cm(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 Zo=new WeakMap,Fr=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),vc=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),ps=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function yt(n,e,t){if(sn&&we){let r=Zo.get(n);r||Zo.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new wc),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,s){const a=Zo.get(n);if(!a){ds++;return}const u=c=>{c&&(process.env.NODE_ENV!=="production"?c.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:s}):c.trigger())};if(gc(),e==="clear")a.forEach(u);else{const c=Fe(n),h=c&&hc(t);if(c&&t==="length"){const p=Number(r);a.forEach((m,y)=>{(y==="length"||y===ps||!cs(y)&&y>=p)&&u(m)})}else switch((t!==void 0||a.has(void 0))&&u(a.get(t)),h&&u(a.get(ps)),e){case"add":c?h&&u(a.get("length")):(u(a.get(Fr)),mi(n)&&u(a.get(vc)));break;case"delete":c||(u(a.get(Fr)),mi(n)&&u(a.get(vc)));break;case"set":mi(n)&&u(a.get(Fr));break}}yc()}function aE(n,e){const t=Zo.get(n);return t&&t.get(e)}function gi(n){const e=he(n);return e===n?e:(yt(e,"iterate",ps),bt(n)?e:e.map(at))}function Sc(n){return yt(n=he(n),"iterate",ps),n}const lE={__proto__:null,[Symbol.iterator](){return xc(this,Symbol.iterator,at)},concat(...n){return gi(this).concat(...n.map(e=>Fe(e)?gi(e):e))},entries(){return xc(this,"entries",n=>(n[1]=at(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(at),arguments)},find(n,e){return Dn(this,"find",n,e,at,arguments)},findIndex(n,e){return Dn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Dn(this,"findLast",n,e,at,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 Cc(this,"includes",n)},indexOf(...n){return Cc(this,"indexOf",n)},join(n){return gi(this).join(n)},lastIndexOf(...n){return Cc(this,"lastIndexOf",n)},map(n,e){return Dn(this,"map",n,e,void 0,arguments)},pop(){return ms(this,"pop")},push(...n){return ms(this,"push",n)},reduce(n,...e){return Em(this,"reduce",n,e)},reduceRight(n,...e){return Em(this,"reduceRight",n,e)},shift(){return ms(this,"shift")},some(n,e){return Dn(this,"some",n,e,void 0,arguments)},splice(...n){return ms(this,"splice",n)},toReversed(){return gi(this).toReversed()},toSorted(n){return gi(this).toSorted(n)},toSpliced(...n){return gi(this).toSpliced(...n)},unshift(...n){return ms(this,"unshift",n)},values(){return xc(this,"values",at)}};function xc(n,e,t){const r=Sc(n),i=r[e]();return r!==n&&!bt(n)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.value&&(s.value=t(s.value)),s}),i}const uE=Array.prototype;function Dn(n,e,t,r,i,s){const a=Sc(n),u=a!==n&&!bt(n),c=a[e];if(c!==uE[e]){const m=c.apply(n,s);return u?at(m):m}let h=t;a!==n&&(u?h=function(m,y){return t.call(this,at(m),y,n)}:t.length>2&&(h=function(m,y){return t.call(this,m,y,n)}));const p=c.call(a,h,r);return u&&i?i(p):p}function Em(n,e,t,r){const i=Sc(n);let s=t;return i!==n&&(bt(n)?t.length>3&&(s=function(a,u,c){return t.call(this,a,u,c,n)}):s=function(a,u,c){return t.call(this,a,at(u),c,n)}),i[e](s,...r)}function Cc(n,e,t){const r=he(n);yt(r,"iterate",ps);const i=r[e](...t);return(i===-1||i===!1)&&ta(t[0])?(t[0]=he(t[0]),r[e](...t)):i}function ms(n,e,t=[]){Yo(),gc();const r=he(n)[e].apply(n,t);return yc(),Xo(),r}const cE=qC("__proto__,__v_isRef,__isVue"),km=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(cs));function fE(n){cs(n)||(n=String(n));const e=he(this);return yt(e,"has",n),e.hasOwnProperty(n)}class Tm{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,s=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return s;if(t==="__v_raw")return r===(i?s?vE:Im:s?wE:Om).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const a=Fe(e);if(!i){let c;if(a&&(c=lE[t]))return c;if(t==="hasOwnProperty")return fE}const u=Reflect.get(e,t,lt(e)?e:r);return(cs(t)?km.has(t):cE(t))||(i||yt(e,"get",t),s)?u:lt(u)?a&&hc(t)?u:u.value:gt(u)?i?Nm(u):kc(u):u}}class hE extends Tm{constructor(e=!1){super(!1,e)}set(e,t,r,i){let s=e[t];if(!this._isShallow){const c=Fn(s);if(!bt(r)&&!Fn(r)&&(s=he(s),r=he(r)),!Fe(e)&&lt(s)&&!lt(r))return c?!1:(s.value=r,!0)}const a=Fe(e)&&hc(t)?Number(t)<e.length:fc(e,t),u=Reflect.set(e,t,r,lt(e)?e:i);return e===he(i)&&(a?ar(r,s)&&lr(e,"set",t,r,s):lr(e,"add",t,r)),u}deleteProperty(e,t){const r=fc(e,t),i=e[t],s=Reflect.deleteProperty(e,t);return s&&r&&lr(e,"delete",t,void 0,i),s}has(e,t){const r=Reflect.has(e,t);return(!cs(t)||!km.has(t))&&yt(e,"has",t),r}ownKeys(e){return yt(e,"iterate",Fe(e)?"length":Fr),Reflect.ownKeys(e)}}class dE extends Tm{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 pE=new hE,mE=new dE,Ec=n=>n,Qo=n=>Reflect.getPrototypeOf(n);function gE(n,e,t){return function(...r){const i=this.__v_raw,s=he(i),a=mi(s),u=n==="entries"||n===Symbol.iterator&&a,c=n==="keys"&&a,h=i[n](...r),p=t?Ec:e?Tc:at;return!e&&yt(s,"iterate",c?vc:Fr),{next(){const{value:m,done:y}=h.next();return y?{value:m,done:y}:{value:u?[p(m[0]),p(m[1])]:p(m),done:y}},[Symbol.iterator](){return this}}}}function ea(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Pn(`${QC(n)} operation ${t}failed: target is readonly.`,he(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function yE(n,e){const t={get(i){const s=this.__v_raw,a=he(s),u=he(i);n||(ar(i,u)&&yt(a,"get",i),yt(a,"get",u));const{has:c}=Qo(a),h=e?Ec:n?Tc:at;if(c.call(a,i))return h(s.get(i));if(c.call(a,u))return h(s.get(u));s!==a&&s.get(i)},get size(){const i=this.__v_raw;return!n&&yt(he(i),"iterate",Fr),Reflect.get(i,"size",i)},has(i){const s=this.__v_raw,a=he(s),u=he(i);return n||(ar(i,u)&&yt(a,"has",i),yt(a,"has",u)),i===u?s.has(i):s.has(i)||s.has(u)},forEach(i,s){const a=this,u=a.__v_raw,c=he(u),h=e?Ec:n?Tc:at;return!n&&yt(c,"iterate",Fr),u.forEach((p,m)=>i.call(s,h(p),h(m),a))}};return or(t,n?{add:ea("add"),set:ea("set"),delete:ea("delete"),clear:ea("clear")}:{add(i){!e&&!bt(i)&&!Fn(i)&&(i=he(i));const s=he(this);return Qo(s).has.call(s,i)||(s.add(i),lr(s,"add",i,i)),this},set(i,s){!e&&!bt(s)&&!Fn(s)&&(s=he(s));const a=he(this),{has:u,get:c}=Qo(a);let h=u.call(a,i);h?process.env.NODE_ENV!=="production"&&Mm(a,u,i):(i=he(i),h=u.call(a,i));const p=c.call(a,i);return a.set(i,s),h?ar(s,p)&&lr(a,"set",i,s,p):lr(a,"add",i,s),this},delete(i){const s=he(this),{has:a,get:u}=Qo(s);let c=a.call(s,i);c?process.env.NODE_ENV!=="production"&&Mm(s,a,i):(i=he(i),c=a.call(s,i));const h=u?u.call(s,i):void 0,p=s.delete(i);return c&&lr(s,"delete",i,void 0,h),p},clear(){const i=he(this),s=i.size!==0,a=process.env.NODE_ENV!=="production"?mi(i)?new Map(i):new Set(i):void 0,u=i.clear();return s&&lr(i,"clear",void 0,void 0,a),u}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=gE(i,n,e)}),t}function Am(n,e){const t=yE(n,e);return(r,i,s)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(fc(t,i)&&i in r?t:r,i,s)}const bE={get:Am(!1,!1)},_E={get:Am(!0,!1)};function Mm(n,e,t){const r=he(t);if(r!==t&&e.call(n,r)){const i=mm(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 Om=new WeakMap,wE=new WeakMap,Im=new WeakMap,vE=new WeakMap;function SE(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function xE(n){return n.__v_skip||!Object.isExtensible(n)?0:SE(mm(n))}function kc(n){return Fn(n)?n:Rm(n,!1,pE,bE,Om)}function Nm(n){return Rm(n,!0,mE,_E,Im)}function Rm(n,e,t,r,i){if(!gt(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 s=i.get(n);if(s)return s;const a=xE(n);if(a===0)return n;const u=new Proxy(n,a===2?r:t);return i.set(n,u),u}function gs(n){return Fn(n)?gs(n.__v_raw):!!(n&&n.__v_isReactive)}function Fn(n){return!!(n&&n.__v_isReadonly)}function bt(n){return!!(n&&n.__v_isShallow)}function ta(n){return n?!!n.__v_raw:!1}function he(n){const e=n&&n.__v_raw;return e?he(e):n}const at=n=>gt(n)?kc(n):n,Tc=n=>gt(n)?Nm(n):n;function lt(n){return n?n.__v_isRef===!0:!1}function na(n){return CE(n,!1)}function CE(n,e){return lt(n)?n:new EE(n,e)}class EE{constructor(e,t){this.dep=new wc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:he(e),this._value=t?e:at(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||bt(e)||Fn(e);e=r?e:he(e),ar(e,t)&&(this._rawValue=e,this._value=r?e:at(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 lt(n)?n.value:n}class kE{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 aE(he(this._object),this._key)}}class TE{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 yi(n,e,t){return lt(n)?n:Qe(n)?new TE(n):gt(n)&&arguments.length>1?AE(n,e,t):na(n)}function AE(n,e,t){const r=n[e];return lt(r)?r:new kE(n,e,t)}class ME{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new wc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ds-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return bm(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 vm(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 OE(n,e,t=!1){let r,i;Qe(n)?r=n:(r=n.get,i=n.set);const s=new ME(r,i,t);return process.env.NODE_ENV,s}const ra={},ia=new WeakMap;let Br;function IE(n,e=!1,t=Br){if(t){let r=ia.get(t);r||ia.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 NE(n,e,t=us){const{immediate:r,deep:i,once:s,scheduler:a,augmentJob:u,call:c}=t,h=T=>{(t.onWarn||Pn)("Invalid watch source: ",T,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},p=T=>i?T:bt(T)||i===!1||i===0?ur(T,1):ur(T);let m,y,_,S,E=!1,N=!1;if(lt(n)?(y=()=>n.value,E=bt(n)):gs(n)?(y=()=>p(n),E=!0):Fe(n)?(N=!0,E=n.some(T=>gs(T)||bt(T)),y=()=>n.map(T=>{if(lt(T))return T.value;if(gs(T))return p(T);if(Qe(T))return c?c(T,2):T();process.env.NODE_ENV!=="production"&&h(T)})):Qe(n)?e?y=c?()=>c(n,2):n:y=()=>{if(_){Yo();try{_()}finally{Xo()}}const T=Br;Br=m;try{return c?c(n,3,[S]):n(S)}finally{Br=T}}:(y=pi,process.env.NODE_ENV!=="production"&&h(n)),e&&i){const T=y,A=i===!0?1/0:i;y=()=>ur(T(),A)}const g=()=>{m.stop()};if(s&&e){const T=e;e=(...A)=>{T(...A),g()}}let v=N?new Array(n.length).fill(ra):ra;const k=T=>{if(!(!(m.flags&1)||!m.dirty&&!T))if(e){const A=m.run();if(i||E||(N?A.some((F,U)=>ar(F,v[U])):ar(A,v))){_&&_();const F=Br;Br=m;try{const U=[A,v===ra?void 0:N&&v[0]===ra?[]:v,S];c?c(e,3,U):e(...U),v=A}finally{Br=F}}}else m.run()};return u&&u(k),m=new iE(y),m.scheduler=a?()=>a(k,!1):k,S=T=>IE(T,!1,m),_=m.onStop=()=>{const T=ia.get(m);if(T){if(c)c(T,4);else for(const A of T)A();ia.delete(m)}},process.env.NODE_ENV!=="production"&&(m.onTrack=t.onTrack,m.onTrigger=t.onTrigger),e?r?k(!0):v=m.run():a?a(k.bind(null,!0),!0):m.run(),g.pause=m.pause.bind(m),g.resume=m.resume.bind(m),g.stop=g,g}function ur(n,e=1/0,t){if(e<=0||!gt(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,lt(n))ur(n.value,e,t);else if(Fe(n))for(let r=0;r<n.length;r++)ur(n[r],e,t);else if(JC(n)||mi(n))n.forEach(r=>{ur(r,e,t)});else if(XC(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 zr=[];function RE(n){zr.push(n)}function LE(){zr.pop()}let Ac=!1;function ut(n,...e){if(Ac)return;Ac=!0,Yo();const t=zr.length?zr[zr.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=PE();if(r)sa(r,t,11,[n+e.map(s=>{var a,u;return(u=(a=s.toString)==null?void 0:a.call(s))!=null?u:JSON.stringify(s)}).join(""),t&&t.proxy,i.map(({vnode:s})=>`at <${Xm(t,s.type)}>`).join(`
27
27
  `),i]);else{const s=[`[Vue warn]: ${n}`,...e];i.length&&s.push(`
28
- `,...PE(i)),console.warn(...s)}Xo(),Tc=!1}function LE(){let n=Br[Br.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 PE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
29
- `],...DE(t))}),e}function DE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Xm(n.component,n.type,r)}`,s=">"+t;return n.props?[i,...FE(n.props),s]:[i+s]}function FE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...Lm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function Lm(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}`]:lt(e)?(e=Lm(n,he(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Qe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=he(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 sa(n,e,t,r){try{return r?n(...r):n()}catch(i){Oc(i,e,t)}}function Dm(n,e,t,r){if(Qe(n)){const i=sa(n,e,t,r);return i&&JC(i)&&i.catch(s=>{Oc(s,e,t)}),i}if(Fe(n)){const i=[];for(let s=0;s<n.length;s++)i.push(Dm(n[s],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ut(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Oc(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||us;if(e){let u=e.parent;const c=e.proxy,h=process.env.NODE_ENV!=="production"?Pm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;u;){const p=u.ec;if(p){for(let m=0;m<p.length;m++)if(p[m](n,c,h)===!1)return}u=u.parent}if(s){Yo(),sa(s,null,10,[n,c,h]),Xo();return}}BE(n,t,i,r,a)}function BE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const s=Pm[e];if(t&&NE(t),ut(`Unhandled error${s?` during execution of ${s}`:""}`),t&&RE(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const qt=[];let Bn=-1;const bi=[];let cr=null,_i=0;const zE=Promise.resolve();let Mc=null;const $E=100;function HE(n){let e=Bn+1,t=qt.length;for(;e<t;){const r=e+t>>>1,i=qt[r],s=ys(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function Fm(n){if(!(n.flags&1)){const e=ys(n),t=qt[qt.length-1];!t||!(n.flags&2)&&e>=ys(t)?qt.push(n):qt.splice(HE(e),0,n),n.flags|=1,Bm()}}function Bm(){Mc||(Mc=zE.then($m))}function zm(n){Fe(n)?bi.push(...n):cr&&n.id===-1?cr.splice(_i+1,0,n):n.flags&1||(bi.push(n),n.flags|=1),Bm()}function WE(n){if(bi.length){const e=[...new Set(bi)].sort((t,r)=>ys(t)-ys(r));if(bi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),_i=0;_i<cr.length;_i++){const t=cr[_i];process.env.NODE_ENV!=="production"&&Hm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,_i=0}}const ys=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=>Hm(n,t):pi;try{for(Bn=0;Bn<qt.length;Bn++){const t=qt[Bn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),sa(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Bn<qt.length;Bn++){const t=qt[Bn];t&&(t.flags&=-2)}Bn=-1,qt.length=0,WE(n),Mc=null,(qt.length||bi.length)&&$m(n)}}function Hm(n,e){const t=n.get(e)||0;if(t>$E){const r=e.i,i=r&&Ym(r.type);return Oc(`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 Ic=new Map;process.env.NODE_ENV!=="production"&&(jo().__VUE_HMR_RUNTIME__={createRecord:Nc(VE),rerender:Nc(UE),reload:Nc(qE)});const oa=new Map;function VE(n,e){return oa.has(n)?!1:(oa.set(n,{initialDef:aa(e),instances:new Set}),!0)}function aa(n){return Zm(n)?n.__vccOpts:n}function UE(n,e){const t=oa.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,aa(r.type).render=e),r.renderCache=[],r.update()}))}function qE(n,e){const t=oa.get(n);if(!t)return;e=aa(e),Wm(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const s=r[i],a=aa(s.type);let u=Ic.get(a);u||(a!==t.initialDef&&Wm(a,e),Ic.set(a,u=new Set)),u.add(s),s.appContext.propsCache.delete(s.type),s.appContext.emitsCache.delete(s.type),s.appContext.optionsCache.delete(s.type),s.ceReload?(u.add(s),s.ceReload(e.styles),u.delete(s)):s.parent?Fm(()=>{s.parent.update(),u.delete(s)}):s.appContext.reload?s.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),s.root.ce&&s!==s.root&&s.root.ce._removeChildStyle(a)}zm(()=>{Ic.clear()})}function Wm(n,e){or(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function Nc(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 wi,la=[];function Vm(n,e){var t,r;wi=n,wi?(wi.enabled=!0,la.forEach(({event:i,args:s})=>wi.emit(i,...s)),la=[]):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(s=>{Vm(s,e)}),setTimeout(()=>{wi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,la=[])},3e3)):la=[]}let vi=null,KE=null;const GE=n=>n.__isTeleport;function Um(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Um(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}jo().requestIdleCallback,jo().cancelIdleCallback;const JE=Symbol.for("v-ndc"),jE={};process.env.NODE_ENV!=="production"&&(jE.ownKeys=n=>(ut("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 YE=null;function XE(n,e,t=!1){const r=fa||vi;if(r||YE){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&&Qe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ut(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ut("inject() can only be used inside setup() or functional components.")}const ZE={},qm=n=>Object.getPrototypeOf(n)===ZE,QE=s5,e5=Symbol.for("v-scx"),t5=()=>{{const n=XE(e5);return n||process.env.NODE_ENV!=="production"&&ut("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function n5(n,e,t){return process.env.NODE_ENV!=="production"&&!Qe(e)&&ut("`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."),r5(n,e,t)}function r5(n,e,t=us){const{immediate:r,deep:i,flush:s,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ut('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ut('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&ut('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=ut);const c=e&&r||!e&&s!=="post";let h;if(ha){if(s==="sync"){const _=t5();h=_.__watcherHandles||(_.__watcherHandles=[])}else if(!c){const _=()=>{};return _.stop=pi,_.resume=pi,_.pause=pi,_}}const p=fa;u.call=(_,S,E)=>Dm(_,p,S,E);let m=!1;s==="post"?u.scheduler=_=>{QE(_,p&&p.suspense)}:s!=="sync"&&(m=!0,u.scheduler=(_,S)=>{S?_():Fm(_)}),u.augmentJob=_=>{e&&(_.flags|=4),m&&(_.flags|=2,p&&(_.id=p.uid,_.i=p))};const y=IE(n,e,u);return ha&&(h?h.push(y):c&&y()),y}const i5=n=>n.__isSuspense;function s5(n,e){e&&e.pendingBranch?Fe(n)?e.effects.push(...n):e.effects.push(n):zm(n)}const Km=Symbol.for("v-fgt"),o5=Symbol.for("v-txt"),a5=Symbol.for("v-cmt");function l5(n){return n?n.__v_isVNode===!0:!1}const u5=(...n)=>Jm(...n),Gm=({key:n})=>n??null,ua=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Ln(n)||lt(n)||Qe(n)?{i:vi,r:n,k:e,f:!!t}:n:null);function c5(n,e=null,t=null,r=0,i=null,s=n===Km?0:1,a=!1,u=!1){const c={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Gm(e),ref:e&&ua(e),scopeId:KE,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:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:vi};return u?(Rc(c,t),s&128&&n.normalize(c)):t&&(c.shapeFlag|=Ln(t)?8:16),process.env.NODE_ENV!=="production"&&c.key!==c.key&&ut("VNode created with invalid key (NaN). VNode type:",c.type),c}const f5=process.env.NODE_ENV!=="production"?u5:Jm;function Jm(n,e=null,t=null,r=0,i=null,s=!1){if((!n||n===JE)&&(process.env.NODE_ENV!=="production"&&!n&&ut(`Invalid vnode type when creating vnode: ${n}.`),n=a5),l5(n)){const u=ca(n,e,!0);return t&&Rc(u,t),u.patchFlag=-2,u}if(Zm(n)&&(n=n.__vccOpts),e){e=h5(e);let{class:u,style:c}=e;u&&!Ln(u)&&(e.class=pc(u)),gt(c)&&(ta(c)&&!Fe(c)&&(c=or({},c)),e.style=dc(c))}const a=Ln(n)?1:i5(n)?128:GE(n)?64:gt(n)?4:Qe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&ta(n)&&(n=he(n),ut("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`.",`
30
- Component that was made reactive: `,n)),c5(n,e,t,r,i,a,s,!0)}function h5(n){return n?ta(n)||qm(n)?or({},n):n:null}function ca(n,e,t=!1,r=!1){const{props:i,ref:s,patchFlag:a,children:u,transition:c}=n,h=e?p5(i||{},e):i,p={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Gm(h),ref:e&&e.ref?t&&s?Fe(s)?s.concat(ua(e)):[s,ua(e)]:ua(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Fe(u)?u.map(jm):u,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Km?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:c,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&ca(n.ssContent),ssFallback:n.ssFallback&&ca(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return c&&r&&Um(p,c.clone(p)),p}function jm(n){const e=ca(n);return Fe(n.children)&&(e.children=n.children.map(jm)),e}function d5(n=" ",e=0){return f5(o5,null,n,e)}function Rc(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Fe(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Rc(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!qm(e)&&(e._ctx=vi);else Qe(e)?(e={default:e,_ctx:vi},t=32):(e=String(e),r&64?(t=16,e=[d5(e)]):t=8);n.children=e,n.shapeFlag|=t}function p5(...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=pc([e.class,r.class]));else if(i==="style")e.style=dc([e.style,r.style]);else if(qC(i)){const s=e[i],a=r[i];a&&s!==a&&!(Fe(s)&&s.includes(a))&&(e[i]=s?[].concat(s,a):a)}else i!==""&&(e[i]=r[i])}return e}let fa=null;const m5=()=>fa||vi;{const n=jo(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),s=>{i.length>1?i.forEach(a=>a(s)):i[0](s)}};e("__VUE_INSTANCE_SETTERS__",t=>fa=t),e("__VUE_SSR_SETTERS__",t=>ha=t)}let ha=!1;process.env.NODE_ENV;const g5=/(?:^|[-_])(\w)/g,y5=n=>n.replace(g5,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ym(n,e=!0){return Qe(n)?n.displayName||n.name:n.name||e&&n.__name}function Xm(n,e,t=!1){let r=Ym(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=s=>{for(const a in s)if(s[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?y5(r):t?"App":"Anonymous"}function Zm(n){return Qe(n)&&"__vccOpts"in n}const ge=(n,e)=>{const t=OE(n,e,ha);if(process.env.NODE_ENV!=="production"){const r=m5();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function b5(){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(m){return gt(m)?m.__isVue?["div",n,"VueInstance"]:lt(m)?["div",{},["span",n,p(m)],"<",u("_value"in m?m._value:m),">"]:gs(m)?["div",{},["span",n,bt(m)?"ShallowReactive":"Reactive"],"<",u(m),`>${Fn(m)?" (readonly)":""}`]:Fn(m)?["div",{},["span",n,bt(m)?"ShallowReadonly":"Readonly"],"<",u(m),">"]:null:null},hasBody(m){return m&&m.__isVue},body(m){if(m&&m.__isVue)return["div",{},...s(m.$)]}};function s(m){const y=[];m.type.props&&m.props&&y.push(a("props",he(m.props))),m.setupState!==us&&y.push(a("setup",m.setupState)),m.data!==us&&y.push(a("data",he(m.data)));const _=c(m,"computed");_&&y.push(a("computed",_));const S=c(m,"inject");return S&&y.push(a("injected",S)),y.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:m}]]),y}function a(m,y){return y=or({},y),Object.keys(y).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},m],["div",{style:"padding-left:1.25em"},...Object.keys(y).map(_=>["div",{},["span",r,_+": "],u(y[_],!1)])]]:["span",{}]}function u(m,y=!0){return typeof m=="number"?["span",e,m]:typeof m=="string"?["span",t,JSON.stringify(m)]:typeof m=="boolean"?["span",r,m]:gt(m)?["object",{object:y?he(m):m}]:["span",t,String(m)]}function c(m,y){const _=m.type;if(Qe(_))return;const S={};for(const E in m.ctx)h(_,E,y)&&(S[E]=m.ctx[E]);return S}function h(m,y,_){const S=m[_];if(Fe(S)&&S.includes(y)||gt(S)&&y in S||m.extends&&h(m.extends,y,_)||m.mixins&&m.mixins.some(E=>h(E,y,_)))return!0}function p(m){return bt(m)?"ShallowRef":m.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 _5(){b5()}process.env.NODE_ENV!=="production"&&_5();function et(n){this.content=n}et.prototype={constructor:et,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new et(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new et(t)},addToStart:function(n,e){return new et([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new et(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new et(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=et.from(n),n.size?new et(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=et.from(n),n.size?new et(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=et.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},et.from=function(n){if(n instanceof et)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new et(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let a=0;i.text[a]==s.text[a];a++)t++;return t}if(i.content.size||s.content.size){let a=Qm(i.content,s.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function eg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let a=n.child(--i),u=e.child(--s),c=a.nodeSize;if(a==u){t-=c,r-=c;continue}if(!a.sameMarkup(u))return{a:t,b:r};if(a.isText&&a.text!=u.text){let h=0,p=Math.min(a.text.length,u.text.length);for(;h<p&&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=eg(a.content,u.content,t-1,r-1);if(h)return h}t-=c,r-=c}}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,s){for(let a=0,u=0;u<t;a++){let c=this.content[a],h=u+c.nodeSize;if(h>e&&r(c,i+u,s||null,a)!==!1&&c.content.size){let p=u+1;c.nodesBetween(Math.max(0,e-p),Math.min(c.content.size,t-p),r,i+p)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",a=!0;return this.nodesBetween(e,t,(u,c)=>{let h=u.isText?u.text.slice(Math.max(e,c)-c,t-c):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&r&&(a?a=!1:s+=r),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);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 s=0,a=0;a<t;s++){let u=this.content[s],c=a+u.nodeSize;c>e&&((a<e||c>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=c}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(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new z(i,s)}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 eg(this,e,t,r)}findIndex(e,t=-1){if(e==0)return da(0,e);if(e==this.size)return da(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),a=i+s.nodeSize;if(a>=e)return a==e||t>0?da(r+1,a):da(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 s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}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 Lc={index:0,offset:0};function da(n,e){return Lc.index=n,Lc.offset=e,Lc}function pa(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(!pa(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!pa(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Te=class wh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&pa(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 wh.none;if(e instanceof wh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Te.none=[];class ma 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=ng(this.content,e+this.openStart,t);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,t){return new K(tg(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 s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function tg(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:a,offset:u}=n.findIndex(t);if(i==e||s.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,s.copy(tg(s.content,e-i-1,t-i-1)))}function ng(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),a=n.maybeChild(i);if(s==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let u=ng(a.content,e-s-1,t);return u&&n.replaceChild(i,a.copy(u))}function w5(n,e,t){if(t.openStart>n.depth)throw new ma("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ma("Inconsistent open depths");return rg(n,e,t,0)}function rg(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=rg(n,e,t,r+1);return s.copy(s.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 $r(a,u.cut(0,n.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=v5(t,n);return $r(s,sg(n,a,u,e,r))}else return $r(s,ga(n,e,r))}function ig(n,e){if(!e.type.compatibleContent(n.type))throw new ma("Cannot join "+e.type.name+" onto "+n.type.name)}function Pc(n,e,t){let r=n.node(t);return ig(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 bs(n,e,t,r){let i=(e||n).node(t),s=0,a=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(zr(n.nodeAfter,r),s++));for(let u=s;u<a;u++)zr(i.child(u),r);e&&e.depth==t&&e.textOffset&&zr(e.nodeBefore,r)}function $r(n,e){return n.type.checkContent(e),n.copy(e)}function sg(n,e,t,r,i){let s=n.depth>i&&Pc(n,e,i+1),a=r.depth>i&&Pc(t,r,i+1),u=[];return bs(null,n,i,u),s&&a&&e.index(i)==t.index(i)?(ig(s,a),zr($r(s,sg(n,e,t,r,i+1)),u)):(s&&zr($r(s,ga(n,e,i+1)),u),bs(e,t,i,u),a&&zr($r(a,ga(t,r,i+1)),u)),bs(r,null,i,u),new z(u)}function ga(n,e,t){let r=[];if(bs(null,n,t,r),n.depth>t){let i=Pc(n,e,t+1);zr($r(i,ga(n,e,t+1)),r)}return bs(e,null,t,r),new z(r)}function v5(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(z.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Us{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Te.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 s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 ya(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,s=t;for(let a=e;;){let{index:u,offset:c}=a.content.findIndex(s),h=s-c;if(r.push(a,u,i+c),!h||(a=a.child(u),a.isText))break;s=h-1,i+=c+1}return new Us(t,r,s)}static resolveCached(e,t){let r=og.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==t)return a}else og.set(e,r=new S5);let i=r.elts[r.i]=Us.resolve(e,t);return r.i=(r.i+1)%x5,i}}class S5{constructor(){this.elts=[],this.i=0}}const x5=12,og=new WeakMap;class ya{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 C5=Object.create(null);let fr=class vh{constructor(e,t,r,i=Te.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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&&pa(this.attrs,t||e.defaultAttrs||C5)&&Te.sameSet(this.marks,r||Te.none)}copy(e=null){return e==this.content?this:new vh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vh(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),s=this.resolve(t),a=r?0:i.sharedDepth(t),u=i.start(a),h=i.node(a).content.cut(i.pos-u,s.pos-u);return new K(h,i.depth-a,s.depth-a)}replace(e,t,r){return w5(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 Us.resolveCached(this,e)}resolveNoCache(e){return Us.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.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()+")"),ag(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,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),u=a&&a.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.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),this.type.checkAttrs(this.attrs);let e=Te.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Te.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;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),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};fr.prototype.text=void 0;class Ll extends fr{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):ag(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 Ll(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ll(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 ag(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new E5(e,t);if(r.next==null)return Xr.empty;let i=lg(r);r.next&&r.err("Unexpected trailing text");let s=N5(I5(i));return R5(s,r),s}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 s=t;i&&s<r;s++)i=i.matchType(e.child(s).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 s(a,u){let c=a.matchFragment(e,r);if(c&&(!t||c.validEnd))return z.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:p,next:m}=a.next[h];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let y=s(m,u.concat(p));if(y)return y}}return null}return s(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(),s=i.match;if(s.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<s.next.length;a++){let{type:u,next:c}=s.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!i.type||c.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 s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
31
- `)}}Xr.empty=new Xr(!0);class E5{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 lg(n){let e=[];do e.push(k5(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function k5(n){let e=[];do e.push(A5(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A5(n){let e=M5(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=T5(n,e);else break;return e}function ug(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function T5(n,e){let t=ug(n),r=t;return n.eat(",")&&(n.next!="}"?r=ug(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function O5(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let a=t[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function M5(n){if(n.eat("(")){let e=lg(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=O5(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 I5(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(a,u,c){let h={term:c,to:u};return e[a].push(h),h}function i(a,u){a.forEach(c=>c.to=u)}function s(a,u){if(a.type=="choice")return a.exprs.reduce((c,h)=>c.concat(s(h,u)),[]);if(a.type=="seq")for(let c=0;;c++){let h=s(a.exprs[c],u);if(c==a.exprs.length-1)return h;i(h,u=t())}else if(a.type=="star"){let c=t();return r(u,c),i(s(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=t();return i(s(a.expr,u),c),i(s(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(u)].concat(s(a.expr,u));if(a.type=="range"){let c=u;for(let h=0;h<a.min;h++){let p=t();i(s(a.expr,c),p),c=p}if(a.max==-1)i(s(a.expr,c),c);else for(let h=a.min;h<a.max;h++){let p=t();r(c,p),i(s(a.expr,c),p),c=p}return[r(c)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function cg(n,e){return e-n}function fg(n,e){let t=[];return r(e),t.sort(cg);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let a=0;a<s.length;a++){let{term:u,to:c}=s[a];!u&&t.indexOf(c)==-1&&r(c)}}}function N5(n){let e=Object.create(null);return t(fg(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let p=0;p<i.length;p++)i[p][0]==u&&(h=i[p][1]);fg(n,c).forEach(p=>{h||i.push([u,h=[]]),h.indexOf(p)==-1&&h.push(p)})})});let s=e[r.join(",")]=new Xr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(cg);s.next.push({type:i[a][0],next:e[u.join(",")]||t(u)})}return s}}function R5(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:c,next:h}=i.next[u];a.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function hg(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 dg(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function pg(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function mg(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new P5(n,r,e[r]);return t}let gg=class qy{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=mg(e,r.attrs),this.defaultAttrs=hg(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==Xr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:dg(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),z.from(t),Te.setFrom(r))}createChecked(e=null,t,r){return t=z.from(t),this.checkContent(t),new fr(this,this.computeAttrs(e),t,Te.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),s=i&&i.fillBefore(z.empty,!0);return s?new fr(this,e,t.append(s),Te.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)}`)}checkAttrs(e){pg(this.attrs,e,"node",this.name)}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:Te.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,a)=>r[s]=new qy(s,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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function L5(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class P5{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?L5(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Pl{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=mg(e,i.attrs),this.excluded=null;let s=hg(this.attrs);this.instance=s?new Te(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Te(this,dg(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new Pl(s,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]}checkAttrs(e){pg(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class yg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=et.from(e.nodes),t.marks=et.from(e.marks||{}),this.nodes=gg.compile(this.spec.nodes,this),this.marks=Pl.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 s=this.nodes[i],a=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=Xr.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=u=="_"?null:u?bg(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:bg(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 gg){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 Ll(r,r.defaultAttrs,e,Te.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return Te.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function bg(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],a=s;if(s)t.push(s);else for(let u in n.marks){let c=n.marks[u];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function D5(n){return n.tag!=null}function F5(n){return n.style!=null}let _s=class Sh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(D5(i))this.tags.push(i);else if(F5(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Sg(this,t,!1);return r.addAll(e,Te.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Sg(this,t,!0);return r.addAll(e,Te.none,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 s=this.tags[i];if($5(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let a=this.styles[s],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 c=a.getAttrs(t);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let u=t[a];if((u.priority==null?50:u.priority)<s)break}t.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=xg(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=xg(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Sh(e,Sh.schemaRules(e)))}};const _g={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},B5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wg={ol:!0,ul:!0},ws=1,Dc=2,ba=4;function vg(n,e,t){return e!=null?(e?ws:0)|(e==="full"?Dc:0):n&&n.whitespace=="pre"?ws|Dc:t&-5}class _a{constructor(e,t,r,i,s,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Te.none,this.match=s||(a&ba?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&ws)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.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}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_g.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Sg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,a=vg(null,t.preserveWhitespace,0)|(r?ba:0);i?s=new _a(i.type,i.attrs,Te.none,!0,t.topMatch||i.type.contentMatch,a):r?s=new _a(null,null,Te.none,!0,null,a):s=new _a(e.schema.topNodeType,null,Te.none,!0,null,a),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&Dc?"full":this.localPreserveWS||(i.options&ws)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
32
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),u;wg.hasOwnProperty(a)&&this.parser.normalizeLists&&z5(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:B5.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let h,p=this.needsBlock;if(_g.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let m=c&&c.skip?t:this.readStyles(e,t);m&&this.addAll(e,m),h&&this.sync(s),this.needsBlock=p}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,c,h,c.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],a=r.getPropertyValue(s);if(a)for(let u=void 0;;){let c=this.parser.matchStyle(s,a,this,u);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(h=>!c.clearMark(h)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)u=c;else break}}return t}addElementByRule(e,t,r,i){let s,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let c=this.enter(a,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let u=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(u)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];a!=u;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,t);this.findAtPoint(e,s)}findPlace(e,t){let r,i;for(let s=this.open;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length)&&(r=u,i=a,!u.length)||a.solid)break}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Te.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Cg(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let u=vg(e,s,a.options);a.options&ba&&a.content.length==0&&(u|=ba);let c=Te.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):Cg(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new _a(e,t,c,i,null,u)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ws)}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),s=-(r?r.depth+1:0)+(i?0:1),a=(u,c)=>{for(;u>=0;u--){let h=t[u];if(h==""){if(u==t.length-1||u==0)continue;for(;c>=s;c--)if(a(u-1,c))return!0;return!1}else{let p=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!p||p.name!=h&&!p.isInGroup(h))return!1;c--}}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}}}function z5(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function $5(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function xg(n){let e={};for(let t in n)e[t]=n[t];return e}function Cg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],a=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:p}=u.edge(c);if(h==e||s.indexOf(p)<0&&a(p))return!0}};if(a(i.contentMatch))return!0}}class Vs{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Fc(t).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let u=0,c=0;for(;u<s.length&&c<a.marks.length;){let h=a.marks[c];if(!this.marks[h.type.name]){c++;continue}if(!h.eq(s[u][0])||h.type.spec.spanning===!1)break;u++,c++}for(;u<s.length;)i=s.pop()[1];for(;c<a.marks.length;){let h=a.marks[c++],p=this.serializeMark(h,a.isInline,t);p&&(s.push([h,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=wa(Fc(t),this.nodes[e.type.name](e),null,e.attrs);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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&wa(Fc(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return wa(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vs(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 Fc(n){return n.document||window.document}const kg=new WeakMap;function H5(n){let e=kg.get(n);return e===void 0&&kg.set(n,e=W5(n)),e}function W5(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function wa(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=H5(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let u,c=t?n.createElementNS(t,i):n.createElement(i),h=e[1],p=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){p=2;for(let m in h)if(h[m]!=null){let y=m.indexOf(" ");y>0?c.setAttributeNS(m.slice(0,y),m.slice(y+1),h[m]):c.setAttribute(m,h[m])}}for(let m=p;m<e.length;m++){let y=e[m];if(y===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:_,contentDOM:S}=wa(n,y,t,r);if(c.appendChild(_),S){if(u)throw new RangeError("Multiple content holes");u=S}}}return{dom:c,contentDOM:u}}const Ag=65535,Tg=Math.pow(2,16);function V5(n,e){return n+e*Tg}function Og(n){return n&Ag}function U5(n){return(n-(n&Ag))/Tg}const Mg=1,Ig=2,va=4,Ng=8;class Bc{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ng)>0}get deletedBefore(){return(this.delInfo&(Mg|va))>0}get deletedAfter(){return(this.delInfo&(Ig|va))>0}get deletedAcross(){return(this.delInfo&va)>0}}class Lt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Lt.empty)return Lt.empty}recover(e){let t=0,r=Og(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+U5(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,s=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],p=this.ranges[u+a],m=c+h;if(e<=m){let y=h?e==c?-1:e==m?1:t:t,_=c+i+(y<0?0:p);if(r)return _;let S=e==(t<0?c:m)?null:V5(u/3,e-c),E=e==c?Ig:e==m?Mg:va;return(t<0?e!=c:e!=m)&&(E|=Ng),new Bc(_,E,S)}i+=p-h}return r?e+i:new Bc(e+i,0,null)}touches(e,t){let r=0,i=Og(t),s=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],p=c+h;if(e<=p&&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,s=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+t],p=this.ranges[i+r];e(u,u+h,c,c+p),s+=p-h}}invert(){return new Lt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Lt.empty:new Lt(e<0?[0,-e,0]:[0,0,e])}}Lt.empty=new Lt([]);class Fi{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 Fi(this.maps,this.mirror,e,t)}copy(){return new Fi(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 Fi;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 s=this.from;s<this.to;s++){let a=this.maps[s],u=a.mapResult(e,t);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this.maps[c].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Bc(e,i,null)}}const zc=Object.create(null);class Ue{getMap(){return Lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zc[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 zc)throw new RangeError("Duplicate use of step JSON ID "+e);return zc[e]=t,t.prototype.jsonID=e,t}}class De{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new De(e,null)}static fail(e){return new De(null,e)}static fromReplace(e,t,r,i){try{return De.ok(e.replace(t,r,i))}catch(s){if(s instanceof ma)return De.fail(s.message);throw s}}}function $c(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy($c(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return z.fromArray(r)}class Er extends Ue{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)),s=new K($c(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 De.fromReplace(e,this.from,this.to,s)}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 Er(t.pos,r.pos,this.mark)}merge(e){return e instanceof Er&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Er(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 Er(t.from,t.to,e.markFromJSON(t.mark))}}Ue.jsonID("addMark",Er);class wn extends Ue{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($c(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return De.fromReplace(e,this.from,this.to,r)}invert(){return new Er(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))}}Ue.jsonID("removeMark",wn);class kr extends Ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return De.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 kr(this.pos,t.marks[i]);return new kr(this.pos,this.mark)}}return new Bi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kr(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 kr(t.pos,e.markFromJSON(t.mark))}}Ue.jsonID("addNodeMark",kr);class Bi extends Ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return De.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 kr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(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 Bi(t.pos,e.markFromJSON(t.mark))}}Ue.jsonID("removeNodeMark",Bi);class je extends Ue{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Hc(e,this.from,this.to)?De.fail("Structure replace would overwrite content"):De.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Lt([this.from,this.to-this.from,this.slice.size])}invert(e){return new je(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 je(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof je)||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 je(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 je(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 je(t.from,t.to,K.fromJSON(e,t.slice),!!t.structure)}}Ue.jsonID("replace",je);class Je extends Ue{constructor(e,t,r,i,s,a,u=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Hc(e,this.from,this.gapFrom)||Hc(e,this.gapTo,this.to)))return De.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return De.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?De.fromReplace(e,this.from,this.to,r):De.fail("Content does not fit in gap")}getMap(){return new Lt([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 Je(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=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Je(t.pos,r.pos,i,s,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 Je(t.from,t.to,t.gapFrom,t.gapTo,K.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ue.jsonID("replaceAround",Je);function Hc(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function q5(n,e,t,r){let i=[],s=[],a,u;n.doc.nodesBetween(e,t,(c,h,p)=>{if(!c.isInline)return;let m=c.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let y=Math.max(h,e),_=Math.min(h+c.nodeSize,t),S=r.addToSet(m);for(let E=0;E<m.length;E++)m[E].isInSet(S)||(a&&a.to==y&&a.mark.eq(m[E])?a.to=_:i.push(a=new wn(y,_,m[E])));u&&u.to==y?u.to=_:s.push(u=new Er(y,_,r))}}),i.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function K5(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(a,u)=>{if(!a.isInline)return;s++;let c=null;if(r instanceof Pl){let h=a.marks,p;for(;p=r.isInSet(h);)(c||(c=[])).push(p),h=p.removeFromSet(h)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let h=Math.min(u+a.nodeSize,t);for(let p=0;p<c.length;p++){let m=c[p],y;for(let _=0;_<i.length;_++){let S=i[_];S.step==s-1&&m.eq(i[_].style)&&(y=S)}y?(y.to=h,y.step=s):i.push({style:m,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(a=>n.step(new wn(a.from,a.to,a.style)))}function Wc(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),a=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),p=u+h.nodeSize,m=r.matchType(h.type);if(!m)a.push(new je(u,p,K.empty));else{r=m;for(let y=0;y<h.marks.length;y++)t.allowsMarkType(h.marks[y].type)||n.step(new wn(u,p,h.marks[y]));if(i&&h.isText&&t.whitespace!="pre"){let y,_=/\r?\n|\r/g,S;for(;y=_.exec(h.text);)S||(S=new K(z.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),a.push(new je(u+y.index,u+y.index+y[0].length,S))}}u=p}if(!r.validEnd){let c=r.fillBefore(z.empty,!0);n.replace(u,u,new K(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function G5(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Si(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,a,t))return r;if(r==0||i.type.spec.isolating||!G5(i,s,a))break}return null}function J5(n,e,t){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),u=i.after(s+1),c=a,h=u,p=z.empty,m=0;for(let S=s,E=!1;S>t;S--)E||r.index(S)>0?(E=!0,p=z.from(r.node(S).copy(p)),m++):c--;let y=z.empty,_=0;for(let S=s,E=!1;S>t;S--)E||i.after(S+1)<i.end(S)?(E=!0,y=z.from(i.node(S).copy(y)),_++):h++;n.step(new Je(c,h,a,u,new K(p.append(y),m,_),p.size-m,!0))}function Vc(n,e,t=null,r=n){let i=j5(n,e),s=i&&Y5(r,e);return s?i.map(Rg).concat({type:e,attrs:t}).concat(s.map(Rg)):null}function Rg(n){return{type:n,attrs:null}}function j5(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return t.canReplaceWith(r,i,a)?s:null}function Y5(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(t.child(h).type);return!c||!c.validEnd?null:a}function X5(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,s=e.end;n.step(new Je(i,s,i,s,new K(r,0,0),t.length,!0))}function Z5(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(a,u)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&Q5(n.doc,n.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let _=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);_&&!S?h=!1:!_&&S&&(h=!0)}h===!1&&Pg(n,a,u,s),Wc(n,n.mapping.slice(s).map(u,1),r,void 0,h===null);let p=n.mapping.slice(s),m=p.map(u,1),y=p.map(u+a.nodeSize,1);return n.step(new Je(m,y,m+1,y-1,new K(z.from(r.create(c,null,a.marks)),0,0),1,!0)),h===!0&&Lg(n,a,u,s),!1}})}function Lg(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(i.text);){let c=n.mapping.slice(r).map(t+1+s+a.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Pg(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+s);n.replaceWith(a,a+1,e.type.schema.text(`
34
- `))}})}function Q5(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function ek(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let a=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,a);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new K(z.from(a),0,0),1,!0))}function zn(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,a=r&&r[r.length-1]||i.parent;if(s<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,p=t-2;h>s;h--,p--){let m=i.node(h),y=i.index(h);if(m.type.spec.isolating)return!1;let _=m.content.cutByIndex(y,m.childCount),S=r&&r[p+1];S&&(_=_.replaceChild(0,S.type.create(S.attrs)));let E=r&&r[p]||m;if(!m.canReplace(y+1,m.childCount)||!E.type.validContent(_))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function tk(n,e,t=1,r){let i=n.doc.resolve(e),s=z.empty,a=z.empty;for(let u=i.depth,c=i.depth-t,h=t-1;u>c;u--,h--){s=z.from(i.node(u).copy(s));let p=r&&r[h];a=z.from(p?p.type.create(p.attrs,a):i.node(u).copy(a))}n.step(new je(e,e,new K(s.append(a),t,t),!0))}function hr(n,e){let t=n.resolve(e),r=t.index();return Dg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function nk(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),a=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Dg(n,e){return!!(n&&e&&!n.isLeaf&&nk(n,e))}function Sa(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,a,u=r.index(i);if(i==r.depth?(s=r.nodeBefore,a=r.nodeAfter):t>0?(s=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(s=r.node(i).maybeChild(u-1),a=r.node(i+1)),s&&!s.isTextblock&&Dg(s,a)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function rk(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),a=s.node().type;if(i&&a.inlineContent){let p=a.whitespace=="pre",m=!!a.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let u=n.steps.length;if(r===!1){let p=n.doc.resolve(e+t);Pg(n,p.node(),p.before(),u)}a.inlineContent&&Wc(n,e+t-1,a,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(u),h=c.map(e-t);if(n.step(new je(h,c.map(e+t,-1),K.empty,!0)),r===!0){let p=n.doc.resolve(h);Lg(n,p.node(),p.before(),n.steps.length)}return n}function ik(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function sk(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)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,c=r.index(a)+(u>0?1:0),h=r.node(a),p=!1;if(s==1)p=h.canReplace(c,c,i);else{let m=h.contentMatchAt(c).findWrapping(i.firstChild.type);p=m&&h.canReplaceWith(c,c,m[0])}if(p)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function xa(n,e,t=e,r=K.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fg(i,s,r)?new je(e,t,r):new ok(i,s,r).fit()}function Fg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class ok{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 s=e.node(i);this.frontier.push({type:s.type,match:s.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 s=this.placed,a=r.depth,u=i.depth;for(;a&&u&&s.childCount==1;)s=s.firstChild.content,a--,u--;let c=new K(s,a,u);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new je(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Uc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],p,m=null;if(t==1&&(a?h.matchType(a.type)||(m=h.fillBefore(z.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:m};if(t==2&&a&&(p=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:p};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Uc(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=Uc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new K(vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new K(vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let a=this.unplaced,u=r?r.content:a.content,c=a.openStart-e,h=0,p=[],{match:m,type:y}=this.frontier[t];if(i){for(let E=0;E<i.childCount;E++)p.push(i.child(E));m=m.matchFragment(i)}let _=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let E=u.child(h),N=m.matchType(E.type);if(!N)break;h++,(h>1||c==0||E.content.size)&&(m=N,p.push(Bg(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?_:-1)))}let S=h==u.childCount;S||(_=-1),this.placed=Ss(this.placed,t,z.from(p)),this.frontier[t].match=m,S&&_<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,N=u;E<_;E++){let g=N.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),N=g.content}this.unplaced=S?e==0?K.empty:new K(vs(a.content,e-1,1),e-1,_<0?a.openEnd:e-1):new K(vs(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||!qc(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=qc(e,t,i,r,s);if(a){for(let u=t-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],p=qc(e,u,h,c,!0);if(!p||p.childCount)continue e}return{depth:t,fit:a,move:s?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=Ss(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ss(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=Ss(this.placed,this.frontier.length,t))}}function vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(vs(n.firstChild.content,e-1,t)))}function Ss(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ss(n.lastChild.content,e-1,t)))}function Uc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Bg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Bg(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 qc(n,e,t,r,i){let s=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==s.childCount&&!t.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,a);return u&&!ak(t,s.content,a)?u:null}function ak(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function lk(n){return n.spec.defining||n.spec.definingForContent}function uk(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Fg(i,s,r))return n.step(new je(e,t,r));let a=$g(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let y=i.depth,_=i.pos-1;y>0;y--,_--){let S=i.node(y).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(y)>-1?u=y:i.before(y)==_&&a.splice(1,0,-y)}let c=a.indexOf(u),h=[],p=r.openStart;for(let y=r.content,_=0;;_++){let S=y.firstChild;if(h.push(S),_==r.openStart)break;y=S.content}for(let y=p-1;y>=0;y--){let _=h[y],S=lk(_.type);if(S&&!_.sameMarkup(i.node(Math.abs(u)-1)))p=y;else if(S||!_.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let _=(y+p+1)%(r.openStart+1),S=h[_];if(S)for(let E=0;E<a.length;E++){let N=a[(E+c)%a.length],g=!0;N<0&&(g=!1,N=-N);let v=i.node(N-1),k=i.index(N-1);if(v.canReplaceWith(k,k,S.type,S.marks))return n.replace(i.before(N),g?s.after(N):t,new K(zg(r.content,0,r.openStart,_),_,r.openEnd))}}let m=n.steps.length;for(let y=a.length-1;y>=0&&(n.replace(e,t,r),!(n.steps.length>m));y--){let _=a[y];_<0||(e=i.before(_),t=s.after(_))}}function zg(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(zg(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(z.empty,!0))}return n}function ck(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=ik(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new K(z.from(r),0,0))}function fk(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=$g(r,i);for(let a=0;a<s.length;a++){let u=s[a],c=a==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return n.delete(r.start(u),i.end(u));if(u>0&&(c||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&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function $g(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class zi extends Ue{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 De.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return De.fromReplace(e,this.pos,this.pos+1,new K(z.from(i),0,t.isLeaf?0:1))}getMap(){return Lt.empty}invert(e){return new zi(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 zi(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 zi(t.pos,t.attr,t.value)}}Ue.jsonID("attr",zi);class qs extends Ue{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return De.ok(r)}getMap(){return Lt.empty}invert(e){return new qs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new qs(t.attr,t.value)}}Ue.jsonID("docAttr",qs);let xi=class extends Error{};xi=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},xi.prototype=Object.create(Error.prototype),xi.prototype.constructor=xi,xi.prototype.name="TransformError";class hk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new xi(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=xa(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 uk(this,e,t,r),this}replaceRangeWith(e,t,r){return ck(this,e,t,r),this}deleteRange(e,t){return fk(this,e,t),this}lift(e,t){return J5(this,e,t),this}join(e,t=1){return rk(this,e,t),this}wrap(e,t){return X5(this,e,t),this}setBlockType(e,t=e,r,i=null){return Z5(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return ek(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new zi(e,t,r)),this}setDocAttribute(e,t){return this.step(new qs(e,t)),this}addNodeMark(e,t){return this.step(new kr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Te)){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 Bi(e,t)),this}split(e,t=1,r){return tk(this,e,t,r),this}addMark(e,t,r){return q5(this,e,t,r),this}removeMark(e,t,r){return K5(this,e,t,r),this}clearIncompatible(e,t,r){return Wc(this,e,t,r),this}}const Kc=Object.create(null);class ye{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new dk(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 s=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:c,$to:h}=a[u],p=e.mapping.slice(s);e.replaceRange(p.map(c.pos),p.map(h.pos),u?K.empty:t),u==0&&Vg(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:u}=i[s],c=e.mapping.slice(r),h=c.map(a.pos),p=c.map(u.pos);s?e.deleteRange(h,p):(e.replaceRangeWith(h,p,t),Vg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new pe(e):Ci(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let a=t<0?Ci(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Ci(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Rt(e.node(0))}static atStart(e){return Ci(e,e,0,0,1)||new Rt(e)}static atEnd(e){return Ci(e,e,e.content.size,e.childCount,-1)||new Rt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Kc[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 Kc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Kc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}}ye.prototype.visible=!0;class dk{constructor(e,t){this.$from=e,this.$to=t}}let Hg=!1;function Wg(n){!Hg&&!n.parent.inlineContent&&(Hg=!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){Wg(e),Wg(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 Dl(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 s=ye.findFrom(t,r,!0)||ye.findFrom(t,-r,!0);if(s)t=s.$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 Dl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Dl(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Q 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),s=e.resolve(i);return r?ye.near(s):new Q(s)}content(){return new K(z.from(this.node),0,0)}eq(e){return e instanceof Q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new xh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Q(e.resolve(t.anchor))}static create(e,t){return new Q(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Q.prototype.visible=!1,ye.jsonID("node",Q);class xh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Dl(r,r):new xh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Q.isSelectable(r)?new Q(t):ye.near(t)}}class Rt 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 Rt(e)}map(e){return new Rt(e)}eq(e){return e instanceof Rt}getBookmark(){return pk}}ye.jsonID("all",Rt);const pk={map(){return this},resolve(n){return new Rt(n)}};function Ci(n,e,t,r,i,s=!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(!s&&Q.isSelectable(u))return Q.create(n,t-(i<0?u.nodeSize:0))}else{let c=Ci(n,u,t+i,i<0?u.childCount:0,i,s);if(c)return c}t+=u.nodeSize*i}return null}function Vg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof je||i instanceof Je))return;let s=n.mapping.maps[r],a;s.forEach((u,c,h,p)=>{a==null&&(a=p)}),n.setSelection(ye.near(n.doc.resolve(a),t))}function Ug(n,e){return!e||!n?n:n.bind(e)}class Ca{constructor(e,t,r){this.name=e,this.init=Ug(t.init,r),this.apply=Ug(t.apply,r)}}new Ca("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ca("selection",{init(n,e){return n.selection||ye.atStart(e.doc)},apply(n){return n.selection}}),new Ca("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ca("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function qg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=qg(i,e,{})),t[r]=i}return t}class ct{constructor(e){this.spec=e,this.props={},e.props&&qg(e.props,this,this.props),this.key=e.key?e.key.key:Kg("plugin")}getState(e){return e[this.key]}}const Gc=Object.create(null);function Kg(n){return n in Gc?n+"$"+ ++Gc[n]:(Gc[n]=0,n+"$")}class Mt{constructor(e="key"){this.key=Kg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Hr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Gg=function(n,e,t,r){return t&&(Jg(n,e,t,r,-1)||Jg(n,e,t,r,1))},mk=/^(img|br|input|textarea|hr)$/i;function Jg(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ea(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Jc(n)||mk.test(n.nodeName)||n.contentEditable=="false")return!1;e=Hr(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Ea(n):0}else return!1}}function Ea(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function gk(n,e,t){for(let r=e==0,i=e==Ea(n);r||i;){if(n==t)return!0;let s=Hr(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Ea(n)}}function Jc(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 jg=function(n){return n.focusNode&&Gg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Yg(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const pn=typeof navigator<"u"?navigator:null,Xg=typeof document<"u"?document:null,dr=pn&&pn.userAgent||"",jc=/Edge\/(\d+)/.exec(dr),Zg=/MSIE \d/.exec(dr),Yc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dr),xs=!!(Zg||Yc||jc),Qg=Zg?document.documentMode:Yc?+Yc[1]:jc?+jc[1]:0,ka=!xs&&/gecko\/(\d+)/i.test(dr);ka&&+(/Firefox\/(\d+)/.exec(dr)||[0,0])[1];const Xc=!xs&&/Chrome\/(\d+)/.exec(dr),pr=!!Xc,e0=Xc?+Xc[1]:0,Wr=!xs&&!!pn&&/Apple Computer/.test(pn.vendor),Zc=Wr&&(/Mobile\/\w+/.test(dr)||!!pn&&pn.maxTouchPoints>2),Kt=Zc||(pn?/Mac/.test(pn.platform):!1),yk=pn?/Win/.test(pn.platform):!1,Cs=/Android \d/.test(dr),Qc=!!Xg&&"webkitFontSmoothing"in Xg.documentElement.style,bk=Qc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _k(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let u=r.resolve(a),c,h;if(jg(t)){for(c=a;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Q.isSelectable(m)&&i.parent&&!(m.isInline&&gk(t.focusNode,t.focusOffset,i.dom))){let y=i.posBefore;h=new Q(a==y?u:r.resolve(y))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let m=a,y=a;for(let _=0;_<t.rangeCount;_++){let S=t.getRangeAt(_);m=Math.min(m,n.docView.posFromDOM(S.startContainer,S.startOffset,1)),y=Math.max(y,n.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[c,a]=y==n.state.selection.anchor?[y,m]:[m,y],u=r.resolve(a)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let p=r.resolve(c);if(!h){let m=e=="pointer"||n.state.selection.head<u.pos&&!s?1:-1;h=o0(n,p,u,m)}return h}function t0(n){return n.editable?n.hasFocus():xk(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ef(n,e=!1){let t=n.state.selection;if(Sk(n,t),!!t0(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&pr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Gg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)vk(n);else{let{anchor:r,head:i}=t,s,a;n0&&!(t instanceof pe)&&(t.$from.parent.inlineContent||(s=r0(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=r0(n,t.to))),n.docView.setSelection(r,i,n,e),n0&&(s&&i0(s),a&&i0(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&wk(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const n0=Wr||pr&&e0<63;function r0(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Wr&&i&&i.contentEditable=="false")return tf(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return tf(i);if(s)return tf(s)}}function tf(n){return n.contentEditable="true",Wr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function i0(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function wk(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(()=>{(!t0(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function vk(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Hr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xs&&Qg<=11&&(r.disabled=!0,r.disabled=!1)}function Sk(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(s0(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else s0(n)}function s0(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function o0(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||pe.between(e,t,r)}function xk(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 nf(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ye.findFrom(s,e)}function mr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function a0(n,e,t){let r=n.state.selection;if(r instanceof pe)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return mr(n,new pe(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=nf(n.state,e);return i&&i instanceof Q?mr(n,i):!1}else if(!(Kt&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=n.docView.descAt(u))&&!a.contentDOM?Q.isSelectable(s)?mr(n,new Q(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Qc?mr(n,new pe(n.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Q&&r.node.isInline)return mr(n,new pe(e>0?r.$to:r.$from));{let i=nf(n.state,e);return i?mr(n,i):!1}}}function Aa(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Es(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ei(n,e){return e<0?Ck(n):Ek(n)}function Ck(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,a=!1;for(ka&&t.nodeType==1&&r<Aa(t)&&Es(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let u=t.childNodes[r-1];if(Es(u,-1))i=t,s=--r;else if(u.nodeType==3)t=u,r=t.nodeValue.length;else break}}else{if(l0(t))break;{let u=t.previousSibling;for(;u&&Es(u,-1);)i=t.parentNode,s=Hr(u),u=u.previousSibling;if(u)t=u,r=Aa(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?rf(n,t,r):i&&rf(n,i,s)}function Ek(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Aa(t),s,a;for(;;)if(r<i){if(t.nodeType!=1)break;let u=t.childNodes[r];if(Es(u,1))s=t,a=++r;else break}else{if(l0(t))break;{let u=t.nextSibling;for(;u&&Es(u,1);)s=u.parentNode,a=Hr(u)+1,u=u.nextSibling;if(u)t=u,r=0,i=Aa(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&rf(n,s,a)}function l0(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function kk(n,e){for(;n&&e==n.childNodes.length&&!Jc(n);)e=Hr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Ak(n,e){for(;n&&!e&&!Jc(n);)e=Hr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function rf(n,e,t){if(e.nodeType!=3){let s,a;(a=kk(e,t))?(e=a,t=0):(s=Ak(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(jg(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&ef(n)},50)}function u0(n,e){let t=n.state.doc.resolve(e);if(!(pr||yk)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function c0(n,e,t){let r=n.state.selection;if(r instanceof pe&&!r.empty||t.indexOf("s")>-1||Kt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=nf(n.state,e);if(a&&a instanceof Q)return mr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:s,u=r instanceof Rt?ye.near(a,e):ye.findFrom(a,e);return u?mr(n,u):!1}return!1}function f0(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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let a=n.state.tr;return e<0?a.delete(t.pos-s.nodeSize,t.pos):a.delete(t.pos,t.pos+s.nodeSize),n.dispatch(a),!0}return!1}function h0(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Tk(n){if(!Wr||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;h0(n,r,"true"),setTimeout(()=>h0(n,r,"false"),20)}return!1}function Ok(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Mk(n,e){let t=e.keyCode,r=Ok(e);if(t==8||Kt&&t==72&&r=="c")return f0(n,-1)||Ei(n,-1);if(t==46&&!e.shiftKey||Kt&&t==68&&r=="c")return f0(n,1)||Ei(n,1);if(t==13||t==27)return!0;if(t==37||Kt&&t==66&&r=="c"){let i=t==37?u0(n,n.state.selection.from)=="ltr"?-1:1:-1;return a0(n,i,r)||Ei(n,i)}else if(t==39||Kt&&t==70&&r=="c"){let i=t==39?u0(n,n.state.selection.from)=="ltr"?1:-1:1;return a0(n,i,r)||Ei(n,i)}else{if(t==38||Kt&&t==80&&r=="c")return c0(n,-1,r)||Ei(n,-1);if(t==40||Kt&&t==78&&r=="c")return Tk(n)||c0(n,1,r)||Ei(n,1);if(r==(Kt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function d0(n,e){n.someProp("transformCopied",_=>{e=_(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let _=r.firstChild;t.push(_.type.name,_.attrs!=_.type.defaultAttrs?_.attrs:null),r=_.content}let a=n.someProp("clipboardSerializer")||Vs.fromSchema(n.state.schema),u=v0(),c=u.createElement("div");c.appendChild(a.serializeFragment(r,{document:u}));let h=c.firstChild,p,m=0;for(;h&&h.nodeType==1&&(p=_0[h.nodeName.toLowerCase()]);){for(let _=p.length-1;_>=0;_--){let S=u.createElement(p[_]);for(;c.firstChild;)S.appendChild(c.firstChild);c.appendChild(S),m++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(t)}`);let y=n.someProp("clipboardTextSerializer",_=>_(e,n))||e.content.textBetween(0,e.content.size,`
28
+ `,...DE(i)),console.warn(...s)}Xo(),Ac=!1}function PE(){let n=zr[zr.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 DE(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
29
+ `],...FE(t))}),e}function FE({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${Xm(n.component,n.type,r)}`,s=">"+t;return n.props?[i,...BE(n.props),s]:[i+s]}function BE(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...Lm(r,n[r]))}),t.length>3&&e.push(" ..."),e}function Lm(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}`]:lt(e)?(e=Lm(n,he(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):Qe(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=he(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 sa(n,e,t,r){try{return r?n(...r):n()}catch(i){Mc(i,e,t)}}function Dm(n,e,t,r){if(Qe(n)){const i=sa(n,e,t,r);return i&&jC(i)&&i.catch(s=>{Mc(s,e,t)}),i}if(Fe(n)){const i=[];for(let s=0;s<n.length;s++)i.push(Dm(n[s],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ut(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Mc(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||us;if(e){let u=e.parent;const c=e.proxy,h=process.env.NODE_ENV!=="production"?Pm[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;u;){const p=u.ec;if(p){for(let m=0;m<p.length;m++)if(p[m](n,c,h)===!1)return}u=u.parent}if(s){Yo(),sa(s,null,10,[n,c,h]),Xo();return}}zE(n,t,i,r,a)}function zE(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const s=Pm[e];if(t&&RE(t),ut(`Unhandled error${s?` during execution of ${s}`:""}`),t&&LE(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const Kt=[];let Bn=-1;const bi=[];let cr=null,_i=0;const $E=Promise.resolve();let Oc=null;const HE=100;function WE(n){let e=Bn+1,t=Kt.length;for(;e<t;){const r=e+t>>>1,i=Kt[r],s=ys(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function Fm(n){if(!(n.flags&1)){const e=ys(n),t=Kt[Kt.length-1];!t||!(n.flags&2)&&e>=ys(t)?Kt.push(n):Kt.splice(WE(e),0,n),n.flags|=1,Bm()}}function Bm(){Oc||(Oc=$E.then($m))}function zm(n){Fe(n)?bi.push(...n):cr&&n.id===-1?cr.splice(_i+1,0,n):n.flags&1||(bi.push(n),n.flags|=1),Bm()}function VE(n){if(bi.length){const e=[...new Set(bi)].sort((t,r)=>ys(t)-ys(r));if(bi.length=0,cr){cr.push(...e);return}for(cr=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),_i=0;_i<cr.length;_i++){const t=cr[_i];process.env.NODE_ENV!=="production"&&Hm(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}cr=null,_i=0}}const ys=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=>Hm(n,t):pi;try{for(Bn=0;Bn<Kt.length;Bn++){const t=Kt[Bn];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),sa(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;Bn<Kt.length;Bn++){const t=Kt[Bn];t&&(t.flags&=-2)}Bn=-1,Kt.length=0,VE(n),Oc=null,(Kt.length||bi.length)&&$m(n)}}function Hm(n,e){const t=n.get(e)||0;if(t>HE){const r=e.i,i=r&&Ym(r.type);return Mc(`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 Ic=new Map;process.env.NODE_ENV!=="production"&&(jo().__VUE_HMR_RUNTIME__={createRecord:Nc(UE),rerender:Nc(qE),reload:Nc(KE)});const oa=new Map;function UE(n,e){return oa.has(n)?!1:(oa.set(n,{initialDef:aa(e),instances:new Set}),!0)}function aa(n){return Zm(n)?n.__vccOpts:n}function qE(n,e){const t=oa.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,aa(r.type).render=e),r.renderCache=[],r.update()}))}function KE(n,e){const t=oa.get(n);if(!t)return;e=aa(e),Wm(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const s=r[i],a=aa(s.type);let u=Ic.get(a);u||(a!==t.initialDef&&Wm(a,e),Ic.set(a,u=new Set)),u.add(s),s.appContext.propsCache.delete(s.type),s.appContext.emitsCache.delete(s.type),s.appContext.optionsCache.delete(s.type),s.ceReload?(u.add(s),s.ceReload(e.styles),u.delete(s)):s.parent?Fm(()=>{s.parent.update(),u.delete(s)}):s.appContext.reload?s.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),s.root.ce&&s!==s.root&&s.root.ce._removeChildStyle(a)}zm(()=>{Ic.clear()})}function Wm(n,e){or(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function Nc(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 wi,la=[];function Vm(n,e){var t,r;wi=n,wi?(wi.enabled=!0,la.forEach(({event:i,args:s})=>wi.emit(i,...s)),la=[]):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(s=>{Vm(s,e)}),setTimeout(()=>{wi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,la=[])},3e3)):la=[]}let vi=null,GE=null;const JE=n=>n.__isTeleport;function Um(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Um(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}jo().requestIdleCallback,jo().cancelIdleCallback;const jE=Symbol.for("v-ndc"),YE={};process.env.NODE_ENV!=="production"&&(YE.ownKeys=n=>(ut("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 XE=null;function ZE(n,e,t=!1){const r=fa||vi;if(r||XE){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&&Qe(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ut(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ut("inject() can only be used inside setup() or functional components.")}const QE={},qm=n=>Object.getPrototypeOf(n)===QE,e5=o5,t5=Symbol.for("v-scx"),n5=()=>{{const n=ZE(t5);return n||process.env.NODE_ENV!=="production"&&ut("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function r5(n,e,t){return process.env.NODE_ENV!=="production"&&!Qe(e)&&ut("`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."),i5(n,e,t)}function i5(n,e,t=us){const{immediate:r,deep:i,flush:s,once:a}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ut('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ut('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),a!==void 0&&ut('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=ut);const c=e&&r||!e&&s!=="post";let h;if(ha){if(s==="sync"){const _=n5();h=_.__watcherHandles||(_.__watcherHandles=[])}else if(!c){const _=()=>{};return _.stop=pi,_.resume=pi,_.pause=pi,_}}const p=fa;u.call=(_,S,E)=>Dm(_,p,S,E);let m=!1;s==="post"?u.scheduler=_=>{e5(_,p&&p.suspense)}:s!=="sync"&&(m=!0,u.scheduler=(_,S)=>{S?_():Fm(_)}),u.augmentJob=_=>{e&&(_.flags|=4),m&&(_.flags|=2,p&&(_.id=p.uid,_.i=p))};const y=NE(n,e,u);return ha&&(h?h.push(y):c&&y()),y}const s5=n=>n.__isSuspense;function o5(n,e){e&&e.pendingBranch?Fe(n)?e.effects.push(...n):e.effects.push(n):zm(n)}const Km=Symbol.for("v-fgt"),a5=Symbol.for("v-txt"),l5=Symbol.for("v-cmt");function u5(n){return n?n.__v_isVNode===!0:!1}const c5=(...n)=>Jm(...n),Gm=({key:n})=>n??null,ua=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Ln(n)||lt(n)||Qe(n)?{i:vi,r:n,k:e,f:!!t}:n:null);function f5(n,e=null,t=null,r=0,i=null,s=n===Km?0:1,a=!1,u=!1){const c={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Gm(e),ref:e&&ua(e),scopeId:GE,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:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:vi};return u?(Rc(c,t),s&128&&n.normalize(c)):t&&(c.shapeFlag|=Ln(t)?8:16),process.env.NODE_ENV!=="production"&&c.key!==c.key&&ut("VNode created with invalid key (NaN). VNode type:",c.type),c}const h5=process.env.NODE_ENV!=="production"?c5:Jm;function Jm(n,e=null,t=null,r=0,i=null,s=!1){if((!n||n===jE)&&(process.env.NODE_ENV!=="production"&&!n&&ut(`Invalid vnode type when creating vnode: ${n}.`),n=l5),u5(n)){const u=ca(n,e,!0);return t&&Rc(u,t),u.patchFlag=-2,u}if(Zm(n)&&(n=n.__vccOpts),e){e=d5(e);let{class:u,style:c}=e;u&&!Ln(u)&&(e.class=pc(u)),gt(c)&&(ta(c)&&!Fe(c)&&(c=or({},c)),e.style=dc(c))}const a=Ln(n)?1:s5(n)?128:JE(n)?64:gt(n)?4:Qe(n)?2:0;return process.env.NODE_ENV!=="production"&&a&4&&ta(n)&&(n=he(n),ut("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`.",`
30
+ Component that was made reactive: `,n)),f5(n,e,t,r,i,a,s,!0)}function d5(n){return n?ta(n)||qm(n)?or({},n):n:null}function ca(n,e,t=!1,r=!1){const{props:i,ref:s,patchFlag:a,children:u,transition:c}=n,h=e?m5(i||{},e):i,p={__v_isVNode:!0,__v_skip:!0,type:n.type,props:h,key:h&&Gm(h),ref:e&&e.ref?t&&s?Fe(s)?s.concat(ua(e)):[s,ua(e)]:ua(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&a===-1&&Fe(u)?u.map(jm):u,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Km?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:c,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&ca(n.ssContent),ssFallback:n.ssFallback&&ca(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return c&&r&&Um(p,c.clone(p)),p}function jm(n){const e=ca(n);return Fe(n.children)&&(e.children=n.children.map(jm)),e}function p5(n=" ",e=0){return h5(a5,null,n,e)}function Rc(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Fe(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Rc(n,i()),i._c&&(i._d=!0));return}else t=32,!e._&&!qm(e)&&(e._ctx=vi);else Qe(e)?(e={default:e,_ctx:vi},t=32):(e=String(e),r&64?(t=16,e=[p5(e)]):t=8);n.children=e,n.shapeFlag|=t}function m5(...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=pc([e.class,r.class]));else if(i==="style")e.style=dc([e.style,r.style]);else if(KC(i)){const s=e[i],a=r[i];a&&s!==a&&!(Fe(s)&&s.includes(a))&&(e[i]=s?[].concat(s,a):a)}else i!==""&&(e[i]=r[i])}return e}let fa=null;const g5=()=>fa||vi;{const n=jo(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),s=>{i.length>1?i.forEach(a=>a(s)):i[0](s)}};e("__VUE_INSTANCE_SETTERS__",t=>fa=t),e("__VUE_SSR_SETTERS__",t=>ha=t)}let ha=!1;process.env.NODE_ENV;const y5=/(?:^|[-_])(\w)/g,b5=n=>n.replace(y5,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ym(n,e=!0){return Qe(n)?n.displayName||n.name:n.name||e&&n.__name}function Xm(n,e,t=!1){let r=Ym(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=s=>{for(const a in s)if(s[a]===e)return a};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?b5(r):t?"App":"Anonymous"}function Zm(n){return Qe(n)&&"__vccOpts"in n}const ge=(n,e)=>{const t=OE(n,e,ha);if(process.env.NODE_ENV!=="production"){const r=g5();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function _5(){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(m){return gt(m)?m.__isVue?["div",n,"VueInstance"]:lt(m)?["div",{},["span",n,p(m)],"<",u("_value"in m?m._value:m),">"]:gs(m)?["div",{},["span",n,bt(m)?"ShallowReactive":"Reactive"],"<",u(m),`>${Fn(m)?" (readonly)":""}`]:Fn(m)?["div",{},["span",n,bt(m)?"ShallowReadonly":"Readonly"],"<",u(m),">"]:null:null},hasBody(m){return m&&m.__isVue},body(m){if(m&&m.__isVue)return["div",{},...s(m.$)]}};function s(m){const y=[];m.type.props&&m.props&&y.push(a("props",he(m.props))),m.setupState!==us&&y.push(a("setup",m.setupState)),m.data!==us&&y.push(a("data",he(m.data)));const _=c(m,"computed");_&&y.push(a("computed",_));const S=c(m,"inject");return S&&y.push(a("injected",S)),y.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:m}]]),y}function a(m,y){return y=or({},y),Object.keys(y).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},m],["div",{style:"padding-left:1.25em"},...Object.keys(y).map(_=>["div",{},["span",r,_+": "],u(y[_],!1)])]]:["span",{}]}function u(m,y=!0){return typeof m=="number"?["span",e,m]:typeof m=="string"?["span",t,JSON.stringify(m)]:typeof m=="boolean"?["span",r,m]:gt(m)?["object",{object:y?he(m):m}]:["span",t,String(m)]}function c(m,y){const _=m.type;if(Qe(_))return;const S={};for(const E in m.ctx)h(_,E,y)&&(S[E]=m.ctx[E]);return S}function h(m,y,_){const S=m[_];if(Fe(S)&&S.includes(y)||gt(S)&&y in S||m.extends&&h(m.extends,y,_)||m.mixins&&m.mixins.some(E=>h(E,y,_)))return!0}function p(m){return bt(m)?"ShallowRef":m.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 w5(){_5()}process.env.NODE_ENV!=="production"&&w5();function et(n){this.content=n}et.prototype={constructor:et,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),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new et(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new et(t)},addToStart:function(n,e){return new et([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new et(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new et(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=et.from(n),n.size?new et(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=et.from(n),n.size?new et(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=et.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},et.from=function(n){if(n instanceof et)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new et(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),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let a=0;i.text[a]==s.text[a];a++)t++;return t}if(i.content.size||s.content.size){let a=Qm(i.content,s.content,t+1);if(a!=null)return a}t+=i.nodeSize}}function eg(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let a=n.child(--i),u=e.child(--s),c=a.nodeSize;if(a==u){t-=c,r-=c;continue}if(!a.sameMarkup(u))return{a:t,b:r};if(a.isText&&a.text!=u.text){let h=0,p=Math.min(a.text.length,u.text.length);for(;h<p&&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=eg(a.content,u.content,t-1,r-1);if(h)return h}t-=c,r-=c}}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,s){for(let a=0,u=0;u<t;a++){let c=this.content[a],h=u+c.nodeSize;if(h>e&&r(c,i+u,s||null,a)!==!1&&c.content.size){let p=u+1;c.nodesBetween(Math.max(0,e-p),Math.min(c.content.size,t-p),r,i+p)}u=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",a=!0;return this.nodesBetween(e,t,(u,c)=>{let h=u.isText?u.text.slice(Math.max(e,c)-c,t-c):u.isLeaf?i?typeof i=="function"?i(u):i:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&h||u.isTextblock)&&r&&(a?a=!1:s+=r),s+=h},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);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 s=0,a=0;a<t;s++){let u=this.content[s],c=a+u.nodeSize;c>e&&((a<e||c>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=c}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(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new z(i,s)}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 eg(this,e,t,r)}findIndex(e,t=-1){if(e==0)return da(0,e);if(e==this.size)return da(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),a=i+s.nodeSize;if(a>=e)return a==e||t>0?da(r+1,a):da(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 s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}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 Lc={index:0,offset:0};function da(n,e){return Lc.index=n,Lc.offset=e,Lc}function pa(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(!pa(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!pa(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Me=class wh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}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&&pa(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 wh.none;if(e instanceof wh)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Me.none=[];class ma 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=ng(this.content,e+this.openStart,t);return r&&new K(r,this.openStart,this.openEnd)}removeBetween(e,t){return new K(tg(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 s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new K(e,r,i)}}K.empty=new K(z.empty,0,0);function tg(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:a,offset:u}=n.findIndex(t);if(i==e||s.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,s.copy(tg(s.content,e-i-1,t-i-1)))}function ng(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),a=n.maybeChild(i);if(s==e||a.isText)return n.cut(0,e).append(t).append(n.cut(e));let u=ng(a.content,e-s-1,t);return u&&n.replaceChild(i,a.copy(u))}function v5(n,e,t){if(t.openStart>n.depth)throw new ma("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ma("Inconsistent open depths");return rg(n,e,t,0)}function rg(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let a=rg(n,e,t,r+1);return s.copy(s.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 Hr(a,u.cut(0,n.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:a,end:u}=S5(t,n);return Hr(s,sg(n,a,u,e,r))}else return Hr(s,ga(n,e,r))}function ig(n,e){if(!e.type.compatibleContent(n.type))throw new ma("Cannot join "+e.type.name+" onto "+n.type.name)}function Pc(n,e,t){let r=n.node(t);return ig(r,e.node(t)),r}function $r(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 bs(n,e,t,r){let i=(e||n).node(t),s=0,a=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&($r(n.nodeAfter,r),s++));for(let u=s;u<a;u++)$r(i.child(u),r);e&&e.depth==t&&e.textOffset&&$r(e.nodeBefore,r)}function Hr(n,e){return n.type.checkContent(e),n.copy(e)}function sg(n,e,t,r,i){let s=n.depth>i&&Pc(n,e,i+1),a=r.depth>i&&Pc(t,r,i+1),u=[];return bs(null,n,i,u),s&&a&&e.index(i)==t.index(i)?(ig(s,a),$r(Hr(s,sg(n,e,t,r,i+1)),u)):(s&&$r(Hr(s,ga(n,e,i+1)),u),bs(e,t,i,u),a&&$r(Hr(a,ga(t,r,i+1)),u)),bs(r,null,i,u),new z(u)}function ga(n,e,t){let r=[];if(bs(null,n,t,r),n.depth>t){let i=Pc(n,e,t+1);$r(Hr(i,ga(n,e,t+1)),r)}return bs(e,null,t,r),new z(r)}function S5(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(z.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Us{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 s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Me.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 s=r.marks;for(var a=0;a<s.length;a++)s[a].type.spec.inclusive===!1&&(!i||!s[a].isInSet(i.marks))&&(s=s[a--].removeFromSet(s));return s}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 s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].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 ya(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,s=t;for(let a=e;;){let{index:u,offset:c}=a.content.findIndex(s),h=s-c;if(r.push(a,u,i+c),!h||(a=a.child(u),a.isText))break;s=h-1,i+=c+1}return new Us(t,r,s)}static resolveCached(e,t){let r=og.get(e);if(r)for(let s=0;s<r.elts.length;s++){let a=r.elts[s];if(a.pos==t)return a}else og.set(e,r=new x5);let i=r.elts[r.i]=Us.resolve(e,t);return r.i=(r.i+1)%C5,i}}class x5{constructor(){this.elts=[],this.i=0}}const C5=12,og=new WeakMap;class ya{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 E5=Object.create(null);let fr=class vh{constructor(e,t,r,i=Me.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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&&pa(this.attrs,t||e.defaultAttrs||E5)&&Me.sameSet(this.marks,r||Me.none)}copy(e=null){return e==this.content?this:new vh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vh(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),s=this.resolve(t),a=r?0:i.sharedDepth(t),u=i.start(a),h=i.node(a).content.cut(i.pos-u,s.pos-u);return new K(h,i.depth-a,s.depth-a)}replace(e,t,r){return v5(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 Us.resolveCached(this,e)}resolveNoCache(e){return Us.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.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()+")"),ag(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,s=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,i,s),u=a&&a.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let c=i;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),a=s&&s.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),this.type.checkAttrs(this.attrs);let e=Me.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Me.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;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),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};fr.prototype.text=void 0;class Ll extends fr{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):ag(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 Ll(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ll(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 ag(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new k5(e,t);if(r.next==null)return Xr.empty;let i=lg(r);r.next&&r.err("Unexpected trailing text");let s=R5(N5(i));return L5(s,r),s}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 s=t;i&&s<r;s++)i=i.matchType(e.child(s).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 s(a,u){let c=a.matchFragment(e,r);if(c&&(!t||c.validEnd))return z.from(u.map(h=>h.createAndFill()));for(let h=0;h<a.next.length;h++){let{type:p,next:m}=a.next[h];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let y=s(m,u.concat(p));if(y)return y}}return null}return s(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(),s=i.match;if(s.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<s.next.length;a++){let{type:u,next:c}=s.next[a];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!i.type||c.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 s=i+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)s+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return s}).join(`
31
+ `)}}Xr.empty=new Xr(!0);class k5{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 lg(n){let e=[];do e.push(T5(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function T5(n){let e=[];do e.push(A5(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A5(n){let e=I5(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=M5(n,e);else break;return e}function ug(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function M5(n,e){let t=ug(n),r=t;return n.eat(",")&&(n.next!="}"?r=ug(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function O5(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let a=t[s];a.isInGroup(e)&&i.push(a)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function I5(n){if(n.eat("(")){let e=lg(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=O5(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 N5(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(a,u,c){let h={term:c,to:u};return e[a].push(h),h}function i(a,u){a.forEach(c=>c.to=u)}function s(a,u){if(a.type=="choice")return a.exprs.reduce((c,h)=>c.concat(s(h,u)),[]);if(a.type=="seq")for(let c=0;;c++){let h=s(a.exprs[c],u);if(c==a.exprs.length-1)return h;i(h,u=t())}else if(a.type=="star"){let c=t();return r(u,c),i(s(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=t();return i(s(a.expr,u),c),i(s(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(u)].concat(s(a.expr,u));if(a.type=="range"){let c=u;for(let h=0;h<a.min;h++){let p=t();i(s(a.expr,c),p),c=p}if(a.max==-1)i(s(a.expr,c),c);else for(let h=a.min;h<a.max;h++){let p=t();r(c,p),i(s(a.expr,c),p),c=p}return[r(c)]}else{if(a.type=="name")return[r(u,void 0,a.value)];throw new Error("Unknown expr type")}}}}function cg(n,e){return e-n}function fg(n,e){let t=[];return r(e),t.sort(cg);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let a=0;a<s.length;a++){let{term:u,to:c}=s[a];!u&&t.indexOf(c)==-1&&r(c)}}}function R5(n){let e=Object.create(null);return t(fg(n,0));function t(r){let i=[];r.forEach(a=>{n[a].forEach(({term:u,to:c})=>{if(!u)return;let h;for(let p=0;p<i.length;p++)i[p][0]==u&&(h=i[p][1]);fg(n,c).forEach(p=>{h||i.push([u,h=[]]),h.indexOf(p)==-1&&h.push(p)})})});let s=e[r.join(",")]=new Xr(r.indexOf(n.length-1)>-1);for(let a=0;a<i.length;a++){let u=i[a][1].sort(cg);s.next.push({type:i[a][0],next:e[u.join(",")]||t(u)})}return s}}function L5(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,a=[];for(let u=0;u<i.next.length;u++){let{type:c,next:h}=i.next[u];a.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(h)==-1&&r.push(h)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function hg(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 dg(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function pg(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function mg(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new D5(n,r,e[r]);return t}let gg=class Ky{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=mg(e,r.attrs),this.defaultAttrs=hg(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==Xr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:dg(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),z.from(t),Me.setFrom(r))}createChecked(e=null,t,r){return t=z.from(t),this.checkContent(t),new fr(this,this.computeAttrs(e),t,Me.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),s=i&&i.fillBefore(z.empty,!0);return s?new fr(this,e,t.append(s),Me.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)}`)}checkAttrs(e){pg(this.attrs,e,"node",this.name)}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:Me.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,a)=>r[s]=new Ky(s,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 s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function P5(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class D5{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?P5(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Pl{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=mg(e,i.attrs),this.excluded=null;let s=hg(this.attrs);this.instance=s?new Me(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Me(this,dg(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,a)=>r[s]=new Pl(s,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]}checkAttrs(e){pg(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class yg{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=et.from(e.nodes),t.marks=et.from(e.marks||{}),this.nodes=gg.compile(this.spec.nodes,this),this.marks=Pl.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 s=this.nodes[i],a=s.spec.content||"",u=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=Xr.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=u=="_"?null:u?bg(this,u.split(" ")):u==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:bg(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 gg){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 Ll(r,r.defaultAttrs,e,Me.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return Me.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function bg(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],a=s;if(s)t.push(s);else for(let u in n.marks){let c=n.marks[u];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function F5(n){return n.tag!=null}function B5(n){return n.style!=null}let _s=class Sh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(F5(i))this.tags.push(i);else if(B5(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Sg(this,t,!1);return r.addAll(e,Me.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Sg(this,t,!0);return r.addAll(e,Me.none,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 s=this.tags[i];if(H5(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let a=this.styles[s],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 c=a.getAttrs(t);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,a=0;for(;a<t.length;a++){let u=t[a];if((u.priority==null?50:u.priority)<s)break}t.splice(a,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(a=>{r(a=xg(a)),a.mark||a.ignore||a.clearMark||(a.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(a=>{r(a=xg(a)),a.node||a.ignore||a.mark||(a.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Sh(e,Sh.schemaRules(e)))}};const _g={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},z5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wg={ol:!0,ul:!0},ws=1,Dc=2,ba=4;function vg(n,e,t){return e!=null?(e?ws:0)|(e==="full"?Dc:0):n&&n.whitespace=="pre"?ws|Dc:t&-5}class _a{constructor(e,t,r,i,s,a){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Me.none,this.match=s||(a&ba?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&ws)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.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}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!_g.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Sg{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,a=vg(null,t.preserveWhitespace,0)|(r?ba:0);i?s=new _a(i.type,i.attrs,Me.none,!0,t.topMatch||i.type.contentMatch,a):r?s=new _a(null,null,Me.none,!0,null,a):s=new _a(e.schema.topNodeType,null,Me.none,!0,null,a),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&Dc?"full":this.localPreserveWS||(i.options&ws)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
32
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),u;wg.hasOwnProperty(a)&&this.parser.normalizeLists&&$5(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,r));e:if(c?c.ignore:z5.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let h,p=this.needsBlock;if(_g.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),h=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let m=c&&c.skip?t:this.readStyles(e,t);m&&this.addAll(e,m),h&&this.sync(s),this.needsBlock=p}else{let h=this.readStyles(e,t);h&&this.addElementByRule(e,c,h,c.consuming===!1?u:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],a=r.getPropertyValue(s);if(a)for(let u=void 0;;){let c=this.parser.matchStyle(s,a,this,u);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(h=>!c.clearMark(h)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)u=c;else break}}return t}addElementByRule(e,t,r,i){let s,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r)||this.leafFallback(e,r);else{let c=this.enter(a,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let u=this.top;if(a&&a.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(u)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,u=i==null?null:e.childNodes[i];a!=u;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,t);this.findAtPoint(e,s)}findPlace(e,t){let r,i;for(let s=this.open;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length)&&(r=u,i=a,!u.length)||a.solid)break}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Me.none;for(let a of r.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Cg(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let u=vg(e,s,a.options);a.options&ba&&a.content.length==0&&(u|=ba);let c=Me.none;return r=r.filter(h=>(a.type?a.type.allowsMarkType(h.type):Cg(h.type,e))?(c=h.addToSet(c),!1):!0),this.nodes.push(new _a(e,t,c,i,null,u)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ws)}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),s=-(r?r.depth+1:0)+(i?0:1),a=(u,c)=>{for(;u>=0;u--){let h=t[u];if(h==""){if(u==t.length-1||u==0)continue;for(;c>=s;c--)if(a(u-1,c))return!0;return!1}else{let p=c>0||c==0&&i?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!p||p.name!=h&&!p.isInGroup(h))return!1;c--}}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}}}function $5(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wg.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function H5(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function xg(n){let e={};for(let t in n)e[t]=n[t];return e}function Cg(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],a=u=>{s.push(u);for(let c=0;c<u.edgeCount;c++){let{type:h,next:p}=u.edge(c);if(h==e||s.indexOf(p)<0&&a(p))return!0}};if(a(i.contentMatch))return!0}}class Vs{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Fc(t).createDocumentFragment());let i=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let u=0,c=0;for(;u<s.length&&c<a.marks.length;){let h=a.marks[c];if(!this.marks[h.type.name]){c++;continue}if(!h.eq(s[u][0])||h.type.spec.spanning===!1)break;u++,c++}for(;u<s.length;)i=s.pop()[1];for(;c<a.marks.length;){let h=a.marks[c++],p=this.serializeMark(h,a.isInline,t);p&&(s.push([h,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=wa(Fc(t),this.nodes[e.type.name](e),null,e.attrs);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 s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&wa(Fc(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return wa(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vs(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 Fc(n){return n.document||window.document}const kg=new WeakMap;function W5(n){let e=kg.get(n);return e===void 0&&kg.set(n,e=V5(n)),e}function V5(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function wa(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=W5(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=i.indexOf(" ");a>0&&(t=i.slice(0,a),i=i.slice(a+1));let u,c=t?n.createElementNS(t,i):n.createElement(i),h=e[1],p=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){p=2;for(let m in h)if(h[m]!=null){let y=m.indexOf(" ");y>0?c.setAttributeNS(m.slice(0,y),m.slice(y+1),h[m]):c.setAttribute(m,h[m])}}for(let m=p;m<e.length;m++){let y=e[m];if(y===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:_,contentDOM:S}=wa(n,y,t,r);if(c.appendChild(_),S){if(u)throw new RangeError("Multiple content holes");u=S}}}return{dom:c,contentDOM:u}}const Tg=65535,Ag=Math.pow(2,16);function U5(n,e){return n+e*Ag}function Mg(n){return n&Tg}function q5(n){return(n-(n&Tg))/Ag}const Og=1,Ig=2,va=4,Ng=8;class Bc{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Ng)>0}get deletedBefore(){return(this.delInfo&(Og|va))>0}get deletedAfter(){return(this.delInfo&(Ig|va))>0}get deletedAcross(){return(this.delInfo&va)>0}}class Pt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Pt.empty)return Pt.empty}recover(e){let t=0,r=Mg(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+q5(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,s=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?i:0);if(c>e)break;let h=this.ranges[u+s],p=this.ranges[u+a],m=c+h;if(e<=m){let y=h?e==c?-1:e==m?1:t:t,_=c+i+(y<0?0:p);if(r)return _;let S=e==(t<0?c:m)?null:U5(u/3,e-c),E=e==c?Ig:e==m?Og:va;return(t<0?e!=c:e!=m)&&(E|=Ng),new Bc(_,E,S)}i+=p-h}return r?e+i:new Bc(e+i,0,null)}touches(e,t){let r=0,i=Mg(t),s=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let c=this.ranges[u]-(this.inverted?r:0);if(c>e)break;let h=this.ranges[u+s],p=c+h;if(e<=p&&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,s=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?s:0),c=a+(this.inverted?0:s),h=this.ranges[i+t],p=this.ranges[i+r];e(u,u+h,c,c+p),s+=p-h}}invert(){return new Pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Pt.empty:new Pt(e<0?[0,-e,0]:[0,0,e])}}Pt.empty=new Pt([]);class Fi{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 Fi(this.maps,this.mirror,e,t)}copy(){return new Fi(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 Fi;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 s=this.from;s<this.to;s++){let a=this.maps[s],u=a.mapResult(e,t);if(u.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this.maps[c].recover(u.recover);continue}}i|=u.delInfo,e=u.pos}return r?e:new Bc(e,i,null)}}const zc=Object.create(null);class Ue{getMap(){return Pt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zc[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 zc)throw new RangeError("Duplicate use of step JSON ID "+e);return zc[e]=t,t.prototype.jsonID=e,t}}class De{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new De(e,null)}static fail(e){return new De(null,e)}static fromReplace(e,t,r,i){try{return De.ok(e.replace(t,r,i))}catch(s){if(s instanceof ma)return De.fail(s.message);throw s}}}function $c(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy($c(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return z.fromArray(r)}class kr extends Ue{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)),s=new K($c(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 De.fromReplace(e,this.from,this.to,s)}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))}}Ue.jsonID("addMark",kr);class wn extends Ue{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($c(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return De.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))}}Ue.jsonID("removeMark",wn);class Tr extends Ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return De.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 Tr(this.pos,t.marks[i]);return new Tr(this.pos,this.mark)}}return new Bi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Tr(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 Tr(t.pos,e.markFromJSON(t.mark))}}Ue.jsonID("addNodeMark",Tr);class Bi extends Ue{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return De.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return De.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 Tr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Bi(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 Bi(t.pos,e.markFromJSON(t.mark))}}Ue.jsonID("removeNodeMark",Bi);class je extends Ue{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&Hc(e,this.from,this.to)?De.fail("Structure replace would overwrite content"):De.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new je(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 je(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof je)||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 je(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 je(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 je(t.from,t.to,K.fromJSON(e,t.slice),!!t.structure)}}Ue.jsonID("replace",je);class Je extends Ue{constructor(e,t,r,i,s,a,u=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=a,this.structure=u}apply(e){if(this.structure&&(Hc(e,this.from,this.gapFrom)||Hc(e,this.gapTo,this.to)))return De.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return De.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?De.fromReplace(e,this.from,this.to,r):De.fail("Content does not fit in gap")}getMap(){return new Pt([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 Je(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=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos?null:new Je(t.pos,r.pos,i,s,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 Je(t.from,t.to,t.gapFrom,t.gapTo,K.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ue.jsonID("replaceAround",Je);function Hc(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}}return!1}function K5(n,e,t,r){let i=[],s=[],a,u;n.doc.nodesBetween(e,t,(c,h,p)=>{if(!c.isInline)return;let m=c.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let y=Math.max(h,e),_=Math.min(h+c.nodeSize,t),S=r.addToSet(m);for(let E=0;E<m.length;E++)m[E].isInSet(S)||(a&&a.to==y&&a.mark.eq(m[E])?a.to=_:i.push(a=new wn(y,_,m[E])));u&&u.to==y?u.to=_:s.push(u=new kr(y,_,r))}}),i.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function G5(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(a,u)=>{if(!a.isInline)return;s++;let c=null;if(r instanceof Pl){let h=a.marks,p;for(;p=r.isInSet(h);)(c||(c=[])).push(p),h=p.removeFromSet(h)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let h=Math.min(u+a.nodeSize,t);for(let p=0;p<c.length;p++){let m=c[p],y;for(let _=0;_<i.length;_++){let S=i[_];S.step==s-1&&m.eq(i[_].style)&&(y=S)}y?(y.to=h,y.step=s):i.push({style:m,from:Math.max(u,e),to:h,step:s})}}}),i.forEach(a=>n.step(new wn(a.from,a.to,a.style)))}function Wc(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),a=[],u=e+1;for(let c=0;c<s.childCount;c++){let h=s.child(c),p=u+h.nodeSize,m=r.matchType(h.type);if(!m)a.push(new je(u,p,K.empty));else{r=m;for(let y=0;y<h.marks.length;y++)t.allowsMarkType(h.marks[y].type)||n.step(new wn(u,p,h.marks[y]));if(i&&h.isText&&t.whitespace!="pre"){let y,_=/\r?\n|\r/g,S;for(;y=_.exec(h.text);)S||(S=new K(z.from(t.schema.text(" ",t.allowedMarks(h.marks))),0,0)),a.push(new je(u+y.index,u+y.index+y[0].length,S))}}u=p}if(!r.validEnd){let c=r.fillBefore(z.empty,!0);n.replace(u,u,new K(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function J5(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Si(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),a=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,a,t))return r;if(r==0||i.type.spec.isolating||!J5(i,s,a))break}return null}function j5(n,e,t){let{$from:r,$to:i,depth:s}=e,a=r.before(s+1),u=i.after(s+1),c=a,h=u,p=z.empty,m=0;for(let S=s,E=!1;S>t;S--)E||r.index(S)>0?(E=!0,p=z.from(r.node(S).copy(p)),m++):c--;let y=z.empty,_=0;for(let S=s,E=!1;S>t;S--)E||i.after(S+1)<i.end(S)?(E=!0,y=z.from(i.node(S).copy(y)),_++):h++;n.step(new Je(c,h,a,u,new K(p.append(y),m,_),p.size-m,!0))}function Vc(n,e,t=null,r=n){let i=Y5(n,e),s=i&&X5(r,e);return s?i.map(Rg).concat({type:e,attrs:t}).concat(s.map(Rg)):null}function Rg(n){return{type:n,attrs:null}}function Y5(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return t.canReplaceWith(r,i,a)?s:null}function X5(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let c=(a.length?a[a.length-1]:e).contentMatch;for(let h=r;c&&h<i;h++)c=c.matchType(t.child(h).type);return!c||!c.validEnd?null:a}function Z5(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,s=e.end;n.step(new Je(i,s,i,s,new K(r,0,0),t.length,!0))}function Q5(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(a,u)=>{let c=typeof i=="function"?i(a):i;if(a.isTextblock&&!a.hasMarkup(r,c)&&ek(n.doc,n.mapping.slice(s).map(u),r)){let h=null;if(r.schema.linebreakReplacement){let _=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);_&&!S?h=!1:!_&&S&&(h=!0)}h===!1&&Pg(n,a,u,s),Wc(n,n.mapping.slice(s).map(u,1),r,void 0,h===null);let p=n.mapping.slice(s),m=p.map(u,1),y=p.map(u+a.nodeSize,1);return n.step(new Je(m,y,m+1,y-1,new K(z.from(r.create(c,null,a.marks)),0,0),1,!0)),h===!0&&Lg(n,a,u,s),!1}})}function Lg(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let a,u=/\r?\n|\r/g;for(;a=u.exec(i.text);){let c=n.mapping.slice(r).map(t+1+s+a.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Pg(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+s);n.replaceWith(a,a+1,e.type.schema.text(`
34
+ `))}})}function ek(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function tk(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let a=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,a);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new K(z.from(a),0,0),1,!0))}function zn(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,a=r&&r[r.length-1]||i.parent;if(s<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,p=t-2;h>s;h--,p--){let m=i.node(h),y=i.index(h);if(m.type.spec.isolating)return!1;let _=m.content.cutByIndex(y,m.childCount),S=r&&r[p+1];S&&(_=_.replaceChild(0,S.type.create(S.attrs)));let E=r&&r[p]||m;if(!m.canReplace(y+1,m.childCount)||!E.type.validContent(_))return!1}let u=i.indexAfter(s),c=r&&r[0];return i.node(s).canReplaceWith(u,u,c?c.type:i.node(s+1).type)}function nk(n,e,t=1,r){let i=n.doc.resolve(e),s=z.empty,a=z.empty;for(let u=i.depth,c=i.depth-t,h=t-1;u>c;u--,h--){s=z.from(i.node(u).copy(s));let p=r&&r[h];a=z.from(p?p.type.create(p.attrs,a):i.node(u).copy(a))}n.step(new je(e,e,new K(s.append(a),t,t),!0))}function hr(n,e){let t=n.resolve(e),r=t.index();return Dg(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function rk(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),a=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function Dg(n,e){return!!(n&&e&&!n.isLeaf&&rk(n,e))}function Sa(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,a,u=r.index(i);if(i==r.depth?(s=r.nodeBefore,a=r.nodeAfter):t>0?(s=r.node(i+1),u++,a=r.node(i).maybeChild(u)):(s=r.node(i).maybeChild(u-1),a=r.node(i+1)),s&&!s.isTextblock&&Dg(s,a)&&r.node(i).canReplace(u,u+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function ik(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),a=s.node().type;if(i&&a.inlineContent){let p=a.whitespace=="pre",m=!!a.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let u=n.steps.length;if(r===!1){let p=n.doc.resolve(e+t);Pg(n,p.node(),p.before(),u)}a.inlineContent&&Wc(n,e+t-1,a,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(u),h=c.map(e-t);if(n.step(new je(h,c.map(e+t,-1),K.empty,!0)),r===!0){let p=n.doc.resolve(h);Lg(n,p.node(),p.before(),n.steps.length)}return n}function sk(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 s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function ok(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)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,c=r.index(a)+(u>0?1:0),h=r.node(a),p=!1;if(s==1)p=h.canReplace(c,c,i);else{let m=h.contentMatchAt(c).findWrapping(i.firstChild.type);p=m&&h.canReplaceWith(c,c,m[0])}if(p)return u==0?r.pos:u<0?r.before(a+1):r.after(a+1)}return null}function xa(n,e,t=e,r=K.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fg(i,s,r)?new je(e,t,r):new ak(i,s,r).fit()}function Fg(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class ak{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 s=e.node(i);this.frontier.push({type:s.type,match:s.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 s=this.placed,a=r.depth,u=i.depth;for(;a&&u&&s.childCount==1;)s=s.firstChild.content,a--,u--;let c=new K(s,a,u);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new je(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Uc(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let a=i.firstChild;for(let u=this.depth;u>=0;u--){let{type:c,match:h}=this.frontier[u],p,m=null;if(t==1&&(a?h.matchType(a.type)||(m=h.fillBefore(z.from(a),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:u,parent:s,inject:m};if(t==2&&a&&(p=h.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:u,parent:s,wrap:p};if(s&&h.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Uc(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=Uc(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new K(vs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new K(vs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let E=0;E<s.length;E++)this.openFrontierNode(s[E]);let a=this.unplaced,u=r?r.content:a.content,c=a.openStart-e,h=0,p=[],{match:m,type:y}=this.frontier[t];if(i){for(let E=0;E<i.childCount;E++)p.push(i.child(E));m=m.matchFragment(i)}let _=u.size+e-(a.content.size-a.openEnd);for(;h<u.childCount;){let E=u.child(h),N=m.matchType(E.type);if(!N)break;h++,(h>1||c==0||E.content.size)&&(m=N,p.push(Bg(E.mark(y.allowedMarks(E.marks)),h==1?c:0,h==u.childCount?_:-1)))}let S=h==u.childCount;S||(_=-1),this.placed=Ss(this.placed,t,z.from(p)),this.frontier[t].match=m,S&&_<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let E=0,N=u;E<_;E++){let g=N.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),N=g.content}this.unplaced=S?e==0?K.empty:new K(vs(a.content,e-1,1),e-1,_<0?a.openEnd:e-1):new K(vs(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||!qc(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],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=qc(e,t,i,r,s);if(a){for(let u=t-1;u>=0;u--){let{match:c,type:h}=this.frontier[u],p=qc(e,u,h,c,!0);if(!p||p.childCount)continue e}return{depth:t,fit:a,move:s?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=Ss(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ss(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=Ss(this.placed,this.frontier.length,t))}}function vs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(vs(n.firstChild.content,e-1,t)))}function Ss(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ss(n.lastChild.content,e-1,t)))}function Uc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Bg(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Bg(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 qc(n,e,t,r,i){let s=n.node(e),a=i?n.indexAfter(e):n.index(e);if(a==s.childCount&&!t.compatibleContent(s.type))return null;let u=r.fillBefore(s.content,!0,a);return u&&!lk(t,s.content,a)?u:null}function lk(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function uk(n){return n.spec.defining||n.spec.definingForContent}function ck(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(Fg(i,s,r))return n.step(new je(e,t,r));let a=$g(i,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let u=-(i.depth+1);a.unshift(u);for(let y=i.depth,_=i.pos-1;y>0;y--,_--){let S=i.node(y).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;a.indexOf(y)>-1?u=y:i.before(y)==_&&a.splice(1,0,-y)}let c=a.indexOf(u),h=[],p=r.openStart;for(let y=r.content,_=0;;_++){let S=y.firstChild;if(h.push(S),_==r.openStart)break;y=S.content}for(let y=p-1;y>=0;y--){let _=h[y],S=uk(_.type);if(S&&!_.sameMarkup(i.node(Math.abs(u)-1)))p=y;else if(S||!_.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let _=(y+p+1)%(r.openStart+1),S=h[_];if(S)for(let E=0;E<a.length;E++){let N=a[(E+c)%a.length],g=!0;N<0&&(g=!1,N=-N);let v=i.node(N-1),k=i.index(N-1);if(v.canReplaceWith(k,k,S.type,S.marks))return n.replace(i.before(N),g?s.after(N):t,new K(zg(r.content,0,r.openStart,_),_,r.openEnd))}}let m=n.steps.length;for(let y=a.length-1;y>=0&&(n.replace(e,t,r),!(n.steps.length>m));y--){let _=a[y];_<0||(e=i.before(_),t=s.after(_))}}function zg(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(zg(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),a=s.fillBefore(n).append(n);n=a.append(s.matchFragment(a).fillBefore(z.empty,!0))}return n}function fk(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=sk(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new K(z.from(r),0,0))}function hk(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=$g(r,i);for(let a=0;a<s.length;a++){let u=s[a],c=a==s.length-1;if(c&&u==0||r.node(u).type.contentMatch.validEnd)return n.delete(r.start(u),i.end(u));if(u>0&&(c||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&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function $g(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<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;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class zi extends Ue{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 De.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return De.fromReplace(e,this.pos,this.pos+1,new K(z.from(i),0,t.isLeaf?0:1))}getMap(){return Pt.empty}invert(e){return new zi(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 zi(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 zi(t.pos,t.attr,t.value)}}Ue.jsonID("attr",zi);class qs extends Ue{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return De.ok(r)}getMap(){return Pt.empty}invert(e){return new qs(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new qs(t.attr,t.value)}}Ue.jsonID("docAttr",qs);let xi=class extends Error{};xi=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},xi.prototype=Object.create(Error.prototype),xi.prototype.constructor=xi,xi.prototype.name="TransformError";class dk{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new xi(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=xa(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 ck(this,e,t,r),this}replaceRangeWith(e,t,r){return fk(this,e,t,r),this}deleteRange(e,t){return hk(this,e,t),this}lift(e,t){return j5(this,e,t),this}join(e,t=1){return ik(this,e,t),this}wrap(e,t){return Z5(this,e,t),this}setBlockType(e,t=e,r,i=null){return Q5(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return tk(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new zi(e,t,r)),this}setDocAttribute(e,t){return this.step(new qs(e,t)),this}addNodeMark(e,t){return this.step(new Tr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof Me)){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 Bi(e,t)),this}split(e,t=1,r){return nk(this,e,t,r),this}addMark(e,t,r){return K5(this,e,t,r),this}removeMark(e,t,r){return G5(this,e,t,r),this}clearIncompatible(e,t,r){return Wc(this,e,t,r),this}}const Kc=Object.create(null);class ye{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new pk(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 s=e.steps.length,a=this.ranges;for(let u=0;u<a.length;u++){let{$from:c,$to:h}=a[u],p=e.mapping.slice(s);e.replaceRange(p.map(c.pos),p.map(h.pos),u?K.empty:t),u==0&&Vg(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:u}=i[s],c=e.mapping.slice(r),h=c.map(a.pos),p=c.map(u.pos);s?e.deleteRange(h,p):(e.replaceRangeWith(h,p,t),Vg(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new pe(e):Ci(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let a=t<0?Ci(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Ci(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Lt(e.node(0))}static atStart(e){return Ci(e,e,0,0,1)||new Lt(e)}static atEnd(e){return Ci(e,e,e.content.size,e.childCount,-1)||new Lt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Kc[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 Kc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Kc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}}ye.prototype.visible=!0;class pk{constructor(e,t){this.$from=e,this.$to=t}}let Hg=!1;function Wg(n){!Hg&&!n.parent.inlineContent&&(Hg=!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){Wg(e),Wg(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 Dl(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 s=ye.findFrom(t,r,!0)||ye.findFrom(t,-r,!0);if(s)t=s.$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 Dl{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Dl(e.map(this.anchor),e.map(this.head))}resolve(e){return pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Q 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),s=e.resolve(i);return r?ye.near(s):new Q(s)}content(){return new K(z.from(this.node),0,0)}eq(e){return e instanceof Q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new xh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Q(e.resolve(t.anchor))}static create(e,t){return new Q(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Q.prototype.visible=!1,ye.jsonID("node",Q);class xh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Dl(r,r):new xh(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Q.isSelectable(r)?new Q(t):ye.near(t)}}class Lt 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 Lt(e)}map(e){return new Lt(e)}eq(e){return e instanceof Lt}getBookmark(){return mk}}ye.jsonID("all",Lt);const mk={map(){return this},resolve(n){return new Lt(n)}};function Ci(n,e,t,r,i,s=!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(!s&&Q.isSelectable(u))return Q.create(n,t-(i<0?u.nodeSize:0))}else{let c=Ci(n,u,t+i,i<0?u.childCount:0,i,s);if(c)return c}t+=u.nodeSize*i}return null}function Vg(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof je||i instanceof Je))return;let s=n.mapping.maps[r],a;s.forEach((u,c,h,p)=>{a==null&&(a=p)}),n.setSelection(ye.near(n.doc.resolve(a),t))}function Ug(n,e){return!e||!n?n:n.bind(e)}class Ca{constructor(e,t,r){this.name=e,this.init=Ug(t.init,r),this.apply=Ug(t.apply,r)}}new Ca("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ca("selection",{init(n,e){return n.selection||ye.atStart(e.doc)},apply(n){return n.selection}}),new Ca("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Ca("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function qg(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=qg(i,e,{})),t[r]=i}return t}class ct{constructor(e){this.spec=e,this.props={},e.props&&qg(e.props,this,this.props),this.key=e.key?e.key.key:Kg("plugin")}getState(e){return e[this.key]}}const Gc=Object.create(null);function Kg(n){return n in Gc?n+"$"+ ++Gc[n]:(Gc[n]=0,n+"$")}class It{constructor(e="key"){this.key=Kg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Wr=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Gg=function(n,e,t,r){return t&&(Jg(n,e,t,r,-1)||Jg(n,e,t,r,1))},gk=/^(img|br|input|textarea|hr)$/i;function Jg(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ea(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Jc(n)||gk.test(n.nodeName)||n.contentEditable=="false")return!1;e=Wr(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?Ea(n):0}else return!1}}function Ea(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function yk(n,e,t){for(let r=e==0,i=e==Ea(n);r||i;){if(n==t)return!0;let s=Wr(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==Ea(n)}}function Jc(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 jg=function(n){return n.focusNode&&Gg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Yg(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const pn=typeof navigator<"u"?navigator:null,Xg=typeof document<"u"?document:null,dr=pn&&pn.userAgent||"",jc=/Edge\/(\d+)/.exec(dr),Zg=/MSIE \d/.exec(dr),Yc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dr),xs=!!(Zg||Yc||jc),Qg=Zg?document.documentMode:Yc?+Yc[1]:jc?+jc[1]:0,ka=!xs&&/gecko\/(\d+)/i.test(dr);ka&&+(/Firefox\/(\d+)/.exec(dr)||[0,0])[1];const Xc=!xs&&/Chrome\/(\d+)/.exec(dr),pr=!!Xc,e0=Xc?+Xc[1]:0,Vr=!xs&&!!pn&&/Apple Computer/.test(pn.vendor),Zc=Vr&&(/Mobile\/\w+/.test(dr)||!!pn&&pn.maxTouchPoints>2),Gt=Zc||(pn?/Mac/.test(pn.platform):!1),bk=pn?/Win/.test(pn.platform):!1,Cs=/Android \d/.test(dr),Qc=!!Xg&&"webkitFontSmoothing"in Xg.documentElement.style,_k=Qc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function wk(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let u=r.resolve(a),c,h;if(jg(t)){for(c=a;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Q.isSelectable(m)&&i.parent&&!(m.isInline&&yk(t.focusNode,t.focusOffset,i.dom))){let y=i.posBefore;h=new Q(a==y?u:r.resolve(y))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let m=a,y=a;for(let _=0;_<t.rangeCount;_++){let S=t.getRangeAt(_);m=Math.min(m,n.docView.posFromDOM(S.startContainer,S.startOffset,1)),y=Math.max(y,n.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[c,a]=y==n.state.selection.anchor?[y,m]:[m,y],u=r.resolve(a)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let p=r.resolve(c);if(!h){let m=e=="pointer"||n.state.selection.head<u.pos&&!s?1:-1;h=o0(n,p,u,m)}return h}function t0(n){return n.editable?n.hasFocus():Ck(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ef(n,e=!1){let t=n.state.selection;if(xk(n,t),!!t0(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&pr){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Gg(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Sk(n);else{let{anchor:r,head:i}=t,s,a;n0&&!(t instanceof pe)&&(t.$from.parent.inlineContent||(s=r0(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=r0(n,t.to))),n.docView.setSelection(r,i,n,e),n0&&(s&&i0(s),a&&i0(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&vk(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const n0=Vr||pr&&e0<63;function r0(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(Vr&&i&&i.contentEditable=="false")return tf(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return tf(i);if(s)return tf(s)}}function tf(n){return n.contentEditable="true",Vr&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function i0(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function vk(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(()=>{(!t0(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Sk(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,Wr(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&xs&&Qg<=11&&(r.disabled=!0,r.disabled=!1)}function xk(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(s0(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else s0(n)}function s0(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function o0(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||pe.between(e,t,r)}function Ck(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 nf(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ye.findFrom(s,e)}function mr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function a0(n,e,t){let r=n.state.selection;if(r instanceof pe)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return mr(n,new pe(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=nf(n.state,e);return i&&i instanceof Q?mr(n,i):!1}else if(!(Gt&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,a;if(!s||s.isText)return!1;let u=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(a=n.docView.descAt(u))&&!a.contentDOM?Q.isSelectable(s)?mr(n,new Q(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Qc?mr(n,new pe(n.state.doc.resolve(e<0?u:u+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Q&&r.node.isInline)return mr(n,new pe(e>0?r.$to:r.$from));{let i=nf(n.state,e);return i?mr(n,i):!1}}}function Ta(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Es(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ei(n,e){return e<0?Ek(n):kk(n)}function Ek(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,a=!1;for(ka&&t.nodeType==1&&r<Ta(t)&&Es(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let u=t.childNodes[r-1];if(Es(u,-1))i=t,s=--r;else if(u.nodeType==3)t=u,r=t.nodeValue.length;else break}}else{if(l0(t))break;{let u=t.previousSibling;for(;u&&Es(u,-1);)i=t.parentNode,s=Wr(u),u=u.previousSibling;if(u)t=u,r=Ta(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?rf(n,t,r):i&&rf(n,i,s)}function kk(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Ta(t),s,a;for(;;)if(r<i){if(t.nodeType!=1)break;let u=t.childNodes[r];if(Es(u,1))s=t,a=++r;else break}else{if(l0(t))break;{let u=t.nextSibling;for(;u&&Es(u,1);)s=u.parentNode,a=Wr(u)+1,u=u.nextSibling;if(u)t=u,r=0,i=Ta(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&rf(n,s,a)}function l0(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Tk(n,e){for(;n&&e==n.childNodes.length&&!Jc(n);)e=Wr(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Ak(n,e){for(;n&&!e&&!Jc(n);)e=Wr(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function rf(n,e,t){if(e.nodeType!=3){let s,a;(a=Tk(e,t))?(e=a,t=0):(s=Ak(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(jg(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&ef(n)},50)}function u0(n,e){let t=n.state.doc.resolve(e);if(!(pr||bk)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>i.top&&a<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function c0(n,e,t){let r=n.state.selection;if(r instanceof pe&&!r.empty||t.indexOf("s")>-1||Gt&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=nf(n.state,e);if(a&&a instanceof Q)return mr(n,a)}if(!i.parent.inlineContent){let a=e<0?i:s,u=r instanceof Lt?ye.near(a,e):ye.findFrom(a,e);return u?mr(n,u):!1}return!1}function f0(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 s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let a=n.state.tr;return e<0?a.delete(t.pos-s.nodeSize,t.pos):a.delete(t.pos,t.pos+s.nodeSize),n.dispatch(a),!0}return!1}function h0(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Mk(n){if(!Vr||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;h0(n,r,"true"),setTimeout(()=>h0(n,r,"false"),20)}return!1}function Ok(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ik(n,e){let t=e.keyCode,r=Ok(e);if(t==8||Gt&&t==72&&r=="c")return f0(n,-1)||Ei(n,-1);if(t==46&&!e.shiftKey||Gt&&t==68&&r=="c")return f0(n,1)||Ei(n,1);if(t==13||t==27)return!0;if(t==37||Gt&&t==66&&r=="c"){let i=t==37?u0(n,n.state.selection.from)=="ltr"?-1:1:-1;return a0(n,i,r)||Ei(n,i)}else if(t==39||Gt&&t==70&&r=="c"){let i=t==39?u0(n,n.state.selection.from)=="ltr"?1:-1:1;return a0(n,i,r)||Ei(n,i)}else{if(t==38||Gt&&t==80&&r=="c")return c0(n,-1,r)||Ei(n,-1);if(t==40||Gt&&t==78&&r=="c")return Mk(n)||c0(n,1,r)||Ei(n,1);if(r==(Gt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function d0(n,e){n.someProp("transformCopied",_=>{e=_(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let _=r.firstChild;t.push(_.type.name,_.attrs!=_.type.defaultAttrs?_.attrs:null),r=_.content}let a=n.someProp("clipboardSerializer")||Vs.fromSchema(n.state.schema),u=v0(),c=u.createElement("div");c.appendChild(a.serializeFragment(r,{document:u}));let h=c.firstChild,p,m=0;for(;h&&h.nodeType==1&&(p=_0[h.nodeName.toLowerCase()]);){for(let _=p.length-1;_>=0;_--){let S=u.createElement(p[_]);for(;c.firstChild;)S.appendChild(c.firstChild);c.appendChild(S),m++}h=c.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(t)}`);let y=n.someProp("clipboardTextSerializer",_=>_(e,n))||e.content.textBetween(0,e.content.size,`
35
35
 
36
36
  `);return{dom:c,text:y,slice:e}}function p0(n,e,t,r,i){let s=i.parent.type.spec.code,a,u;if(!t&&!e)return null;let c=e&&(r||s||!t);if(c){if(n.someProp("transformPastedText",y=>{e=y(e,s||r,n)}),s)return e?new K(z.from(n.state.schema.text(e.replace(/\r\n?/g,`
37
- `))),0,0):K.empty;let m=n.someProp("clipboardTextParser",y=>y(e,i,r,n));if(m)u=m;else{let y=i.marks(),{schema:_}=n.state,S=Vs.fromSchema(_);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let N=a.appendChild(document.createElement("p"));E&&N.appendChild(S.serializeNode(_.text(E,y)))})}}else n.someProp("transformPastedHTML",m=>{t=m(t,n)}),a=Lk(t),Qc&&Pk(a);let h=a&&a.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let y=a.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;a=y}if(u||(u=(n.someProp("clipboardParser")||n.someProp("domParser")||_s.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||p),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!Ik.test(y.parentNode.nodeName)?{ignore:!0}:null}})),p)u=Dk(b0(u,+p[1],+p[2]),p[4]);else if(u=K.maxOpen(Nk(u.content,i),!0),u.openStart||u.openEnd){let m=0,y=0;for(let _=u.content.firstChild;m<u.openStart&&!_.type.spec.isolating;m++,_=_.firstChild);for(let _=u.content.lastChild;y<u.openEnd&&!_.type.spec.isolating;y++,_=_.lastChild);u=b0(u,m,y)}return n.someProp("transformPasted",m=>{u=m(u,n)}),u}const Ik=/^(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 Nk(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)),s,a=[];if(n.forEach(u=>{if(!a)return;let c=i.findWrapping(u.type),h;if(!c)return a=null;if(h=a.length&&s.length&&g0(c,s,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=y0(a[a.length-1],s.length));let p=m0(u,c);a.push(p),i=i.matchType(p.type),s=c}}),a)return z.from(a)}return n}function m0(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,z.from(n));return n}function g0(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=g0(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(z.from(m0(t,n,i+1))))}}function y0(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,y0(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(z.empty,!0);return n.copy(t.append(r))}function sf(n,e,t,r,i,s){let a=e<0?n.firstChild:n.lastChild,u=a.content;return n.childCount>1&&(s=0),i<r-1&&(u=sf(u,e,t,r,i+1,s)),i>=t&&(u=e<0?a.contentMatchAt(0).fillBefore(u,s<=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 b0(n,e,t){return e<n.openStart&&(n=new K(sf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new K(sf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const _0={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 w0=null;function v0(){return w0||(w0=document.implementation.createHTMLDocument("title"))}let of=null;function Rk(n){let e=window.trustedTypes;return e?(of||(of=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),of.createHTML(n)):n}function Lk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=v0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&_0[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Rk(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Pk(n){let e=n.querySelectorAll(pr?"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:s,openEnd:a}=n;for(let u=r.length-2;u>=0;u-=2){let c=t.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=z.from(c.create(r[u+1],i)),s++,a++}return new K(i,s,a)}const on={},It={};function gr(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,!x0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Cs&&pr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Zc&&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,Yg(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Mk(n,t)?t.preventDefault():gr(n,"key")},It.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},It.keypress=(n,e)=>{let t=e;if(x0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Kt&&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);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Ta(n){return{left:n.clientX,top:n.clientY}}function Fk(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function af(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(n.someProp(e,u=>a>s.depth?u(n,t,s.nodeAfter,s.before(a),i,!0):u(n,t,s.node(a),s.before(a),i,!1)))return!0;return!1}function ki(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function Bk(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Q.isSelectable(r)?(ki(n,new Q(t)),!0):!1}function zk(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Q&&(r=t.node);let s=n.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let u=a>s.depth?s.nodeAfter:s.node(a);if(Q.isSelectable(u)){r&&t.$from.depth>0&&a>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(a);break}}return i!=null?(ki(n,Q.create(n.state.doc,i)),!0):!1}function $k(n,e,t,r,i){return af(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?zk(n,t):Bk(n,t))}function Hk(n,e,t,r){return af(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Wk(n,e,t,r){return af(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?(ki(n,pe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(a.inlineContent)ki(n,pe.create(r,u+1,u+1+a.content.size));else if(Q.isSelectable(a))ki(n,Q.create(r,u));else continue;return!0}}function lf(n){return Oa(n)}const S0=Kt?"metaKey":"ctrlKey";on.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=lf(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Fk(t,n.input.lastClick)&&!t[S0]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let a=n.posAtCoords(Ta(t));a&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Uk(n,a,t,!!r)):(s=="doubleClick"?Hk:Wk)(n,a.pos,a.inside,t)?t.preventDefault():gr(n,"pointer"))};class Uk{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 s,a;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),a=t.inside;else{let p=e.state.doc.resolve(t.pos);s=p.parent,a=p.depth?p.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:h}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof Q&&h.from<=a&&h.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ka&&!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)),gr(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(()=>ef(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(Ta(e))),this.updateAllowDefault(e),this.allowDefault||!t?gr(this.view,"pointer"):$k(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Wr&&this.mightDrag&&!this.mightDrag.node.isAtom||pr&&!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)?(ki(this.view,ye.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):gr(this.view,"pointer")}move(e){this.updateAllowDefault(e),gr(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)}}on.touchstart=n=>{n.input.lastTouch=Date.now(),lf(n),gr(n,"pointer")},on.touchmove=n=>{n.input.lastTouch=Date.now(),gr(n,"pointer")},on.contextmenu=n=>lf(n);function x0(n,e){return n.composing?!0:Wr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const qk=Cs?5e3:-1;It.compositionstart=It.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof pe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Oa(n,!0),n.markCursor=null;else if(Oa(n,!e.selection.empty),ka&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let u=n.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}n.input.composing=!0}C0(n,qk)},It.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,C0(n,20))};function C0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Oa(n),e))}function Kk(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Gk());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Gk(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Oa(n,e=!1){if(!(Cs&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Kk(n),e||n.docView&&n.docView.dirty){let t=_k(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Jk(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 ks=xs&&Qg<15||Zc&&bk<604;on.copy=It.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=ks?null:t.clipboardData,a=r.content(),{dom:u,text:c}=d0(n,a);s?(t.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):Jk(n,u),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Yk(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();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?uf(n,r.value,null,i,e):uf(n,r.textContent,r.innerHTML,i,e)},50)}function uf(n,e,t,r,i){let s=p0(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,s||K.empty)))return!0;if(!s)return!1;let a=jk(s),u=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(s);return n.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function E0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}It.paste=(n,e)=>{let t=e;if(n.composing&&!Cs)return;let r=ks?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&uf(n,E0(r),r.getData("text/html"),i,t)?t.preventDefault():Yk(n,t)};class Xk{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const k0=Kt?"altKey":"ctrlKey";on.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Ta(t)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Q?i.to-1:i.to))){if(r&&r.mightDrag)a=Q.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let m=n.docView.nearestDesc(t.target,!0);m&&m.node.type.spec.draggable&&m!=n.docView&&(a=Q.create(n.state.doc,m.posBefore))}}let u=(a||n.state.selection).content(),{dom:c,text:h,slice:p}=d0(n,u);(!t.dataTransfer.files.length||!pr||e0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ks?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",ks||t.dataTransfer.setData("text/plain",h),n.dragging=new Xk(p,!t[k0],a)},on.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(Ta(t));if(!i)return;let s=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",S=>{a=S(a,n)}):a=p0(n,E0(t.dataTransfer),ks?null:t.dataTransfer.getData("text/html"),!1,s);let u=!!(r&&!t[k0]);if(n.someProp("handleDrop",S=>S(n,t,a||K.empty,u))){t.preventDefault();return}if(!a)return;t.preventDefault();let c=a?sk(n.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let h=n.state.tr;if(u){let{node:S}=r;S?S.replace(h):h.deleteSelection()}let p=h.mapping.map(c),m=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,y=h.doc;if(m?h.replaceRangeWith(p,p,a.content.firstChild):h.replaceRange(p,p,a),h.doc.eq(y))return;let _=h.doc.resolve(p);if(m&&Q.isSelectable(a.content.firstChild)&&_.nodeAfter&&_.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new Q(_));else{let S=h.mapping.map(c);h.mapping.maps[h.mapping.maps.length-1].forEach((E,N,g,v)=>S=v),h.setSelection(o0(n,_,h.doc.resolve(S)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},on.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())&&ef(n)},20))},on.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)},on.beforeinput=(n,e)=>{if(pr&&Cs&&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",s=>s(n,Yg(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)on[n]=It[n];function As(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 Fl{constructor(e,t){this.toDOM=e,this.spec=t||Vr,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new vn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Fl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&As(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Cr{constructor(e,t){this.attrs=e,this.spec=t||Vr}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new vn(s,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Cr&&As(this.attrs,e.attrs)&&As(this.spec,e.spec)}static is(e){return e.type instanceof Cr}destroy(){}}let Zk=class Ky{constructor(e,t){this.attrs=e,this.spec=t||Vr}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=s.pos?null:new vn(s.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Ky&&As(this.attrs,e.attrs)&&As(this.spec,e.spec)}destroy(){}};class vn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new vn(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 vn(e,e,new Fl(t,r))}static inline(e,t,r,i){return new vn(e,t,new Cr(r,i))}static node(e,t,r,i){return new vn(e,t,new Zk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Cr}get widget(){return this.type instanceof Fl}}const Ai=[],Vr={};class Ye{constructor(e,t){this.local=e.length?e:Ai,this.children=t.length?t:Ai}static create(e,t){return t.length?Ma(t,e,0,Vr):ft}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=t&&u.to>=e&&(!s||s(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,s)}}map(e,t,r){return this==ft||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Vr)}mapInner(e,t,r,i,s){let a;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(t,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?Qk(this.children,a||[],e,t,r,i,s):a?new Ye(a.sort(Ur),Ai):ft}add(e,t){return t.length?this==ft?Ye.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,p;if(p=T0(t,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,p,h+1):i.splice(s,0,c,c+u.nodeSize,Ma(p,u,h+1,Vr)),s+=3}});let a=A0(s?O0(t):t,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Ye(a.length?this.local.concat(a).sort(Ur):this.local,i||this.children)}remove(e){return e.length==0||this==ft?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let a,u=r[s]+t,c=r[s+1]+t;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>u&&m.to<c&&(e[p]=null,(a||(a=[])).push(m));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(a,u+1);h!=ft?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])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 Ye(i,r):ft}forChild(e,t){if(this==ft)return this;if(t.isLeaf)return Ye.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 s=e+1,a=s+t.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<a&&c.to>s&&c.type instanceof Cr){let h=Math.max(s,c.from)-s,p=Math.min(a,c.to)-s;h<p&&(i||(i=[])).push(c.copy(h,p))}}if(i){let u=new Ye(i.sort(Ur),Ai);return r?new Zr([u,r]):u}return r||ft}eq(e){if(this==e)return!0;if(!(e instanceof Ye)||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 cf(this.localsInner(e))}localsInner(e){if(this==ft)return Ai;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}forEachSet(e){e(this)}}Ye.empty=new Ye([],[]),Ye.removeOverlap=cf;const ft=Ye.empty;class Zr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Vr));return Zr.from(r)}forChild(e,t){if(t.isLeaf)return Ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=ft&&(s instanceof Zr?r=r.concat(s.members):r.push(s))}return Zr.from(r)}eq(e){if(!(e instanceof Zr)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let a=0;a<s.length;a++)t.push(s[a])}}return t?cf(r?t:t.sort(Ur)):Ai}static from(e){switch(e.length){case 0:return ft;case 1:return e[0];default:return new Zr(e.every(t=>t instanceof Ye)?e:e.reduce((t,r)=>t.concat(r instanceof Ye?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Qk(n,e,t,r,i,s,a){let u=n.slice();for(let h=0,p=s;h<t.maps.length;h++){let m=0;t.maps[h].forEach((y,_,S,E)=>{let N=E-S-(_-y);for(let g=0;g<u.length;g+=3){let v=u[g+1];if(v<0||y>v+p-m)continue;let k=u[g]+p-m;_>=k?u[g+1]=y<=k?-2:-1:y>=p&&N&&(u[g]+=N,u[g+1]+=N)}m+=N}),p=t.maps[h].map(p,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let p=t.map(n[h]+s),m=p-i;if(m<0||m>=r.content.size){c=!0;continue}let y=t.map(n[h+1]+s,-1),_=y-i,{index:S,offset:E}=r.content.findIndex(m),N=r.maybeChild(S);if(N&&E==m&&E+N.nodeSize==_){let g=u[h+2].mapInner(t,N,p+1,n[h]+s+1,a);g!=ft?(u[h]=m,u[h+1]=_,u[h+2]=g):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=eA(u,n,e,t,i,s,a),p=Ma(h,r,0,a);e=p.local;for(let m=0;m<u.length;m+=3)u[m+1]<0&&(u.splice(m,3),m-=3);for(let m=0,y=0;m<p.children.length;m+=3){let _=p.children[m];for(;y<u.length&&u[y]<_;)y+=3;u.splice(y,0,p.children[m],p.children[m+1],p.children[m+2])}}return new Ye(e.sort(Ur),u)}function A0(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 vn(i.from+e,i.to+e,i.type))}return t}function eA(n,e,t,r,i,s,a){function u(c,h){for(let p=0;p<c.local.length;p++){let m=c.local[p].map(r,i,h);m?t.push(m):a.onRemove&&a.onRemove(c.local[p].spec)}for(let p=0;p<c.children.length;p+=3)u(c.children[p+2],c.children[p]+h+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&u(n[c+2],e[c]+s+1);return t}function T0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,a;s<n.length;s++)(a=n[s])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[s]=null);return i}function O0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Ma(n,e,t,r){let i=[],s=!1;e.forEach((u,c)=>{let h=T0(n,u,c+t);if(h){s=!0;let p=Ma(h,u,t+c+1,r);p!=ft&&i.push(c,c+u.nodeSize,p)}});let a=A0(s?O0(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 Ye(a,i):ft}function Ur(n,e){return n.from-e.from||n.to-e.to}function cf(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),M0(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),M0(e,i,r.copy(s.from,r.to)));break}}}return e}function M0(n,e,t){for(;e<n.length&&Ur(t,n[e])>0;)e++;n.splice(e,0,t)}for(var yr={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:"'"},Ia={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tA=typeof navigator<"u"&&/Mac/.test(navigator.platform),nA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)yr[48+tt]=yr[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)yr[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)yr[tt]=String.fromCharCode(tt+32),Ia[tt]=String.fromCharCode(tt);for(var ff in yr)Ia.hasOwnProperty(ff)||(Ia[ff]=yr[ff]);function rA(n){var e=tA&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nA&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ia:yr)[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 iA=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function sA(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,a;for(let u=0;u<e.length-1;u++){let c=e[u];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))iA?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function oA(n){let e=Object.create(null);for(let t in n)e[sA(t)]=n[t];return e}function hf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function aA(n){return new ct({props:{handleKeyDown:lA(n)}})}function lA(n){let e=oA(n);return function(t,r){let i=rA(r),s,a=e[hf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[hf(i,r,!1)];if(u&&u(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=yr[r.keyCode])&&s!=i){let u=e[hf(s,r)];if(u&&u(t.state,t.dispatch,t))return!0}}return!1}}const df=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function I0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const N0=(n,e,t)=>{let r=I0(n,t);if(!r)return!1;let i=pf(r);if(!i){let a=r.blockRange(),u=a&&Si(a);return u==null?!1:(e&&e(n.tr.lift(a,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(H0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ti(s,"end")||Q.isSelectable(s)))for(let a=r.depth;;a--){let u=xa(n.doc,r.before(a),r.after(a),K.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=n.tr.step(u);c.setSelection(Ti(s,"end")?ye.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):Q.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},uA=(n,e,t)=>{let r=I0(n,t);if(!r)return!1;let i=pf(r);return i?R0(n,i,e):!1},cA=(n,e,t)=>{let r=P0(n,t);if(!r)return!1;let i=mf(r);return i?R0(n,i,e):!1};function R0(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let a=e.nodeAfter,u=a,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let p=u.firstChild;if(!p)return!1;u=p}let h=xa(n.doc,s,c,K.empty);if(!h||h.from!=s||h instanceof je&&h.slice.size>=c-s)return!1;if(t){let p=n.tr.step(h);p.setSelection(pe.create(p.doc,s)),t(p.scrollIntoView())}return!0}function Ti(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 L0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=pf(r)}let a=s&&s.nodeBefore;return!a||!Q.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function pf(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 P0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const D0=(n,e,t)=>{let r=P0(n,t);if(!r)return!1;let i=mf(r);if(!i)return!1;let s=i.nodeAfter;if(H0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ti(s,"start")||Q.isSelectable(s))){let a=xa(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(Ti(s,"start")?ye.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):Q.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},F0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=mf(r)}let a=s&&s.nodeAfter;return!a||!Q.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,s.pos)).scrollIntoView()),!0)};function mf(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 fA=(n,e)=>{let t=n.selection,r=t instanceof Q,i;if(r){if(t.node.isTextblock||!hr(n.doc,t.from))return!1;i=t.from}else if(i=Sa(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(Q.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},hA=(n,e)=>{let t=n.selection,r;if(t instanceof Q){if(t.node.isTextblock||!hr(n.doc,t.to))return!1;r=t.to}else if(r=Sa(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},dA=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Si(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},B0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
38
- `).scrollIntoView()),!0)};function gf(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 pA=(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),s=t.indexAfter(-1),a=gf(i.contentMatchAt(s));if(!a||!i.canReplaceWith(s,s,a))return!1;if(e){let u=t.after(),c=n.tr.replaceWith(u,u,a.createAndFill());c.setSelection(ye.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},z0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Rt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=gf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=n.tr.insert(a,s.createAndFill());u.setSelection(pe.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},$0=(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 s=t.before();if(zn(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Si(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function mA(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!r.parentOffset||!zn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,u,c=!1,h=!1;for(let _=r.depth;;_--)if(r.node(_).isBlock){c=r.end(_)==r.pos+(r.depth-_),h=r.start(_)==r.pos-(r.depth-_),u=gf(r.node(_-1).contentMatchAt(r.indexAfter(_-1))),s.unshift(c&&u?{type:u}:null),a=_;break}else{if(_==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof pe||e.selection instanceof Rt)&&p.deleteSelection();let m=p.mapping.map(r.pos),y=zn(p.doc,m,s.length,s);if(y||(s[0]=u?{type:u}:null,y=zn(p.doc,m,s.length,s)),p.split(m,s.length,s),!c&&h&&r.node(a).type!=u){let _=p.mapping.map(r.before(a)),S=p.doc.resolve(_);u&&r.node(a-1).canReplaceWith(S.index(),S.index()+1,u)&&p.setNodeMarkup(p.mapping.map(r.before(a)),u)}return t&&t(p.scrollIntoView()),!0}}const gA=mA(),yA=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(Q.create(n.doc,i))),!0)};function bA(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||hr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function H0(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,a,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&bA(n,e,t))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(a[0]||s.type).validEnd){if(t){let _=e.pos+s.nodeSize,S=z.empty;for(let g=a.length-1;g>=0;g--)S=z.from(a[g].create(null,S));S=z.from(i.copy(S));let E=n.tr.step(new Je(e.pos-1,_,e.pos,_,new K(S,1,0),a.length,!0)),N=E.doc.resolve(_+2*a.length);N.nodeAfter&&N.nodeAfter.type==i.type&&hr(E.doc,N.pos)&&E.join(N.pos),t(E.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&c?null:ye.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),y=m&&Si(m);if(y!=null&&y>=e.depth)return t&&t(n.tr.lift(m,y).scrollIntoView()),!0;if(h&&Ti(s,"start",!0)&&Ti(i,"end")){let _=i,S=[];for(;S.push(_),!_.isTextblock;)_=_.lastChild;let E=s,N=1;for(;!E.isTextblock;E=E.firstChild)N++;if(_.canReplace(_.childCount,_.childCount,E.content)){if(t){let g=z.empty;for(let k=S.length-1;k>=0;k--)g=z.from(S[k].copy(g));let v=n.tr.step(new Je(e.pos-S.length,e.pos+s.nodeSize,e.pos+N,e.pos+s.nodeSize-N,new K(g,S.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function W0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(pe.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const _A=W0(-1),wA=W0(1);function vA(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,a=i.blockRange(s),u=a&&Vc(a,n,e);return u?(r&&r(t.tr.wrap(a,u).scrollIntoView()),!0):!1}}function V0(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:a},$to:{pos:u}}=t.selection.ranges[s];t.doc.nodesBetween(a,u,(c,h)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let p=t.doc.resolve(h),m=p.index();i=p.parent.canReplaceWith(m,m+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:c}}=t.selection.ranges[a];s.setBlockType(u,c,n,e)}r(s.scrollIntoView())}return!0}}function yf(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}yf(df,N0,L0),yf(df,D0,F0),yf(B0,z0,$0,gA),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:s}=t.selection,a=i.blockRange(s);if(!a)return!1;let u=r?t.tr:null;return xA(u,a,n,e)?(r&&r(u.scrollIntoView()),!0):!1}}function xA(n,e,t,r=null){let i=!1,s=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=a.resolve(e.start-2);s=new ya(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new ya(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let u=Vc(s,t,r,e);return u?(n&&CA(n,e,u,i,t),!0):!1}function CA(n,e,t,r,i){let s=z.empty;for(let p=t.length-1;p>=0;p--)s=z.from(t[p].type.create(t[p].attrs,s));n.step(new Je(e.start-(r?2:0),e.end,e.start,e.end,new K(s,0,0),t.length,!0));let a=0;for(let p=0;p<t.length;p++)t[p].type==i&&(a=p+1);let u=t.length-a,c=e.start+t.length-(r?2:0),h=e.parent;for(let p=e.startIndex,m=e.endIndex,y=!0;p<m;p++,y=!1)!y&&zn(n.doc,c,u)&&(n.split(c,u),c+=2*u),c+=h.child(p).nodeSize;return n}function EA(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?kA(e,t,n,s):AA(e,t,s):!0:!1}}function kA(n,e,t,r){let i=n.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(i.step(new Je(s-1,a,s,a,new K(z.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new ya(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Si(r);if(u==null)return!1;i.lift(r,u);let c=i.mapping.map(s,-1)-1;return hr(i.doc,c)&&i.join(c),e(i.scrollIntoView()),!0}function AA(n,e,t){let r=n.tr,i=t.parent;for(let _=t.end,S=t.endIndex-1,E=t.startIndex;S>E;S--)_-=i.child(S).nodeSize,r.delete(_-1,_+1);let s=r.doc.resolve(t.start),a=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let u=t.startIndex==0,c=t.endIndex==i.childCount,h=s.node(-1),p=s.index(-1);if(!h.canReplace(p+(u?0:1),p+1,a.content.append(c?z.empty:z.from(i))))return!1;let m=s.pos,y=m+a.nodeSize;return r.step(new Je(m-(u?1:0),y+(c?1:0),m+1,y-1,new K((u?z.empty:z.from(i.copy(z.empty))).append(c?z.empty:z.from(i.copy(z.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function TA(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let u=s.parent,c=u.child(a-1);if(c.type!=n)return!1;if(t){let h=c.lastChild&&c.lastChild.type==u.type,p=z.from(h?n.create():null),m=new K(z.from(n.create(null,z.from(u.type.create(null,p)))),h?3:1,0),y=s.start,_=s.end;t(e.tr.step(new Je(y-(h?3:1),_,y,_,m,1,!0)).scrollIntoView())}return!0}}function Na(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class bf{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:s}=r,a=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([u,c])=>[u,(...p)=>{const m=c(...p)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:a}=i,u=[],c=!!e,h=e||s.tr,p=()=>(!c&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),u.every(y=>y===!0)),m={...Object.fromEntries(Object.entries(r).map(([y,_])=>[y,(...E)=>{const N=this.buildProps(h,t),g=_(...E)(N);return u.push(g),m}])),run:p};return m}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,a=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([c,h])=>[c,(...p)=>h(...p)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:a}=i,u={tr:e,editor:i,view:a,state:Na({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,h])=>[c,(...p)=>h(...p)(u)]))}};return u}}function J(n,e,t){return n.config[e]===void 0&&n.parent?J(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?J(n.parent,e,t):null}):n.config[e]}function Ra(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 U0(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ra(n),i=[...t,...r],s={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,extensions:i},c=J(a,"addGlobalAttributes",u);if(!c)return;c().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([y,_])=>{e.push({type:m,name:y,attribute:{...s,..._}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},c=J(a,"addAttributes",u);if(!c)return;const h=c();Object.entries(h).forEach(([p,m])=>{const y={...s,...m};typeof y?.default=="function"&&(y.default=y.default()),y?.isRequired&&y?.default===void 0&&delete y.default,e.push({type:a.name,name:p,attribute:y})})}),e}function qe(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 Oi(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const u=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],h=u.filter(p=>!c.includes(p));r[i]=[...c,...h].join(" ")}else if(i==="style"){const u=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],h=new Map;c.forEach(p=>{const[m,y]=p.split(":").map(_=>_.trim());h.set(m,y)}),u.forEach(p=>{const[m,y]=p.split(":").map(_=>_.trim());h.set(m,y)}),r[i]=Array.from(h.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function _f(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Oi(t,r),{})}function OA(n){return typeof n=="function"}function de(n,e=void 0,...t){return OA(n)?e?n.bind(e)(...t):n(...t):n}function MA(n={}){return Object.keys(n).length===0&&n.constructor===Object}function IA(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function q0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(t):IA(t.getAttribute(a.name));return u==null?s:{...s,[a.name]:u}},{});return{...r,...i}}}}function K0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&MA(t)?!1:t!=null))}function G0(n,e){var t;const r=U0(n),{nodeExtensions:i,markExtensions:s}=Ra(n),a=(t=i.find(h=>J(h,"topNode")))===null||t===void 0?void 0:t.name,u=Object.fromEntries(i.map(h=>{const p=r.filter(g=>g.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=n.reduce((g,v)=>{const k=J(v,"extendNodeSchema",m);return{...g,...k?k(h):{}}},{}),_=K0({...y,content:de(J(h,"content",m)),marks:de(J(h,"marks",m)),group:de(J(h,"group",m)),inline:de(J(h,"inline",m)),atom:de(J(h,"atom",m)),selectable:de(J(h,"selectable",m)),draggable:de(J(h,"draggable",m)),code:de(J(h,"code",m)),whitespace:de(J(h,"whitespace",m)),linebreakReplacement:de(J(h,"linebreakReplacement",m)),defining:de(J(h,"defining",m)),isolating:de(J(h,"isolating",m)),attrs:Object.fromEntries(p.map(g=>{var v;return[g.name,{default:(v=g?.attribute)===null||v===void 0?void 0:v.default}]}))}),S=de(J(h,"parseHTML",m));S&&(_.parseDOM=S.map(g=>q0(g,p)));const E=J(h,"renderHTML",m);E&&(_.toDOM=g=>E({node:g,HTMLAttributes:_f(g,p)}));const N=J(h,"renderText",m);return N&&(_.toText=N),[h.name,_]})),c=Object.fromEntries(s.map(h=>{const p=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=n.reduce((N,g)=>{const v=J(g,"extendMarkSchema",m);return{...N,...v?v(h):{}}},{}),_=K0({...y,inclusive:de(J(h,"inclusive",m)),excludes:de(J(h,"excludes",m)),group:de(J(h,"group",m)),spanning:de(J(h,"spanning",m)),code:de(J(h,"code",m)),attrs:Object.fromEntries(p.map(N=>{var g;return[N.name,{default:(g=N?.attribute)===null||g===void 0?void 0:g.default}]}))}),S=de(J(h,"parseHTML",m));S&&(_.parseDOM=S.map(N=>q0(N,p)));const E=J(h,"renderHTML",m);return E&&(_.toDOM=N=>E({mark:N,HTMLAttributes:_f(N,p)})),[h.name,_]}));return new yg({topNode:a,nodes:u,marks:c})}function wf(n,e){return e.nodes[n]||e.marks[n]||null}function J0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function j0(n,e){const t=Vs.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const NA=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,a,u)=>{var c,h;const p=((h=(c=i.type.spec).toText)===null||h===void 0?void 0:h.call(c,{node:i,pos:s,parent:a,index:u}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),t};function vf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Y0{constructor(e){this.find=e.find,this.handler=e.handler}}const RA=(n,e)=>{if(vf(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 La(n){var e;const{editor:t,from:r,to:i,text:s,rules:a,plugin:u}=n,{view:c}=t;if(c.composing)return!1;const h=c.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(y=>y.type.spec.code))return!1;let p=!1;const m=NA(h)+s;return a.forEach(y=>{if(p)return;const _=RA(m,y.find);if(!_)return;const S=c.state.tr,E=Na({state:c.state,transaction:S}),N={from:r-(_[0].length-s.length),to:i},{commands:g,chain:v,can:k}=new bf({editor:t,state:E});y.handler({state:E,range:N,match:_,commands:g,chain:v,can:k})===null||!S.steps.length||(S.setMeta(u,{transform:S,from:r,to:i,text:s}),c.dispatch(S),p=!0)}),p}function LA(n){const{editor:e,rules:t}=n,r=new ct({state:{init(){return null},apply(i,s,a){const u=i.getMeta(r);if(u)return u;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:p}=c;typeof p=="string"?p=p:p=j0(z.from(p),a.schema);const{from:m}=c,y=m+p.length;La({editor:e,from:m,to:y,text:p,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,a,u){return La({editor:e,from:s,to:a,text:u,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&La({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?La({editor:e,from:a.pos,to:a.pos,text:`
39
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function PA(n){return Object.prototype.toString.call(n).slice(8,-1)}function Pa(n){return PA(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Da(n,e){const t={...n};return Pa(n)&&Pa(e)&&Object.keys(e).forEach(r=>{Pa(e[r])&&Pa(n[r])?t[r]=Da(n[r],e[r]):t[r]=e[r]}),t}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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Nt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,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&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(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 c=a.find(h=>h?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function DA(n){return typeof n=="number"}class FA{constructor(e){this.find=e.find,this.handler=e.handler}}const BA=(n,e,t)=>{if(vf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function zA(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:a,dropEvent:u}=n,{commands:c,chain:h,can:p}=new bf({editor:e,state:t}),m=[];return t.doc.nodesBetween(r,i,(_,S)=>{if(!_.isTextblock||_.type.spec.code)return;const E=Math.max(r,S),N=Math.min(i,S+_.content.size),g=_.textBetween(E-S,N-S,void 0,"\uFFFC");BA(g,s.find,a).forEach(k=>{if(k.index===void 0)return;const A=E+k.index+1,T=A+k[0].length,F={from:t.tr.mapping.map(A),to:t.tr.mapping.map(T)},U=s.handler({state:t,range:F,match:k,commands:c,chain:h,can:p,pasteEvent:a,dropEvent:u});m.push(U)})}),m.every(_=>_!==null)}let Fa=null;const $A=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function HA(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const c=({state:p,from:m,to:y,rule:_,pasteEvt:S})=>{const E=p.tr,N=Na({state:p,transaction:E});if(!(!zA({editor:e,state:N,from:Math.max(m-1,0),to:y.b-1,rule:_,pasteEvent:S,dropEvent:u})||!E.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,E}};return t.map(p=>new ct({view(m){const y=S=>{var E;r=!((E=m.dom.parentElement)===null||E===void 0)&&E.contains(S.target)?m.dom.parentElement:null,r&&(Fa=e)},_=()=>{Fa&&(Fa=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",_),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",_)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(s=r===m.dom.parentElement,u=y,!s){const _=Fa;_&&setTimeout(()=>{const S=_.state.selection;S&&_.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,y)=>{var _;const S=(_=y.clipboardData)===null||_===void 0?void 0:_.getData("text/html");return a=y,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,y,_)=>{const S=m[0],E=S.getMeta("uiEvent")==="paste"&&!i,N=S.getMeta("uiEvent")==="drop"&&!s,g=S.getMeta("applyPasteRules"),v=!!g;if(!E&&!N&&!v)return;if(v){let{text:T}=g;typeof T=="string"?T=T:T=j0(z.from(T),_.schema);const{from:F}=g,U=F+T.length,H=$A(T);return c({rule:p,state:_,from:F,to:{b:U},pasteEvt:H})}const k=y.doc.content.findDiffStart(_.doc.content),A=y.doc.content.findDiffEnd(_.doc.content);if(!(!DA(k)||!A||k===A.b))return c({rule:p,state:_,from:k,to:A,pasteEvt:a})}}))}function WA(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Di{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Di.resolve(e),this.schema=G0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Di.sort(Di.flatten(e)),r=WA(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=J(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=J(r,"priority")||100,a=J(i,"priority")||100;return s>a?-1:s<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:wf(t.name,this.schema)},i=J(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Di.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:e,type:wf(a.name,this.schema)},c=[],h=J(a,"addKeyboardShortcuts",u);let p={};if(a.type==="mark"&&J(a,"exitable",u)&&(p.ArrowRight=()=>Nt.handleExit({editor:e,mark:a})),h){const E=Object.fromEntries(Object.entries(h()).map(([N,g])=>[N,()=>g({editor:e})]));p={...p,...E}}const m=aA(p);c.push(m);const y=J(a,"addInputRules",u);J0(a,e.options.enableInputRules)&&y&&r.push(...y());const _=J(a,"addPasteRules",u);J0(a,e.options.enablePasteRules)&&_&&i.push(..._());const S=J(a,"addProseMirrorPlugins",u);if(S){const E=S();c.push(...E)}return c}).flat();return[LA({editor:e,rules:r}),...HA({editor:e,rules:i}),...s]}get attributes(){return U0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ra(this.extensions);return Object.fromEntries(t.filter(r=>!!J(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:qe(r.name,this.schema)},a=J(r,"addNodeView",s);if(!a)return[];const u=(c,h,p,m,y)=>{const _=_f(c,i);return a()({node:c,view:h,getPos:p,decorations:m,innerDecorations:y,editor:e,extension:r,HTMLAttributes:_})};return[r.name,u]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:wf(e.name,this.schema)};e.type==="mark"&&(!((t=de(J(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=J(e,"onBeforeCreate",r),s=J(e,"onCreate",r),a=J(e,"onUpdate",r),u=J(e,"onSelectionUpdate",r),c=J(e,"onTransaction",r),h=J(e,"onFocus",r),p=J(e,"onBlur",r),m=J(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),a&&this.editor.on("update",a),u&&this.editor.on("selectionUpdate",u),c&&this.editor.on("transaction",c),h&&this.editor.on("focus",h),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Re(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Re({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(t,"addStorage",{name:t.name,options:t.options})),t}}function VA(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
37
+ `))),0,0):K.empty;let m=n.someProp("clipboardTextParser",y=>y(e,i,r,n));if(m)u=m;else{let y=i.marks(),{schema:_}=n.state,S=Vs.fromSchema(_);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(E=>{let N=a.appendChild(document.createElement("p"));E&&N.appendChild(S.serializeNode(_.text(E,y)))})}}else n.someProp("transformPastedHTML",m=>{t=m(t,n)}),a=Pk(t),Qc&&Dk(a);let h=a&&a.querySelector("[data-pm-slice]"),p=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let y=a.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;a=y}if(u||(u=(n.someProp("clipboardParser")||n.someProp("domParser")||_s.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||p),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!Nk.test(y.parentNode.nodeName)?{ignore:!0}:null}})),p)u=Fk(b0(u,+p[1],+p[2]),p[4]);else if(u=K.maxOpen(Rk(u.content,i),!0),u.openStart||u.openEnd){let m=0,y=0;for(let _=u.content.firstChild;m<u.openStart&&!_.type.spec.isolating;m++,_=_.firstChild);for(let _=u.content.lastChild;y<u.openEnd&&!_.type.spec.isolating;y++,_=_.lastChild);u=b0(u,m,y)}return n.someProp("transformPasted",m=>{u=m(u,n)}),u}const Nk=/^(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 Rk(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)),s,a=[];if(n.forEach(u=>{if(!a)return;let c=i.findWrapping(u.type),h;if(!c)return a=null;if(h=a.length&&s.length&&g0(c,s,u,a[a.length-1],0))a[a.length-1]=h;else{a.length&&(a[a.length-1]=y0(a[a.length-1],s.length));let p=m0(u,c);a.push(p),i=i.matchType(p.type),s=c}}),a)return z.from(a)}return n}function m0(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,z.from(n));return n}function g0(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=g0(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(z.from(m0(t,n,i+1))))}}function y0(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,y0(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(z.empty,!0);return n.copy(t.append(r))}function sf(n,e,t,r,i,s){let a=e<0?n.firstChild:n.lastChild,u=a.content;return n.childCount>1&&(s=0),i<r-1&&(u=sf(u,e,t,r,i+1,s)),i>=t&&(u=e<0?a.contentMatchAt(0).fillBefore(u,s<=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 b0(n,e,t){return e<n.openStart&&(n=new K(sf(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new K(sf(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const _0={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 w0=null;function v0(){return w0||(w0=document.implementation.createHTMLDocument("title"))}let of=null;function Lk(n){let e=window.trustedTypes;return e?(of||(of=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),of.createHTML(n)):n}function Pk(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=v0().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&_0[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Lk(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Dk(n){let e=n.querySelectorAll(pr?"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 Fk(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:s,openEnd:a}=n;for(let u=r.length-2;u>=0;u-=2){let c=t.nodes[r[u]];if(!c||c.hasRequiredAttrs())break;i=z.from(c.create(r[u+1],i)),s++,a++}return new K(i,s,a)}const on={},Nt={};function gr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Nt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!x0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Cs&&pr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Zc&&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,Yg(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ik(n,t)?t.preventDefault():gr(n,"key")},Nt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Nt.keypress=(n,e)=>{let t=e;if(x0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Gt&&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);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function Aa(n){return{left:n.clientX,top:n.clientY}}function Bk(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function af(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(n.someProp(e,u=>a>s.depth?u(n,t,s.nodeAfter,s.before(a),i,!0):u(n,t,s.node(a),s.before(a),i,!1)))return!0;return!1}function ki(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function zk(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Q.isSelectable(r)?(ki(n,new Q(t)),!0):!1}function $k(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Q&&(r=t.node);let s=n.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let u=a>s.depth?s.nodeAfter:s.node(a);if(Q.isSelectable(u)){r&&t.$from.depth>0&&a>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(a);break}}return i!=null?(ki(n,Q.create(n.state.doc,i)),!0):!1}function Hk(n,e,t,r,i){return af(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?$k(n,t):zk(n,t))}function Wk(n,e,t,r){return af(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Vk(n,e,t,r){return af(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Uk(n,t,r)}function Uk(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(ki(n,pe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s),u=i.before(s);if(a.inlineContent)ki(n,pe.create(r,u+1,u+1+a.content.size));else if(Q.isSelectable(a))ki(n,Q.create(r,u));else continue;return!0}}function lf(n){return Ma(n)}const S0=Gt?"metaKey":"ctrlKey";on.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=lf(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Bk(t,n.input.lastClick)&&!t[S0]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let a=n.posAtCoords(Aa(t));a&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new qk(n,a,t,!!r)):(s=="doubleClick"?Wk:Vk)(n,a.pos,a.inside,t)?t.preventDefault():gr(n,"pointer"))};class qk{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 s,a;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),a=t.inside;else{let p=e.state.doc.resolve(t.pos);s=p.parent,a=p.depth?p.before():0}const u=i?null:r.target,c=u?e.docView.nearestDesc(u,!0):null;this.target=c&&c.dom.nodeType==1?c.dom:null;let{selection:h}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||h instanceof Q&&h.from<=a&&h.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ka&&!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)),gr(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(()=>ef(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(Aa(e))),this.updateAllowDefault(e),this.allowDefault||!t?gr(this.view,"pointer"):Hk(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Vr&&this.mightDrag&&!this.mightDrag.node.isAtom||pr&&!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)?(ki(this.view,ye.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):gr(this.view,"pointer")}move(e){this.updateAllowDefault(e),gr(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)}}on.touchstart=n=>{n.input.lastTouch=Date.now(),lf(n),gr(n,"pointer")},on.touchmove=n=>{n.input.lastTouch=Date.now(),gr(n,"pointer")},on.contextmenu=n=>lf(n);function x0(n,e){return n.composing?!0:Vr&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Kk=Cs?5e3:-1;Nt.compositionstart=Nt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof pe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Ma(n,!0),n.markCursor=null;else if(Ma(n,!e.selection.empty),ka&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let a=s<0?i.lastChild:i.childNodes[s-1];if(!a)break;if(a.nodeType==3){let u=n.domSelection();u&&u.collapse(a,a.nodeValue.length);break}else i=a,s=-1}}n.input.composing=!0}C0(n,Kk)},Nt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,C0(n,20))};function C0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Ma(n),e))}function Gk(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Jk());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Jk(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ma(n,e=!1){if(!(Cs&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Gk(n),e||n.docView&&n.docView.dirty){let t=wk(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function jk(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 ks=xs&&Qg<15||Zc&&_k<604;on.copy=Nt.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=ks?null:t.clipboardData,a=r.content(),{dom:u,text:c}=d0(n,a);s?(t.preventDefault(),s.clearData(),s.setData("text/html",u.innerHTML),s.setData("text/plain",c)):jk(n,u),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Yk(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Xk(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();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?uf(n,r.value,null,i,e):uf(n,r.textContent,r.innerHTML,i,e)},50)}function uf(n,e,t,r,i){let s=p0(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,i,s||K.empty)))return!0;if(!s)return!1;let a=Yk(s),u=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(s);return n.dispatch(u.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function E0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Nt.paste=(n,e)=>{let t=e;if(n.composing&&!Cs)return;let r=ks?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&uf(n,E0(r),r.getData("text/html"),i,t)?t.preventDefault():Xk(n,t)};class Zk{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const k0=Gt?"altKey":"ctrlKey";on.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(Aa(t)),a;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Q?i.to-1:i.to))){if(r&&r.mightDrag)a=Q.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let m=n.docView.nearestDesc(t.target,!0);m&&m.node.type.spec.draggable&&m!=n.docView&&(a=Q.create(n.state.doc,m.posBefore))}}let u=(a||n.state.selection).content(),{dom:c,text:h,slice:p}=d0(n,u);(!t.dataTransfer.files.length||!pr||e0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ks?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",ks||t.dataTransfer.setData("text/plain",h),n.dragging=new Zk(p,!t[k0],a)},on.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Nt.dragover=Nt.dragenter=(n,e)=>e.preventDefault(),Nt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(Aa(t));if(!i)return;let s=n.state.doc.resolve(i.pos),a=r&&r.slice;a?n.someProp("transformPasted",S=>{a=S(a,n)}):a=p0(n,E0(t.dataTransfer),ks?null:t.dataTransfer.getData("text/html"),!1,s);let u=!!(r&&!t[k0]);if(n.someProp("handleDrop",S=>S(n,t,a||K.empty,u))){t.preventDefault();return}if(!a)return;t.preventDefault();let c=a?ok(n.state.doc,s.pos,a):s.pos;c==null&&(c=s.pos);let h=n.state.tr;if(u){let{node:S}=r;S?S.replace(h):h.deleteSelection()}let p=h.mapping.map(c),m=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,y=h.doc;if(m?h.replaceRangeWith(p,p,a.content.firstChild):h.replaceRange(p,p,a),h.doc.eq(y))return;let _=h.doc.resolve(p);if(m&&Q.isSelectable(a.content.firstChild)&&_.nodeAfter&&_.nodeAfter.sameMarkup(a.content.firstChild))h.setSelection(new Q(_));else{let S=h.mapping.map(c);h.mapping.maps[h.mapping.maps.length-1].forEach((E,N,g,v)=>S=v),h.setSelection(o0(n,_,h.doc.resolve(S)))}n.focus(),n.dispatch(h.setMeta("uiEvent","drop"))},on.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())&&ef(n)},20))},on.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)},on.beforeinput=(n,e)=>{if(pr&&Cs&&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",s=>s(n,Yg(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 Nt)on[n]=Nt[n];function Ts(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 Fl{constructor(e,t){this.toDOM=e,this.spec=t||Ur,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:a}=e.mapResult(t.from+i,this.side<0?-1:1);return a?null:new vn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Fl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ts(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Er{constructor(e,t){this.attrs=e,this.spec=t||Ur}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new vn(s,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Er&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}static is(e){return e.type instanceof Er}destroy(){}}let Qk=class Gy{constructor(e,t){this.attrs=e,this.spec=t||Ur}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let a=e.mapResult(t.to+i,-1);return a.deleted||a.pos<=s.pos?null:new vn(s.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Gy&&Ts(this.attrs,e.attrs)&&Ts(this.spec,e.spec)}destroy(){}};class vn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new vn(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 vn(e,e,new Fl(t,r))}static inline(e,t,r,i){return new vn(e,t,new Er(r,i))}static node(e,t,r,i){return new vn(e,t,new Qk(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Er}get widget(){return this.type instanceof Fl}}const Ti=[],Ur={};class Ye{constructor(e,t){this.local=e.length?e:Ti,this.children=t.length?t:Ti}static create(e,t){return t.length?Oa(t,e,0,Ur):ft}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let a=0;a<this.local.length;a++){let u=this.local[a];u.from<=t&&u.to>=e&&(!s||s(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,s)}}map(e,t,r){return this==ft||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Ur)}mapInner(e,t,r,i,s){let a;for(let u=0;u<this.local.length;u++){let c=this.local[u].map(e,r,i);c&&c.type.valid(t,c)?(a||(a=[])).push(c):s.onRemove&&s.onRemove(this.local[u].spec)}return this.children.length?eT(this.children,a||[],e,t,r,i,s):a?new Ye(a.sort(qr),Ti):ft}add(e,t){return t.length?this==ft?Ye.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((u,c)=>{let h=c+r,p;if(p=A0(t,u,h)){for(i||(i=this.children.slice());s<i.length&&i[s]<c;)s+=3;i[s]==c?i[s+2]=i[s+2].addInner(u,p,h+1):i.splice(s,0,c,c+u.nodeSize,Oa(p,u,h+1,Ur)),s+=3}});let a=T0(s?M0(t):t,-r);for(let u=0;u<a.length;u++)a[u].type.valid(e,a[u])||a.splice(u--,1);return new Ye(a.length?this.local.concat(a).sort(qr):this.local,i||this.children)}remove(e){return e.length==0||this==ft?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let a,u=r[s]+t,c=r[s+1]+t;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>u&&m.to<c&&(e[p]=null,(a||(a=[])).push(m));if(!a)continue;r==this.children&&(r=this.children.slice());let h=r[s+2].removeInner(a,u+1);h!=ft?r[s+2]=h:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,a;s<e.length;s++)if(a=e[s])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 Ye(i,r):ft}forChild(e,t){if(this==ft)return this;if(t.isLeaf)return Ye.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 s=e+1,a=s+t.content.size;for(let u=0;u<this.local.length;u++){let c=this.local[u];if(c.from<a&&c.to>s&&c.type instanceof Er){let h=Math.max(s,c.from)-s,p=Math.min(a,c.to)-s;h<p&&(i||(i=[])).push(c.copy(h,p))}}if(i){let u=new Ye(i.sort(qr),Ti);return r?new Zr([u,r]):u}return r||ft}eq(e){if(this==e)return!0;if(!(e instanceof Ye)||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 cf(this.localsInner(e))}localsInner(e){if(this==ft)return Ti;if(e.inlineContent||!this.local.some(Er.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Er||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Ye.empty=new Ye([],[]),Ye.removeOverlap=cf;const ft=Ye.empty;class Zr{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Ur));return Zr.from(r)}forChild(e,t){if(t.isLeaf)return Ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=ft&&(s instanceof Zr?r=r.concat(s.members):r.push(s))}return Zr.from(r)}eq(e){if(!(e instanceof Zr)||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 s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let a=0;a<s.length;a++)t.push(s[a])}}return t?cf(r?t:t.sort(qr)):Ti}static from(e){switch(e.length){case 0:return ft;case 1:return e[0];default:return new Zr(e.every(t=>t instanceof Ye)?e:e.reduce((t,r)=>t.concat(r instanceof Ye?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function eT(n,e,t,r,i,s,a){let u=n.slice();for(let h=0,p=s;h<t.maps.length;h++){let m=0;t.maps[h].forEach((y,_,S,E)=>{let N=E-S-(_-y);for(let g=0;g<u.length;g+=3){let v=u[g+1];if(v<0||y>v+p-m)continue;let k=u[g]+p-m;_>=k?u[g+1]=y<=k?-2:-1:y>=p&&N&&(u[g]+=N,u[g+1]+=N)}m+=N}),p=t.maps[h].map(p,-1)}let c=!1;for(let h=0;h<u.length;h+=3)if(u[h+1]<0){if(u[h+1]==-2){c=!0,u[h+1]=-1;continue}let p=t.map(n[h]+s),m=p-i;if(m<0||m>=r.content.size){c=!0;continue}let y=t.map(n[h+1]+s,-1),_=y-i,{index:S,offset:E}=r.content.findIndex(m),N=r.maybeChild(S);if(N&&E==m&&E+N.nodeSize==_){let g=u[h+2].mapInner(t,N,p+1,n[h]+s+1,a);g!=ft?(u[h]=m,u[h+1]=_,u[h+2]=g):(u[h+1]=-2,c=!0)}else c=!0}if(c){let h=tT(u,n,e,t,i,s,a),p=Oa(h,r,0,a);e=p.local;for(let m=0;m<u.length;m+=3)u[m+1]<0&&(u.splice(m,3),m-=3);for(let m=0,y=0;m<p.children.length;m+=3){let _=p.children[m];for(;y<u.length&&u[y]<_;)y+=3;u.splice(y,0,p.children[m],p.children[m+1],p.children[m+2])}}return new Ye(e.sort(qr),u)}function T0(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 vn(i.from+e,i.to+e,i.type))}return t}function tT(n,e,t,r,i,s,a){function u(c,h){for(let p=0;p<c.local.length;p++){let m=c.local[p].map(r,i,h);m?t.push(m):a.onRemove&&a.onRemove(c.local[p].spec)}for(let p=0;p<c.children.length;p+=3)u(c.children[p+2],c.children[p]+h+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&u(n[c+2],e[c]+s+1);return t}function A0(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,a;s<n.length;s++)(a=n[s])&&a.from>t&&a.to<r&&((i||(i=[])).push(a),n[s]=null);return i}function M0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Oa(n,e,t,r){let i=[],s=!1;e.forEach((u,c)=>{let h=A0(n,u,c+t);if(h){s=!0;let p=Oa(h,u,t+c+1,r);p!=ft&&i.push(c,c+u.nodeSize,p)}});let a=T0(s?M0(n):n,-t).sort(qr);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 Ye(a,i):ft}function qr(n,e){return n.from-e.from||n.to-e.to}function cf(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 s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),O0(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),O0(e,i,r.copy(s.from,r.to)));break}}}return e}function O0(n,e,t){for(;e<n.length&&qr(t,n[e])>0;)e++;n.splice(e,0,t)}for(var yr={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:"'"},Ia={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nT=typeof navigator<"u"&&/Mac/.test(navigator.platform),rT=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)yr[48+tt]=yr[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)yr[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)yr[tt]=String.fromCharCode(tt+32),Ia[tt]=String.fromCharCode(tt);for(var ff in yr)Ia.hasOwnProperty(ff)||(Ia[ff]=yr[ff]);function iT(n){var e=nT&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||rT&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ia:yr)[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 sT=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function oT(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,a;for(let u=0;u<e.length-1;u++){let c=e[u];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))sT?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),a&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function aT(n){let e=Object.create(null);for(let t in n)e[oT(t)]=n[t];return e}function hf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function lT(n){return new ct({props:{handleKeyDown:uT(n)}})}function uT(n){let e=aT(n);return function(t,r){let i=iT(r),s,a=e[hf(i,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let u=e[hf(i,r,!1)];if(u&&u(t.state,t.dispatch,t))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(s=yr[r.keyCode])&&s!=i){let u=e[hf(s,r)];if(u&&u(t.state,t.dispatch,t))return!0}}return!1}}const df=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function I0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const N0=(n,e,t)=>{let r=I0(n,t);if(!r)return!1;let i=pf(r);if(!i){let a=r.blockRange(),u=a&&Si(a);return u==null?!1:(e&&e(n.tr.lift(a,u).scrollIntoView()),!0)}let s=i.nodeBefore;if(H0(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Ai(s,"end")||Q.isSelectable(s)))for(let a=r.depth;;a--){let u=xa(n.doc,r.before(a),r.after(a),K.empty);if(u&&u.slice.size<u.to-u.from){if(e){let c=n.tr.step(u);c.setSelection(Ai(s,"end")?ye.findFrom(c.doc.resolve(c.mapping.map(i.pos,-1)),-1):Q.create(c.doc,i.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},cT=(n,e,t)=>{let r=I0(n,t);if(!r)return!1;let i=pf(r);return i?R0(n,i,e):!1},fT=(n,e,t)=>{let r=P0(n,t);if(!r)return!1;let i=mf(r);return i?R0(n,i,e):!1};function R0(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let a=e.nodeAfter,u=a,c=e.pos+1;for(;!u.isTextblock;c++){if(u.type.spec.isolating)return!1;let p=u.firstChild;if(!p)return!1;u=p}let h=xa(n.doc,s,c,K.empty);if(!h||h.from!=s||h instanceof je&&h.slice.size>=c-s)return!1;if(t){let p=n.tr.step(h);p.setSelection(pe.create(p.doc,s)),t(p.scrollIntoView())}return!0}function Ai(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 L0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=pf(r)}let a=s&&s.nodeBefore;return!a||!Q.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function pf(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 P0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const D0=(n,e,t)=>{let r=P0(n,t);if(!r)return!1;let i=mf(r);if(!i)return!1;let s=i.nodeAfter;if(H0(n,i,e,1))return!0;if(r.parent.content.size==0&&(Ai(s,"start")||Q.isSelectable(s))){let a=xa(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(Ai(s,"start")?ye.findFrom(u.doc.resolve(u.mapping.map(i.pos)),1):Q.create(u.doc,u.mapping.map(i.pos))),e(u.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},F0=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=mf(r)}let a=s&&s.nodeAfter;return!a||!Q.isSelectable(a)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,s.pos)).scrollIntoView()),!0)};function mf(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 hT=(n,e)=>{let t=n.selection,r=t instanceof Q,i;if(r){if(t.node.isTextblock||!hr(n.doc,t.from))return!1;i=t.from}else if(i=Sa(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(Q.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},dT=(n,e)=>{let t=n.selection,r;if(t instanceof Q){if(t.node.isTextblock||!hr(n.doc,t.to))return!1;r=t.to}else if(r=Sa(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},pT=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&Si(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},B0=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
38
+ `).scrollIntoView()),!0)};function gf(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 mT=(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),s=t.indexAfter(-1),a=gf(i.contentMatchAt(s));if(!a||!i.canReplaceWith(s,s,a))return!1;if(e){let u=t.after(),c=n.tr.replaceWith(u,u,a.createAndFill());c.setSelection(ye.near(c.doc.resolve(u),1)),e(c.scrollIntoView())}return!0},z0=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Lt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=gf(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,u=n.tr.insert(a,s.createAndFill());u.setSelection(pe.create(u.doc,a+1)),e(u.scrollIntoView())}return!0},$0=(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 s=t.before();if(zn(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Si(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function gT(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!r.parentOffset||!zn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,u,c=!1,h=!1;for(let _=r.depth;;_--)if(r.node(_).isBlock){c=r.end(_)==r.pos+(r.depth-_),h=r.start(_)==r.pos-(r.depth-_),u=gf(r.node(_-1).contentMatchAt(r.indexAfter(_-1))),s.unshift(c&&u?{type:u}:null),a=_;break}else{if(_==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof pe||e.selection instanceof Lt)&&p.deleteSelection();let m=p.mapping.map(r.pos),y=zn(p.doc,m,s.length,s);if(y||(s[0]=u?{type:u}:null,y=zn(p.doc,m,s.length,s)),p.split(m,s.length,s),!c&&h&&r.node(a).type!=u){let _=p.mapping.map(r.before(a)),S=p.doc.resolve(_);u&&r.node(a-1).canReplaceWith(S.index(),S.index()+1,u)&&p.setNodeMarkup(p.mapping.map(r.before(a)),u)}return t&&t(p.scrollIntoView()),!0}}const yT=gT(),bT=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(Q.create(n.doc,i))),!0)};function _T(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||hr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function H0(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,a,u,c=i.type.spec.isolating||s.type.spec.isolating;if(!c&&_T(n,e,t))return!0;let h=!c&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(a=(u=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&u.matchType(a[0]||s.type).validEnd){if(t){let _=e.pos+s.nodeSize,S=z.empty;for(let g=a.length-1;g>=0;g--)S=z.from(a[g].create(null,S));S=z.from(i.copy(S));let E=n.tr.step(new Je(e.pos-1,_,e.pos,_,new K(S,1,0),a.length,!0)),N=E.doc.resolve(_+2*a.length);N.nodeAfter&&N.nodeAfter.type==i.type&&hr(E.doc,N.pos)&&E.join(N.pos),t(E.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&c?null:ye.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),y=m&&Si(m);if(y!=null&&y>=e.depth)return t&&t(n.tr.lift(m,y).scrollIntoView()),!0;if(h&&Ai(s,"start",!0)&&Ai(i,"end")){let _=i,S=[];for(;S.push(_),!_.isTextblock;)_=_.lastChild;let E=s,N=1;for(;!E.isTextblock;E=E.firstChild)N++;if(_.canReplace(_.childCount,_.childCount,E.content)){if(t){let g=z.empty;for(let k=S.length-1;k>=0;k--)g=z.from(S[k].copy(g));let v=n.tr.step(new Je(e.pos-S.length,e.pos+s.nodeSize,e.pos+N,e.pos+s.nodeSize-N,new K(g,S.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function W0(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(pe.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const wT=W0(-1),vT=W0(1);function ST(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,a=i.blockRange(s),u=a&&Vc(a,n,e);return u?(r&&r(t.tr.wrap(a,u).scrollIntoView()),!0):!1}}function V0(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:a},$to:{pos:u}}=t.selection.ranges[s];t.doc.nodesBetween(a,u,(c,h)=>{if(i)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)i=!0;else{let p=t.doc.resolve(h),m=p.index();i=p.parent.canReplaceWith(m,m+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:u},$to:{pos:c}}=t.selection.ranges[a];s.setBlockType(u,c,n,e)}r(s.scrollIntoView())}return!0}}function yf(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}yf(df,N0,L0),yf(df,D0,F0),yf(B0,z0,$0,yT),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function xT(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,a=i.blockRange(s);if(!a)return!1;let u=r?t.tr:null;return CT(u,a,n,e)?(r&&r(u.scrollIntoView()),!0):!1}}function CT(n,e,t,r=null){let i=!1,s=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=a.resolve(e.start-2);s=new ya(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new ya(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let u=Vc(s,t,r,e);return u?(n&&ET(n,e,u,i,t),!0):!1}function ET(n,e,t,r,i){let s=z.empty;for(let p=t.length-1;p>=0;p--)s=z.from(t[p].type.create(t[p].attrs,s));n.step(new Je(e.start-(r?2:0),e.end,e.start,e.end,new K(s,0,0),t.length,!0));let a=0;for(let p=0;p<t.length;p++)t[p].type==i&&(a=p+1);let u=t.length-a,c=e.start+t.length-(r?2:0),h=e.parent;for(let p=e.startIndex,m=e.endIndex,y=!0;p<m;p++,y=!1)!y&&zn(n.doc,c,u)&&(n.split(c,u),c+=2*u),c+=h.child(p).nodeSize;return n}function kT(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,a=>a.childCount>0&&a.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?TT(e,t,n,s):AT(e,t,s):!0:!1}}function TT(n,e,t,r){let i=n.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(i.step(new Je(s-1,a,s,a,new K(z.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new ya(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));const u=Si(r);if(u==null)return!1;i.lift(r,u);let c=i.mapping.map(s,-1)-1;return hr(i.doc,c)&&i.join(c),e(i.scrollIntoView()),!0}function AT(n,e,t){let r=n.tr,i=t.parent;for(let _=t.end,S=t.endIndex-1,E=t.startIndex;S>E;S--)_-=i.child(S).nodeSize,r.delete(_-1,_+1);let s=r.doc.resolve(t.start),a=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let u=t.startIndex==0,c=t.endIndex==i.childCount,h=s.node(-1),p=s.index(-1);if(!h.canReplace(p+(u?0:1),p+1,a.content.append(c?z.empty:z.from(i))))return!1;let m=s.pos,y=m+a.nodeSize;return r.step(new Je(m-(u?1:0),y+(c?1:0),m+1,y-1,new K((u?z.empty:z.from(i.copy(z.empty))).append(c?z.empty:z.from(i.copy(z.empty))),u?0:1,c?0:1),u?0:1)),e(r.scrollIntoView()),!0}function MT(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,h=>h.childCount>0&&h.firstChild.type==n);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let u=s.parent,c=u.child(a-1);if(c.type!=n)return!1;if(t){let h=c.lastChild&&c.lastChild.type==u.type,p=z.from(h?n.create():null),m=new K(z.from(n.create(null,z.from(u.type.create(null,p)))),h?3:1,0),y=s.start,_=s.end;t(e.tr.step(new Je(y-(h?3:1),_,y,_,m,1,!0)).scrollIntoView())}return!0}}function Na(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}}}class bf{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:s}=r,a=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([u,c])=>[u,(...p)=>{const m=c(...p)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:a}=i,u=[],c=!!e,h=e||s.tr,p=()=>(!c&&t&&!h.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(h),u.every(y=>y===!0)),m={...Object.fromEntries(Object.entries(r).map(([y,_])=>[y,(...E)=>{const N=this.buildProps(h,t),g=_(...E)(N);return u.push(g),m}])),run:p};return m}createCan(e){const{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,a=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([c,h])=>[c,(...p)=>h(...p)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:r,editor:i,state:s}=this,{view:a}=i,u={tr:e,editor:i,view:a,state:Na({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([c,h])=>[c,(...p)=>h(...p)(u)]))}};return u}}function J(n,e,t){return n.config[e]===void 0&&n.parent?J(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?J(n.parent,e,t):null}):n.config[e]}function Ra(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 U0(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ra(n),i=[...t,...r],s={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,extensions:i},c=J(a,"addGlobalAttributes",u);if(!c)return;c().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([y,_])=>{e.push({type:m,name:y,attribute:{...s,..._}})})})})}),i.forEach(a=>{const u={name:a.name,options:a.options,storage:a.storage},c=J(a,"addAttributes",u);if(!c)return;const h=c();Object.entries(h).forEach(([p,m])=>{const y={...s,...m};typeof y?.default=="function"&&(y.default=y.default()),y?.isRequired&&y?.default===void 0&&delete y.default,e.push({type:a.name,name:p,attribute:y})})}),e}function qe(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 Mi(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const u=s?String(s).split(" "):[],c=r[i]?r[i].split(" "):[],h=u.filter(p=>!c.includes(p));r[i]=[...c,...h].join(" ")}else if(i==="style"){const u=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],c=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],h=new Map;c.forEach(p=>{const[m,y]=p.split(":").map(_=>_.trim());h.set(m,y)}),u.forEach(p=>{const[m,y]=p.split(":").map(_=>_.trim());h.set(m,y)}),r[i]=Array.from(h.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function _f(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Mi(t,r),{})}function OT(n){return typeof n=="function"}function de(n,e=void 0,...t){return OT(n)?e?n.bind(e)(...t):n(...t):n}function IT(n={}){return Object.keys(n).length===0&&n.constructor===Object}function NT(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function q0(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const i=e.reduce((s,a)=>{const u=a.attribute.parseHTML?a.attribute.parseHTML(t):NT(t.getAttribute(a.name));return u==null?s:{...s,[a.name]:u}},{});return{...r,...i}}}}function K0(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&IT(t)?!1:t!=null))}function G0(n,e){var t;const r=U0(n),{nodeExtensions:i,markExtensions:s}=Ra(n),a=(t=i.find(h=>J(h,"topNode")))===null||t===void 0?void 0:t.name,u=Object.fromEntries(i.map(h=>{const p=r.filter(g=>g.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=n.reduce((g,v)=>{const k=J(v,"extendNodeSchema",m);return{...g,...k?k(h):{}}},{}),_=K0({...y,content:de(J(h,"content",m)),marks:de(J(h,"marks",m)),group:de(J(h,"group",m)),inline:de(J(h,"inline",m)),atom:de(J(h,"atom",m)),selectable:de(J(h,"selectable",m)),draggable:de(J(h,"draggable",m)),code:de(J(h,"code",m)),whitespace:de(J(h,"whitespace",m)),linebreakReplacement:de(J(h,"linebreakReplacement",m)),defining:de(J(h,"defining",m)),isolating:de(J(h,"isolating",m)),attrs:Object.fromEntries(p.map(g=>{var v;return[g.name,{default:(v=g?.attribute)===null||v===void 0?void 0:v.default}]}))}),S=de(J(h,"parseHTML",m));S&&(_.parseDOM=S.map(g=>q0(g,p)));const E=J(h,"renderHTML",m);E&&(_.toDOM=g=>E({node:g,HTMLAttributes:_f(g,p)}));const N=J(h,"renderText",m);return N&&(_.toText=N),[h.name,_]})),c=Object.fromEntries(s.map(h=>{const p=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},y=n.reduce((N,g)=>{const v=J(g,"extendMarkSchema",m);return{...N,...v?v(h):{}}},{}),_=K0({...y,inclusive:de(J(h,"inclusive",m)),excludes:de(J(h,"excludes",m)),group:de(J(h,"group",m)),spanning:de(J(h,"spanning",m)),code:de(J(h,"code",m)),attrs:Object.fromEntries(p.map(N=>{var g;return[N.name,{default:(g=N?.attribute)===null||g===void 0?void 0:g.default}]}))}),S=de(J(h,"parseHTML",m));S&&(_.parseDOM=S.map(N=>q0(N,p)));const E=J(h,"renderHTML",m);return E&&(_.toDOM=N=>E({mark:N,HTMLAttributes:_f(N,p)})),[h.name,_]}));return new yg({topNode:a,nodes:u,marks:c})}function wf(n,e){return e.nodes[n]||e.marks[n]||null}function J0(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function j0(n,e){const t=Vs.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}const RT=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,a,u)=>{var c,h;const p=((h=(c=i.type.spec).toText)===null||h===void 0?void 0:h.call(c,{node:i,pos:s,parent:a,index:u}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),t};function vf(n){return Object.prototype.toString.call(n)==="[object RegExp]"}class Y0{constructor(e){this.find=e.find,this.handler=e.handler}}const LT=(n,e)=>{if(vf(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 La(n){var e;const{editor:t,from:r,to:i,text:s,rules:a,plugin:u}=n,{view:c}=t;if(c.composing)return!1;const h=c.state.doc.resolve(r);if(h.parent.type.spec.code||!((e=h.nodeBefore||h.nodeAfter)===null||e===void 0)&&e.marks.find(y=>y.type.spec.code))return!1;let p=!1;const m=RT(h)+s;return a.forEach(y=>{if(p)return;const _=LT(m,y.find);if(!_)return;const S=c.state.tr,E=Na({state:c.state,transaction:S}),N={from:r-(_[0].length-s.length),to:i},{commands:g,chain:v,can:k}=new bf({editor:t,state:E});y.handler({state:E,range:N,match:_,commands:g,chain:v,can:k})===null||!S.steps.length||(S.setMeta(u,{transform:S,from:r,to:i,text:s}),c.dispatch(S),p=!0)}),p}function PT(n){const{editor:e,rules:t}=n,r=new ct({state:{init(){return null},apply(i,s,a){const u=i.getMeta(r);if(u)return u;const c=i.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:p}=c;typeof p=="string"?p=p:p=j0(z.from(p),a.schema);const{from:m}=c,y=m+p.length;La({editor:e,from:m,to:y,text:p,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,a,u){return La({editor:e,from:s,to:a,text:u,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&La({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:a}=i.state.selection;return a?La({editor:e,from:a.pos,to:a.pos,text:`
39
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function DT(n){return Object.prototype.toString.call(n).slice(8,-1)}function Pa(n){return DT(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function Da(n,e){const t={...n};return Pa(n)&&Pa(e)&&Object.keys(e).forEach(r=>{Pa(e[r])&&Pa(n[r])?t[r]=Da(n[r],e[r]):t[r]=e[r]}),t}class wt{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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new wt(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new wt(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(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 c=a.find(h=>h?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function FT(n){return typeof n=="number"}class BT{constructor(e){this.find=e.find,this.handler=e.handler}}const zT=(n,e,t)=>{if(vf(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function $T(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:a,dropEvent:u}=n,{commands:c,chain:h,can:p}=new bf({editor:e,state:t}),m=[];return t.doc.nodesBetween(r,i,(_,S)=>{if(!_.isTextblock||_.type.spec.code)return;const E=Math.max(r,S),N=Math.min(i,S+_.content.size),g=_.textBetween(E-S,N-S,void 0,"\uFFFC");zT(g,s.find,a).forEach(k=>{if(k.index===void 0)return;const T=E+k.index+1,A=T+k[0].length,F={from:t.tr.mapping.map(T),to:t.tr.mapping.map(A)},U=s.handler({state:t,range:F,match:k,commands:c,chain:h,can:p,pasteEvent:a,dropEvent:u});m.push(U)})}),m.every(_=>_!==null)}let Fa=null;const HT=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function WT(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,u;try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}const c=({state:p,from:m,to:y,rule:_,pasteEvt:S})=>{const E=p.tr,N=Na({state:p,transaction:E});if(!(!$T({editor:e,state:N,from:Math.max(m-1,0),to:y.b-1,rule:_,pasteEvent:S,dropEvent:u})||!E.steps.length)){try{u=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{u=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,E}};return t.map(p=>new ct({view(m){const y=S=>{var E;r=!((E=m.dom.parentElement)===null||E===void 0)&&E.contains(S.target)?m.dom.parentElement:null,r&&(Fa=e)},_=()=>{Fa&&(Fa=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",_),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",_)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(s=r===m.dom.parentElement,u=y,!s){const _=Fa;_&&setTimeout(()=>{const S=_.state.selection;S&&_.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,y)=>{var _;const S=(_=y.clipboardData)===null||_===void 0?void 0:_.getData("text/html");return a=y,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,y,_)=>{const S=m[0],E=S.getMeta("uiEvent")==="paste"&&!i,N=S.getMeta("uiEvent")==="drop"&&!s,g=S.getMeta("applyPasteRules"),v=!!g;if(!E&&!N&&!v)return;if(v){let{text:A}=g;typeof A=="string"?A=A:A=j0(z.from(A),_.schema);const{from:F}=g,U=F+A.length,V=HT(A);return c({rule:p,state:_,from:F,to:{b:U},pasteEvt:V})}const k=y.doc.content.findDiffStart(_.doc.content),T=y.doc.content.findDiffEnd(_.doc.content);if(!(!FT(k)||!T||k===T.b))return c({rule:p,state:_,from:k,to:T,pasteEvt:a})}}))}function VT(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}class Di{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=Di.resolve(e),this.schema=G0(this.extensions,t),this.setupExtensions()}static resolve(e){const t=Di.sort(Di.flatten(e)),r=VT(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=J(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=J(r,"priority")||100,a=J(i,"priority")||100;return s>a?-1:s<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:wf(t.name,this.schema)},i=J(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=Di.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(a=>{const u={name:a.name,options:a.options,storage:a.storage,editor:e,type:wf(a.name,this.schema)},c=[],h=J(a,"addKeyboardShortcuts",u);let p={};if(a.type==="mark"&&J(a,"exitable",u)&&(p.ArrowRight=()=>wt.handleExit({editor:e,mark:a})),h){const E=Object.fromEntries(Object.entries(h()).map(([N,g])=>[N,()=>g({editor:e})]));p={...p,...E}}const m=lT(p);c.push(m);const y=J(a,"addInputRules",u);J0(a,e.options.enableInputRules)&&y&&r.push(...y());const _=J(a,"addPasteRules",u);J0(a,e.options.enablePasteRules)&&_&&i.push(..._());const S=J(a,"addProseMirrorPlugins",u);if(S){const E=S();c.push(...E)}return c}).flat();return[PT({editor:e,rules:r}),...WT({editor:e,rules:i}),...s]}get attributes(){return U0(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ra(this.extensions);return Object.fromEntries(t.filter(r=>!!J(r,"addNodeView")).map(r=>{const i=this.attributes.filter(c=>c.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:qe(r.name,this.schema)},a=J(r,"addNodeView",s);if(!a)return[];const u=(c,h,p,m,y)=>{const _=_f(c,i);return a()({node:c,view:h,getPos:p,decorations:m,innerDecorations:y,editor:e,extension:r,HTMLAttributes:_})};return[r.name,u]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:wf(e.name,this.schema)};e.type==="mark"&&(!((t=de(J(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=J(e,"onBeforeCreate",r),s=J(e,"onCreate",r),a=J(e,"onUpdate",r),u=J(e,"onSelectionUpdate",r),c=J(e,"onTransaction",r),h=J(e,"onFocus",r),p=J(e,"onBlur",r),m=J(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),a&&this.editor.on("update",a),u&&this.editor.on("selectionUpdate",u),c&&this.editor.on("transaction",c),h&&this.editor.on("focus",h),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Re(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Re({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(t,"addStorage",{name:t.name,options:t.options})),t}}function UT(n,e,t){const{from:r,to:i}=e,{blockSeparator:s=`
40
40
 
41
- `,textSerializers:a={}}=t||{};let u="";return n.nodesBetween(r,i,(c,h,p,m)=>{var y;c.isBlock&&h>r&&(u+=s);const _=a?.[c.type.name];if(_)return p&&(u+=_({node:c,pos:h,parent:p,index:m,range:e})),!1;c.isText&&(u+=(y=c?.text)===null||y===void 0?void 0:y.slice(Math.max(r,h)-h,i-h))}),u}function UA(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Re.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ct({key:new Mt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,a=Math.min(...s.map(p=>p.$from.pos)),u=Math.max(...s.map(p=>p.$to.pos)),c=UA(t);return VA(r,{from:a,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}});const qA=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),KA=(n=!1)=>({commands:e})=>e.setContent("",n),GA=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:a})=>{n.doc.nodesBetween(s.pos,a.pos,(u,c)=>{if(u.type.isText)return;const{doc:h,mapping:p}=e,m=h.resolve(p.map(c)),y=h.resolve(p.map(c+u.nodeSize)),_=m.blockRange(y);if(!_)return;const S=Si(_);if(u.type.isTextblock){const{defaultType:E}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(_.start,E)}(S||S===0)&&e.lift(_,S)})}),!0},JA=n=>e=>n(e),jA=()=>({state:n,dispatch:e})=>z0(n,e),YA=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new pe(r.doc.resolve(a-1))),!0},XA=()=>({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 s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const u=i.before(s),c=i.after(s);n.delete(u,c).scrollIntoView()}return!0}return!1},ZA=n=>({tr:e,state:t,dispatch:r})=>{const i=qe(n,t.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===i){if(r){const c=s.before(a),h=s.after(a);e.delete(c,h).scrollIntoView()}return!0}return!1},QA=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},eT=()=>({state:n,dispatch:e})=>df(n,e),tT=()=>({commands:n})=>n.keyboardShortcut("Enter"),nT=()=>({state:n,dispatch:e})=>pA(n,e);function Ba(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:vf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function X0(n,e,t={}){return n.find(r=>r.type===e&&Ba(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Z0(n,e,t={}){return!!X0(n,e,t)}function Sf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!X0([...i.node.marks],e,t)))return;let a=i.index,u=n.start()+i.offset,c=a+1,h=u+i.node.nodeSize;for(;a>0&&Z0([...n.parent.child(a-1).marks],e,t);)a-=1,u-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&Z0([...n.parent.child(c).marks],e,t);)h+=n.parent.child(c).nodeSize,c+=1;return{from:u,to:h}}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 rT=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=mn(n,r.schema),{doc:a,selection:u}=t,{$from:c,from:h,to:p}=u;if(i){const m=Sf(c,s,e);if(m&&m.from<=h&&m.to>=p){const y=pe.create(a,m.from,m.to);t.setSelection(y)}}return!0},iT=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 Q0(n){return n instanceof pe}function qr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function sT(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,s=r.to;return e==="all"?pe.create(n,qr(0,i,s),qr(n.content.size,i,s)):pe.create(n,qr(e,i,s),qr(e,i,s))}function oT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function xf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const aT=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(xf()||oT())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Q0(t.state.selection))return a(),!0;const u=sT(i.doc,n)||t.state.selection,c=t.state.selection.eq(u);return s&&(c||i.setSelection(u),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},lT=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),uT=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),e1=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&e1(r)}return n};function za(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return e1(t)}function $a(n,e,t){if(n instanceof fr||n instanceof z)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return z.fromArray(n.map(u=>e.nodeFromJSON(u)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),$a("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,u="";const c=new yg({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(a=!0,u=typeof h=="string"?h:h.outerHTML,null)}]}})});if(t.slice?_s.fromSchema(c).parseSlice(za(n),t.parseOptions):_s.fromSchema(c).parse(za(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const s=_s.fromSchema(e);return t.slice?s.parseSlice(za(n),t.parseOptions).content:s.parse(za(n),t.parseOptions)}return $a("",e,t)}function cT(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof je||i instanceof Je))return;const s=n.mapping.maps[r];let a=0;s.forEach((u,c,h,p)=>{a===0&&(a=p)}),n.setSelection(ye.near(n.doc.resolve(a),t))}const fT=n=>!("type"in n),hT=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var a;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let u;try{u=$a(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:s.options.enableContentCheck})}catch(S){return s.emit("contentError",{editor:s,error:S,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,m=!0;if((fT(u)?u:[u]).forEach(S=>{S.check(),p=p?S.isText&&S.marks.length===0:!1,m=m?S.isBlock:!1}),c===h&&m){const{parent:S}=r.doc.resolve(c);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(c-=1,h+=1)}let _;if(p){if(Array.isArray(e))_=e.map(S=>S.text||"").join("");else if(e instanceof z){let S="";e.forEach(E=>{E.text&&(S+=E.text)}),_=S}else typeof e=="object"&&e&&e.text?_=e.text:_=e;r.insertText(_,c,h)}else _=u,r.replaceWith(c,h,_);t.updateSelection&&cT(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:_}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:_})}return!0},dT=()=>({state:n,dispatch:e})=>fA(n,e),pT=()=>({state:n,dispatch:e})=>hA(n,e),mT=()=>({state:n,dispatch:e})=>N0(n,e),gT=()=>({state:n,dispatch:e})=>D0(n,e),yT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Sa(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},bT=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Sa(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},_T=()=>({state:n,dispatch:e})=>uA(n,e),wT=()=>({state:n,dispatch:e})=>cA(n,e);function t1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vT(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,a;for(let u=0;u<e.length-1;u+=1){const c=e[u];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))xf()||t1()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}const ST=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=vT(n).split(/-(?!$)/),a=s.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,u))});return c?.steps.forEach(h=>{const p=h.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Cf(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,a=e?qe(e,n.schema):null,u=[];n.doc.nodesBetween(r,i,(m,y)=>{if(m.isText)return;const _=Math.max(r,y),S=Math.min(i,y+m.nodeSize);u.push({node:m,from:_,to:S})});const c=i-r,h=u.filter(m=>a?a.name===m.node.type.name:!0).filter(m=>Ba(m.node.attrs,t,{strict:!1}));return s?!!h.length:h.reduce((m,y)=>m+y.to-y.from,0)>=c}const xT=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return Cf(t,i,e)?dA(t,r):!1},CT=()=>({state:n,dispatch:e})=>$0(n,e),ET=n=>({state:e,dispatch:t})=>{const r=qe(n,e.schema);return EA(r)(e,t)},kT=()=>({state:n,dispatch:e})=>B0(n,e);function Ef(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function n1(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 AT=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,a=null;const u=Ef(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(s=qe(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(h,p)=>{s&&s===h.type&&t.setNodeMarkup(p,void 0,n1(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(m=>{a===m.type&&t.addMark(p,p+h.nodeSize,a.create(n1(m.attrs,e)))})})}),!0):!1},TT=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),OT=()=>({tr:n,dispatch:e})=>{if(e){const t=new Rt(n.doc);n.setSelection(t)}return!0},MT=()=>({state:n,dispatch:e})=>L0(n,e),IT=()=>({state:n,dispatch:e})=>F0(n,e),NT=()=>({state:n,dispatch:e})=>yA(n,e),RT=()=>({state:n,dispatch:e})=>wA(n,e),LT=()=>({state:n,dispatch:e})=>_A(n,e);function PT(n,e,t={},r={}){return $a(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const DT=(n,e=!1,t={},r={})=>({editor:i,tr:s,dispatch:a,commands:u})=>{var c,h;const{doc:p}=s;if(t.preserveWhitespace!=="full"){const m=PT(n,i.schema,t,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck});return a&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return a&&s.setMeta("preventUpdate",!e),u.insertContentAt({from:0,to:p.content.size},n,{parseOptions:t,errorOnInvalidContent:(h=r.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck})};function r1(n,e){const t=mn(e,n.schema),{from:r,to:i,empty:s}=n.selection,a=[];s?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,c=>{a.push(...c.marks)});const u=a.find(c=>c.type.name===t.name);return u?{...u.attrs}:{}}function FT(n,e){const t=new hk(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function BT(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 zT(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function $T(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 kf(n){return e=>$T(e.$from,n)}function HT(n,e){const t=Di.resolve(n);return G0(t,e)}function WT(n,e){const t=qe(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,u=>{s.push(u)});const a=s.reverse().find(u=>u.type.name===t.name);return a?{...a.attrs}:{}}function VT(n,e){const t=Ef(typeof e=="string"?e:e.name,n.schema);return t==="node"?WT(n,e):t==="mark"?r1(n,e):{}}function UT(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 qT(n){const e=UT(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,a)=>a!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function KT(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const a=[];if(i.ranges.length)i.forEach((u,c)=>{a.push({from:u,to:c})});else{const{from:u,to:c}=t[s];if(u===void 0||c===void 0)return;a.push({from:u,to:c})}a.forEach(({from:u,to:c})=>{const h=e.slice(s).map(u,-1),p=e.slice(s).map(c),m=e.invert().map(h,-1),y=e.invert().map(p);r.push({oldRange:{from:m,to:y},newRange:{from:h,to:p}})})}),qT(r)}function i1(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),a=Sf(s,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:s,to:s+i.nodeSize,mark:a})))}),r}function Ha(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function GT(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?mn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Ba(m.attrs,t,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:m,$to:y})=>{const _=m.pos,S=y.pos;n.doc.nodesBetween(_,S,(E,N)=>{if(!E.isText&&!E.marks.length)return;const g=Math.max(_,N),v=Math.min(S,N+E.nodeSize),k=v-g;a+=k,u.push(...E.marks.map(A=>({mark:A,from:g,to:v})))})}),a===0)return!1;const c=u.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Ba(m.mark.attrs,t,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),h=u.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,y)=>m+y.to-y.from,0);return(c>0?c+h:c)>=a}function s1(n,e){const{nodeExtensions:t}=Ra(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=de(J(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function o1(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(o1(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function JT(n,e,t){var r;const{selection:i}=e;let s=null;if(Q0(i)&&(s=i.$cursor),s){const u=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(u)||!u.some(c=>c.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:u,$to:c})=>{let h=u.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(u.pos,c.pos,(p,m,y)=>{if(h)return!1;if(p.isInline){const _=!y||y.type.allowsMarkType(t),S=!!t.isInSet(p.marks)||!p.marks.some(E=>E.type.excludes(t));h=_&&S}return!h}),h})}const jT=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:a,ranges:u}=s,c=mn(n,r.schema);if(i)if(a){const h=r1(r,c);t.addStoredMark(c.create({...h,...e}))}else u.forEach(h=>{const p=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(p,m,(y,_)=>{const S=Math.max(_,p),E=Math.min(_+y.nodeSize,m);y.marks.find(g=>g.type===c)?y.marks.forEach(g=>{c===g.type&&t.addMark(S,E,c.create({...g.attrs,...e}))}):t.addMark(S,E,c.create(e))})});return JT(r,t,c)},YT=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),XT=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=qe(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:u})=>V0(s,{...a,...e})(t)?!0:u.clearNodes()).command(({state:u})=>V0(s,{...a,...e})(u,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ZT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=qr(n,0,r.content.size),s=Q.create(r,i);e.setSelection(s)}return!0},QT=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,a=pe.atStart(r).from,u=pe.atEnd(r).to,c=qr(i,a,u),h=qr(s,a,u),p=pe.create(r,c,h);e.setSelection(p)}return!0},eO=n=>({state:e,dispatch:t})=>{const r=qe(n,e.schema);return TA(r)(e,t)};function a1(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 tO=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:u,$to:c}=s,h=i.extensionManager.attributes,p=Ha(h,u.node().type.name,u.node().attrs);if(s instanceof Q&&s.node.isBlock)return!u.parentOffset||!zn(a,u.pos)?!1:(r&&(n&&a1(t,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const m=c.parentOffset===c.parent.content.size,y=u.depth===0?void 0:BT(u.node(-1).contentMatchAt(u.indexAfter(-1)));let _=m&&y?[{type:y,attrs:p}]:void 0,S=zn(e.doc,e.mapping.map(u.pos),1,_);if(!_&&!S&&zn(e.doc,e.mapping.map(u.pos),1,y?[{type:y}]:void 0)&&(S=!0,_=y?[{type:y,attrs:p}]:void 0),r){if(S&&(s instanceof pe&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,_),y&&!m&&!u.parentOffset&&u.parent.type!==y)){const E=e.mapping.map(u.before()),N=e.doc.resolve(E);u.node(-1).canReplaceWith(N.index(),N.index()+1,y)&&e.setNodeMarkup(e.mapping.map(u.before()),y)}n&&a1(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},nO=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var a;const u=qe(n,r.schema),{$from:c,$to:h}=r.selection,p=r.selection.node;if(p&&p.isBlock||c.depth<2||!c.sameParent(h))return!1;const m=c.node(-1);if(m.type!==u)return!1;const y=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==u||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let g=z.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let H=c.depth-v;H>=c.depth-3;H-=1)g=z.from(c.node(H).copy(g));const k=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,A={...Ha(y,c.node().type.name,c.node().attrs),...e},T=((a=u.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(A))||void 0;g=g.append(z.from(u.createAndFill(null,T)||void 0));const F=c.before(c.depth-(v-1));t.replace(F,c.after(-k),new K(g,4-v,0));let U=-1;t.doc.nodesBetween(F,t.doc.content.size,(H,ee)=>{if(U>-1)return!1;H.isTextblock&&H.content.size===0&&(U=ee+1)}),U>-1&&t.setSelection(pe.near(t.doc.resolve(U))),t.scrollIntoView()}return!0}const _=h.pos===c.end()?m.contentMatchAt(0).defaultType:null,S={...Ha(y,m.type.name,m.attrs),...e},E={...Ha(y,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,h.pos);const N=_?[{type:u,attrs:S},{type:_,attrs:E}]:[{type:u,attrs:S}];if(!zn(t.doc,c.pos,2))return!1;if(i){const{selection:g,storedMarks:v}=r,{splittableMarks:k}=s.extensionManager,A=v||g.$to.parentOffset&&g.$from.marks();if(t.split(c.pos,2,N).scrollIntoView(),!A||!i)return!0;const T=A.filter(F=>k.includes(F.type.name));t.ensureMarks(T)}return!0},Af=(n,e)=>{const t=kf(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},Tf=(n,e)=>{const t=kf(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},rO=(n,e,t,r={})=>({editor:i,tr:s,state:a,dispatch:u,chain:c,commands:h,can:p})=>{const{extensions:m,splittableMarks:y}=i.extensionManager,_=qe(n,a.schema),S=qe(e,a.schema),{selection:E,storedMarks:N}=a,{$from:g,$to:v}=E,k=g.blockRange(v),A=N||E.$to.parentOffset&&E.$from.marks();if(!k)return!1;const T=kf(F=>s1(F.type.name,m))(E);if(k.depth>=1&&T&&k.depth-T.depth<=1){if(T.node.type===_)return h.liftListItem(S);if(s1(T.node.type.name,m)&&_.validContent(T.node.content)&&u)return c().command(()=>(s.setNodeMarkup(T.pos,_),!0)).command(()=>Af(s,_)).command(()=>Tf(s,_)).run()}return!t||!A||!u?c().command(()=>p().wrapInList(_,r)?!0:h.clearNodes()).wrapInList(_,r).command(()=>Af(s,_)).command(()=>Tf(s,_)).run():c().command(()=>{const F=p().wrapInList(_,r),U=A.filter(H=>y.includes(H.type.name));return s.ensureMarks(U),F?!0:h.clearNodes()}).wrapInList(_,r).command(()=>Af(s,_)).command(()=>Tf(s,_)).run()},iO=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,a=mn(n,r.schema);return GT(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:s}):i.setMark(a,e)},sO=(n,e,t={})=>({state:r,commands:i})=>{const s=qe(n,r.schema),a=qe(e,r.schema),u=Cf(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),u?i.setNode(a,c):i.setNode(s,{...c,...t})},oO=(n,e={})=>({state:t,commands:r})=>{const i=qe(n,t.schema);return Cf(t,i,e)?r.lift(i):r.wrapIn(i,e)},aO=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const a=n.tr,u=s.transform;for(let c=u.steps.length-1;c>=0;c-=1)a.step(u.steps[c].invert(u.docs[c]));if(s.text){const c=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else a.delete(s.from,s.to)}return!0}}return!1},lO=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},uO=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=t,c=mn(n,r.schema),{$from:h,empty:p,ranges:m}=u;if(!i)return!0;if(p&&a){let{from:y,to:_}=u;const S=(s=h.marks().find(N=>N.type===c))===null||s===void 0?void 0:s.attrs,E=Sf(h,c,S);E&&(y=E.from,_=E.to),t.removeMark(y,_,c)}else m.forEach(y=>{t.removeMark(y.$from.pos,y.$to.pos,c)});return t.removeStoredMark(c),!0},cO=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,a=null;const u=Ef(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(s=qe(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(c=>{const h=c.$from.pos,p=c.$to.pos;let m,y,_,S;t.selection.empty?r.doc.nodesBetween(h,p,(E,N)=>{s&&s===E.type&&(_=Math.max(N,h),S=Math.min(N+E.nodeSize,p),m=N,y=E)}):r.doc.nodesBetween(h,p,(E,N)=>{N<h&&s&&s===E.type&&(_=Math.max(N,h),S=Math.min(N+E.nodeSize,p),m=N,y=E),N>=h&&N<=p&&(s&&s===E.type&&t.setNodeMarkup(N,void 0,{...E.attrs,...e}),a&&E.marks.length&&E.marks.forEach(g=>{if(a===g.type){const v=Math.max(N,h),k=Math.min(N+E.nodeSize,p);t.addMark(v,k,a.create({...g.attrs,...e}))}}))}),y&&(m!==void 0&&t.setNodeMarkup(m,void 0,{...y.attrs,...e}),a&&y.marks.length&&y.marks.forEach(E=>{a===E.type&&t.addMark(_,S,a.create({...E.attrs,...e}))}))}),!0):!1},fO=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return vA(i,e)(t,r)},hO=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return SA(i,e)(t,r)};var dO=Object.freeze({__proto__:null,blur:qA,clearContent:KA,clearNodes:GA,command:JA,createParagraphNear:jA,cut:YA,deleteCurrentNode:XA,deleteNode:ZA,deleteRange:QA,deleteSelection:eT,enter:tT,exitCode:nT,extendMarkRange:rT,first:iT,focus:aT,forEach:lT,insertContent:uT,insertContentAt:hT,joinBackward:mT,joinDown:pT,joinForward:gT,joinItemBackward:yT,joinItemForward:bT,joinTextblockBackward:_T,joinTextblockForward:wT,joinUp:dT,keyboardShortcut:ST,lift:xT,liftEmptyBlock:CT,liftListItem:ET,newlineInCode:kT,resetAttributes:AT,scrollIntoView:TT,selectAll:OT,selectNodeBackward:MT,selectNodeForward:IT,selectParentNode:NT,selectTextblockEnd:RT,selectTextblockStart:LT,setContent:DT,setMark:jT,setMeta:YT,setNode:XT,setNodeSelection:ZT,setTextSelection:QT,sinkListItem:eO,splitBlock:tO,splitListItem:nO,toggleList:rO,toggleMark:iO,toggleNode:sO,toggleWrap:oO,undoInputRule:aO,unsetAllMarks:lO,unsetMark:uO,updateAttributes:cO,wrapIn:fO,wrapInList:hO});Re.create({name:"commands",addCommands(){return{...dO}}}),Re.create({name:"drop",addProseMirrorPlugins(){return[new ct({key:new Mt("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Re.create({name:"editable",addProseMirrorPlugins(){return[new ct({key:new Mt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Re.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ct({key:new Mt("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:c,doc:h}=u,{empty:p,$anchor:m}=c,{pos:y,parent:_}=m,S=m.parent.isTextblock&&y>0?u.doc.resolve(y-1):m,E=S.parent.type.spec.isolating,N=m.pos-m.parentOffset,g=E&&S.parent.childCount===1?N===m.pos:ye.atStart(h).from===y;return!p||!_.type.isTextblock||_.textContent.length||!g||g&&m.parent.type.name==="paragraph"?!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},s={...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 xf()||t1()?s:i},addProseMirrorPlugins(){return[new ct({key:new Mt("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(E=>E.getMeta("composition")))return;const r=n.some(E=>E.docChanged)&&!e.doc.eq(t.doc),i=n.some(E=>E.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:a,to:u}=e.selection,c=ye.atStart(e.doc).from,h=ye.atEnd(e.doc).to;if(s||!(a===c&&u===h)||!o1(t.doc))return;const y=t.tr,_=Na({state:t,transaction:y}),{commands:S}=new bf({editor:this.editor,state:_});if(S.clearNodes(),!!y.steps.length)return y}})]}}),Re.create({name:"paste",addProseMirrorPlugins(){return[new ct({key:new Mt("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Re.create({name:"tabindex",addProseMirrorPlugins(){return[new ct({key:new Mt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function pO(n){return new Y0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=de(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,s)}})}function mO(n){return new Y0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=de(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),h=c&&Vc(c,n.type,s);if(!h)return null;if(a.wrap(c,h),n.keepMarks&&n.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:_}=n.editor.extensionManager,S=y||m.$to.parentOffset&&m.$from.marks();if(S){const E=S.filter(N=>_.includes(N.type.name));a.ensureMarks(E)}}if(n.keepAttributes){const m=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=a.doc.resolve(t.from-1).nodeBefore;p&&p.type===n.type&&hr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,p))&&a.join(t.from-1)}})}class jn{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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new jn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new jn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(t,"addStorage",{name:t.name,options:t.options})),t}}function gO(n){return new FA({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=de(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:a}=e,u=r[r.length-1],c=r[0];let h=t.to;if(u){const p=c.search(/\S/),m=t.from+c.indexOf(u),y=m+u.length;if(i1(t.from,t.to,e.doc).filter(S=>S.mark.type.excluded.find(N=>N===n.type&&N!==S.mark.type)).filter(S=>S.to>m).length)return null;y<t.to&&a.delete(y,t.to),m>t.from&&a.delete(t.from+p,m),h=t.from+p+u.length,a.addMark(t.from+p,h,n.type.create(s||{})),a.removeStoredMark(n.type)}}})}const yO=jn.create({name:"text",group:"inline"});var Wa=200,Ke=function(){};Ke.prototype.append=function(e){return e.length?(e=Ke.from(e),!this.length&&e||e.length<Wa&&this.leafAppend(e)||this.length<Wa&&e.leafPrepend(this)||this.appendInner(e)):this},Ke.prototype.prepend=function(e){return e.length?Ke.from(e).append(this):this},Ke.prototype.appendInner=function(e){return new bO(this,e)},Ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ke.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)},Ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,a){return i.push(e(s,a))},t,r),i},Ke.from=function(e){return e instanceof Ke?e:e&&e.length?new l1(e):Ke.empty};var l1=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,a,u){for(var c=s;c<a;c++)if(i(this.values[c],u+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,a,u){for(var c=s-1;c>=a;c--)if(i(this.values[c],u+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Wa)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Wa)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}(Ke);Ke.empty=new l1([]);var bO=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,s,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(s,u),a)===!1||s>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,s)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(s,u)-u,a+u)===!1||s<u&&this.left.forEachInvertedInner(r,Math.min(i,u),s,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Ke);const _O=500;class un{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let a=e.tr,u,c,h=[],p=[];return this.items.forEach((m,y)=>{if(!m.step){i||(i=this.remapping(r,y+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new bn(m.map));let _=m.step.map(i.slice(s)),S;_&&a.maybeStep(_).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new bn(S,void 0,void 0,h.length+p.length))),s--,S&&i.appendMap(S,s)}else a.maybeStep(m.step);if(m.selection)return u=i?m.selection.map(i.slice(s)):m.selection,c=new un(this.items.slice(0,r).append(p.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:u}}addTransform(e,t,r,i){let s=[],a=this.eventCount,u=this.items,c=!i&&u.length?u.get(u.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),y=new bn(e.mapping.maps[p],m,t),_;(_=c&&c.merge(y))&&(y=_,p?s.pop():u=u.slice(0,u.length-1)),s.push(y),t&&(a++,t=void 0),i||(c=y)}let h=a-r.depth;return h>vO&&(u=wO(u,h),a-=h),new un(u.append(s),a)}remapping(e,t){let r=new Fi;return this.items.forEach((i,s)=>{let a=i.mirrorOffset!=null&&s-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 un(this.items.append(e.map(t=>new bn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(y=>{y.selection&&u--},i);let c=t;this.items.forEach(y=>{let _=s.getMirror(--c);if(_==null)return;a=Math.min(a,_);let S=s.maps[_];if(y.step){let E=e.steps[_].invert(e.docs[_]),N=y.selection&&y.selection.map(s.slice(c+1,_));N&&u++,r.push(new bn(S,E,N))}else r.push(new bn(S))},i);let h=[];for(let y=t;y<a;y++)h.push(new bn(s.maps[y]));let p=this.items.slice(0,i).append(h).append(r),m=new un(p,u);return m.emptyItemCount()>_O&&(m=m.compress(this.items.length-r.length)),m}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=[],s=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&s++;else if(a.step){let c=a.step.map(t.slice(r)),h=c&&c.getMap();if(r--,h&&t.appendMap(h,r),c){let p=a.selection&&a.selection.map(t.slice(r));p&&s++;let m=new bn(h.invert(),c,p),y,_=i.length-1;(y=i.length&&i[_].merge(m))?i[_]=y:i.push(m)}}else a.map&&r--},this.items.length,0),new un(Ke.from(i.reverse()),s)}}un.empty=new un(Ke.empty,0);function wO(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class bn{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 bn(t.getMap().invert(),t,this.selection)}}}class br{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const vO=20;function SO(n,e,t,r){let i=t.getMeta(Kr),s;if(i)return i.historyState;t.getMeta(EO)&&(n=new br(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Kr))return a.getMeta(Kr).redo?new br(n.done.addTransform(t,void 0,r,Va(e)),n.undone,u1(t.mapping.maps),n.prevTime,n.prevComposition):new br(n.done,n.undone.addTransform(t,void 0,r,Va(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=t.getMeta("composition"),c=n.prevTime==0||!a&&n.prevComposition!=u&&(n.prevTime<(t.time||0)-r.newGroupDelay||!xO(t,n.prevRanges)),h=a?Of(n.prevRanges,t.mapping):u1(t.mapping.maps);return new br(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Va(e)),un.empty,h,t.time,u??n.prevComposition)}else return(s=t.getMeta("rebased"))?new br(n.done.rebased(t,s),n.undone.rebased(t,s),Of(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new br(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Of(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function xO(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function u1(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,a)=>e.push(s,a));return e}function Of(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function CO(n,e,t){let r=Va(e),i=Kr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),u=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),c=new br(t?u:s.remaining,t?s.remaining:u,null,0,-1);return s.transform.setSelection(a).setMeta(Kr,{redo:t,historyState:c})}let Mf=!1,c1=null;function Va(n){let e=n.plugins;if(c1!=e){Mf=!1,c1=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Mf=!0;break}}return Mf}const Kr=new Mt("history"),EO=new Mt("closeHistory");function kO(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ct({key:Kr,state:{init(){return new br(un.empty,un.empty,null,0,-1)},apply(e,t,r){return SO(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?h1:r=="historyRedo"?d1:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function f1(n,e){return(t,r)=>{let i=Kr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=CO(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const h1=f1(!1,!0),d1=f1(!0,!0),AO=Re.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>h1(n,e),redo:()=>({state:n,dispatch:e})=>d1(n,e)}},addProseMirrorPlugins(){return[kO(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var If=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(If||{});const TO=["common","mobile","tablet","desktop"];var Ua=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Ua||{}),_r=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(_r||{});const OO=["left","center","right","justify"];var oe=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(oe||{});const Nf=["paragraph","list","heading"];var an=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(an||{});const MO=["disc","circle","square","decimal","roman","latin"],IO=["decimal","roman","latin"];var Oe=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(Oe||{});const p1=["alignment","line_height","margin"],qa=["line_height"],m1=["text_decoration","link","superscript","background_color"],g1=["background_color","font_color","font_family","font_size","font_style","font_weight","text_decoration","superscript"];var Gt=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Gt||{}),Rf=(n=>(n.BLANK="_blank",n.SELF="_self",n))(Rf||{}),Mi=(n=>(n.URL="url",n.BLOCK="block",n))(Mi||{});class Lf{static create(e,t){const r=new this(e,t||{});return new ct({key:new Mt(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 NO extends Lf{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Bl.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,(s,a,u)=>{u.type.name===oe.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+s.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class RO extends Lf{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 s=vn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(s)}return!1}),Ye.create(e,t)}}const LO="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",PO="\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\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",Ii=(n,e)=>{for(const t in e)n[t]=e[t];return n},Pf="numeric",Df="ascii",Ff="alpha",Ts="asciinumeric",Os="alphanumeric",Bf="domain",y1="emoji",DO="scheme",FO="slashscheme",zf="whitespace";function BO(n,e){return n in e||(e[n]=[]),e[n]}function Gr(n,e,t){e[Pf]&&(e[Ts]=!0,e[Os]=!0),e[Df]&&(e[Ts]=!0,e[Ff]=!0),e[Ts]&&(e[Os]=!0),e[Ff]&&(e[Os]=!0),e[Os]&&(e[Bf]=!0),e[y1]&&(e[Bf]=!0);for(const r in e){const i=BO(r,t);i.indexOf(n)<0&&i.push(n)}}function zO(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function _t(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}_t.groups={},_t.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],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return 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||_t.groups;let i;return e&&e.j?i=e:(i=new _t(e),t&&r&&Gr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let a=0;a<s-1;a++)i=i.tt(n[a]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||_t.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let a,u=i.go(n);if(u?(a=new _t,Ii(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new _t,s){if(r)if(a.t&&typeof a.t=="string"){const c=Ii(zO(a.t,r),t);Gr(s,c,r)}else t&&Gr(s,t,r);a.t=s}return i.j[n]=a,a}};const ae=(n,e,t,r,i)=>n.ta(e,t,r,i),Ne=(n,e,t,r,i)=>n.tr(e,t,r,i),b1=(n,e,t,r,i)=>n.ts(e,t,r,i),$=(n,e,t,r,i)=>n.tt(e,t,r,i),$n="WORD",$f="UWORD",_1="ASCIINUMERICAL",w1="ALPHANUMERICAL",Ms="LOCALHOST",Hf="TLD",Wf="UTLD",Ka="SCHEME",Ni="SLASH_SCHEME",Vf="NUM",Uf="WS",qf="NL",Is="OPENBRACE",Ns="CLOSEBRACE",Ga="OPENBRACKET",Ja="CLOSEBRACKET",ja="OPENPAREN",Ya="CLOSEPAREN",Xa="OPENANGLEBRACKET",Za="CLOSEANGLEBRACKET",Qa="FULLWIDTHLEFTPAREN",el="FULLWIDTHRIGHTPAREN",tl="LEFTCORNERBRACKET",nl="RIGHTCORNERBRACKET",rl="LEFTWHITECORNERBRACKET",il="RIGHTWHITECORNERBRACKET",sl="FULLWIDTHLESSTHAN",ol="FULLWIDTHGREATERTHAN",al="AMPERSAND",Kf="APOSTROPHE",ll="ASTERISK",wr="AT",ul="BACKSLASH",cl="BACKTICK",fl="CARET",vr="COLON",Gf="COMMA",hl="DOLLAR",gn="DOT",dl="EQUALS",Jf="EXCLAMATION",Jt="HYPHEN",Rs="PERCENT",pl="PIPE",ml="PLUS",gl="POUND",Ls="QUERY",jf="QUOTE",v1="FULLWIDTHMIDDLEDOT",Yf="SEMI",yn="SLASH",Ps="TILDE",yl="UNDERSCORE",S1="EMOJI",bl="SYM";var x1=Object.freeze({__proto__:null,WORD:$n,UWORD:$f,ASCIINUMERICAL:_1,ALPHANUMERICAL:w1,LOCALHOST:Ms,TLD:Hf,UTLD:Wf,SCHEME:Ka,SLASH_SCHEME:Ni,NUM:Vf,WS:Uf,NL:qf,OPENBRACE:Is,CLOSEBRACE:Ns,OPENBRACKET:Ga,CLOSEBRACKET:Ja,OPENPAREN:ja,CLOSEPAREN:Ya,OPENANGLEBRACKET:Xa,CLOSEANGLEBRACKET:Za,FULLWIDTHLEFTPAREN:Qa,FULLWIDTHRIGHTPAREN:el,LEFTCORNERBRACKET:tl,RIGHTCORNERBRACKET:nl,LEFTWHITECORNERBRACKET:rl,RIGHTWHITECORNERBRACKET:il,FULLWIDTHLESSTHAN:sl,FULLWIDTHGREATERTHAN:ol,AMPERSAND:al,APOSTROPHE:Kf,ASTERISK:ll,AT:wr,BACKSLASH:ul,BACKTICK:cl,CARET:fl,COLON:vr,COMMA:Gf,DOLLAR:hl,DOT:gn,EQUALS:dl,EXCLAMATION:Jf,HYPHEN:Jt,PERCENT:Rs,PIPE:pl,PLUS:ml,POUND:gl,QUERY:Ls,QUOTE:jf,FULLWIDTHMIDDLEDOT:v1,SEMI:Yf,SLASH:yn,TILDE:Ps,UNDERSCORE:yl,EMOJI:S1,SYM:bl});const Hn=/[a-z]/,Ds=/\p{L}/u,Xf=/\p{Emoji}/u,Wn=/\d/,Zf=/\s/,C1="\r",Qf=`
42
- `,$O="\uFE0F",HO="\u200D",eh="\uFFFC";let _l=null,wl=null;function WO(n=[]){const e={};_t.groups=e;const t=new _t;_l==null&&(_l=k1(LO)),wl==null&&(wl=k1(PO)),$(t,"'",Kf),$(t,"{",Is),$(t,"}",Ns),$(t,"[",Ga),$(t,"]",Ja),$(t,"(",ja),$(t,")",Ya),$(t,"<",Xa),$(t,">",Za),$(t,"\uFF08",Qa),$(t,"\uFF09",el),$(t,"\u300C",tl),$(t,"\u300D",nl),$(t,"\u300E",rl),$(t,"\u300F",il),$(t,"\uFF1C",sl),$(t,"\uFF1E",ol),$(t,"&",al),$(t,"*",ll),$(t,"@",wr),$(t,"`",cl),$(t,"^",fl),$(t,":",vr),$(t,",",Gf),$(t,"$",hl),$(t,".",gn),$(t,"=",dl),$(t,"!",Jf),$(t,"-",Jt),$(t,"%",Rs),$(t,"|",pl),$(t,"+",ml),$(t,"#",gl),$(t,"?",Ls),$(t,'"',jf),$(t,"/",yn),$(t,";",Yf),$(t,"~",Ps),$(t,"_",yl),$(t,"\\",ul),$(t,"\u30FB",v1);const r=Ne(t,Wn,Vf,{[Pf]:!0});Ne(r,Wn,r);const i=Ne(r,Hn,_1,{[Ts]:!0}),s=Ne(r,Ds,w1,{[Os]:!0}),a=Ne(t,Hn,$n,{[Df]:!0});Ne(a,Wn,i),Ne(a,Hn,a),Ne(i,Wn,i),Ne(i,Hn,i);const u=Ne(t,Ds,$f,{[Ff]:!0});Ne(u,Hn),Ne(u,Wn,s),Ne(u,Ds,u),Ne(s,Wn,s),Ne(s,Hn),Ne(s,Ds,s);const c=$(t,Qf,qf,{[zf]:!0}),h=$(t,C1,Uf,{[zf]:!0}),p=Ne(t,Zf,Uf,{[zf]:!0});$(t,eh,p),$(h,Qf,c),$(h,eh,p),Ne(h,Zf,p),$(p,C1),$(p,Qf),Ne(p,Zf,p),$(p,eh,p);const m=Ne(t,Xf,S1,{[y1]:!0});$(m,"#"),Ne(m,Xf,m),$(m,$O,m);const y=$(m,HO);$(y,"#"),Ne(y,Xf,m);const _=[[Hn,a],[Wn,i]],S=[[Hn,null],[Ds,u],[Wn,s]];for(let E=0;E<_l.length;E++)Sr(t,_l[E],Hf,$n,_);for(let E=0;E<wl.length;E++)Sr(t,wl[E],Wf,$f,S);Gr(Hf,{tld:!0,ascii:!0},e),Gr(Wf,{utld:!0,alpha:!0},e),Sr(t,"file",Ka,$n,_),Sr(t,"mailto",Ka,$n,_),Sr(t,"http",Ni,$n,_),Sr(t,"https",Ni,$n,_),Sr(t,"ftp",Ni,$n,_),Sr(t,"ftps",Ni,$n,_),Gr(Ka,{scheme:!0,ascii:!0},e),Gr(Ni,{slashscheme:!0,ascii:!0},e),n=n.sort((E,N)=>E[0]>N[0]?1:-1);for(let E=0;E<n.length;E++){const N=n[E][0],v=n[E][1]?{[DO]:!0}:{[FO]:!0};N.indexOf("-")>=0?v[Bf]=!0:Hn.test(N)?Wn.test(N)?v[Ts]=!0:v[Df]=!0:v[Pf]=!0,b1(t,N,N,v)}return b1(t,"localhost",Ms,{ascii:!0}),t.jd=new _t(bl),{start:t,tokens:Ii({groups:e},x1)}}function E1(n,e){const t=VO(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=t.length,i=[];let s=0,a=0;for(;a<r;){let u=n,c=null,h=0,p=null,m=-1,y=-1;for(;a<r&&(c=u.go(t[a]));)u=c,u.accepts()?(m=0,y=0,p=u):m>=0&&(m+=t[a].length,y++),h+=t[a].length,s+=t[a].length,a++;s-=m,a-=y,h-=m,i.push({t:p.t,v:e.slice(s-h,s),s:s-h,e:s})}return i}function VO(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,a=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Sr(n,e,t,r,i){let s;const a=e.length;for(let u=0;u<a-1;u++){const c=e[u];n.j[c]?s=n.j[c]:(s=new _t(r),s.jr=i.slice(),n.j[c]=s),n=s}return s=new _t(t),s.jr=i.slice(),n.j[e[a-1]]=s,s}function k1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+s),10);a>0;a--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Fs={defaultProtocol:"http",events:null,format:A1,formatHref:A1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function th(n,e=null){let t=Ii({},Fs);n&&(t=Ii(t,n instanceof th?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}th.prototype={o:Fs,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]:Fs[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 A1(n){return n}function T1(n,e){this.t="token",this.v=n,this.tk=e}T1.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=Fs.defaultProtocol){return{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),s=this.toFormattedString(n),a={},u=n.get("className",t,e),c=n.get("target",t,e),h=n.get("rel",t,e),p=n.getObj("attributes",t,e),m=n.getObj("events",t,e);return a.href=r,u&&(a.class=u),c&&(a.target=c),h&&(a.rel=h),p&&Ii(a,p),{tagName:i,attributes:a,content:s,eventListeners:m}}};function vl(n,e){class t extends T1{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const O1=vl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),M1=vl("text"),UO=vl("nl"),Sl=vl("url",{isLink:!0,toHref(n=Fs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ms&&n[1].t===vr}}),jt=n=>new _t(n);function qO({groups:n}){const e=n.domain.concat([al,ll,wr,ul,cl,fl,hl,dl,Jt,Vf,Rs,pl,ml,gl,yn,bl,Ps,yl]),t=[vr,Gf,gn,Jf,Rs,Ls,jf,Yf,Xa,Za,Is,Ns,Ja,Ga,ja,Ya,Qa,el,tl,nl,rl,il,sl,ol],r=[al,Kf,ll,ul,cl,fl,hl,dl,Jt,Is,Ns,Rs,pl,ml,gl,Ls,yn,bl,Ps,yl],i=jt(),s=$(i,Ps);ae(s,r,s),ae(s,n.domain,s);const a=jt(),u=jt(),c=jt();ae(i,n.domain,a),ae(i,n.scheme,u),ae(i,n.slashscheme,c),ae(a,r,s),ae(a,n.domain,a);const h=$(a,wr);$(s,wr,h),$(u,wr,h),$(c,wr,h);const p=$(s,gn);ae(p,r,s),ae(p,n.domain,s);const m=jt();ae(h,n.domain,m),ae(m,n.domain,m);const y=$(m,gn);ae(y,n.domain,m);const _=jt(O1);ae(y,n.tld,_),ae(y,n.utld,_),$(h,Ms,_);const S=$(m,Jt);$(S,Jt,S),ae(S,n.domain,m),ae(_,n.domain,m),$(_,gn,y),$(_,Jt,S);const E=$(_,vr);ae(E,n.numeric,O1);const N=$(a,Jt),g=$(a,gn);$(N,Jt,N),ae(N,n.domain,a),ae(g,r,s),ae(g,n.domain,a);const v=jt(Sl);ae(g,n.tld,v),ae(g,n.utld,v),ae(v,n.domain,a),ae(v,r,s),$(v,gn,g),$(v,Jt,N),$(v,wr,h);const k=$(v,vr),A=jt(Sl);ae(k,n.numeric,A);const T=jt(Sl),F=jt();ae(T,e,T),ae(T,t,F),ae(F,e,T),ae(F,t,F),$(v,yn,T),$(A,yn,T);const U=$(u,vr),H=$(c,vr),ee=$(H,yn),te=$(ee,yn);ae(u,n.domain,a),$(u,gn,g),$(u,Jt,N),ae(c,n.domain,a),$(c,gn,g),$(c,Jt,N),ae(U,n.domain,T),$(U,yn,T),$(U,Ls,T),ae(te,n.domain,T),ae(te,e,T),$(te,yn,T);const Se=[[Is,Ns],[Ga,Ja],[ja,Ya],[Xa,Za],[Qa,el],[tl,nl],[rl,il],[sl,ol]];for(let wt=0;wt<Se.length;wt++){const[Sn,Dt]=Se[wt],xn=$(T,Sn);$(F,Sn,xn),$(xn,Dt,T);const We=jt(Sl);ae(xn,e,We);const vt=jt();ae(xn,t),ae(We,e,We),ae(We,t,vt),ae(vt,e,We),ae(vt,t,vt),$(We,Dt,T),$(vt,Dt,T)}return $(i,Ms,v),$(i,qf,UO),{start:i,tokens:x1}}function KO(n,e,t){let r=t.length,i=0,s=[],a=[];for(;i<r;){let u=n,c=null,h=null,p=0,m=null,y=-1;for(;i<r&&!(c=u.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=c||u.go(t[i].t));)c=null,u=h,u.accepts()?(y=0,m=u):y>=0&&y++,i++,p++;if(y<0)i-=p,i<r&&(a.push(t[i]),i++);else{a.length>0&&(s.push(nh(M1,e,a)),a=[]),i-=y,p-=y;const _=m.t,S=t.slice(i-p,i);s.push(nh(_,e,S))}}return a.length>0&&s.push(nh(M1,e,a)),s}function nh(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const GO=typeof console<"u"&&console&&console.warn||(()=>{}),JO="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ke={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function jO(){return _t.groups={},ke.scanner=null,ke.parser=null,ke.tokenQueue=[],ke.pluginQueue=[],ke.customSchemes=[],ke.initialized=!1,ke}function I1(n,e=!1){if(ke.initialized&&GO(`linkifyjs: already initialized - will not register custom scheme "${n}" ${JO}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
41
+ `,textSerializers:a={}}=t||{};let u="";return n.nodesBetween(r,i,(c,h,p,m)=>{var y;c.isBlock&&h>r&&(u+=s);const _=a?.[c.type.name];if(_)return p&&(u+=_({node:c,pos:h,parent:p,index:m,range:e})),!1;c.isText&&(u+=(y=c?.text)===null||y===void 0?void 0:y.slice(Math.max(r,h)-h,i-h))}),u}function qT(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}Re.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ct({key:new It("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,a=Math.min(...s.map(p=>p.$from.pos)),u=Math.max(...s.map(p=>p.$to.pos)),c=qT(t);return UT(r,{from:a,to:u},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}});const KT=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),GT=(n=!1)=>({commands:e})=>e.setContent("",n),JT=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:a})=>{n.doc.nodesBetween(s.pos,a.pos,(u,c)=>{if(u.type.isText)return;const{doc:h,mapping:p}=e,m=h.resolve(p.map(c)),y=h.resolve(p.map(c+u.nodeSize)),_=m.blockRange(y);if(!_)return;const S=Si(_);if(u.type.isTextblock){const{defaultType:E}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(_.start,E)}(S||S===0)&&e.lift(_,S)})}),!0},jT=n=>e=>n(e),YT=()=>({state:n,dispatch:e})=>z0(n,e),XT=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new pe(r.doc.resolve(a-1))),!0},ZT=()=>({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 s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const u=i.before(s),c=i.after(s);n.delete(u,c).scrollIntoView()}return!0}return!1},QT=n=>({tr:e,state:t,dispatch:r})=>{const i=qe(n,t.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===i){if(r){const c=s.before(a),h=s.after(a);e.delete(c,h).scrollIntoView()}return!0}return!1},eA=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},tA=()=>({state:n,dispatch:e})=>df(n,e),nA=()=>({commands:n})=>n.keyboardShortcut("Enter"),rA=()=>({state:n,dispatch:e})=>mT(n,e);function Ba(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:vf(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function X0(n,e,t={}){return n.find(r=>r.type===e&&Ba(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Z0(n,e,t={}){return!!X0(n,e,t)}function Sf(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!X0([...i.node.marks],e,t)))return;let a=i.index,u=n.start()+i.offset,c=a+1,h=u+i.node.nodeSize;for(;a>0&&Z0([...n.parent.child(a-1).marks],e,t);)a-=1,u-=n.parent.child(a).nodeSize;for(;c<n.parent.childCount&&Z0([...n.parent.child(c).marks],e,t);)h+=n.parent.child(c).nodeSize,c+=1;return{from:u,to:h}}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 iA=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=mn(n,r.schema),{doc:a,selection:u}=t,{$from:c,from:h,to:p}=u;if(i){const m=Sf(c,s,e);if(m&&m.from<=h&&m.to>=p){const y=pe.create(a,m.from,m.to);t.setSelection(y)}}return!0},sA=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 Q0(n){return n instanceof pe}function Kr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function oA(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,s=r.to;return e==="all"?pe.create(n,Kr(0,i,s),Kr(n.content.size,i,s)):pe.create(n,Kr(e,i,s),Kr(e,i,s))}function aA(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function xf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const lA=(n=null,e={})=>({editor:t,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(xf()||aA())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Q0(t.state.selection))return a(),!0;const u=oA(i.doc,n)||t.state.selection,c=t.state.selection.eq(u);return s&&(c||i.setSelection(u),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),a()),!0},uA=(n,e)=>t=>n.every((r,i)=>e(r,{...t,index:i})),cA=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),e1=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&e1(r)}return n};function za(n){const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return e1(t)}function $a(n,e,t){if(n instanceof fr||n instanceof z)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return z.fromArray(n.map(u=>e.nodeFromJSON(u)));const a=e.nodeFromJSON(n);return t.errorOnInvalidContent&&a.check(),a}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),$a("",e,t)}if(i){if(t.errorOnInvalidContent){let a=!1,u="";const c=new yg({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(a=!0,u=typeof h=="string"?h:h.outerHTML,null)}]}})});if(t.slice?_s.fromSchema(c).parseSlice(za(n),t.parseOptions):_s.fromSchema(c).parse(za(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${u}`)})}const s=_s.fromSchema(e);return t.slice?s.parseSlice(za(n),t.parseOptions).content:s.parse(za(n),t.parseOptions)}return $a("",e,t)}function fA(n,e,t){const r=n.steps.length-1;if(r<e)return;const i=n.steps[r];if(!(i instanceof je||i instanceof Je))return;const s=n.mapping.maps[r];let a=0;s.forEach((u,c,h,p)=>{a===0&&(a=p)}),n.setSelection(ye.near(n.doc.resolve(a),t))}const hA=n=>!("type"in n),dA=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var a;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let u;try{u=$a(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(a=t.errorOnInvalidContent)!==null&&a!==void 0?a:s.options.enableContentCheck})}catch(S){return s.emit("contentError",{editor:s,error:S,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:h}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,m=!0;if((hA(u)?u:[u]).forEach(S=>{S.check(),p=p?S.isText&&S.marks.length===0:!1,m=m?S.isBlock:!1}),c===h&&m){const{parent:S}=r.doc.resolve(c);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(c-=1,h+=1)}let _;if(p){if(Array.isArray(e))_=e.map(S=>S.text||"").join("");else if(e instanceof z){let S="";e.forEach(E=>{E.text&&(S+=E.text)}),_=S}else typeof e=="object"&&e&&e.text?_=e.text:_=e;r.insertText(_,c,h)}else _=u,r.replaceWith(c,h,_);t.updateSelection&&fA(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:_}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:_})}return!0},pA=()=>({state:n,dispatch:e})=>hT(n,e),mA=()=>({state:n,dispatch:e})=>dT(n,e),gA=()=>({state:n,dispatch:e})=>N0(n,e),yA=()=>({state:n,dispatch:e})=>D0(n,e),bA=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Sa(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},_A=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Sa(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},wA=()=>({state:n,dispatch:e})=>cT(n,e),vA=()=>({state:n,dispatch:e})=>fT(n,e);function t1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function SA(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,a;for(let u=0;u<e.length-1;u+=1){const c=e[u];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))xf()||t1()?a=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}const xA=n=>({editor:e,view:t,tr:r,dispatch:i})=>{const s=SA(n).split(/-(?!$)/),a=s.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),u=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",h=>h(t,u))});return c?.steps.forEach(h=>{const p=h.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Cf(n,e,t={}){const{from:r,to:i,empty:s}=n.selection,a=e?qe(e,n.schema):null,u=[];n.doc.nodesBetween(r,i,(m,y)=>{if(m.isText)return;const _=Math.max(r,y),S=Math.min(i,y+m.nodeSize);u.push({node:m,from:_,to:S})});const c=i-r,h=u.filter(m=>a?a.name===m.node.type.name:!0).filter(m=>Ba(m.node.attrs,t,{strict:!1}));return s?!!h.length:h.reduce((m,y)=>m+y.to-y.from,0)>=c}const CA=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return Cf(t,i,e)?pT(t,r):!1},EA=()=>({state:n,dispatch:e})=>$0(n,e),kA=n=>({state:e,dispatch:t})=>{const r=qe(n,e.schema);return kT(r)(e,t)},TA=()=>({state:n,dispatch:e})=>B0(n,e);function Ef(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function n1(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 AA=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,a=null;const u=Ef(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(s=qe(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(h,p)=>{s&&s===h.type&&t.setNodeMarkup(p,void 0,n1(h.attrs,e)),a&&h.marks.length&&h.marks.forEach(m=>{a===m.type&&t.addMark(p,p+h.nodeSize,a.create(n1(m.attrs,e)))})})}),!0):!1},MA=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),OA=()=>({tr:n,dispatch:e})=>{if(e){const t=new Lt(n.doc);n.setSelection(t)}return!0},IA=()=>({state:n,dispatch:e})=>L0(n,e),NA=()=>({state:n,dispatch:e})=>F0(n,e),RA=()=>({state:n,dispatch:e})=>bT(n,e),LA=()=>({state:n,dispatch:e})=>vT(n,e),PA=()=>({state:n,dispatch:e})=>wT(n,e);function DA(n,e,t={},r={}){return $a(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}const FA=(n,e=!1,t={},r={})=>({editor:i,tr:s,dispatch:a,commands:u})=>{var c,h;const{doc:p}=s;if(t.preserveWhitespace!=="full"){const m=DA(n,i.schema,t,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck});return a&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return a&&s.setMeta("preventUpdate",!e),u.insertContentAt({from:0,to:p.content.size},n,{parseOptions:t,errorOnInvalidContent:(h=r.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck})};function r1(n,e){const t=mn(e,n.schema),{from:r,to:i,empty:s}=n.selection,a=[];s?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,c=>{a.push(...c.marks)});const u=a.find(c=>c.type.name===t.name);return u?{...u.attrs}:{}}function BA(n,e){const t=new dk(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function zA(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 $A(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function HA(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 kf(n){return e=>HA(e.$from,n)}function WA(n,e){const t=Di.resolve(n);return G0(t,e)}function VA(n,e){const t=qe(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,u=>{s.push(u)});const a=s.reverse().find(u=>u.type.name===t.name);return a?{...a.attrs}:{}}function UA(n,e){const t=Ef(typeof e=="string"?e:e.name,n.schema);return t==="node"?VA(n,e):t==="mark"?r1(n,e):{}}function qA(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 KA(n){const e=qA(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,a)=>a!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function GA(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{const a=[];if(i.ranges.length)i.forEach((u,c)=>{a.push({from:u,to:c})});else{const{from:u,to:c}=t[s];if(u===void 0||c===void 0)return;a.push({from:u,to:c})}a.forEach(({from:u,to:c})=>{const h=e.slice(s).map(u,-1),p=e.slice(s).map(c),m=e.invert().map(h,-1),y=e.invert().map(p);r.push({oldRange:{from:m,to:y},newRange:{from:h,to:p}})})}),KA(r)}function i1(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(i=>{const s=t.resolve(n),a=Sf(s,i.type);a&&r.push({mark:i,...a})}):t.nodesBetween(n,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(a=>({from:s,to:s+i.nodeSize,mark:a})))}),r}function Ha(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function JA(n,e,t={}){const{empty:r,ranges:i}=n.selection,s=e?mn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Ba(m.attrs,t,{strict:!1}));let a=0;const u=[];if(i.forEach(({$from:m,$to:y})=>{const _=m.pos,S=y.pos;n.doc.nodesBetween(_,S,(E,N)=>{if(!E.isText&&!E.marks.length)return;const g=Math.max(_,N),v=Math.min(S,N+E.nodeSize),k=v-g;a+=k,u.push(...E.marks.map(T=>({mark:T,from:g,to:v})))})}),a===0)return!1;const c=u.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Ba(m.mark.attrs,t,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),h=u.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,y)=>m+y.to-y.from,0);return(c>0?c+h:c)>=a}function s1(n,e){const{nodeExtensions:t}=Ra(e),r=t.find(a=>a.name===n);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=de(J(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function o1(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(o1(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function jA(n,e,t){var r;const{selection:i}=e;let s=null;if(Q0(i)&&(s=i.$cursor),s){const u=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(u)||!u.some(c=>c.type.excludes(t))}const{ranges:a}=i;return a.some(({$from:u,$to:c})=>{let h=u.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(u.pos,c.pos,(p,m,y)=>{if(h)return!1;if(p.isInline){const _=!y||y.type.allowsMarkType(t),S=!!t.isInSet(p.marks)||!p.marks.some(E=>E.type.excludes(t));h=_&&S}return!h}),h})}const YA=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const{selection:s}=t,{empty:a,ranges:u}=s,c=mn(n,r.schema);if(i)if(a){const h=r1(r,c);t.addStoredMark(c.create({...h,...e}))}else u.forEach(h=>{const p=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(p,m,(y,_)=>{const S=Math.max(_,p),E=Math.min(_+y.nodeSize,m);y.marks.find(g=>g.type===c)?y.marks.forEach(g=>{c===g.type&&t.addMark(S,E,c.create({...g.attrs,...e}))}):t.addMark(S,E,c.create(e))})});return jA(r,t,c)},XA=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),ZA=(n,e={})=>({state:t,dispatch:r,chain:i})=>{const s=qe(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:u})=>V0(s,{...a,...e})(t)?!0:u.clearNodes()).command(({state:u})=>V0(s,{...a,...e})(u,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},QA=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,i=Kr(n,0,r.content.size),s=Q.create(r,i);e.setSelection(s)}return!0},eM=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,a=pe.atStart(r).from,u=pe.atEnd(r).to,c=Kr(i,a,u),h=Kr(s,a,u),p=pe.create(r,c,h);e.setSelection(p)}return!0},tM=n=>({state:e,dispatch:t})=>{const r=qe(n,e.schema);return MT(r)(e,t)};function a1(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 nM=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:u,$to:c}=s,h=i.extensionManager.attributes,p=Ha(h,u.node().type.name,u.node().attrs);if(s instanceof Q&&s.node.isBlock)return!u.parentOffset||!zn(a,u.pos)?!1:(r&&(n&&a1(t,i.extensionManager.splittableMarks),e.split(u.pos).scrollIntoView()),!0);if(!u.parent.isBlock)return!1;const m=c.parentOffset===c.parent.content.size,y=u.depth===0?void 0:zA(u.node(-1).contentMatchAt(u.indexAfter(-1)));let _=m&&y?[{type:y,attrs:p}]:void 0,S=zn(e.doc,e.mapping.map(u.pos),1,_);if(!_&&!S&&zn(e.doc,e.mapping.map(u.pos),1,y?[{type:y}]:void 0)&&(S=!0,_=y?[{type:y,attrs:p}]:void 0),r){if(S&&(s instanceof pe&&e.deleteSelection(),e.split(e.mapping.map(u.pos),1,_),y&&!m&&!u.parentOffset&&u.parent.type!==y)){const E=e.mapping.map(u.before()),N=e.doc.resolve(E);u.node(-1).canReplaceWith(N.index(),N.index()+1,y)&&e.setNodeMarkup(e.mapping.map(u.before()),y)}n&&a1(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},rM=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var a;const u=qe(n,r.schema),{$from:c,$to:h}=r.selection,p=r.selection.node;if(p&&p.isBlock||c.depth<2||!c.sameParent(h))return!1;const m=c.node(-1);if(m.type!==u)return!1;const y=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==u||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let g=z.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let V=c.depth-v;V>=c.depth-3;V-=1)g=z.from(c.node(V).copy(g));const k=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...Ha(y,c.node().type.name,c.node().attrs),...e},A=((a=u.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(T))||void 0;g=g.append(z.from(u.createAndFill(null,A)||void 0));const F=c.before(c.depth-(v-1));t.replace(F,c.after(-k),new K(g,4-v,0));let U=-1;t.doc.nodesBetween(F,t.doc.content.size,(V,ee)=>{if(U>-1)return!1;V.isTextblock&&V.content.size===0&&(U=ee+1)}),U>-1&&t.setSelection(pe.near(t.doc.resolve(U))),t.scrollIntoView()}return!0}const _=h.pos===c.end()?m.contentMatchAt(0).defaultType:null,S={...Ha(y,m.type.name,m.attrs),...e},E={...Ha(y,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,h.pos);const N=_?[{type:u,attrs:S},{type:_,attrs:E}]:[{type:u,attrs:S}];if(!zn(t.doc,c.pos,2))return!1;if(i){const{selection:g,storedMarks:v}=r,{splittableMarks:k}=s.extensionManager,T=v||g.$to.parentOffset&&g.$from.marks();if(t.split(c.pos,2,N).scrollIntoView(),!T||!i)return!0;const A=T.filter(F=>k.includes(F.type.name));t.ensureMarks(A)}return!0},Tf=(n,e)=>{const t=kf(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},Af=(n,e)=>{const t=kf(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},iM=(n,e,t,r={})=>({editor:i,tr:s,state:a,dispatch:u,chain:c,commands:h,can:p})=>{const{extensions:m,splittableMarks:y}=i.extensionManager,_=qe(n,a.schema),S=qe(e,a.schema),{selection:E,storedMarks:N}=a,{$from:g,$to:v}=E,k=g.blockRange(v),T=N||E.$to.parentOffset&&E.$from.marks();if(!k)return!1;const A=kf(F=>s1(F.type.name,m))(E);if(k.depth>=1&&A&&k.depth-A.depth<=1){if(A.node.type===_)return h.liftListItem(S);if(s1(A.node.type.name,m)&&_.validContent(A.node.content)&&u)return c().command(()=>(s.setNodeMarkup(A.pos,_),!0)).command(()=>Tf(s,_)).command(()=>Af(s,_)).run()}return!t||!T||!u?c().command(()=>p().wrapInList(_,r)?!0:h.clearNodes()).wrapInList(_,r).command(()=>Tf(s,_)).command(()=>Af(s,_)).run():c().command(()=>{const F=p().wrapInList(_,r),U=T.filter(V=>y.includes(V.type.name));return s.ensureMarks(U),F?!0:h.clearNodes()}).wrapInList(_,r).command(()=>Tf(s,_)).command(()=>Af(s,_)).run()},sM=(n,e={},t={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,a=mn(n,r.schema);return JA(r,a,e)?i.unsetMark(a,{extendEmptyMarkRange:s}):i.setMark(a,e)},oM=(n,e,t={})=>({state:r,commands:i})=>{const s=qe(n,r.schema),a=qe(e,r.schema),u=Cf(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),u?i.setNode(a,c):i.setNode(s,{...c,...t})},aM=(n,e={})=>({state:t,commands:r})=>{const i=qe(n,t.schema);return Cf(t,i,e)?r.lift(i):r.wrapIn(i,e)},lM=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const i=t[r];let s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){const a=n.tr,u=s.transform;for(let c=u.steps.length-1;c>=0;c-=1)a.step(u.steps[c].invert(u.docs[c]));if(s.text){const c=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else a.delete(s.from,s.to)}return!0}}return!1},uM=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},cM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:u}=t,c=mn(n,r.schema),{$from:h,empty:p,ranges:m}=u;if(!i)return!0;if(p&&a){let{from:y,to:_}=u;const S=(s=h.marks().find(N=>N.type===c))===null||s===void 0?void 0:s.attrs,E=Sf(h,c,S);E&&(y=E.from,_=E.to),t.removeMark(y,_,c)}else m.forEach(y=>{t.removeMark(y.$from.pos,y.$to.pos,c)});return t.removeStoredMark(c),!0},fM=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,a=null;const u=Ef(typeof n=="string"?n:n.name,r.schema);return u?(u==="node"&&(s=qe(n,r.schema)),u==="mark"&&(a=mn(n,r.schema)),i&&t.selection.ranges.forEach(c=>{const h=c.$from.pos,p=c.$to.pos;let m,y,_,S;t.selection.empty?r.doc.nodesBetween(h,p,(E,N)=>{s&&s===E.type&&(_=Math.max(N,h),S=Math.min(N+E.nodeSize,p),m=N,y=E)}):r.doc.nodesBetween(h,p,(E,N)=>{N<h&&s&&s===E.type&&(_=Math.max(N,h),S=Math.min(N+E.nodeSize,p),m=N,y=E),N>=h&&N<=p&&(s&&s===E.type&&t.setNodeMarkup(N,void 0,{...E.attrs,...e}),a&&E.marks.length&&E.marks.forEach(g=>{if(a===g.type){const v=Math.max(N,h),k=Math.min(N+E.nodeSize,p);t.addMark(v,k,a.create({...g.attrs,...e}))}}))}),y&&(m!==void 0&&t.setNodeMarkup(m,void 0,{...y.attrs,...e}),a&&y.marks.length&&y.marks.forEach(E=>{a===E.type&&t.addMark(_,S,a.create({...E.attrs,...e}))}))}),!0):!1},hM=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return ST(i,e)(t,r)},dM=(n,e={})=>({state:t,dispatch:r})=>{const i=qe(n,t.schema);return xT(i,e)(t,r)};var pM=Object.freeze({__proto__:null,blur:KT,clearContent:GT,clearNodes:JT,command:jT,createParagraphNear:YT,cut:XT,deleteCurrentNode:ZT,deleteNode:QT,deleteRange:eA,deleteSelection:tA,enter:nA,exitCode:rA,extendMarkRange:iA,first:sA,focus:lA,forEach:uA,insertContent:cA,insertContentAt:dA,joinBackward:gA,joinDown:mA,joinForward:yA,joinItemBackward:bA,joinItemForward:_A,joinTextblockBackward:wA,joinTextblockForward:vA,joinUp:pA,keyboardShortcut:xA,lift:CA,liftEmptyBlock:EA,liftListItem:kA,newlineInCode:TA,resetAttributes:AA,scrollIntoView:MA,selectAll:OA,selectNodeBackward:IA,selectNodeForward:NA,selectParentNode:RA,selectTextblockEnd:LA,selectTextblockStart:PA,setContent:FA,setMark:YA,setMeta:XA,setNode:ZA,setNodeSelection:QA,setTextSelection:eM,sinkListItem:tM,splitBlock:nM,splitListItem:rM,toggleList:iM,toggleMark:sM,toggleNode:oM,toggleWrap:aM,undoInputRule:lM,unsetAllMarks:uM,unsetMark:cM,updateAttributes:fM,wrapIn:hM,wrapInList:dM});Re.create({name:"commands",addCommands(){return{...pM}}}),Re.create({name:"drop",addProseMirrorPlugins(){return[new ct({key:new It("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Re.create({name:"editable",addProseMirrorPlugins(){return[new ct({key:new It("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Re.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ct({key:new It("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:c,doc:h}=u,{empty:p,$anchor:m}=c,{pos:y,parent:_}=m,S=m.parent.isTextblock&&y>0?u.doc.resolve(y-1):m,E=S.parent.type.spec.isolating,N=m.pos-m.parentOffset,g=E&&S.parent.childCount===1?N===m.pos:ye.atStart(h).from===y;return!p||!_.type.isTextblock||_.textContent.length||!g||g&&m.parent.type.name==="paragraph"?!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},s={...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 xf()||t1()?s:i},addProseMirrorPlugins(){return[new ct({key:new It("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(E=>E.getMeta("composition")))return;const r=n.some(E=>E.docChanged)&&!e.doc.eq(t.doc),i=n.some(E=>E.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:a,to:u}=e.selection,c=ye.atStart(e.doc).from,h=ye.atEnd(e.doc).to;if(s||!(a===c&&u===h)||!o1(t.doc))return;const y=t.tr,_=Na({state:t,transaction:y}),{commands:S}=new bf({editor:this.editor,state:_});if(S.clearNodes(),!!y.steps.length)return y}})]}}),Re.create({name:"paste",addProseMirrorPlugins(){return[new ct({key:new It("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Re.create({name:"tabindex",addProseMirrorPlugins(){return[new ct({key:new It("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function mM(n){return new Y0({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=de(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,s)}})}function gM(n){return new Y0({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=de(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),c=a.doc.resolve(t.from).blockRange(),h=c&&Vc(c,n.type,s);if(!h)return null;if(a.wrap(c,h),n.keepMarks&&n.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:_}=n.editor.extensionManager,S=y||m.$to.parentOffset&&m.$from.marks();if(S){const E=S.filter(N=>_.includes(N.type.name));a.ensureMarks(E)}}if(n.keepAttributes){const m=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=a.doc.resolve(t.from-1).nodeBefore;p&&p.type===n.type&&hr(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,p))&&a.join(t.from-1)}})}class jn{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&&Object.keys(e.defaultOptions).length>0&&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=de(J(this,"addOptions",{name:this.name}))),this.storage=de(J(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new jn(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Da(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new jn(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=de(J(t,"addOptions",{name:t.name})),t.storage=de(J(t,"addStorage",{name:t.name,options:t.options})),t}}function yM(n){return new BT({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{const s=de(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:a}=e,u=r[r.length-1],c=r[0];let h=t.to;if(u){const p=c.search(/\S/),m=t.from+c.indexOf(u),y=m+u.length;if(i1(t.from,t.to,e.doc).filter(S=>S.mark.type.excluded.find(N=>N===n.type&&N!==S.mark.type)).filter(S=>S.to>m).length)return null;y<t.to&&a.delete(y,t.to),m>t.from&&a.delete(t.from+p,m),h=t.from+p+u.length,a.addMark(t.from+p,h,n.type.create(s||{})),a.removeStoredMark(n.type)}}})}const bM=jn.create({name:"text",group:"inline"});var Wa=200,Ke=function(){};Ke.prototype.append=function(e){return e.length?(e=Ke.from(e),!this.length&&e||e.length<Wa&&this.leafAppend(e)||this.length<Wa&&e.leafPrepend(this)||this.appendInner(e)):this},Ke.prototype.prepend=function(e){return e.length?Ke.from(e).append(this):this},Ke.prototype.appendInner=function(e){return new _M(this,e)},Ke.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ke.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ke.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ke.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)},Ke.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,a){return i.push(e(s,a))},t,r),i},Ke.from=function(e){return e instanceof Ke?e:e&&e.length?new l1(e):Ke.empty};var l1=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,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,a,u){for(var c=s;c<a;c++)if(i(this.values[c],u+c)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,a,u){for(var c=s-1;c>=a;c--)if(i(this.values[c],u+c)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Wa)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Wa)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}(Ke);Ke.empty=new l1([]);var _M=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,s,a){var u=this.left.length;if(i<u&&this.left.forEachInner(r,i,Math.min(s,u),a)===!1||s>u&&this.right.forEachInner(r,Math.max(i-u,0),Math.min(this.length,s)-u,a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,a){var u=this.left.length;if(i>u&&this.right.forEachInvertedInner(r,i-u,Math.max(s,u)-u,a+u)===!1||s<u&&this.left.forEachInvertedInner(r,Math.min(i,u),s,a)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},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}(Ke);const wM=500;class un{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,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let a=e.tr,u,c,h=[],p=[];return this.items.forEach((m,y)=>{if(!m.step){i||(i=this.remapping(r,y+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new bn(m.map));let _=m.step.map(i.slice(s)),S;_&&a.maybeStep(_).doc&&(S=a.mapping.maps[a.mapping.maps.length-1],h.push(new bn(S,void 0,void 0,h.length+p.length))),s--,S&&i.appendMap(S,s)}else a.maybeStep(m.step);if(m.selection)return u=i?m.selection.map(i.slice(s)):m.selection,c=new un(this.items.slice(0,r).append(p.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:u}}addTransform(e,t,r,i){let s=[],a=this.eventCount,u=this.items,c=!i&&u.length?u.get(u.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),y=new bn(e.mapping.maps[p],m,t),_;(_=c&&c.merge(y))&&(y=_,p?s.pop():u=u.slice(0,u.length-1)),s.push(y),t&&(a++,t=void 0),i||(c=y)}let h=a-r.depth;return h>SM&&(u=vM(u,h),a-=h),new un(u.append(s),a)}remapping(e,t){let r=new Fi;return this.items.forEach((i,s)=>{let a=i.mirrorOffset!=null&&s-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 un(this.items.append(e.map(t=>new bn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,a=e.steps.length,u=this.eventCount;this.items.forEach(y=>{y.selection&&u--},i);let c=t;this.items.forEach(y=>{let _=s.getMirror(--c);if(_==null)return;a=Math.min(a,_);let S=s.maps[_];if(y.step){let E=e.steps[_].invert(e.docs[_]),N=y.selection&&y.selection.map(s.slice(c+1,_));N&&u++,r.push(new bn(S,E,N))}else r.push(new bn(S))},i);let h=[];for(let y=t;y<a;y++)h.push(new bn(s.maps[y]));let p=this.items.slice(0,i).append(h).append(r),m=new un(p,u);return m.emptyItemCount()>wM&&(m=m.compress(this.items.length-r.length)),m}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=[],s=0;return this.items.forEach((a,u)=>{if(u>=e)i.push(a),a.selection&&s++;else if(a.step){let c=a.step.map(t.slice(r)),h=c&&c.getMap();if(r--,h&&t.appendMap(h,r),c){let p=a.selection&&a.selection.map(t.slice(r));p&&s++;let m=new bn(h.invert(),c,p),y,_=i.length-1;(y=i.length&&i[_].merge(m))?i[_]=y:i.push(m)}}else a.map&&r--},this.items.length,0),new un(Ke.from(i.reverse()),s)}}un.empty=new un(Ke.empty,0);function vM(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class bn{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 bn(t.getMap().invert(),t,this.selection)}}}class br{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const SM=20;function xM(n,e,t,r){let i=t.getMeta(Gr),s;if(i)return i.historyState;t.getMeta(kM)&&(n=new br(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Gr))return a.getMeta(Gr).redo?new br(n.done.addTransform(t,void 0,r,Va(e)),n.undone,u1(t.mapping.maps),n.prevTime,n.prevComposition):new br(n.done,n.undone.addTransform(t,void 0,r,Va(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let u=t.getMeta("composition"),c=n.prevTime==0||!a&&n.prevComposition!=u&&(n.prevTime<(t.time||0)-r.newGroupDelay||!CM(t,n.prevRanges)),h=a?Mf(n.prevRanges,t.mapping):u1(t.mapping.maps);return new br(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,Va(e)),un.empty,h,t.time,u??n.prevComposition)}else return(s=t.getMeta("rebased"))?new br(n.done.rebased(t,s),n.undone.rebased(t,s),Mf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new br(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Mf(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function CM(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function u1(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,a)=>e.push(s,a));return e}function Mf(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function EM(n,e,t){let r=Va(e),i=Gr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),u=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),c=new br(t?u:s.remaining,t?s.remaining:u,null,0,-1);return s.transform.setSelection(a).setMeta(Gr,{redo:t,historyState:c})}let Of=!1,c1=null;function Va(n){let e=n.plugins;if(c1!=e){Of=!1,c1=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Of=!0;break}}return Of}const Gr=new It("history"),kM=new It("closeHistory");function TM(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ct({key:Gr,state:{init(){return new br(un.empty,un.empty,null,0,-1)},apply(e,t,r){return xM(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?h1:r=="historyRedo"?d1:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function f1(n,e){return(t,r)=>{let i=Gr.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=EM(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const h1=f1(!1,!0),d1=f1(!0,!0),AM=Re.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>h1(n,e),redo:()=>({state:n,dispatch:e})=>d1(n,e)}},addProseMirrorPlugins(){return[TM(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var If=(n=>(n.COMMON="common",n.DESKTOP="desktop",n.TABLET="tablet",n.MOBILE="mobile",n))(If||{});const MM=["common","mobile","tablet","desktop"];var Ua=(n=>(n.UPPERCASE="uppercase",n.LOWERCASE="lowercase",n.CAPITALIZE="capitalize",n))(Ua||{}),_r=(n=>(n.LEFT="left",n.CENTER="center",n.RIGHT="right",n.JUSTIFY="justify",n))(_r||{});const OM=["left","center","right","justify"];var oe=(n=>(n.DOCUMENT="doc",n.PARAGRAPH="paragraph",n.HEADING="heading",n.LIST="list",n.LIST_ITEM="listItem",n.TEXT="text",n))(oe||{});const Nf=["paragraph","list","heading"];var an=(n=>(n.DISC="disc",n.CIRCLE="circle",n.SQUARE="square",n.DECIMAL="decimal",n.ROMAN="roman",n.LATIN="latin",n))(an||{});const IM=["disc","circle","square","decimal","roman","latin"],NM=["decimal","roman","latin"];var ke=(n=>(n.ALIGNMENT="alignment",n.BACKGROUND_COLOR="background_color",n.FONT_COLOR="font_color",n.FONT_FAMILY="font_family",n.FONT_SIZE="font_size",n.FONT_STYLE="font_style",n.FONT_WEIGHT="font_weight",n.LINE_HEIGHT="line_height",n.LETTER_SPACING="letter_spacing",n.TEXT_DECORATION="text_decoration",n.SUPERSCRIPT="superscript",n.MARGIN="margin",n.LINK="link",n.STYLE_PRESET="style_preset",n))(ke||{});const p1=["alignment","line_height","margin"],qa=["line_height"],m1=["text_decoration","link","superscript","background_color"],g1=["background_color","font_color","font_family","font_size","font_style","font_weight","letter_spacing","text_decoration","superscript"];var Rt=(n=>(n.SETTINGS="settings",n.ALL="_",n))(Rt||{}),Rf=(n=>(n.BLANK="_blank",n.SELF="_self",n))(Rf||{}),Oi=(n=>(n.URL="url",n.BLOCK="block",n))(Oi||{});class Lf{static create(e,t){const r=new this(e,t||{});return new ct({key:new It(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 Lf{addProps(){return{transformPastedHTML:this._transformPastedHTML,handlePaste:this._handlePaste}}_transformPastedHTML(e){if(e.includes("data-pm-slice")&&e.includes("zw-style"))return e;const t=Bl.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,(s,a,u)=>{u.type.name===oe.DOCUMENT&&(r=Math.min(r,a+1),i=Math.max(i,a+s.nodeSize-1))}),{from:r,to:i}}_isMatchPosition(e,t){return Math.abs(e-t)<5}}class LM extends Lf{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 s=vn.node(i,i+r.nodeSize,{class:"zw-wysiwyg__placeholder","data-placeholder":"Type your text here..."});t.push(s)}return!1}),Ye.create(e,t)}}const PM="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",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\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",Ii=(n,e)=>{for(const t in e)n[t]=e[t];return n},Pf="numeric",Df="ascii",Ff="alpha",As="asciinumeric",Ms="alphanumeric",Bf="domain",y1="emoji",FM="scheme",BM="slashscheme",zf="whitespace";function zM(n,e){return n in e||(e[n]=[]),e[n]}function Jr(n,e,t){e[Pf]&&(e[As]=!0,e[Ms]=!0),e[Df]&&(e[As]=!0,e[Ff]=!0),e[As]&&(e[Ms]=!0),e[Ff]&&(e[Ms]=!0),e[Ms]&&(e[Bf]=!0),e[y1]&&(e[Bf]=!0);for(const r in e){const i=zM(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 _t(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}_t.groups={},_t.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],s=e.jr[r][1];if(s&&i.test(n))return s}return e.jd},has(n,e=!1){return 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||_t.groups;let i;return e&&e.j?i=e:(i=new _t(e),t&&r&&Jr(e,t,r)),this.jr.push([n,i]),i},ts(n,e,t,r){let i=this;const s=n.length;if(!s)return i;for(let a=0;a<s-1;a++)i=i.tt(n[a]);return i.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||_t.groups;const i=this;if(e&&e.j)return i.j[n]=e,e;const s=e;let a,u=i.go(n);if(u?(a=new _t,Ii(a.j,u.j),a.jr.push.apply(a.jr,u.jr),a.jd=u.jd,a.t=u.t):a=new _t,s){if(r)if(a.t&&typeof a.t=="string"){const c=Ii($M(a.t,r),t);Jr(s,c,r)}else t&&Jr(s,t,r);a.t=s}return i.j[n]=a,a}};const ae=(n,e,t,r,i)=>n.ta(e,t,r,i),Ne=(n,e,t,r,i)=>n.tr(e,t,r,i),b1=(n,e,t,r,i)=>n.ts(e,t,r,i),$=(n,e,t,r,i)=>n.tt(e,t,r,i),$n="WORD",$f="UWORD",_1="ASCIINUMERICAL",w1="ALPHANUMERICAL",Os="LOCALHOST",Hf="TLD",Wf="UTLD",Ka="SCHEME",Ni="SLASH_SCHEME",Vf="NUM",Uf="WS",qf="NL",Is="OPENBRACE",Ns="CLOSEBRACE",Ga="OPENBRACKET",Ja="CLOSEBRACKET",ja="OPENPAREN",Ya="CLOSEPAREN",Xa="OPENANGLEBRACKET",Za="CLOSEANGLEBRACKET",Qa="FULLWIDTHLEFTPAREN",el="FULLWIDTHRIGHTPAREN",tl="LEFTCORNERBRACKET",nl="RIGHTCORNERBRACKET",rl="LEFTWHITECORNERBRACKET",il="RIGHTWHITECORNERBRACKET",sl="FULLWIDTHLESSTHAN",ol="FULLWIDTHGREATERTHAN",al="AMPERSAND",Kf="APOSTROPHE",ll="ASTERISK",wr="AT",ul="BACKSLASH",cl="BACKTICK",fl="CARET",vr="COLON",Gf="COMMA",hl="DOLLAR",gn="DOT",dl="EQUALS",Jf="EXCLAMATION",Jt="HYPHEN",Rs="PERCENT",pl="PIPE",ml="PLUS",gl="POUND",Ls="QUERY",jf="QUOTE",v1="FULLWIDTHMIDDLEDOT",Yf="SEMI",yn="SLASH",Ps="TILDE",yl="UNDERSCORE",S1="EMOJI",bl="SYM";var x1=Object.freeze({__proto__:null,WORD:$n,UWORD:$f,ASCIINUMERICAL:_1,ALPHANUMERICAL:w1,LOCALHOST:Os,TLD:Hf,UTLD:Wf,SCHEME:Ka,SLASH_SCHEME:Ni,NUM:Vf,WS:Uf,NL:qf,OPENBRACE:Is,CLOSEBRACE:Ns,OPENBRACKET:Ga,CLOSEBRACKET:Ja,OPENPAREN:ja,CLOSEPAREN:Ya,OPENANGLEBRACKET:Xa,CLOSEANGLEBRACKET:Za,FULLWIDTHLEFTPAREN:Qa,FULLWIDTHRIGHTPAREN:el,LEFTCORNERBRACKET:tl,RIGHTCORNERBRACKET:nl,LEFTWHITECORNERBRACKET:rl,RIGHTWHITECORNERBRACKET:il,FULLWIDTHLESSTHAN:sl,FULLWIDTHGREATERTHAN:ol,AMPERSAND:al,APOSTROPHE:Kf,ASTERISK:ll,AT:wr,BACKSLASH:ul,BACKTICK:cl,CARET:fl,COLON:vr,COMMA:Gf,DOLLAR:hl,DOT:gn,EQUALS:dl,EXCLAMATION:Jf,HYPHEN:Jt,PERCENT:Rs,PIPE:pl,PLUS:ml,POUND:gl,QUERY:Ls,QUOTE:jf,FULLWIDTHMIDDLEDOT:v1,SEMI:Yf,SLASH:yn,TILDE:Ps,UNDERSCORE:yl,EMOJI:S1,SYM:bl});const Hn=/[a-z]/,Ds=/\p{L}/u,Xf=/\p{Emoji}/u,Wn=/\d/,Zf=/\s/,C1="\r",Qf=`
42
+ `,HM="\uFE0F",WM="\u200D",eh="\uFFFC";let _l=null,wl=null;function VM(n=[]){const e={};_t.groups=e;const t=new _t;_l==null&&(_l=k1(PM)),wl==null&&(wl=k1(DM)),$(t,"'",Kf),$(t,"{",Is),$(t,"}",Ns),$(t,"[",Ga),$(t,"]",Ja),$(t,"(",ja),$(t,")",Ya),$(t,"<",Xa),$(t,">",Za),$(t,"\uFF08",Qa),$(t,"\uFF09",el),$(t,"\u300C",tl),$(t,"\u300D",nl),$(t,"\u300E",rl),$(t,"\u300F",il),$(t,"\uFF1C",sl),$(t,"\uFF1E",ol),$(t,"&",al),$(t,"*",ll),$(t,"@",wr),$(t,"`",cl),$(t,"^",fl),$(t,":",vr),$(t,",",Gf),$(t,"$",hl),$(t,".",gn),$(t,"=",dl),$(t,"!",Jf),$(t,"-",Jt),$(t,"%",Rs),$(t,"|",pl),$(t,"+",ml),$(t,"#",gl),$(t,"?",Ls),$(t,'"',jf),$(t,"/",yn),$(t,";",Yf),$(t,"~",Ps),$(t,"_",yl),$(t,"\\",ul),$(t,"\u30FB",v1);const r=Ne(t,Wn,Vf,{[Pf]:!0});Ne(r,Wn,r);const i=Ne(r,Hn,_1,{[As]:!0}),s=Ne(r,Ds,w1,{[Ms]:!0}),a=Ne(t,Hn,$n,{[Df]:!0});Ne(a,Wn,i),Ne(a,Hn,a),Ne(i,Wn,i),Ne(i,Hn,i);const u=Ne(t,Ds,$f,{[Ff]:!0});Ne(u,Hn),Ne(u,Wn,s),Ne(u,Ds,u),Ne(s,Wn,s),Ne(s,Hn),Ne(s,Ds,s);const c=$(t,Qf,qf,{[zf]:!0}),h=$(t,C1,Uf,{[zf]:!0}),p=Ne(t,Zf,Uf,{[zf]:!0});$(t,eh,p),$(h,Qf,c),$(h,eh,p),Ne(h,Zf,p),$(p,C1),$(p,Qf),Ne(p,Zf,p),$(p,eh,p);const m=Ne(t,Xf,S1,{[y1]:!0});$(m,"#"),Ne(m,Xf,m),$(m,HM,m);const y=$(m,WM);$(y,"#"),Ne(y,Xf,m);const _=[[Hn,a],[Wn,i]],S=[[Hn,null],[Ds,u],[Wn,s]];for(let E=0;E<_l.length;E++)Sr(t,_l[E],Hf,$n,_);for(let E=0;E<wl.length;E++)Sr(t,wl[E],Wf,$f,S);Jr(Hf,{tld:!0,ascii:!0},e),Jr(Wf,{utld:!0,alpha:!0},e),Sr(t,"file",Ka,$n,_),Sr(t,"mailto",Ka,$n,_),Sr(t,"http",Ni,$n,_),Sr(t,"https",Ni,$n,_),Sr(t,"ftp",Ni,$n,_),Sr(t,"ftps",Ni,$n,_),Jr(Ka,{scheme:!0,ascii:!0},e),Jr(Ni,{slashscheme:!0,ascii:!0},e),n=n.sort((E,N)=>E[0]>N[0]?1:-1);for(let E=0;E<n.length;E++){const N=n[E][0],v=n[E][1]?{[FM]:!0}:{[BM]:!0};N.indexOf("-")>=0?v[Bf]=!0:Hn.test(N)?Wn.test(N)?v[As]=!0:v[Df]=!0:v[Pf]=!0,b1(t,N,N,v)}return b1(t,"localhost",Os,{ascii:!0}),t.jd=new _t(bl),{start:t,tokens:Ii({groups:e},x1)}}function E1(n,e){const t=UM(e.replace(/[A-Z]/g,u=>u.toLowerCase())),r=t.length,i=[];let s=0,a=0;for(;a<r;){let u=n,c=null,h=0,p=null,m=-1,y=-1;for(;a<r&&(c=u.go(t[a]));)u=c,u.accepts()?(m=0,y=0,p=u):m>=0&&(m+=t[a].length,y++),h+=t[a].length,s+=t[a].length,a++;s-=m,a-=y,h-=m,i.push({t:p.t,v:e.slice(s-h,s),s:s-h,e:s})}return i}function UM(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,a=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function Sr(n,e,t,r,i){let s;const a=e.length;for(let u=0;u<a-1;u++){const c=e[u];n.j[c]?s=n.j[c]:(s=new _t(r),s.jr=i.slice(),n.j[c]=s),n=s}return s=new _t(t),s.jr=i.slice(),n.j[e[a-1]]=s,s}function k1(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+s),10);a>0;a--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Fs={defaultProtocol:"http",events:null,format:T1,formatHref:T1,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function th(n,e=null){let t=Ii({},Fs);n&&(t=Ii(t,n instanceof th?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}th.prototype={o:Fs,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]:Fs[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 T1(n){return n}function A1(n,e){this.t="token",this.v=n,this.tk=e}A1.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=Fs.defaultProtocol){return{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),s=this.toFormattedString(n),a={},u=n.get("className",t,e),c=n.get("target",t,e),h=n.get("rel",t,e),p=n.getObj("attributes",t,e),m=n.getObj("events",t,e);return a.href=r,u&&(a.class=u),c&&(a.target=c),h&&(a.rel=h),p&&Ii(a,p),{tagName:i,attributes:a,content:s,eventListeners:m}}};function vl(n,e){class t extends A1{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const M1=vl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),O1=vl("text"),qM=vl("nl"),Sl=vl("url",{isLink:!0,toHref(n=Fs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Os&&n[1].t===vr}}),jt=n=>new _t(n);function KM({groups:n}){const e=n.domain.concat([al,ll,wr,ul,cl,fl,hl,dl,Jt,Vf,Rs,pl,ml,gl,yn,bl,Ps,yl]),t=[vr,Gf,gn,Jf,Rs,Ls,jf,Yf,Xa,Za,Is,Ns,Ja,Ga,ja,Ya,Qa,el,tl,nl,rl,il,sl,ol],r=[al,Kf,ll,ul,cl,fl,hl,dl,Jt,Is,Ns,Rs,pl,ml,gl,Ls,yn,bl,Ps,yl],i=jt(),s=$(i,Ps);ae(s,r,s),ae(s,n.domain,s);const a=jt(),u=jt(),c=jt();ae(i,n.domain,a),ae(i,n.scheme,u),ae(i,n.slashscheme,c),ae(a,r,s),ae(a,n.domain,a);const h=$(a,wr);$(s,wr,h),$(u,wr,h),$(c,wr,h);const p=$(s,gn);ae(p,r,s),ae(p,n.domain,s);const m=jt();ae(h,n.domain,m),ae(m,n.domain,m);const y=$(m,gn);ae(y,n.domain,m);const _=jt(M1);ae(y,n.tld,_),ae(y,n.utld,_),$(h,Os,_);const S=$(m,Jt);$(S,Jt,S),ae(S,n.domain,m),ae(_,n.domain,m),$(_,gn,y),$(_,Jt,S);const E=$(_,vr);ae(E,n.numeric,M1);const N=$(a,Jt),g=$(a,gn);$(N,Jt,N),ae(N,n.domain,a),ae(g,r,s),ae(g,n.domain,a);const v=jt(Sl);ae(g,n.tld,v),ae(g,n.utld,v),ae(v,n.domain,a),ae(v,r,s),$(v,gn,g),$(v,Jt,N),$(v,wr,h);const k=$(v,vr),T=jt(Sl);ae(k,n.numeric,T);const A=jt(Sl),F=jt();ae(A,e,A),ae(A,t,F),ae(F,e,A),ae(F,t,F),$(v,yn,A),$(T,yn,A);const U=$(u,vr),V=$(c,vr),ee=$(V,yn),te=$(ee,yn);ae(u,n.domain,a),$(u,gn,g),$(u,Jt,N),ae(c,n.domain,a),$(c,gn,g),$(c,Jt,N),ae(U,n.domain,A),$(U,yn,A),$(U,Ls,A),ae(te,n.domain,A),ae(te,e,A),$(te,yn,A);const Se=[[Is,Ns],[Ga,Ja],[ja,Ya],[Xa,Za],[Qa,el],[tl,nl],[rl,il],[sl,ol]];for(let vt=0;vt<Se.length;vt++){const[Sn,Ft]=Se[vt],xn=$(A,Sn);$(F,Sn,xn),$(xn,Ft,A);const We=jt(Sl);ae(xn,e,We);const St=jt();ae(xn,t),ae(We,e,We),ae(We,t,St),ae(St,e,We),ae(St,t,St),$(We,Ft,A),$(St,Ft,A)}return $(i,Os,v),$(i,qf,qM),{start:i,tokens:x1}}function GM(n,e,t){let r=t.length,i=0,s=[],a=[];for(;i<r;){let u=n,c=null,h=null,p=0,m=null,y=-1;for(;i<r&&!(c=u.go(t[i].t));)a.push(t[i++]);for(;i<r&&(h=c||u.go(t[i].t));)c=null,u=h,u.accepts()?(y=0,m=u):y>=0&&y++,i++,p++;if(y<0)i-=p,i<r&&(a.push(t[i]),i++);else{a.length>0&&(s.push(nh(O1,e,a)),a=[]),i-=y,p-=y;const _=m.t,S=t.slice(i-p,i);s.push(nh(_,e,S))}}return a.length>0&&s.push(nh(O1,e,a)),s}function nh(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const JM=typeof console<"u"&&console&&console.warn||(()=>{}),jM="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Te={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function YM(){return _t.groups={},Te.scanner=null,Te.parser=null,Te.tokenQueue=[],Te.pluginQueue=[],Te.customSchemes=[],Te.initialized=!1,Te}function I1(n,e=!1){if(Te.initialized&&JM(`linkifyjs: already initialized - will not register custom scheme "${n}" ${jM}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
43
43
  1. Must only contain digits, lowercase ASCII letters or "-"
44
44
  2. Cannot start or end with "-"
45
- 3. "-" cannot repeat`);ke.customSchemes.push([n,e])}function YO(){ke.scanner=WO(ke.customSchemes);for(let n=0;n<ke.tokenQueue.length;n++)ke.tokenQueue[n][1]({scanner:ke.scanner});ke.parser=qO(ke.scanner.tokens);for(let n=0;n<ke.pluginQueue.length;n++)ke.pluginQueue[n][1]({scanner:ke.scanner,parser:ke.parser});return ke.initialized=!0,ke}function xl(n){return ke.initialized||YO(),KO(ke.parser.start,n,E1(ke.scanner.start,n))}xl.scan=E1;function N1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new th(t),i=xl(n),s=[];for(let a=0;a<i.length;a++){const u=i[a];u.isLink&&(!e||u.t===e)&&r.check(u)&&s.push(u.toFormattedObject(r))}return s}function XO(n,e=null){const t=xl(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class ZO extends Lf{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(),s=XO(i);if(!i||!s)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return kh.query(t,{typeName:oe.TEXT,mark:{typeName:Oe.LINK},getMark:{typeName:Oe.LINK}})?.attrs||{href:e}}}function W(n){return(...e)=>t=>n(t,...e)}function Cl(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const s=r.replace(/_/g,"-");return`${t}--zw-${s}:${i};`},"");return e?{style:e}:null}function Jr(n){const e=Cl(n);return["span",e?{...e,class:"zw-style"}:{},0]}function QO(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Yt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var eM=Object.defineProperty,tM=(n,e,t)=>e in n?eM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Vn=(n,e,t)=>tM(n,typeof e!="symbol"?e+"":e,t),R1,L1,P1;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(c=>c[u])),s=n.map(a=>i.map(u=>{let c=0;if(!Array.isArray(a)){for(let h of u)c+=a*h;return c}for(let h=0;h<a.length;h++)c+=a[h]*(u[h]||0);return c}));return t===1&&(s=s[0]),r===1?s.map(a=>a[0]):s}function D1(n){return Bs(n)==="string"}function Bs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function rh(n,{precision:e,unit:t}){return ih(n)?"none":nM(n,e)+(t??"")}function ih(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function nM(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 rM={deg:1,grad:.9,rad:180/Math.PI,turn:360};function iM(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 s=n.match(e);if(s){let a=[];return s[2].replace(i,(u,c)=>{let h=c.match(r),p=c;if(h){let m=h[0],y=p.slice(0,-m.length);m==="%"?(p=new Number(y/100),p.type="<percentage>"):(p=new Number(y*rM[m]),p.type="<angle>",p.unit=m)}else t.test(p)?(p=new Number(p),p.type="<number>"):p==="none"&&(p=new Number(NaN),p.none=!0);u.startsWith("/")&&(p=p instanceof Number?p:new Number(p),p.alpha=!0),typeof p=="object"&&p instanceof Number&&(p.raw=c),a.push(p)}),{name:s[1].toLowerCase(),rawName:s[1],rawArgs:s[2],args:a}}}function sM(n){return n[n.length-1]}function F1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function oM(n,e,t){return(t-n)/(e-n)}function B1(n,e,t){return F1(e[0],e[1],oM(n[0],n[1],t))}function aM(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 lM(n,e,t){return Math.max(Math.min(t,e),n)}function sh(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function Un(n,e){return sh(Math.abs(n)**e,n)}function z1(n,e){return e===0?0:n/e}function uM(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 cM{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 El=new cM,qn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function oh(n){return Array.isArray(n)?n:qn[n]}function kl(n,e,t,r={}){if(n=oh(n),e=oh(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(El.run("chromatic-adaptation-start",i),i.M||(i.W1===qn.D65&&i.W2===qn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===qn.D50&&i.W2===qn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),El.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 zs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((P1=(L1=(R1=globalThis?.process)==null?void 0:R1.env)==null?void 0:L1.NODE_ENV)==null?void 0:P1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},fM=new Set(["<number>","<percentage>","<angle>"]);function $1(n,e,t,r){return Object.entries(n.coords).map(([s,a],u)=>{let c=e.coordGrammar[u],h=r[u],p=h?.type,m;if(h.none?m=c.find(S=>fM.has(S)):m=c.find(S=>S==p),!m){let S=a.name||s;throw new TypeError(`${p??h.raw} not allowed for ${S} in ${t}()`)}let y=m.range;p==="<percentage>"&&(y||(y=[0,1]));let _=a.range||a.refRange;return y&&_&&(r[u]=B1(y,_,r[u])),m})}function H1(n,{meta:e}={}){var t,r,i,s;let a={str:(t=String(n))==null?void 0:t.trim()};if(El.run("parse-start",a),a.color)return a.color;if(a.parsed=iM(a.str),a.parsed){let u=a.parsed.name;if(u==="color"){let c=a.parsed.args.shift(),h=c.startsWith("--")?c.substring(2):`--${c}`,p=[c,h],m=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let S of le.all){let E=S.getFormat("color");if(E&&(p.includes(E.id)||(r=E.ids)!=null&&r.filter(N=>p.includes(N)).length)){const N=Object.keys(S.coords).map((v,k)=>a.parsed.args[k]||0);let g;return E.coordGrammar&&(g=$1(S,E,"color",N)),e&&Object.assign(e,{formatId:"color",types:g}),E.id.startsWith("--")&&!c.startsWith("--")&&zs.warn(`${S.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${E.id}) instead of color(${c}).`),c.startsWith("--")&&!E.id.startsWith("--")&&zs.warn(`${S.name} is a standard space and supported in the CSS spec. Use color(${E.id}) instead of prefixed color(${c}).`),{spaceId:S.id,coords:N,alpha:m}}}let y="",_=c in le.registry?c:h;if(_ in le.registry){let S=(s=(i=le.registry[_].formats)==null?void 0:i.color)==null?void 0:s.id;S&&(y=`Did you mean color(${S})?`)}throw new TypeError(`Cannot parse color(${c}). `+(y||"Missing a plugin?"))}else for(let c of le.all){let h=c.getFormat(u);if(h&&h.type==="function"){let p=1;(h.lastAlpha||sM(a.parsed.args).alpha)&&(p=a.parsed.args.pop());let m=a.parsed.args,y;return h.coordGrammar&&(y=$1(c,h,u,m)),e&&Object.assign(e,{formatId:h.name,types:y}),{spaceId:c.id,coords:m,alpha:p}}}}else for(let u of le.all)for(let c in u.formats){let h=u.formats[c];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let p=h.parse(a.str);if(p)return p.alpha??(p.alpha=1),e&&(e.formatId=c),p}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ge(n){if(Array.isArray(n))return n.map(Ge);if(!n)throw new TypeError("Empty color reference");D1(n)&&(n=H1(n));let e=n.space||n.spaceId;return e instanceof le||(n.space=le.get(e)),n.alpha===void 0&&(n.alpha=1),n}const hM=75e-6,ah=class ln{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?ln.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 s in r)"name"in r[s]||(r[s].name=s);this.coords=r;let i=e.white??this.base.white??"D65";this.white=oh(i),this.formats=e.formats??{};for(let s in this.formats){let a=this.formats[s];a.type||(a.type="function"),a.name||(a.name=s)}(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:ln.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(s,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:dM(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),El.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=hM}={}){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,s)=>{let a=r[s];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[u,c]=a.range;return(u===void 0||i>=u-t)&&(c===void 0||i<=c+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=W1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=W1(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=Ge(e);[e,t]=[u.space,u.coords]}if(e=ln.get(e),this.equals(e))return t;t=t.map(u=>Number.isNaN(u)?0:u);let r=this.path,i=e.path,s,a;for(let u=0;u<r.length&&r[u].equals(i[u]);u++)s=r[u],a=u;if(!s)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=Ge(e);[e,t]=[r.space,r.coords]}return e=ln.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(ln.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 ln)return e;if(Bs(e)==="string"){let i=ln.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return ln.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Bs(e),s,a;if(i==="string"?e.includes(".")?[s,a]=e.split("."):[s,a]=[,e]:Array.isArray(e)?[s,a]=e:(s=e.space,a=e.coordId),s=ln.get(s),s||(s=t),!s)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Bs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(s.coords)[a];if(h)return{space:s,id:h[0],index:a,...h[1]}}s=ln.get(s);let u=a.toLowerCase(),c=0;for(let h in s.coords){let p=s.coords[h];if(h.toLowerCase()===u||((r=p.name)==null?void 0:r.toLowerCase())===u)return{space:s,id:h,index:c,...p};c++}throw new TypeError(`No "${a}" coordinate found in ${s.name}. Its coordinates are: ${Object.keys(s.coords).join(", ")}`)}};Vn(ah,"registry",{}),Vn(ah,"DEFAULT_FORMAT",{type:"functions",name:"color"});let le=ah;function dM(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function W1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=aM(n.coords);let t=Object.entries(e).map(([r,i],s)=>{let a=n.coordGrammar[s][0],u=i.range||i.refRange,c=a.range,h="";return a=="<percentage>"?(c=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:u,toRange:c,suffix:h}});n.serializeCoords=(r,i)=>r.map((s,a)=>{let{fromRange:u,toRange:c,suffix:h}=t[a];return u&&c&&(s=B1(u,c,s)),s=rh(s,{precision:i,unit:h}),s})}return n}const Kn=new le({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 V1 extends le{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=Kn),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=kl(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=kl(this.base.white,this.white,t),$e(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function lh(n,e){return n=Ge(n),!e||n.space.equals(e)?n.coords.slice():(e=le.get(e),e.from(n))}function Gn(n,e){n=Ge(n);let{space:t,index:r}=le.resolveCoord(e,n.space);return lh(n,t)[r]}function U1(n,e,t){return n=Ge(n),e=le.get(e),n.coords=e.to(n.space,t),n}U1.returns="color";function uh(n,e,t){if(n=Ge(n),arguments.length===2&&Bs(arguments[1])==="object"){let r=arguments[1];for(let i in r)uh(n,i,r[i])}else{typeof t=="function"&&(t=t(Gn(n,e)));let{space:r,index:i}=le.resolveCoord(e,n.space),s=lh(n,r);s[i]=t,U1(n,r,s)}return n}uh.returns="color";const pM=new le({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Kn,fromBase:n=>kl(Kn.white,"D50",n),toBase:n=>kl("D50",Kn.white,n)}),mM=216/24389,q1=24/116,Al=24389/27;let ch=qn.D50;const Jn=new le({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ch,base:pM,fromBase(n){let t=n.map((r,i)=>r/ch[i]).map(r=>r>mM?Math.cbrt(r):(Al*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]>q1?Math.pow(e[0],3):(116*e[0]-16)/Al,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/Al,e[2]>q1?Math.pow(e[2],3):(116*e[2]-16)/Al].map((r,i)=>r*ch[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function xr(n){return(n%360+360)%360}const Tl=new le({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:Jn,fromBase(n){let[e,t,r]=n,i;const s=.02;return Math.abs(t)<s&&Math.abs(r)<s?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>"]}}}),K1=25**7,Ol=Math.PI,G1=180/Ol,Ri=Ol/180;function J1(n){const e=n*n;return e*e*e*n}function j1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ge([n,e]);let[s,a,u]=Jn.from(n),c=Tl.from(Jn,[s,a,u])[1],[h,p,m]=Jn.from(e),y=Tl.from(Jn,[h,p,m])[1];c<0&&(c=0),y<0&&(y=0);let _=(c+y)/2,S=J1(_),E=.5*(1-Math.sqrt(S/(S+K1))),N=(1+E)*a,g=(1+E)*p,v=Math.sqrt(N**2+u**2),k=Math.sqrt(g**2+m**2),A=N===0&&u===0?0:Math.atan2(u,N),T=g===0&&m===0?0:Math.atan2(m,g);A<0&&(A+=2*Ol),T<0&&(T+=2*Ol),A*=G1,T*=G1;let F=h-s,U=k-v,H=T-A,ee=A+T,te=Math.abs(H),Se;v*k===0?Se=0:te<=180?Se=H:H>180?Se=H-360:H<-180?Se=H+360:zs.warn("the unthinkable has happened");let wt=2*Math.sqrt(k*v)*Math.sin(Se*Ri/2),Sn=(s+h)/2,Dt=(v+k)/2,xn=J1(Dt),We;v*k===0?We=ee:te<=180?We=ee/2:ee<360?We=(ee+360)/2:We=(ee-360)/2;let vt=(Sn-50)**2,Yn=1+.015*vt/Math.sqrt(20+vt),Gs=1+.045*Dt,cn=1;cn-=.17*Math.cos((We-30)*Ri),cn+=.24*Math.cos(2*We*Ri),cn+=.32*Math.cos((3*We+6)*Ri),cn-=.2*Math.cos((4*We-63)*Ri);let St=1+.015*Dt*cn,zl=30*Math.exp(-1*((We-275)/25)**2),$l=2*Math.sqrt(xn/(xn+K1)),Hl=-1*Math.sin(2*zl*Ri)*$l,Xt=(F/(t*Yn))**2;return Xt+=(U/(r*Gs))**2,Xt+=(wt/(i*St))**2,Xt+=Hl*(U/(r*Gs))*(wt/(i*St)),Math.sqrt(Xt)}const gM=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],yM=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],bM=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],_M=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],$s=new le({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Kn,fromBase(n){let t=$e(gM,n).map(r=>Math.cbrt(r));return $e(bM,t)},toBase(n){let t=$e(_M,n).map(r=>r**3);return $e(yM,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function fh(n,e){[n,e]=Ge([n,e]);let[t,r,i]=$s.from(n),[s,a,u]=$s.from(e),c=t-s,h=r-a,p=i-u;return Math.sqrt(c**2+h**2+p**2)}const wM=75e-6;function Li(n,e,{epsilon:t=wM}={}){n=Ge(n),e||(e=n.space),e=le.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function hh(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function vM(n,e,t="lab"){t=le.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((s,a,u)=>{let c=i[u];return isNaN(a)||isNaN(c)?s:s+(c-a)**2},0))}function SM(n,e){return vM(n,e,"lab")}const xM=Math.PI,Y1=xM/180;function CM(n,e,{l:t=2,c:r=1}={}){[n,e]=Ge([n,e]);let[i,s,a]=Jn.from(n),[,u,c]=Tl.from(Jn,[i,s,a]),[h,p,m]=Jn.from(e),y=Tl.from(Jn,[h,p,m])[1];u<0&&(u=0),y<0&&(y=0);let _=i-h,S=u-y,E=s-p,N=a-m,g=E**2+N**2-S**2,v=.511;i>=16&&(v=.040975*i/(1+.01765*i));let k=.0638*u/(1+.0131*u)+.638,A;Number.isNaN(c)&&(c=0),c>=164&&c<=345?A=.56+Math.abs(.2*Math.cos((c+168)*Y1)):A=.36+Math.abs(.4*Math.cos((c+35)*Y1));let T=Math.pow(u,4),F=Math.sqrt(T/(T+1900)),U=k*(F*A+1-F),H=(_/(t*v))**2;return H+=(S/(r*k))**2,H+=g/U**2,Math.sqrt(H)}const X1=203,Z1=new le({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:Kn,fromBase(n){return n.map(e=>Math.max(e*X1,0))},toBase(n){return n.map(e=>Math.max(e/X1,0))}}),Ml=1.15,Il=.66,Q1=2610/2**14,EM=2**14/2610,ey=3424/2**12,ty=2413/2**7,ny=2392/2**7,kM=1.7*2523/2**5,ry=2**5/(1.7*2523),Nl=-.56,dh=16295499532821565e-27,AM=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],TM=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],OM=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],MM=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],IM=new le({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Z1,fromBase(n){let[e,t,r]=n,i=Ml*e-(Ml-1)*r,s=Il*t-(Il-1)*e,u=$e(AM,[i,s,r]).map(function(y){let _=ey+ty*(y/1e4)**Q1,S=1+ny*(y/1e4)**Q1;return(_/S)**kM}),[c,h,p]=$e(OM,u);return[(1+Nl)*c/(1+Nl*c)-dh,h,p]},toBase(n){let[e,t,r]=n,i=(e+dh)/(1+Nl-Nl*(e+dh)),a=$e(MM,[i,t,r]).map(function(y){let _=ey-y**ry,S=ny*y**ry-ty;return 1e4*(_/S)**EM}),[u,c,h]=$e(TM,a),p=(u+(Ml-1)*h)/Ml,m=(c+(Il-1)*p)/Il;return[p,m,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),iy=new le({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:IM,fromBase(n){let[e,t,r]=n,i;const s=2e-4;return Math.abs(t)<s&&Math.abs(r)<s?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 NM(n,e){[n,e]=Ge([n,e]);let[t,r,i]=iy.from(n),[s,a,u]=iy.from(e),c=t-s,h=r-a;Number.isNaN(i)&&Number.isNaN(u)?(i=0,u=0):Number.isNaN(i)?i=u:Number.isNaN(u)&&(u=i);let p=i-u,m=2*Math.sqrt(r*a)*Math.sin(p/2*(Math.PI/180));return Math.sqrt(c**2+h**2+m**2)}const sy=3424/4096,oy=2413/128,ay=2392/128,ly=2610/16384,RM=2523/32,LM=16384/2610,uy=32/2523,PM=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],DM=[[2048/4096,2048/4096,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],FM=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],BM=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],cy=new le({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Z1,fromBase(n){let e=$e(PM,n);return zM(e)},toBase(n){let e=$M(n);return $e(BM,e)}});function zM(n){let e=n.map(function(t){let r=sy+oy*(t/1e4)**ly,i=1+ay*(t/1e4)**ly;return(r/i)**RM});return $e(DM,e)}function $M(n){return $e(FM,n).map(function(r){let i=Math.max(r**uy-sy,0),s=oy-ay*r**uy;return 1e4*(i/s)**LM})}function HM(n,e){[n,e]=Ge([n,e]);let[t,r,i]=cy.from(n),[s,a,u]=cy.from(e);return 720*Math.sqrt((t-s)**2+.25*(r-a)**2+(i-u)**2)}const WM=qn.D65,fy=.42,hy=1/fy,ph=2*Math.PI,dy=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],VM=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],UM=[[460,451,288],[460,-891,-261],[460,-220,-6300]],qM={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},jr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},KM=180/Math.PI,py=Math.PI/180;function my(n,e){return n.map(r=>{const i=Un(e*Math.abs(r)*.01,fy);return 400*sh(i,r)/(i+27.13)})}function GM(n,e){const t=100/e*27.13**hy;return n.map(r=>{const i=Math.abs(r);return sh(t*Un(i/(400-i),hy),r)})}function JM(n){let e=xr(n);e<=jr.h[0]&&(e+=360);const t=uM(jr.h,e)-1,[r,i]=jr.h.slice(t,t+2),[s,a]=jr.e.slice(t,t+2),u=jr.H[t],c=(e-r)/s;return u+100*c/(c+(i-e)/a)}function jM(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=jr.h.slice(t,t+2),[s,a]=jr.e.slice(t,t+2);return xr((e*(a*r-s*i)-100*r*a)/(e*(a-s)-100*a))}function gy(n,e,t,r,i){const s={};s.discounting=i,s.refWhite=n,s.surround=r;const a=n.map(E=>E*100);s.la=e,s.yb=t;const u=a[1],c=$e(dy,a);r=qM[s.surround];const h=r[0];s.c=r[1],s.nc=r[2];const m=(1/(5*s.la+1))**4;s.fl=m*s.la+.1*(1-m)*(1-m)*Math.cbrt(5*s.la),s.flRoot=s.fl**.25,s.n=s.yb/u,s.z=1.48+Math.sqrt(s.n),s.nbb=.725*s.n**-.2,s.ncb=s.nbb;const y=Math.max(Math.min(h*(1-1/3.6*Math.exp((-s.la-42)/92)),1),0);s.dRgb=c.map(E=>F1(1,u/E,y)),s.dRgbInv=s.dRgb.map(E=>1/E);const _=c.map((E,N)=>E*s.dRgb[N]),S=my(_,s.fl);return s.aW=s.nbb*(2*S[0]+S[1]+.05*S[2]),s}const yy=gy(WM,64/Math.PI*.2,20,"average",!1);function mh(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)*py:t=jM(n.H)*py;const r=Math.cos(t),i=Math.sin(t);let s=0;n.J!==void 0?s=Un(n.J,1/2)*.1:n.Q!==void 0&&(s=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/s:n.M!==void 0?a=n.M/e.flRoot/s:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const u=Un(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),c=.25*(Math.cos(t+2)+3.8),h=e.aW*Un(s,2/e.c/e.z),p=5e4/13*e.nc*e.ncb*c,m=h/e.nbb,y=23*(m+.305)*z1(u,23*p+u*(11*r+108*i)),_=y*r,S=y*i,E=GM($e(UM,[m,_,S]).map(N=>N*1/1403),e.fl);return $e(VM,E.map((N,g)=>N*e.dRgbInv[g])).map(N=>N/100)}function by(n,e){const t=n.map(k=>k*100),r=my($e(dy,t).map((k,A)=>k*e.dRgb[A]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,s=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(s,i)%ph+ph)%ph,u=.25*(Math.cos(a+2)+3.8),c=5e4/13*e.nc*e.ncb*z1(u*Math.sqrt(i**2+s**2),r[0]+r[1]+1.05*r[2]+.305),h=Un(c,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),p=e.nbb*(2*r[0]+r[1]+.05*r[2]),m=Un(p/e.aW,.5*e.c*e.z),y=100*Un(m,2),_=4/e.c*m*(e.aW+4)*e.flRoot,S=h*m,E=S*e.flRoot,N=xr(a*KM),g=JM(N),v=50*Un(e.c*h/(e.aW+4),1/2);return{J:y,C:S,h:N,s:v,Q:_,M:E,H:g}}new le({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:Kn,fromBase(n){const e=by(n,yy);return[e.J,e.M,e.h]},toBase(n){return mh({J:n[0],M:n[1],h:n[2]},yy)}});const YM=qn.D65,XM=216/24389,_y=24389/27;function ZM(n){return 116*(n>XM?Math.cbrt(n):(_y*n+16)/116)-16}function gh(n){return n>8?Math.pow((n+16)/116,3):n/_y}function QM(n,e){let[t,r,i]=n,s=[],a=0;if(i===0)return[0,0,0];let u=gh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const c=2e-12,h=15;let p=0,m=1/0;for(;p<=h;){s=mh({J:a,C:r,h:t},e);const y=Math.abs(s[1]-u);if(y<m){if(y<=c)return s;m=y}a=a-(s[1]-u)*a/(2*s[1]),p+=1}return mh({J:a,C:r,h:t},e)}function eI(n,e){const t=ZM(n[1]);if(t===0)return[0,0,0];const r=by(n,yh);return[xr(r.h),r.C,t]}const yh=gy(YM,200/Math.PI*gh(50),gh(50)*100,"average",!1),Rl=new le({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:Kn,fromBase(n){return eI(n)},toBase(n){return QM(n,yh)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),tI=Math.PI/180,wy=[1,.007,.0228];function vy(n){n[1]<0&&(n=Rl.fromBase(Rl.toBase(n)));const e=Math.log(Math.max(1+wy[2]*n[1]*yh.flRoot,1))/wy[2],t=n[0]*tI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function nI(n,e){[n,e]=Ge([n,e]);let[t,r,i]=vy(Rl.from(n)),[s,a,u]=vy(Rl.from(e));return Math.sqrt((t-s)**2+(r-a)**2+(i-u)**2)}const Sy={deltaE76:SM,deltaECMC:CM,deltaE2000:j1,deltaEJz:NM,deltaEITP:HM,deltaEOK:fh,deltaEHCT:nI};function rI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const xy={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 Hs(n,{method:e=zs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:s={}}={}){if(n=Ge(n),D1(arguments[1])?t=arguments[1]:t||(t=n.space),t=le.get(t),Li(n,t,{epsilon:0}))return n;let a;if(e==="css")a=iI(n,{space:t});else{if(e!=="clip"&&!Li(n,t)){Object.prototype.hasOwnProperty.call(xy,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:s}=xy[e]);let u=j1;if(r!==""){for(let h in Sy)if("deltae"+r.toLowerCase()===h.toLowerCase()){u=Sy[h];break}}let c=Hs(He(n,t),{method:"clip",space:t});if(u(n,c)>i){if(Object.keys(s).length===3){let v=le.resolveCoord(s.channel),k=Gn(He(n,v.space),v.id);if(ih(k)&&(k=0),k>=s.max)return He({space:"xyz-d65",coords:qn.D65},n.space);if(k<=s.min)return He({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=le.resolveCoord(e),p=h.space,m=h.id,y=He(n,p);y.coords.forEach((v,k)=>{ih(v)&&(y.coords[k]=0)});let S=(h.range||h.refRange)[0],E=rI(i),N=S,g=Gn(y,m);for(;g-N>E;){let v=hh(y);v=Hs(v,{space:t,method:"clip"}),u(y,v)-i<E?N=Gn(y,m):g=Gn(y,m),uh(y,m,(N+g)/2)}a=He(y,t)}else a=c}else a=He(n,t);if(e==="clip"||!Li(a,t,{epsilon:0})){let u=Object.values(t.coords).map(c=>c.range||[]);a.coords=a.coords.map((c,h)=>{let[p,m]=u[h];return p!==void 0&&(c=Math.max(p,c)),m!==void 0&&(c=Math.min(c,m)),c})}}return t!==n.space&&(a=He(a,n.space)),n.coords=a.coords,n}Hs.returns="color";const Cy={WHITE:{space:$s,coords:[1,0,0]},BLACK:{space:$s,coords:[0,0,0]}};function iI(n,{space:e}={}){n=Ge(n),e||(e=n.space),e=le.get(e);const i=le.get("oklch");if(e.isUnbounded)return He(n,e);const s=He(n,i);let a=s.coords[0];if(a>=1){const S=He(Cy.WHITE,e);return S.alpha=n.alpha,He(S,e)}if(a<=0){const S=He(Cy.BLACK,e);return S.alpha=n.alpha,He(S,e)}if(Li(s,e,{epsilon:0}))return He(s,e);function u(S){const E=He(S,e),N=Object.values(e.coords);return E.coords=E.coords.map((g,v)=>{if("range"in N[v]){const[k,A]=N[v].range;return lM(k,g,A)}return g}),E}let c=0,h=s.coords[1],p=!0,m=hh(s),y=u(m),_=fh(y,m);if(_<.02)return y;for(;h-c>1e-4;){const S=(c+h)/2;if(m.coords[1]=S,p&&Li(m,e,{epsilon:0}))c=S;else if(y=u(m),_=fh(y,m),_<.02){if(.02-_<1e-4)break;p=!1,c=S}else h=S}return y}function He(n,e,{inGamut:t}={}){n=Ge(n),e=le.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Hs(i,t===!0?void 0:t)),i}He.returns="color";function sI(n,{precision:e=zs.precision,format:t="default",inGamut:r=!0,...i}={}){var s;let a;n=Ge(n);let u=t;t=n.space.getFormat(t)??n.space.getFormat("default")??le.DEFAULT_FORMAT;let c=n.coords.slice();if(r||(r=t.toGamut),r&&!Li(n)&&(c=Hs(hh(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(c,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?c=t.serializeCoords(c,e):e!==null&&(c=c.map(_=>rh(_,{precision:e})));let p=[...c];if(h==="color"){let _=t.id||((s=t.ids)==null?void 0:s[0])||n.space.id;p.unshift(_)}let m=n.alpha;e!==null&&(m=rh(m,{precision:e}));let y=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${m}`;a=`${h}(${p.join(t.commas?", ":" ")}${y})`}return a}const oI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],aI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],lI=new V1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:oI,fromXYZ_M:aI}),Ey={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 ky=Array(3).fill("<percentage> | <number>[0, 255]"),Ay=Array(3).fill("<number>[0, 255]");const Ty=new V1({id:"srgb",name:"sRGB",base:lI,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:ky},rgb_number:{name:"rgb",commas:!0,coords:Ay,noAlpha:!0},color:{},rgba:{coords:ky,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Ay},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(s=>Math.round(s*255));let r=t&&n.every(s=>s%17===0);return"#"+n.map(s=>r?(s/17).toString(16):s.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=Ey.black,e.alpha=0):e.coords=Ey[n],e.coords)return e}}}});function uI(n){return Gn(n,[Kn,"y"])}const Oy=new le({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:Ty,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,s]=n,[a,u,c]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(u=c===0||c===1?0:(e-c)/Math.min(c,1-c),e){case r:a=(i-s)/h+(i<s?6:0);break;case i:a=(s-r)/h+2;break;case s:a=(r-i)/h+4}a=a*60}return u<0&&(a+=180,u=Math.abs(u)),a>=360&&(a-=360),[a,u*100,c*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(s){let a=(s+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}}}),cI=new le({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:Oy,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>"]}}}),fI=new le({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:$s,fromBase(n){let[e,t,r]=n,i;const s=2e-4;return Math.abs(t)<s&&Math.abs(r)<s?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,i,s;return isNaN(r)?(i=0,s=0):(i=t*Math.cos(r*Math.PI/180),s=t*Math.sin(r*Math.PI/180)),[e,i,s]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});class Pt{constructor(e){Vn(this,"data"),this.data=He(e,"srgb")}static fromTransparent(){return new Pt({spaceId:"srgb",coords:[1,1,1],alpha:0})}static fromBlack(){return new Pt({spaceId:"srgb",coords:[0,0,0],alpha:1})}static fromWhite(){return new Pt({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 Gn(this.data,"hsv.h")}get s(){return Gn(this.data,"hsv.s")}get v(){return Gn(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 uI(this.data)<.5}withAlpha(e){return new Pt({...this.data,alpha:e})}withRgb(e){const t=this.alpha===0?1:this.alpha;return new Pt({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=lh(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),s=Math.max(e.v??r[2],1e-5),a=this.alpha===0?1:this.alpha;return new Pt({alpha:a,spaceId:"hsv",coords:[e.h??r[0],i,s]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=sI(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 Pt(this.data)}}class hI{constructor(e){Vn(this,"_color"),Vn(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 My=999;function dI(){return My+=1,My}function pI(n){return n?n.startsWith("linear-gradient("):!1}function mI(){const n=Pt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}le.register(Ty),le.register(cI),le.register(Oy),le.register(fI);function Iy(n){if(!n)return Pt.fromTransparent();try{return new Pt(He(H1(n),"srgb"))}catch(e){return console.warn(e),Pt.fromBlack()}}function gI(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 yI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:Iy(t),offset:Number.parseFloat(r.replace("%",""))}})}function bI(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),s=yI(i),a=gI(r);return{isEmpty:!1,isGradient:!0,solidColor:s[0].color,angle:a,transitions:s}}function _I(n){const e=Iy(n),t=Pt.fromWhite();return{isEmpty:!1,isGradient:!1,solidColor:e,angle:0,transitions:[{color:t,offset:0},{color:e.withAlpha(1),offset:100}]}}function wI(n,e=!0){if(!n)return mI();const t=pI(n)?bI(n):_I(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class Ch{constructor(e,t=0){Vn(this,"id"),this.color=e,this.offset=t,this.id=dI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new Ch(this.color.clone(),e)}}class vI{constructor(e){Vn(this,"isEmpty",!1),Vn(this,"_angle",0),Vn(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 Ch(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function SI(n){const e=wI(n);return(e.isGradient?new vI(e):new hI(e)).toString()}function Ny(n){return SI(n)}function Ry(n,e){if(!n.includes("em"))return parseInt(n);const t=Pi.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r)}function xI(n,e){return(n.firstElementChild||n).style.fontSize||Pi.getComputedStyle(e).fontSize}function CI(n,e,t){if(!n.includes("px"))return n;const r=xI(e,t),i=Ry(r,t);return i?(parseInt(n)/i).toFixed(2):null}const EI={start:_r.LEFT,end:_r.RIGHT};function kI(n){const e=EI[n]||n;return OO.includes(e)?e:null}const Ly=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function Py(n,e){return n.resolve(e).depth+1}function AI(n,e,t,r){const i=Py(n,r),s=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return s&&a}const TI=(n,e)=>n.eq(e);function OI(n,e,t,r=TI){const i=n.resolve(e).path.slice().reverse();for(const s of i)if(typeof s!="number"){for(const a of s.marks)if(r(a,t))return!0}return!1}function MI(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var Ws={exports:{}};var II=Ws.exports,Dy;function NI(){return Dy||(Dy=1,function(n,e){(function(){var t,r="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",m=1,y=2,_=4,S=1,E=2,N=1,g=2,v=4,k=8,A=16,T=32,F=64,U=128,H=256,ee=512,te=30,Se="...",wt=800,Sn=16,Dt=1,xn=2,We=3,vt=1/0,Yn=9007199254740991,Gs=17976931348623157e292,cn=NaN,St=4294967295,zl=St-1,$l=St>>>1,Hl=[["ary",U],["bind",N],["bindKey",g],["curry",k],["curryRight",A],["flip",ee],["partial",T],["partialRight",F],["rearg",H]],Xt="[object Arguments]",Js="[object Array]",Gy="[object AsyncFunction]",$i="[object Boolean]",Hi="[object Date]",Jy="[object DOMException]",js="[object Error]",Ys="[object Function]",Ah="[object GeneratorFunction]",Zt="[object Map]",Wi="[object Number]",jy="[object Null]",Cn="[object Object]",Th="[object Promise]",Yy="[object Proxy]",Vi="[object RegExp]",Qt="[object Set]",Ui="[object String]",Xs="[object Symbol]",Xy="[object Undefined]",qi="[object WeakMap]",Zy="[object WeakSet]",Ki="[object ArrayBuffer]",Qr="[object DataView]",Wl="[object Float32Array]",Vl="[object Float64Array]",Ul="[object Int8Array]",ql="[object Int16Array]",Kl="[object Int32Array]",Gl="[object Uint8Array]",Jl="[object Uint8ClampedArray]",jl="[object Uint16Array]",Yl="[object Uint32Array]",Qy=/\b__p \+= '';/g,eb=/\b(__p \+=) '' \+/g,tb=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Oh=/&(?:amp|lt|gt|quot|#39);/g,Mh=/[&<>"']/g,nb=RegExp(Oh.source),rb=RegExp(Mh.source),ib=/<%-([\s\S]+?)%>/g,sb=/<%([\s\S]+?)%>/g,Ih=/<%=([\s\S]+?)%>/g,ob=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ab=/^\w*$/,lb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xl=/[\\^$.*+?()[\]{}|]/g,ub=RegExp(Xl.source),Zl=/^\s+/,cb=/\s/,fb=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,hb=/\{\n\/\* \[wrapped with (.+)\] \*/,db=/,? & /,pb=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,mb=/[()=,{}\[\]\/\s]/,gb=/\\(\\)?/g,yb=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nh=/\w*$/,bb=/^[-+]0x[0-9a-f]+$/i,_b=/^0b[01]+$/i,wb=/^\[object .+?Constructor\]$/,vb=/^0o[0-7]+$/i,Sb=/^(?:0|[1-9]\d*)$/,xb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,Cb=/['\n\r\u2028\u2029\\]/g,Qs="\\ud800-\\udfff",Eb="\\u0300-\\u036f",kb="\\ufe20-\\ufe2f",Ab="\\u20d0-\\u20ff",Rh=Eb+kb+Ab,Lh="\\u2700-\\u27bf",Ph="a-z\\xdf-\\xf6\\xf8-\\xff",Tb="\\xac\\xb1\\xd7\\xf7",Ob="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Mb="\\u2000-\\u206f",Ib=" \\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",Dh="A-Z\\xc0-\\xd6\\xd8-\\xde",Fh="\\ufe0e\\ufe0f",Bh=Tb+Ob+Mb+Ib,Ql="['\u2019]",Nb="["+Qs+"]",zh="["+Bh+"]",eo="["+Rh+"]",$h="\\d+",Rb="["+Lh+"]",Hh="["+Ph+"]",Wh="[^"+Qs+Bh+$h+Lh+Ph+Dh+"]",eu="\\ud83c[\\udffb-\\udfff]",Lb="(?:"+eo+"|"+eu+")",Vh="[^"+Qs+"]",tu="(?:\\ud83c[\\udde6-\\uddff]){2}",nu="[\\ud800-\\udbff][\\udc00-\\udfff]",ei="["+Dh+"]",Uh="\\u200d",qh="(?:"+Hh+"|"+Wh+")",Pb="(?:"+ei+"|"+Wh+")",Kh="(?:"+Ql+"(?:d|ll|m|re|s|t|ve))?",Gh="(?:"+Ql+"(?:D|LL|M|RE|S|T|VE))?",Jh=Lb+"?",jh="["+Fh+"]?",Db="(?:"+Uh+"(?:"+[Vh,tu,nu].join("|")+")"+jh+Jh+")*",Fb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yh=jh+Jh+Db,zb="(?:"+[Rb,tu,nu].join("|")+")"+Yh,$b="(?:"+[Vh+eo+"?",eo,tu,nu,Nb].join("|")+")",Hb=RegExp(Ql,"g"),Wb=RegExp(eo,"g"),ru=RegExp(eu+"(?="+eu+")|"+$b+Yh,"g"),Vb=RegExp([ei+"?"+Hh+"+"+Kh+"(?="+[zh,ei,"$"].join("|")+")",Pb+"+"+Gh+"(?="+[zh,ei+qh,"$"].join("|")+")",ei+"?"+qh+"+"+Kh,ei+"+"+Gh,Bb,Fb,$h,zb].join("|"),"g"),Ub=RegExp("["+Uh+Qs+Rh+Fh+"]"),qb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Kb=["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[Wl]=Ee[Vl]=Ee[Ul]=Ee[ql]=Ee[Kl]=Ee[Gl]=Ee[Jl]=Ee[jl]=Ee[Yl]=!0,Ee[Xt]=Ee[Js]=Ee[Ki]=Ee[$i]=Ee[Qr]=Ee[Hi]=Ee[js]=Ee[Ys]=Ee[Zt]=Ee[Wi]=Ee[Cn]=Ee[Vi]=Ee[Qt]=Ee[Ui]=Ee[qi]=!1;var Ce={};Ce[Xt]=Ce[Js]=Ce[Ki]=Ce[Qr]=Ce[$i]=Ce[Hi]=Ce[Wl]=Ce[Vl]=Ce[Ul]=Ce[ql]=Ce[Kl]=Ce[Zt]=Ce[Wi]=Ce[Cn]=Ce[Vi]=Ce[Qt]=Ce[Ui]=Ce[Xs]=Ce[Gl]=Ce[Jl]=Ce[jl]=Ce[Yl]=!0,Ce[js]=Ce[Ys]=Ce[qi]=!1;var Jb={\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"},jb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Yb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Xb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Zb=parseFloat,Qb=parseInt,Xh=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,e2=typeof self=="object"&&self&&self.Object===Object&&self,Xe=Xh||e2||Function("return this")(),iu=e&&!e.nodeType&&e,Ar=iu&&!0&&n&&!n.nodeType&&n,Zh=Ar&&Ar.exports===iu,su=Zh&&Xh.process,Ft=function(){try{var M=Ar&&Ar.require&&Ar.require("util").types;return M||su&&su.binding&&su.binding("util")}catch{}}(),Qh=Ft&&Ft.isArrayBuffer,ed=Ft&&Ft.isDate,td=Ft&&Ft.isMap,nd=Ft&&Ft.isRegExp,rd=Ft&&Ft.isSet,id=Ft&&Ft.isTypedArray;function xt(M,L,R){switch(R.length){case 0:return M.call(L);case 1:return M.call(L,R[0]);case 2:return M.call(L,R[0],R[1]);case 3:return M.call(L,R[0],R[1],R[2])}return M.apply(L,R)}function t2(M,L,R,G){for(var ne=-1,be=M==null?0:M.length;++ne<be;){var Be=M[ne];L(G,Be,R(Be),M)}return G}function Bt(M,L){for(var R=-1,G=M==null?0:M.length;++R<G&&L(M[R],R,M)!==!1;);return M}function n2(M,L){for(var R=M==null?0:M.length;R--&&L(M[R],R,M)!==!1;);return M}function sd(M,L){for(var R=-1,G=M==null?0:M.length;++R<G;)if(!L(M[R],R,M))return!1;return!0}function Xn(M,L){for(var R=-1,G=M==null?0:M.length,ne=0,be=[];++R<G;){var Be=M[R];L(Be,R,M)&&(be[ne++]=Be)}return be}function to(M,L){var R=M==null?0:M.length;return!!R&&ti(M,L,0)>-1}function ou(M,L,R){for(var G=-1,ne=M==null?0:M.length;++G<ne;)if(R(L,M[G]))return!0;return!1}function Ae(M,L){for(var R=-1,G=M==null?0:M.length,ne=Array(G);++R<G;)ne[R]=L(M[R],R,M);return ne}function Zn(M,L){for(var R=-1,G=L.length,ne=M.length;++R<G;)M[ne+R]=L[R];return M}function au(M,L,R,G){var ne=-1,be=M==null?0:M.length;for(G&&be&&(R=M[++ne]);++ne<be;)R=L(R,M[ne],ne,M);return R}function r2(M,L,R,G){var ne=M==null?0:M.length;for(G&&ne&&(R=M[--ne]);ne--;)R=L(R,M[ne],ne,M);return R}function lu(M,L){for(var R=-1,G=M==null?0:M.length;++R<G;)if(L(M[R],R,M))return!0;return!1}var i2=uu("length");function s2(M){return M.split("")}function o2(M){return M.match(pb)||[]}function od(M,L,R){var G;return R(M,function(ne,be,Be){if(L(ne,be,Be))return G=be,!1}),G}function no(M,L,R,G){for(var ne=M.length,be=R+(G?1:-1);G?be--:++be<ne;)if(L(M[be],be,M))return be;return-1}function ti(M,L,R){return L===L?b2(M,L,R):no(M,ad,R)}function a2(M,L,R,G){for(var ne=R-1,be=M.length;++ne<be;)if(G(M[ne],L))return ne;return-1}function ad(M){return M!==M}function ld(M,L){var R=M==null?0:M.length;return R?fu(M,L)/R:cn}function uu(M){return function(L){return L==null?t:L[M]}}function cu(M){return function(L){return M==null?t:M[L]}}function ud(M,L,R,G,ne){return ne(M,function(be,Be,xe){R=G?(G=!1,be):L(R,be,Be,xe)}),R}function l2(M,L){var R=M.length;for(M.sort(L);R--;)M[R]=M[R].value;return M}function fu(M,L){for(var R,G=-1,ne=M.length;++G<ne;){var be=L(M[G]);be!==t&&(R=R===t?be:R+be)}return R}function hu(M,L){for(var R=-1,G=Array(M);++R<M;)G[R]=L(R);return G}function u2(M,L){return Ae(L,function(R){return[R,M[R]]})}function cd(M){return M&&M.slice(0,pd(M)+1).replace(Zl,"")}function Ct(M){return function(L){return M(L)}}function du(M,L){return Ae(L,function(R){return M[R]})}function Gi(M,L){return M.has(L)}function fd(M,L){for(var R=-1,G=M.length;++R<G&&ti(L,M[R],0)>-1;);return R}function hd(M,L){for(var R=M.length;R--&&ti(L,M[R],0)>-1;);return R}function c2(M,L){for(var R=M.length,G=0;R--;)M[R]===L&&++G;return G}var f2=cu(Jb),h2=cu(jb);function d2(M){return"\\"+Xb[M]}function p2(M,L){return M==null?t:M[L]}function ni(M){return Ub.test(M)}function m2(M){return qb.test(M)}function g2(M){for(var L,R=[];!(L=M.next()).done;)R.push(L.value);return R}function pu(M){var L=-1,R=Array(M.size);return M.forEach(function(G,ne){R[++L]=[ne,G]}),R}function dd(M,L){return function(R){return M(L(R))}}function Qn(M,L){for(var R=-1,G=M.length,ne=0,be=[];++R<G;){var Be=M[R];(Be===L||Be===p)&&(M[R]=p,be[ne++]=R)}return be}function ro(M){var L=-1,R=Array(M.size);return M.forEach(function(G){R[++L]=G}),R}function y2(M){var L=-1,R=Array(M.size);return M.forEach(function(G){R[++L]=[G,G]}),R}function b2(M,L,R){for(var G=R-1,ne=M.length;++G<ne;)if(M[G]===L)return G;return-1}function _2(M,L,R){for(var G=R+1;G--;)if(M[G]===L)return G;return G}function ri(M){return ni(M)?v2(M):i2(M)}function en(M){return ni(M)?S2(M):s2(M)}function pd(M){for(var L=M.length;L--&&cb.test(M.charAt(L)););return L}var w2=cu(Yb);function v2(M){for(var L=ru.lastIndex=0;ru.test(M);)++L;return L}function S2(M){return M.match(ru)||[]}function x2(M){return M.match(Vb)||[]}var C2=function M(L){L=L==null?Xe:ii.defaults(Xe.Object(),L,ii.pick(Xe,Kb));var R=L.Array,G=L.Date,ne=L.Error,be=L.Function,Be=L.Math,xe=L.Object,mu=L.RegExp,E2=L.String,zt=L.TypeError,io=R.prototype,k2=be.prototype,si=xe.prototype,so=L["__core-js_shared__"],oo=k2.toString,ve=si.hasOwnProperty,A2=0,md=function(){var o=/[^.]+$/.exec(so&&so.keys&&so.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),ao=si.toString,T2=oo.call(xe),O2=Xe._,M2=mu("^"+oo.call(ve).replace(Xl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Zh?L.Buffer:t,er=L.Symbol,uo=L.Uint8Array,gd=lo?lo.allocUnsafe:t,co=dd(xe.getPrototypeOf,xe),yd=xe.create,bd=si.propertyIsEnumerable,fo=io.splice,_d=er?er.isConcatSpreadable:t,Ji=er?er.iterator:t,Tr=er?er.toStringTag:t,ho=function(){try{var o=Rr(xe,"defineProperty");return o({},"",{}),o}catch{}}(),I2=L.clearTimeout!==Xe.clearTimeout&&L.clearTimeout,N2=G&&G.now!==Xe.Date.now&&G.now,R2=L.setTimeout!==Xe.setTimeout&&L.setTimeout,po=Be.ceil,mo=Be.floor,gu=xe.getOwnPropertySymbols,L2=lo?lo.isBuffer:t,wd=L.isFinite,P2=io.join,D2=dd(xe.keys,xe),ze=Be.max,nt=Be.min,F2=G.now,B2=L.parseInt,vd=Be.random,z2=io.reverse,yu=Rr(L,"DataView"),ji=Rr(L,"Map"),bu=Rr(L,"Promise"),oi=Rr(L,"Set"),Yi=Rr(L,"WeakMap"),Xi=Rr(xe,"create"),go=Yi&&new Yi,ai={},$2=Lr(yu),H2=Lr(ji),W2=Lr(bu),V2=Lr(oi),U2=Lr(Yi),yo=er?er.prototype:t,Zi=yo?yo.valueOf:t,Sd=yo?yo.toString:t;function w(o){if(Ie(o)&&!re(o)&&!(o instanceof fe)){if(o instanceof $t)return o;if(ve.call(o,"__wrapped__"))return xp(o)}return new $t(o)}var li=function(){function o(){}return function(l){if(!Me(l))return{};if(yd)return yd(l);o.prototype=l;var f=new o;return o.prototype=t,f}}();function bo(){}function $t(o,l){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}w.templateSettings={escape:ib,evaluate:sb,interpolate:Ih,variable:"",imports:{_:w}},w.prototype=bo.prototype,w.prototype.constructor=w,$t.prototype=li(bo.prototype),$t.prototype.constructor=$t;function fe(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=St,this.__views__=[]}function q2(){var o=new fe(this.__wrapped__);return o.__actions__=ht(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=ht(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=ht(this.__views__),o}function K2(){if(this.__filtered__){var o=new fe(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function G2(){var o=this.__wrapped__.value(),l=this.__dir__,f=re(o),d=l<0,b=f?o.length:0,x=sw(0,b,this.__views__),C=x.start,O=x.end,I=O-C,P=d?O:C-1,D=this.__iteratees__,B=D.length,q=0,j=nt(I,this.__takeCount__);if(!f||!d&&b==I&&j==I)return Kd(o,this.__actions__);var X=[];e:for(;I--&&q<j;){P+=l;for(var se=-1,Z=o[P];++se<B;){var ce=D[se],me=ce.iteratee,At=ce.type,ot=me(Z);if(At==xn)Z=ot;else if(!ot){if(At==Dt)continue e;break e}}X[q++]=Z}return X}fe.prototype=li(bo.prototype),fe.prototype.constructor=fe;function Or(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function J2(){this.__data__=Xi?Xi(null):{},this.size=0}function j2(o){var l=this.has(o)&&delete this.__data__[o];return this.size-=l?1:0,l}function Y2(o){var l=this.__data__;if(Xi){var f=l[o];return f===c?t:f}return ve.call(l,o)?l[o]:t}function X2(o){var l=this.__data__;return Xi?l[o]!==t:ve.call(l,o)}function Z2(o,l){var f=this.__data__;return this.size+=this.has(o)?0:1,f[o]=Xi&&l===t?c:l,this}Or.prototype.clear=J2,Or.prototype.delete=j2,Or.prototype.get=Y2,Or.prototype.has=X2,Or.prototype.set=Z2;function En(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function Q2(){this.__data__=[],this.size=0}function e_(o){var l=this.__data__,f=_o(l,o);if(f<0)return!1;var d=l.length-1;return f==d?l.pop():fo.call(l,f,1),--this.size,!0}function t_(o){var l=this.__data__,f=_o(l,o);return f<0?t:l[f][1]}function n_(o){return _o(this.__data__,o)>-1}function r_(o,l){var f=this.__data__,d=_o(f,o);return d<0?(++this.size,f.push([o,l])):f[d][1]=l,this}En.prototype.clear=Q2,En.prototype.delete=e_,En.prototype.get=t_,En.prototype.has=n_,En.prototype.set=r_;function kn(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function i_(){this.size=0,this.__data__={hash:new Or,map:new(ji||En),string:new Or}}function s_(o){var l=Io(this,o).delete(o);return this.size-=l?1:0,l}function o_(o){return Io(this,o).get(o)}function a_(o){return Io(this,o).has(o)}function l_(o,l){var f=Io(this,o),d=f.size;return f.set(o,l),this.size+=f.size==d?0:1,this}kn.prototype.clear=i_,kn.prototype.delete=s_,kn.prototype.get=o_,kn.prototype.has=a_,kn.prototype.set=l_;function Mr(o){var l=-1,f=o==null?0:o.length;for(this.__data__=new kn;++l<f;)this.add(o[l])}function u_(o){return this.__data__.set(o,c),this}function c_(o){return this.__data__.has(o)}Mr.prototype.add=Mr.prototype.push=u_,Mr.prototype.has=c_;function tn(o){var l=this.__data__=new En(o);this.size=l.size}function f_(){this.__data__=new En,this.size=0}function h_(o){var l=this.__data__,f=l.delete(o);return this.size=l.size,f}function d_(o){return this.__data__.get(o)}function p_(o){return this.__data__.has(o)}function m_(o,l){var f=this.__data__;if(f instanceof En){var d=f.__data__;if(!ji||d.length<i-1)return d.push([o,l]),this.size=++f.size,this;f=this.__data__=new kn(d)}return f.set(o,l),this.size=f.size,this}tn.prototype.clear=f_,tn.prototype.delete=h_,tn.prototype.get=d_,tn.prototype.has=p_,tn.prototype.set=m_;function xd(o,l){var f=re(o),d=!f&&Pr(o),b=!f&&!d&&sr(o),x=!f&&!d&&!b&&hi(o),C=f||d||b||x,O=C?hu(o.length,E2):[],I=O.length;for(var P in o)(l||ve.call(o,P))&&!(C&&(P=="length"||b&&(P=="offset"||P=="parent")||x&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||Mn(P,I)))&&O.push(P);return O}function Cd(o){var l=o.length;return l?o[Ou(0,l-1)]:t}function g_(o,l){return No(ht(o),Ir(l,0,o.length))}function y_(o){return No(ht(o))}function _u(o,l,f){(f!==t&&!nn(o[l],f)||f===t&&!(l in o))&&An(o,l,f)}function Qi(o,l,f){var d=o[l];(!(ve.call(o,l)&&nn(d,f))||f===t&&!(l in o))&&An(o,l,f)}function _o(o,l){for(var f=o.length;f--;)if(nn(o[f][0],l))return f;return-1}function b_(o,l,f,d){return tr(o,function(b,x,C){l(d,b,f(b),C)}),d}function Ed(o,l){return o&&hn(l,Ve(l),o)}function __(o,l){return o&&hn(l,pt(l),o)}function An(o,l,f){l=="__proto__"&&ho?ho(o,l,{configurable:!0,enumerable:!0,value:f,writable:!0}):o[l]=f}function wu(o,l){for(var f=-1,d=l.length,b=R(d),x=o==null;++f<d;)b[f]=x?t:ec(o,l[f]);return b}function Ir(o,l,f){return o===o&&(f!==t&&(o=o<=f?o:f),l!==t&&(o=o>=l?o:l)),o}function Ht(o,l,f,d,b,x){var C,O=l&m,I=l&y,P=l&_;if(f&&(C=b?f(o,d,b,x):f(o)),C!==t)return C;if(!Me(o))return o;var D=re(o);if(D){if(C=aw(o),!O)return ht(o,C)}else{var B=rt(o),q=B==Ys||B==Ah;if(sr(o))return jd(o,O);if(B==Cn||B==Xt||q&&!b){if(C=I||q?{}:pp(o),!O)return I?Y_(o,__(C,o)):j_(o,Ed(C,o))}else{if(!Ce[B])return b?o:{};C=lw(o,B,O)}}x||(x=new tn);var j=x.get(o);if(j)return j;x.set(o,C),Vp(o)?o.forEach(function(Z){C.add(Ht(Z,l,f,Z,o,x))}):Hp(o)&&o.forEach(function(Z,ce){C.set(ce,Ht(Z,l,f,ce,o,x))});var X=P?I?$u:zu:I?pt:Ve,se=D?t:X(o);return Bt(se||o,function(Z,ce){se&&(ce=Z,Z=o[ce]),Qi(C,ce,Ht(Z,l,f,ce,o,x))}),C}function w_(o){var l=Ve(o);return function(f){return kd(f,o,l)}}function kd(o,l,f){var d=f.length;if(o==null)return!d;for(o=xe(o);d--;){var b=f[d],x=l[b],C=o[b];if(C===t&&!(b in o)||!x(C))return!1}return!0}function Ad(o,l,f){if(typeof o!="function")throw new zt(a);return as(function(){o.apply(t,f)},l)}function es(o,l,f,d){var b=-1,x=to,C=!0,O=o.length,I=[],P=l.length;if(!O)return I;f&&(l=Ae(l,Ct(f))),d?(x=ou,C=!1):l.length>=i&&(x=Gi,C=!1,l=new Mr(l));e:for(;++b<O;){var D=o[b],B=f==null?D:f(D);if(D=d||D!==0?D:0,C&&B===B){for(var q=P;q--;)if(l[q]===B)continue e;I.push(D)}else x(l,B,d)||I.push(D)}return I}var tr=ep(fn),Td=ep(Su,!0);function v_(o,l){var f=!0;return tr(o,function(d,b,x){return f=!!l(d,b,x),f}),f}function wo(o,l,f){for(var d=-1,b=o.length;++d<b;){var x=o[d],C=l(x);if(C!=null&&(O===t?C===C&&!kt(C):f(C,O)))var O=C,I=x}return I}function S_(o,l,f,d){var b=o.length;for(f=ie(f),f<0&&(f=-f>b?0:b+f),d=d===t||d>b?b:ie(d),d<0&&(d+=b),d=f>d?0:qp(d);f<d;)o[f++]=l;return o}function Od(o,l){var f=[];return tr(o,function(d,b,x){l(d,b,x)&&f.push(d)}),f}function Ze(o,l,f,d,b){var x=-1,C=o.length;for(f||(f=cw),b||(b=[]);++x<C;){var O=o[x];l>0&&f(O)?l>1?Ze(O,l-1,f,d,b):Zn(b,O):d||(b[b.length]=O)}return b}var vu=tp(),Md=tp(!0);function fn(o,l){return o&&vu(o,l,Ve)}function Su(o,l){return o&&Md(o,l,Ve)}function vo(o,l){return Xn(l,function(f){return In(o[f])})}function Nr(o,l){l=rr(l,o);for(var f=0,d=l.length;o!=null&&f<d;)o=o[dn(l[f++])];return f&&f==d?o:t}function Id(o,l,f){var d=l(o);return re(o)?d:Zn(d,f(o))}function it(o){return o==null?o===t?Xy:jy:Tr&&Tr in xe(o)?iw(o):yw(o)}function xu(o,l){return o>l}function x_(o,l){return o!=null&&ve.call(o,l)}function C_(o,l){return o!=null&&l in xe(o)}function E_(o,l,f){return o>=nt(l,f)&&o<ze(l,f)}function Cu(o,l,f){for(var d=f?ou:to,b=o[0].length,x=o.length,C=x,O=R(x),I=1/0,P=[];C--;){var D=o[C];C&&l&&(D=Ae(D,Ct(l))),I=nt(D.length,I),O[C]=!f&&(l||b>=120&&D.length>=120)?new Mr(C&&D):t}D=o[0];var B=-1,q=O[0];e:for(;++B<b&&P.length<I;){var j=D[B],X=l?l(j):j;if(j=f||j!==0?j:0,!(q?Gi(q,X):d(P,X,f))){for(C=x;--C;){var se=O[C];if(!(se?Gi(se,X):d(o[C],X,f)))continue e}q&&q.push(X),P.push(j)}}return P}function k_(o,l,f,d){return fn(o,function(b,x,C){l(d,f(b),x,C)}),d}function ts(o,l,f){l=rr(l,o),o=bp(o,l);var d=o==null?o:o[dn(Vt(l))];return d==null?t:xt(d,o,f)}function Nd(o){return Ie(o)&&it(o)==Xt}function A_(o){return Ie(o)&&it(o)==Ki}function T_(o){return Ie(o)&&it(o)==Hi}function ns(o,l,f,d,b){return o===l?!0:o==null||l==null||!Ie(o)&&!Ie(l)?o!==o&&l!==l:O_(o,l,f,d,ns,b)}function O_(o,l,f,d,b,x){var C=re(o),O=re(l),I=C?Js:rt(o),P=O?Js:rt(l);I=I==Xt?Cn:I,P=P==Xt?Cn:P;var D=I==Cn,B=P==Cn,q=I==P;if(q&&sr(o)){if(!sr(l))return!1;C=!0,D=!1}if(q&&!D)return x||(x=new tn),C||hi(o)?fp(o,l,f,d,b,x):nw(o,l,I,f,d,b,x);if(!(f&S)){var j=D&&ve.call(o,"__wrapped__"),X=B&&ve.call(l,"__wrapped__");if(j||X){var se=j?o.value():o,Z=X?l.value():l;return x||(x=new tn),b(se,Z,f,d,x)}}return q?(x||(x=new tn),rw(o,l,f,d,b,x)):!1}function M_(o){return Ie(o)&&rt(o)==Zt}function Eu(o,l,f,d){var b=f.length,x=b,C=!d;if(o==null)return!x;for(o=xe(o);b--;){var O=f[b];if(C&&O[2]?O[1]!==o[O[0]]:!(O[0]in o))return!1}for(;++b<x;){O=f[b];var I=O[0],P=o[I],D=O[1];if(C&&O[2]){if(P===t&&!(I in o))return!1}else{var B=new tn;if(d)var q=d(P,D,I,o,l,B);if(!(q===t?ns(D,P,S|E,d,B):q))return!1}}return!0}function Rd(o){if(!Me(o)||hw(o))return!1;var l=In(o)?M2:wb;return l.test(Lr(o))}function I_(o){return Ie(o)&&it(o)==Vi}function N_(o){return Ie(o)&&rt(o)==Qt}function R_(o){return Ie(o)&&Bo(o.length)&&!!Ee[it(o)]}function Ld(o){return typeof o=="function"?o:o==null?mt:typeof o=="object"?re(o)?Fd(o[0],o[1]):Dd(o):nm(o)}function ku(o){if(!ss(o))return D2(o);var l=[];for(var f in xe(o))ve.call(o,f)&&f!="constructor"&&l.push(f);return l}function L_(o){if(!Me(o))return gw(o);var l=ss(o),f=[];for(var d in o)d=="constructor"&&(l||!ve.call(o,d))||f.push(d);return f}function Au(o,l){return o<l}function Pd(o,l){var f=-1,d=dt(o)?R(o.length):[];return tr(o,function(b,x,C){d[++f]=l(b,x,C)}),d}function Dd(o){var l=Wu(o);return l.length==1&&l[0][2]?gp(l[0][0],l[0][1]):function(f){return f===o||Eu(f,o,l)}}function Fd(o,l){return Uu(o)&&mp(l)?gp(dn(o),l):function(f){var d=ec(f,o);return d===t&&d===l?tc(f,o):ns(l,d,S|E)}}function So(o,l,f,d,b){o!==l&&vu(l,function(x,C){if(b||(b=new tn),Me(x))P_(o,l,C,f,So,d,b);else{var O=d?d(Ku(o,C),x,C+"",o,l,b):t;O===t&&(O=x),_u(o,C,O)}},pt)}function P_(o,l,f,d,b,x,C){var O=Ku(o,f),I=Ku(l,f),P=C.get(I);if(P){_u(o,f,P);return}var D=x?x(O,I,f+"",o,l,C):t,B=D===t;if(B){var q=re(I),j=!q&&sr(I),X=!q&&!j&&hi(I);D=I,q||j||X?re(O)?D=O:Le(O)?D=ht(O):j?(B=!1,D=jd(I,!0)):X?(B=!1,D=Yd(I,!0)):D=[]:ls(I)||Pr(I)?(D=O,Pr(O)?D=Kp(O):(!Me(O)||In(O))&&(D=pp(I))):B=!1}B&&(C.set(I,D),b(D,I,d,x,C),C.delete(I)),_u(o,f,D)}function Bd(o,l){var f=o.length;if(f)return l+=l<0?f:0,Mn(l,f)?o[l]:t}function zd(o,l,f){l.length?l=Ae(l,function(x){return re(x)?function(C){return Nr(C,x.length===1?x[0]:x)}:x}):l=[mt];var d=-1;l=Ae(l,Ct(Y()));var b=Pd(o,function(x,C,O){var I=Ae(l,function(P){return P(x)});return{criteria:I,index:++d,value:x}});return l2(b,function(x,C){return J_(x,C,f)})}function D_(o,l){return $d(o,l,function(f,d){return tc(o,d)})}function $d(o,l,f){for(var d=-1,b=l.length,x={};++d<b;){var C=l[d],O=Nr(o,C);f(O,C)&&rs(x,rr(C,o),O)}return x}function F_(o){return function(l){return Nr(l,o)}}function Tu(o,l,f,d){var b=d?a2:ti,x=-1,C=l.length,O=o;for(o===l&&(l=ht(l)),f&&(O=Ae(o,Ct(f)));++x<C;)for(var I=0,P=l[x],D=f?f(P):P;(I=b(O,D,I,d))>-1;)O!==o&&fo.call(O,I,1),fo.call(o,I,1);return o}function Hd(o,l){for(var f=o?l.length:0,d=f-1;f--;){var b=l[f];if(f==d||b!==x){var x=b;Mn(b)?fo.call(o,b,1):Nu(o,b)}}return o}function Ou(o,l){return o+mo(vd()*(l-o+1))}function B_(o,l,f,d){for(var b=-1,x=ze(po((l-o)/(f||1)),0),C=R(x);x--;)C[d?x:++b]=o,o+=f;return C}function Mu(o,l){var f="";if(!o||l<1||l>Yn)return f;do l%2&&(f+=o),l=mo(l/2),l&&(o+=o);while(l);return f}function ue(o,l){return Gu(yp(o,l,mt),o+"")}function z_(o){return Cd(di(o))}function $_(o,l){var f=di(o);return No(f,Ir(l,0,f.length))}function rs(o,l,f,d){if(!Me(o))return o;l=rr(l,o);for(var b=-1,x=l.length,C=x-1,O=o;O!=null&&++b<x;){var I=dn(l[b]),P=f;if(I==="__proto__"||I==="constructor"||I==="prototype")return o;if(b!=C){var D=O[I];P=d?d(D,I,O):t,P===t&&(P=Me(D)?D:Mn(l[b+1])?[]:{})}Qi(O,I,P),O=O[I]}return o}var Wd=go?function(o,l){return go.set(o,l),o}:mt,H_=ho?function(o,l){return ho(o,"toString",{configurable:!0,enumerable:!1,value:rc(l),writable:!0})}:mt;function W_(o){return No(di(o))}function Wt(o,l,f){var d=-1,b=o.length;l<0&&(l=-l>b?0:b+l),f=f>b?b:f,f<0&&(f+=b),b=l>f?0:f-l>>>0,l>>>=0;for(var x=R(b);++d<b;)x[d]=o[d+l];return x}function V_(o,l){var f;return tr(o,function(d,b,x){return f=l(d,b,x),!f}),!!f}function xo(o,l,f){var d=0,b=o==null?d:o.length;if(typeof l=="number"&&l===l&&b<=$l){for(;d<b;){var x=d+b>>>1,C=o[x];C!==null&&!kt(C)&&(f?C<=l:C<l)?d=x+1:b=x}return b}return Iu(o,l,mt,f)}function Iu(o,l,f,d){var b=0,x=o==null?0:o.length;if(x===0)return 0;l=f(l);for(var C=l!==l,O=l===null,I=kt(l),P=l===t;b<x;){var D=mo((b+x)/2),B=f(o[D]),q=B!==t,j=B===null,X=B===B,se=kt(B);if(C)var Z=d||X;else P?Z=X&&(d||q):O?Z=X&&q&&(d||!j):I?Z=X&&q&&!j&&(d||!se):j||se?Z=!1:Z=d?B<=l:B<l;Z?b=D+1:x=D}return nt(x,zl)}function Vd(o,l){for(var f=-1,d=o.length,b=0,x=[];++f<d;){var C=o[f],O=l?l(C):C;if(!f||!nn(O,I)){var I=O;x[b++]=C===0?0:C}}return x}function Ud(o){return typeof o=="number"?o:kt(o)?cn:+o}function Et(o){if(typeof o=="string")return o;if(re(o))return Ae(o,Et)+"";if(kt(o))return Sd?Sd.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}function nr(o,l,f){var d=-1,b=to,x=o.length,C=!0,O=[],I=O;if(f)C=!1,b=ou;else if(x>=i){var P=l?null:ew(o);if(P)return ro(P);C=!1,b=Gi,I=new Mr}else I=l?[]:O;e:for(;++d<x;){var D=o[d],B=l?l(D):D;if(D=f||D!==0?D:0,C&&B===B){for(var q=I.length;q--;)if(I[q]===B)continue e;l&&I.push(B),O.push(D)}else b(I,B,f)||(I!==O&&I.push(B),O.push(D))}return O}function Nu(o,l){return l=rr(l,o),o=bp(o,l),o==null||delete o[dn(Vt(l))]}function qd(o,l,f,d){return rs(o,l,f(Nr(o,l)),d)}function Co(o,l,f,d){for(var b=o.length,x=d?b:-1;(d?x--:++x<b)&&l(o[x],x,o););return f?Wt(o,d?0:x,d?x+1:b):Wt(o,d?x+1:0,d?b:x)}function Kd(o,l){var f=o;return f instanceof fe&&(f=f.value()),au(l,function(d,b){return b.func.apply(b.thisArg,Zn([d],b.args))},f)}function Ru(o,l,f){var d=o.length;if(d<2)return d?nr(o[0]):[];for(var b=-1,x=R(d);++b<d;)for(var C=o[b],O=-1;++O<d;)O!=b&&(x[b]=es(x[b]||C,o[O],l,f));return nr(Ze(x,1),l,f)}function Gd(o,l,f){for(var d=-1,b=o.length,x=l.length,C={};++d<b;){var O=d<x?l[d]:t;f(C,o[d],O)}return C}function Lu(o){return Le(o)?o:[]}function Pu(o){return typeof o=="function"?o:mt}function rr(o,l){return re(o)?o:Uu(o,l)?[o]:Sp(_e(o))}var U_=ue;function ir(o,l,f){var d=o.length;return f=f===t?d:f,!l&&f>=d?o:Wt(o,l,f)}var Jd=I2||function(o){return Xe.clearTimeout(o)};function jd(o,l){if(l)return o.slice();var f=o.length,d=gd?gd(f):new o.constructor(f);return o.copy(d),d}function Du(o){var l=new o.constructor(o.byteLength);return new uo(l).set(new uo(o)),l}function q_(o,l){var f=l?Du(o.buffer):o.buffer;return new o.constructor(f,o.byteOffset,o.byteLength)}function K_(o){var l=new o.constructor(o.source,Nh.exec(o));return l.lastIndex=o.lastIndex,l}function G_(o){return Zi?xe(Zi.call(o)):{}}function Yd(o,l){var f=l?Du(o.buffer):o.buffer;return new o.constructor(f,o.byteOffset,o.length)}function Xd(o,l){if(o!==l){var f=o!==t,d=o===null,b=o===o,x=kt(o),C=l!==t,O=l===null,I=l===l,P=kt(l);if(!O&&!P&&!x&&o>l||x&&C&&I&&!O&&!P||d&&C&&I||!f&&I||!b)return 1;if(!d&&!x&&!P&&o<l||P&&f&&b&&!d&&!x||O&&f&&b||!C&&b||!I)return-1}return 0}function J_(o,l,f){for(var d=-1,b=o.criteria,x=l.criteria,C=b.length,O=f.length;++d<C;){var I=Xd(b[d],x[d]);if(I){if(d>=O)return I;var P=f[d];return I*(P=="desc"?-1:1)}}return o.index-l.index}function Zd(o,l,f,d){for(var b=-1,x=o.length,C=f.length,O=-1,I=l.length,P=ze(x-C,0),D=R(I+P),B=!d;++O<I;)D[O]=l[O];for(;++b<C;)(B||b<x)&&(D[f[b]]=o[b]);for(;P--;)D[O++]=o[b++];return D}function Qd(o,l,f,d){for(var b=-1,x=o.length,C=-1,O=f.length,I=-1,P=l.length,D=ze(x-O,0),B=R(D+P),q=!d;++b<D;)B[b]=o[b];for(var j=b;++I<P;)B[j+I]=l[I];for(;++C<O;)(q||b<x)&&(B[j+f[C]]=o[b++]);return B}function ht(o,l){var f=-1,d=o.length;for(l||(l=R(d));++f<d;)l[f]=o[f];return l}function hn(o,l,f,d){var b=!f;f||(f={});for(var x=-1,C=l.length;++x<C;){var O=l[x],I=d?d(f[O],o[O],O,f,o):t;I===t&&(I=o[O]),b?An(f,O,I):Qi(f,O,I)}return f}function j_(o,l){return hn(o,Vu(o),l)}function Y_(o,l){return hn(o,hp(o),l)}function Eo(o,l){return function(f,d){var b=re(f)?t2:b_,x=l?l():{};return b(f,o,Y(d,2),x)}}function ui(o){return ue(function(l,f){var d=-1,b=f.length,x=b>1?f[b-1]:t,C=b>2?f[2]:t;for(x=o.length>3&&typeof x=="function"?(b--,x):t,C&&st(f[0],f[1],C)&&(x=b<3?t:x,b=1),l=xe(l);++d<b;){var O=f[d];O&&o(l,O,d,x)}return l})}function ep(o,l){return function(f,d){if(f==null)return f;if(!dt(f))return o(f,d);for(var b=f.length,x=l?b:-1,C=xe(f);(l?x--:++x<b)&&d(C[x],x,C)!==!1;);return f}}function tp(o){return function(l,f,d){for(var b=-1,x=xe(l),C=d(l),O=C.length;O--;){var I=C[o?O:++b];if(f(x[I],I,x)===!1)break}return l}}function X_(o,l,f){var d=l&N,b=is(o);function x(){var C=this&&this!==Xe&&this instanceof x?b:o;return C.apply(d?f:this,arguments)}return x}function np(o){return function(l){l=_e(l);var f=ni(l)?en(l):t,d=f?f[0]:l.charAt(0),b=f?ir(f,1).join(""):l.slice(1);return d[o]()+b}}function ci(o){return function(l){return au(em(Qp(l).replace(Hb,"")),o,"")}}function is(o){return function(){var l=arguments;switch(l.length){case 0:return new o;case 1:return new o(l[0]);case 2:return new o(l[0],l[1]);case 3:return new o(l[0],l[1],l[2]);case 4:return new o(l[0],l[1],l[2],l[3]);case 5:return new o(l[0],l[1],l[2],l[3],l[4]);case 6:return new o(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new o(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var f=li(o.prototype),d=o.apply(f,l);return Me(d)?d:f}}function Z_(o,l,f){var d=is(o);function b(){for(var x=arguments.length,C=R(x),O=x,I=fi(b);O--;)C[O]=arguments[O];var P=x<3&&C[0]!==I&&C[x-1]!==I?[]:Qn(C,I);if(x-=P.length,x<f)return ap(o,l,ko,b.placeholder,t,C,P,t,t,f-x);var D=this&&this!==Xe&&this instanceof b?d:o;return xt(D,this,C)}return b}function rp(o){return function(l,f,d){var b=xe(l);if(!dt(l)){var x=Y(f,3);l=Ve(l),f=function(O){return x(b[O],O,b)}}var C=o(l,f,d);return C>-1?b[x?l[C]:C]:t}}function ip(o){return On(function(l){var f=l.length,d=f,b=$t.prototype.thru;for(o&&l.reverse();d--;){var x=l[d];if(typeof x!="function")throw new zt(a);if(b&&!C&&Mo(x)=="wrapper")var C=new $t([],!0)}for(d=C?d:f;++d<f;){x=l[d];var O=Mo(x),I=O=="wrapper"?Hu(x):t;I&&qu(I[0])&&I[1]==(U|k|T|H)&&!I[4].length&&I[9]==1?C=C[Mo(I[0])].apply(C,I[3]):C=x.length==1&&qu(x)?C[O]():C.thru(x)}return function(){var P=arguments,D=P[0];if(C&&P.length==1&&re(D))return C.plant(D).value();for(var B=0,q=f?l[B].apply(this,P):D;++B<f;)q=l[B].call(this,q);return q}})}function ko(o,l,f,d,b,x,C,O,I,P){var D=l&U,B=l&N,q=l&g,j=l&(k|A),X=l&ee,se=q?t:is(o);function Z(){for(var ce=arguments.length,me=R(ce),At=ce;At--;)me[At]=arguments[At];if(j)var ot=fi(Z),Tt=c2(me,ot);if(d&&(me=Zd(me,d,b,j)),x&&(me=Qd(me,x,C,j)),ce-=Tt,j&&ce<P){var Pe=Qn(me,ot);return ap(o,l,ko,Z.placeholder,f,me,Pe,O,I,P-ce)}var rn=B?f:this,Rn=q?rn[o]:o;return ce=me.length,O?me=bw(me,O):X&&ce>1&&me.reverse(),D&&I<ce&&(me.length=I),this&&this!==Xe&&this instanceof Z&&(Rn=se||is(Rn)),Rn.apply(rn,me)}return Z}function sp(o,l){return function(f,d){return k_(f,o,l(d),{})}}function Ao(o,l){return function(f,d){var b;if(f===t&&d===t)return l;if(f!==t&&(b=f),d!==t){if(b===t)return d;typeof f=="string"||typeof d=="string"?(f=Et(f),d=Et(d)):(f=Ud(f),d=Ud(d)),b=o(f,d)}return b}}function Fu(o){return On(function(l){return l=Ae(l,Ct(Y())),ue(function(f){var d=this;return o(l,function(b){return xt(b,d,f)})})})}function To(o,l){l=l===t?" ":Et(l);var f=l.length;if(f<2)return f?Mu(l,o):l;var d=Mu(l,po(o/ri(l)));return ni(l)?ir(en(d),0,o).join(""):d.slice(0,o)}function Q_(o,l,f,d){var b=l&N,x=is(o);function C(){for(var O=-1,I=arguments.length,P=-1,D=d.length,B=R(D+I),q=this&&this!==Xe&&this instanceof C?x:o;++P<D;)B[P]=d[P];for(;I--;)B[P++]=arguments[++O];return xt(q,b?f:this,B)}return C}function op(o){return function(l,f,d){return d&&typeof d!="number"&&st(l,f,d)&&(f=d=t),l=Nn(l),f===t?(f=l,l=0):f=Nn(f),d=d===t?l<f?1:-1:Nn(d),B_(l,f,d,o)}}function Oo(o){return function(l,f){return typeof l=="string"&&typeof f=="string"||(l=Ut(l),f=Ut(f)),o(l,f)}}function ap(o,l,f,d,b,x,C,O,I,P){var D=l&k,B=D?C:t,q=D?t:C,j=D?x:t,X=D?t:x;l|=D?T:F,l&=~(D?F:T),l&v||(l&=-4);var se=[o,l,b,j,B,X,q,O,I,P],Z=f.apply(t,se);return qu(o)&&_p(Z,se),Z.placeholder=d,wp(Z,o,l)}function Bu(o){var l=Be[o];return function(f,d){if(f=Ut(f),d=d==null?0:nt(ie(d),292),d&&wd(f)){var b=(_e(f)+"e").split("e"),x=l(b[0]+"e"+(+b[1]+d));return b=(_e(x)+"e").split("e"),+(b[0]+"e"+(+b[1]-d))}return l(f)}}var ew=oi&&1/ro(new oi([,-0]))[1]==vt?function(o){return new oi(o)}:oc;function lp(o){return function(l){var f=rt(l);return f==Zt?pu(l):f==Qt?y2(l):u2(l,o(l))}}function Tn(o,l,f,d,b,x,C,O){var I=l&g;if(!I&&typeof o!="function")throw new zt(a);var P=d?d.length:0;if(P||(l&=-97,d=b=t),C=C===t?C:ze(ie(C),0),O=O===t?O:ie(O),P-=b?b.length:0,l&F){var D=d,B=b;d=b=t}var q=I?t:Hu(o),j=[o,l,f,d,b,D,B,x,C,O];if(q&&mw(j,q),o=j[0],l=j[1],f=j[2],d=j[3],b=j[4],O=j[9]=j[9]===t?I?0:o.length:ze(j[9]-P,0),!O&&l&(k|A)&&(l&=-25),!l||l==N)var X=X_(o,l,f);else l==k||l==A?X=Z_(o,l,O):(l==T||l==(N|T))&&!b.length?X=Q_(o,l,f,d):X=ko.apply(t,j);var se=q?Wd:_p;return wp(se(X,j),o,l)}function up(o,l,f,d){return o===t||nn(o,si[f])&&!ve.call(d,f)?l:o}function cp(o,l,f,d,b,x){return Me(o)&&Me(l)&&(x.set(l,o),So(o,l,t,cp,x),x.delete(l)),o}function tw(o){return ls(o)?t:o}function fp(o,l,f,d,b,x){var C=f&S,O=o.length,I=l.length;if(O!=I&&!(C&&I>O))return!1;var P=x.get(o),D=x.get(l);if(P&&D)return P==l&&D==o;var B=-1,q=!0,j=f&E?new Mr:t;for(x.set(o,l),x.set(l,o);++B<O;){var X=o[B],se=l[B];if(d)var Z=C?d(se,X,B,l,o,x):d(X,se,B,o,l,x);if(Z!==t){if(Z)continue;q=!1;break}if(j){if(!lu(l,function(ce,me){if(!Gi(j,me)&&(X===ce||b(X,ce,f,d,x)))return j.push(me)})){q=!1;break}}else if(!(X===se||b(X,se,f,d,x))){q=!1;break}}return x.delete(o),x.delete(l),q}function nw(o,l,f,d,b,x,C){switch(f){case Qr:if(o.byteLength!=l.byteLength||o.byteOffset!=l.byteOffset)return!1;o=o.buffer,l=l.buffer;case Ki:return!(o.byteLength!=l.byteLength||!x(new uo(o),new uo(l)));case $i:case Hi:case Wi:return nn(+o,+l);case js:return o.name==l.name&&o.message==l.message;case Vi:case Ui:return o==l+"";case Zt:var O=pu;case Qt:var I=d&S;if(O||(O=ro),o.size!=l.size&&!I)return!1;var P=C.get(o);if(P)return P==l;d|=E,C.set(o,l);var D=fp(O(o),O(l),d,b,x,C);return C.delete(o),D;case Xs:if(Zi)return Zi.call(o)==Zi.call(l)}return!1}function rw(o,l,f,d,b,x){var C=f&S,O=zu(o),I=O.length,P=zu(l),D=P.length;if(I!=D&&!C)return!1;for(var B=I;B--;){var q=O[B];if(!(C?q in l:ve.call(l,q)))return!1}var j=x.get(o),X=x.get(l);if(j&&X)return j==l&&X==o;var se=!0;x.set(o,l),x.set(l,o);for(var Z=C;++B<I;){q=O[B];var ce=o[q],me=l[q];if(d)var At=C?d(me,ce,q,l,o,x):d(ce,me,q,o,l,x);if(!(At===t?ce===me||b(ce,me,f,d,x):At)){se=!1;break}Z||(Z=q=="constructor")}if(se&&!Z){var ot=o.constructor,Tt=l.constructor;ot!=Tt&&"constructor"in o&&"constructor"in l&&!(typeof ot=="function"&&ot instanceof ot&&typeof Tt=="function"&&Tt instanceof Tt)&&(se=!1)}return x.delete(o),x.delete(l),se}function On(o){return Gu(yp(o,t,kp),o+"")}function zu(o){return Id(o,Ve,Vu)}function $u(o){return Id(o,pt,hp)}var Hu=go?function(o){return go.get(o)}:oc;function Mo(o){for(var l=o.name+"",f=ai[l],d=ve.call(ai,l)?f.length:0;d--;){var b=f[d],x=b.func;if(x==null||x==o)return b.name}return l}function fi(o){var l=ve.call(w,"placeholder")?w:o;return l.placeholder}function Y(){var o=w.iteratee||ic;return o=o===ic?Ld:o,arguments.length?o(arguments[0],arguments[1]):o}function Io(o,l){var f=o.__data__;return fw(l)?f[typeof l=="string"?"string":"hash"]:f.map}function Wu(o){for(var l=Ve(o),f=l.length;f--;){var d=l[f],b=o[d];l[f]=[d,b,mp(b)]}return l}function Rr(o,l){var f=p2(o,l);return Rd(f)?f:t}function iw(o){var l=ve.call(o,Tr),f=o[Tr];try{o[Tr]=t;var d=!0}catch{}var b=ao.call(o);return d&&(l?o[Tr]=f:delete o[Tr]),b}var Vu=gu?function(o){return o==null?[]:(o=xe(o),Xn(gu(o),function(l){return bd.call(o,l)}))}:ac,hp=gu?function(o){for(var l=[];o;)Zn(l,Vu(o)),o=co(o);return l}:ac,rt=it;(yu&&rt(new yu(new ArrayBuffer(1)))!=Qr||ji&&rt(new ji)!=Zt||bu&&rt(bu.resolve())!=Th||oi&&rt(new oi)!=Qt||Yi&&rt(new Yi)!=qi)&&(rt=function(o){var l=it(o),f=l==Cn?o.constructor:t,d=f?Lr(f):"";if(d)switch(d){case $2:return Qr;case H2:return Zt;case W2:return Th;case V2:return Qt;case U2:return qi}return l});function sw(o,l,f){for(var d=-1,b=f.length;++d<b;){var x=f[d],C=x.size;switch(x.type){case"drop":o+=C;break;case"dropRight":l-=C;break;case"take":l=nt(l,o+C);break;case"takeRight":o=ze(o,l-C);break}}return{start:o,end:l}}function ow(o){var l=o.match(hb);return l?l[1].split(db):[]}function dp(o,l,f){l=rr(l,o);for(var d=-1,b=l.length,x=!1;++d<b;){var C=dn(l[d]);if(!(x=o!=null&&f(o,C)))break;o=o[C]}return x||++d!=b?x:(b=o==null?0:o.length,!!b&&Bo(b)&&Mn(C,b)&&(re(o)||Pr(o)))}function aw(o){var l=o.length,f=new o.constructor(l);return l&&typeof o[0]=="string"&&ve.call(o,"index")&&(f.index=o.index,f.input=o.input),f}function pp(o){return typeof o.constructor=="function"&&!ss(o)?li(co(o)):{}}function lw(o,l,f){var d=o.constructor;switch(l){case Ki:return Du(o);case $i:case Hi:return new d(+o);case Qr:return q_(o,f);case Wl:case Vl:case Ul:case ql:case Kl:case Gl:case Jl:case jl:case Yl:return Yd(o,f);case Zt:return new d;case Wi:case Ui:return new d(o);case Vi:return K_(o);case Qt:return new d;case Xs:return G_(o)}}function uw(o,l){var f=l.length;if(!f)return o;var d=f-1;return l[d]=(f>1?"& ":"")+l[d],l=l.join(f>2?", ":" "),o.replace(fb,`{
45
+ 3. "-" cannot repeat`);Te.customSchemes.push([n,e])}function XM(){Te.scanner=VM(Te.customSchemes);for(let n=0;n<Te.tokenQueue.length;n++)Te.tokenQueue[n][1]({scanner:Te.scanner});Te.parser=KM(Te.scanner.tokens);for(let n=0;n<Te.pluginQueue.length;n++)Te.pluginQueue[n][1]({scanner:Te.scanner,parser:Te.parser});return Te.initialized=!0,Te}function xl(n){return Te.initialized||XM(),GM(Te.parser.start,n,E1(Te.scanner.start,n))}xl.scan=E1;function N1(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new th(t),i=xl(n),s=[];for(let a=0;a<i.length;a++){const u=i[a];u.isLink&&(!e||u.t===e)&&r.check(u)&&s.push(u.toFormattedObject(r))}return s}function ZM(n,e=null){const t=xl(n);return t.length===1&&t[0].isLink&&(!e||t[0].t===e)}class QM extends Lf{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(),s=ZM(i);if(!i||!s)return!1;const a=this._createLinkAttrs(i,r.content);return this.editor.commands.applyLink(a),!0}_createLinkAttrs(e,t){return kh.query(t,{typeName:oe.TEXT,mark:{typeName:ke.LINK},getMark:{typeName:ke.LINK}})?.attrs||{href:e}}}function W(n){return(...e)=>t=>n(t,...e)}function Cl(n){const e=Object.entries(n).reduce((t,[r,i])=>{if(!i)return t;const s=r.replace(/_/g,"-");return`${t}--zw-${s}:${i};`},"");return e?{style:e}:null}function xr(n){const e=Cl(n);return["span",e?{...e,class:"zw-style"}:{},0]}function eO(n){return n.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}function Yt(n,...e){return({editor:t})=>(t.commands[n](...e),!0)}var tO=Object.defineProperty,nO=(n,e,t)=>e in n?tO(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Vn=(n,e,t)=>nO(n,typeof e!="symbol"?e+"":e,t),R1,L1,P1;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(c=>c[u])),s=n.map(a=>i.map(u=>{let c=0;if(!Array.isArray(a)){for(let h of u)c+=a*h;return c}for(let h=0;h<a.length;h++)c+=a[h]*(u[h]||0);return c}));return t===1&&(s=s[0]),r===1?s.map(a=>a[0]):s}function D1(n){return Bs(n)==="string"}function Bs(n){return(Object.prototype.toString.call(n).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function rh(n,{precision:e,unit:t}){return ih(n)?"none":rO(n,e)+(t??"")}function ih(n){return Number.isNaN(n)||n instanceof Number&&n?.none}function rO(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 iO={deg:1,grad:.9,rad:180/Math.PI,turn:360};function sO(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 s=n.match(e);if(s){let a=[];return s[2].replace(i,(u,c)=>{let h=c.match(r),p=c;if(h){let m=h[0],y=p.slice(0,-m.length);m==="%"?(p=new Number(y/100),p.type="<percentage>"):(p=new Number(y*iO[m]),p.type="<angle>",p.unit=m)}else t.test(p)?(p=new Number(p),p.type="<number>"):p==="none"&&(p=new Number(NaN),p.none=!0);u.startsWith("/")&&(p=p instanceof Number?p:new Number(p),p.alpha=!0),typeof p=="object"&&p instanceof Number&&(p.raw=c),a.push(p)}),{name:s[1].toLowerCase(),rawName:s[1],rawArgs:s[2],args:a}}}function oO(n){return n[n.length-1]}function F1(n,e,t){return isNaN(n)?e:isNaN(e)?n:n+(e-n)*t}function aO(n,e,t){return(t-n)/(e-n)}function B1(n,e,t){return F1(e[0],e[1],aO(n[0],n[1],t))}function lO(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 uO(n,e,t){return Math.max(Math.min(t,e),n)}function sh(n,e){return Math.sign(n)===Math.sign(e)?n:-n}function Un(n,e){return sh(Math.abs(n)**e,n)}function z1(n,e){return e===0?0:n/e}function cO(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 fO{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 El=new fO,qn={D50:[.3457/.3585,1,(1-.3457-.3585)/.3585],D65:[.3127/.329,1,(1-.3127-.329)/.329]};function oh(n){return Array.isArray(n)?n:qn[n]}function kl(n,e,t,r={}){if(n=oh(n),e=oh(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(El.run("chromatic-adaptation-start",i),i.M||(i.W1===qn.D65&&i.W2===qn.D50?i.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:i.W1===qn.D50&&i.W2===qn.D65&&(i.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),El.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 zs={gamut_mapping:"css",precision:5,deltaE:"76",verbose:((P1=(L1=(R1=globalThis?.process)==null?void 0:R1.env)==null?void 0:L1.NODE_ENV)==null?void 0:P1.toLowerCase())!=="test",warn:function(e){var t,r;this.verbose&&((r=(t=globalThis?.console)==null?void 0:t.warn)==null||r.call(t,e))}},hO=new Set(["<number>","<percentage>","<angle>"]);function $1(n,e,t,r){return Object.entries(n.coords).map(([s,a],u)=>{let c=e.coordGrammar[u],h=r[u],p=h?.type,m;if(h.none?m=c.find(S=>hO.has(S)):m=c.find(S=>S==p),!m){let S=a.name||s;throw new TypeError(`${p??h.raw} not allowed for ${S} in ${t}()`)}let y=m.range;p==="<percentage>"&&(y||(y=[0,1]));let _=a.range||a.refRange;return y&&_&&(r[u]=B1(y,_,r[u])),m})}function H1(n,{meta:e}={}){var t,r,i,s;let a={str:(t=String(n))==null?void 0:t.trim()};if(El.run("parse-start",a),a.color)return a.color;if(a.parsed=sO(a.str),a.parsed){let u=a.parsed.name;if(u==="color"){let c=a.parsed.args.shift(),h=c.startsWith("--")?c.substring(2):`--${c}`,p=[c,h],m=a.parsed.rawArgs.indexOf("/")>0?a.parsed.args.pop():1;for(let S of le.all){let E=S.getFormat("color");if(E&&(p.includes(E.id)||(r=E.ids)!=null&&r.filter(N=>p.includes(N)).length)){const N=Object.keys(S.coords).map((v,k)=>a.parsed.args[k]||0);let g;return E.coordGrammar&&(g=$1(S,E,"color",N)),e&&Object.assign(e,{formatId:"color",types:g}),E.id.startsWith("--")&&!c.startsWith("--")&&zs.warn(`${S.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${E.id}) instead of color(${c}).`),c.startsWith("--")&&!E.id.startsWith("--")&&zs.warn(`${S.name} is a standard space and supported in the CSS spec. Use color(${E.id}) instead of prefixed color(${c}).`),{spaceId:S.id,coords:N,alpha:m}}}let y="",_=c in le.registry?c:h;if(_ in le.registry){let S=(s=(i=le.registry[_].formats)==null?void 0:i.color)==null?void 0:s.id;S&&(y=`Did you mean color(${S})?`)}throw new TypeError(`Cannot parse color(${c}). `+(y||"Missing a plugin?"))}else for(let c of le.all){let h=c.getFormat(u);if(h&&h.type==="function"){let p=1;(h.lastAlpha||oO(a.parsed.args).alpha)&&(p=a.parsed.args.pop());let m=a.parsed.args,y;return h.coordGrammar&&(y=$1(c,h,u,m)),e&&Object.assign(e,{formatId:h.name,types:y}),{spaceId:c.id,coords:m,alpha:p}}}}else for(let u of le.all)for(let c in u.formats){let h=u.formats[c];if(h.type!=="custom"||h.test&&!h.test(a.str))continue;let p=h.parse(a.str);if(p)return p.alpha??(p.alpha=1),e&&(e.formatId=c),p}throw new TypeError(`Could not parse ${n} as a color. Missing a plugin?`)}function Ge(n){if(Array.isArray(n))return n.map(Ge);if(!n)throw new TypeError("Empty color reference");D1(n)&&(n=H1(n));let e=n.space||n.spaceId;return e instanceof le||(n.space=le.get(e)),n.alpha===void 0&&(n.alpha=1),n}const dO=75e-6,ah=class ln{constructor(e){var t;this.id=e.id,this.name=e.name,this.base=e.base?ln.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 s in r)"name"in r[s]||(r[s].name=s);this.coords=r;let i=e.white??this.base.white??"D65";this.white=oh(i),this.formats=e.formats??{};for(let s in this.formats){let a=this.formats[s];a.type||(a.type="function"),a.name||(a.name=s)}(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:ln.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(s,a)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:pO(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),El.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=dO}={}){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,s)=>{let a=r[s];if(a.type!=="angle"&&a.range){if(Number.isNaN(i))return!0;let[u,c]=a.range;return(u===void 0||i>=u-t)&&(c===void 0||i<=c+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=W1(e,this),e;let t;return e==="default"?t=Object.values(this.formats)[0]:t=this.formats[e],t?(t=W1(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=Ge(e);[e,t]=[u.space,u.coords]}if(e=ln.get(e),this.equals(e))return t;t=t.map(u=>Number.isNaN(u)?0:u);let r=this.path,i=e.path,s,a;for(let u=0;u<r.length&&r[u].equals(i[u]);u++)s=r[u],a=u;if(!s)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=Ge(e);[e,t]=[r.space,r.coords]}return e=ln.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(ln.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 ln)return e;if(Bs(e)==="string"){let i=ln.registry[e.toLowerCase()];if(!i)throw new TypeError(`No color space found with id = "${e}"`);return i}if(t.length)return ln.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){var r;let i=Bs(e),s,a;if(i==="string"?e.includes(".")?[s,a]=e.split("."):[s,a]=[,e]:Array.isArray(e)?[s,a]=e:(s=e.space,a=e.coordId),s=ln.get(s),s||(s=t),!s)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(i=Bs(a),i==="number"||i==="string"&&a>=0){let h=Object.entries(s.coords)[a];if(h)return{space:s,id:h[0],index:a,...h[1]}}s=ln.get(s);let u=a.toLowerCase(),c=0;for(let h in s.coords){let p=s.coords[h];if(h.toLowerCase()===u||((r=p.name)==null?void 0:r.toLowerCase())===u)return{space:s,id:h,index:c,...p};c++}throw new TypeError(`No "${a}" coordinate found in ${s.name}. Its coordinates are: ${Object.keys(s.coords).join(", ")}`)}};Vn(ah,"registry",{}),Vn(ah,"DEFAULT_FORMAT",{type:"functions",name:"color"});let le=ah;function pO(n){let e=[n];for(let t=n;t=t.base;)e.push(t);return e}function W1(n,{coords:e}={}){if(n.coords&&!n.coordGrammar){n.type||(n.type="function"),n.name||(n.name="color"),n.coordGrammar=lO(n.coords);let t=Object.entries(e).map(([r,i],s)=>{let a=n.coordGrammar[s][0],u=i.range||i.refRange,c=a.range,h="";return a=="<percentage>"?(c=[0,100],h="%"):a=="<angle>"&&(h="deg"),{fromRange:u,toRange:c,suffix:h}});n.serializeCoords=(r,i)=>r.map((s,a)=>{let{fromRange:u,toRange:c,suffix:h}=t[a];return u&&c&&(s=B1(u,c,s)),s=rh(s,{precision:i,unit:h}),s})}return n}const Kn=new le({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 V1 extends le{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=Kn),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=kl(this.white,this.base.white,r)),r}),e.fromBase??(e.fromBase=t=>(t=kl(this.base.white,this.white,t),$e(e.fromXYZ_M,t)))),e.referred??(e.referred="display"),super(e)}}function lh(n,e){return n=Ge(n),!e||n.space.equals(e)?n.coords.slice():(e=le.get(e),e.from(n))}function Gn(n,e){n=Ge(n);let{space:t,index:r}=le.resolveCoord(e,n.space);return lh(n,t)[r]}function U1(n,e,t){return n=Ge(n),e=le.get(e),n.coords=e.to(n.space,t),n}U1.returns="color";function uh(n,e,t){if(n=Ge(n),arguments.length===2&&Bs(arguments[1])==="object"){let r=arguments[1];for(let i in r)uh(n,i,r[i])}else{typeof t=="function"&&(t=t(Gn(n,e)));let{space:r,index:i}=le.resolveCoord(e,n.space),s=lh(n,r);s[i]=t,U1(n,r,s)}return n}uh.returns="color";const mO=new le({id:"xyz-d50",name:"XYZ D50",white:"D50",base:Kn,fromBase:n=>kl(Kn.white,"D50",n),toBase:n=>kl("D50",Kn.white,n)}),gO=216/24389,q1=24/116,Tl=24389/27;let ch=qn.D50;const Jn=new le({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:ch,base:mO,fromBase(n){let t=n.map((r,i)=>r/ch[i]).map(r=>r>gO?Math.cbrt(r):(Tl*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]>q1?Math.pow(e[0],3):(116*e[0]-16)/Tl,n[0]>8?Math.pow((n[0]+16)/116,3):n[0]/Tl,e[2]>q1?Math.pow(e[2],3):(116*e[2]-16)/Tl].map((r,i)=>r*ch[i])},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Cr(n){return(n%360+360)%360}const Al=new le({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:Jn,fromBase(n){let[e,t,r]=n,i;const s=.02;return Math.abs(t)<s&&Math.abs(r)<s?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Cr(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>"]}}}),K1=25**7,Ml=Math.PI,G1=180/Ml,Ri=Ml/180;function J1(n){const e=n*n;return e*e*e*n}function j1(n,e,{kL:t=1,kC:r=1,kH:i=1}={}){[n,e]=Ge([n,e]);let[s,a,u]=Jn.from(n),c=Al.from(Jn,[s,a,u])[1],[h,p,m]=Jn.from(e),y=Al.from(Jn,[h,p,m])[1];c<0&&(c=0),y<0&&(y=0);let _=(c+y)/2,S=J1(_),E=.5*(1-Math.sqrt(S/(S+K1))),N=(1+E)*a,g=(1+E)*p,v=Math.sqrt(N**2+u**2),k=Math.sqrt(g**2+m**2),T=N===0&&u===0?0:Math.atan2(u,N),A=g===0&&m===0?0:Math.atan2(m,g);T<0&&(T+=2*Ml),A<0&&(A+=2*Ml),T*=G1,A*=G1;let F=h-s,U=k-v,V=A-T,ee=T+A,te=Math.abs(V),Se;v*k===0?Se=0:te<=180?Se=V:V>180?Se=V-360:V<-180?Se=V+360:zs.warn("the unthinkable has happened");let vt=2*Math.sqrt(k*v)*Math.sin(Se*Ri/2),Sn=(s+h)/2,Ft=(v+k)/2,xn=J1(Ft),We;v*k===0?We=ee:te<=180?We=ee/2:ee<360?We=(ee+360)/2:We=(ee-360)/2;let St=(Sn-50)**2,Yn=1+.015*St/Math.sqrt(20+St),Gs=1+.045*Ft,cn=1;cn-=.17*Math.cos((We-30)*Ri),cn+=.24*Math.cos(2*We*Ri),cn+=.32*Math.cos((3*We+6)*Ri),cn-=.2*Math.cos((4*We-63)*Ri);let xt=1+.015*Ft*cn,zl=30*Math.exp(-1*((We-275)/25)**2),$l=2*Math.sqrt(xn/(xn+K1)),Hl=-1*Math.sin(2*zl*Ri)*$l,Xt=(F/(t*Yn))**2;return Xt+=(U/(r*Gs))**2,Xt+=(vt/(i*xt))**2,Xt+=Hl*(U/(r*Gs))*(vt/(i*xt)),Math.sqrt(Xt)}const yO=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],bO=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],_O=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],wO=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],$s=new le({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:Kn,fromBase(n){let t=$e(yO,n).map(r=>Math.cbrt(r));return $e(_O,t)},toBase(n){let t=$e(wO,n).map(r=>r**3);return $e(bO,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function fh(n,e){[n,e]=Ge([n,e]);let[t,r,i]=$s.from(n),[s,a,u]=$s.from(e),c=t-s,h=r-a,p=i-u;return Math.sqrt(c**2+h**2+p**2)}const vO=75e-6;function Li(n,e,{epsilon:t=vO}={}){n=Ge(n),e||(e=n.space),e=le.get(e);let r=n.coords;return e!==n.space&&(r=e.from(n)),e.inGamut(r,{epsilon:t})}function hh(n){return{space:n.space,coords:n.coords.slice(),alpha:n.alpha}}function SO(n,e,t="lab"){t=le.get(t);let r=t.from(n),i=t.from(e);return Math.sqrt(r.reduce((s,a,u)=>{let c=i[u];return isNaN(a)||isNaN(c)?s:s+(c-a)**2},0))}function xO(n,e){return SO(n,e,"lab")}const CO=Math.PI,Y1=CO/180;function EO(n,e,{l:t=2,c:r=1}={}){[n,e]=Ge([n,e]);let[i,s,a]=Jn.from(n),[,u,c]=Al.from(Jn,[i,s,a]),[h,p,m]=Jn.from(e),y=Al.from(Jn,[h,p,m])[1];u<0&&(u=0),y<0&&(y=0);let _=i-h,S=u-y,E=s-p,N=a-m,g=E**2+N**2-S**2,v=.511;i>=16&&(v=.040975*i/(1+.01765*i));let k=.0638*u/(1+.0131*u)+.638,T;Number.isNaN(c)&&(c=0),c>=164&&c<=345?T=.56+Math.abs(.2*Math.cos((c+168)*Y1)):T=.36+Math.abs(.4*Math.cos((c+35)*Y1));let A=Math.pow(u,4),F=Math.sqrt(A/(A+1900)),U=k*(F*T+1-F),V=(_/(t*v))**2;return V+=(S/(r*k))**2,V+=g/U**2,Math.sqrt(V)}const X1=203,Z1=new le({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:Kn,fromBase(n){return n.map(e=>Math.max(e*X1,0))},toBase(n){return n.map(e=>Math.max(e/X1,0))}}),Ol=1.15,Il=.66,Q1=2610/2**14,kO=2**14/2610,ey=3424/2**12,ty=2413/2**7,ny=2392/2**7,TO=1.7*2523/2**5,ry=2**5/(1.7*2523),Nl=-.56,dh=16295499532821565e-27,AO=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],MO=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],OO=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],IO=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]],NO=new le({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Z1,fromBase(n){let[e,t,r]=n,i=Ol*e-(Ol-1)*r,s=Il*t-(Il-1)*e,u=$e(AO,[i,s,r]).map(function(y){let _=ey+ty*(y/1e4)**Q1,S=1+ny*(y/1e4)**Q1;return(_/S)**TO}),[c,h,p]=$e(OO,u);return[(1+Nl)*c/(1+Nl*c)-dh,h,p]},toBase(n){let[e,t,r]=n,i=(e+dh)/(1+Nl-Nl*(e+dh)),a=$e(IO,[i,t,r]).map(function(y){let _=ey-y**ry,S=ny*y**ry-ty;return 1e4*(_/S)**kO}),[u,c,h]=$e(MO,a),p=(u+(Ol-1)*h)/Ol,m=(c+(Il-1)*p)/Il;return[p,m,h]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),iy=new le({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:NO,fromBase(n){let[e,t,r]=n,i;const s=2e-4;return Math.abs(t)<s&&Math.abs(r)<s?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Cr(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 RO(n,e){[n,e]=Ge([n,e]);let[t,r,i]=iy.from(n),[s,a,u]=iy.from(e),c=t-s,h=r-a;Number.isNaN(i)&&Number.isNaN(u)?(i=0,u=0):Number.isNaN(i)?i=u:Number.isNaN(u)&&(u=i);let p=i-u,m=2*Math.sqrt(r*a)*Math.sin(p/2*(Math.PI/180));return Math.sqrt(c**2+h**2+m**2)}const sy=3424/4096,oy=2413/128,ay=2392/128,ly=2610/16384,LO=2523/32,PO=16384/2610,uy=32/2523,DO=[[.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]],BO=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],zO=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]],cy=new le({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Z1,fromBase(n){let e=$e(DO,n);return $O(e)},toBase(n){let e=HO(n);return $e(zO,e)}});function $O(n){let e=n.map(function(t){let r=sy+oy*(t/1e4)**ly,i=1+ay*(t/1e4)**ly;return(r/i)**LO});return $e(FO,e)}function HO(n){return $e(BO,n).map(function(r){let i=Math.max(r**uy-sy,0),s=oy-ay*r**uy;return 1e4*(i/s)**PO})}function WO(n,e){[n,e]=Ge([n,e]);let[t,r,i]=cy.from(n),[s,a,u]=cy.from(e);return 720*Math.sqrt((t-s)**2+.25*(r-a)**2+(i-u)**2)}const VO=qn.D65,fy=.42,hy=1/fy,ph=2*Math.PI,dy=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],UO=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],qO=[[460,451,288],[460,-891,-261],[460,-220,-6300]],KO={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},jr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},GO=180/Math.PI,py=Math.PI/180;function my(n,e){return n.map(r=>{const i=Un(e*Math.abs(r)*.01,fy);return 400*sh(i,r)/(i+27.13)})}function JO(n,e){const t=100/e*27.13**hy;return n.map(r=>{const i=Math.abs(r);return sh(t*Un(i/(400-i),hy),r)})}function jO(n){let e=Cr(n);e<=jr.h[0]&&(e+=360);const t=cO(jr.h,e)-1,[r,i]=jr.h.slice(t,t+2),[s,a]=jr.e.slice(t,t+2),u=jr.H[t],c=(e-r)/s;return u+100*c/(c+(i-e)/a)}function YO(n){let e=(n%400+400)%400;const t=Math.floor(.01*e);e=e%100;const[r,i]=jr.h.slice(t,t+2),[s,a]=jr.e.slice(t,t+2);return Cr((e*(a*r-s*i)-100*r*a)/(e*(a-s)-100*a))}function gy(n,e,t,r,i){const s={};s.discounting=i,s.refWhite=n,s.surround=r;const a=n.map(E=>E*100);s.la=e,s.yb=t;const u=a[1],c=$e(dy,a);r=KO[s.surround];const h=r[0];s.c=r[1],s.nc=r[2];const m=(1/(5*s.la+1))**4;s.fl=m*s.la+.1*(1-m)*(1-m)*Math.cbrt(5*s.la),s.flRoot=s.fl**.25,s.n=s.yb/u,s.z=1.48+Math.sqrt(s.n),s.nbb=.725*s.n**-.2,s.ncb=s.nbb;const y=Math.max(Math.min(h*(1-1/3.6*Math.exp((-s.la-42)/92)),1),0);s.dRgb=c.map(E=>F1(1,u/E,y)),s.dRgbInv=s.dRgb.map(E=>1/E);const _=c.map((E,N)=>E*s.dRgb[N]),S=my(_,s.fl);return s.aW=s.nbb*(2*S[0]+S[1]+.05*S[2]),s}const yy=gy(VO,64/Math.PI*.2,20,"average",!1);function mh(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=Cr(n.h)*py:t=YO(n.H)*py;const r=Math.cos(t),i=Math.sin(t);let s=0;n.J!==void 0?s=Un(n.J,1/2)*.1:n.Q!==void 0&&(s=.25*e.c*n.Q/((e.aW+4)*e.flRoot));let a=0;n.C!==void 0?a=n.C/s:n.M!==void 0?a=n.M/e.flRoot/s:n.s!==void 0&&(a=4e-4*n.s**2*(e.aW+4)/e.c);const u=Un(a*Math.pow(1.64-Math.pow(.29,e.n),-.73),10/9),c=.25*(Math.cos(t+2)+3.8),h=e.aW*Un(s,2/e.c/e.z),p=5e4/13*e.nc*e.ncb*c,m=h/e.nbb,y=23*(m+.305)*z1(u,23*p+u*(11*r+108*i)),_=y*r,S=y*i,E=JO($e(qO,[m,_,S]).map(N=>N*1/1403),e.fl);return $e(UO,E.map((N,g)=>N*e.dRgbInv[g])).map(N=>N/100)}function by(n,e){const t=n.map(k=>k*100),r=my($e(dy,t).map((k,T)=>k*e.dRgb[T]),e.fl),i=r[0]+(-12*r[1]+r[2])/11,s=(r[0]+r[1]-2*r[2])/9,a=(Math.atan2(s,i)%ph+ph)%ph,u=.25*(Math.cos(a+2)+3.8),c=5e4/13*e.nc*e.ncb*z1(u*Math.sqrt(i**2+s**2),r[0]+r[1]+1.05*r[2]+.305),h=Un(c,.9)*Math.pow(1.64-Math.pow(.29,e.n),.73),p=e.nbb*(2*r[0]+r[1]+.05*r[2]),m=Un(p/e.aW,.5*e.c*e.z),y=100*Un(m,2),_=4/e.c*m*(e.aW+4)*e.flRoot,S=h*m,E=S*e.flRoot,N=Cr(a*GO),g=jO(N),v=50*Un(e.c*h/(e.aW+4),1/2);return{J:y,C:S,h:N,s:v,Q:_,M:E,H:g}}new le({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:Kn,fromBase(n){const e=by(n,yy);return[e.J,e.M,e.h]},toBase(n){return mh({J:n[0],M:n[1],h:n[2]},yy)}});const XO=qn.D65,ZO=216/24389,_y=24389/27;function QO(n){return 116*(n>ZO?Math.cbrt(n):(_y*n+16)/116)-16}function gh(n){return n>8?Math.pow((n+16)/116,3):n/_y}function eI(n,e){let[t,r,i]=n,s=[],a=0;if(i===0)return[0,0,0];let u=gh(i);i>0?a=.00379058511492914*i**2+.608983189401032*i+.9155088574762233:a=9514440756550361e-21*i**2+.08693057439788597*i-21.928975842194614;const c=2e-12,h=15;let p=0,m=1/0;for(;p<=h;){s=mh({J:a,C:r,h:t},e);const y=Math.abs(s[1]-u);if(y<m){if(y<=c)return s;m=y}a=a-(s[1]-u)*a/(2*s[1]),p+=1}return mh({J:a,C:r,h:t},e)}function tI(n,e){const t=QO(n[1]);if(t===0)return[0,0,0];const r=by(n,yh);return[Cr(r.h),r.C,t]}const yh=gy(XO,200/Math.PI*gh(50),gh(50)*100,"average",!1),Rl=new le({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:Kn,fromBase(n){return tI(n)},toBase(n){return eI(n,yh)},formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}}),nI=Math.PI/180,wy=[1,.007,.0228];function vy(n){n[1]<0&&(n=Rl.fromBase(Rl.toBase(n)));const e=Math.log(Math.max(1+wy[2]*n[1]*yh.flRoot,1))/wy[2],t=n[0]*nI,r=e*Math.cos(t),i=e*Math.sin(t);return[n[2],r,i]}function rI(n,e){[n,e]=Ge([n,e]);let[t,r,i]=vy(Rl.from(n)),[s,a,u]=vy(Rl.from(e));return Math.sqrt((t-s)**2+(r-a)**2+(i-u)**2)}const Sy={deltaE76:xO,deltaECMC:EO,deltaE2000:j1,deltaEJz:RO,deltaEITP:WO,deltaEOK:fh,deltaEHCT:rI};function iI(n){const e=n?Math.floor(Math.log10(Math.abs(n))):0;return Math.max(parseFloat(`1e${e-2}`),1e-6)}const xy={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 Hs(n,{method:e=zs.gamut_mapping,space:t=void 0,deltaEMethod:r="",jnd:i=2,blackWhiteClamp:s={}}={}){if(n=Ge(n),D1(arguments[1])?t=arguments[1]:t||(t=n.space),t=le.get(t),Li(n,t,{epsilon:0}))return n;let a;if(e==="css")a=sI(n,{space:t});else{if(e!=="clip"&&!Li(n,t)){Object.prototype.hasOwnProperty.call(xy,e)&&({method:e,jnd:i,deltaEMethod:r,blackWhiteClamp:s}=xy[e]);let u=j1;if(r!==""){for(let h in Sy)if("deltae"+r.toLowerCase()===h.toLowerCase()){u=Sy[h];break}}let c=Hs(He(n,t),{method:"clip",space:t});if(u(n,c)>i){if(Object.keys(s).length===3){let v=le.resolveCoord(s.channel),k=Gn(He(n,v.space),v.id);if(ih(k)&&(k=0),k>=s.max)return He({space:"xyz-d65",coords:qn.D65},n.space);if(k<=s.min)return He({space:"xyz-d65",coords:[0,0,0]},n.space)}let h=le.resolveCoord(e),p=h.space,m=h.id,y=He(n,p);y.coords.forEach((v,k)=>{ih(v)&&(y.coords[k]=0)});let S=(h.range||h.refRange)[0],E=iI(i),N=S,g=Gn(y,m);for(;g-N>E;){let v=hh(y);v=Hs(v,{space:t,method:"clip"}),u(y,v)-i<E?N=Gn(y,m):g=Gn(y,m),uh(y,m,(N+g)/2)}a=He(y,t)}else a=c}else a=He(n,t);if(e==="clip"||!Li(a,t,{epsilon:0})){let u=Object.values(t.coords).map(c=>c.range||[]);a.coords=a.coords.map((c,h)=>{let[p,m]=u[h];return p!==void 0&&(c=Math.max(p,c)),m!==void 0&&(c=Math.min(c,m)),c})}}return t!==n.space&&(a=He(a,n.space)),n.coords=a.coords,n}Hs.returns="color";const Cy={WHITE:{space:$s,coords:[1,0,0]},BLACK:{space:$s,coords:[0,0,0]}};function sI(n,{space:e}={}){n=Ge(n),e||(e=n.space),e=le.get(e);const i=le.get("oklch");if(e.isUnbounded)return He(n,e);const s=He(n,i);let a=s.coords[0];if(a>=1){const S=He(Cy.WHITE,e);return S.alpha=n.alpha,He(S,e)}if(a<=0){const S=He(Cy.BLACK,e);return S.alpha=n.alpha,He(S,e)}if(Li(s,e,{epsilon:0}))return He(s,e);function u(S){const E=He(S,e),N=Object.values(e.coords);return E.coords=E.coords.map((g,v)=>{if("range"in N[v]){const[k,T]=N[v].range;return uO(k,g,T)}return g}),E}let c=0,h=s.coords[1],p=!0,m=hh(s),y=u(m),_=fh(y,m);if(_<.02)return y;for(;h-c>1e-4;){const S=(c+h)/2;if(m.coords[1]=S,p&&Li(m,e,{epsilon:0}))c=S;else if(y=u(m),_=fh(y,m),_<.02){if(.02-_<1e-4)break;p=!1,c=S}else h=S}return y}function He(n,e,{inGamut:t}={}){n=Ge(n),e=le.get(e);let r=e.from(n),i={space:e,coords:r,alpha:n.alpha};return t&&(i=Hs(i,t===!0?void 0:t)),i}He.returns="color";function oI(n,{precision:e=zs.precision,format:t="default",inGamut:r=!0,...i}={}){var s;let a;n=Ge(n);let u=t;t=n.space.getFormat(t)??n.space.getFormat("default")??le.DEFAULT_FORMAT;let c=n.coords.slice();if(r||(r=t.toGamut),r&&!Li(n)&&(c=Hs(hh(n),r===!0?void 0:r).coords),t.type==="custom")if(i.precision=e,t.serialize)a=t.serialize(c,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?c=t.serializeCoords(c,e):e!==null&&(c=c.map(_=>rh(_,{precision:e})));let p=[...c];if(h==="color"){let _=t.id||((s=t.ids)==null?void 0:s[0])||n.space.id;p.unshift(_)}let m=n.alpha;e!==null&&(m=rh(m,{precision:e}));let y=n.alpha>=1||t.noAlpha?"":`${t.commas?",":" /"} ${m}`;a=`${h}(${p.join(t.commas?", ":" ")}${y})`}return a}const aI=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],lI=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],uI=new V1({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:aI,fromXYZ_M:lI}),Ey={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 ky=Array(3).fill("<percentage> | <number>[0, 255]"),Ty=Array(3).fill("<number>[0, 255]");const Ay=new V1({id:"srgb",name:"sRGB",base:uI,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:ky},rgb_number:{name:"rgb",commas:!0,coords:Ty,noAlpha:!0},color:{},rgba:{coords:ky,commas:!0,lastAlpha:!0},rgba_number:{name:"rgba",commas:!0,coords:Ty},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(s=>Math.round(s*255));let r=t&&n.every(s=>s%17===0);return"#"+n.map(s=>r?(s/17).toString(16):s.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=Ey.black,e.alpha=0):e.coords=Ey[n],e.coords)return e}}}});function cI(n){return Gn(n,[Kn,"y"])}const My=new le({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:Ay,fromBase:n=>{let e=Math.max(...n),t=Math.min(...n),[r,i,s]=n,[a,u,c]=[NaN,0,(t+e)/2],h=e-t;if(h!==0){switch(u=c===0||c===1?0:(e-c)/Math.min(c,1-c),e){case r:a=(i-s)/h+(i<s?6:0);break;case i:a=(s-r)/h+2;break;case s:a=(r-i)/h+4}a=a*60}return u<0&&(a+=180,u=Math.abs(u)),a>=360&&(a-=360),[a,u*100,c*100]},toBase:n=>{let[e,t,r]=n;e=e%360,e<0&&(e+=360),t/=100,r/=100;function i(s){let a=(s+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}}}),fI=new le({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:My,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>"]}}}),hI=new le({id:"oklch",name:"Oklch",coords:{l:{refRange:[0,1],name:"Lightness"},c:{refRange:[0,.4],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},white:"D65",base:$s,fromBase(n){let[e,t,r]=n,i;const s=2e-4;return Math.abs(t)<s&&Math.abs(r)<s?i=NaN:i=Math.atan2(r,t)*180/Math.PI,[e,Math.sqrt(t**2+r**2),Cr(i)]},toBase(n){let[e,t,r]=n,i,s;return isNaN(r)?(i=0,s=0):(i=t*Math.cos(r*Math.PI/180),s=t*Math.sin(r*Math.PI/180)),[e,i,s]},formats:{oklch:{coords:["<percentage> | <number>","<number> | <percentage>[0,1]","<number> | <angle>"]}}});class Dt{constructor(e){Vn(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 Gn(this.data,"hsv.h")}get s(){return Gn(this.data,"hsv.s")}get v(){return Gn(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 cI(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=lh(this.data,"hsv"),i=Math.max(e.s??r[1],1e-5),s=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,s]})}toString(){return this.alpha===1?this.toHexString():this.toRgbaString()}toHexString(){const e=oI(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 dI{constructor(e){Vn(this,"_color"),Vn(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 Oy=999;function pI(){return Oy+=1,Oy}function mI(n){return n?n.startsWith("linear-gradient("):!1}function gI(){const n=Dt.fromTransparent();return{isEmpty:!0,isGradient:!1,solidColor:n,angle:0,transitions:[{color:n.clone(),offset:0},{color:n.clone(),offset:100}]}}le.register(Ay),le.register(fI),le.register(My),le.register(hI);function Iy(n){if(!n)return Dt.fromTransparent();try{return new Dt(He(H1(n),"srgb"))}catch(e){return console.warn(e),Dt.fromBlack()}}function yI(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 bI(n){return n.map(e=>{const[t,r]=e.trim().split(/\s+(?![^(]*\))/);return{color:Iy(t),offset:Number.parseFloat(r.replace("%",""))}})}function _I(n){const e=n.indexOf("("),t=n.lastIndexOf(")"),[r,...i]=n.slice(e+1,t).split(/,(?![^(]*\))/),s=bI(i),a=yI(r);return{isEmpty:!1,isGradient:!0,solidColor:s[0].color,angle:a,transitions:s}}function wI(n){const e=Iy(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 vI(n,e=!0){if(!n)return gI();const t=mI(n)?_I(n):wI(n);return t.isGradient&&!e?{...t,isGradient:!1}:t}class Ch{constructor(e,t=0){Vn(this,"id"),this.color=e,this.offset=t,this.id=pI()}setOffset(e){this.offset=e}toString(){return`${this.color.toString()} ${this.offset}%`}clone(e){return new Ch(this.color.clone(),e)}}class SI{constructor(e){Vn(this,"isEmpty",!1),Vn(this,"_angle",0),Vn(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 Ch(t,r)),this.setEmpty(e.isEmpty)}hasTransition(e){return this.transitions.some(t=>t.id===e.id)}}function xI(n){const e=vI(n);return(e.isGradient?new SI(e):new dI(e)).toString()}function Ny(n){return xI(n)}function Ry(n,e){const t=Pi.getComputedStyle(e).fontSize,r=parseFloat(n)*parseFloat(t);return Math.round(r*10)/10}function Ly(n,e){return String(n).includes("em")?Math.round(Ry(n,e)):parseInt(n)}function CI(n,e){return(n.firstElementChild||n).style.fontSize||Pi.getComputedStyle(e).fontSize}function EI(n,e,t){if(!n.includes("px"))return n;const r=CI(e,t),i=Ly(r,t);return i?(parseInt(n)/i).toFixed(2):null}function kI(n,e){return String(n).includes("em")?Ry(n,e):parseFloat(n)}const TI={start:_r.LEFT,end:_r.RIGHT};function AI(n){const e=TI[n]||n;return OM.includes(e)?e:null}const Py=(n,e,t,r)=>({from:Math.max(r,n.pos),to:Math.min(r+t.nodeSize,e.pos)});function Dy(n,e){return n.resolve(e).depth+1}function MI(n,e,t,r){const i=Dy(n,r),s=e.from-i<=r,a=e.to+i>=t.nodeSize+r;return s&&a}const OI=(n,e)=>n.eq(e);function II(n,e,t,r=OI){const i=n.resolve(e).path.slice().reverse();for(const s of i)if(typeof s!="number"){for(const a of s.marks)if(r(a,t))return!0}return!1}function NI(n,e){const t=typeof e=="string"?e:e.name;return n.find(r=>r.type.name===t)}var Ws={exports:{}};var RI=Ws.exports,Fy;function LI(){return Fy||(Fy=1,function(n,e){(function(){var t,r="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",a="Expected a function",u="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",h=500,p="__lodash_placeholder__",m=1,y=2,_=4,S=1,E=2,N=1,g=2,v=4,k=8,T=16,A=32,F=64,U=128,V=256,ee=512,te=30,Se="...",vt=800,Sn=16,Ft=1,xn=2,We=3,St=1/0,Yn=9007199254740991,Gs=17976931348623157e292,cn=NaN,xt=4294967295,zl=xt-1,$l=xt>>>1,Hl=[["ary",U],["bind",N],["bindKey",g],["curry",k],["curryRight",T],["flip",ee],["partial",A],["partialRight",F],["rearg",V]],Xt="[object Arguments]",Js="[object Array]",Jy="[object AsyncFunction]",$i="[object Boolean]",Hi="[object Date]",jy="[object DOMException]",js="[object Error]",Ys="[object Function]",Th="[object GeneratorFunction]",Zt="[object Map]",Wi="[object Number]",Yy="[object Null]",Cn="[object Object]",Ah="[object Promise]",Xy="[object Proxy]",Vi="[object RegExp]",Qt="[object Set]",Ui="[object String]",Xs="[object Symbol]",Zy="[object Undefined]",qi="[object WeakMap]",Qy="[object WeakSet]",Ki="[object ArrayBuffer]",Qr="[object DataView]",Wl="[object Float32Array]",Vl="[object Float64Array]",Ul="[object Int8Array]",ql="[object Int16Array]",Kl="[object Int32Array]",Gl="[object Uint8Array]",Jl="[object Uint8ClampedArray]",jl="[object Uint16Array]",Yl="[object Uint32Array]",eb=/\b__p \+= '';/g,tb=/\b(__p \+=) '' \+/g,nb=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Mh=/&(?:amp|lt|gt|quot|#39);/g,Oh=/[&<>"']/g,rb=RegExp(Mh.source),ib=RegExp(Oh.source),sb=/<%-([\s\S]+?)%>/g,ob=/<%([\s\S]+?)%>/g,Ih=/<%=([\s\S]+?)%>/g,ab=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lb=/^\w*$/,ub=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xl=/[\\^$.*+?()[\]{}|]/g,cb=RegExp(Xl.source),Zl=/^\s+/,fb=/\s/,hb=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,db=/\{\n\/\* \[wrapped with (.+)\] \*/,pb=/,? & /,mb=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,gb=/[()=,{}\[\]\/\s]/,yb=/\\(\\)?/g,bb=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nh=/\w*$/,_b=/^[-+]0x[0-9a-f]+$/i,wb=/^0b[01]+$/i,vb=/^\[object .+?Constructor\]$/,Sb=/^0o[0-7]+$/i,xb=/^(?:0|[1-9]\d*)$/,Cb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Zs=/($^)/,Eb=/['\n\r\u2028\u2029\\]/g,Qs="\\ud800-\\udfff",kb="\\u0300-\\u036f",Tb="\\ufe20-\\ufe2f",Ab="\\u20d0-\\u20ff",Rh=kb+Tb+Ab,Lh="\\u2700-\\u27bf",Ph="a-z\\xdf-\\xf6\\xf8-\\xff",Mb="\\xac\\xb1\\xd7\\xf7",Ob="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ib="\\u2000-\\u206f",Nb=" \\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",Dh="A-Z\\xc0-\\xd6\\xd8-\\xde",Fh="\\ufe0e\\ufe0f",Bh=Mb+Ob+Ib+Nb,Ql="['\u2019]",Rb="["+Qs+"]",zh="["+Bh+"]",eo="["+Rh+"]",$h="\\d+",Lb="["+Lh+"]",Hh="["+Ph+"]",Wh="[^"+Qs+Bh+$h+Lh+Ph+Dh+"]",eu="\\ud83c[\\udffb-\\udfff]",Pb="(?:"+eo+"|"+eu+")",Vh="[^"+Qs+"]",tu="(?:\\ud83c[\\udde6-\\uddff]){2}",nu="[\\ud800-\\udbff][\\udc00-\\udfff]",ei="["+Dh+"]",Uh="\\u200d",qh="(?:"+Hh+"|"+Wh+")",Db="(?:"+ei+"|"+Wh+")",Kh="(?:"+Ql+"(?:d|ll|m|re|s|t|ve))?",Gh="(?:"+Ql+"(?:D|LL|M|RE|S|T|VE))?",Jh=Pb+"?",jh="["+Fh+"]?",Fb="(?:"+Uh+"(?:"+[Vh,tu,nu].join("|")+")"+jh+Jh+")*",Bb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zb="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Yh=jh+Jh+Fb,$b="(?:"+[Lb,tu,nu].join("|")+")"+Yh,Hb="(?:"+[Vh+eo+"?",eo,tu,nu,Rb].join("|")+")",Wb=RegExp(Ql,"g"),Vb=RegExp(eo,"g"),ru=RegExp(eu+"(?="+eu+")|"+Hb+Yh,"g"),Ub=RegExp([ei+"?"+Hh+"+"+Kh+"(?="+[zh,ei,"$"].join("|")+")",Db+"+"+Gh+"(?="+[zh,ei+qh,"$"].join("|")+")",ei+"?"+qh+"+"+Kh,ei+"+"+Gh,zb,Bb,$h,$b].join("|"),"g"),qb=RegExp("["+Uh+Qs+Rh+Fh+"]"),Kb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gb=["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"],Jb=-1,Ee={};Ee[Wl]=Ee[Vl]=Ee[Ul]=Ee[ql]=Ee[Kl]=Ee[Gl]=Ee[Jl]=Ee[jl]=Ee[Yl]=!0,Ee[Xt]=Ee[Js]=Ee[Ki]=Ee[$i]=Ee[Qr]=Ee[Hi]=Ee[js]=Ee[Ys]=Ee[Zt]=Ee[Wi]=Ee[Cn]=Ee[Vi]=Ee[Qt]=Ee[Ui]=Ee[qi]=!1;var Ce={};Ce[Xt]=Ce[Js]=Ce[Ki]=Ce[Qr]=Ce[$i]=Ce[Hi]=Ce[Wl]=Ce[Vl]=Ce[Ul]=Ce[ql]=Ce[Kl]=Ce[Zt]=Ce[Wi]=Ce[Cn]=Ce[Vi]=Ce[Qt]=Ce[Ui]=Ce[Xs]=Ce[Gl]=Ce[Jl]=Ce[jl]=Ce[Yl]=!0,Ce[js]=Ce[Ys]=Ce[qi]=!1;var jb={\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"},Yb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xb={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Zb={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qb=parseFloat,e2=parseInt,Xh=typeof Ho=="object"&&Ho&&Ho.Object===Object&&Ho,t2=typeof self=="object"&&self&&self.Object===Object&&self,Xe=Xh||t2||Function("return this")(),iu=e&&!e.nodeType&&e,Ar=iu&&!0&&n&&!n.nodeType&&n,Zh=Ar&&Ar.exports===iu,su=Zh&&Xh.process,Bt=function(){try{var O=Ar&&Ar.require&&Ar.require("util").types;return O||su&&su.binding&&su.binding("util")}catch{}}(),Qh=Bt&&Bt.isArrayBuffer,ed=Bt&&Bt.isDate,td=Bt&&Bt.isMap,nd=Bt&&Bt.isRegExp,rd=Bt&&Bt.isSet,id=Bt&&Bt.isTypedArray;function Ct(O,L,R){switch(R.length){case 0:return O.call(L);case 1:return O.call(L,R[0]);case 2:return O.call(L,R[0],R[1]);case 3:return O.call(L,R[0],R[1],R[2])}return O.apply(L,R)}function n2(O,L,R,G){for(var ne=-1,be=O==null?0:O.length;++ne<be;){var Be=O[ne];L(G,Be,R(Be),O)}return G}function zt(O,L){for(var R=-1,G=O==null?0:O.length;++R<G&&L(O[R],R,O)!==!1;);return O}function r2(O,L){for(var R=O==null?0:O.length;R--&&L(O[R],R,O)!==!1;);return O}function sd(O,L){for(var R=-1,G=O==null?0:O.length;++R<G;)if(!L(O[R],R,O))return!1;return!0}function Xn(O,L){for(var R=-1,G=O==null?0:O.length,ne=0,be=[];++R<G;){var Be=O[R];L(Be,R,O)&&(be[ne++]=Be)}return be}function to(O,L){var R=O==null?0:O.length;return!!R&&ti(O,L,0)>-1}function ou(O,L,R){for(var G=-1,ne=O==null?0:O.length;++G<ne;)if(R(L,O[G]))return!0;return!1}function Ae(O,L){for(var R=-1,G=O==null?0:O.length,ne=Array(G);++R<G;)ne[R]=L(O[R],R,O);return ne}function Zn(O,L){for(var R=-1,G=L.length,ne=O.length;++R<G;)O[ne+R]=L[R];return O}function au(O,L,R,G){var ne=-1,be=O==null?0:O.length;for(G&&be&&(R=O[++ne]);++ne<be;)R=L(R,O[ne],ne,O);return R}function i2(O,L,R,G){var ne=O==null?0:O.length;for(G&&ne&&(R=O[--ne]);ne--;)R=L(R,O[ne],ne,O);return R}function lu(O,L){for(var R=-1,G=O==null?0:O.length;++R<G;)if(L(O[R],R,O))return!0;return!1}var s2=uu("length");function o2(O){return O.split("")}function a2(O){return O.match(mb)||[]}function od(O,L,R){var G;return R(O,function(ne,be,Be){if(L(ne,be,Be))return G=be,!1}),G}function no(O,L,R,G){for(var ne=O.length,be=R+(G?1:-1);G?be--:++be<ne;)if(L(O[be],be,O))return be;return-1}function ti(O,L,R){return L===L?_2(O,L,R):no(O,ad,R)}function l2(O,L,R,G){for(var ne=R-1,be=O.length;++ne<be;)if(G(O[ne],L))return ne;return-1}function ad(O){return O!==O}function ld(O,L){var R=O==null?0:O.length;return R?fu(O,L)/R:cn}function uu(O){return function(L){return L==null?t:L[O]}}function cu(O){return function(L){return O==null?t:O[L]}}function ud(O,L,R,G,ne){return ne(O,function(be,Be,xe){R=G?(G=!1,be):L(R,be,Be,xe)}),R}function u2(O,L){var R=O.length;for(O.sort(L);R--;)O[R]=O[R].value;return O}function fu(O,L){for(var R,G=-1,ne=O.length;++G<ne;){var be=L(O[G]);be!==t&&(R=R===t?be:R+be)}return R}function hu(O,L){for(var R=-1,G=Array(O);++R<O;)G[R]=L(R);return G}function c2(O,L){return Ae(L,function(R){return[R,O[R]]})}function cd(O){return O&&O.slice(0,pd(O)+1).replace(Zl,"")}function Et(O){return function(L){return O(L)}}function du(O,L){return Ae(L,function(R){return O[R]})}function Gi(O,L){return O.has(L)}function fd(O,L){for(var R=-1,G=O.length;++R<G&&ti(L,O[R],0)>-1;);return R}function hd(O,L){for(var R=O.length;R--&&ti(L,O[R],0)>-1;);return R}function f2(O,L){for(var R=O.length,G=0;R--;)O[R]===L&&++G;return G}var h2=cu(jb),d2=cu(Yb);function p2(O){return"\\"+Zb[O]}function m2(O,L){return O==null?t:O[L]}function ni(O){return qb.test(O)}function g2(O){return Kb.test(O)}function y2(O){for(var L,R=[];!(L=O.next()).done;)R.push(L.value);return R}function pu(O){var L=-1,R=Array(O.size);return O.forEach(function(G,ne){R[++L]=[ne,G]}),R}function dd(O,L){return function(R){return O(L(R))}}function Qn(O,L){for(var R=-1,G=O.length,ne=0,be=[];++R<G;){var Be=O[R];(Be===L||Be===p)&&(O[R]=p,be[ne++]=R)}return be}function ro(O){var L=-1,R=Array(O.size);return O.forEach(function(G){R[++L]=G}),R}function b2(O){var L=-1,R=Array(O.size);return O.forEach(function(G){R[++L]=[G,G]}),R}function _2(O,L,R){for(var G=R-1,ne=O.length;++G<ne;)if(O[G]===L)return G;return-1}function w2(O,L,R){for(var G=R+1;G--;)if(O[G]===L)return G;return G}function ri(O){return ni(O)?S2(O):s2(O)}function en(O){return ni(O)?x2(O):o2(O)}function pd(O){for(var L=O.length;L--&&fb.test(O.charAt(L)););return L}var v2=cu(Xb);function S2(O){for(var L=ru.lastIndex=0;ru.test(O);)++L;return L}function x2(O){return O.match(ru)||[]}function C2(O){return O.match(Ub)||[]}var E2=function O(L){L=L==null?Xe:ii.defaults(Xe.Object(),L,ii.pick(Xe,Gb));var R=L.Array,G=L.Date,ne=L.Error,be=L.Function,Be=L.Math,xe=L.Object,mu=L.RegExp,k2=L.String,$t=L.TypeError,io=R.prototype,T2=be.prototype,si=xe.prototype,so=L["__core-js_shared__"],oo=T2.toString,ve=si.hasOwnProperty,A2=0,md=function(){var o=/[^.]+$/.exec(so&&so.keys&&so.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),ao=si.toString,M2=oo.call(xe),O2=Xe._,I2=mu("^"+oo.call(ve).replace(Xl,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lo=Zh?L.Buffer:t,er=L.Symbol,uo=L.Uint8Array,gd=lo?lo.allocUnsafe:t,co=dd(xe.getPrototypeOf,xe),yd=xe.create,bd=si.propertyIsEnumerable,fo=io.splice,_d=er?er.isConcatSpreadable:t,Ji=er?er.iterator:t,Mr=er?er.toStringTag:t,ho=function(){try{var o=Lr(xe,"defineProperty");return o({},"",{}),o}catch{}}(),N2=L.clearTimeout!==Xe.clearTimeout&&L.clearTimeout,R2=G&&G.now!==Xe.Date.now&&G.now,L2=L.setTimeout!==Xe.setTimeout&&L.setTimeout,po=Be.ceil,mo=Be.floor,gu=xe.getOwnPropertySymbols,P2=lo?lo.isBuffer:t,wd=L.isFinite,D2=io.join,F2=dd(xe.keys,xe),ze=Be.max,nt=Be.min,B2=G.now,z2=L.parseInt,vd=Be.random,$2=io.reverse,yu=Lr(L,"DataView"),ji=Lr(L,"Map"),bu=Lr(L,"Promise"),oi=Lr(L,"Set"),Yi=Lr(L,"WeakMap"),Xi=Lr(xe,"create"),go=Yi&&new Yi,ai={},H2=Pr(yu),W2=Pr(ji),V2=Pr(bu),U2=Pr(oi),q2=Pr(Yi),yo=er?er.prototype:t,Zi=yo?yo.valueOf:t,Sd=yo?yo.toString:t;function w(o){if(Ie(o)&&!re(o)&&!(o instanceof fe)){if(o instanceof Ht)return o;if(ve.call(o,"__wrapped__"))return xp(o)}return new Ht(o)}var li=function(){function o(){}return function(l){if(!Oe(l))return{};if(yd)return yd(l);o.prototype=l;var f=new o;return o.prototype=t,f}}();function bo(){}function Ht(o,l){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=t}w.templateSettings={escape:sb,evaluate:ob,interpolate:Ih,variable:"",imports:{_:w}},w.prototype=bo.prototype,w.prototype.constructor=w,Ht.prototype=li(bo.prototype),Ht.prototype.constructor=Ht;function fe(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=xt,this.__views__=[]}function K2(){var o=new fe(this.__wrapped__);return o.__actions__=ht(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=ht(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=ht(this.__views__),o}function G2(){if(this.__filtered__){var o=new fe(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function J2(){var o=this.__wrapped__.value(),l=this.__dir__,f=re(o),d=l<0,b=f?o.length:0,x=ow(0,b,this.__views__),C=x.start,M=x.end,I=M-C,P=d?M:C-1,D=this.__iteratees__,B=D.length,q=0,j=nt(I,this.__takeCount__);if(!f||!d&&b==I&&j==I)return Kd(o,this.__actions__);var X=[];e:for(;I--&&q<j;){P+=l;for(var se=-1,Z=o[P];++se<B;){var ce=D[se],me=ce.iteratee,At=ce.type,ot=me(Z);if(At==xn)Z=ot;else if(!ot){if(At==Ft)continue e;break e}}X[q++]=Z}return X}fe.prototype=li(bo.prototype),fe.prototype.constructor=fe;function Or(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function j2(){this.__data__=Xi?Xi(null):{},this.size=0}function Y2(o){var l=this.has(o)&&delete this.__data__[o];return this.size-=l?1:0,l}function X2(o){var l=this.__data__;if(Xi){var f=l[o];return f===c?t:f}return ve.call(l,o)?l[o]:t}function Z2(o){var l=this.__data__;return Xi?l[o]!==t:ve.call(l,o)}function Q2(o,l){var f=this.__data__;return this.size+=this.has(o)?0:1,f[o]=Xi&&l===t?c:l,this}Or.prototype.clear=j2,Or.prototype.delete=Y2,Or.prototype.get=X2,Or.prototype.has=Z2,Or.prototype.set=Q2;function En(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function e_(){this.__data__=[],this.size=0}function t_(o){var l=this.__data__,f=_o(l,o);if(f<0)return!1;var d=l.length-1;return f==d?l.pop():fo.call(l,f,1),--this.size,!0}function n_(o){var l=this.__data__,f=_o(l,o);return f<0?t:l[f][1]}function r_(o){return _o(this.__data__,o)>-1}function i_(o,l){var f=this.__data__,d=_o(f,o);return d<0?(++this.size,f.push([o,l])):f[d][1]=l,this}En.prototype.clear=e_,En.prototype.delete=t_,En.prototype.get=n_,En.prototype.has=r_,En.prototype.set=i_;function kn(o){var l=-1,f=o==null?0:o.length;for(this.clear();++l<f;){var d=o[l];this.set(d[0],d[1])}}function s_(){this.size=0,this.__data__={hash:new Or,map:new(ji||En),string:new Or}}function o_(o){var l=Io(this,o).delete(o);return this.size-=l?1:0,l}function a_(o){return Io(this,o).get(o)}function l_(o){return Io(this,o).has(o)}function u_(o,l){var f=Io(this,o),d=f.size;return f.set(o,l),this.size+=f.size==d?0:1,this}kn.prototype.clear=s_,kn.prototype.delete=o_,kn.prototype.get=a_,kn.prototype.has=l_,kn.prototype.set=u_;function Ir(o){var l=-1,f=o==null?0:o.length;for(this.__data__=new kn;++l<f;)this.add(o[l])}function c_(o){return this.__data__.set(o,c),this}function f_(o){return this.__data__.has(o)}Ir.prototype.add=Ir.prototype.push=c_,Ir.prototype.has=f_;function tn(o){var l=this.__data__=new En(o);this.size=l.size}function h_(){this.__data__=new En,this.size=0}function d_(o){var l=this.__data__,f=l.delete(o);return this.size=l.size,f}function p_(o){return this.__data__.get(o)}function m_(o){return this.__data__.has(o)}function g_(o,l){var f=this.__data__;if(f instanceof En){var d=f.__data__;if(!ji||d.length<i-1)return d.push([o,l]),this.size=++f.size,this;f=this.__data__=new kn(d)}return f.set(o,l),this.size=f.size,this}tn.prototype.clear=h_,tn.prototype.delete=d_,tn.prototype.get=p_,tn.prototype.has=m_,tn.prototype.set=g_;function xd(o,l){var f=re(o),d=!f&&Dr(o),b=!f&&!d&&sr(o),x=!f&&!d&&!b&&hi(o),C=f||d||b||x,M=C?hu(o.length,k2):[],I=M.length;for(var P in o)(l||ve.call(o,P))&&!(C&&(P=="length"||b&&(P=="offset"||P=="parent")||x&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||On(P,I)))&&M.push(P);return M}function Cd(o){var l=o.length;return l?o[Mu(0,l-1)]:t}function y_(o,l){return No(ht(o),Nr(l,0,o.length))}function b_(o){return No(ht(o))}function _u(o,l,f){(f!==t&&!nn(o[l],f)||f===t&&!(l in o))&&Tn(o,l,f)}function Qi(o,l,f){var d=o[l];(!(ve.call(o,l)&&nn(d,f))||f===t&&!(l in o))&&Tn(o,l,f)}function _o(o,l){for(var f=o.length;f--;)if(nn(o[f][0],l))return f;return-1}function __(o,l,f,d){return tr(o,function(b,x,C){l(d,b,f(b),C)}),d}function Ed(o,l){return o&&hn(l,Ve(l),o)}function w_(o,l){return o&&hn(l,pt(l),o)}function Tn(o,l,f){l=="__proto__"&&ho?ho(o,l,{configurable:!0,enumerable:!0,value:f,writable:!0}):o[l]=f}function wu(o,l){for(var f=-1,d=l.length,b=R(d),x=o==null;++f<d;)b[f]=x?t:ec(o,l[f]);return b}function Nr(o,l,f){return o===o&&(f!==t&&(o=o<=f?o:f),l!==t&&(o=o>=l?o:l)),o}function Wt(o,l,f,d,b,x){var C,M=l&m,I=l&y,P=l&_;if(f&&(C=b?f(o,d,b,x):f(o)),C!==t)return C;if(!Oe(o))return o;var D=re(o);if(D){if(C=lw(o),!M)return ht(o,C)}else{var B=rt(o),q=B==Ys||B==Th;if(sr(o))return jd(o,M);if(B==Cn||B==Xt||q&&!b){if(C=I||q?{}:pp(o),!M)return I?X_(o,w_(C,o)):Y_(o,Ed(C,o))}else{if(!Ce[B])return b?o:{};C=uw(o,B,M)}}x||(x=new tn);var j=x.get(o);if(j)return j;x.set(o,C),Vp(o)?o.forEach(function(Z){C.add(Wt(Z,l,f,Z,o,x))}):Hp(o)&&o.forEach(function(Z,ce){C.set(ce,Wt(Z,l,f,ce,o,x))});var X=P?I?$u:zu:I?pt:Ve,se=D?t:X(o);return zt(se||o,function(Z,ce){se&&(ce=Z,Z=o[ce]),Qi(C,ce,Wt(Z,l,f,ce,o,x))}),C}function v_(o){var l=Ve(o);return function(f){return kd(f,o,l)}}function kd(o,l,f){var d=f.length;if(o==null)return!d;for(o=xe(o);d--;){var b=f[d],x=l[b],C=o[b];if(C===t&&!(b in o)||!x(C))return!1}return!0}function Td(o,l,f){if(typeof o!="function")throw new $t(a);return as(function(){o.apply(t,f)},l)}function es(o,l,f,d){var b=-1,x=to,C=!0,M=o.length,I=[],P=l.length;if(!M)return I;f&&(l=Ae(l,Et(f))),d?(x=ou,C=!1):l.length>=i&&(x=Gi,C=!1,l=new Ir(l));e:for(;++b<M;){var D=o[b],B=f==null?D:f(D);if(D=d||D!==0?D:0,C&&B===B){for(var q=P;q--;)if(l[q]===B)continue e;I.push(D)}else x(l,B,d)||I.push(D)}return I}var tr=ep(fn),Ad=ep(Su,!0);function S_(o,l){var f=!0;return tr(o,function(d,b,x){return f=!!l(d,b,x),f}),f}function wo(o,l,f){for(var d=-1,b=o.length;++d<b;){var x=o[d],C=l(x);if(C!=null&&(M===t?C===C&&!Tt(C):f(C,M)))var M=C,I=x}return I}function x_(o,l,f,d){var b=o.length;for(f=ie(f),f<0&&(f=-f>b?0:b+f),d=d===t||d>b?b:ie(d),d<0&&(d+=b),d=f>d?0:qp(d);f<d;)o[f++]=l;return o}function Md(o,l){var f=[];return tr(o,function(d,b,x){l(d,b,x)&&f.push(d)}),f}function Ze(o,l,f,d,b){var x=-1,C=o.length;for(f||(f=fw),b||(b=[]);++x<C;){var M=o[x];l>0&&f(M)?l>1?Ze(M,l-1,f,d,b):Zn(b,M):d||(b[b.length]=M)}return b}var vu=tp(),Od=tp(!0);function fn(o,l){return o&&vu(o,l,Ve)}function Su(o,l){return o&&Od(o,l,Ve)}function vo(o,l){return Xn(l,function(f){return In(o[f])})}function Rr(o,l){l=rr(l,o);for(var f=0,d=l.length;o!=null&&f<d;)o=o[dn(l[f++])];return f&&f==d?o:t}function Id(o,l,f){var d=l(o);return re(o)?d:Zn(d,f(o))}function it(o){return o==null?o===t?Zy:Yy:Mr&&Mr in xe(o)?sw(o):bw(o)}function xu(o,l){return o>l}function C_(o,l){return o!=null&&ve.call(o,l)}function E_(o,l){return o!=null&&l in xe(o)}function k_(o,l,f){return o>=nt(l,f)&&o<ze(l,f)}function Cu(o,l,f){for(var d=f?ou:to,b=o[0].length,x=o.length,C=x,M=R(x),I=1/0,P=[];C--;){var D=o[C];C&&l&&(D=Ae(D,Et(l))),I=nt(D.length,I),M[C]=!f&&(l||b>=120&&D.length>=120)?new Ir(C&&D):t}D=o[0];var B=-1,q=M[0];e:for(;++B<b&&P.length<I;){var j=D[B],X=l?l(j):j;if(j=f||j!==0?j:0,!(q?Gi(q,X):d(P,X,f))){for(C=x;--C;){var se=M[C];if(!(se?Gi(se,X):d(o[C],X,f)))continue e}q&&q.push(X),P.push(j)}}return P}function T_(o,l,f,d){return fn(o,function(b,x,C){l(d,f(b),x,C)}),d}function ts(o,l,f){l=rr(l,o),o=bp(o,l);var d=o==null?o:o[dn(Ut(l))];return d==null?t:Ct(d,o,f)}function Nd(o){return Ie(o)&&it(o)==Xt}function A_(o){return Ie(o)&&it(o)==Ki}function M_(o){return Ie(o)&&it(o)==Hi}function ns(o,l,f,d,b){return o===l?!0:o==null||l==null||!Ie(o)&&!Ie(l)?o!==o&&l!==l:O_(o,l,f,d,ns,b)}function O_(o,l,f,d,b,x){var C=re(o),M=re(l),I=C?Js:rt(o),P=M?Js:rt(l);I=I==Xt?Cn:I,P=P==Xt?Cn:P;var D=I==Cn,B=P==Cn,q=I==P;if(q&&sr(o)){if(!sr(l))return!1;C=!0,D=!1}if(q&&!D)return x||(x=new tn),C||hi(o)?fp(o,l,f,d,b,x):rw(o,l,I,f,d,b,x);if(!(f&S)){var j=D&&ve.call(o,"__wrapped__"),X=B&&ve.call(l,"__wrapped__");if(j||X){var se=j?o.value():o,Z=X?l.value():l;return x||(x=new tn),b(se,Z,f,d,x)}}return q?(x||(x=new tn),iw(o,l,f,d,b,x)):!1}function I_(o){return Ie(o)&&rt(o)==Zt}function Eu(o,l,f,d){var b=f.length,x=b,C=!d;if(o==null)return!x;for(o=xe(o);b--;){var M=f[b];if(C&&M[2]?M[1]!==o[M[0]]:!(M[0]in o))return!1}for(;++b<x;){M=f[b];var I=M[0],P=o[I],D=M[1];if(C&&M[2]){if(P===t&&!(I in o))return!1}else{var B=new tn;if(d)var q=d(P,D,I,o,l,B);if(!(q===t?ns(D,P,S|E,d,B):q))return!1}}return!0}function Rd(o){if(!Oe(o)||dw(o))return!1;var l=In(o)?I2:vb;return l.test(Pr(o))}function N_(o){return Ie(o)&&it(o)==Vi}function R_(o){return Ie(o)&&rt(o)==Qt}function L_(o){return Ie(o)&&Bo(o.length)&&!!Ee[it(o)]}function Ld(o){return typeof o=="function"?o:o==null?mt:typeof o=="object"?re(o)?Fd(o[0],o[1]):Dd(o):nm(o)}function ku(o){if(!ss(o))return F2(o);var l=[];for(var f in xe(o))ve.call(o,f)&&f!="constructor"&&l.push(f);return l}function P_(o){if(!Oe(o))return yw(o);var l=ss(o),f=[];for(var d in o)d=="constructor"&&(l||!ve.call(o,d))||f.push(d);return f}function Tu(o,l){return o<l}function Pd(o,l){var f=-1,d=dt(o)?R(o.length):[];return tr(o,function(b,x,C){d[++f]=l(b,x,C)}),d}function Dd(o){var l=Wu(o);return l.length==1&&l[0][2]?gp(l[0][0],l[0][1]):function(f){return f===o||Eu(f,o,l)}}function Fd(o,l){return Uu(o)&&mp(l)?gp(dn(o),l):function(f){var d=ec(f,o);return d===t&&d===l?tc(f,o):ns(l,d,S|E)}}function So(o,l,f,d,b){o!==l&&vu(l,function(x,C){if(b||(b=new tn),Oe(x))D_(o,l,C,f,So,d,b);else{var M=d?d(Ku(o,C),x,C+"",o,l,b):t;M===t&&(M=x),_u(o,C,M)}},pt)}function D_(o,l,f,d,b,x,C){var M=Ku(o,f),I=Ku(l,f),P=C.get(I);if(P){_u(o,f,P);return}var D=x?x(M,I,f+"",o,l,C):t,B=D===t;if(B){var q=re(I),j=!q&&sr(I),X=!q&&!j&&hi(I);D=I,q||j||X?re(M)?D=M:Le(M)?D=ht(M):j?(B=!1,D=jd(I,!0)):X?(B=!1,D=Yd(I,!0)):D=[]:ls(I)||Dr(I)?(D=M,Dr(M)?D=Kp(M):(!Oe(M)||In(M))&&(D=pp(I))):B=!1}B&&(C.set(I,D),b(D,I,d,x,C),C.delete(I)),_u(o,f,D)}function Bd(o,l){var f=o.length;if(f)return l+=l<0?f:0,On(l,f)?o[l]:t}function zd(o,l,f){l.length?l=Ae(l,function(x){return re(x)?function(C){return Rr(C,x.length===1?x[0]:x)}:x}):l=[mt];var d=-1;l=Ae(l,Et(Y()));var b=Pd(o,function(x,C,M){var I=Ae(l,function(P){return P(x)});return{criteria:I,index:++d,value:x}});return u2(b,function(x,C){return j_(x,C,f)})}function F_(o,l){return $d(o,l,function(f,d){return tc(o,d)})}function $d(o,l,f){for(var d=-1,b=l.length,x={};++d<b;){var C=l[d],M=Rr(o,C);f(M,C)&&rs(x,rr(C,o),M)}return x}function B_(o){return function(l){return Rr(l,o)}}function Au(o,l,f,d){var b=d?l2:ti,x=-1,C=l.length,M=o;for(o===l&&(l=ht(l)),f&&(M=Ae(o,Et(f)));++x<C;)for(var I=0,P=l[x],D=f?f(P):P;(I=b(M,D,I,d))>-1;)M!==o&&fo.call(M,I,1),fo.call(o,I,1);return o}function Hd(o,l){for(var f=o?l.length:0,d=f-1;f--;){var b=l[f];if(f==d||b!==x){var x=b;On(b)?fo.call(o,b,1):Nu(o,b)}}return o}function Mu(o,l){return o+mo(vd()*(l-o+1))}function z_(o,l,f,d){for(var b=-1,x=ze(po((l-o)/(f||1)),0),C=R(x);x--;)C[d?x:++b]=o,o+=f;return C}function Ou(o,l){var f="";if(!o||l<1||l>Yn)return f;do l%2&&(f+=o),l=mo(l/2),l&&(o+=o);while(l);return f}function ue(o,l){return Gu(yp(o,l,mt),o+"")}function $_(o){return Cd(di(o))}function H_(o,l){var f=di(o);return No(f,Nr(l,0,f.length))}function rs(o,l,f,d){if(!Oe(o))return o;l=rr(l,o);for(var b=-1,x=l.length,C=x-1,M=o;M!=null&&++b<x;){var I=dn(l[b]),P=f;if(I==="__proto__"||I==="constructor"||I==="prototype")return o;if(b!=C){var D=M[I];P=d?d(D,I,M):t,P===t&&(P=Oe(D)?D:On(l[b+1])?[]:{})}Qi(M,I,P),M=M[I]}return o}var Wd=go?function(o,l){return go.set(o,l),o}:mt,W_=ho?function(o,l){return ho(o,"toString",{configurable:!0,enumerable:!1,value:rc(l),writable:!0})}:mt;function V_(o){return No(di(o))}function Vt(o,l,f){var d=-1,b=o.length;l<0&&(l=-l>b?0:b+l),f=f>b?b:f,f<0&&(f+=b),b=l>f?0:f-l>>>0,l>>>=0;for(var x=R(b);++d<b;)x[d]=o[d+l];return x}function U_(o,l){var f;return tr(o,function(d,b,x){return f=l(d,b,x),!f}),!!f}function xo(o,l,f){var d=0,b=o==null?d:o.length;if(typeof l=="number"&&l===l&&b<=$l){for(;d<b;){var x=d+b>>>1,C=o[x];C!==null&&!Tt(C)&&(f?C<=l:C<l)?d=x+1:b=x}return b}return Iu(o,l,mt,f)}function Iu(o,l,f,d){var b=0,x=o==null?0:o.length;if(x===0)return 0;l=f(l);for(var C=l!==l,M=l===null,I=Tt(l),P=l===t;b<x;){var D=mo((b+x)/2),B=f(o[D]),q=B!==t,j=B===null,X=B===B,se=Tt(B);if(C)var Z=d||X;else P?Z=X&&(d||q):M?Z=X&&q&&(d||!j):I?Z=X&&q&&!j&&(d||!se):j||se?Z=!1:Z=d?B<=l:B<l;Z?b=D+1:x=D}return nt(x,zl)}function Vd(o,l){for(var f=-1,d=o.length,b=0,x=[];++f<d;){var C=o[f],M=l?l(C):C;if(!f||!nn(M,I)){var I=M;x[b++]=C===0?0:C}}return x}function Ud(o){return typeof o=="number"?o:Tt(o)?cn:+o}function kt(o){if(typeof o=="string")return o;if(re(o))return Ae(o,kt)+"";if(Tt(o))return Sd?Sd.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}function nr(o,l,f){var d=-1,b=to,x=o.length,C=!0,M=[],I=M;if(f)C=!1,b=ou;else if(x>=i){var P=l?null:tw(o);if(P)return ro(P);C=!1,b=Gi,I=new Ir}else I=l?[]:M;e:for(;++d<x;){var D=o[d],B=l?l(D):D;if(D=f||D!==0?D:0,C&&B===B){for(var q=I.length;q--;)if(I[q]===B)continue e;l&&I.push(B),M.push(D)}else b(I,B,f)||(I!==M&&I.push(B),M.push(D))}return M}function Nu(o,l){return l=rr(l,o),o=bp(o,l),o==null||delete o[dn(Ut(l))]}function qd(o,l,f,d){return rs(o,l,f(Rr(o,l)),d)}function Co(o,l,f,d){for(var b=o.length,x=d?b:-1;(d?x--:++x<b)&&l(o[x],x,o););return f?Vt(o,d?0:x,d?x+1:b):Vt(o,d?x+1:0,d?b:x)}function Kd(o,l){var f=o;return f instanceof fe&&(f=f.value()),au(l,function(d,b){return b.func.apply(b.thisArg,Zn([d],b.args))},f)}function Ru(o,l,f){var d=o.length;if(d<2)return d?nr(o[0]):[];for(var b=-1,x=R(d);++b<d;)for(var C=o[b],M=-1;++M<d;)M!=b&&(x[b]=es(x[b]||C,o[M],l,f));return nr(Ze(x,1),l,f)}function Gd(o,l,f){for(var d=-1,b=o.length,x=l.length,C={};++d<b;){var M=d<x?l[d]:t;f(C,o[d],M)}return C}function Lu(o){return Le(o)?o:[]}function Pu(o){return typeof o=="function"?o:mt}function rr(o,l){return re(o)?o:Uu(o,l)?[o]:Sp(_e(o))}var q_=ue;function ir(o,l,f){var d=o.length;return f=f===t?d:f,!l&&f>=d?o:Vt(o,l,f)}var Jd=N2||function(o){return Xe.clearTimeout(o)};function jd(o,l){if(l)return o.slice();var f=o.length,d=gd?gd(f):new o.constructor(f);return o.copy(d),d}function Du(o){var l=new o.constructor(o.byteLength);return new uo(l).set(new uo(o)),l}function K_(o,l){var f=l?Du(o.buffer):o.buffer;return new o.constructor(f,o.byteOffset,o.byteLength)}function G_(o){var l=new o.constructor(o.source,Nh.exec(o));return l.lastIndex=o.lastIndex,l}function J_(o){return Zi?xe(Zi.call(o)):{}}function Yd(o,l){var f=l?Du(o.buffer):o.buffer;return new o.constructor(f,o.byteOffset,o.length)}function Xd(o,l){if(o!==l){var f=o!==t,d=o===null,b=o===o,x=Tt(o),C=l!==t,M=l===null,I=l===l,P=Tt(l);if(!M&&!P&&!x&&o>l||x&&C&&I&&!M&&!P||d&&C&&I||!f&&I||!b)return 1;if(!d&&!x&&!P&&o<l||P&&f&&b&&!d&&!x||M&&f&&b||!C&&b||!I)return-1}return 0}function j_(o,l,f){for(var d=-1,b=o.criteria,x=l.criteria,C=b.length,M=f.length;++d<C;){var I=Xd(b[d],x[d]);if(I){if(d>=M)return I;var P=f[d];return I*(P=="desc"?-1:1)}}return o.index-l.index}function Zd(o,l,f,d){for(var b=-1,x=o.length,C=f.length,M=-1,I=l.length,P=ze(x-C,0),D=R(I+P),B=!d;++M<I;)D[M]=l[M];for(;++b<C;)(B||b<x)&&(D[f[b]]=o[b]);for(;P--;)D[M++]=o[b++];return D}function Qd(o,l,f,d){for(var b=-1,x=o.length,C=-1,M=f.length,I=-1,P=l.length,D=ze(x-M,0),B=R(D+P),q=!d;++b<D;)B[b]=o[b];for(var j=b;++I<P;)B[j+I]=l[I];for(;++C<M;)(q||b<x)&&(B[j+f[C]]=o[b++]);return B}function ht(o,l){var f=-1,d=o.length;for(l||(l=R(d));++f<d;)l[f]=o[f];return l}function hn(o,l,f,d){var b=!f;f||(f={});for(var x=-1,C=l.length;++x<C;){var M=l[x],I=d?d(f[M],o[M],M,f,o):t;I===t&&(I=o[M]),b?Tn(f,M,I):Qi(f,M,I)}return f}function Y_(o,l){return hn(o,Vu(o),l)}function X_(o,l){return hn(o,hp(o),l)}function Eo(o,l){return function(f,d){var b=re(f)?n2:__,x=l?l():{};return b(f,o,Y(d,2),x)}}function ui(o){return ue(function(l,f){var d=-1,b=f.length,x=b>1?f[b-1]:t,C=b>2?f[2]:t;for(x=o.length>3&&typeof x=="function"?(b--,x):t,C&&st(f[0],f[1],C)&&(x=b<3?t:x,b=1),l=xe(l);++d<b;){var M=f[d];M&&o(l,M,d,x)}return l})}function ep(o,l){return function(f,d){if(f==null)return f;if(!dt(f))return o(f,d);for(var b=f.length,x=l?b:-1,C=xe(f);(l?x--:++x<b)&&d(C[x],x,C)!==!1;);return f}}function tp(o){return function(l,f,d){for(var b=-1,x=xe(l),C=d(l),M=C.length;M--;){var I=C[o?M:++b];if(f(x[I],I,x)===!1)break}return l}}function Z_(o,l,f){var d=l&N,b=is(o);function x(){var C=this&&this!==Xe&&this instanceof x?b:o;return C.apply(d?f:this,arguments)}return x}function np(o){return function(l){l=_e(l);var f=ni(l)?en(l):t,d=f?f[0]:l.charAt(0),b=f?ir(f,1).join(""):l.slice(1);return d[o]()+b}}function ci(o){return function(l){return au(em(Qp(l).replace(Wb,"")),o,"")}}function is(o){return function(){var l=arguments;switch(l.length){case 0:return new o;case 1:return new o(l[0]);case 2:return new o(l[0],l[1]);case 3:return new o(l[0],l[1],l[2]);case 4:return new o(l[0],l[1],l[2],l[3]);case 5:return new o(l[0],l[1],l[2],l[3],l[4]);case 6:return new o(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new o(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var f=li(o.prototype),d=o.apply(f,l);return Oe(d)?d:f}}function Q_(o,l,f){var d=is(o);function b(){for(var x=arguments.length,C=R(x),M=x,I=fi(b);M--;)C[M]=arguments[M];var P=x<3&&C[0]!==I&&C[x-1]!==I?[]:Qn(C,I);if(x-=P.length,x<f)return ap(o,l,ko,b.placeholder,t,C,P,t,t,f-x);var D=this&&this!==Xe&&this instanceof b?d:o;return Ct(D,this,C)}return b}function rp(o){return function(l,f,d){var b=xe(l);if(!dt(l)){var x=Y(f,3);l=Ve(l),f=function(M){return x(b[M],M,b)}}var C=o(l,f,d);return C>-1?b[x?l[C]:C]:t}}function ip(o){return Mn(function(l){var f=l.length,d=f,b=Ht.prototype.thru;for(o&&l.reverse();d--;){var x=l[d];if(typeof x!="function")throw new $t(a);if(b&&!C&&Oo(x)=="wrapper")var C=new Ht([],!0)}for(d=C?d:f;++d<f;){x=l[d];var M=Oo(x),I=M=="wrapper"?Hu(x):t;I&&qu(I[0])&&I[1]==(U|k|A|V)&&!I[4].length&&I[9]==1?C=C[Oo(I[0])].apply(C,I[3]):C=x.length==1&&qu(x)?C[M]():C.thru(x)}return function(){var P=arguments,D=P[0];if(C&&P.length==1&&re(D))return C.plant(D).value();for(var B=0,q=f?l[B].apply(this,P):D;++B<f;)q=l[B].call(this,q);return q}})}function ko(o,l,f,d,b,x,C,M,I,P){var D=l&U,B=l&N,q=l&g,j=l&(k|T),X=l&ee,se=q?t:is(o);function Z(){for(var ce=arguments.length,me=R(ce),At=ce;At--;)me[At]=arguments[At];if(j)var ot=fi(Z),Mt=f2(me,ot);if(d&&(me=Zd(me,d,b,j)),x&&(me=Qd(me,x,C,j)),ce-=Mt,j&&ce<P){var Pe=Qn(me,ot);return ap(o,l,ko,Z.placeholder,f,me,Pe,M,I,P-ce)}var rn=B?f:this,Rn=q?rn[o]:o;return ce=me.length,M?me=_w(me,M):X&&ce>1&&me.reverse(),D&&I<ce&&(me.length=I),this&&this!==Xe&&this instanceof Z&&(Rn=se||is(Rn)),Rn.apply(rn,me)}return Z}function sp(o,l){return function(f,d){return T_(f,o,l(d),{})}}function To(o,l){return function(f,d){var b;if(f===t&&d===t)return l;if(f!==t&&(b=f),d!==t){if(b===t)return d;typeof f=="string"||typeof d=="string"?(f=kt(f),d=kt(d)):(f=Ud(f),d=Ud(d)),b=o(f,d)}return b}}function Fu(o){return Mn(function(l){return l=Ae(l,Et(Y())),ue(function(f){var d=this;return o(l,function(b){return Ct(b,d,f)})})})}function Ao(o,l){l=l===t?" ":kt(l);var f=l.length;if(f<2)return f?Ou(l,o):l;var d=Ou(l,po(o/ri(l)));return ni(l)?ir(en(d),0,o).join(""):d.slice(0,o)}function ew(o,l,f,d){var b=l&N,x=is(o);function C(){for(var M=-1,I=arguments.length,P=-1,D=d.length,B=R(D+I),q=this&&this!==Xe&&this instanceof C?x:o;++P<D;)B[P]=d[P];for(;I--;)B[P++]=arguments[++M];return Ct(q,b?f:this,B)}return C}function op(o){return function(l,f,d){return d&&typeof d!="number"&&st(l,f,d)&&(f=d=t),l=Nn(l),f===t?(f=l,l=0):f=Nn(f),d=d===t?l<f?1:-1:Nn(d),z_(l,f,d,o)}}function Mo(o){return function(l,f){return typeof l=="string"&&typeof f=="string"||(l=qt(l),f=qt(f)),o(l,f)}}function ap(o,l,f,d,b,x,C,M,I,P){var D=l&k,B=D?C:t,q=D?t:C,j=D?x:t,X=D?t:x;l|=D?A:F,l&=~(D?F:A),l&v||(l&=-4);var se=[o,l,b,j,B,X,q,M,I,P],Z=f.apply(t,se);return qu(o)&&_p(Z,se),Z.placeholder=d,wp(Z,o,l)}function Bu(o){var l=Be[o];return function(f,d){if(f=qt(f),d=d==null?0:nt(ie(d),292),d&&wd(f)){var b=(_e(f)+"e").split("e"),x=l(b[0]+"e"+(+b[1]+d));return b=(_e(x)+"e").split("e"),+(b[0]+"e"+(+b[1]-d))}return l(f)}}var tw=oi&&1/ro(new oi([,-0]))[1]==St?function(o){return new oi(o)}:oc;function lp(o){return function(l){var f=rt(l);return f==Zt?pu(l):f==Qt?b2(l):c2(l,o(l))}}function An(o,l,f,d,b,x,C,M){var I=l&g;if(!I&&typeof o!="function")throw new $t(a);var P=d?d.length:0;if(P||(l&=-97,d=b=t),C=C===t?C:ze(ie(C),0),M=M===t?M:ie(M),P-=b?b.length:0,l&F){var D=d,B=b;d=b=t}var q=I?t:Hu(o),j=[o,l,f,d,b,D,B,x,C,M];if(q&&gw(j,q),o=j[0],l=j[1],f=j[2],d=j[3],b=j[4],M=j[9]=j[9]===t?I?0:o.length:ze(j[9]-P,0),!M&&l&(k|T)&&(l&=-25),!l||l==N)var X=Z_(o,l,f);else l==k||l==T?X=Q_(o,l,M):(l==A||l==(N|A))&&!b.length?X=ew(o,l,f,d):X=ko.apply(t,j);var se=q?Wd:_p;return wp(se(X,j),o,l)}function up(o,l,f,d){return o===t||nn(o,si[f])&&!ve.call(d,f)?l:o}function cp(o,l,f,d,b,x){return Oe(o)&&Oe(l)&&(x.set(l,o),So(o,l,t,cp,x),x.delete(l)),o}function nw(o){return ls(o)?t:o}function fp(o,l,f,d,b,x){var C=f&S,M=o.length,I=l.length;if(M!=I&&!(C&&I>M))return!1;var P=x.get(o),D=x.get(l);if(P&&D)return P==l&&D==o;var B=-1,q=!0,j=f&E?new Ir:t;for(x.set(o,l),x.set(l,o);++B<M;){var X=o[B],se=l[B];if(d)var Z=C?d(se,X,B,l,o,x):d(X,se,B,o,l,x);if(Z!==t){if(Z)continue;q=!1;break}if(j){if(!lu(l,function(ce,me){if(!Gi(j,me)&&(X===ce||b(X,ce,f,d,x)))return j.push(me)})){q=!1;break}}else if(!(X===se||b(X,se,f,d,x))){q=!1;break}}return x.delete(o),x.delete(l),q}function rw(o,l,f,d,b,x,C){switch(f){case Qr:if(o.byteLength!=l.byteLength||o.byteOffset!=l.byteOffset)return!1;o=o.buffer,l=l.buffer;case Ki:return!(o.byteLength!=l.byteLength||!x(new uo(o),new uo(l)));case $i:case Hi:case Wi:return nn(+o,+l);case js:return o.name==l.name&&o.message==l.message;case Vi:case Ui:return o==l+"";case Zt:var M=pu;case Qt:var I=d&S;if(M||(M=ro),o.size!=l.size&&!I)return!1;var P=C.get(o);if(P)return P==l;d|=E,C.set(o,l);var D=fp(M(o),M(l),d,b,x,C);return C.delete(o),D;case Xs:if(Zi)return Zi.call(o)==Zi.call(l)}return!1}function iw(o,l,f,d,b,x){var C=f&S,M=zu(o),I=M.length,P=zu(l),D=P.length;if(I!=D&&!C)return!1;for(var B=I;B--;){var q=M[B];if(!(C?q in l:ve.call(l,q)))return!1}var j=x.get(o),X=x.get(l);if(j&&X)return j==l&&X==o;var se=!0;x.set(o,l),x.set(l,o);for(var Z=C;++B<I;){q=M[B];var ce=o[q],me=l[q];if(d)var At=C?d(me,ce,q,l,o,x):d(ce,me,q,o,l,x);if(!(At===t?ce===me||b(ce,me,f,d,x):At)){se=!1;break}Z||(Z=q=="constructor")}if(se&&!Z){var ot=o.constructor,Mt=l.constructor;ot!=Mt&&"constructor"in o&&"constructor"in l&&!(typeof ot=="function"&&ot instanceof ot&&typeof Mt=="function"&&Mt instanceof Mt)&&(se=!1)}return x.delete(o),x.delete(l),se}function Mn(o){return Gu(yp(o,t,kp),o+"")}function zu(o){return Id(o,Ve,Vu)}function $u(o){return Id(o,pt,hp)}var Hu=go?function(o){return go.get(o)}:oc;function Oo(o){for(var l=o.name+"",f=ai[l],d=ve.call(ai,l)?f.length:0;d--;){var b=f[d],x=b.func;if(x==null||x==o)return b.name}return l}function fi(o){var l=ve.call(w,"placeholder")?w:o;return l.placeholder}function Y(){var o=w.iteratee||ic;return o=o===ic?Ld:o,arguments.length?o(arguments[0],arguments[1]):o}function Io(o,l){var f=o.__data__;return hw(l)?f[typeof l=="string"?"string":"hash"]:f.map}function Wu(o){for(var l=Ve(o),f=l.length;f--;){var d=l[f],b=o[d];l[f]=[d,b,mp(b)]}return l}function Lr(o,l){var f=m2(o,l);return Rd(f)?f:t}function sw(o){var l=ve.call(o,Mr),f=o[Mr];try{o[Mr]=t;var d=!0}catch{}var b=ao.call(o);return d&&(l?o[Mr]=f:delete o[Mr]),b}var Vu=gu?function(o){return o==null?[]:(o=xe(o),Xn(gu(o),function(l){return bd.call(o,l)}))}:ac,hp=gu?function(o){for(var l=[];o;)Zn(l,Vu(o)),o=co(o);return l}:ac,rt=it;(yu&&rt(new yu(new ArrayBuffer(1)))!=Qr||ji&&rt(new ji)!=Zt||bu&&rt(bu.resolve())!=Ah||oi&&rt(new oi)!=Qt||Yi&&rt(new Yi)!=qi)&&(rt=function(o){var l=it(o),f=l==Cn?o.constructor:t,d=f?Pr(f):"";if(d)switch(d){case H2:return Qr;case W2:return Zt;case V2:return Ah;case U2:return Qt;case q2:return qi}return l});function ow(o,l,f){for(var d=-1,b=f.length;++d<b;){var x=f[d],C=x.size;switch(x.type){case"drop":o+=C;break;case"dropRight":l-=C;break;case"take":l=nt(l,o+C);break;case"takeRight":o=ze(o,l-C);break}}return{start:o,end:l}}function aw(o){var l=o.match(db);return l?l[1].split(pb):[]}function dp(o,l,f){l=rr(l,o);for(var d=-1,b=l.length,x=!1;++d<b;){var C=dn(l[d]);if(!(x=o!=null&&f(o,C)))break;o=o[C]}return x||++d!=b?x:(b=o==null?0:o.length,!!b&&Bo(b)&&On(C,b)&&(re(o)||Dr(o)))}function lw(o){var l=o.length,f=new o.constructor(l);return l&&typeof o[0]=="string"&&ve.call(o,"index")&&(f.index=o.index,f.input=o.input),f}function pp(o){return typeof o.constructor=="function"&&!ss(o)?li(co(o)):{}}function uw(o,l,f){var d=o.constructor;switch(l){case Ki:return Du(o);case $i:case Hi:return new d(+o);case Qr:return K_(o,f);case Wl:case Vl:case Ul:case ql:case Kl:case Gl:case Jl:case jl:case Yl:return Yd(o,f);case Zt:return new d;case Wi:case Ui:return new d(o);case Vi:return G_(o);case Qt:return new d;case Xs:return J_(o)}}function cw(o,l){var f=l.length;if(!f)return o;var d=f-1;return l[d]=(f>1?"& ":"")+l[d],l=l.join(f>2?", ":" "),o.replace(hb,`{
46
46
  /* [wrapped with `+l+`] */
47
- `)}function cw(o){return re(o)||Pr(o)||!!(_d&&o&&o[_d])}function Mn(o,l){var f=typeof o;return l=l??Yn,!!l&&(f=="number"||f!="symbol"&&Sb.test(o))&&o>-1&&o%1==0&&o<l}function st(o,l,f){if(!Me(f))return!1;var d=typeof l;return(d=="number"?dt(f)&&Mn(l,f.length):d=="string"&&l in f)?nn(f[l],o):!1}function Uu(o,l){if(re(o))return!1;var f=typeof o;return f=="number"||f=="symbol"||f=="boolean"||o==null||kt(o)?!0:ab.test(o)||!ob.test(o)||l!=null&&o in xe(l)}function fw(o){var l=typeof o;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?o!=="__proto__":o===null}function qu(o){var l=Mo(o),f=w[l];if(typeof f!="function"||!(l in fe.prototype))return!1;if(o===f)return!0;var d=Hu(f);return!!d&&o===d[0]}function hw(o){return!!md&&md in o}var dw=so?In:lc;function ss(o){var l=o&&o.constructor,f=typeof l=="function"&&l.prototype||si;return o===f}function mp(o){return o===o&&!Me(o)}function gp(o,l){return function(f){return f==null?!1:f[o]===l&&(l!==t||o in xe(f))}}function pw(o){var l=Do(o,function(d){return f.size===h&&f.clear(),d}),f=l.cache;return l}function mw(o,l){var f=o[1],d=l[1],b=f|d,x=b<(N|g|U),C=d==U&&f==k||d==U&&f==H&&o[7].length<=l[8]||d==(U|H)&&l[7].length<=l[8]&&f==k;if(!(x||C))return o;d&N&&(o[2]=l[2],b|=f&N?0:v);var O=l[3];if(O){var I=o[3];o[3]=I?Zd(I,O,l[4]):O,o[4]=I?Qn(o[3],p):l[4]}return O=l[5],O&&(I=o[5],o[5]=I?Qd(I,O,l[6]):O,o[6]=I?Qn(o[5],p):l[6]),O=l[7],O&&(o[7]=O),d&U&&(o[8]=o[8]==null?l[8]:nt(o[8],l[8])),o[9]==null&&(o[9]=l[9]),o[0]=l[0],o[1]=b,o}function gw(o){var l=[];if(o!=null)for(var f in xe(o))l.push(f);return l}function yw(o){return ao.call(o)}function yp(o,l,f){return l=ze(l===t?o.length-1:l,0),function(){for(var d=arguments,b=-1,x=ze(d.length-l,0),C=R(x);++b<x;)C[b]=d[l+b];b=-1;for(var O=R(l+1);++b<l;)O[b]=d[b];return O[l]=f(C),xt(o,this,O)}}function bp(o,l){return l.length<2?o:Nr(o,Wt(l,0,-1))}function bw(o,l){for(var f=o.length,d=nt(l.length,f),b=ht(o);d--;){var x=l[d];o[d]=Mn(x,f)?b[x]:t}return o}function Ku(o,l){if(!(l==="constructor"&&typeof o[l]=="function")&&l!="__proto__")return o[l]}var _p=vp(Wd),as=R2||function(o,l){return Xe.setTimeout(o,l)},Gu=vp(H_);function wp(o,l,f){var d=l+"";return Gu(o,uw(d,_w(ow(d),f)))}function vp(o){var l=0,f=0;return function(){var d=F2(),b=Sn-(d-f);if(f=d,b>0){if(++l>=wt)return arguments[0]}else l=0;return o.apply(t,arguments)}}function No(o,l){var f=-1,d=o.length,b=d-1;for(l=l===t?d:l;++f<l;){var x=Ou(f,b),C=o[x];o[x]=o[f],o[f]=C}return o.length=l,o}var Sp=pw(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(lb,function(f,d,b,x){l.push(b?x.replace(gb,"$1"):d||f)}),l});function dn(o){if(typeof o=="string"||kt(o))return o;var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}function Lr(o){if(o!=null){try{return oo.call(o)}catch{}try{return o+""}catch{}}return""}function _w(o,l){return Bt(Hl,function(f){var d="_."+f[0];l&f[1]&&!to(o,d)&&o.push(d)}),o.sort()}function xp(o){if(o instanceof fe)return o.clone();var l=new $t(o.__wrapped__,o.__chain__);return l.__actions__=ht(o.__actions__),l.__index__=o.__index__,l.__values__=o.__values__,l}function ww(o,l,f){(f?st(o,l,f):l===t)?l=1:l=ze(ie(l),0);var d=o==null?0:o.length;if(!d||l<1)return[];for(var b=0,x=0,C=R(po(d/l));b<d;)C[x++]=Wt(o,b,b+=l);return C}function vw(o){for(var l=-1,f=o==null?0:o.length,d=0,b=[];++l<f;){var x=o[l];x&&(b[d++]=x)}return b}function Sw(){var o=arguments.length;if(!o)return[];for(var l=R(o-1),f=arguments[0],d=o;d--;)l[d-1]=arguments[d];return Zn(re(f)?ht(f):[f],Ze(l,1))}var xw=ue(function(o,l){return Le(o)?es(o,Ze(l,1,Le,!0)):[]}),Cw=ue(function(o,l){var f=Vt(l);return Le(f)&&(f=t),Le(o)?es(o,Ze(l,1,Le,!0),Y(f,2)):[]}),Ew=ue(function(o,l){var f=Vt(l);return Le(f)&&(f=t),Le(o)?es(o,Ze(l,1,Le,!0),t,f):[]});function kw(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),Wt(o,l<0?0:l,d)):[]}function Aw(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),l=d-l,Wt(o,0,l<0?0:l)):[]}function Tw(o,l){return o&&o.length?Co(o,Y(l,3),!0,!0):[]}function Ow(o,l){return o&&o.length?Co(o,Y(l,3),!0):[]}function Mw(o,l,f,d){var b=o==null?0:o.length;return b?(f&&typeof f!="number"&&st(o,l,f)&&(f=0,d=b),S_(o,l,f,d)):[]}function Cp(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=f==null?0:ie(f);return b<0&&(b=ze(d+b,0)),no(o,Y(l,3),b)}function Ep(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=d-1;return f!==t&&(b=ie(f),b=f<0?ze(d+b,0):nt(b,d-1)),no(o,Y(l,3),b,!0)}function kp(o){var l=o==null?0:o.length;return l?Ze(o,1):[]}function Iw(o){var l=o==null?0:o.length;return l?Ze(o,vt):[]}function Nw(o,l){var f=o==null?0:o.length;return f?(l=l===t?1:ie(l),Ze(o,l)):[]}function Rw(o){for(var l=-1,f=o==null?0:o.length,d={};++l<f;){var b=o[l];d[b[0]]=b[1]}return d}function Ap(o){return o&&o.length?o[0]:t}function Lw(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=f==null?0:ie(f);return b<0&&(b=ze(d+b,0)),ti(o,l,b)}function Pw(o){var l=o==null?0:o.length;return l?Wt(o,0,-1):[]}var Dw=ue(function(o){var l=Ae(o,Lu);return l.length&&l[0]===o[0]?Cu(l):[]}),Fw=ue(function(o){var l=Vt(o),f=Ae(o,Lu);return l===Vt(f)?l=t:f.pop(),f.length&&f[0]===o[0]?Cu(f,Y(l,2)):[]}),Bw=ue(function(o){var l=Vt(o),f=Ae(o,Lu);return l=typeof l=="function"?l:t,l&&f.pop(),f.length&&f[0]===o[0]?Cu(f,t,l):[]});function zw(o,l){return o==null?"":P2.call(o,l)}function Vt(o){var l=o==null?0:o.length;return l?o[l-1]:t}function $w(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=d;return f!==t&&(b=ie(f),b=b<0?ze(d+b,0):nt(b,d-1)),l===l?_2(o,l,b):no(o,ad,b,!0)}function Hw(o,l){return o&&o.length?Bd(o,ie(l)):t}var Ww=ue(Tp);function Tp(o,l){return o&&o.length&&l&&l.length?Tu(o,l):o}function Vw(o,l,f){return o&&o.length&&l&&l.length?Tu(o,l,Y(f,2)):o}function Uw(o,l,f){return o&&o.length&&l&&l.length?Tu(o,l,t,f):o}var qw=On(function(o,l){var f=o==null?0:o.length,d=wu(o,l);return Hd(o,Ae(l,function(b){return Mn(b,f)?+b:b}).sort(Xd)),d});function Kw(o,l){var f=[];if(!(o&&o.length))return f;var d=-1,b=[],x=o.length;for(l=Y(l,3);++d<x;){var C=o[d];l(C,d,o)&&(f.push(C),b.push(d))}return Hd(o,b),f}function Ju(o){return o==null?o:z2.call(o)}function Gw(o,l,f){var d=o==null?0:o.length;return d?(f&&typeof f!="number"&&st(o,l,f)?(l=0,f=d):(l=l==null?0:ie(l),f=f===t?d:ie(f)),Wt(o,l,f)):[]}function Jw(o,l){return xo(o,l)}function jw(o,l,f){return Iu(o,l,Y(f,2))}function Yw(o,l){var f=o==null?0:o.length;if(f){var d=xo(o,l);if(d<f&&nn(o[d],l))return d}return-1}function Xw(o,l){return xo(o,l,!0)}function Zw(o,l,f){return Iu(o,l,Y(f,2),!0)}function Qw(o,l){var f=o==null?0:o.length;if(f){var d=xo(o,l,!0)-1;if(nn(o[d],l))return d}return-1}function ev(o){return o&&o.length?Vd(o):[]}function tv(o,l){return o&&o.length?Vd(o,Y(l,2)):[]}function nv(o){var l=o==null?0:o.length;return l?Wt(o,1,l):[]}function rv(o,l,f){return o&&o.length?(l=f||l===t?1:ie(l),Wt(o,0,l<0?0:l)):[]}function iv(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),l=d-l,Wt(o,l<0?0:l,d)):[]}function sv(o,l){return o&&o.length?Co(o,Y(l,3),!1,!0):[]}function ov(o,l){return o&&o.length?Co(o,Y(l,3)):[]}var av=ue(function(o){return nr(Ze(o,1,Le,!0))}),lv=ue(function(o){var l=Vt(o);return Le(l)&&(l=t),nr(Ze(o,1,Le,!0),Y(l,2))}),uv=ue(function(o){var l=Vt(o);return l=typeof l=="function"?l:t,nr(Ze(o,1,Le,!0),t,l)});function cv(o){return o&&o.length?nr(o):[]}function fv(o,l){return o&&o.length?nr(o,Y(l,2)):[]}function hv(o,l){return l=typeof l=="function"?l:t,o&&o.length?nr(o,t,l):[]}function ju(o){if(!(o&&o.length))return[];var l=0;return o=Xn(o,function(f){if(Le(f))return l=ze(f.length,l),!0}),hu(l,function(f){return Ae(o,uu(f))})}function Op(o,l){if(!(o&&o.length))return[];var f=ju(o);return l==null?f:Ae(f,function(d){return xt(l,t,d)})}var dv=ue(function(o,l){return Le(o)?es(o,l):[]}),pv=ue(function(o){return Ru(Xn(o,Le))}),mv=ue(function(o){var l=Vt(o);return Le(l)&&(l=t),Ru(Xn(o,Le),Y(l,2))}),gv=ue(function(o){var l=Vt(o);return l=typeof l=="function"?l:t,Ru(Xn(o,Le),t,l)}),yv=ue(ju);function bv(o,l){return Gd(o||[],l||[],Qi)}function _v(o,l){return Gd(o||[],l||[],rs)}var wv=ue(function(o){var l=o.length,f=l>1?o[l-1]:t;return f=typeof f=="function"?(o.pop(),f):t,Op(o,f)});function Mp(o){var l=w(o);return l.__chain__=!0,l}function vv(o,l){return l(o),o}function Ro(o,l){return l(o)}var Sv=On(function(o){var l=o.length,f=l?o[0]:0,d=this.__wrapped__,b=function(x){return wu(x,o)};return l>1||this.__actions__.length||!(d instanceof fe)||!Mn(f)?this.thru(b):(d=d.slice(f,+f+(l?1:0)),d.__actions__.push({func:Ro,args:[b],thisArg:t}),new $t(d,this.__chain__).thru(function(x){return l&&!x.length&&x.push(t),x}))});function xv(){return Mp(this)}function Cv(){return new $t(this.value(),this.__chain__)}function Ev(){this.__values__===t&&(this.__values__=Up(this.value()));var o=this.__index__>=this.__values__.length,l=o?t:this.__values__[this.__index__++];return{done:o,value:l}}function kv(){return this}function Av(o){for(var l,f=this;f instanceof bo;){var d=xp(f);d.__index__=0,d.__values__=t,l?b.__wrapped__=d:l=d;var b=d;f=f.__wrapped__}return b.__wrapped__=o,l}function Tv(){var o=this.__wrapped__;if(o instanceof fe){var l=o;return this.__actions__.length&&(l=new fe(this)),l=l.reverse(),l.__actions__.push({func:Ro,args:[Ju],thisArg:t}),new $t(l,this.__chain__)}return this.thru(Ju)}function Ov(){return Kd(this.__wrapped__,this.__actions__)}var Mv=Eo(function(o,l,f){ve.call(o,f)?++o[f]:An(o,f,1)});function Iv(o,l,f){var d=re(o)?sd:v_;return f&&st(o,l,f)&&(l=t),d(o,Y(l,3))}function Nv(o,l){var f=re(o)?Xn:Od;return f(o,Y(l,3))}var Rv=rp(Cp),Lv=rp(Ep);function Pv(o,l){return Ze(Lo(o,l),1)}function Dv(o,l){return Ze(Lo(o,l),vt)}function Fv(o,l,f){return f=f===t?1:ie(f),Ze(Lo(o,l),f)}function Ip(o,l){var f=re(o)?Bt:tr;return f(o,Y(l,3))}function Np(o,l){var f=re(o)?n2:Td;return f(o,Y(l,3))}var Bv=Eo(function(o,l,f){ve.call(o,f)?o[f].push(l):An(o,f,[l])});function zv(o,l,f,d){o=dt(o)?o:di(o),f=f&&!d?ie(f):0;var b=o.length;return f<0&&(f=ze(b+f,0)),zo(o)?f<=b&&o.indexOf(l,f)>-1:!!b&&ti(o,l,f)>-1}var $v=ue(function(o,l,f){var d=-1,b=typeof l=="function",x=dt(o)?R(o.length):[];return tr(o,function(C){x[++d]=b?xt(l,C,f):ts(C,l,f)}),x}),Hv=Eo(function(o,l,f){An(o,f,l)});function Lo(o,l){var f=re(o)?Ae:Pd;return f(o,Y(l,3))}function Wv(o,l,f,d){return o==null?[]:(re(l)||(l=l==null?[]:[l]),f=d?t:f,re(f)||(f=f==null?[]:[f]),zd(o,l,f))}var Vv=Eo(function(o,l,f){o[f?0:1].push(l)},function(){return[[],[]]});function Uv(o,l,f){var d=re(o)?au:ud,b=arguments.length<3;return d(o,Y(l,4),f,b,tr)}function qv(o,l,f){var d=re(o)?r2:ud,b=arguments.length<3;return d(o,Y(l,4),f,b,Td)}function Kv(o,l){var f=re(o)?Xn:Od;return f(o,Fo(Y(l,3)))}function Gv(o){var l=re(o)?Cd:z_;return l(o)}function Jv(o,l,f){(f?st(o,l,f):l===t)?l=1:l=ie(l);var d=re(o)?g_:$_;return d(o,l)}function jv(o){var l=re(o)?y_:W_;return l(o)}function Yv(o){if(o==null)return 0;if(dt(o))return zo(o)?ri(o):o.length;var l=rt(o);return l==Zt||l==Qt?o.size:ku(o).length}function Xv(o,l,f){var d=re(o)?lu:V_;return f&&st(o,l,f)&&(l=t),d(o,Y(l,3))}var Zv=ue(function(o,l){if(o==null)return[];var f=l.length;return f>1&&st(o,l[0],l[1])?l=[]:f>2&&st(l[0],l[1],l[2])&&(l=[l[0]]),zd(o,Ze(l,1),[])}),Po=N2||function(){return Xe.Date.now()};function Qv(o,l){if(typeof l!="function")throw new zt(a);return o=ie(o),function(){if(--o<1)return l.apply(this,arguments)}}function Rp(o,l,f){return l=f?t:l,l=o&&l==null?o.length:l,Tn(o,U,t,t,t,t,l)}function Lp(o,l){var f;if(typeof l!="function")throw new zt(a);return o=ie(o),function(){return--o>0&&(f=l.apply(this,arguments)),o<=1&&(l=t),f}}var Yu=ue(function(o,l,f){var d=N;if(f.length){var b=Qn(f,fi(Yu));d|=T}return Tn(o,d,l,f,b)}),Pp=ue(function(o,l,f){var d=N|g;if(f.length){var b=Qn(f,fi(Pp));d|=T}return Tn(l,d,o,f,b)});function Dp(o,l,f){l=f?t:l;var d=Tn(o,k,t,t,t,t,t,l);return d.placeholder=Dp.placeholder,d}function Fp(o,l,f){l=f?t:l;var d=Tn(o,A,t,t,t,t,t,l);return d.placeholder=Fp.placeholder,d}function Bp(o,l,f){var d,b,x,C,O,I,P=0,D=!1,B=!1,q=!0;if(typeof o!="function")throw new zt(a);l=Ut(l)||0,Me(f)&&(D=!!f.leading,B="maxWait"in f,x=B?ze(Ut(f.maxWait)||0,l):x,q="trailing"in f?!!f.trailing:q);function j(Pe){var rn=d,Rn=b;return d=b=t,P=Pe,C=o.apply(Rn,rn),C}function X(Pe){return P=Pe,O=as(ce,l),D?j(Pe):C}function se(Pe){var rn=Pe-I,Rn=Pe-P,rm=l-rn;return B?nt(rm,x-Rn):rm}function Z(Pe){var rn=Pe-I,Rn=Pe-P;return I===t||rn>=l||rn<0||B&&Rn>=x}function ce(){var Pe=Po();if(Z(Pe))return me(Pe);O=as(ce,se(Pe))}function me(Pe){return O=t,q&&d?j(Pe):(d=b=t,C)}function At(){O!==t&&Jd(O),P=0,d=I=b=O=t}function ot(){return O===t?C:me(Po())}function Tt(){var Pe=Po(),rn=Z(Pe);if(d=arguments,b=this,I=Pe,rn){if(O===t)return X(I);if(B)return Jd(O),O=as(ce,l),j(I)}return O===t&&(O=as(ce,l)),C}return Tt.cancel=At,Tt.flush=ot,Tt}var eS=ue(function(o,l){return Ad(o,1,l)}),tS=ue(function(o,l,f){return Ad(o,Ut(l)||0,f)});function nS(o){return Tn(o,ee)}function Do(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new zt(a);var f=function(){var d=arguments,b=l?l.apply(this,d):d[0],x=f.cache;if(x.has(b))return x.get(b);var C=o.apply(this,d);return f.cache=x.set(b,C)||x,C};return f.cache=new(Do.Cache||kn),f}Do.Cache=kn;function Fo(o){if(typeof o!="function")throw new zt(a);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function rS(o){return Lp(2,o)}var iS=U_(function(o,l){l=l.length==1&&re(l[0])?Ae(l[0],Ct(Y())):Ae(Ze(l,1),Ct(Y()));var f=l.length;return ue(function(d){for(var b=-1,x=nt(d.length,f);++b<x;)d[b]=l[b].call(this,d[b]);return xt(o,this,d)})}),Xu=ue(function(o,l){var f=Qn(l,fi(Xu));return Tn(o,T,t,l,f)}),zp=ue(function(o,l){var f=Qn(l,fi(zp));return Tn(o,F,t,l,f)}),sS=On(function(o,l){return Tn(o,H,t,t,t,l)});function oS(o,l){if(typeof o!="function")throw new zt(a);return l=l===t?l:ie(l),ue(o,l)}function aS(o,l){if(typeof o!="function")throw new zt(a);return l=l==null?0:ze(ie(l),0),ue(function(f){var d=f[l],b=ir(f,0,l);return d&&Zn(b,d),xt(o,this,b)})}function lS(o,l,f){var d=!0,b=!0;if(typeof o!="function")throw new zt(a);return Me(f)&&(d="leading"in f?!!f.leading:d,b="trailing"in f?!!f.trailing:b),Bp(o,l,{leading:d,maxWait:l,trailing:b})}function uS(o){return Rp(o,1)}function cS(o,l){return Xu(Pu(l),o)}function fS(){if(!arguments.length)return[];var o=arguments[0];return re(o)?o:[o]}function hS(o){return Ht(o,_)}function dS(o,l){return l=typeof l=="function"?l:t,Ht(o,_,l)}function pS(o){return Ht(o,m|_)}function mS(o,l){return l=typeof l=="function"?l:t,Ht(o,m|_,l)}function gS(o,l){return l==null||kd(o,l,Ve(l))}function nn(o,l){return o===l||o!==o&&l!==l}var yS=Oo(xu),bS=Oo(function(o,l){return o>=l}),Pr=Nd(function(){return arguments}())?Nd:function(o){return Ie(o)&&ve.call(o,"callee")&&!bd.call(o,"callee")},re=R.isArray,_S=Qh?Ct(Qh):A_;function dt(o){return o!=null&&Bo(o.length)&&!In(o)}function Le(o){return Ie(o)&&dt(o)}function wS(o){return o===!0||o===!1||Ie(o)&&it(o)==$i}var sr=L2||lc,vS=ed?Ct(ed):T_;function SS(o){return Ie(o)&&o.nodeType===1&&!ls(o)}function xS(o){if(o==null)return!0;if(dt(o)&&(re(o)||typeof o=="string"||typeof o.splice=="function"||sr(o)||hi(o)||Pr(o)))return!o.length;var l=rt(o);if(l==Zt||l==Qt)return!o.size;if(ss(o))return!ku(o).length;for(var f in o)if(ve.call(o,f))return!1;return!0}function CS(o,l){return ns(o,l)}function ES(o,l,f){f=typeof f=="function"?f:t;var d=f?f(o,l):t;return d===t?ns(o,l,t,f):!!d}function Zu(o){if(!Ie(o))return!1;var l=it(o);return l==js||l==Jy||typeof o.message=="string"&&typeof o.name=="string"&&!ls(o)}function kS(o){return typeof o=="number"&&wd(o)}function In(o){if(!Me(o))return!1;var l=it(o);return l==Ys||l==Ah||l==Gy||l==Yy}function $p(o){return typeof o=="number"&&o==ie(o)}function Bo(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Yn}function Me(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function Ie(o){return o!=null&&typeof o=="object"}var Hp=td?Ct(td):M_;function AS(o,l){return o===l||Eu(o,l,Wu(l))}function TS(o,l,f){return f=typeof f=="function"?f:t,Eu(o,l,Wu(l),f)}function OS(o){return Wp(o)&&o!=+o}function MS(o){if(dw(o))throw new ne(s);return Rd(o)}function IS(o){return o===null}function NS(o){return o==null}function Wp(o){return typeof o=="number"||Ie(o)&&it(o)==Wi}function ls(o){if(!Ie(o)||it(o)!=Cn)return!1;var l=co(o);if(l===null)return!0;var f=ve.call(l,"constructor")&&l.constructor;return typeof f=="function"&&f instanceof f&&oo.call(f)==T2}var Qu=nd?Ct(nd):I_;function RS(o){return $p(o)&&o>=-9007199254740991&&o<=Yn}var Vp=rd?Ct(rd):N_;function zo(o){return typeof o=="string"||!re(o)&&Ie(o)&&it(o)==Ui}function kt(o){return typeof o=="symbol"||Ie(o)&&it(o)==Xs}var hi=id?Ct(id):R_;function LS(o){return o===t}function PS(o){return Ie(o)&&rt(o)==qi}function DS(o){return Ie(o)&&it(o)==Zy}var FS=Oo(Au),BS=Oo(function(o,l){return o<=l});function Up(o){if(!o)return[];if(dt(o))return zo(o)?en(o):ht(o);if(Ji&&o[Ji])return g2(o[Ji]());var l=rt(o),f=l==Zt?pu:l==Qt?ro:di;return f(o)}function Nn(o){if(!o)return o===0?o:0;if(o=Ut(o),o===vt||o===-1/0){var l=o<0?-1:1;return l*Gs}return o===o?o:0}function ie(o){var l=Nn(o),f=l%1;return l===l?f?l-f:l:0}function qp(o){return o?Ir(ie(o),0,St):0}function Ut(o){if(typeof o=="number")return o;if(kt(o))return cn;if(Me(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=Me(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=cd(o);var f=_b.test(o);return f||vb.test(o)?Qb(o.slice(2),f?2:8):bb.test(o)?cn:+o}function Kp(o){return hn(o,pt(o))}function zS(o){return o?Ir(ie(o),-9007199254740991,Yn):o===0?o:0}function _e(o){return o==null?"":Et(o)}var $S=ui(function(o,l){if(ss(l)||dt(l)){hn(l,Ve(l),o);return}for(var f in l)ve.call(l,f)&&Qi(o,f,l[f])}),Gp=ui(function(o,l){hn(l,pt(l),o)}),$o=ui(function(o,l,f,d){hn(l,pt(l),o,d)}),HS=ui(function(o,l,f,d){hn(l,Ve(l),o,d)}),WS=On(wu);function VS(o,l){var f=li(o);return l==null?f:Ed(f,l)}var US=ue(function(o,l){o=xe(o);var f=-1,d=l.length,b=d>2?l[2]:t;for(b&&st(l[0],l[1],b)&&(d=1);++f<d;)for(var x=l[f],C=pt(x),O=-1,I=C.length;++O<I;){var P=C[O],D=o[P];(D===t||nn(D,si[P])&&!ve.call(o,P))&&(o[P]=x[P])}return o}),qS=ue(function(o){return o.push(t,cp),xt(Jp,t,o)});function KS(o,l){return od(o,Y(l,3),fn)}function GS(o,l){return od(o,Y(l,3),Su)}function JS(o,l){return o==null?o:vu(o,Y(l,3),pt)}function jS(o,l){return o==null?o:Md(o,Y(l,3),pt)}function YS(o,l){return o&&fn(o,Y(l,3))}function XS(o,l){return o&&Su(o,Y(l,3))}function ZS(o){return o==null?[]:vo(o,Ve(o))}function QS(o){return o==null?[]:vo(o,pt(o))}function ec(o,l,f){var d=o==null?t:Nr(o,l);return d===t?f:d}function ex(o,l){return o!=null&&dp(o,l,x_)}function tc(o,l){return o!=null&&dp(o,l,C_)}var tx=sp(function(o,l,f){l!=null&&typeof l.toString!="function"&&(l=ao.call(l)),o[l]=f},rc(mt)),nx=sp(function(o,l,f){l!=null&&typeof l.toString!="function"&&(l=ao.call(l)),ve.call(o,l)?o[l].push(f):o[l]=[f]},Y),rx=ue(ts);function Ve(o){return dt(o)?xd(o):ku(o)}function pt(o){return dt(o)?xd(o,!0):L_(o)}function ix(o,l){var f={};return l=Y(l,3),fn(o,function(d,b,x){An(f,l(d,b,x),d)}),f}function sx(o,l){var f={};return l=Y(l,3),fn(o,function(d,b,x){An(f,b,l(d,b,x))}),f}var ox=ui(function(o,l,f){So(o,l,f)}),Jp=ui(function(o,l,f,d){So(o,l,f,d)}),ax=On(function(o,l){var f={};if(o==null)return f;var d=!1;l=Ae(l,function(x){return x=rr(x,o),d||(d=x.length>1),x}),hn(o,$u(o),f),d&&(f=Ht(f,m|y|_,tw));for(var b=l.length;b--;)Nu(f,l[b]);return f});function lx(o,l){return jp(o,Fo(Y(l)))}var ux=On(function(o,l){return o==null?{}:D_(o,l)});function jp(o,l){if(o==null)return{};var f=Ae($u(o),function(d){return[d]});return l=Y(l),$d(o,f,function(d,b){return l(d,b[0])})}function cx(o,l,f){l=rr(l,o);var d=-1,b=l.length;for(b||(b=1,o=t);++d<b;){var x=o==null?t:o[dn(l[d])];x===t&&(d=b,x=f),o=In(x)?x.call(o):x}return o}function fx(o,l,f){return o==null?o:rs(o,l,f)}function hx(o,l,f,d){return d=typeof d=="function"?d:t,o==null?o:rs(o,l,f,d)}var Yp=lp(Ve),Xp=lp(pt);function dx(o,l,f){var d=re(o),b=d||sr(o)||hi(o);if(l=Y(l,4),f==null){var x=o&&o.constructor;b?f=d?new x:[]:Me(o)?f=In(x)?li(co(o)):{}:f={}}return(b?Bt:fn)(o,function(C,O,I){return l(f,C,O,I)}),f}function px(o,l){return o==null?!0:Nu(o,l)}function mx(o,l,f){return o==null?o:qd(o,l,Pu(f))}function gx(o,l,f,d){return d=typeof d=="function"?d:t,o==null?o:qd(o,l,Pu(f),d)}function di(o){return o==null?[]:du(o,Ve(o))}function yx(o){return o==null?[]:du(o,pt(o))}function bx(o,l,f){return f===t&&(f=l,l=t),f!==t&&(f=Ut(f),f=f===f?f:0),l!==t&&(l=Ut(l),l=l===l?l:0),Ir(Ut(o),l,f)}function _x(o,l,f){return l=Nn(l),f===t?(f=l,l=0):f=Nn(f),o=Ut(o),E_(o,l,f)}function wx(o,l,f){if(f&&typeof f!="boolean"&&st(o,l,f)&&(l=f=t),f===t&&(typeof l=="boolean"?(f=l,l=t):typeof o=="boolean"&&(f=o,o=t)),o===t&&l===t?(o=0,l=1):(o=Nn(o),l===t?(l=o,o=0):l=Nn(l)),o>l){var d=o;o=l,l=d}if(f||o%1||l%1){var b=vd();return nt(o+b*(l-o+Zb("1e-"+((b+"").length-1))),l)}return Ou(o,l)}var vx=ci(function(o,l,f){return l=l.toLowerCase(),o+(f?Zp(l):l)});function Zp(o){return nc(_e(o).toLowerCase())}function Qp(o){return o=_e(o),o&&o.replace(xb,f2).replace(Wb,"")}function Sx(o,l,f){o=_e(o),l=Et(l);var d=o.length;f=f===t?d:Ir(ie(f),0,d);var b=f;return f-=l.length,f>=0&&o.slice(f,b)==l}function xx(o){return o=_e(o),o&&rb.test(o)?o.replace(Mh,h2):o}function Cx(o){return o=_e(o),o&&ub.test(o)?o.replace(Xl,"\\$&"):o}var Ex=ci(function(o,l,f){return o+(f?"-":"")+l.toLowerCase()}),kx=ci(function(o,l,f){return o+(f?" ":"")+l.toLowerCase()}),Ax=np("toLowerCase");function Tx(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;if(!l||d>=l)return o;var b=(l-d)/2;return To(mo(b),f)+o+To(po(b),f)}function Ox(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;return l&&d<l?o+To(l-d,f):o}function Mx(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;return l&&d<l?To(l-d,f)+o:o}function Ix(o,l,f){return f||l==null?l=0:l&&(l=+l),B2(_e(o).replace(Zl,""),l||0)}function Nx(o,l,f){return(f?st(o,l,f):l===t)?l=1:l=ie(l),Mu(_e(o),l)}function Rx(){var o=arguments,l=_e(o[0]);return o.length<3?l:l.replace(o[1],o[2])}var Lx=ci(function(o,l,f){return o+(f?"_":"")+l.toLowerCase()});function Px(o,l,f){return f&&typeof f!="number"&&st(o,l,f)&&(l=f=t),f=f===t?St:f>>>0,f?(o=_e(o),o&&(typeof l=="string"||l!=null&&!Qu(l))&&(l=Et(l),!l&&ni(o))?ir(en(o),0,f):o.split(l,f)):[]}var Dx=ci(function(o,l,f){return o+(f?" ":"")+nc(l)});function Fx(o,l,f){return o=_e(o),f=f==null?0:Ir(ie(f),0,o.length),l=Et(l),o.slice(f,f+l.length)==l}function Bx(o,l,f){var d=w.templateSettings;f&&st(o,l,f)&&(l=t),o=_e(o),l=$o({},l,d,up);var b=$o({},l.imports,d.imports,up),x=Ve(b),C=du(b,x),O,I,P=0,D=l.interpolate||Zs,B="__p += '",q=mu((l.escape||Zs).source+"|"+D.source+"|"+(D===Ih?yb:Zs).source+"|"+(l.evaluate||Zs).source+"|$","g"),j="//# sourceURL="+(ve.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Gb+"]")+`
48
- `;o.replace(q,function(Z,ce,me,At,ot,Tt){return me||(me=At),B+=o.slice(P,Tt).replace(Cb,d2),ce&&(O=!0,B+=`' +
47
+ `)}function fw(o){return re(o)||Dr(o)||!!(_d&&o&&o[_d])}function On(o,l){var f=typeof o;return l=l??Yn,!!l&&(f=="number"||f!="symbol"&&xb.test(o))&&o>-1&&o%1==0&&o<l}function st(o,l,f){if(!Oe(f))return!1;var d=typeof l;return(d=="number"?dt(f)&&On(l,f.length):d=="string"&&l in f)?nn(f[l],o):!1}function Uu(o,l){if(re(o))return!1;var f=typeof o;return f=="number"||f=="symbol"||f=="boolean"||o==null||Tt(o)?!0:lb.test(o)||!ab.test(o)||l!=null&&o in xe(l)}function hw(o){var l=typeof o;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?o!=="__proto__":o===null}function qu(o){var l=Oo(o),f=w[l];if(typeof f!="function"||!(l in fe.prototype))return!1;if(o===f)return!0;var d=Hu(f);return!!d&&o===d[0]}function dw(o){return!!md&&md in o}var pw=so?In:lc;function ss(o){var l=o&&o.constructor,f=typeof l=="function"&&l.prototype||si;return o===f}function mp(o){return o===o&&!Oe(o)}function gp(o,l){return function(f){return f==null?!1:f[o]===l&&(l!==t||o in xe(f))}}function mw(o){var l=Do(o,function(d){return f.size===h&&f.clear(),d}),f=l.cache;return l}function gw(o,l){var f=o[1],d=l[1],b=f|d,x=b<(N|g|U),C=d==U&&f==k||d==U&&f==V&&o[7].length<=l[8]||d==(U|V)&&l[7].length<=l[8]&&f==k;if(!(x||C))return o;d&N&&(o[2]=l[2],b|=f&N?0:v);var M=l[3];if(M){var I=o[3];o[3]=I?Zd(I,M,l[4]):M,o[4]=I?Qn(o[3],p):l[4]}return M=l[5],M&&(I=o[5],o[5]=I?Qd(I,M,l[6]):M,o[6]=I?Qn(o[5],p):l[6]),M=l[7],M&&(o[7]=M),d&U&&(o[8]=o[8]==null?l[8]:nt(o[8],l[8])),o[9]==null&&(o[9]=l[9]),o[0]=l[0],o[1]=b,o}function yw(o){var l=[];if(o!=null)for(var f in xe(o))l.push(f);return l}function bw(o){return ao.call(o)}function yp(o,l,f){return l=ze(l===t?o.length-1:l,0),function(){for(var d=arguments,b=-1,x=ze(d.length-l,0),C=R(x);++b<x;)C[b]=d[l+b];b=-1;for(var M=R(l+1);++b<l;)M[b]=d[b];return M[l]=f(C),Ct(o,this,M)}}function bp(o,l){return l.length<2?o:Rr(o,Vt(l,0,-1))}function _w(o,l){for(var f=o.length,d=nt(l.length,f),b=ht(o);d--;){var x=l[d];o[d]=On(x,f)?b[x]:t}return o}function Ku(o,l){if(!(l==="constructor"&&typeof o[l]=="function")&&l!="__proto__")return o[l]}var _p=vp(Wd),as=L2||function(o,l){return Xe.setTimeout(o,l)},Gu=vp(W_);function wp(o,l,f){var d=l+"";return Gu(o,cw(d,ww(aw(d),f)))}function vp(o){var l=0,f=0;return function(){var d=B2(),b=Sn-(d-f);if(f=d,b>0){if(++l>=vt)return arguments[0]}else l=0;return o.apply(t,arguments)}}function No(o,l){var f=-1,d=o.length,b=d-1;for(l=l===t?d:l;++f<l;){var x=Mu(f,b),C=o[x];o[x]=o[f],o[f]=C}return o.length=l,o}var Sp=mw(function(o){var l=[];return o.charCodeAt(0)===46&&l.push(""),o.replace(ub,function(f,d,b,x){l.push(b?x.replace(yb,"$1"):d||f)}),l});function dn(o){if(typeof o=="string"||Tt(o))return o;var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}function Pr(o){if(o!=null){try{return oo.call(o)}catch{}try{return o+""}catch{}}return""}function ww(o,l){return zt(Hl,function(f){var d="_."+f[0];l&f[1]&&!to(o,d)&&o.push(d)}),o.sort()}function xp(o){if(o instanceof fe)return o.clone();var l=new Ht(o.__wrapped__,o.__chain__);return l.__actions__=ht(o.__actions__),l.__index__=o.__index__,l.__values__=o.__values__,l}function vw(o,l,f){(f?st(o,l,f):l===t)?l=1:l=ze(ie(l),0);var d=o==null?0:o.length;if(!d||l<1)return[];for(var b=0,x=0,C=R(po(d/l));b<d;)C[x++]=Vt(o,b,b+=l);return C}function Sw(o){for(var l=-1,f=o==null?0:o.length,d=0,b=[];++l<f;){var x=o[l];x&&(b[d++]=x)}return b}function xw(){var o=arguments.length;if(!o)return[];for(var l=R(o-1),f=arguments[0],d=o;d--;)l[d-1]=arguments[d];return Zn(re(f)?ht(f):[f],Ze(l,1))}var Cw=ue(function(o,l){return Le(o)?es(o,Ze(l,1,Le,!0)):[]}),Ew=ue(function(o,l){var f=Ut(l);return Le(f)&&(f=t),Le(o)?es(o,Ze(l,1,Le,!0),Y(f,2)):[]}),kw=ue(function(o,l){var f=Ut(l);return Le(f)&&(f=t),Le(o)?es(o,Ze(l,1,Le,!0),t,f):[]});function Tw(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),Vt(o,l<0?0:l,d)):[]}function Aw(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),l=d-l,Vt(o,0,l<0?0:l)):[]}function Mw(o,l){return o&&o.length?Co(o,Y(l,3),!0,!0):[]}function Ow(o,l){return o&&o.length?Co(o,Y(l,3),!0):[]}function Iw(o,l,f,d){var b=o==null?0:o.length;return b?(f&&typeof f!="number"&&st(o,l,f)&&(f=0,d=b),x_(o,l,f,d)):[]}function Cp(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=f==null?0:ie(f);return b<0&&(b=ze(d+b,0)),no(o,Y(l,3),b)}function Ep(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=d-1;return f!==t&&(b=ie(f),b=f<0?ze(d+b,0):nt(b,d-1)),no(o,Y(l,3),b,!0)}function kp(o){var l=o==null?0:o.length;return l?Ze(o,1):[]}function Nw(o){var l=o==null?0:o.length;return l?Ze(o,St):[]}function Rw(o,l){var f=o==null?0:o.length;return f?(l=l===t?1:ie(l),Ze(o,l)):[]}function Lw(o){for(var l=-1,f=o==null?0:o.length,d={};++l<f;){var b=o[l];d[b[0]]=b[1]}return d}function Tp(o){return o&&o.length?o[0]:t}function Pw(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=f==null?0:ie(f);return b<0&&(b=ze(d+b,0)),ti(o,l,b)}function Dw(o){var l=o==null?0:o.length;return l?Vt(o,0,-1):[]}var Fw=ue(function(o){var l=Ae(o,Lu);return l.length&&l[0]===o[0]?Cu(l):[]}),Bw=ue(function(o){var l=Ut(o),f=Ae(o,Lu);return l===Ut(f)?l=t:f.pop(),f.length&&f[0]===o[0]?Cu(f,Y(l,2)):[]}),zw=ue(function(o){var l=Ut(o),f=Ae(o,Lu);return l=typeof l=="function"?l:t,l&&f.pop(),f.length&&f[0]===o[0]?Cu(f,t,l):[]});function $w(o,l){return o==null?"":D2.call(o,l)}function Ut(o){var l=o==null?0:o.length;return l?o[l-1]:t}function Hw(o,l,f){var d=o==null?0:o.length;if(!d)return-1;var b=d;return f!==t&&(b=ie(f),b=b<0?ze(d+b,0):nt(b,d-1)),l===l?w2(o,l,b):no(o,ad,b,!0)}function Ww(o,l){return o&&o.length?Bd(o,ie(l)):t}var Vw=ue(Ap);function Ap(o,l){return o&&o.length&&l&&l.length?Au(o,l):o}function Uw(o,l,f){return o&&o.length&&l&&l.length?Au(o,l,Y(f,2)):o}function qw(o,l,f){return o&&o.length&&l&&l.length?Au(o,l,t,f):o}var Kw=Mn(function(o,l){var f=o==null?0:o.length,d=wu(o,l);return Hd(o,Ae(l,function(b){return On(b,f)?+b:b}).sort(Xd)),d});function Gw(o,l){var f=[];if(!(o&&o.length))return f;var d=-1,b=[],x=o.length;for(l=Y(l,3);++d<x;){var C=o[d];l(C,d,o)&&(f.push(C),b.push(d))}return Hd(o,b),f}function Ju(o){return o==null?o:$2.call(o)}function Jw(o,l,f){var d=o==null?0:o.length;return d?(f&&typeof f!="number"&&st(o,l,f)?(l=0,f=d):(l=l==null?0:ie(l),f=f===t?d:ie(f)),Vt(o,l,f)):[]}function jw(o,l){return xo(o,l)}function Yw(o,l,f){return Iu(o,l,Y(f,2))}function Xw(o,l){var f=o==null?0:o.length;if(f){var d=xo(o,l);if(d<f&&nn(o[d],l))return d}return-1}function Zw(o,l){return xo(o,l,!0)}function Qw(o,l,f){return Iu(o,l,Y(f,2),!0)}function ev(o,l){var f=o==null?0:o.length;if(f){var d=xo(o,l,!0)-1;if(nn(o[d],l))return d}return-1}function tv(o){return o&&o.length?Vd(o):[]}function nv(o,l){return o&&o.length?Vd(o,Y(l,2)):[]}function rv(o){var l=o==null?0:o.length;return l?Vt(o,1,l):[]}function iv(o,l,f){return o&&o.length?(l=f||l===t?1:ie(l),Vt(o,0,l<0?0:l)):[]}function sv(o,l,f){var d=o==null?0:o.length;return d?(l=f||l===t?1:ie(l),l=d-l,Vt(o,l<0?0:l,d)):[]}function ov(o,l){return o&&o.length?Co(o,Y(l,3),!1,!0):[]}function av(o,l){return o&&o.length?Co(o,Y(l,3)):[]}var lv=ue(function(o){return nr(Ze(o,1,Le,!0))}),uv=ue(function(o){var l=Ut(o);return Le(l)&&(l=t),nr(Ze(o,1,Le,!0),Y(l,2))}),cv=ue(function(o){var l=Ut(o);return l=typeof l=="function"?l:t,nr(Ze(o,1,Le,!0),t,l)});function fv(o){return o&&o.length?nr(o):[]}function hv(o,l){return o&&o.length?nr(o,Y(l,2)):[]}function dv(o,l){return l=typeof l=="function"?l:t,o&&o.length?nr(o,t,l):[]}function ju(o){if(!(o&&o.length))return[];var l=0;return o=Xn(o,function(f){if(Le(f))return l=ze(f.length,l),!0}),hu(l,function(f){return Ae(o,uu(f))})}function Mp(o,l){if(!(o&&o.length))return[];var f=ju(o);return l==null?f:Ae(f,function(d){return Ct(l,t,d)})}var pv=ue(function(o,l){return Le(o)?es(o,l):[]}),mv=ue(function(o){return Ru(Xn(o,Le))}),gv=ue(function(o){var l=Ut(o);return Le(l)&&(l=t),Ru(Xn(o,Le),Y(l,2))}),yv=ue(function(o){var l=Ut(o);return l=typeof l=="function"?l:t,Ru(Xn(o,Le),t,l)}),bv=ue(ju);function _v(o,l){return Gd(o||[],l||[],Qi)}function wv(o,l){return Gd(o||[],l||[],rs)}var vv=ue(function(o){var l=o.length,f=l>1?o[l-1]:t;return f=typeof f=="function"?(o.pop(),f):t,Mp(o,f)});function Op(o){var l=w(o);return l.__chain__=!0,l}function Sv(o,l){return l(o),o}function Ro(o,l){return l(o)}var xv=Mn(function(o){var l=o.length,f=l?o[0]:0,d=this.__wrapped__,b=function(x){return wu(x,o)};return l>1||this.__actions__.length||!(d instanceof fe)||!On(f)?this.thru(b):(d=d.slice(f,+f+(l?1:0)),d.__actions__.push({func:Ro,args:[b],thisArg:t}),new Ht(d,this.__chain__).thru(function(x){return l&&!x.length&&x.push(t),x}))});function Cv(){return Op(this)}function Ev(){return new Ht(this.value(),this.__chain__)}function kv(){this.__values__===t&&(this.__values__=Up(this.value()));var o=this.__index__>=this.__values__.length,l=o?t:this.__values__[this.__index__++];return{done:o,value:l}}function Tv(){return this}function Av(o){for(var l,f=this;f instanceof bo;){var d=xp(f);d.__index__=0,d.__values__=t,l?b.__wrapped__=d:l=d;var b=d;f=f.__wrapped__}return b.__wrapped__=o,l}function Mv(){var o=this.__wrapped__;if(o instanceof fe){var l=o;return this.__actions__.length&&(l=new fe(this)),l=l.reverse(),l.__actions__.push({func:Ro,args:[Ju],thisArg:t}),new Ht(l,this.__chain__)}return this.thru(Ju)}function Ov(){return Kd(this.__wrapped__,this.__actions__)}var Iv=Eo(function(o,l,f){ve.call(o,f)?++o[f]:Tn(o,f,1)});function Nv(o,l,f){var d=re(o)?sd:S_;return f&&st(o,l,f)&&(l=t),d(o,Y(l,3))}function Rv(o,l){var f=re(o)?Xn:Md;return f(o,Y(l,3))}var Lv=rp(Cp),Pv=rp(Ep);function Dv(o,l){return Ze(Lo(o,l),1)}function Fv(o,l){return Ze(Lo(o,l),St)}function Bv(o,l,f){return f=f===t?1:ie(f),Ze(Lo(o,l),f)}function Ip(o,l){var f=re(o)?zt:tr;return f(o,Y(l,3))}function Np(o,l){var f=re(o)?r2:Ad;return f(o,Y(l,3))}var zv=Eo(function(o,l,f){ve.call(o,f)?o[f].push(l):Tn(o,f,[l])});function $v(o,l,f,d){o=dt(o)?o:di(o),f=f&&!d?ie(f):0;var b=o.length;return f<0&&(f=ze(b+f,0)),zo(o)?f<=b&&o.indexOf(l,f)>-1:!!b&&ti(o,l,f)>-1}var Hv=ue(function(o,l,f){var d=-1,b=typeof l=="function",x=dt(o)?R(o.length):[];return tr(o,function(C){x[++d]=b?Ct(l,C,f):ts(C,l,f)}),x}),Wv=Eo(function(o,l,f){Tn(o,f,l)});function Lo(o,l){var f=re(o)?Ae:Pd;return f(o,Y(l,3))}function Vv(o,l,f,d){return o==null?[]:(re(l)||(l=l==null?[]:[l]),f=d?t:f,re(f)||(f=f==null?[]:[f]),zd(o,l,f))}var Uv=Eo(function(o,l,f){o[f?0:1].push(l)},function(){return[[],[]]});function qv(o,l,f){var d=re(o)?au:ud,b=arguments.length<3;return d(o,Y(l,4),f,b,tr)}function Kv(o,l,f){var d=re(o)?i2:ud,b=arguments.length<3;return d(o,Y(l,4),f,b,Ad)}function Gv(o,l){var f=re(o)?Xn:Md;return f(o,Fo(Y(l,3)))}function Jv(o){var l=re(o)?Cd:$_;return l(o)}function jv(o,l,f){(f?st(o,l,f):l===t)?l=1:l=ie(l);var d=re(o)?y_:H_;return d(o,l)}function Yv(o){var l=re(o)?b_:V_;return l(o)}function Xv(o){if(o==null)return 0;if(dt(o))return zo(o)?ri(o):o.length;var l=rt(o);return l==Zt||l==Qt?o.size:ku(o).length}function Zv(o,l,f){var d=re(o)?lu:U_;return f&&st(o,l,f)&&(l=t),d(o,Y(l,3))}var Qv=ue(function(o,l){if(o==null)return[];var f=l.length;return f>1&&st(o,l[0],l[1])?l=[]:f>2&&st(l[0],l[1],l[2])&&(l=[l[0]]),zd(o,Ze(l,1),[])}),Po=R2||function(){return Xe.Date.now()};function eS(o,l){if(typeof l!="function")throw new $t(a);return o=ie(o),function(){if(--o<1)return l.apply(this,arguments)}}function Rp(o,l,f){return l=f?t:l,l=o&&l==null?o.length:l,An(o,U,t,t,t,t,l)}function Lp(o,l){var f;if(typeof l!="function")throw new $t(a);return o=ie(o),function(){return--o>0&&(f=l.apply(this,arguments)),o<=1&&(l=t),f}}var Yu=ue(function(o,l,f){var d=N;if(f.length){var b=Qn(f,fi(Yu));d|=A}return An(o,d,l,f,b)}),Pp=ue(function(o,l,f){var d=N|g;if(f.length){var b=Qn(f,fi(Pp));d|=A}return An(l,d,o,f,b)});function Dp(o,l,f){l=f?t:l;var d=An(o,k,t,t,t,t,t,l);return d.placeholder=Dp.placeholder,d}function Fp(o,l,f){l=f?t:l;var d=An(o,T,t,t,t,t,t,l);return d.placeholder=Fp.placeholder,d}function Bp(o,l,f){var d,b,x,C,M,I,P=0,D=!1,B=!1,q=!0;if(typeof o!="function")throw new $t(a);l=qt(l)||0,Oe(f)&&(D=!!f.leading,B="maxWait"in f,x=B?ze(qt(f.maxWait)||0,l):x,q="trailing"in f?!!f.trailing:q);function j(Pe){var rn=d,Rn=b;return d=b=t,P=Pe,C=o.apply(Rn,rn),C}function X(Pe){return P=Pe,M=as(ce,l),D?j(Pe):C}function se(Pe){var rn=Pe-I,Rn=Pe-P,rm=l-rn;return B?nt(rm,x-Rn):rm}function Z(Pe){var rn=Pe-I,Rn=Pe-P;return I===t||rn>=l||rn<0||B&&Rn>=x}function ce(){var Pe=Po();if(Z(Pe))return me(Pe);M=as(ce,se(Pe))}function me(Pe){return M=t,q&&d?j(Pe):(d=b=t,C)}function At(){M!==t&&Jd(M),P=0,d=I=b=M=t}function ot(){return M===t?C:me(Po())}function Mt(){var Pe=Po(),rn=Z(Pe);if(d=arguments,b=this,I=Pe,rn){if(M===t)return X(I);if(B)return Jd(M),M=as(ce,l),j(I)}return M===t&&(M=as(ce,l)),C}return Mt.cancel=At,Mt.flush=ot,Mt}var tS=ue(function(o,l){return Td(o,1,l)}),nS=ue(function(o,l,f){return Td(o,qt(l)||0,f)});function rS(o){return An(o,ee)}function Do(o,l){if(typeof o!="function"||l!=null&&typeof l!="function")throw new $t(a);var f=function(){var d=arguments,b=l?l.apply(this,d):d[0],x=f.cache;if(x.has(b))return x.get(b);var C=o.apply(this,d);return f.cache=x.set(b,C)||x,C};return f.cache=new(Do.Cache||kn),f}Do.Cache=kn;function Fo(o){if(typeof o!="function")throw new $t(a);return function(){var l=arguments;switch(l.length){case 0:return!o.call(this);case 1:return!o.call(this,l[0]);case 2:return!o.call(this,l[0],l[1]);case 3:return!o.call(this,l[0],l[1],l[2])}return!o.apply(this,l)}}function iS(o){return Lp(2,o)}var sS=q_(function(o,l){l=l.length==1&&re(l[0])?Ae(l[0],Et(Y())):Ae(Ze(l,1),Et(Y()));var f=l.length;return ue(function(d){for(var b=-1,x=nt(d.length,f);++b<x;)d[b]=l[b].call(this,d[b]);return Ct(o,this,d)})}),Xu=ue(function(o,l){var f=Qn(l,fi(Xu));return An(o,A,t,l,f)}),zp=ue(function(o,l){var f=Qn(l,fi(zp));return An(o,F,t,l,f)}),oS=Mn(function(o,l){return An(o,V,t,t,t,l)});function aS(o,l){if(typeof o!="function")throw new $t(a);return l=l===t?l:ie(l),ue(o,l)}function lS(o,l){if(typeof o!="function")throw new $t(a);return l=l==null?0:ze(ie(l),0),ue(function(f){var d=f[l],b=ir(f,0,l);return d&&Zn(b,d),Ct(o,this,b)})}function uS(o,l,f){var d=!0,b=!0;if(typeof o!="function")throw new $t(a);return Oe(f)&&(d="leading"in f?!!f.leading:d,b="trailing"in f?!!f.trailing:b),Bp(o,l,{leading:d,maxWait:l,trailing:b})}function cS(o){return Rp(o,1)}function fS(o,l){return Xu(Pu(l),o)}function hS(){if(!arguments.length)return[];var o=arguments[0];return re(o)?o:[o]}function dS(o){return Wt(o,_)}function pS(o,l){return l=typeof l=="function"?l:t,Wt(o,_,l)}function mS(o){return Wt(o,m|_)}function gS(o,l){return l=typeof l=="function"?l:t,Wt(o,m|_,l)}function yS(o,l){return l==null||kd(o,l,Ve(l))}function nn(o,l){return o===l||o!==o&&l!==l}var bS=Mo(xu),_S=Mo(function(o,l){return o>=l}),Dr=Nd(function(){return arguments}())?Nd:function(o){return Ie(o)&&ve.call(o,"callee")&&!bd.call(o,"callee")},re=R.isArray,wS=Qh?Et(Qh):A_;function dt(o){return o!=null&&Bo(o.length)&&!In(o)}function Le(o){return Ie(o)&&dt(o)}function vS(o){return o===!0||o===!1||Ie(o)&&it(o)==$i}var sr=P2||lc,SS=ed?Et(ed):M_;function xS(o){return Ie(o)&&o.nodeType===1&&!ls(o)}function CS(o){if(o==null)return!0;if(dt(o)&&(re(o)||typeof o=="string"||typeof o.splice=="function"||sr(o)||hi(o)||Dr(o)))return!o.length;var l=rt(o);if(l==Zt||l==Qt)return!o.size;if(ss(o))return!ku(o).length;for(var f in o)if(ve.call(o,f))return!1;return!0}function ES(o,l){return ns(o,l)}function kS(o,l,f){f=typeof f=="function"?f:t;var d=f?f(o,l):t;return d===t?ns(o,l,t,f):!!d}function Zu(o){if(!Ie(o))return!1;var l=it(o);return l==js||l==jy||typeof o.message=="string"&&typeof o.name=="string"&&!ls(o)}function TS(o){return typeof o=="number"&&wd(o)}function In(o){if(!Oe(o))return!1;var l=it(o);return l==Ys||l==Th||l==Jy||l==Xy}function $p(o){return typeof o=="number"&&o==ie(o)}function Bo(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Yn}function Oe(o){var l=typeof o;return o!=null&&(l=="object"||l=="function")}function Ie(o){return o!=null&&typeof o=="object"}var Hp=td?Et(td):I_;function AS(o,l){return o===l||Eu(o,l,Wu(l))}function MS(o,l,f){return f=typeof f=="function"?f:t,Eu(o,l,Wu(l),f)}function OS(o){return Wp(o)&&o!=+o}function IS(o){if(pw(o))throw new ne(s);return Rd(o)}function NS(o){return o===null}function RS(o){return o==null}function Wp(o){return typeof o=="number"||Ie(o)&&it(o)==Wi}function ls(o){if(!Ie(o)||it(o)!=Cn)return!1;var l=co(o);if(l===null)return!0;var f=ve.call(l,"constructor")&&l.constructor;return typeof f=="function"&&f instanceof f&&oo.call(f)==M2}var Qu=nd?Et(nd):N_;function LS(o){return $p(o)&&o>=-9007199254740991&&o<=Yn}var Vp=rd?Et(rd):R_;function zo(o){return typeof o=="string"||!re(o)&&Ie(o)&&it(o)==Ui}function Tt(o){return typeof o=="symbol"||Ie(o)&&it(o)==Xs}var hi=id?Et(id):L_;function PS(o){return o===t}function DS(o){return Ie(o)&&rt(o)==qi}function FS(o){return Ie(o)&&it(o)==Qy}var BS=Mo(Tu),zS=Mo(function(o,l){return o<=l});function Up(o){if(!o)return[];if(dt(o))return zo(o)?en(o):ht(o);if(Ji&&o[Ji])return y2(o[Ji]());var l=rt(o),f=l==Zt?pu:l==Qt?ro:di;return f(o)}function Nn(o){if(!o)return o===0?o:0;if(o=qt(o),o===St||o===-1/0){var l=o<0?-1:1;return l*Gs}return o===o?o:0}function ie(o){var l=Nn(o),f=l%1;return l===l?f?l-f:l:0}function qp(o){return o?Nr(ie(o),0,xt):0}function qt(o){if(typeof o=="number")return o;if(Tt(o))return cn;if(Oe(o)){var l=typeof o.valueOf=="function"?o.valueOf():o;o=Oe(l)?l+"":l}if(typeof o!="string")return o===0?o:+o;o=cd(o);var f=wb.test(o);return f||Sb.test(o)?e2(o.slice(2),f?2:8):_b.test(o)?cn:+o}function Kp(o){return hn(o,pt(o))}function $S(o){return o?Nr(ie(o),-9007199254740991,Yn):o===0?o:0}function _e(o){return o==null?"":kt(o)}var HS=ui(function(o,l){if(ss(l)||dt(l)){hn(l,Ve(l),o);return}for(var f in l)ve.call(l,f)&&Qi(o,f,l[f])}),Gp=ui(function(o,l){hn(l,pt(l),o)}),$o=ui(function(o,l,f,d){hn(l,pt(l),o,d)}),WS=ui(function(o,l,f,d){hn(l,Ve(l),o,d)}),VS=Mn(wu);function US(o,l){var f=li(o);return l==null?f:Ed(f,l)}var qS=ue(function(o,l){o=xe(o);var f=-1,d=l.length,b=d>2?l[2]:t;for(b&&st(l[0],l[1],b)&&(d=1);++f<d;)for(var x=l[f],C=pt(x),M=-1,I=C.length;++M<I;){var P=C[M],D=o[P];(D===t||nn(D,si[P])&&!ve.call(o,P))&&(o[P]=x[P])}return o}),KS=ue(function(o){return o.push(t,cp),Ct(Jp,t,o)});function GS(o,l){return od(o,Y(l,3),fn)}function JS(o,l){return od(o,Y(l,3),Su)}function jS(o,l){return o==null?o:vu(o,Y(l,3),pt)}function YS(o,l){return o==null?o:Od(o,Y(l,3),pt)}function XS(o,l){return o&&fn(o,Y(l,3))}function ZS(o,l){return o&&Su(o,Y(l,3))}function QS(o){return o==null?[]:vo(o,Ve(o))}function ex(o){return o==null?[]:vo(o,pt(o))}function ec(o,l,f){var d=o==null?t:Rr(o,l);return d===t?f:d}function tx(o,l){return o!=null&&dp(o,l,C_)}function tc(o,l){return o!=null&&dp(o,l,E_)}var nx=sp(function(o,l,f){l!=null&&typeof l.toString!="function"&&(l=ao.call(l)),o[l]=f},rc(mt)),rx=sp(function(o,l,f){l!=null&&typeof l.toString!="function"&&(l=ao.call(l)),ve.call(o,l)?o[l].push(f):o[l]=[f]},Y),ix=ue(ts);function Ve(o){return dt(o)?xd(o):ku(o)}function pt(o){return dt(o)?xd(o,!0):P_(o)}function sx(o,l){var f={};return l=Y(l,3),fn(o,function(d,b,x){Tn(f,l(d,b,x),d)}),f}function ox(o,l){var f={};return l=Y(l,3),fn(o,function(d,b,x){Tn(f,b,l(d,b,x))}),f}var ax=ui(function(o,l,f){So(o,l,f)}),Jp=ui(function(o,l,f,d){So(o,l,f,d)}),lx=Mn(function(o,l){var f={};if(o==null)return f;var d=!1;l=Ae(l,function(x){return x=rr(x,o),d||(d=x.length>1),x}),hn(o,$u(o),f),d&&(f=Wt(f,m|y|_,nw));for(var b=l.length;b--;)Nu(f,l[b]);return f});function ux(o,l){return jp(o,Fo(Y(l)))}var cx=Mn(function(o,l){return o==null?{}:F_(o,l)});function jp(o,l){if(o==null)return{};var f=Ae($u(o),function(d){return[d]});return l=Y(l),$d(o,f,function(d,b){return l(d,b[0])})}function fx(o,l,f){l=rr(l,o);var d=-1,b=l.length;for(b||(b=1,o=t);++d<b;){var x=o==null?t:o[dn(l[d])];x===t&&(d=b,x=f),o=In(x)?x.call(o):x}return o}function hx(o,l,f){return o==null?o:rs(o,l,f)}function dx(o,l,f,d){return d=typeof d=="function"?d:t,o==null?o:rs(o,l,f,d)}var Yp=lp(Ve),Xp=lp(pt);function px(o,l,f){var d=re(o),b=d||sr(o)||hi(o);if(l=Y(l,4),f==null){var x=o&&o.constructor;b?f=d?new x:[]:Oe(o)?f=In(x)?li(co(o)):{}:f={}}return(b?zt:fn)(o,function(C,M,I){return l(f,C,M,I)}),f}function mx(o,l){return o==null?!0:Nu(o,l)}function gx(o,l,f){return o==null?o:qd(o,l,Pu(f))}function yx(o,l,f,d){return d=typeof d=="function"?d:t,o==null?o:qd(o,l,Pu(f),d)}function di(o){return o==null?[]:du(o,Ve(o))}function bx(o){return o==null?[]:du(o,pt(o))}function _x(o,l,f){return f===t&&(f=l,l=t),f!==t&&(f=qt(f),f=f===f?f:0),l!==t&&(l=qt(l),l=l===l?l:0),Nr(qt(o),l,f)}function wx(o,l,f){return l=Nn(l),f===t?(f=l,l=0):f=Nn(f),o=qt(o),k_(o,l,f)}function vx(o,l,f){if(f&&typeof f!="boolean"&&st(o,l,f)&&(l=f=t),f===t&&(typeof l=="boolean"?(f=l,l=t):typeof o=="boolean"&&(f=o,o=t)),o===t&&l===t?(o=0,l=1):(o=Nn(o),l===t?(l=o,o=0):l=Nn(l)),o>l){var d=o;o=l,l=d}if(f||o%1||l%1){var b=vd();return nt(o+b*(l-o+Qb("1e-"+((b+"").length-1))),l)}return Mu(o,l)}var Sx=ci(function(o,l,f){return l=l.toLowerCase(),o+(f?Zp(l):l)});function Zp(o){return nc(_e(o).toLowerCase())}function Qp(o){return o=_e(o),o&&o.replace(Cb,h2).replace(Vb,"")}function xx(o,l,f){o=_e(o),l=kt(l);var d=o.length;f=f===t?d:Nr(ie(f),0,d);var b=f;return f-=l.length,f>=0&&o.slice(f,b)==l}function Cx(o){return o=_e(o),o&&ib.test(o)?o.replace(Oh,d2):o}function Ex(o){return o=_e(o),o&&cb.test(o)?o.replace(Xl,"\\$&"):o}var kx=ci(function(o,l,f){return o+(f?"-":"")+l.toLowerCase()}),Tx=ci(function(o,l,f){return o+(f?" ":"")+l.toLowerCase()}),Ax=np("toLowerCase");function Mx(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;if(!l||d>=l)return o;var b=(l-d)/2;return Ao(mo(b),f)+o+Ao(po(b),f)}function Ox(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;return l&&d<l?o+Ao(l-d,f):o}function Ix(o,l,f){o=_e(o),l=ie(l);var d=l?ri(o):0;return l&&d<l?Ao(l-d,f)+o:o}function Nx(o,l,f){return f||l==null?l=0:l&&(l=+l),z2(_e(o).replace(Zl,""),l||0)}function Rx(o,l,f){return(f?st(o,l,f):l===t)?l=1:l=ie(l),Ou(_e(o),l)}function Lx(){var o=arguments,l=_e(o[0]);return o.length<3?l:l.replace(o[1],o[2])}var Px=ci(function(o,l,f){return o+(f?"_":"")+l.toLowerCase()});function Dx(o,l,f){return f&&typeof f!="number"&&st(o,l,f)&&(l=f=t),f=f===t?xt:f>>>0,f?(o=_e(o),o&&(typeof l=="string"||l!=null&&!Qu(l))&&(l=kt(l),!l&&ni(o))?ir(en(o),0,f):o.split(l,f)):[]}var Fx=ci(function(o,l,f){return o+(f?" ":"")+nc(l)});function Bx(o,l,f){return o=_e(o),f=f==null?0:Nr(ie(f),0,o.length),l=kt(l),o.slice(f,f+l.length)==l}function zx(o,l,f){var d=w.templateSettings;f&&st(o,l,f)&&(l=t),o=_e(o),l=$o({},l,d,up);var b=$o({},l.imports,d.imports,up),x=Ve(b),C=du(b,x),M,I,P=0,D=l.interpolate||Zs,B="__p += '",q=mu((l.escape||Zs).source+"|"+D.source+"|"+(D===Ih?bb:Zs).source+"|"+(l.evaluate||Zs).source+"|$","g"),j="//# sourceURL="+(ve.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Jb+"]")+`
48
+ `;o.replace(q,function(Z,ce,me,At,ot,Mt){return me||(me=At),B+=o.slice(P,Mt).replace(Eb,p2),ce&&(M=!0,B+=`' +
49
49
  __e(`+ce+`) +
50
50
  '`),ot&&(I=!0,B+=`';
51
51
  `+ot+`;
52
52
  __p += '`),me&&(B+=`' +
53
53
  ((__t = (`+me+`)) == null ? '' : __t) +
54
- '`),P=Tt+Z.length,Z}),B+=`';
54
+ '`),P=Mt+Z.length,Z}),B+=`';
55
55
  `;var X=ve.call(l,"variable")&&l.variable;if(!X)B=`with (obj) {
56
56
  `+B+`
57
57
  }
58
- `;else if(mb.test(X))throw new ne(u);B=(I?B.replace(Qy,""):B).replace(eb,"$1").replace(tb,"$1;"),B="function("+(X||"obj")+`) {
58
+ `;else if(gb.test(X))throw new ne(u);B=(I?B.replace(eb,""):B).replace(tb,"$1").replace(nb,"$1;"),B="function("+(X||"obj")+`) {
59
59
  `+(X?"":`obj || (obj = {});
60
- `)+"var __t, __p = ''"+(O?", __e = _.escape":"")+(I?`, __j = Array.prototype.join;
60
+ `)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(I?`, __j = Array.prototype.join;
61
61
  function print() { __p += __j.call(arguments, '') }
62
62
  `:`;
63
63
  `)+B+`return __p
64
- }`;var se=tm(function(){return be(x,j+"return "+B).apply(t,C)});if(se.source=B,Zu(se))throw se;return se}function zx(o){return _e(o).toLowerCase()}function $x(o){return _e(o).toUpperCase()}function Hx(o,l,f){if(o=_e(o),o&&(f||l===t))return cd(o);if(!o||!(l=Et(l)))return o;var d=en(o),b=en(l),x=fd(d,b),C=hd(d,b)+1;return ir(d,x,C).join("")}function Wx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=Et(l)))return o;var d=en(o),b=hd(d,en(l))+1;return ir(d,0,b).join("")}function Vx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.replace(Zl,"");if(!o||!(l=Et(l)))return o;var d=en(o),b=fd(d,en(l));return ir(d,b).join("")}function Ux(o,l){var f=te,d=Se;if(Me(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?Et(l.omission):d}o=_e(o);var x=o.length;if(ni(o)){var C=en(o);x=C.length}if(f>=x)return o;var O=f-ri(d);if(O<1)return d;var I=C?ir(C,0,O).join(""):o.slice(0,O);if(b===t)return I+d;if(C&&(O+=I.length-O),Qu(b)){if(o.slice(O).search(b)){var P,D=I;for(b.global||(b=mu(b.source,_e(Nh.exec(b))+"g")),b.lastIndex=0;P=b.exec(D);)var B=P.index;I=I.slice(0,B===t?O:B)}}else if(o.indexOf(Et(b),O)!=O){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function qx(o){return o=_e(o),o&&nb.test(o)?o.replace(Oh,w2):o}var Kx=ci(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),nc=np("toUpperCase");function em(o,l,f){return o=_e(o),l=f?t:l,l===t?m2(o)?x2(o):o2(o):o.match(l)||[]}var tm=ue(function(o,l){try{return xt(o,t,l)}catch(f){return Zu(f)?f:new ne(f)}}),Gx=On(function(o,l){return Bt(l,function(f){f=dn(f),An(o,f,Yu(o[f],o))}),o});function Jx(o){var l=o==null?0:o.length,f=Y();return o=l?Ae(o,function(d){if(typeof d[1]!="function")throw new zt(a);return[f(d[0]),d[1]]}):[],ue(function(d){for(var b=-1;++b<l;){var x=o[b];if(xt(x[0],this,d))return xt(x[1],this,d)}})}function jx(o){return w_(Ht(o,m))}function rc(o){return function(){return o}}function Yx(o,l){return o==null||o!==o?l:o}var Xx=ip(),Zx=ip(!0);function mt(o){return o}function ic(o){return Ld(typeof o=="function"?o:Ht(o,m))}function Qx(o){return Dd(Ht(o,m))}function eC(o,l){return Fd(o,Ht(l,m))}var tC=ue(function(o,l){return function(f){return ts(f,o,l)}}),nC=ue(function(o,l){return function(f){return ts(o,f,l)}});function sc(o,l,f){var d=Ve(l),b=vo(l,d);f==null&&!(Me(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=vo(l,Ve(l)));var x=!(Me(f)&&"chain"in f)||!!f.chain,C=In(o);return Bt(b,function(O){var I=l[O];o[O]=I,C&&(o.prototype[O]=function(){var P=this.__chain__;if(x||P){var D=o(this.__wrapped__),B=D.__actions__=ht(this.__actions__);return B.push({func:I,args:arguments,thisArg:o}),D.__chain__=P,D}return I.apply(o,Zn([this.value()],arguments))})}),o}function rC(){return Xe._===this&&(Xe._=O2),this}function oc(){}function iC(o){return o=ie(o),ue(function(l){return Bd(l,o)})}var sC=Fu(Ae),oC=Fu(sd),aC=Fu(lu);function nm(o){return Uu(o)?uu(dn(o)):F_(o)}function lC(o){return function(l){return o==null?t:Nr(o,l)}}var uC=op(),cC=op(!0);function ac(){return[]}function lc(){return!1}function fC(){return{}}function hC(){return""}function dC(){return!0}function pC(o,l){if(o=ie(o),o<1||o>Yn)return[];var f=St,d=nt(o,St);l=Y(l),o-=St;for(var b=hu(d,l);++f<o;)l(f);return b}function mC(o){return re(o)?Ae(o,dn):kt(o)?[o]:ht(Sp(_e(o)))}function gC(o){var l=++A2;return _e(o)+l}var yC=Ao(function(o,l){return o+l},0),bC=Bu("ceil"),_C=Ao(function(o,l){return o/l},1),wC=Bu("floor");function vC(o){return o&&o.length?wo(o,mt,xu):t}function SC(o,l){return o&&o.length?wo(o,Y(l,2),xu):t}function xC(o){return ld(o,mt)}function CC(o,l){return ld(o,Y(l,2))}function EC(o){return o&&o.length?wo(o,mt,Au):t}function kC(o,l){return o&&o.length?wo(o,Y(l,2),Au):t}var AC=Ao(function(o,l){return o*l},1),TC=Bu("round"),OC=Ao(function(o,l){return o-l},0);function MC(o){return o&&o.length?fu(o,mt):0}function IC(o,l){return o&&o.length?fu(o,Y(l,2)):0}return w.after=Qv,w.ary=Rp,w.assign=$S,w.assignIn=Gp,w.assignInWith=$o,w.assignWith=HS,w.at=WS,w.before=Lp,w.bind=Yu,w.bindAll=Gx,w.bindKey=Pp,w.castArray=fS,w.chain=Mp,w.chunk=ww,w.compact=vw,w.concat=Sw,w.cond=Jx,w.conforms=jx,w.constant=rc,w.countBy=Mv,w.create=VS,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=US,w.defaultsDeep=qS,w.defer=eS,w.delay=tS,w.difference=xw,w.differenceBy=Cw,w.differenceWith=Ew,w.drop=kw,w.dropRight=Aw,w.dropRightWhile=Tw,w.dropWhile=Ow,w.fill=Mw,w.filter=Nv,w.flatMap=Pv,w.flatMapDeep=Dv,w.flatMapDepth=Fv,w.flatten=kp,w.flattenDeep=Iw,w.flattenDepth=Nw,w.flip=nS,w.flow=Xx,w.flowRight=Zx,w.fromPairs=Rw,w.functions=ZS,w.functionsIn=QS,w.groupBy=Bv,w.initial=Pw,w.intersection=Dw,w.intersectionBy=Fw,w.intersectionWith=Bw,w.invert=tx,w.invertBy=nx,w.invokeMap=$v,w.iteratee=ic,w.keyBy=Hv,w.keys=Ve,w.keysIn=pt,w.map=Lo,w.mapKeys=ix,w.mapValues=sx,w.matches=Qx,w.matchesProperty=eC,w.memoize=Do,w.merge=ox,w.mergeWith=Jp,w.method=tC,w.methodOf=nC,w.mixin=sc,w.negate=Fo,w.nthArg=iC,w.omit=ax,w.omitBy=lx,w.once=rS,w.orderBy=Wv,w.over=sC,w.overArgs=iS,w.overEvery=oC,w.overSome=aC,w.partial=Xu,w.partialRight=zp,w.partition=Vv,w.pick=ux,w.pickBy=jp,w.property=nm,w.propertyOf=lC,w.pull=Ww,w.pullAll=Tp,w.pullAllBy=Vw,w.pullAllWith=Uw,w.pullAt=qw,w.range=uC,w.rangeRight=cC,w.rearg=sS,w.reject=Kv,w.remove=Kw,w.rest=oS,w.reverse=Ju,w.sampleSize=Jv,w.set=fx,w.setWith=hx,w.shuffle=jv,w.slice=Gw,w.sortBy=Zv,w.sortedUniq=ev,w.sortedUniqBy=tv,w.split=Px,w.spread=aS,w.tail=nv,w.take=rv,w.takeRight=iv,w.takeRightWhile=sv,w.takeWhile=ov,w.tap=vv,w.throttle=lS,w.thru=Ro,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=mC,w.toPlainObject=Kp,w.transform=dx,w.unary=uS,w.union=av,w.unionBy=lv,w.unionWith=uv,w.uniq=cv,w.uniqBy=fv,w.uniqWith=hv,w.unset=px,w.unzip=ju,w.unzipWith=Op,w.update=mx,w.updateWith=gx,w.values=di,w.valuesIn=yx,w.without=dv,w.words=em,w.wrap=cS,w.xor=pv,w.xorBy=mv,w.xorWith=gv,w.zip=yv,w.zipObject=bv,w.zipObjectDeep=_v,w.zipWith=wv,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=$o,sc(w,w),w.add=yC,w.attempt=tm,w.camelCase=vx,w.capitalize=Zp,w.ceil=bC,w.clamp=bx,w.clone=hS,w.cloneDeep=pS,w.cloneDeepWith=mS,w.cloneWith=dS,w.conformsTo=gS,w.deburr=Qp,w.defaultTo=Yx,w.divide=_C,w.endsWith=Sx,w.eq=nn,w.escape=xx,w.escapeRegExp=Cx,w.every=Iv,w.find=Rv,w.findIndex=Cp,w.findKey=KS,w.findLast=Lv,w.findLastIndex=Ep,w.findLastKey=GS,w.floor=wC,w.forEach=Ip,w.forEachRight=Np,w.forIn=JS,w.forInRight=jS,w.forOwn=YS,w.forOwnRight=XS,w.get=ec,w.gt=yS,w.gte=bS,w.has=ex,w.hasIn=tc,w.head=Ap,w.identity=mt,w.includes=zv,w.indexOf=Lw,w.inRange=_x,w.invoke=rx,w.isArguments=Pr,w.isArray=re,w.isArrayBuffer=_S,w.isArrayLike=dt,w.isArrayLikeObject=Le,w.isBoolean=wS,w.isBuffer=sr,w.isDate=vS,w.isElement=SS,w.isEmpty=xS,w.isEqual=CS,w.isEqualWith=ES,w.isError=Zu,w.isFinite=kS,w.isFunction=In,w.isInteger=$p,w.isLength=Bo,w.isMap=Hp,w.isMatch=AS,w.isMatchWith=TS,w.isNaN=OS,w.isNative=MS,w.isNil=NS,w.isNull=IS,w.isNumber=Wp,w.isObject=Me,w.isObjectLike=Ie,w.isPlainObject=ls,w.isRegExp=Qu,w.isSafeInteger=RS,w.isSet=Vp,w.isString=zo,w.isSymbol=kt,w.isTypedArray=hi,w.isUndefined=LS,w.isWeakMap=PS,w.isWeakSet=DS,w.join=zw,w.kebabCase=Ex,w.last=Vt,w.lastIndexOf=$w,w.lowerCase=kx,w.lowerFirst=Ax,w.lt=FS,w.lte=BS,w.max=vC,w.maxBy=SC,w.mean=xC,w.meanBy=CC,w.min=EC,w.minBy=kC,w.stubArray=ac,w.stubFalse=lc,w.stubObject=fC,w.stubString=hC,w.stubTrue=dC,w.multiply=AC,w.nth=Hw,w.noConflict=rC,w.noop=oc,w.now=Po,w.pad=Tx,w.padEnd=Ox,w.padStart=Mx,w.parseInt=Ix,w.random=wx,w.reduce=Uv,w.reduceRight=qv,w.repeat=Nx,w.replace=Rx,w.result=cx,w.round=TC,w.runInContext=M,w.sample=Gv,w.size=Yv,w.snakeCase=Lx,w.some=Xv,w.sortedIndex=Jw,w.sortedIndexBy=jw,w.sortedIndexOf=Yw,w.sortedLastIndex=Xw,w.sortedLastIndexBy=Zw,w.sortedLastIndexOf=Qw,w.startCase=Dx,w.startsWith=Fx,w.subtract=OC,w.sum=MC,w.sumBy=IC,w.template=Bx,w.times=pC,w.toFinite=Nn,w.toInteger=ie,w.toLength=qp,w.toLower=zx,w.toNumber=Ut,w.toSafeInteger=zS,w.toString=_e,w.toUpper=$x,w.trim=Hx,w.trimEnd=Wx,w.trimStart=Vx,w.truncate=Ux,w.unescape=qx,w.uniqueId=gC,w.upperCase=Kx,w.upperFirst=nc,w.each=Ip,w.eachRight=Np,w.first=Ap,sc(w,function(){var o={};return fn(w,function(l,f){ve.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,Bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),Bt(["drop","take"],function(o,l){fe.prototype[o]=function(f){f=f===t?1:ze(ie(f),0);var d=this.__filtered__&&!l?new fe(this):this.clone();return d.__filtered__?d.__takeCount__=nt(f,d.__takeCount__):d.__views__.push({size:nt(f,St),type:o+(d.__dir__<0?"Right":"")}),d},fe.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),Bt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Dt||f==We;fe.prototype[o]=function(b){var x=this.clone();return x.__iteratees__.push({iteratee:Y(b,3),type:f}),x.__filtered__=x.__filtered__||d,x}}),Bt(["head","last"],function(o,l){var f="take"+(l?"Right":"");fe.prototype[o]=function(){return this[f](1).value()[0]}}),Bt(["initial","tail"],function(o,l){var f="drop"+(l?"":"Right");fe.prototype[o]=function(){return this.__filtered__?new fe(this):this[f](1)}}),fe.prototype.compact=function(){return this.filter(mt)},fe.prototype.find=function(o){return this.filter(o).head()},fe.prototype.findLast=function(o){return this.reverse().find(o)},fe.prototype.invokeMap=ue(function(o,l){return typeof o=="function"?new fe(this):this.map(function(f){return ts(f,o,l)})}),fe.prototype.reject=function(o){return this.filter(Fo(Y(o)))},fe.prototype.slice=function(o,l){o=ie(o);var f=this;return f.__filtered__&&(o>0||l<0)?new fe(f):(o<0?f=f.takeRight(-o):o&&(f=f.drop(o)),l!==t&&(l=ie(l),f=l<0?f.dropRight(-l):f.take(l-o)),f)},fe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},fe.prototype.toArray=function(){return this.take(St)},fn(fe.prototype,function(o,l){var f=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),b=w[d?"take"+(l=="last"?"Right":""):l],x=d||/^find/.test(l);b&&(w.prototype[l]=function(){var C=this.__wrapped__,O=d?[1]:arguments,I=C instanceof fe,P=O[0],D=I||re(C),B=function(ce){var me=b.apply(w,Zn([ce],O));return d&&q?me[0]:me};D&&f&&typeof P=="function"&&P.length!=1&&(I=D=!1);var q=this.__chain__,j=!!this.__actions__.length,X=x&&!q,se=I&&!j;if(!x&&D){C=se?C:new fe(this);var Z=o.apply(C,O);return Z.__actions__.push({func:Ro,args:[B],thisArg:t}),new $t(Z,q)}return X&&se?o.apply(this,O):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),Bt(["pop","push","shift","sort","splice","unshift"],function(o){var l=io[o],f=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",d=/^(?:pop|shift)$/.test(o);w.prototype[o]=function(){var b=arguments;if(d&&!this.__chain__){var x=this.value();return l.apply(re(x)?x:[],b)}return this[f](function(C){return l.apply(re(C)?C:[],b)})}}),fn(fe.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";ve.call(ai,d)||(ai[d]=[]),ai[d].push({name:l,func:f})}}),ai[ko(t,g).name]=[{name:"wrapper",func:t}],fe.prototype.clone=q2,fe.prototype.reverse=K2,fe.prototype.value=G2,w.prototype.at=Sv,w.prototype.chain=xv,w.prototype.commit=Cv,w.prototype.next=Ev,w.prototype.plant=Av,w.prototype.reverse=Tv,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=Ov,w.prototype.first=w.prototype.head,Ji&&(w.prototype[Ji]=kv),w},ii=C2();Ar?((Ar.exports=ii)._=ii,iu._=ii):Xe._=ii}).call(II)}(Ws,Ws.exports)),Ws.exports}var Fy=NI();function bh(n){return n.type.create(Fy.cloneDeep(n.attrs))}function _h({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const RI=Re.create({name:"node_processor",addCommands(){return{setBlockAttributes:W(({commands:n,state:e},t,r,i={})=>{const s=V(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:c,to:h}=u.selection;a.nodesBetween(c,h,(p,m)=>{Nf.includes(p.type.name)&&u.setNodeAttribute(m,t,{...i,...s,...r})})}),getBlockAttributes:W(({editor:n},e,t)=>ge(()=>{let r=Object.assign({},t||{});for(const i of Nf)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:W(({commands:n},e)=>{for(const t of Nf)n.resetAttributes(t,e)}),applyMark:W(({state:n,commands:e},t,r,i={})=>{const{tr:s,doc:a,schema:u}=n,{$from:c,$to:h}=s.selection,p=mn(Oe.LINK,u),m=mn(t,u);if(!(m.spec.group||"").includes(Gt.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:E,node:N,position:g,mark:v}=S;_h({tr:E,node:N,position:g,mark:v.type})}};a.nodesBetween(c.pos,h.pos,(S,E)=>{if(S.type.name===oe.LIST)return;const N=MI(S.marks,t),g=m.create({...N?.attrs||{},...r}),v=Ly(c,h,S,E);if(!p.isInSet(S.marks)&&OI(s.doc,E,g,i.isAppliedToParent))return _({tr:s,node:S,position:E,mark:g});if(S.isText){s.addMark(v.from,v.to,g);return}AI(s.doc,s.selection,S,E)&&s.addNodeMark(E,g)})}),getMarks:W(({editor:n},e)=>{const t=yi(n,"state");return ge(()=>{const{selection:r,doc:i}=V(t),{from:s,to:a}=V(r),u=[];return i.nodesBetween(s,a,c=>{for(const h of c.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:W(({commands:n},e)=>{const t=n.getMarks(e);return ge(()=>V(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return ge(()=>!!V(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return ge(()=>V(r)?.value??V(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return ge(()=>{for(const s of V(r)){const a=s[V(i)];if(a)return a}return V(t)})}),removeAllMarks:W(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(s,a)=>{for(const u of s.marks)_h({tr:e,node:s,position:a,mark:u})})}),removeMarks:W(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:s}=t.selection;r.nodesBetween(i,s,(a,u)=>{const c=a.marks.filter(h=>e.includes(h.type.name));for(const h of c)_h({tr:t,node:a,position:u,mark:h})})})}}}),LI=Re.create({name:"text_processor",addCommands(){return{getSelectedText:W(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:W(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,s)=>{if(!i.isText)return;const a=Ly(t,r,i,s),u=Math.max(0,t.pos-s),c=Math.max(0,r.pos-s),h=e({text:i.textContent.substring(u,c)}),p=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,p)})})}}}),PI=Re.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:W(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:W(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:W(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:Py(n.doc,a);r=Math.min(r,a+c),i=Math.max(i,a+s.nodeSize-c)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:W(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===oe.DOCUMENT))}}}),DI=jn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends Ue{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=fr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,De.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)}}Ue.jsonID("setDocAttr",Ks);const FI=DI.extend({marks:Gt.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:W(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),BI=jn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Oi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zI=BI.extend({marks:Gt.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),$I=jn.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]}`,Oi(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=>pO({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),HI=$I.extend({marks:Gt.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),WI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[NO.create(this.editor),RO.create(this.editor)]}}),VI=()=>[FI,zI,HI,yO,AO,RI,LI,PI,WI],UI=Nt.create({name:Oe.FONT_FAMILY,group:Gt.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:W(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=V(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(Oe.FONT_STYLE).value;t.isItalicOnly?n.applyItalic():!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:W(({commands:n})=>{const e=V(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return ge(()=>n.findFontByName(V(r))||t)}),findFontByName:W((n,e)=>V(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:W(({commands:n})=>{const e=n.getPreset();return ge(()=>V(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 Jr({font_family:e})}}),qI=Re.create({name:Oe.STYLE_PRESET,addGlobalAttributes(){return[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{preset:{isRequired:!1,default:{id:V(this.options.defaultId)},parseHTML:n=>{const e=V(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 s=V(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(s))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:V(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:V(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 s of Object.keys(t)){const a=t[s],u=r[s],c=!u||u.toLowerCase()==="inherit";i[s]=c?a:u}return i}return{getPresetList:W(()=>ge(()=>V(this.options.presets).filter(t=>!t.hidden))),getPreset:W(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:V(this.options.defaultId)}),i=t.getPresetList(),s=t.isLink(),a=t.getLinkPreset();return ge(()=>{const u=n(V(i),V(r).id);if(!V(s))return u;const c=V(a);return{id:u.id,common:e(u.common,c.common),mobile:e(u.mobile,c.mobile),tablet:e(u.tablet,c.tablet),desktop:e(u.desktop,c.desktop)}})}),applyPreset:W(({commands:t,chain:r},i)=>{const s=V(t.getPresetList()),a=n(s,i),u=a.node?.type??oe.PARAGRAPH,c={preset:{id:i}};a.node&&(c.level=a.node.level);for(const h of p1)c[h]=V(t.getBlockAttributes(h));r().removeList().setNode(u,c).run()}),applyDefaultPreset:W(({commands:t})=>{t.applyPreset(V(this.options.defaultId))}),removePreset:W(({commands:t})=>{t.setNode(oe.PARAGRAPH,{preset:null})}),getPresetCustomization:W(({editor:t,commands:r})=>{const i=yi(t,"state");return ge(()=>{const{selection:s,doc:a}=V(i),{from:u,to:c}=s;return r._getSettingCustomization(a,u,c)})}),isSettingCustomized:W(({commands:t},r)=>{const i=t.getPresetCustomization(),s=qa.includes(r)?"attributes":"marks";return ge(()=>V(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=yi(t,"state");return ge(()=>{const{doc:s}=V(i);return r._getSettingCustomization(s,0,s.content.size)})}),_getSettingCustomization:W((t,r,i,s)=>{const a=new Set,u=new Set;return r.nodesBetween(i,s,c=>{for(const[h,p]of Object.entries(c.attrs))qa.includes(h)&&p&&u.add(h);for(const{type:h}of c.marks)g1.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(g1).resetAttributes(oe.PARAGRAPH,qa).resetAttributes(oe.HEADING,qa).restoreSelection().run()}),removeFormat:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Pi.head,V(this.options.presets))}}),KI=Nt.create({name:Oe.FONT_WEIGHT,group:Gt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:W(({commands:n},e)=>{n.applyMark(this.name,{value:e}),V(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:W(({commands:n})=>{const e=V(n.getFontWeight()),t=V(n.getFont()),i=Number(e)>=600?"400":"700",s=t.findClosestWeight(i);n.applyFontWeight(s)}),getFontWeight:W(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return ge(()=>{const r=V(e),i=V(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:W(({commands:n})=>{const e=n.getPreset();return ge(()=>V(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Yt("toggleBold"),"Mod-B":Yt("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 Jr({font_weight:n.value})}}),GI=Nt.create({name:Oe.FONT_SIZE,group:Gt.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:W(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].font_size.replace("px",""))}),applyFontSize:W(({commands:n},e)=>{const t=V(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:s,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(p=>!!p))return!1;const h=a.type.create(u);if(i.isText){r.addMark(s,s+i.nodeSize,h);return}r.addNodeMark(s,h)}})}),increaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.min(e+1,V(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:W(({commands:n})=>{const e=Number(V(n.getFontSize())),t=Math.max(e-1,V(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Yt("increaseFontSize"),"Mod-Shift--":Yt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=V(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 Jr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),JI=Nt.create({name:Oe.FONT_COLOR,group:Gt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:W(({commands:n})=>{const e=n.getPreset();return ge(()=>V(e).common.color)}),applyFontColor:W(({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 Jr({font_color:n.value})}}),jI=Nt.create({name:Oe.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:W(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:W(({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 Jr({background_color:n.value})}}),YI=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>yi(this.options,"device"))}}}),XI=Nt.create({name:Oe.FONT_STYLE,group:Gt.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return ge(()=>V(e)?.italic??V(t).italic)}),isItalicAvailable:W(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return ge(()=>{const r=V(e),i=V(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:W(({commands:n})=>{const e=n.getPreset();return ge(()=>({italic:V(e).common.font_style==="italic"}))}),toggleItalic:W(({commands:n})=>{V(n.isItalicAvailable())&&(V(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Yt("toggleItalic"),"Mod-I":Yt("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 Jr({font_style:e})}}),ZI=Nt.create({name:Oe.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>V(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>V(e).strike_through)}),getTextDecoration:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return ge(()=>{const r=V(e)??{},i=V(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:W(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return ge(()=>V(e)!==V(t).underline)}),getDefaultTextDecoration:W(({commands:n})=>{const e=n.getPreset();return ge(()=>{const{text_decoration:t}=V(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:W(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:W(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:W(({commands:n},e,t=null)=>{const r=V(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Yt("toggleUnderline"),"Mod-U":Yt("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"),Jr({text_decoration:e.join(" ")})}}),QI=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case Ua.CAPITALIZE:return n.applyCapitalize();case Ua.LOWERCASE:return n.applyLowerCase();case Ua.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>QO(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),By={mobile:null,tablet:null,desktop:null},eN=Re.create({name:Oe.ALIGNMENT,addGlobalAttributes:()=>[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[Oe.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=kI(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:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},By)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,By),t=n.getDevice(),r=n.getDefaultAlignment();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].alignment??_r.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Yt("applyAlignment",_r.LEFT),"Mod-Shift-e":Yt("applyAlignment",_r.CENTER),"Mod-Shift-r":Yt("applyAlignment",_r.RIGHT),"Mod-Shift-j":Yt("applyAlignment",_r.JUSTIFY)})}),zy={mobile:null,tablet:null,desktop:null},tN=Re.create({name:Oe.LINE_HEIGHT,addGlobalAttributes(){return[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[Oe.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const s=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:s,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=V(this.options.wrapperRef),r=CI(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:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,zy),t=n.getDevice(),r=n.getDefaultLineHeight();return ge(()=>V(e)?.[V(t)]??V(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>V(t)[V(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=V(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},zy)})}}}),nN=jn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Oi(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)}}}),rN=nN.extend({name:oe.LIST_ITEM,marks:Gt.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:W(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const s=n(t);for(const a of r.marks)t.addNodeMark(s,bh(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===oe.LIST))return t.listItemNewline()}})});function iN(n,e){if(m1.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function sN(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===oe.LIST)return;if(r.type.name!==oe.LIST_ITEM)return!1;const s=[];return r.forEach(a=>{for(const u of a.marks){if(u.isInSet(s)){n.removeNodeMark(i+1,u);continue}iN(r,u)&&(n.removeNodeMark(i+1,u),n.addNodeMark(i,bh(u)),s.push(u))}}),!1})}const oN=jn.create({name:oe.LIST,content:`${oe.LIST_ITEM}+`,group:"block list",marks:Gt.SETTINGS,addExtensions:()=>[rN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:an.DISC}}}),parseHTML(){const n={a:an.ROMAN,i:an.LATIN,1:an.DECIMAL},e=t=>{for(const r of MO){const i=`.${V(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||an.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||an.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[V(this.options.baseClass)+n.bullet.type,V(this.options.presetClass)];return[IO.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return ge(()=>V(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>V(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(oe.LIST,oe.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>sN(i)).run()),removeList:W(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===oe.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,s,a)=>{if([oe.LIST,oe.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==oe.LIST_ITEM)return!1;const u=a.marks.filter(c=>!c.type.isInSet(i.marks));for(const c of u)e.addNodeMark(s,bh(c));return!1}),!0}).liftListItem(oe.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>mO({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(an.DISC,/^\s*([-+*])\s$/),n(an.DECIMAL,/^(\d+)\.\s$/),n(an.LATIN,/^([ivx]{1,3})\.\s$/i),n(an.ROMAN,/^([a-z])\.\s$/i)]}});function aN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function lN(n){return new ct({key:new Mt("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),s=e.some(h=>h.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,u=FT(t.doc,[...e]);if(KT(u).forEach(({newRange:h})=>{const p=zT(r.doc,h,_=>_.isTextblock);let m,y;if(p.length>1?(m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ")):p.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(m=p[0],y=r.doc.textBetween(m.pos,h.to,void 0," ")),m&&y){const _=y.split(" ").filter(g=>g!=="");if(_.length<=0)return!1;const S=_[_.length-1],E=m.pos+y.lastIndexOf(S);if(!S)return!1;const N=xl(S).map(g=>g.toObject(n.defaultProtocol));if(!aN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:E+g.start+1,to:E+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate(g.value)).filter(g=>n.shouldAutoLink(g.value)).forEach(g=>{i1(g.from,g.to,r.doc).some(v=>v.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function uN(n){return new ct({key:new Mt("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const u=[];for(;a.nodeName!=="DIV";)u.push(a),a=a.parentNode;if(!u.find(y=>y.nodeName==="A"))return!1;const c=VT(e.state,n.type.name),h=r.target,p=(i=h?.href)!==null&&i!==void 0?i:c.href,m=(s=h?.target)!==null&&s!==void 0?s:c.target;return h&&p?(window.open(p,m),!0):!1}}})}function cN(n){return new ct({key:new Mt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const c=N1(u,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}const fN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Yr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(fN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const hN=Nt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){I1(n);return}I1(n.scheme,n.optionalSlashes)})},onDestroy(){jO()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Yr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Yr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Yr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Oi(this.options.HTMLAttributes,n),0]:["a",Oi(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[gO({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=N1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Yr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(lN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Yr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(uN({type:this.type})),this.options.linkOnPaste&&n.push(cN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),dN=hN.extend({name:Oe.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:Rf.SELF,parseHTML:n=>n.getAttribute("target")||Rf.SELF},destination:{default:Mi.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Mi.URL;const t=e.replace("#","");return V(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Mi.BLOCK:Mi.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:W(({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(Hy.text(r.text,[Hy.mark(Oe.LINK,r)])))),expandSelectionToLink:W(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:W(({commands:e})=>e.hasMark(this.name)),getLinkPreset:W(()=>ge(()=>V(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),ZO.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Mi.BLOCK?`#${n.href}`:n.href,t=V(this.options.basePresetClass)+V(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),pN=Nt.create({name:Oe.SUPERSCRIPT,addCommands(){return{applySuperscript:W(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:W(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:W(({commands:n})=>{V(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:W(({commands:n})=>{const e=n.getMark(this.name);return ge(()=>!!V(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),mN=Re.create({name:Oe.MARGIN,addGlobalAttributes:()=>[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[Oe.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:s}=n.style;return[e,t,r,i,s].some(c=>!!c)?e?{value:e}:{value:[t||0,r||0,i||0,s||0].join(" ")}:null},renderHTML(n){return n.margin?Cl({margin:n.margin.value}):null}}}}]});function gN(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=kc({default:null,link:null});return n5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),VI().concat([qI.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new vN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),oN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),YI.configure({device:n.deviceRef}),GI.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),UI.configure({fonts:n.fonts,defaultPreset:yi(t,"default"),defaultFont:n.defaultFont}),KI,JI,jI,XI,ZI,QI,pN,eN,tN.configure({wrapperRef:n.wrapperRef}),dN.configure({preset:yi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),mN])}class yN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class $y{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class _n extends $y{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=_n.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=s=>s.tagName!=="BODY"&&t.call(this,s),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:s=>r(s)?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,s;const a=u=>{this._assignElementProperties(u,e,_n.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,_n.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,s=u;continue}if(u.tagName==="BR"&&s&&s?.tagName!=="BR"){u.remove(),s=u;continue}if(u.tagName==="BR"){const c=this.dom.createElement("p");c.append(u),a(c),i=null,s=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),s=u}e.append(t),this._removeStyleProperties(e,_n.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,_n.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return _n.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return _n.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const s=t.style.getPropertyValue(i);s&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,s)}}_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 s=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,_n.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(s),s=i.cloneNode();continue}s.append(u)}t.append(s),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),s=this._parseTextDecoration(i),a={underline:s.underline||t.underline,line_through:s.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),s=i.style.backgroundColor||t;i.style.backgroundColor=s}}_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 bN extends $y{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!==oe.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(m1.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===oe.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>Fy.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===oe.TEXT&&this._includesMarkType(e,Oe.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 Bl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new _n({content:e,parser:t.parser||new yN})}static _buildJson(e){return new bN({content:e})}static normalize(e,t={}){return Bl.build(e,t).normalize()}}class Pi{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 Eh{static build({config:e,nodeDomParser:t}){const r=gN({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:na(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:na(If.DESKTOP),pageBlocksRef:na([]),wrapperRef:Pi.document.createElement("p")}),i=HT(r);return new Eh({schema:i,domParser:_s.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=Bl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function _N(n,e){return n.type===e}function wN(n){return typeof n=="string"}class Hy{static doc(e){return{type:oe.DOCUMENT,content:e}}static list(e,t){return{type:oe.LIST,attrs:{bullet:{type:e}},content:t.map(r=>_N(r,oe.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:oe.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>wN(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:oe.HEADING,...r}}static paragraph(...e){return{type:oe.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...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:oe.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(Oe.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class vN{_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=Pi.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,s=this.makePresetCssClass(r);t+=` ${s} {`;for(const a of TO)for(const u of Object.keys(r[a])){const c=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${c}, inherit);`,i&&!p1.includes(u)){const p=h.replace("preset-","");t+=`${p}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===If.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 kh{static _instance;static get instance(){return this._instance??=new kh,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 Wy{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Vy{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 SN extends Vy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:im.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Pi.use(Wy.createWindow());const i=im.resolve(process.cwd(),t),s=Eh.build({config:require(i).editor,nodeDomParser:new Wy}),a=e.map(h=>s.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,c=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(c):c)}_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 xN="4.11.5";class CN extends Vy{name="version";description="display cli version";doCommand(){this.output(xN)}}const Uy=new VC,EN=[SN,CN];for(const n of EN)new n().install(Uy);Uy.parse();
64
+ }`;var se=tm(function(){return be(x,j+"return "+B).apply(t,C)});if(se.source=B,Zu(se))throw se;return se}function $x(o){return _e(o).toLowerCase()}function Hx(o){return _e(o).toUpperCase()}function Wx(o,l,f){if(o=_e(o),o&&(f||l===t))return cd(o);if(!o||!(l=kt(l)))return o;var d=en(o),b=en(l),x=fd(d,b),C=hd(d,b)+1;return ir(d,x,C).join("")}function Vx(o,l,f){if(o=_e(o),o&&(f||l===t))return o.slice(0,pd(o)+1);if(!o||!(l=kt(l)))return o;var d=en(o),b=hd(d,en(l))+1;return ir(d,0,b).join("")}function Ux(o,l,f){if(o=_e(o),o&&(f||l===t))return o.replace(Zl,"");if(!o||!(l=kt(l)))return o;var d=en(o),b=fd(d,en(l));return ir(d,b).join("")}function qx(o,l){var f=te,d=Se;if(Oe(l)){var b="separator"in l?l.separator:b;f="length"in l?ie(l.length):f,d="omission"in l?kt(l.omission):d}o=_e(o);var x=o.length;if(ni(o)){var C=en(o);x=C.length}if(f>=x)return o;var M=f-ri(d);if(M<1)return d;var I=C?ir(C,0,M).join(""):o.slice(0,M);if(b===t)return I+d;if(C&&(M+=I.length-M),Qu(b)){if(o.slice(M).search(b)){var P,D=I;for(b.global||(b=mu(b.source,_e(Nh.exec(b))+"g")),b.lastIndex=0;P=b.exec(D);)var B=P.index;I=I.slice(0,B===t?M:B)}}else if(o.indexOf(kt(b),M)!=M){var q=I.lastIndexOf(b);q>-1&&(I=I.slice(0,q))}return I+d}function Kx(o){return o=_e(o),o&&rb.test(o)?o.replace(Mh,v2):o}var Gx=ci(function(o,l,f){return o+(f?" ":"")+l.toUpperCase()}),nc=np("toUpperCase");function em(o,l,f){return o=_e(o),l=f?t:l,l===t?g2(o)?C2(o):a2(o):o.match(l)||[]}var tm=ue(function(o,l){try{return Ct(o,t,l)}catch(f){return Zu(f)?f:new ne(f)}}),Jx=Mn(function(o,l){return zt(l,function(f){f=dn(f),Tn(o,f,Yu(o[f],o))}),o});function jx(o){var l=o==null?0:o.length,f=Y();return o=l?Ae(o,function(d){if(typeof d[1]!="function")throw new $t(a);return[f(d[0]),d[1]]}):[],ue(function(d){for(var b=-1;++b<l;){var x=o[b];if(Ct(x[0],this,d))return Ct(x[1],this,d)}})}function Yx(o){return v_(Wt(o,m))}function rc(o){return function(){return o}}function Xx(o,l){return o==null||o!==o?l:o}var Zx=ip(),Qx=ip(!0);function mt(o){return o}function ic(o){return Ld(typeof o=="function"?o:Wt(o,m))}function eC(o){return Dd(Wt(o,m))}function tC(o,l){return Fd(o,Wt(l,m))}var nC=ue(function(o,l){return function(f){return ts(f,o,l)}}),rC=ue(function(o,l){return function(f){return ts(o,f,l)}});function sc(o,l,f){var d=Ve(l),b=vo(l,d);f==null&&!(Oe(l)&&(b.length||!d.length))&&(f=l,l=o,o=this,b=vo(l,Ve(l)));var x=!(Oe(f)&&"chain"in f)||!!f.chain,C=In(o);return zt(b,function(M){var I=l[M];o[M]=I,C&&(o.prototype[M]=function(){var P=this.__chain__;if(x||P){var D=o(this.__wrapped__),B=D.__actions__=ht(this.__actions__);return B.push({func:I,args:arguments,thisArg:o}),D.__chain__=P,D}return I.apply(o,Zn([this.value()],arguments))})}),o}function iC(){return Xe._===this&&(Xe._=O2),this}function oc(){}function sC(o){return o=ie(o),ue(function(l){return Bd(l,o)})}var oC=Fu(Ae),aC=Fu(sd),lC=Fu(lu);function nm(o){return Uu(o)?uu(dn(o)):B_(o)}function uC(o){return function(l){return o==null?t:Rr(o,l)}}var cC=op(),fC=op(!0);function ac(){return[]}function lc(){return!1}function hC(){return{}}function dC(){return""}function pC(){return!0}function mC(o,l){if(o=ie(o),o<1||o>Yn)return[];var f=xt,d=nt(o,xt);l=Y(l),o-=xt;for(var b=hu(d,l);++f<o;)l(f);return b}function gC(o){return re(o)?Ae(o,dn):Tt(o)?[o]:ht(Sp(_e(o)))}function yC(o){var l=++A2;return _e(o)+l}var bC=To(function(o,l){return o+l},0),_C=Bu("ceil"),wC=To(function(o,l){return o/l},1),vC=Bu("floor");function SC(o){return o&&o.length?wo(o,mt,xu):t}function xC(o,l){return o&&o.length?wo(o,Y(l,2),xu):t}function CC(o){return ld(o,mt)}function EC(o,l){return ld(o,Y(l,2))}function kC(o){return o&&o.length?wo(o,mt,Tu):t}function TC(o,l){return o&&o.length?wo(o,Y(l,2),Tu):t}var AC=To(function(o,l){return o*l},1),MC=Bu("round"),OC=To(function(o,l){return o-l},0);function IC(o){return o&&o.length?fu(o,mt):0}function NC(o,l){return o&&o.length?fu(o,Y(l,2)):0}return w.after=eS,w.ary=Rp,w.assign=HS,w.assignIn=Gp,w.assignInWith=$o,w.assignWith=WS,w.at=VS,w.before=Lp,w.bind=Yu,w.bindAll=Jx,w.bindKey=Pp,w.castArray=hS,w.chain=Op,w.chunk=vw,w.compact=Sw,w.concat=xw,w.cond=jx,w.conforms=Yx,w.constant=rc,w.countBy=Iv,w.create=US,w.curry=Dp,w.curryRight=Fp,w.debounce=Bp,w.defaults=qS,w.defaultsDeep=KS,w.defer=tS,w.delay=nS,w.difference=Cw,w.differenceBy=Ew,w.differenceWith=kw,w.drop=Tw,w.dropRight=Aw,w.dropRightWhile=Mw,w.dropWhile=Ow,w.fill=Iw,w.filter=Rv,w.flatMap=Dv,w.flatMapDeep=Fv,w.flatMapDepth=Bv,w.flatten=kp,w.flattenDeep=Nw,w.flattenDepth=Rw,w.flip=rS,w.flow=Zx,w.flowRight=Qx,w.fromPairs=Lw,w.functions=QS,w.functionsIn=ex,w.groupBy=zv,w.initial=Dw,w.intersection=Fw,w.intersectionBy=Bw,w.intersectionWith=zw,w.invert=nx,w.invertBy=rx,w.invokeMap=Hv,w.iteratee=ic,w.keyBy=Wv,w.keys=Ve,w.keysIn=pt,w.map=Lo,w.mapKeys=sx,w.mapValues=ox,w.matches=eC,w.matchesProperty=tC,w.memoize=Do,w.merge=ax,w.mergeWith=Jp,w.method=nC,w.methodOf=rC,w.mixin=sc,w.negate=Fo,w.nthArg=sC,w.omit=lx,w.omitBy=ux,w.once=iS,w.orderBy=Vv,w.over=oC,w.overArgs=sS,w.overEvery=aC,w.overSome=lC,w.partial=Xu,w.partialRight=zp,w.partition=Uv,w.pick=cx,w.pickBy=jp,w.property=nm,w.propertyOf=uC,w.pull=Vw,w.pullAll=Ap,w.pullAllBy=Uw,w.pullAllWith=qw,w.pullAt=Kw,w.range=cC,w.rangeRight=fC,w.rearg=oS,w.reject=Gv,w.remove=Gw,w.rest=aS,w.reverse=Ju,w.sampleSize=jv,w.set=hx,w.setWith=dx,w.shuffle=Yv,w.slice=Jw,w.sortBy=Qv,w.sortedUniq=tv,w.sortedUniqBy=nv,w.split=Dx,w.spread=lS,w.tail=rv,w.take=iv,w.takeRight=sv,w.takeRightWhile=ov,w.takeWhile=av,w.tap=Sv,w.throttle=uS,w.thru=Ro,w.toArray=Up,w.toPairs=Yp,w.toPairsIn=Xp,w.toPath=gC,w.toPlainObject=Kp,w.transform=px,w.unary=cS,w.union=lv,w.unionBy=uv,w.unionWith=cv,w.uniq=fv,w.uniqBy=hv,w.uniqWith=dv,w.unset=mx,w.unzip=ju,w.unzipWith=Mp,w.update=gx,w.updateWith=yx,w.values=di,w.valuesIn=bx,w.without=pv,w.words=em,w.wrap=fS,w.xor=mv,w.xorBy=gv,w.xorWith=yv,w.zip=bv,w.zipObject=_v,w.zipObjectDeep=wv,w.zipWith=vv,w.entries=Yp,w.entriesIn=Xp,w.extend=Gp,w.extendWith=$o,sc(w,w),w.add=bC,w.attempt=tm,w.camelCase=Sx,w.capitalize=Zp,w.ceil=_C,w.clamp=_x,w.clone=dS,w.cloneDeep=mS,w.cloneDeepWith=gS,w.cloneWith=pS,w.conformsTo=yS,w.deburr=Qp,w.defaultTo=Xx,w.divide=wC,w.endsWith=xx,w.eq=nn,w.escape=Cx,w.escapeRegExp=Ex,w.every=Nv,w.find=Lv,w.findIndex=Cp,w.findKey=GS,w.findLast=Pv,w.findLastIndex=Ep,w.findLastKey=JS,w.floor=vC,w.forEach=Ip,w.forEachRight=Np,w.forIn=jS,w.forInRight=YS,w.forOwn=XS,w.forOwnRight=ZS,w.get=ec,w.gt=bS,w.gte=_S,w.has=tx,w.hasIn=tc,w.head=Tp,w.identity=mt,w.includes=$v,w.indexOf=Pw,w.inRange=wx,w.invoke=ix,w.isArguments=Dr,w.isArray=re,w.isArrayBuffer=wS,w.isArrayLike=dt,w.isArrayLikeObject=Le,w.isBoolean=vS,w.isBuffer=sr,w.isDate=SS,w.isElement=xS,w.isEmpty=CS,w.isEqual=ES,w.isEqualWith=kS,w.isError=Zu,w.isFinite=TS,w.isFunction=In,w.isInteger=$p,w.isLength=Bo,w.isMap=Hp,w.isMatch=AS,w.isMatchWith=MS,w.isNaN=OS,w.isNative=IS,w.isNil=RS,w.isNull=NS,w.isNumber=Wp,w.isObject=Oe,w.isObjectLike=Ie,w.isPlainObject=ls,w.isRegExp=Qu,w.isSafeInteger=LS,w.isSet=Vp,w.isString=zo,w.isSymbol=Tt,w.isTypedArray=hi,w.isUndefined=PS,w.isWeakMap=DS,w.isWeakSet=FS,w.join=$w,w.kebabCase=kx,w.last=Ut,w.lastIndexOf=Hw,w.lowerCase=Tx,w.lowerFirst=Ax,w.lt=BS,w.lte=zS,w.max=SC,w.maxBy=xC,w.mean=CC,w.meanBy=EC,w.min=kC,w.minBy=TC,w.stubArray=ac,w.stubFalse=lc,w.stubObject=hC,w.stubString=dC,w.stubTrue=pC,w.multiply=AC,w.nth=Ww,w.noConflict=iC,w.noop=oc,w.now=Po,w.pad=Mx,w.padEnd=Ox,w.padStart=Ix,w.parseInt=Nx,w.random=vx,w.reduce=qv,w.reduceRight=Kv,w.repeat=Rx,w.replace=Lx,w.result=fx,w.round=MC,w.runInContext=O,w.sample=Jv,w.size=Xv,w.snakeCase=Px,w.some=Zv,w.sortedIndex=jw,w.sortedIndexBy=Yw,w.sortedIndexOf=Xw,w.sortedLastIndex=Zw,w.sortedLastIndexBy=Qw,w.sortedLastIndexOf=ev,w.startCase=Fx,w.startsWith=Bx,w.subtract=OC,w.sum=IC,w.sumBy=NC,w.template=zx,w.times=mC,w.toFinite=Nn,w.toInteger=ie,w.toLength=qp,w.toLower=$x,w.toNumber=qt,w.toSafeInteger=$S,w.toString=_e,w.toUpper=Hx,w.trim=Wx,w.trimEnd=Vx,w.trimStart=Ux,w.truncate=qx,w.unescape=Kx,w.uniqueId=yC,w.upperCase=Gx,w.upperFirst=nc,w.each=Ip,w.eachRight=Np,w.first=Tp,sc(w,function(){var o={};return fn(w,function(l,f){ve.call(w.prototype,f)||(o[f]=l)}),o}(),{chain:!1}),w.VERSION=r,zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){w[o].placeholder=w}),zt(["drop","take"],function(o,l){fe.prototype[o]=function(f){f=f===t?1:ze(ie(f),0);var d=this.__filtered__&&!l?new fe(this):this.clone();return d.__filtered__?d.__takeCount__=nt(f,d.__takeCount__):d.__views__.push({size:nt(f,xt),type:o+(d.__dir__<0?"Right":"")}),d},fe.prototype[o+"Right"]=function(f){return this.reverse()[o](f).reverse()}}),zt(["filter","map","takeWhile"],function(o,l){var f=l+1,d=f==Ft||f==We;fe.prototype[o]=function(b){var x=this.clone();return x.__iteratees__.push({iteratee:Y(b,3),type:f}),x.__filtered__=x.__filtered__||d,x}}),zt(["head","last"],function(o,l){var f="take"+(l?"Right":"");fe.prototype[o]=function(){return this[f](1).value()[0]}}),zt(["initial","tail"],function(o,l){var f="drop"+(l?"":"Right");fe.prototype[o]=function(){return this.__filtered__?new fe(this):this[f](1)}}),fe.prototype.compact=function(){return this.filter(mt)},fe.prototype.find=function(o){return this.filter(o).head()},fe.prototype.findLast=function(o){return this.reverse().find(o)},fe.prototype.invokeMap=ue(function(o,l){return typeof o=="function"?new fe(this):this.map(function(f){return ts(f,o,l)})}),fe.prototype.reject=function(o){return this.filter(Fo(Y(o)))},fe.prototype.slice=function(o,l){o=ie(o);var f=this;return f.__filtered__&&(o>0||l<0)?new fe(f):(o<0?f=f.takeRight(-o):o&&(f=f.drop(o)),l!==t&&(l=ie(l),f=l<0?f.dropRight(-l):f.take(l-o)),f)},fe.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},fe.prototype.toArray=function(){return this.take(xt)},fn(fe.prototype,function(o,l){var f=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),b=w[d?"take"+(l=="last"?"Right":""):l],x=d||/^find/.test(l);b&&(w.prototype[l]=function(){var C=this.__wrapped__,M=d?[1]:arguments,I=C instanceof fe,P=M[0],D=I||re(C),B=function(ce){var me=b.apply(w,Zn([ce],M));return d&&q?me[0]:me};D&&f&&typeof P=="function"&&P.length!=1&&(I=D=!1);var q=this.__chain__,j=!!this.__actions__.length,X=x&&!q,se=I&&!j;if(!x&&D){C=se?C:new fe(this);var Z=o.apply(C,M);return Z.__actions__.push({func:Ro,args:[B],thisArg:t}),new Ht(Z,q)}return X&&se?o.apply(this,M):(Z=this.thru(B),X?d?Z.value()[0]:Z.value():Z)})}),zt(["pop","push","shift","sort","splice","unshift"],function(o){var l=io[o],f=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",d=/^(?:pop|shift)$/.test(o);w.prototype[o]=function(){var b=arguments;if(d&&!this.__chain__){var x=this.value();return l.apply(re(x)?x:[],b)}return this[f](function(C){return l.apply(re(C)?C:[],b)})}}),fn(fe.prototype,function(o,l){var f=w[l];if(f){var d=f.name+"";ve.call(ai,d)||(ai[d]=[]),ai[d].push({name:l,func:f})}}),ai[ko(t,g).name]=[{name:"wrapper",func:t}],fe.prototype.clone=K2,fe.prototype.reverse=G2,fe.prototype.value=J2,w.prototype.at=xv,w.prototype.chain=Cv,w.prototype.commit=Ev,w.prototype.next=kv,w.prototype.plant=Av,w.prototype.reverse=Mv,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=Ov,w.prototype.first=w.prototype.head,Ji&&(w.prototype[Ji]=Tv),w},ii=E2();Ar?((Ar.exports=ii)._=ii,iu._=ii):Xe._=ii}).call(RI)}(Ws,Ws.exports)),Ws.exports}var By=LI();function bh(n){return n.type.create(By.cloneDeep(n.attrs))}function _h({tr:n,node:e,position:t,mark:r}){return e.isText?n.removeMark(t,t+e.nodeSize,r):n.removeNodeMark(t,r)}const PI=Re.create({name:"node_processor",addCommands(){return{setBlockAttributes:W(({commands:n,state:e},t,r,i={})=>{const s=H(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:c,to:h}=u.selection;a.nodesBetween(c,h,(p,m)=>{Nf.includes(p.type.name)&&u.setNodeAttribute(m,t,{...i,...s,...r})})}),getBlockAttributes:W(({editor:n},e,t)=>ge(()=>{let r=Object.assign({},t||{});for(const i of Nf)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:W(({commands:n},e)=>{for(const t of Nf)n.resetAttributes(t,e)}),applyMark:W(({state:n,commands:e},t,r,i={})=>{const{tr:s,doc:a,schema:u}=n,{$from:c,$to:h}=s.selection,p=mn(ke.LINK,u),m=mn(t,u);if(!(m.spec.group||"").includes(Rt.SETTINGS))return e.setMark(t,r);if(c.pos===h.pos)return;const _=S=>{if(!i.onAppliedToParent||i.onAppliedToParent(S)===!1){const{tr:E,node:N,position:g,mark:v}=S;_h({tr:E,node:N,position:g,mark:v.type})}};a.nodesBetween(c.pos,h.pos,(S,E)=>{if(S.type.name===oe.LIST)return;const N=NI(S.marks,t),g=m.create({...N?.attrs||{},...r}),v=Py(c,h,S,E);if(!p.isInSet(S.marks)&&II(s.doc,E,g,i.isAppliedToParent))return _({tr:s,node:S,position:E,mark:g});if(S.isText){s.addMark(v.from,v.to,g);return}MI(s.doc,s.selection,S,E)&&s.addNodeMark(E,g)})}),getMarks:W(({editor:n},e)=>{const t=yi(n,"state");return ge(()=>{const{selection:r,doc:i}=H(t),{from:s,to:a}=H(r),u=[];return i.nodesBetween(s,a,c=>{for(const h of c.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:W(({commands:n},e)=>{const t=n.getMarks(e);return ge(()=>H(t)[0]??null)}),hasMark:W(({commands:n},e)=>{const t=n.getMark(e);return ge(()=>!!H(t))}),getCommonSettingMark:W(({commands:n},e,t)=>{const r=n.getMark(e);return ge(()=>H(r)?.value??H(t))}),getDeviceSettingMark:W(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return ge(()=>{for(const s of H(r)){const a=s[H(i)];if(a)return a}return H(t)})}),removeAllMarks:W(({state:n})=>{const{tr:e,doc:t}=n,{from:r,to:i}=e.selection;t.nodesBetween(r,i,(s,a)=>{for(const u of s.marks)_h({tr:e,node:s,position:a,mark:u})})}),removeMarks:W(({state:n},e)=>{const{tr:t,doc:r}=n,{from:i,to:s}=t.selection;r.nodesBetween(i,s,(a,u)=>{const c=a.marks.filter(h=>e.includes(h.type.name));for(const h of c)_h({tr:t,node:a,position:u,mark:h})})})}}}),DI=Re.create({name:"text_processor",addCommands(){return{getSelectedText:W(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:W(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,s)=>{if(!i.isText)return;const a=Py(t,r,i,s),u=Math.max(0,t.pos-s),c=Math.max(0,r.pos-s),h=e({text:i.textContent.substring(u,c)}),p=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,p)})})}}}),FI=Re.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:W(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:W(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:W(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;return n.doc.nodesBetween(r,i,(s,a,u)=>{if(t({node:s,parent:u})){const c=s.isText?0:Dy(n.doc,a);r=Math.min(r,a+c),i=Math.max(i,a+s.nodeSize-c)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:W(({commands:n})=>n.expandSelection(({parent:e})=>e.type.name===oe.DOCUMENT))}}}),BI=jn.create({name:"doc",topNode:!0,content:"block+"});class Ks extends Ue{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=fr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,De.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)}}Ue.jsonID("setDocAttr",Ks);const zI=BI.extend({marks:Rt.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:W(({state:n},e,t)=>{n.tr.step(new Ks(e,t,n.schema))})}}}),$I=jn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Mi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),HI=$I.extend({marks:Rt.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),WI=jn.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]}`,Mi(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=>mM({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),VI=WI.extend({marks:Rt.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),UI=Re.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[RM.create(this.editor),LM.create(this.editor)]}}),qI=()=>[zI,HI,VI,bM,AM,PI,DI,FI,UI],KI=wt.create({name:ke.FONT_FAMILY,group:Rt.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:W(({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(ke.FONT_STYLE).value;t.isItalicOnly?n.applyItalic():!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:W(({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:W((n,e)=>H(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:W(({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 xr({font_family:e})}}),GI=Re.create({name:ke.STYLE_PRESET,addGlobalAttributes(){return[{types:[oe.PARAGRAPH,oe.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 s=H(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(s))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 s of Object.keys(t)){const a=t[s],u=r[s],c=!u||u.toLowerCase()==="inherit";i[s]=c?a:u}return i}return{getPresetList:W(()=>ge(()=>H(this.options.presets).filter(t=>!t.hidden))),getPreset:W(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:H(this.options.defaultId)}),i=t.getPresetList(),s=t.isLink(),a=t.getLinkPreset();return ge(()=>{const u=n(H(i),H(r).id);if(!H(s))return u;const c=H(a);return{id:u.id,common:e(u.common,c.common),mobile:e(u.mobile,c.mobile),tablet:e(u.tablet,c.tablet),desktop:e(u.desktop,c.desktop)}})}),applyPreset:W(({commands:t,chain:r},i)=>{const s=H(t.getPresetList()),a=n(s,i),u=a.node?.type??oe.PARAGRAPH,c={preset:{id:i}};a.node&&(c.level=a.node.level);for(const h of p1)c[h]=H(t.getBlockAttributes(h));r().removeList().setNode(u,c).run()}),applyDefaultPreset:W(({commands:t})=>{t.applyPreset(H(this.options.defaultId))}),removePreset:W(({commands:t})=>{t.setNode(oe.PARAGRAPH,{preset:null})}),getPresetCustomization:W(({editor:t,commands:r})=>{const i=yi(t,"state");return ge(()=>{const{selection:s,doc:a}=H(i),{from:u,to:c}=s;return r._getSettingCustomization(a,u,c)})}),isSettingCustomized:W(({commands:t},r)=>{const i=t.getPresetCustomization(),s=qa.includes(r)?"attributes":"marks";return ge(()=>H(i)[s]?.includes(r)??!1)}),getContentCustomization:W(({editor:t,commands:r})=>{const i=yi(t,"state");return ge(()=>{const{doc:s}=H(i);return r._getSettingCustomization(s,0,s.content.size)})}),_getSettingCustomization:W((t,r,i,s)=>{const a=new Set,u=new Set;return r.nodesBetween(i,s,c=>{for(const[h,p]of Object.entries(c.attrs))qa.includes(h)&&p&&u.add(h);for(const{type:h}of c.marks)g1.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(g1).resetAttributes(oe.PARAGRAPH,qa).resetAttributes(oe.HEADING,qa).restoreSelection().run()}),removeFormat:W(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Pi.head,H(this.options.presets))}}),JI=wt.create({name:ke.FONT_WEIGHT,group:Rt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:W(({commands:n},e)=>{n.applyMark(this.name,{value:e}),H(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:W(({commands:n})=>{const e=H(n.getFontWeight()),t=H(n.getFont()),i=Number(e)>=600?"400":"700",s=t.findClosestWeight(i);n.applyFontWeight(s)}),getFontWeight:W(({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:W(({commands:n})=>{const e=n.getPreset();return ge(()=>H(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Yt("toggleBold"),"Mod-B":Yt("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 xr({font_weight:n.value})}}),jI=wt.create({name:ke.FONT_SIZE,group:Rt.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:W(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].font_size.replace("px",""))}),applyFontSize:W(({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:s,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(p=>!!p))return!1;const h=a.type.create(u);if(i.isText){r.addMark(s,s+i.nodeSize,h);return}r.addNodeMark(s,h)}})}),increaseFontSize:W(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.min(e+1,H(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:W(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.max(e-1,H(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Yt("increaseFontSize"),"Mod-Shift--":Yt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef),r=Ly(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 xr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),YI=wt.create({name:ke.FONT_COLOR,group:Rt.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:W(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:W(({commands:n})=>{const e=n.getPreset();return ge(()=>H(e).common.color)}),applyFontColor:W(({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 xr({font_color:n.value})}}),XI=wt.create({name:ke.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:W(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:W(({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 xr({background_color:n.value})}}),ZI=Re.create({name:"device_manager",addCommands(){return{getDevice:W(()=>yi(this.options,"device"))}}}),QI=wt.create({name:ke.FONT_STYLE,group:Rt.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:W(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return ge(()=>H(e)?.italic??H(t).italic)}),isItalicAvailable:W(({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:W(({commands:n})=>{const e=n.getPreset();return ge(()=>({italic:H(e).common.font_style==="italic"}))}),toggleItalic:W(({commands:n})=>{H(n.isItalicAvailable())&&(H(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:W(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Yt("toggleItalic"),"Mod-I":Yt("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 xr({font_style:e})}}),eN=wt.create({name:ke.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>H(e).underline)}),isStrikeThrough:W(({commands:n})=>{const e=n.getTextDecoration();return ge(()=>H(e).strike_through)}),getTextDecoration:W(({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:W(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return ge(()=>H(e)!==H(t).underline)}),getDefaultTextDecoration:W(({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:W(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:W(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:W(({commands:n},e,t=null)=>{const r=H(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:W(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Yt("toggleUnderline"),"Mod-U":Yt("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"),xr({text_decoration:e.join(" ")})}}),tN=Re.create({name:"case_style",addCommands(){return{applyCaseStyle:W(({commands:n},e)=>{switch(e){case Ua.CAPITALIZE:return n.applyCapitalize();case Ua.LOWERCASE:return n.applyLowerCase();case Ua.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:W(({commands:n})=>{n.transformText(({text:e})=>eO(e))}),applyLowerCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:W(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),zy={mobile:null,tablet:null,desktop:null},nN=Re.create({name:ke.ALIGNMENT,addGlobalAttributes:()=>[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[ke.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=AI(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:W(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},zy)}),removeAlignment:W(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,zy),t=n.getDevice(),r=n.getDefaultAlignment();return ge(()=>H(e)?.[H(t)]??H(r))}),getDefaultAlignment:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].alignment??_r.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Yt("applyAlignment",_r.LEFT),"Mod-Shift-e":Yt("applyAlignment",_r.CENTER),"Mod-Shift-r":Yt("applyAlignment",_r.RIGHT),"Mod-Shift-j":Yt("applyAlignment",_r.JUSTIFY)})}),$y={mobile:null,tablet:null,desktop:null},rN=Re.create({name:ke.LINE_HEIGHT,addGlobalAttributes(){return[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[ke.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const s=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:s,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=H(this.options.wrapperRef),r=EI(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:W(({commands:n})=>{const e=n.getBlockAttributes(this.name,$y),t=n.getDevice(),r=n.getDefaultLineHeight();return ge(()=>H(e)?.[H(t)]??H(r))}),getDefaultLineHeight:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].line_height)}),applyLineHeight:W(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},$y)})}}}),iN=wt.create({name:ke.LETTER_SPACING,group:Rt.SETTINGS,addAttributes:()=>({mobile:{default:null},tablet:{default:null},desktop:{default:null}}),addCommands(){return{getLetterSpacing:W(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultLetterSpacing())),getDefaultLetterSpacing:W(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return ge(()=>H(t)[H(e)].letter_spacing??null)}),applyLetterSpacing:W(({commands:n},e)=>{const t=H(n.getDevice());n.applyMark(this.name,{[t]:e})})}},parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef);return`${kI(e,t)}px`};return[{tag:'[style*="--zw-letter-spacing"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-letter-spacing-mobile")),tablet:n(e.getPropertyValue("--zw-letter-spacing-tablet")),desktop:n(e.getPropertyValue("--zw-letter-spacing-desktop"))})},{style:"letter-spacing",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:t}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return xr({letter_spacing_mobile:e(n.mobile),letter_spacing_tablet:e(n.tablet),letter_spacing_desktop:e(n.desktop)})}}),sN=jn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Mi(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)}}}),oN=sN.extend({name:oe.LIST_ITEM,marks:Rt.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:W(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const s=n(t);for(const a of r.marks)t.addNodeMark(s,bh(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===oe.LIST))return t.listItemNewline()}})});function aN(n,e){if(m1.includes(e.type)||e.type.isInSet(n.marks))return!1;for(const t of n.content.content)if(t.childCount&&(!t.marks||!e.isInSet(t.marks)))return!1;return!0}function lN(n){const e=n.selection.$from.start(),t=n.selection.$to.end();n.doc.nodesBetween(e,t,(r,i)=>{if(r.type.name===oe.LIST)return;if(r.type.name!==oe.LIST_ITEM)return!1;const s=[];return r.forEach(a=>{for(const u of a.marks){if(u.isInSet(s)){n.removeNodeMark(i+1,u);continue}aN(r,u)&&(n.removeNodeMark(i+1,u),n.addNodeMark(i,bh(u)),s.push(u))}}),!1})}const uN=jn.create({name:oe.LIST,content:`${oe.LIST_ITEM}+`,group:"block list",marks:Rt.SETTINGS,addExtensions:()=>[oN],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:an.DISC}}}),parseHTML(){const n={a:an.ROMAN,i:an.LATIN,1:an.DECIMAL},e=t=>{for(const r of IM){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)||an.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||an.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[H(this.options.baseClass)+n.bullet.type,H(this.options.presetClass)];return[NM.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:W(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return ge(()=>H(e).type??null)}),applyList:W(({commands:n,chain:e},t)=>H(n.getListType())===t?n.removeList():e().applyDefaultPreset().toggleList(oe.LIST,oe.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({tr:i})=>lN(i)).run()),removeList:W(({chain:n})=>n().expandSelection(({parent:e})=>e.type.name===oe.LIST).command(({tr:e})=>{const t=e.selection.$from.start(),r=e.selection.$to.end();return e.doc.nodesBetween(t,r,(i,s,a)=>{if([oe.LIST,oe.LIST_ITEM].includes(i.type.name))return;if(a.type.name!==oe.LIST_ITEM)return!1;const u=a.marks.filter(c=>!c.type.isInSet(i.marks));for(const c of u)e.addNodeMark(s,bh(c));return!1}),!0}).liftListItem(oe.LIST_ITEM).run())}},addInputRules(){const n=(e,t)=>gM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(an.DISC,/^\s*([-+*])\s$/),n(an.DECIMAL,/^(\d+)\.\s$/),n(an.LATIN,/^([ivx]{1,3})\.\s$/i),n(an.ROMAN,/^([a-z])\.\s$/i)]}});function cN(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function fN(n){return new ct({key:new It("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),s=e.some(h=>h.getMeta("preventAutolink"));if(!i||s)return;const{tr:a}=r,u=BA(t.doc,[...e]);if(GA(u).forEach(({newRange:h})=>{const p=$A(r.doc,h,_=>_.isTextblock);let m,y;if(p.length>1?(m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ")):p.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(m=p[0],y=r.doc.textBetween(m.pos,h.to,void 0," ")),m&&y){const _=y.split(" ").filter(g=>g!=="");if(_.length<=0)return!1;const S=_[_.length-1],E=m.pos+y.lastIndexOf(S);if(!S)return!1;const N=xl(S).map(g=>g.toObject(n.defaultProtocol));if(!cN(N))return!1;N.filter(g=>g.isLink).map(g=>({...g,from:E+g.start+1,to:E+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>n.validate(g.value)).filter(g=>n.shouldAutoLink(g.value)).forEach(g=>{i1(g.from,g.to,r.doc).some(v=>v.mark.type===n.type)||a.addMark(g.from,g.to,n.type.create({href:g.href}))})}}),!!a.steps.length)return a}})}function hN(n){return new ct({key:new It("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const u=[];for(;a.nodeName!=="DIV";)u.push(a),a=a.parentNode;if(!u.find(y=>y.nodeName==="A"))return!1;const c=UA(e.state,n.type.name),h=r.target,p=(i=h?.href)!==null&&i!==void 0?i:c.href,m=(s=h?.target)!==null&&s!==void 0?s:c.target;return h&&p?(window.open(p,m),!0):!1}}})}function dN(n){return new ct({key:new It("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:a}=s;if(a)return!1;let u="";r.content.forEach(h=>{u+=h.textContent});const c=N1(u,{defaultProtocol:n.defaultProtocol}).find(h=>h.isLink&&h.value===u);return!u||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}const pN=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Yr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(pN,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const mN=wt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){I1(n);return}I1(n.scheme,n.optionalSlashes)})},onDestroy(){YM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Yr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Yr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Yr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mi(this.options.HTMLAttributes,n),0]:["a",Mi(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Yr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[yM({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=N1(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!Yr(a,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(fN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Yr(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(hN({type:this.type})),this.options.linkOnPaste&&n.push(dN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),gN=mN.extend({name:ke.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:Rf.SELF,parseHTML:n=>n.getAttribute("target")||Rf.SELF},destination:{default:Oi.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Oi.URL;const t=e.replace("#","");return H(this.options.pageBlocks).find(s=>s.id===parseInt(t))?Oi.BLOCK:Oi.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:W(({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(Wy.text(r.text,[Wy.mark(ke.LINK,r)])))),expandSelectionToLink:W(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:W(({commands:e})=>e.hasMark(this.name)),getLinkPreset:W(()=>ge(()=>H(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),QM.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Oi.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]}}),yN=wt.create({name:ke.SUPERSCRIPT,addCommands(){return{applySuperscript:W(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:W(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:W(({commands:n})=>{H(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:W(({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]}}),bN=Re.create({name:ke.MARGIN,addGlobalAttributes:()=>[{types:[oe.PARAGRAPH,oe.HEADING],attributes:{[ke.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:s}=n.style;return[e,t,r,i,s].some(c=>!!c)?e?{value:e}:{value:[t||0,r||0,i||0,s||0].join(" ")}:null},renderHTML(n){return n.margin?Cl({margin:n.margin.value}):null}}}}]});function _N(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=kc({default:null,link:null});return r5(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),qI().concat([GI.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new CN({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),uN.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),ZI.configure({device:n.deviceRef}),jI.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),KI.configure({fonts:n.fonts,defaultPreset:yi(t,"default"),defaultFont:n.defaultFont}),JI,YI,XI,QI,eN,tN,yN,nN,rN.configure({wrapperRef:n.wrapperRef}),iN,gN.configure({preset:yi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),bN])}class wN{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class Hy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class _n extends Hy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=_n.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=s=>s.tagName!=="BODY"&&t.call(this,s),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:s=>r(s)?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,s;const a=u=>{this._assignElementProperties(u,e,_n.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,_n.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,s=u;continue}if(u.tagName==="BR"&&s&&s?.tagName!=="BR"){u.remove(),s=u;continue}if(u.tagName==="BR"){const c=this.dom.createElement("p");c.append(u),a(c),i=null,s=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),s=u}e.append(t),this._removeStyleProperties(e,_n.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,_n.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return _n.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return _n.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const s=t.style.getPropertyValue(i);s&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,s)}}_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 s=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,_n.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(s),s=i.cloneNode();continue}s.append(u)}t.append(s),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),s=this._parseTextDecoration(i),a={underline:s.underline||t.underline,line_through:s.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),s=i.style.backgroundColor||t;i.style.backgroundColor=s}}_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 vN extends Hy{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!==oe.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(m1.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===oe.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>By.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===oe.TEXT&&this._includesMarkType(e,ke.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 Bl{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new _n({content:e,parser:t.parser||new wN})}static _buildJson(e){return new vN({content:e})}static normalize(e,t={}){return Bl.build(e,t).normalize()}}class Pi{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 Eh{static build({config:e,nodeDomParser:t}){const r=_N({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:na(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:na(If.DESKTOP),pageBlocksRef:na([]),wrapperRef:Pi.document.createElement("p")}),i=WA(r);return new Eh({schema:i,domParser:_s.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=Bl.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}function SN(n,e){return n.type===e}function xN(n){return typeof n=="string"}class Wy{static doc(e){return{type:oe.DOCUMENT,content:e}}static list(e,t){return{type:oe.LIST,attrs:{bullet:{type:e}},content:t.map(r=>SN(r,oe.LIST_ITEM)?r:this.listItem([r].flat()))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{type:oe.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[r].flat().map(s=>xN(s)?this.paragraph(s):s)}}static heading(e,...t){const r=this.textBlock(t);return r.attrs??={},r.attrs.level=e,{type:oe.HEADING,...r}}static paragraph(...e){return{type:oe.PARAGRAPH,...this.textBlock(e)}}static textBlock(e){const{attrs:t,content:r,marks:i}=this.normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:[r].flat(),...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:oe.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(ke.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class CN{_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=Pi.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,s=this.makePresetCssClass(r);t+=` ${s} {`;for(const a of MM)for(const u of Object.keys(r[a])){const c=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${c}, inherit);`,i&&!p1.includes(u)){const p=h.replace("preset-","");t+=`${p}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===If.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 kh{static _instance;static get instance(){return this._instance??=new kh,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 Vy{static createWindow(){return new sm.JSDOM().window}types;parse(e){const{window:t}=new sm.JSDOM(e);return this.types=t,t.document}}class Uy{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 EN extends Uy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:im.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Pi.use(Vy.createWindow());const i=im.resolve(process.cwd(),t),s=Eh.build({config:require(i).editor,nodeDomParser:new Vy}),a=e.map(h=>s.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,c=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(c):c)}_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 kN="4.12.0-beta.1";class TN extends Uy{name="version";description="display cli version";doCommand(){this.output(kN)}}const qy=new UC,AN=[EN,TN];for(const n of AN)new n().install(qy);qy.parse();