@inpageedit/core 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.umd.js CHANGED
@@ -9,7 +9,7 @@
9
9
  } catch (e) {
10
10
  throw e;
11
11
  }
12
- `);return(i,n)=>{const r=new Proxy(n,{has:(s,o)=>typeof o=="symbol"?o in s:!(typeof o=="string"&&(t.has(o)||o==="__expr__")),get:(s,o)=>{if(o in s)return s[o]}});return e(i,r)}}function wl(t){return t.charAt(0).toLowerCase()+t.slice(1)}function ki(t){return wl(t).replace(/_/g,"-").replace(/.[A-Z]+/g,e=>e[0]+"-"+e.slice(1).toLowerCase())}function Rp(t){return wl(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}function Gt(t,e){let i=t[0]??"";for(let n=0;n<e.length;n++)i+=String(e[n])+(t[n+1]??"");return i}class Ip{constructor(e,i){this.languages=new Map,this.currentLanguage="en",this.missingKeys=new Map,this.usedKeys=new Set;const n=i?.language||"en";this.currentLanguage=n,this.interpolate=vl(i?.globals),e&&Object.keys(e).length&&this.setLanguageData(n,e)}setGlobals(e){return this.interpolate=vl(e),this}set(e,i){const n=this.currentLanguage,r=this.ensureLanguageMap(n);if(typeof e=="string"&&typeof i=="string")r.set(e,i);else if(typeof e=="object"){const s=this.toStringRecord(e);for(const[o,a]of Object.entries(s))r.set(o,a)}return this}setLanguageData(e,i){e=ki(e).toLowerCase();const n=this.ensureLanguageMap(e),r=this.toStringRecord(i);for(const[s,o]of Object.entries(r))n.set(s,o);return this}setLanguage(e){return e=ki(e).toLowerCase(),this.currentLanguage=e,this}getLanguage(){return this.currentLanguage}hasLanguage(e){e=ki(e).toLowerCase();const i=this.languages.get(e);return i&&Object.keys(i).length>0}toStringRecord(e,i){const n={};for(const[r,s]of Object.entries(e)){const o=i?`${i}.${r}`:r;if(s&&typeof s=="object"&&!Array.isArray(s)){const a=this.toStringRecord(s,o);for(const[l,c]of Object.entries(a))n[l]=String(c)}else n[o]=String(s)}return n}has(e){const i=this.resolveLanguageOrder(this.currentLanguage);for(const n of i)if(this.languages.get(n)?.has(e))return!0;return!1}get(e){this.recordUsedKey(e);const i=this.resolveLanguageOrder(this.currentLanguage),n=[];for(const r of i){const o=this.languages.get(r)?.get(e);if(typeof o<"u")return n.length&&this.recordMissing(e,n),o;n.push(r)}n.length&&this.recordMissing(e,n)}translate(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const n=this.get(e);return typeof n>"u"?this.interpolate(e,...i):this.interpolate(n,...i)}$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],s=e.slice(1),o=Gt(r,s);return this.translate(o)}const n=e;return(r,...s)=>{const o=Gt(r,s);return this.translate(o,...n)}}translateRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??e:""}$raw(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],r=e.slice(1),s=Gt(n,r);return this.translateRaw(s)}return(n,...r)=>{const s=Gt(n,r);return this.translateRaw(s)}}message(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const n=this.get(e);return typeof n>"u"?`(${e})`:this.interpolate(n,...i)}$$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],s=e.slice(1),o=Gt(r,s);return this.message(o)}const n=e;return(r,...s)=>{const o=Gt(r,s);return this.message(o,...n)}}messageRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??`(${e})`:""}$$raw(...e){if(Array.isArray(e[0])&&e[0].raw){const n=e[0],r=e.slice(1),s=Gt(n,r);return this.messageRaw(s)}return(n,...r)=>{const s=Gt(n,r);return this.messageRaw(s)}}getAvailableLanguages(){return Array.from(this.languages.keys())}ensureLanguageMap(e){let i=this.languages.get(e);return i||(i=new Map,this.languages.set(e,i)),i}resolveLanguageOrder(e){const i=e;return i==="en"?["en"]:[i,"en"]}getMissingReport(){return Object.fromEntries(this.missingKeys.entries())}clearMissingReport(){this.missingKeys.clear()}recordMissing(e,i){if(!i.length)return;const n=this.missingKeys.get(e)||[];for(const r of i)n.includes(r)||n.push(r);this.missingKeys.set(e,n)}recordUsedKey(e){this.usedKeys.add(e)}getUsedKeys(){return Array.from(this.usedKeys)}generateBlankKeyRecord(){const e={};for(const i of this.getUsedKeys())e[i]="";return e}}function Vt(t){return function(e){return e.PreferencesSchema=t,e}}var Ap=Object.create,Bs=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,_l=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xl=t=>{throw TypeError(t)},Tp=(t,e,i)=>e in t?Bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Lp=(t,e)=>Bs(t,"name",{value:e,configurable:!0}),Mp=t=>[,,,Ap(t?.[_l("metadata")]??null)],Np=["class","method","getter","setter","accessor","field","value","get","set"],Sl=t=>t!==void 0&&typeof t!="function"?xl("Function expected"):t,Dp=(t,e,i,n,r)=>({kind:Np[t],name:e,metadata:n,addInitializer:s=>i._?xl("Already initialized"):r.push(Sl(s||null))}),jp=(t,e)=>Tp(e,_l("metadata"),t[3]),Up=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Bp=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Op(r,i));Lp(r,i);for(var d=n.length-1;d>=0;d--)l=Dp(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Sl(o)&&(r=o);return jp(t,r),p&&Bs(r,i,p),u?c^4?s:p:r},kl,Fs,$l;const El=new R(R.object({manifest_version:R.const(1).required(),base_language:R.string().required(),last_modified:R.string().required(),languages:R.dict(R.object({file:R.string().required(),fallback:R.string(),iso_name:R.string(),endonym:R.string(),data:R.transform(R.dict(R.any()).default({}),t=>Object.keys(t).length>0?t:void 0)})).required()}));kl=[Ee(["wiki","preferences"]),Vt(R.object({"i18n.index_url":R.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(xt.I18N_INDEX_URL)}).description("").extra("category","general"))];class rr extends($l=wt){constructor(e){super(e,"i18n",!1),this.ctx=e,this.logger=void 0,this._indexUrl=void 0,this._indexCache=null,this.manager=void 0,this.i18nIndexDB=void 0,this.i18nDataDB=void 0,this.$=void 0,this.$raw=void 0,this.$$=void 0,this.$$raw=void 0,this.logger=this.ctx.logger("I18nService"),this.manager=new Ip({},{language:"",globals:{getUrl:(...i)=>e.wiki.getUrl(...i)}}),this.i18nIndexDB=e.storage.createDatabase("i18n-index",1e3*60*60*24*3,this.ctx.version,"indexedDB"),this.i18nDataDB=e.storage.createDatabase("i18n-data",1e3*60*60*24*3,this.ctx.version,"indexedDB"),this.$=this.manager.$.bind(this.manager),this.$raw=this.manager.$raw.bind(this.manager),this.$$=this.manager.$$.bind(this.manager),this.$$raw=this.manager.$$raw.bind(this.manager)}async start(){this.ctx.preferences.registerCustomConfig("language",R.object({language:R.union(["@user","@site",R.string().description("Custom language code")]).description("UI language").default("@user")}).description("UI language")),this.ctx.on("clear-cache",this.onClearCache.bind(this));const e=this._indexUrl=await this.ctx.preferences.get("i18n.index_url")||"";if(!e){this.logger.error("I18n index URL is not set"),this.setupShortcuts();return}let i=null;try{i=await this.getI18nIndex(e)}catch(s){this.logger.error("Failed to fetch i18n index",s),this.setupShortcuts();return}this._indexCache=i,Object.entries(i.languages).forEach(([s,o])=>{o.data&&Object.keys(o.data).length>0&&this.manager.setLanguageData(s,o.data)});const n=await this.ctx.preferences.get("language"),r=this.normalizeLanguageCode(n);this.logger.debug("Settings",{prefer:n,normalized:r});try{await this.switchLanguage(r),this.logger.info(`Initialized for language: ${this.language}`)}catch(s){this.logger.error("Failed to fetch i18n index",s),this.manager.setLanguage("en")}this.ctx.preferences.registerCustomConfig("language",R.object({language:R.union([R.const("@user").description(this.$`Same as your personal language`),R.const("@site").description(this.$`Same as the site language`),...this.getAvailableLanguageCodes().map(({code:s,endonym:o,iso_name:a})=>R.const(s).description(o||a||s))]).default("@user")}).description(this.$`InPageEdit UI language`)),this.setupShortcuts(),this.ctx.on("preferences/changed",async({changes:s})=>{if(!("language"in s))return;const o=this.normalizeLanguageCode(await this.ctx.preferences.get("language"));o&&o!==this.language&&await this.switchLanguage(o)})}setupShortcuts(){if(!this.manager)throw new Error("I18nManager is not initialized");this.ctx.set("$",this.manager.$.bind(this.manager)),this.ctx.set("$raw",this.manager.$raw.bind(this.manager)),this.ctx.set("$$",this.manager.$$.bind(this.manager)),this.ctx.set("$$raw",this.manager.$$raw.bind(this.manager))}normalizeLanguageCode(e){return!e||typeof e!="string"?"en":(e==="@user"&&(e=this.ctx.wiki.userInfo.options.language||"en"),e==="@site"&&(e=this.ctx.wiki.siteInfo.general.lang||"en"),ki(String(e)).toLowerCase())}get language(){return this.manager.getLanguage()}async setLanguagePreference(e){await this.ctx.preferences.set("language",e)}async switchLanguage(e){const i=this.normalizeLanguageCode(e);await this.ensureLanguageLoaded(i),this.manager.setLanguage(i),this.ctx.emit("i18n/changed",{ctx:this.ctx,language:i})}async registerMessages(e,i,n){const r=n?.namespace?{[n.namespace]:i}:i;this.manager.setLanguageData(e,r),e===this.language&&this.ctx.emit("i18n/changed",{ctx:this.ctx,language:this.language})}getAvailableLanguageCodes(){if(!this._indexCache)throw new Error("I18n index is not loaded");return Object.entries(this._indexCache.languages).filter(([e,i])=>!i.fallback).reduce((e,[i,n])=>(e.push({code:i,...n}),e),[])}findLanguageMeta(e,i){const n=ki(String(i)).toLowerCase(),r=e.languages[n];if(r)return{code:n,...r};{const s=e.languages.en;if(s)return{code:"en",...s}}}async getI18nIndex(e,i=!1){if(!i){const r=await this.i18nIndexDB.get(e);if(r)try{return El(r)}catch(s){this.logger.error("Failed to parse cached i18n index",s),this.i18nIndexDB.delete(e)}}const n=await this.fetchI18nIndex(e);return this.i18nIndexDB.set(e,n),n}async fetchI18nIndex(e){const i=await fetch(e).then(n=>n.json());return El(i)}async ensureLanguageLoaded(e){if(!this.manager||!this._indexCache)throw new Error("I18nManager is not initialized");if(this.manager.hasLanguage(e))return this.logger.debug("Language already loaded",e);const i=await this.getLanguageData(e);this.manager.setLanguageData(e,i),this.logger.debug("Language data ensured",e,i)}async getLanguageData(e,i=!1){if(!this._indexCache)throw new Error("I18n index is not loaded");const n=this.findLanguageMeta(this._indexCache,e);if(!n)return{};const r=`${this._indexUrl}#${n.file}`;if(!i){const o=await this.i18nDataDB.get(r);if(o&&Object.keys(o).length>0)return this.logger.debug("Using cached language data",e,o),o}const s=n.data||await fetch(new URL(n.file,this._indexUrl).toString()).then(o=>o.json());return this.i18nDataDB.set(r,s),this.logger.debug("Language data fetched",e,n.file,s),s}getMissingReport(){return this.manager.getMissingReport()}clearMissingReport(){this.manager.clearMissingReport()}async onClearCache(){await this.i18nIndexDB.clear(),await this.i18nDataDB.clear()}}Fs=Mp($l),rr=Bp(Fs,0,"I18nService",kl,rr),Up(Fs,1,rr);const Mn=class Mn extends ze{constructor(i){super({name:"InPageEdit"});Wi(this,ft);this.version="0.14.1",this.Endpoints=xt,this.schema=R,this.config=Qi(Mn.DEFAULT_CONFIG,i),this.logger=Aa({name:"IPE",color:"#33aaff",level:this.config.logLevel}),ot(this,ft,Yf).call(this)}async withInject(i){const{promise:n,resolve:r}=re();return this.inject(i,s=>{r(s)}),n}};ft=new WeakSet,Yf=async function(){await ot(this,ft,Qf).call(this),this.config.autoInstallCorePlugins&&ot(this,ft,Jf).call(this),ot(this,ft,Zf).call(this)},Qf=async function(){this.plugin(rr),this.plugin(qd,this.config.apiConfigs),this.plugin(Vn),this.plugin(Zd),this.plugin(zh),this.plugin(nr),this.plugin(ap,{dbName:this.config.storageNamespace}),this.plugin(ir),this.plugin(Ns),this.plugin(Ds),ot(this,ft,Xf).call(this,["i18n","$","$$","api","currentPage","resourceLoader","modal","preferences","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Xf=function(i){if(!Array.isArray(i)||i.length===0)return this;for(const n of i){const r=this[Mn.internal][n];r?.type==="service"&&(r.builtin=!0)}return this},Jf=async function(){[Promise.resolve().then(()=>Zp).then(({PluginAnalytics:n})=>n),Promise.resolve().then(()=>ug).then(({PluginInArticleLinks:n})=>n),Promise.resolve().then(()=>Wy).then(({PluginPluginStore:n})=>n),Promise.resolve().then(()=>vb).then(({PluginPreferencesUI:n})=>n),Promise.resolve().then(()=>Lb).then(({PluginQuickEdit:n})=>n),Promise.resolve().then(()=>Kb).then(({PluginQuickMove:n})=>n),Promise.resolve().then(()=>iv).then(({PluginQuickPreview:n})=>n),Promise.resolve().then(()=>vv).then(({PluginQuickDiff:n})=>n),Promise.resolve().then(()=>wv).then(({PluginQuickRedirect:n})=>n),Promise.resolve().then(()=>Av).then(({PluginToolbox:n})=>n)].forEach(async n=>{this.plugin(await n)})},Zf=async function(){this.inject(["resourceLoader"],i=>{})},Mn.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:ps.info,storageNamespace:"InPageEdit",autoloadStyles:!0,autoInstallCorePlugins:!0};let $i=Mn;const Jr=class Jr{constructor(e,i=void 0,n){Wi(this,Nn);this.ctx=e,this.disposeHandlers=[],this.name=n||"",this.config=i||{};const{promise:r,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{this.name||(this.name=this.constructor.name);try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("start() returns a rejected promise",l),o(l)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}r.then(()=>{this.logger.debug("started")}),r.catch(a=>{this.logger.error("start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.debug("disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(i=>i!==e)}set name(e){Te(this,Nn,Rp(e).toUpperCase())}get name(){return ae(this,Nn)}get logger(){return this.ctx.logger(this.name)}};Nn=new WeakMap,Jr.inject=[],Jr.reusable=!1;let et=Jr;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),qp("InPageEdit#autoload",()=>{const t=Pl();t&&Fp({baseURL:t,InPageEdit:$i})});async function Fp(t={baseURL:Pl(),InPageEdit:$i}){const{baseURL:e,InPageEdit:i}=t;typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const n=window.InPageEdit||{},r=new i({apiConfigs:{baseURL:e},legacyPreferences:n?.myPreferences||{}});if(window.ipe=r,await r.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(r)}),Array.isArray(window.__IPE_MODULES__)){const s=[];for(;window.__IPE_MODULES__.length;)try{const o=window.__IPE_MODULES__.shift();typeof o=="function"&&o?.(r),s.push(o)}catch{}window.__IPE_MODULES__={push:o=>{typeof o=="function"&&o(r),s.push(o)}},r.on("dispose",()=>{window.__IPE_MODULES__=s})}r.logger("AUTOLOAD").info(`
12
+ `);return(i,n)=>{const r=new Proxy(n,{has:(s,o)=>typeof o=="symbol"?o in s:!(typeof o=="string"&&(t.has(o)||o==="__expr__")),get:(s,o)=>{if(o in s)return s[o]}});return e(i,r)}}function wl(t){return t.charAt(0).toLowerCase()+t.slice(1)}function ki(t){return wl(t).replace(/_/g,"-").replace(/.[A-Z]+/g,e=>e[0]+"-"+e.slice(1).toLowerCase())}function Rp(t){return wl(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}function Gt(t,e){let i=t[0]??"";for(let n=0;n<e.length;n++)i+=String(e[n])+(t[n+1]??"");return i}class Ip{constructor(e,i){this.languages=new Map,this.currentLanguage="en",this.missingKeys=new Map,this.usedKeys=new Set;const n=i?.language||"en";this.currentLanguage=n,this.interpolate=vl(i?.globals),e&&Object.keys(e).length&&this.setLanguageData(n,e)}setGlobals(e){return this.interpolate=vl(e),this}set(e,i){const n=this.currentLanguage,r=this.ensureLanguageMap(n);if(typeof e=="string"&&typeof i=="string")r.set(e,i);else if(typeof e=="object"){const s=this.toStringRecord(e);for(const[o,a]of Object.entries(s))r.set(o,a)}return this}setLanguageData(e,i){e=ki(e).toLowerCase();const n=this.ensureLanguageMap(e),r=this.toStringRecord(i);for(const[s,o]of Object.entries(r))n.set(s,o);return this}setLanguage(e){return e=ki(e).toLowerCase(),this.currentLanguage=e,this}getLanguage(){return this.currentLanguage}hasLanguage(e){e=ki(e).toLowerCase();const i=this.languages.get(e);return i&&Object.keys(i).length>0}toStringRecord(e,i){const n={};for(const[r,s]of Object.entries(e)){const o=i?`${i}.${r}`:r;if(s&&typeof s=="object"&&!Array.isArray(s)){const a=this.toStringRecord(s,o);for(const[l,c]of Object.entries(a))n[l]=String(c)}else n[o]=String(s)}return n}has(e){const i=this.resolveLanguageOrder(this.currentLanguage);for(const n of i)if(this.languages.get(n)?.has(e))return!0;return!1}get(e){this.recordUsedKey(e);const i=this.resolveLanguageOrder(this.currentLanguage),n=[];for(const r of i){const o=this.languages.get(r)?.get(e);if(typeof o<"u")return n.length&&this.recordMissing(e,n),o;n.push(r)}n.length&&this.recordMissing(e,n)}translate(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const n=this.get(e);return typeof n>"u"?this.interpolate(e,...i):this.interpolate(n,...i)}$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],s=e.slice(1),o=Gt(r,s);return this.translate(o)}const n=e;return(r,...s)=>{const o=Gt(r,s);return this.translate(o,...n)}}translateRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??e:""}$raw(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],r=e.slice(1),s=Gt(n,r);return this.translateRaw(s)}return(n,...r)=>{const s=Gt(n,r);return this.translateRaw(s)}}message(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const n=this.get(e);return typeof n>"u"?`(${e})`:this.interpolate(n,...i)}$$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],s=e.slice(1),o=Gt(r,s);return this.message(o)}const n=e;return(r,...s)=>{const o=Gt(r,s);return this.message(o,...n)}}messageRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??`(${e})`:""}$$raw(...e){if(Array.isArray(e[0])&&e[0].raw){const n=e[0],r=e.slice(1),s=Gt(n,r);return this.messageRaw(s)}return(n,...r)=>{const s=Gt(n,r);return this.messageRaw(s)}}getAvailableLanguages(){return Array.from(this.languages.keys())}ensureLanguageMap(e){let i=this.languages.get(e);return i||(i=new Map,this.languages.set(e,i)),i}resolveLanguageOrder(e){const i=e;return i==="en"?["en"]:[i,"en"]}getMissingReport(){return Object.fromEntries(this.missingKeys.entries())}clearMissingReport(){this.missingKeys.clear()}recordMissing(e,i){if(!i.length)return;const n=this.missingKeys.get(e)||[];for(const r of i)n.includes(r)||n.push(r);this.missingKeys.set(e,n)}recordUsedKey(e){this.usedKeys.add(e)}getUsedKeys(){return Array.from(this.usedKeys)}generateBlankKeyRecord(){const e={};for(const i of this.getUsedKeys())e[i]="";return e}}function Vt(t){return function(e){return e.PreferencesSchema=t,e}}var Ap=Object.create,Bs=Object.defineProperty,Op=Object.getOwnPropertyDescriptor,_l=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xl=t=>{throw TypeError(t)},Tp=(t,e,i)=>e in t?Bs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Lp=(t,e)=>Bs(t,"name",{value:e,configurable:!0}),Mp=t=>[,,,Ap(t?.[_l("metadata")]??null)],Np=["class","method","getter","setter","accessor","field","value","get","set"],Sl=t=>t!==void 0&&typeof t!="function"?xl("Function expected"):t,Dp=(t,e,i,n,r)=>({kind:Np[t],name:e,metadata:n,addInitializer:s=>i._?xl("Already initialized"):r.push(Sl(s||null))}),jp=(t,e)=>Tp(e,_l("metadata"),t[3]),Up=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Bp=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Op(r,i));Lp(r,i);for(var d=n.length-1;d>=0;d--)l=Dp(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Sl(o)&&(r=o);return jp(t,r),p&&Bs(r,i,p),u?c^4?s:p:r},kl,Fs,$l;const El=new R(R.object({manifest_version:R.const(1).required(),base_language:R.string().required(),last_modified:R.string().required(),languages:R.dict(R.object({file:R.string().required(),fallback:R.string(),iso_name:R.string(),endonym:R.string(),data:R.transform(R.dict(R.any()).default({}),t=>Object.keys(t).length>0?t:void 0)})).required()}));kl=[Ee(["wiki","preferences"]),Vt(R.object({"i18n.index_url":R.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(xt.I18N_INDEX_URL)}).description("").extra("category","general"))];class rr extends($l=wt){constructor(e){super(e,"i18n",!1),this.ctx=e,this.logger=void 0,this._indexUrl=void 0,this._indexCache=null,this.manager=void 0,this.i18nIndexDB=void 0,this.i18nDataDB=void 0,this.$=void 0,this.$raw=void 0,this.$$=void 0,this.$$raw=void 0,this.logger=this.ctx.logger("I18nService"),this.manager=new Ip({},{language:"",globals:{getUrl:(...i)=>e.wiki.getUrl(...i)}}),this.i18nIndexDB=e.storage.createDatabase("i18n-index",1e3*60*60*24*3,this.ctx.version,"indexedDB"),this.i18nDataDB=e.storage.createDatabase("i18n-data",1e3*60*60*24*3,this.ctx.version,"indexedDB"),this.$=this.manager.$.bind(this.manager),this.$raw=this.manager.$raw.bind(this.manager),this.$$=this.manager.$$.bind(this.manager),this.$$raw=this.manager.$$raw.bind(this.manager)}async start(){this.ctx.preferences.registerCustomConfig("language",R.object({language:R.union(["@user","@site",R.string().description("Custom language code")]).description("UI language").default("@user")}).description("UI language")),this.ctx.on("clear-cache",this.onClearCache.bind(this));const e=this._indexUrl=await this.ctx.preferences.get("i18n.index_url")||"";if(!e){this.logger.error("I18n index URL is not set"),this.setupShortcuts();return}let i=null;try{i=await this.getI18nIndex(e)}catch(s){this.logger.error("Failed to fetch i18n index",s),this.setupShortcuts();return}this._indexCache=i,Object.entries(i.languages).forEach(([s,o])=>{o.data&&Object.keys(o.data).length>0&&this.manager.setLanguageData(s,o.data)});const n=await this.ctx.preferences.get("language"),r=this.normalizeLanguageCode(n);this.logger.debug("Settings",{prefer:n,normalized:r});try{await this.switchLanguage(r),this.logger.info(`Initialized for language: ${this.language}`)}catch(s){this.logger.error("Failed to fetch i18n index",s),this.manager.setLanguage("en")}this.ctx.preferences.registerCustomConfig("language",R.object({language:R.union([R.const("@user").description(this.$`Same as your personal language`),R.const("@site").description(this.$`Same as the site language`),...this.getAvailableLanguageCodes().map(({code:s,endonym:o,iso_name:a})=>R.const(s).description(o||a||s))]).default("@user")}).description(this.$`InPageEdit UI language`)),this.setupShortcuts(),this.ctx.on("preferences/changed",async({changes:s})=>{if(!("language"in s))return;const o=this.normalizeLanguageCode(await this.ctx.preferences.get("language"));o&&o!==this.language&&await this.switchLanguage(o)})}setupShortcuts(){if(!this.manager)throw new Error("I18nManager is not initialized");this.ctx.set("$",this.manager.$.bind(this.manager)),this.ctx.set("$raw",this.manager.$raw.bind(this.manager)),this.ctx.set("$$",this.manager.$$.bind(this.manager)),this.ctx.set("$$raw",this.manager.$$raw.bind(this.manager))}normalizeLanguageCode(e){return!e||typeof e!="string"?"en":(e==="@user"&&(e=this.ctx.wiki.userInfo.options.language||"en"),e==="@site"&&(e=this.ctx.wiki.siteInfo.general.lang||"en"),ki(String(e)).toLowerCase())}get language(){return this.manager.getLanguage()}async setLanguagePreference(e){await this.ctx.preferences.set("language",e)}async switchLanguage(e){const i=this.normalizeLanguageCode(e);await this.ensureLanguageLoaded(i),this.manager.setLanguage(i),this.ctx.emit("i18n/changed",{ctx:this.ctx,language:i})}async registerMessages(e,i,n){const r=n?.namespace?{[n.namespace]:i}:i;this.manager.setLanguageData(e,r),e===this.language&&this.ctx.emit("i18n/changed",{ctx:this.ctx,language:this.language})}getAvailableLanguageCodes(){if(!this._indexCache)throw new Error("I18n index is not loaded");return Object.entries(this._indexCache.languages).filter(([e,i])=>!i.fallback).reduce((e,[i,n])=>(e.push({code:i,...n}),e),[])}findLanguageMeta(e,i){const n=ki(String(i)).toLowerCase(),r=e.languages[n];if(r)return{code:n,...r};{const s=e.languages.en;if(s)return{code:"en",...s}}}async getI18nIndex(e,i=!1){if(!i){const r=await this.i18nIndexDB.get(e);if(r)try{return El(r)}catch(s){this.logger.error("Failed to parse cached i18n index",s),this.i18nIndexDB.delete(e)}}const n=await this.fetchI18nIndex(e);return this.i18nIndexDB.set(e,n),n}async fetchI18nIndex(e){const i=await fetch(e).then(n=>n.json());return El(i)}async ensureLanguageLoaded(e){if(!this.manager||!this._indexCache)throw new Error("I18nManager is not initialized");if(this.manager.hasLanguage(e))return this.logger.debug("Language already loaded",e);const i=await this.getLanguageData(e);this.manager.setLanguageData(e,i),this.logger.debug("Language data ensured",e,i)}async getLanguageData(e,i=!1){if(!this._indexCache)throw new Error("I18n index is not loaded");const n=this.findLanguageMeta(this._indexCache,e);if(!n)return{};const r=`${this._indexUrl}#${n.file}`;if(!i){const o=await this.i18nDataDB.get(r);if(o&&Object.keys(o).length>0)return this.logger.debug("Using cached language data",e,o),o}const s=n.data||await fetch(new URL(n.file,this._indexUrl).toString()).then(o=>o.json());return this.i18nDataDB.set(r,s),this.logger.debug("Language data fetched",e,n.file,s),s}getMissingReport(){return this.manager.getMissingReport()}clearMissingReport(){this.manager.clearMissingReport()}async onClearCache(){await this.i18nIndexDB.clear(),await this.i18nDataDB.clear()}}Fs=Mp($l),rr=Bp(Fs,0,"I18nService",kl,rr),Up(Fs,1,rr);const Mn=class Mn extends ze{constructor(i){super({name:"InPageEdit"});Wi(this,ft);this.version="0.14.2",this.Endpoints=xt,this.schema=R,this.config=Qi(Mn.DEFAULT_CONFIG,i),this.logger=Aa({name:"IPE",color:"#33aaff",level:this.config.logLevel}),ot(this,ft,Yf).call(this)}async withInject(i){const{promise:n,resolve:r}=re();return this.inject(i,s=>{r(s)}),n}};ft=new WeakSet,Yf=async function(){await ot(this,ft,Qf).call(this),this.config.autoInstallCorePlugins&&ot(this,ft,Jf).call(this),ot(this,ft,Zf).call(this)},Qf=async function(){this.plugin(rr),this.plugin(qd,this.config.apiConfigs),this.plugin(Vn),this.plugin(Zd),this.plugin(zh),this.plugin(nr),this.plugin(ap,{dbName:this.config.storageNamespace}),this.plugin(ir),this.plugin(Ns),this.plugin(Ds),ot(this,ft,Xf).call(this,["i18n","$","$$","api","currentPage","resourceLoader","modal","preferences","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Xf=function(i){if(!Array.isArray(i)||i.length===0)return this;for(const n of i){const r=this[Mn.internal][n];r?.type==="service"&&(r.builtin=!0)}return this},Jf=async function(){[Promise.resolve().then(()=>Zp).then(({PluginAnalytics:n})=>n),Promise.resolve().then(()=>ug).then(({PluginInArticleLinks:n})=>n),Promise.resolve().then(()=>Wy).then(({PluginPluginStore:n})=>n),Promise.resolve().then(()=>vb).then(({PluginPreferencesUI:n})=>n),Promise.resolve().then(()=>Lb).then(({PluginQuickEdit:n})=>n),Promise.resolve().then(()=>Kb).then(({PluginQuickMove:n})=>n),Promise.resolve().then(()=>iv).then(({PluginQuickPreview:n})=>n),Promise.resolve().then(()=>vv).then(({PluginQuickDiff:n})=>n),Promise.resolve().then(()=>wv).then(({PluginQuickRedirect:n})=>n),Promise.resolve().then(()=>Av).then(({PluginToolbox:n})=>n)].forEach(async n=>{this.plugin(await n)})},Zf=async function(){this.inject(["resourceLoader"],i=>{})},Mn.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:ps.info,storageNamespace:"InPageEdit",autoloadStyles:!0,autoInstallCorePlugins:!0};let $i=Mn;const Jr=class Jr{constructor(e,i=void 0,n){Wi(this,Nn);this.ctx=e,this.disposeHandlers=[],this.name=n||"",this.config=i||{};const{promise:r,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{this.name||(this.name=this.constructor.name);try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("start() returns a rejected promise",l),o(l)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}r.then(()=>{this.logger.debug("started")}),r.catch(a=>{this.logger.error("start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.debug("disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(i=>i!==e)}set name(e){Te(this,Nn,Rp(e).toUpperCase())}get name(){return ae(this,Nn)}get logger(){return this.ctx.logger(this.name)}};Nn=new WeakMap,Jr.inject=[],Jr.reusable=!1;let et=Jr;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),qp("InPageEdit#autoload",()=>{const t=Pl();t&&Fp({baseURL:t,InPageEdit:$i})});async function Fp(t={baseURL:Pl(),InPageEdit:$i}){const{baseURL:e,InPageEdit:i}=t;typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const n=window.InPageEdit||{},r=new i({apiConfigs:{baseURL:e},legacyPreferences:n?.myPreferences||{}});if(window.ipe=r,await r.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(r)}),Array.isArray(window.__IPE_MODULES__)){const s=[];for(;window.__IPE_MODULES__.length;)try{const o=window.__IPE_MODULES__.shift();typeof o=="function"&&o?.(r),s.push(o)}catch{}window.__IPE_MODULES__={push:o=>{typeof o=="function"&&o(r),s.push(o)}},r.on("dispose",()=>{window.__IPE_MODULES__=s})}r.logger("AUTOLOAD").info(`
13
13
  ____ ____ ______ ___ __
14
14
  / _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
15
15
  / // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
@@ -18,10 +18,10 @@
18
18
  /____/ v`+r.version+`
19
19
  - Wiki API Endpoint: ${e}
20
20
  - Documentation: ${xt.HOME_URL}
21
- - Bug Reports: ${xt.GITHUB_URL}`)}function Pl(){const t=document.querySelector('meta[name="generator"][content^="MediaWiki"]')!==null,e=document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];return t&&e?e:void 0}function qp(t,e){const i=Symbol.for(t);return window[i]?!1:(window[i]=!0,e(),!0)}var Hp=Object.create,qs=Object.defineProperty,zp=Object.getOwnPropertyDescriptor,Cl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Rl=t=>{throw TypeError(t)},Kp=(t,e,i)=>e in t?qs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Wp=(t,e)=>qs(t,"name",{value:e,configurable:!0}),Gp=t=>[,,,Hp(t?.[Cl("metadata")]??null)],Vp=["class","method","getter","setter","accessor","field","value","get","set"],Il=t=>t!==void 0&&typeof t!="function"?Rl("Function expected"):t,Yp=(t,e,i,n,r)=>({kind:Vp[t],name:e,metadata:n,addInitializer:s=>i._?Rl("Already initialized"):r.push(Il(s||null))}),Qp=(t,e)=>Kp(e,Cl("metadata"),t[3]),Xp=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Jp=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&zp(r,i));Wp(r,i);for(var d=n.length-1;d>=0;d--)l=Yp(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Il(o)&&(r=o);return Qp(t,r),p&&qs(r,i,p),u?c^4?s:p:r},Al,Hs,Ol;Al=[Ee(["wiki","preferences","$"])];class sr extends(Ol=et){constructor(e){super(e,{},"analytics"),this.ctx=e,this._usages=[],this._timer=null,this.MAX_QUEUE_SIZE=50,this.INTERVAL_MS=60*1e3,this._setupTimer(),this._registerUnloadHandler(),this._showConfirmNotify(),this._initPluginListeners(),e.set("analytics",this)}start(){const e=this.ctx,i=e.$;e.preferences.registerCustomConfig("analytics",R.object({"analytics._intro":R.const(m("section",{children:[m("h3",{children:i`InPageEdit Analytics`}),m("p",{children:i`InPageEdit Analytics is the companion analytics platform for the InPageEdit NEXT project. By collecting and displaying usage data from around the world, it helps developers and the community better understand how the tool is used, optimize feature design, and enhance user experience.`}),m("h4",{children:i`What data will be collected?`}),m("ol",{style:{listStyle:"number",paddingLeft:"1em"},children:[m("li",{children:[m("strong",{children:i`Usage data`}),":"," ",i`When and which features you use, what pages you edit, etc.`]}),m("li",{children:[m("strong",{children:i`User information`}),": ",i`Your user name and user ID.`]}),m("li",{children:[m("strong",{children:i`Site information`}),": ",i`This wiki's url and site name.`]})]}),m("p",{children:m("strong",{children:i`NO sensitive data will be collected.`})}),m("div",{style:{display:"grid",gap:"0.5rem"},children:[m("a",{href:this.analyticsDashUrl,target:"_blank",rel:"noopener noreferrer",children:m("button",{className:"btn",style:{width:"100%"},children:i`Analytics Platform`})}),m("a",{href:`${this.analyticsDashUrl}/_redirect/user?${new URLSearchParams({siteApi:this.ctx.wiki.getSciprtUrl("api"),mwUserId:this.ctx.wiki.userInfo.id.toString()}).toString()}`,target:"_blank",rel:"noopener noreferrer",children:m("button",{className:"btn",style:{width:"100%"},children:i`View My Data`})})]})]})).role("raw-html"),"analytics.enabled":R.boolean().description(i`prefs.analytics.enabled`).default(!1)}).description(i`prefs.analytics.$`),"general")}get analyticsDashUrl(){return xt.ANALYTICS_DASH_URL}get analyticsApiBase(){return xt.ANALYTICS_API_BASE}_setupTimer(){this._timer=setInterval(()=>{this._usages.length>0&&this.sendBeacon()},this.INTERVAL_MS)}_registerUnloadHandler(){const e=()=>{this._usages.length>0&&this.sendBeacon()};window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()}),window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}async _showConfirmNotify(){const e=this.ctx.$;this.ctx.inject(["modal","storage"],async i=>{const n="analytics/confirm-shown",r=await i.storage.simpleKV.get(n),s=await i.preferences.get("analytics.enabled");r||s||i.modal.notify("confirm",{title:e`Enable Analytics`,content:m("div",{children:[m("p",{children:e`Help us improve InPageEdit by sharing your usage data with us.`}),m("p",{children:e`What data will be collected?`}),m("ul",{style:{listStyle:"auto",paddingLeft:"1.5em"},children:[m("li",{children:[e`Usage data`,": ",e`When and which features you use, what pages you edit, etc.`]}),m("li",{children:[e`User information`,": ",e`Your user name and user ID.`]}),m("li",{children:[e`Site information`,": ",e`This wiki's url and site name.`]})]}),m("p",{children:m("strong",{children:e`NO sensitive data will be collected.`})})]}),okBtn:{label:e`Enable`},cancelBtn:{label:e`Disable`},closeAfter:0,onClose:()=>{this.ctx.storage.simpleKV.set(n,1)}},o=>{i.preferences.set("analytics.enabled",o),o&&this.addEvent("analytics","enabled")})})}_initPluginListeners(){const e=this.ctx;e.on("in-article-links/anchor-clicked",i=>{this.addEvent("in-article-links",ki(i.action))}),e.on("quick-diff/loaded",i=>{this.addEvent("quick-diff","loaded",i.compare.fromtitle)}),e.on("quick-redirect/submit",i=>{this.addEvent("quick-redirect","submit",i.payload.to||void 0)}),e.on("quick-preview/loaded",i=>{this.addEvent("quick-preview","loaded",i.wikiPage.title)}),e.on("quick-edit/wiki-page",i=>{this.addEvent("quick-edit",void 0,i.wikiPage.title)}),e.on("quick-edit/submit",i=>{this.addEvent("quick-edit","submit",i.wikiPage.title)}),e.on("quick-move/submit",i=>{this.addEvent("quick-move","submit")}),e.on("toolbox/button-clicked",i=>{this.addEvent("toolbox",`button-clicked#${i.id||"unknown"}`)})}addEvent(e,i,n){const r={ts:Date.now(),feature:e,subtype:i,page:n};return this._usages.push(r),this._usages.length>=this.MAX_QUEUE_SIZE&&this.sendBeacon(),this}async sendBeacon(){if(this._usages.length===0)return!0;if(!await this.ctx.preferences.get("analytics.enabled",!1))return this.logger.debug("Analytics disabled, skipping"),!0;const i=this._usages.splice(0,this._usages.length),n={siteApi:this.ctx.wiki.getSciprtUrl("api"),siteName:this.ctx.wiki.siteInfo.general.sitename,userId:this.ctx.wiki.userInfo.id,userName:this.ctx.wiki.userInfo.name,version:this.ctx.version.split("-")[0],usages:i},r=JSON.stringify(n),s=`${this.analyticsApiBase}/submit`;if(navigator?.sendBeacon?.(s,r))return this.logger.debug("Beacon sent successfully",n),!0;{this.logger.debug("Beacon failed, sending via XMLHttpRequest");const{promise:a,resolve:l,reject:c}=re();try{const u=new XMLHttpRequest;u.open("POST",s,!0),u.setRequestHeader("Content-Type","application/json"),u.send(r),u.onload=()=>{this.logger.debug("Beacon sent successfully via XMLHttpRequest",n),l(u.status>=200&&u.status<300)},u.onerror=()=>{c(new Error("Failed to send beacon"))}}catch(u){c(u)}return a}}stop(){this._timer!==null&&(clearInterval(this._timer),this._timer=null),this._usages.length>0&&this.sendBeacon()}}Hs=Gp(Ol),sr=Jp(Hs,0,"PluginAnalytics",Al,sr),Xp(Hs,1,sr);const Zp=Object.freeze(Object.defineProperty({__proto__:null,get PluginAnalytics(){return sr}},Symbol.toStringTag,{value:"Module"})),Tl=t=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,class:`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className||""}`,children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),m("path",{d:"M13.5 6.5l4 4"}),m("path",{d:"M19 16l-2 3h4l-2 3"})]});var eg=Object.create,zs=Object.defineProperty,tg=Object.getOwnPropertyDescriptor,Ll=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ml=t=>{throw TypeError(t)},ig=(t,e,i)=>e in t?zs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ng=(t,e)=>zs(t,"name",{value:e,configurable:!0}),rg=t=>[,,,eg(t?.[Ll("metadata")]??null)],sg=["class","method","getter","setter","accessor","field","value","get","set"],Nl=t=>t!==void 0&&typeof t!="function"?Ml("Function expected"):t,og=(t,e,i,n,r)=>({kind:sg[t],name:e,metadata:n,addInitializer:s=>i._?Ml("Already initialized"):r.push(Nl(s||null))}),ag=(t,e)=>ig(e,Ll("metadata"),t[3]),lg=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},cg=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&tg(r,i));ng(r,i);for(var d=n.length-1;d>=0;d--)l=og(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Nl(o)&&(r=o);return ag(t,r),p&&zs(r,i,p),u?c^4?s:p:r},Dl,Ks,jl;Dl=[Ee(["wiki","wikiTitle","preferences","$"]),Vt(R.object({"inArticleLinks.enable":R.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":R.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":R.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":R.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class or extends(jl=et){constructor(e){super(e,{linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this);const i=this.ctx.$;this.ctx.preferences.defineCategory({name:"in-article-links",label:i`prefs.inArticleLinks.label`,description:i`prefs.inArticleLinks.$`,index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){Array.from(document.getElementsByClassName(this.config.linkClassName)).forEach(e=>{e.remove()}),document.querySelectorAll("[data-ipe-edit-mounted]").forEach(e=>{e.dataset.ipeEditMounted=void 0})}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const i=this._cachedAnchorInfo.get(e);if(i)return i;const n=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(n))return null;const r=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(r);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!n.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),this.ctx.emit("in-article-links/anchor-parsed",{ctx:this.ctx,anchor:e,info:o}),o}scanAnchors(e,i){const n=e.querySelectorAll("a[href]");return Array.from(n).map(r=>this.parseAnchor(r)).filter(r=>r!==null&&(!i||i(r)))}async handleQuickEdit(){let e=!1;const i=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],n=>{e=!0,n.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(r=>{if(!e)return;this.scanAnchors(r.get(0),({action:o,title:a,redlink:l})=>i||!l?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(o=>{const{$el:a,title:l,pageId:c,params:u}=o;if(a.dataset.ipeEditMounted)return;if(a.dataset.ipeEditMounted="1",u.has("preload")||u.has("redo"))return this.ctx.logger.debug(a,"Not compatible with quick edit");const h=l?.getPrefixedDBKey()||"",p=u.get("section")?.replace(/^T-/,"")||void 0,d=u.get("oldid"),w=u.has("redlink");let S;p==="new"||l?.isSpecial("newsection")?S="new":p&&/^\d+$/.test(p)&&(S=parseInt(p,10));const E=d?parseInt(d,10):void 0,M={title:h,pageId:c||void 0,section:S,revision:E,createOnly:w},g=m("a",{href:"#ipe://quick-edit/",dataset:M,className:`${this.config.linkClassName} ipe-quick-edit ${w?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:y=>{y.preventDefault(),this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:y,action:"quickEdit"}),n.quickEdit.showModal(M)},children:m(Tl,{className:"ipe-icon"})});a.insertAdjacentElement("afterend",g)})})})}handleQuickDiff(){let e=!1;const i=n=>["prev","next","cur"].includes(n);this.ctx.inject(["quickDiff"],n=>{e=!0,n.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(r=>{if(!e)return;this.scanAnchors(r.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(o=>{const{$el:a,title:l,params:c}=o;if(a.dataset.ipeDiffMounted)return;a.dataset.ipeDiffMounted="1";let u,f;if(l?.getNamespaceId()===-1?([,f,u]=l.getMainDBKey().split("/"),u||(u="prev")):(u=c.get("diff"),f=c.get("oldid")),!u||!f)return;const h={};i(u)?(h.fromrev=parseInt(f),h.torelative=u):(h.fromrev=parseInt(f),h.torev=parseInt(u));const p=m("a",{href:"#ipe://quick-diff/",dataset:h,className:`${this.config.linkClassName} ipe-quick-diff`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:d=>{d.preventDefault(),this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:d,action:"quickDiff"}),n.quickDiff.comparePages(h)},children:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-diff ipe-icon",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),m("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),m("path",{d:"M12 10l0 4"}),m("path",{d:"M10 12l4 0"}),m("path",{d:"M10 17l4 0"})]})});a.insertAdjacentElement("afterend",p)})})})}}Ks=rg(jl),or=cg(Ks,0,"PluginInArticleLinks",Dl,or),lg(Ks,1,or);const ug=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return or}},Symbol.toStringTag,{value:"Module"}));function Ws(t){const e=Object.create(null);for(const i of t.split(","))e[i]=1;return i=>i in e}const ne={},Ei=[],St=()=>{},Ul=()=>!1,ar=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Gs=t=>t.startsWith("onUpdate:"),Ae=Object.assign,Vs=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},fg=Object.prototype.hasOwnProperty,se=(t,e)=>fg.call(t,e),Y=Array.isArray,Pi=t=>lr(t)==="[object Map]",Bl=t=>lr(t)==="[object Set]",Q=t=>typeof t=="function",_e=t=>typeof t=="string",Dt=t=>typeof t=="symbol",ye=t=>t!==null&&typeof t=="object",Fl=t=>(ye(t)||Q(t))&&Q(t.then)&&Q(t.catch),ql=Object.prototype.toString,lr=t=>ql.call(t),dg=t=>lr(t).slice(8,-1),Hl=t=>lr(t)==="[object Object]",Ys=t=>_e(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ln=Ws(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cr=t=>{const e=Object.create(null);return(i=>e[i]||(e[i]=t(i)))},hg=/-\w/g,jt=cr(t=>t.replace(hg,e=>e.slice(1).toUpperCase())),pg=/\B([A-Z])/g,Yt=cr(t=>t.replace(pg,"-$1").toLowerCase()),zl=cr(t=>t.charAt(0).toUpperCase()+t.slice(1)),Qs=cr(t=>t?`on${zl(t)}`:""),Ve=(t,e)=>!Object.is(t,e),ur=(t,...e)=>{for(let i=0;i<t.length;i++)t[i](...e)},Kl=(t,e,i,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:i})},Xs=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Wl;const fr=()=>Wl||(Wl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Js(t){if(Y(t)){const e={};for(let i=0;i<t.length;i++){const n=t[i],r=_e(n)?bg(n):Js(n);if(r)for(const s in r)e[s]=r[s]}return e}else if(_e(t)||ye(t))return t}const gg=/;(?![^(]*\))/g,mg=/:([^]+)/,yg=/\/\*[^]*?\*\//g;function bg(t){const e={};return t.replace(yg,"").split(gg).forEach(i=>{if(i){const n=i.split(mg);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function pt(t){let e="";if(_e(t))e=t;else if(Y(t))for(let i=0;i<t.length;i++){const n=pt(t[i]);n&&(e+=n+" ")}else if(ye(t))for(const i in t)t[i]&&(e+=i+" ");return e.trim()}const vg=Ws("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Gl(t){return!!t||t===""}const Vl=t=>!!(t&&t.__v_isRef===!0),ue=t=>_e(t)?t:t==null?"":Y(t)||ye(t)&&(t.toString===ql||!Q(t.toString))?Vl(t)?ue(t.value):JSON.stringify(t,Yl,2):String(t),Yl=(t,e)=>Vl(e)?Yl(t,e.value):Pi(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((i,[n,r],s)=>(i[Zs(n,s)+" =>"]=r,i),{})}:Bl(e)?{[`Set(${e.size})`]:[...e.values()].map(i=>Zs(i))}:Dt(e)?Zs(e):ye(e)&&!Y(e)&&!Hl(e)?String(e):e,Zs=(t,e="")=>{var i;return Dt(t)?`Symbol(${(i=t.description)!=null?i:e})`:t};let Ye;class wg{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ye,!e&&Ye&&(this.index=(Ye.scopes||(Ye.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].pause();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].resume();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].resume()}}run(e){if(this._active){const i=Ye;try{return Ye=this,e()}finally{Ye=i}}}on(){++this._on===1&&(this.prevScope=Ye,Ye=this)}off(){this._on>0&&--this._on===0&&(Ye=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let i,n;for(i=0,n=this.effects.length;i<n;i++)this.effects[i].stop();for(this.effects.length=0,i=0,n=this.cleanups.length;i<n;i++)this.cleanups[i]();if(this.cleanups.length=0,this.scopes){for(i=0,n=this.scopes.length;i<n;i++)this.scopes[i].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function _g(){return Ye}let fe;const eo=new WeakSet;class Ql{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,Ye&&Ye.active&&Ye.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,eo.has(this)&&(eo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nc(this),Zl(this);const e=fe,i=gt;fe=this,gt=!0;try{return this.fn()}finally{ec(this),fe=e,gt=i,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ro(e);this.deps=this.depsTail=void 0,nc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?eo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){no(this)&&this.run()}get dirty(){return no(this)}}let Xl=0,cn,un;function Jl(t,e=!1){if(t.flags|=8,e){t.next=un,un=t;return}t.next=cn,cn=t}function to(){Xl++}function io(){if(--Xl>0)return;if(un){let e=un;for(un=void 0;e;){const i=e.next;e.next=void 0,e.flags&=-9,e=i}}let t;for(;cn;){let e=cn;for(cn=void 0;e;){const i=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=i}}if(t)throw t}function Zl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ec(t){let e,i=t.depsTail,n=i;for(;n;){const r=n.prevDep;n.version===-1?(n===i&&(i=r),ro(n),xg(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}t.deps=e,t.depsTail=i}function no(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(tc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function tc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===fn)||(t.globalVersion=fn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!no(t))))return;t.flags|=2;const e=t.dep,i=fe,n=gt;fe=t,gt=!0;try{Zl(t);const r=t.fn(t._value);(e.version===0||Ve(r,t._value))&&(t.flags|=128,t._value=r,e.version++)}catch(r){throw e.version++,r}finally{fe=i,gt=n,ec(t),t.flags&=-3}}function ro(t,e=!1){const{dep:i,prevSub:n,nextSub:r}=t;if(n&&(n.nextSub=r,t.prevSub=void 0),r&&(r.prevSub=n,t.nextSub=void 0),i.subs===t&&(i.subs=n,!n&&i.computed)){i.computed.flags&=-5;for(let s=i.computed.deps;s;s=s.nextDep)ro(s,!0)}!e&&!--i.sc&&i.map&&i.map.delete(i.key)}function xg(t){const{prevDep:e,nextDep:i}=t;e&&(e.nextDep=i,t.prevDep=void 0),i&&(i.prevDep=e,t.nextDep=void 0)}let gt=!0;const ic=[];function kt(){ic.push(gt),gt=!1}function $t(){const t=ic.pop();gt=t===void 0?!0:t}function nc(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const i=fe;fe=void 0;try{e()}finally{fe=i}}}let fn=0;class Sg{constructor(e,i){this.sub=e,this.dep=i,this.version=i.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class dr{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,this.__v_skip=!0}track(e){if(!fe||!gt||fe===this.computed)return;let i=this.activeLink;if(i===void 0||i.sub!==fe)i=this.activeLink=new Sg(fe,this),fe.deps?(i.prevDep=fe.depsTail,fe.depsTail.nextDep=i,fe.depsTail=i):fe.deps=fe.depsTail=i,rc(i);else if(i.version===-1&&(i.version=this.version,i.nextDep)){const n=i.nextDep;n.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=n),i.prevDep=fe.depsTail,i.nextDep=void 0,fe.depsTail.nextDep=i,fe.depsTail=i,fe.deps===i&&(fe.deps=n)}return i}trigger(e){this.version++,fn++,this.notify(e)}notify(e){to();try{for(let i=this.subs;i;i=i.prevSub)i.sub.notify()&&i.sub.dep.notify()}finally{io()}}}function rc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)rc(n)}const i=t.dep.subs;i!==t&&(t.prevSub=i,i&&(i.nextSub=t)),t.dep.subs=t}}const so=new WeakMap,li=Symbol(""),oo=Symbol(""),dn=Symbol("");function Me(t,e,i){if(gt&&fe){let n=so.get(t);n||so.set(t,n=new Map);let r=n.get(i);r||(n.set(i,r=new dr),r.map=n,r.key=i),r.track()}}function Ut(t,e,i,n,r,s){const o=so.get(t);if(!o){fn++;return}const a=l=>{l&&l.trigger()};if(to(),e==="clear")o.forEach(a);else{const l=Y(t),c=l&&Ys(i);if(l&&i==="length"){const u=Number(n);o.forEach((f,h)=>{(h==="length"||h===dn||!Dt(h)&&h>=u)&&a(f)})}else switch((i!==void 0||o.has(void 0))&&a(o.get(i)),c&&a(o.get(dn)),e){case"add":l?c&&a(o.get("length")):(a(o.get(li)),Pi(t)&&a(o.get(oo)));break;case"delete":l||(a(o.get(li)),Pi(t)&&a(o.get(oo)));break;case"set":Pi(t)&&a(o.get(li));break}}io()}function Ci(t){const e=ie(t);return e===t?e:(Me(e,"iterate",dn),lt(t)?e:e.map(Oe))}function hr(t){return Me(t=ie(t),"iterate",dn),t}const kg={__proto__:null,[Symbol.iterator](){return ao(this,Symbol.iterator,Oe)},concat(...t){return Ci(this).concat(...t.map(e=>Y(e)?Ci(e):e))},entries(){return ao(this,"entries",t=>(t[1]=Oe(t[1]),t))},every(t,e){return Bt(this,"every",t,e,void 0,arguments)},filter(t,e){return Bt(this,"filter",t,e,i=>i.map(Oe),arguments)},find(t,e){return Bt(this,"find",t,e,Oe,arguments)},findIndex(t,e){return Bt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Bt(this,"findLast",t,e,Oe,arguments)},findLastIndex(t,e){return Bt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Bt(this,"forEach",t,e,void 0,arguments)},includes(...t){return lo(this,"includes",t)},indexOf(...t){return lo(this,"indexOf",t)},join(t){return Ci(this).join(t)},lastIndexOf(...t){return lo(this,"lastIndexOf",t)},map(t,e){return Bt(this,"map",t,e,void 0,arguments)},pop(){return hn(this,"pop")},push(...t){return hn(this,"push",t)},reduce(t,...e){return sc(this,"reduce",t,e)},reduceRight(t,...e){return sc(this,"reduceRight",t,e)},shift(){return hn(this,"shift")},some(t,e){return Bt(this,"some",t,e,void 0,arguments)},splice(...t){return hn(this,"splice",t)},toReversed(){return Ci(this).toReversed()},toSorted(t){return Ci(this).toSorted(t)},toSpliced(...t){return Ci(this).toSpliced(...t)},unshift(...t){return hn(this,"unshift",t)},values(){return ao(this,"values",Oe)}};function ao(t,e,i){const n=hr(t),r=n[e]();return n!==t&&!lt(t)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=i(s.value)),s}),r}const $g=Array.prototype;function Bt(t,e,i,n,r,s){const o=hr(t),a=o!==t&&!lt(t),l=o[e];if(l!==$g[e]){const f=l.apply(t,s);return a?Oe(f):f}let c=i;o!==t&&(a?c=function(f,h){return i.call(this,Oe(f),h,t)}:i.length>2&&(c=function(f,h){return i.call(this,f,h,t)}));const u=l.call(o,c,n);return a&&r?r(u):u}function sc(t,e,i,n){const r=hr(t);let s=i;return r!==t&&(lt(t)?i.length>3&&(s=function(o,a,l){return i.call(this,o,a,l,t)}):s=function(o,a,l){return i.call(this,o,Oe(a),l,t)}),r[e](s,...n)}function lo(t,e,i){const n=ie(t);Me(n,"iterate",dn);const r=n[e](...i);return(r===-1||r===!1)&&ho(i[0])?(i[0]=ie(i[0]),n[e](...i)):r}function hn(t,e,i=[]){kt(),to();const n=ie(t)[e].apply(t,i);return io(),$t(),n}const Eg=Ws("__proto__,__v_isRef,__isVue"),oc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Dt));function Pg(t){Dt(t)||(t=String(t));const e=ie(this);return Me(e,"has",t),e.hasOwnProperty(t)}class ac{constructor(e=!1,i=!1){this._isReadonly=e,this._isShallow=i}get(e,i,n){if(i==="__v_skip")return e.__v_skip;const r=this._isReadonly,s=this._isShallow;if(i==="__v_isReactive")return!r;if(i==="__v_isReadonly")return r;if(i==="__v_isShallow")return s;if(i==="__v_raw")return n===(r?s?hc:dc:s?fc:uc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=Y(e);if(!r){let l;if(o&&(l=kg[i]))return l;if(i==="hasOwnProperty")return Pg}const a=Reflect.get(e,i,Ie(e)?e:n);if((Dt(i)?oc.has(i):Eg(i))||(r||Me(e,"get",i),s))return a;if(Ie(a)){const l=o&&Ys(i)?a:a.value;return r&&ye(l)?fo(l):l}return ye(a)?r?fo(a):uo(a):a}}class lc extends ac{constructor(e=!1){super(!1,e)}set(e,i,n,r){let s=e[i];if(!this._isShallow){const l=Qt(s);if(!lt(n)&&!Qt(n)&&(s=ie(s),n=ie(n)),!Y(e)&&Ie(s)&&!Ie(n))return l||(s.value=n),!0}const o=Y(e)&&Ys(i)?Number(i)<e.length:se(e,i),a=Reflect.set(e,i,n,Ie(e)?e:r);return e===ie(r)&&(o?Ve(n,s)&&Ut(e,"set",i,n):Ut(e,"add",i,n)),a}deleteProperty(e,i){const n=se(e,i);e[i];const r=Reflect.deleteProperty(e,i);return r&&n&&Ut(e,"delete",i,void 0),r}has(e,i){const n=Reflect.has(e,i);return(!Dt(i)||!oc.has(i))&&Me(e,"has",i),n}ownKeys(e){return Me(e,"iterate",Y(e)?"length":li),Reflect.ownKeys(e)}}class cc extends ac{constructor(e=!1){super(!0,e)}set(e,i){return!0}deleteProperty(e,i){return!0}}const Cg=new lc,Rg=new cc,Ig=new lc(!0),Ag=new cc(!0),co=t=>t,pr=t=>Reflect.getPrototypeOf(t);function Og(t,e,i){return function(...n){const r=this.__v_raw,s=ie(r),o=Pi(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=r[t](...n),u=i?co:e?br:Oe;return!e&&Me(s,"iterate",l?oo:li),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function gr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Tg(t,e){const i={get(r){const s=this.__v_raw,o=ie(s),a=ie(r);t||(Ve(r,a)&&Me(o,"get",r),Me(o,"get",a));const{has:l}=pr(o),c=e?co:t?br:Oe;if(l.call(o,r))return c(s.get(r));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!t&&Me(ie(r),"iterate",li),r.size},has(r){const s=this.__v_raw,o=ie(s),a=ie(r);return t||(Ve(r,a)&&Me(o,"has",r),Me(o,"has",a)),r===a?s.has(r):s.has(r)||s.has(a)},forEach(r,s){const o=this,a=o.__v_raw,l=ie(a),c=e?co:t?br:Oe;return!t&&Me(l,"iterate",li),a.forEach((u,f)=>r.call(s,c(u),c(f),o))}};return Ae(i,t?{add:gr("add"),set:gr("set"),delete:gr("delete"),clear:gr("clear")}:{add(r){!e&&!lt(r)&&!Qt(r)&&(r=ie(r));const s=ie(this);return pr(s).has.call(s,r)||(s.add(r),Ut(s,"add",r,r)),this},set(r,s){!e&&!lt(s)&&!Qt(s)&&(s=ie(s));const o=ie(this),{has:a,get:l}=pr(o);let c=a.call(o,r);c||(r=ie(r),c=a.call(o,r));const u=l.call(o,r);return o.set(r,s),c?Ve(s,u)&&Ut(o,"set",r,s):Ut(o,"add",r,s),this},delete(r){const s=ie(this),{has:o,get:a}=pr(s);let l=o.call(s,r);l||(r=ie(r),l=o.call(s,r)),a&&a.call(s,r);const c=s.delete(r);return l&&Ut(s,"delete",r,void 0),c},clear(){const r=ie(this),s=r.size!==0,o=r.clear();return s&&Ut(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{i[r]=Og(r,t,e)}),i}function mr(t,e){const i=Tg(t,e);return(n,r,s)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?n:Reflect.get(se(i,r)&&r in n?i:n,r,s)}const Lg={get:mr(!1,!1)},Mg={get:mr(!1,!0)},Ng={get:mr(!0,!1)},Dg={get:mr(!0,!0)},uc=new WeakMap,fc=new WeakMap,dc=new WeakMap,hc=new WeakMap;function jg(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ug(t){return t.__v_skip||!Object.isExtensible(t)?0:jg(dg(t))}function uo(t){return Qt(t)?t:yr(t,!1,Cg,Lg,uc)}function Bg(t){return yr(t,!1,Ig,Mg,fc)}function fo(t){return yr(t,!0,Rg,Ng,dc)}function Uw(t){return yr(t,!0,Ag,Dg,hc)}function yr(t,e,i,n,r){if(!ye(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Ug(t);if(s===0)return t;const o=r.get(t);if(o)return o;const a=new Proxy(t,s===2?n:i);return r.set(t,a),a}function Ri(t){return Qt(t)?Ri(t.__v_raw):!!(t&&t.__v_isReactive)}function Qt(t){return!!(t&&t.__v_isReadonly)}function lt(t){return!!(t&&t.__v_isShallow)}function ho(t){return t?!!t.__v_raw:!1}function ie(t){const e=t&&t.__v_raw;return e?ie(e):t}function Fg(t){return!se(t,"__v_skip")&&Object.isExtensible(t)&&Kl(t,"__v_skip",!0),t}const Oe=t=>ye(t)?uo(t):t,br=t=>ye(t)?fo(t):t;function Ie(t){return t?t.__v_isRef===!0:!1}function Ue(t){return gc(t,!1)}function pc(t){return gc(t,!0)}function gc(t,e){return Ie(t)?t:new qg(t,e)}class qg{constructor(e,i){this.dep=new dr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=i?e:ie(e),this._value=i?e:Oe(e),this.__v_isShallow=i}get value(){return this.dep.track(),this._value}set value(e){const i=this._rawValue,n=this.__v_isShallow||lt(e)||Qt(e);e=n?e:ie(e),Ve(e,i)&&(this._rawValue=e,this._value=n?e:Oe(e),this.dep.trigger())}}function Pe(t){return Ie(t)?t.value:t}const Hg={get:(t,e,i)=>e==="__v_raw"?t:Pe(Reflect.get(t,e,i)),set:(t,e,i,n)=>{const r=t[e];return Ie(r)&&!Ie(i)?(r.value=i,!0):Reflect.set(t,e,i,n)}};function mc(t){return Ri(t)?t:new Proxy(t,Hg)}class zg{constructor(e){this.__v_isRef=!0,this._value=void 0;const i=this.dep=new dr,{get:n,set:r}=e(i.track.bind(i),i.trigger.bind(i));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}}function Kg(t){return new zg(t)}class Wg{constructor(e,i,n){this.fn=e,this.setter=i,this._value=void 0,this.dep=new dr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=fn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!i,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&fe!==this)return Jl(this,!0),!0}get value(){const e=this.dep.track();return tc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Gg(t,e,i=!1){let n,r;return Q(t)?n=t:(n=t.get,r=t.set),new Wg(n,r,i)}const vr={},wr=new WeakMap;let ci;function Vg(t,e=!1,i=ci){if(i){let n=wr.get(i);n||wr.set(i,n=[]),n.push(t)}}function Yg(t,e,i=ne){const{immediate:n,deep:r,once:s,scheduler:o,augmentJob:a,call:l}=i,c=y=>r?y:lt(y)||r===!1||r===0?Ft(y,1):Ft(y);let u,f,h,p,d=!1,w=!1;if(Ie(t)?(f=()=>t.value,d=lt(t)):Ri(t)?(f=()=>c(t),d=!0):Y(t)?(w=!0,d=t.some(y=>Ri(y)||lt(y)),f=()=>t.map(y=>{if(Ie(y))return y.value;if(Ri(y))return c(y);if(Q(y))return l?l(y,2):y()})):Q(t)?e?f=l?()=>l(t,2):t:f=()=>{if(h){kt();try{h()}finally{$t()}}const y=ci;ci=u;try{return l?l(t,3,[p]):t(p)}finally{ci=y}}:f=St,e&&r){const y=f,v=r===!0?1/0:r;f=()=>Ft(y(),v)}const S=_g(),E=()=>{u.stop(),S&&S.active&&Vs(S.effects,u)};if(s&&e){const y=e;e=(...v)=>{y(...v),E()}}let M=w?new Array(t.length).fill(vr):vr;const g=y=>{if(!(!(u.flags&1)||!u.dirty&&!y))if(e){const v=u.run();if(r||d||(w?v.some((x,P)=>Ve(x,M[P])):Ve(v,M))){h&&h();const x=ci;ci=u;try{const P=[v,M===vr?void 0:w&&M[0]===vr?[]:M,p];M=v,l?l(e,3,P):e(...P)}finally{ci=x}}}else u.run()};return a&&a(g),u=new Ql(f),u.scheduler=o?()=>o(g,!1):g,p=y=>Vg(y,!1,u),h=u.onStop=()=>{const y=wr.get(u);if(y){if(l)l(y,4);else for(const v of y)v();wr.delete(u)}},e?n?g(!0):M=u.run():o?o(g.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Ft(t,e=1/0,i){if(e<=0||!ye(t)||t.__v_skip||(i=i||new Map,(i.get(t)||0)>=e))return t;if(i.set(t,e),e--,Ie(t))Ft(t.value,e,i);else if(Y(t))for(let n=0;n<t.length;n++)Ft(t[n],e,i);else if(Bl(t)||Pi(t))t.forEach(n=>{Ft(n,e,i)});else if(Hl(t)){for(const n in t)Ft(t[n],e,i);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Ft(t[n],e,i)}return t}const pn=[];let po=!1;function Bw(t,...e){if(po)return;po=!0,kt();const i=pn.length?pn[pn.length-1].component:null,n=i&&i.appContext.config.warnHandler,r=Qg();if(n)Ii(n,i,11,[t+e.map(s=>{var o,a;return(a=(o=s.toString)==null?void 0:o.call(s))!=null?a:JSON.stringify(s)}).join(""),i&&i.proxy,r.map(({vnode:s})=>`at <${du(i,s.type)}>`).join(`
21
+ - Bug Reports: ${xt.GITHUB_URL}`)}function Pl(){const t=document.querySelector('meta[name="generator"][content^="MediaWiki"]')!==null,e=document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];return t&&e?e:void 0}function qp(t,e){const i=Symbol.for(t);return window[i]?!1:(window[i]=!0,e(),!0)}var Hp=Object.create,qs=Object.defineProperty,zp=Object.getOwnPropertyDescriptor,Cl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Rl=t=>{throw TypeError(t)},Kp=(t,e,i)=>e in t?qs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Wp=(t,e)=>qs(t,"name",{value:e,configurable:!0}),Gp=t=>[,,,Hp(t?.[Cl("metadata")]??null)],Vp=["class","method","getter","setter","accessor","field","value","get","set"],Il=t=>t!==void 0&&typeof t!="function"?Rl("Function expected"):t,Yp=(t,e,i,n,r)=>({kind:Vp[t],name:e,metadata:n,addInitializer:s=>i._?Rl("Already initialized"):r.push(Il(s||null))}),Qp=(t,e)=>Kp(e,Cl("metadata"),t[3]),Xp=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Jp=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&zp(r,i));Wp(r,i);for(var d=n.length-1;d>=0;d--)l=Yp(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Il(o)&&(r=o);return Qp(t,r),p&&qs(r,i,p),u?c^4?s:p:r},Al,Hs,Ol;Al=[Ee(["wiki","preferences","$"])];class sr extends(Ol=et){constructor(e){super(e,{},"analytics"),this.ctx=e,this._usages=[],this._timer=null,this.MAX_QUEUE_SIZE=50,this.INTERVAL_MS=60*1e3,this._setupTimer(),this._registerUnloadHandler(),this._showConfirmNotify(),this._initPluginListeners(),e.set("analytics",this)}start(){const e=this.ctx,i=e.$;e.preferences.registerCustomConfig("analytics",R.object({"analytics._intro":R.const(m("section",{children:[m("h3",{children:i`InPageEdit Analytics`}),m("p",{children:i`InPageEdit Analytics is the companion analytics platform for the InPageEdit NEXT project. By collecting and displaying usage data from around the world, it helps developers and the community better understand how the tool is used, optimize feature design, and enhance user experience.`}),m("h4",{children:i`What data will be collected?`}),m("ol",{style:{listStyle:"number",paddingLeft:"1em"},children:[m("li",{children:[m("strong",{children:i`Usage data`}),":"," ",i`When and which features you use, what pages you edit, etc.`]}),m("li",{children:[m("strong",{children:i`User information`}),": ",i`Your user name and user ID.`]}),m("li",{children:[m("strong",{children:i`Site information`}),": ",i`This wiki's url and site name.`]})]}),m("p",{children:m("strong",{children:i`NO sensitive data will be collected.`})}),m("div",{style:{display:"grid",gap:"0.5rem"},children:[m("a",{href:this.analyticsDashUrl,target:"_blank",rel:"noopener noreferrer",children:m("button",{className:"btn",style:{width:"100%"},children:i`Analytics Platform`})}),m("a",{href:`${this.analyticsDashUrl}/_redirect/user?${new URLSearchParams({siteApi:this.ctx.wiki.getSciprtUrl("api"),mwUserId:this.ctx.wiki.userInfo.id.toString()}).toString()}`,target:"_blank",rel:"noopener noreferrer",children:m("button",{className:"btn",style:{width:"100%"},children:i`View My Data`})})]})]})).role("raw-html"),"analytics.enabled":R.boolean().description(i`prefs.analytics.enabled`).default(!1)}).description(i`prefs.analytics.$`),"general")}get analyticsDashUrl(){return xt.ANALYTICS_DASH_URL}get analyticsApiBase(){return xt.ANALYTICS_API_BASE}_setupTimer(){this._timer=setInterval(()=>{this._usages.length>0&&this.sendBeacon()},this.INTERVAL_MS)}_registerUnloadHandler(){const e=()=>{this._usages.length>0&&this.sendBeacon()};window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()}),window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e)}async _showConfirmNotify(){const e=this.ctx.$;this.ctx.inject(["modal","storage"],async i=>{const n="analytics/confirm-shown",r=await i.storage.simpleKV.get(n),s=await i.preferences.get("analytics.enabled");r||s||i.modal.notify("confirm",{title:e`Enable Analytics`,content:m("div",{children:[m("p",{children:e`Help us improve InPageEdit by sharing your usage data with us.`}),m("p",{children:e`What data will be collected?`}),m("ul",{style:{listStyle:"auto",paddingLeft:"1.5em"},children:[m("li",{children:[e`Usage data`,": ",e`When and which features you use, what pages you edit, etc.`]}),m("li",{children:[e`User information`,": ",e`Your user name and user ID.`]}),m("li",{children:[e`Site information`,": ",e`This wiki's url and site name.`]})]}),m("p",{children:m("strong",{children:e`NO sensitive data will be collected.`})})]}),okBtn:{label:e`Enable`},cancelBtn:{label:e`Disable`},closeAfter:0,onClose:()=>{this.ctx.storage.simpleKV.set(n,1)}},o=>{i.preferences.set("analytics.enabled",o),o&&this.addEvent("analytics","enabled")})})}_initPluginListeners(){const e=this.ctx;e.on("in-article-links/anchor-clicked",i=>{this.addEvent("in-article-links",ki(i.action))}),e.on("quick-diff/loaded",i=>{this.addEvent("quick-diff","loaded",i.compare.fromtitle)}),e.on("quick-redirect/submit",i=>{this.addEvent("quick-redirect","submit",i.payload.to||void 0)}),e.on("quick-preview/loaded",i=>{this.addEvent("quick-preview","loaded",i.wikiPage.title)}),e.on("quick-edit/wiki-page",i=>{this.addEvent("quick-edit",void 0,i.wikiPage.title)}),e.on("quick-edit/submit",i=>{this.addEvent("quick-edit","submit",i.wikiPage.title)}),e.on("quick-move/submit",()=>{this.addEvent("quick-move","submit")}),e.on("toolbox/button-clicked",({payload:i})=>{this.addEvent("toolbox",`button-clicked#${i.id||"unknown"}`)}),e.on("plugin-store/plugin-installed",({registry:i,id:n,by:r})=>{r==="new-added"&&this.addEvent("plugin-store","plugin-installed",`${i.name}#${n}`)}),e.on("plugin-store/plugin-uninstalled",({registry:i,id:n})=>{this.addEvent("plugin-store","plugin-uninstalled",`${i.name}#${n}`)})}addEvent(e,i,n){const r={ts:Date.now(),feature:e,subtype:i,page:n};return this._usages.push(r),this._usages.length>=this.MAX_QUEUE_SIZE&&this.sendBeacon(),this}async sendBeacon(){if(this._usages.length===0)return!0;if(!await this.ctx.preferences.get("analytics.enabled",!1))return this.logger.debug("Analytics disabled, skipping"),!0;const i=this._usages.splice(0,this._usages.length),n={siteApi:this.ctx.wiki.getSciprtUrl("api"),siteName:this.ctx.wiki.siteInfo.general.sitename,userId:this.ctx.wiki.userInfo.id,userName:this.ctx.wiki.userInfo.name,version:this.ctx.version.split("-")[0],usages:i},r=JSON.stringify(n),s=`${this.analyticsApiBase}/submit`;if(navigator?.sendBeacon?.(s,r))return this.logger.debug("Beacon sent successfully",n),!0;{this.logger.debug("Beacon failed, sending via XMLHttpRequest");const{promise:a,resolve:l,reject:c}=re();try{const u=new XMLHttpRequest;u.open("POST",s,!0),u.setRequestHeader("Content-Type","application/json"),u.send(r),u.onload=()=>{this.logger.debug("Beacon sent successfully via XMLHttpRequest",n),l(u.status>=200&&u.status<300)},u.onerror=()=>{c(new Error("Failed to send beacon"))}}catch(u){c(u)}return a}}stop(){this._timer!==null&&(clearInterval(this._timer),this._timer=null),this._usages.length>0&&this.sendBeacon()}}Hs=Gp(Ol),sr=Jp(Hs,0,"PluginAnalytics",Al,sr),Xp(Hs,1,sr);const Zp=Object.freeze(Object.defineProperty({__proto__:null,get PluginAnalytics(){return sr}},Symbol.toStringTag,{value:"Module"})),Tl=t=>m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,class:`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className||""}`,children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),m("path",{d:"M13.5 6.5l4 4"}),m("path",{d:"M19 16l-2 3h4l-2 3"})]});var eg=Object.create,zs=Object.defineProperty,tg=Object.getOwnPropertyDescriptor,Ll=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ml=t=>{throw TypeError(t)},ig=(t,e,i)=>e in t?zs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ng=(t,e)=>zs(t,"name",{value:e,configurable:!0}),rg=t=>[,,,eg(t?.[Ll("metadata")]??null)],sg=["class","method","getter","setter","accessor","field","value","get","set"],Nl=t=>t!==void 0&&typeof t!="function"?Ml("Function expected"):t,og=(t,e,i,n,r)=>({kind:sg[t],name:e,metadata:n,addInitializer:s=>i._?Ml("Already initialized"):r.push(Nl(s||null))}),ag=(t,e)=>ig(e,Ll("metadata"),t[3]),lg=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},cg=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&tg(r,i));ng(r,i);for(var d=n.length-1;d>=0;d--)l=og(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Nl(o)&&(r=o);return ag(t,r),p&&zs(r,i,p),u?c^4?s:p:r},Dl,Ks,jl;Dl=[Ee(["wiki","wikiTitle","preferences","$"]),Vt(R.object({"inArticleLinks.enable":R.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":R.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":R.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":R.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class or extends(jl=et){constructor(e){super(e,{linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this);const i=this.ctx.$;this.ctx.preferences.defineCategory({name:"in-article-links",label:i`prefs.inArticleLinks.label`,description:i`prefs.inArticleLinks.$`,index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){Array.from(document.getElementsByClassName(this.config.linkClassName)).forEach(e=>{e.remove()}),document.querySelectorAll("[data-ipe-edit-mounted]").forEach(e=>{e.dataset.ipeEditMounted=void 0})}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const i=this._cachedAnchorInfo.get(e);if(i)return i;const n=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(n))return null;const r=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(r);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!n.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),this.ctx.emit("in-article-links/anchor-parsed",{ctx:this.ctx,anchor:e,info:o}),o}scanAnchors(e,i){const n=e.querySelectorAll("a[href]");return Array.from(n).map(r=>this.parseAnchor(r)).filter(r=>r!==null&&(!i||i(r)))}async handleQuickEdit(){let e=!1;const i=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],n=>{e=!0,n.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(r=>{if(!e)return;this.scanAnchors(r.get(0),({action:o,title:a,redlink:l})=>i||!l?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(o=>{const{$el:a,title:l,pageId:c,params:u}=o;if(a.dataset.ipeEditMounted)return;if(a.dataset.ipeEditMounted="1",u.has("preload")||u.has("redo"))return this.ctx.logger.debug(a,"Not compatible with quick edit");const h=l?.getPrefixedDBKey()||"",p=u.get("section")?.replace(/^T-/,"")||void 0,d=u.get("oldid"),w=u.has("redlink");let S;p==="new"||l?.isSpecial("newsection")?S="new":p&&/^\d+$/.test(p)&&(S=parseInt(p,10));const E=d?parseInt(d,10):void 0,M={title:h,pageId:c||void 0,section:S,revision:E,createOnly:w},g=m("a",{href:"#ipe://quick-edit/",dataset:M,className:`${this.config.linkClassName} ipe-quick-edit ${w?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:y=>{y.preventDefault(),this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:y,action:"quickEdit"}),n.quickEdit.showModal(M)},children:m(Tl,{className:"ipe-icon"})});a.insertAdjacentElement("afterend",g)})})})}handleQuickDiff(){let e=!1;const i=n=>["prev","next","cur"].includes(n);this.ctx.inject(["quickDiff"],n=>{e=!0,n.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(r=>{if(!e)return;this.scanAnchors(r.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(o=>{const{$el:a,title:l,params:c}=o;if(a.dataset.ipeDiffMounted)return;a.dataset.ipeDiffMounted="1";let u,f;if(l?.getNamespaceId()===-1?([,f,u]=l.getMainDBKey().split("/"),u||(u="prev")):(u=c.get("diff"),f=c.get("oldid")),!u||!f)return;const h={};i(u)?(h.fromrev=parseInt(f),h.torelative=u):(h.fromrev=parseInt(f),h.torev=parseInt(u));const p=m("a",{href:"#ipe://quick-diff/",dataset:h,className:`${this.config.linkClassName} ipe-quick-diff`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:d=>{d.preventDefault(),this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:d,action:"quickDiff"}),n.quickDiff.comparePages(h)},children:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-diff ipe-icon",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),m("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),m("path",{d:"M12 10l0 4"}),m("path",{d:"M10 12l4 0"}),m("path",{d:"M10 17l4 0"})]})});a.insertAdjacentElement("afterend",p)})})})}}Ks=rg(jl),or=cg(Ks,0,"PluginInArticleLinks",Dl,or),lg(Ks,1,or);const ug=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return or}},Symbol.toStringTag,{value:"Module"}));function Ws(t){const e=Object.create(null);for(const i of t.split(","))e[i]=1;return i=>i in e}const ne={},Ei=[],St=()=>{},Ul=()=>!1,ar=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Gs=t=>t.startsWith("onUpdate:"),Ae=Object.assign,Vs=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},fg=Object.prototype.hasOwnProperty,se=(t,e)=>fg.call(t,e),Y=Array.isArray,Pi=t=>lr(t)==="[object Map]",Bl=t=>lr(t)==="[object Set]",Q=t=>typeof t=="function",_e=t=>typeof t=="string",Dt=t=>typeof t=="symbol",ye=t=>t!==null&&typeof t=="object",Fl=t=>(ye(t)||Q(t))&&Q(t.then)&&Q(t.catch),ql=Object.prototype.toString,lr=t=>ql.call(t),dg=t=>lr(t).slice(8,-1),Hl=t=>lr(t)==="[object Object]",Ys=t=>_e(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ln=Ws(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cr=t=>{const e=Object.create(null);return(i=>e[i]||(e[i]=t(i)))},hg=/-\w/g,jt=cr(t=>t.replace(hg,e=>e.slice(1).toUpperCase())),pg=/\B([A-Z])/g,Yt=cr(t=>t.replace(pg,"-$1").toLowerCase()),zl=cr(t=>t.charAt(0).toUpperCase()+t.slice(1)),Qs=cr(t=>t?`on${zl(t)}`:""),Ve=(t,e)=>!Object.is(t,e),ur=(t,...e)=>{for(let i=0;i<t.length;i++)t[i](...e)},Kl=(t,e,i,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:i})},Xs=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Wl;const fr=()=>Wl||(Wl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Js(t){if(Y(t)){const e={};for(let i=0;i<t.length;i++){const n=t[i],r=_e(n)?bg(n):Js(n);if(r)for(const s in r)e[s]=r[s]}return e}else if(_e(t)||ye(t))return t}const gg=/;(?![^(]*\))/g,mg=/:([^]+)/,yg=/\/\*[^]*?\*\//g;function bg(t){const e={};return t.replace(yg,"").split(gg).forEach(i=>{if(i){const n=i.split(mg);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function pt(t){let e="";if(_e(t))e=t;else if(Y(t))for(let i=0;i<t.length;i++){const n=pt(t[i]);n&&(e+=n+" ")}else if(ye(t))for(const i in t)t[i]&&(e+=i+" ");return e.trim()}const vg=Ws("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Gl(t){return!!t||t===""}const Vl=t=>!!(t&&t.__v_isRef===!0),ue=t=>_e(t)?t:t==null?"":Y(t)||ye(t)&&(t.toString===ql||!Q(t.toString))?Vl(t)?ue(t.value):JSON.stringify(t,Yl,2):String(t),Yl=(t,e)=>Vl(e)?Yl(t,e.value):Pi(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((i,[n,r],s)=>(i[Zs(n,s)+" =>"]=r,i),{})}:Bl(e)?{[`Set(${e.size})`]:[...e.values()].map(i=>Zs(i))}:Dt(e)?Zs(e):ye(e)&&!Y(e)&&!Hl(e)?String(e):e,Zs=(t,e="")=>{var i;return Dt(t)?`Symbol(${(i=t.description)!=null?i:e})`:t};let Ye;class wg{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ye,!e&&Ye&&(this.index=(Ye.scopes||(Ye.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].pause();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].resume();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].resume()}}run(e){if(this._active){const i=Ye;try{return Ye=this,e()}finally{Ye=i}}}on(){++this._on===1&&(this.prevScope=Ye,Ye=this)}off(){this._on>0&&--this._on===0&&(Ye=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let i,n;for(i=0,n=this.effects.length;i<n;i++)this.effects[i].stop();for(this.effects.length=0,i=0,n=this.cleanups.length;i<n;i++)this.cleanups[i]();if(this.cleanups.length=0,this.scopes){for(i=0,n=this.scopes.length;i<n;i++)this.scopes[i].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function _g(){return Ye}let fe;const eo=new WeakSet;class Ql{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,Ye&&Ye.active&&Ye.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,eo.has(this)&&(eo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nc(this),Zl(this);const e=fe,i=gt;fe=this,gt=!0;try{return this.fn()}finally{ec(this),fe=e,gt=i,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ro(e);this.deps=this.depsTail=void 0,nc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?eo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){no(this)&&this.run()}get dirty(){return no(this)}}let Xl=0,cn,un;function Jl(t,e=!1){if(t.flags|=8,e){t.next=un,un=t;return}t.next=cn,cn=t}function to(){Xl++}function io(){if(--Xl>0)return;if(un){let e=un;for(un=void 0;e;){const i=e.next;e.next=void 0,e.flags&=-9,e=i}}let t;for(;cn;){let e=cn;for(cn=void 0;e;){const i=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=i}}if(t)throw t}function Zl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ec(t){let e,i=t.depsTail,n=i;for(;n;){const r=n.prevDep;n.version===-1?(n===i&&(i=r),ro(n),xg(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}t.deps=e,t.depsTail=i}function no(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(tc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function tc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===fn)||(t.globalVersion=fn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!no(t))))return;t.flags|=2;const e=t.dep,i=fe,n=gt;fe=t,gt=!0;try{Zl(t);const r=t.fn(t._value);(e.version===0||Ve(r,t._value))&&(t.flags|=128,t._value=r,e.version++)}catch(r){throw e.version++,r}finally{fe=i,gt=n,ec(t),t.flags&=-3}}function ro(t,e=!1){const{dep:i,prevSub:n,nextSub:r}=t;if(n&&(n.nextSub=r,t.prevSub=void 0),r&&(r.prevSub=n,t.nextSub=void 0),i.subs===t&&(i.subs=n,!n&&i.computed)){i.computed.flags&=-5;for(let s=i.computed.deps;s;s=s.nextDep)ro(s,!0)}!e&&!--i.sc&&i.map&&i.map.delete(i.key)}function xg(t){const{prevDep:e,nextDep:i}=t;e&&(e.nextDep=i,t.prevDep=void 0),i&&(i.prevDep=e,t.nextDep=void 0)}let gt=!0;const ic=[];function kt(){ic.push(gt),gt=!1}function $t(){const t=ic.pop();gt=t===void 0?!0:t}function nc(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const i=fe;fe=void 0;try{e()}finally{fe=i}}}let fn=0;class Sg{constructor(e,i){this.sub=e,this.dep=i,this.version=i.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class dr{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,this.__v_skip=!0}track(e){if(!fe||!gt||fe===this.computed)return;let i=this.activeLink;if(i===void 0||i.sub!==fe)i=this.activeLink=new Sg(fe,this),fe.deps?(i.prevDep=fe.depsTail,fe.depsTail.nextDep=i,fe.depsTail=i):fe.deps=fe.depsTail=i,rc(i);else if(i.version===-1&&(i.version=this.version,i.nextDep)){const n=i.nextDep;n.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=n),i.prevDep=fe.depsTail,i.nextDep=void 0,fe.depsTail.nextDep=i,fe.depsTail=i,fe.deps===i&&(fe.deps=n)}return i}trigger(e){this.version++,fn++,this.notify(e)}notify(e){to();try{for(let i=this.subs;i;i=i.prevSub)i.sub.notify()&&i.sub.dep.notify()}finally{io()}}}function rc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)rc(n)}const i=t.dep.subs;i!==t&&(t.prevSub=i,i&&(i.nextSub=t)),t.dep.subs=t}}const so=new WeakMap,li=Symbol(""),oo=Symbol(""),dn=Symbol("");function Me(t,e,i){if(gt&&fe){let n=so.get(t);n||so.set(t,n=new Map);let r=n.get(i);r||(n.set(i,r=new dr),r.map=n,r.key=i),r.track()}}function Ut(t,e,i,n,r,s){const o=so.get(t);if(!o){fn++;return}const a=l=>{l&&l.trigger()};if(to(),e==="clear")o.forEach(a);else{const l=Y(t),c=l&&Ys(i);if(l&&i==="length"){const u=Number(n);o.forEach((f,h)=>{(h==="length"||h===dn||!Dt(h)&&h>=u)&&a(f)})}else switch((i!==void 0||o.has(void 0))&&a(o.get(i)),c&&a(o.get(dn)),e){case"add":l?c&&a(o.get("length")):(a(o.get(li)),Pi(t)&&a(o.get(oo)));break;case"delete":l||(a(o.get(li)),Pi(t)&&a(o.get(oo)));break;case"set":Pi(t)&&a(o.get(li));break}}io()}function Ci(t){const e=ie(t);return e===t?e:(Me(e,"iterate",dn),lt(t)?e:e.map(Oe))}function hr(t){return Me(t=ie(t),"iterate",dn),t}const kg={__proto__:null,[Symbol.iterator](){return ao(this,Symbol.iterator,Oe)},concat(...t){return Ci(this).concat(...t.map(e=>Y(e)?Ci(e):e))},entries(){return ao(this,"entries",t=>(t[1]=Oe(t[1]),t))},every(t,e){return Bt(this,"every",t,e,void 0,arguments)},filter(t,e){return Bt(this,"filter",t,e,i=>i.map(Oe),arguments)},find(t,e){return Bt(this,"find",t,e,Oe,arguments)},findIndex(t,e){return Bt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Bt(this,"findLast",t,e,Oe,arguments)},findLastIndex(t,e){return Bt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Bt(this,"forEach",t,e,void 0,arguments)},includes(...t){return lo(this,"includes",t)},indexOf(...t){return lo(this,"indexOf",t)},join(t){return Ci(this).join(t)},lastIndexOf(...t){return lo(this,"lastIndexOf",t)},map(t,e){return Bt(this,"map",t,e,void 0,arguments)},pop(){return hn(this,"pop")},push(...t){return hn(this,"push",t)},reduce(t,...e){return sc(this,"reduce",t,e)},reduceRight(t,...e){return sc(this,"reduceRight",t,e)},shift(){return hn(this,"shift")},some(t,e){return Bt(this,"some",t,e,void 0,arguments)},splice(...t){return hn(this,"splice",t)},toReversed(){return Ci(this).toReversed()},toSorted(t){return Ci(this).toSorted(t)},toSpliced(...t){return Ci(this).toSpliced(...t)},unshift(...t){return hn(this,"unshift",t)},values(){return ao(this,"values",Oe)}};function ao(t,e,i){const n=hr(t),r=n[e]();return n!==t&&!lt(t)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=i(s.value)),s}),r}const $g=Array.prototype;function Bt(t,e,i,n,r,s){const o=hr(t),a=o!==t&&!lt(t),l=o[e];if(l!==$g[e]){const f=l.apply(t,s);return a?Oe(f):f}let c=i;o!==t&&(a?c=function(f,h){return i.call(this,Oe(f),h,t)}:i.length>2&&(c=function(f,h){return i.call(this,f,h,t)}));const u=l.call(o,c,n);return a&&r?r(u):u}function sc(t,e,i,n){const r=hr(t);let s=i;return r!==t&&(lt(t)?i.length>3&&(s=function(o,a,l){return i.call(this,o,a,l,t)}):s=function(o,a,l){return i.call(this,o,Oe(a),l,t)}),r[e](s,...n)}function lo(t,e,i){const n=ie(t);Me(n,"iterate",dn);const r=n[e](...i);return(r===-1||r===!1)&&ho(i[0])?(i[0]=ie(i[0]),n[e](...i)):r}function hn(t,e,i=[]){kt(),to();const n=ie(t)[e].apply(t,i);return io(),$t(),n}const Eg=Ws("__proto__,__v_isRef,__isVue"),oc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Dt));function Pg(t){Dt(t)||(t=String(t));const e=ie(this);return Me(e,"has",t),e.hasOwnProperty(t)}class ac{constructor(e=!1,i=!1){this._isReadonly=e,this._isShallow=i}get(e,i,n){if(i==="__v_skip")return e.__v_skip;const r=this._isReadonly,s=this._isShallow;if(i==="__v_isReactive")return!r;if(i==="__v_isReadonly")return r;if(i==="__v_isShallow")return s;if(i==="__v_raw")return n===(r?s?hc:dc:s?fc:uc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=Y(e);if(!r){let l;if(o&&(l=kg[i]))return l;if(i==="hasOwnProperty")return Pg}const a=Reflect.get(e,i,Ie(e)?e:n);if((Dt(i)?oc.has(i):Eg(i))||(r||Me(e,"get",i),s))return a;if(Ie(a)){const l=o&&Ys(i)?a:a.value;return r&&ye(l)?fo(l):l}return ye(a)?r?fo(a):uo(a):a}}class lc extends ac{constructor(e=!1){super(!1,e)}set(e,i,n,r){let s=e[i];if(!this._isShallow){const l=Qt(s);if(!lt(n)&&!Qt(n)&&(s=ie(s),n=ie(n)),!Y(e)&&Ie(s)&&!Ie(n))return l||(s.value=n),!0}const o=Y(e)&&Ys(i)?Number(i)<e.length:se(e,i),a=Reflect.set(e,i,n,Ie(e)?e:r);return e===ie(r)&&(o?Ve(n,s)&&Ut(e,"set",i,n):Ut(e,"add",i,n)),a}deleteProperty(e,i){const n=se(e,i);e[i];const r=Reflect.deleteProperty(e,i);return r&&n&&Ut(e,"delete",i,void 0),r}has(e,i){const n=Reflect.has(e,i);return(!Dt(i)||!oc.has(i))&&Me(e,"has",i),n}ownKeys(e){return Me(e,"iterate",Y(e)?"length":li),Reflect.ownKeys(e)}}class cc extends ac{constructor(e=!1){super(!0,e)}set(e,i){return!0}deleteProperty(e,i){return!0}}const Cg=new lc,Rg=new cc,Ig=new lc(!0),Ag=new cc(!0),co=t=>t,pr=t=>Reflect.getPrototypeOf(t);function Og(t,e,i){return function(...n){const r=this.__v_raw,s=ie(r),o=Pi(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=r[t](...n),u=i?co:e?br:Oe;return!e&&Me(s,"iterate",l?oo:li),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:a?[u(f[0]),u(f[1])]:u(f),done:h}},[Symbol.iterator](){return this}}}}function gr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Tg(t,e){const i={get(r){const s=this.__v_raw,o=ie(s),a=ie(r);t||(Ve(r,a)&&Me(o,"get",r),Me(o,"get",a));const{has:l}=pr(o),c=e?co:t?br:Oe;if(l.call(o,r))return c(s.get(r));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!t&&Me(ie(r),"iterate",li),r.size},has(r){const s=this.__v_raw,o=ie(s),a=ie(r);return t||(Ve(r,a)&&Me(o,"has",r),Me(o,"has",a)),r===a?s.has(r):s.has(r)||s.has(a)},forEach(r,s){const o=this,a=o.__v_raw,l=ie(a),c=e?co:t?br:Oe;return!t&&Me(l,"iterate",li),a.forEach((u,f)=>r.call(s,c(u),c(f),o))}};return Ae(i,t?{add:gr("add"),set:gr("set"),delete:gr("delete"),clear:gr("clear")}:{add(r){!e&&!lt(r)&&!Qt(r)&&(r=ie(r));const s=ie(this);return pr(s).has.call(s,r)||(s.add(r),Ut(s,"add",r,r)),this},set(r,s){!e&&!lt(s)&&!Qt(s)&&(s=ie(s));const o=ie(this),{has:a,get:l}=pr(o);let c=a.call(o,r);c||(r=ie(r),c=a.call(o,r));const u=l.call(o,r);return o.set(r,s),c?Ve(s,u)&&Ut(o,"set",r,s):Ut(o,"add",r,s),this},delete(r){const s=ie(this),{has:o,get:a}=pr(s);let l=o.call(s,r);l||(r=ie(r),l=o.call(s,r)),a&&a.call(s,r);const c=s.delete(r);return l&&Ut(s,"delete",r,void 0),c},clear(){const r=ie(this),s=r.size!==0,o=r.clear();return s&&Ut(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{i[r]=Og(r,t,e)}),i}function mr(t,e){const i=Tg(t,e);return(n,r,s)=>r==="__v_isReactive"?!t:r==="__v_isReadonly"?t:r==="__v_raw"?n:Reflect.get(se(i,r)&&r in n?i:n,r,s)}const Lg={get:mr(!1,!1)},Mg={get:mr(!1,!0)},Ng={get:mr(!0,!1)},Dg={get:mr(!0,!0)},uc=new WeakMap,fc=new WeakMap,dc=new WeakMap,hc=new WeakMap;function jg(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Ug(t){return t.__v_skip||!Object.isExtensible(t)?0:jg(dg(t))}function uo(t){return Qt(t)?t:yr(t,!1,Cg,Lg,uc)}function Bg(t){return yr(t,!1,Ig,Mg,fc)}function fo(t){return yr(t,!0,Rg,Ng,dc)}function Uw(t){return yr(t,!0,Ag,Dg,hc)}function yr(t,e,i,n,r){if(!ye(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=Ug(t);if(s===0)return t;const o=r.get(t);if(o)return o;const a=new Proxy(t,s===2?n:i);return r.set(t,a),a}function Ri(t){return Qt(t)?Ri(t.__v_raw):!!(t&&t.__v_isReactive)}function Qt(t){return!!(t&&t.__v_isReadonly)}function lt(t){return!!(t&&t.__v_isShallow)}function ho(t){return t?!!t.__v_raw:!1}function ie(t){const e=t&&t.__v_raw;return e?ie(e):t}function Fg(t){return!se(t,"__v_skip")&&Object.isExtensible(t)&&Kl(t,"__v_skip",!0),t}const Oe=t=>ye(t)?uo(t):t,br=t=>ye(t)?fo(t):t;function Ie(t){return t?t.__v_isRef===!0:!1}function Ue(t){return gc(t,!1)}function pc(t){return gc(t,!0)}function gc(t,e){return Ie(t)?t:new qg(t,e)}class qg{constructor(e,i){this.dep=new dr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=i?e:ie(e),this._value=i?e:Oe(e),this.__v_isShallow=i}get value(){return this.dep.track(),this._value}set value(e){const i=this._rawValue,n=this.__v_isShallow||lt(e)||Qt(e);e=n?e:ie(e),Ve(e,i)&&(this._rawValue=e,this._value=n?e:Oe(e),this.dep.trigger())}}function Pe(t){return Ie(t)?t.value:t}const Hg={get:(t,e,i)=>e==="__v_raw"?t:Pe(Reflect.get(t,e,i)),set:(t,e,i,n)=>{const r=t[e];return Ie(r)&&!Ie(i)?(r.value=i,!0):Reflect.set(t,e,i,n)}};function mc(t){return Ri(t)?t:new Proxy(t,Hg)}class zg{constructor(e){this.__v_isRef=!0,this._value=void 0;const i=this.dep=new dr,{get:n,set:r}=e(i.track.bind(i),i.trigger.bind(i));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}}function Kg(t){return new zg(t)}class Wg{constructor(e,i,n){this.fn=e,this.setter=i,this._value=void 0,this.dep=new dr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=fn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!i,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&fe!==this)return Jl(this,!0),!0}get value(){const e=this.dep.track();return tc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Gg(t,e,i=!1){let n,r;return Q(t)?n=t:(n=t.get,r=t.set),new Wg(n,r,i)}const vr={},wr=new WeakMap;let ci;function Vg(t,e=!1,i=ci){if(i){let n=wr.get(i);n||wr.set(i,n=[]),n.push(t)}}function Yg(t,e,i=ne){const{immediate:n,deep:r,once:s,scheduler:o,augmentJob:a,call:l}=i,c=y=>r?y:lt(y)||r===!1||r===0?Ft(y,1):Ft(y);let u,f,h,p,d=!1,w=!1;if(Ie(t)?(f=()=>t.value,d=lt(t)):Ri(t)?(f=()=>c(t),d=!0):Y(t)?(w=!0,d=t.some(y=>Ri(y)||lt(y)),f=()=>t.map(y=>{if(Ie(y))return y.value;if(Ri(y))return c(y);if(Q(y))return l?l(y,2):y()})):Q(t)?e?f=l?()=>l(t,2):t:f=()=>{if(h){kt();try{h()}finally{$t()}}const y=ci;ci=u;try{return l?l(t,3,[p]):t(p)}finally{ci=y}}:f=St,e&&r){const y=f,v=r===!0?1/0:r;f=()=>Ft(y(),v)}const S=_g(),E=()=>{u.stop(),S&&S.active&&Vs(S.effects,u)};if(s&&e){const y=e;e=(...v)=>{y(...v),E()}}let M=w?new Array(t.length).fill(vr):vr;const g=y=>{if(!(!(u.flags&1)||!u.dirty&&!y))if(e){const v=u.run();if(r||d||(w?v.some((x,P)=>Ve(x,M[P])):Ve(v,M))){h&&h();const x=ci;ci=u;try{const P=[v,M===vr?void 0:w&&M[0]===vr?[]:M,p];M=v,l?l(e,3,P):e(...P)}finally{ci=x}}}else u.run()};return a&&a(g),u=new Ql(f),u.scheduler=o?()=>o(g,!1):g,p=y=>Vg(y,!1,u),h=u.onStop=()=>{const y=wr.get(u);if(y){if(l)l(y,4);else for(const v of y)v();wr.delete(u)}},e?n?g(!0):M=u.run():o?o(g.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Ft(t,e=1/0,i){if(e<=0||!ye(t)||t.__v_skip||(i=i||new Map,(i.get(t)||0)>=e))return t;if(i.set(t,e),e--,Ie(t))Ft(t.value,e,i);else if(Y(t))for(let n=0;n<t.length;n++)Ft(t[n],e,i);else if(Bl(t)||Pi(t))t.forEach(n=>{Ft(n,e,i)});else if(Hl(t)){for(const n in t)Ft(t[n],e,i);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Ft(t[n],e,i)}return t}const pn=[];let po=!1;function Bw(t,...e){if(po)return;po=!0,kt();const i=pn.length?pn[pn.length-1].component:null,n=i&&i.appContext.config.warnHandler,r=Qg();if(n)Ii(n,i,11,[t+e.map(s=>{var o,a;return(a=(o=s.toString)==null?void 0:o.call(s))!=null?a:JSON.stringify(s)}).join(""),i&&i.proxy,r.map(({vnode:s})=>`at <${du(i,s.type)}>`).join(`
22
22
  `),r]);else{const s=[`[Vue warn]: ${t}`,...e];r.length&&s.push(`
23
23
  `,...Xg(r))}$t(),po=!1}function Qg(){let t=pn[pn.length-1];if(!t)return[];const e=[];for(;t;){const i=e[0];i&&i.vnode===t?i.recurseCount++:e.push({vnode:t,recurseCount:0});const n=t.component&&t.component.parent;t=n&&n.vnode}return e}function Xg(t){const e=[];return t.forEach((i,n)=>{e.push(...n===0?[]:[`
24
- `],...Jg(i))}),e}function Jg({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",n=t.component?t.component.parent==null:!1,r=` at <${du(t.component,t.type,n)}`,s=">"+i;return t.props?[r,...Zg(t.props),s]:[r+s]}function Zg(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(n=>{e.push(...yc(n,t[n]))}),i.length>3&&e.push(" ..."),e}function yc(t,e,i){return _e(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:Ie(e)?(e=yc(t,ie(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):Q(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=ie(e),i?e:[`${t}=`,e])}function Ii(t,e,i,n){try{return n?t(...n):t()}catch(r){gn(r,e,i)}}function Et(t,e,i,n){if(Q(t)){const r=Ii(t,e,i,n);return r&&Fl(r)&&r.catch(s=>{gn(s,e,i)}),r}if(Y(t)){const r=[];for(let s=0;s<t.length;s++)r.push(Et(t[s],e,i,n));return r}}function gn(t,e,i,n=!0){const r=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ne;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){kt(),Ii(s,null,10,[t,l,c]),$t();return}}em(t,i,r,n,o)}function em(t,e,i,n=!0,r=!1){if(r)throw t}const Be=[];let Pt=-1;const Ai=[];let Xt=null,Oi=0;const bc=Promise.resolve();let _r=null;function mn(t){const e=_r||bc;return t?e.then(this?t.bind(this):t):e}function tm(t){let e=Pt+1,i=Be.length;for(;e<i;){const n=e+i>>>1,r=Be[n],s=yn(r);s<t||s===t&&r.flags&2?e=n+1:i=n}return e}function go(t){if(!(t.flags&1)){const e=yn(t),i=Be[Be.length-1];!i||!(t.flags&2)&&e>=yn(i)?Be.push(t):Be.splice(tm(e),0,t),t.flags|=1,vc()}}function vc(){_r||(_r=bc.then(xc))}function im(t){Y(t)?Ai.push(...t):Xt&&t.id===-1?Xt.splice(Oi+1,0,t):t.flags&1||(Ai.push(t),t.flags|=1),vc()}function wc(t,e,i=Pt+1){for(;i<Be.length;i++){const n=Be[i];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Be.splice(i,1),i--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function _c(t){if(Ai.length){const e=[...new Set(Ai)].sort((i,n)=>yn(i)-yn(n));if(Ai.length=0,Xt){Xt.push(...e);return}for(Xt=e,Oi=0;Oi<Xt.length;Oi++){const i=Xt[Oi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}Xt=null,Oi=0}}const yn=t=>t.id==null?t.flags&2?-1:1/0:t.id;function xc(t){try{for(Pt=0;Pt<Be.length;Pt++){const e=Be[Pt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ii(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Pt<Be.length;Pt++){const e=Be[Pt];e&&(e.flags&=-2)}Pt=-1,Be.length=0,_c(),_r=null,(Be.length||Ai.length)&&xc()}}let Ne=null,Sc=null;function xr(t){const e=Ne;return Ne=t,Sc=t&&t.type.__scopeId||null,e}function bn(t,e=Ne,i){if(!e||t._n)return t;const n=(...r)=>{n._d&&ru(-1);const s=xr(e);let o;try{o=t(...r)}finally{xr(s),n._d&&ru(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function kc(t,e){if(Ne===null)return t;const i=Tr(Ne),n=t.dirs||(t.dirs=[]);for(let r=0;r<e.length;r++){let[s,o,a,l=ne]=e[r];s&&(Q(s)&&(s={mounted:s,updated:s}),s.deep&&Ft(o),n.push({dir:s,instance:i,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function ui(t,e,i,n){const r=t.dirs,s=e&&e.dirs;for(let o=0;o<r.length;o++){const a=r[o];s&&(a.oldValue=s[o].value);let l=a.dir[n];l&&(kt(),Et(l,i,8,[t.el,a,t,e]),$t())}}const nm=Symbol("_vte"),rm=t=>t.__isTeleport,sm=Symbol("_leaveCb");function mo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,mo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function fi(t,e){return Q(t)?Ae({name:t.name},e,{setup:t}):t}function yo(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function $c(t){const e=Lo(),i=pc(null);if(e){const r=e.refs===ne?e.refs={}:e.refs;Object.defineProperty(r,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const Sr=new WeakMap;function vn(t,e,i,n,r=!1){if(Y(t)){t.forEach((d,w)=>vn(d,e&&(Y(e)?e[w]:e),i,n,r));return}if(Ti(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&vn(t,e,i,n.component.subTree);return}const s=n.shapeFlag&4?Tr(n.component):n.el,o=r?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ne?a.refs={}:a.refs,f=a.setupState,h=ie(f),p=f===ne?Ul:d=>se(h,d);if(c!=null&&c!==l){if(Ec(e),_e(c))u[c]=null,p(c)&&(f[c]=null);else if(Ie(c)){c.value=null;const d=e;d.k&&(u[d.k]=null)}}if(Q(l))Ii(l,a,12,[o,u]);else{const d=_e(l),w=Ie(l);if(d||w){const S=()=>{if(t.f){const E=d?p(l)?f[l]:u[l]:l.value;if(r)Y(E)&&Vs(E,s);else if(Y(E))E.includes(s)||E.push(s);else if(d)u[l]=[s],p(l)&&(f[l]=u[l]);else{const M=[s];l.value=M,t.k&&(u[t.k]=M)}}else d?(u[l]=o,p(l)&&(f[l]=o)):w&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const E=()=>{S(),Sr.delete(t)};E.id=-1,Sr.set(t,E),tt(E,i)}else Ec(t),S()}}}function Ec(t){const e=Sr.get(t);e&&(e.flags|=8,Sr.delete(t))}const Pc=t=>t.nodeType===8;fr().requestIdleCallback,fr().cancelIdleCallback;function om(t,e){if(Pc(t)&&t.data==="["){let i=1,n=t.nextSibling;for(;n;){if(n.nodeType===1){if(e(n)===!1)break}else if(Pc(n))if(n.data==="]"){if(--i===0)break}else n.data==="["&&i++;n=n.nextSibling}}else e(t)}const Ti=t=>!!t.type.__asyncLoader;function am(t){Q(t)&&(t={loader:t});const{loader:e,loadingComponent:i,errorComponent:n,delay:r=200,hydrate:s,timeout:o,suspensible:a=!0,onError:l}=t;let c=null,u,f=0;const h=()=>(f++,c=null,p()),p=()=>{let d;return c||(d=c=e().catch(w=>{if(w=w instanceof Error?w:new Error(String(w)),l)return new Promise((S,E)=>{l(w,()=>S(h()),()=>E(w),f+1)});throw w}).then(w=>d!==c&&c?c:(w&&(w.__esModule||w[Symbol.toStringTag]==="Module")&&(w=w.default),u=w,w)))};return fi({name:"AsyncComponentWrapper",__asyncLoader:p,__asyncHydrate(d,w,S){let E=!1;(w.bu||(w.bu=[])).push(()=>E=!0);const M=()=>{E||S()},g=s?()=>{const y=s(M,v=>om(d,v));y&&(w.bum||(w.bum=[])).push(y)}:M;u?g():p().then(()=>!w.isUnmounted&&g())},get __asyncResolved(){return u},setup(){const d=De;if(yo(d),u)return()=>kr(u,d);const w=g=>{c=null,gn(g,d,13,!n)};if(a&&d.suspense||Di)return p().then(g=>()=>kr(g,d)).catch(g=>(w(g),()=>n?Ce(n,{error:g}):null));const S=Ue(!1),E=Ue(),M=Ue(!!r);return r&&setTimeout(()=>{M.value=!1},r),o!=null&&setTimeout(()=>{if(!S.value&&!E.value){const g=new Error(`Async component timed out after ${o}ms.`);w(g),E.value=g}},o),p().then(()=>{S.value=!0,d.parent&&bo(d.parent.vnode)&&d.parent.update()}).catch(g=>{w(g),E.value=g}),()=>{if(S.value&&u)return kr(u,d);if(E.value&&n)return Ce(n,{error:E.value});if(i&&!M.value)return kr(i,d)}}})}function kr(t,e){const{ref:i,props:n,children:r,ce:s}=e.vnode,o=Ce(t,n,r);return o.ref=i,o.ce=s,delete e.vnode.ce,o}const bo=t=>t.type.__isKeepAlive;function lm(t,e){Cc(t,"a",e)}function cm(t,e){Cc(t,"da",e)}function Cc(t,e,i=De){const n=t.__wdc||(t.__wdc=()=>{let r=i;for(;r;){if(r.isDeactivated)return;r=r.parent}return t()});if($r(e,n,i),i){let r=i.parent;for(;r&&r.parent;)bo(r.parent.vnode)&&um(n,e,i,r),r=r.parent}}function um(t,e,i,n){const r=$r(e,t,n,!0);wo(()=>{Vs(n[e],r)},i)}function $r(t,e,i=De,n=!1){if(i){const r=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{kt();const a=Cn(i),l=Et(e,i,t,o);return a(),$t(),l});return n?r.unshift(s):r.push(s),s}}const qt=t=>(e,i=De)=>{(!Di||t==="sp")&&$r(t,(...n)=>e(...n),i)},Rc=qt("bm"),wn=qt("m"),fm=qt("bu"),dm=qt("u"),vo=qt("bum"),wo=qt("um"),hm=qt("sp"),pm=qt("rtg"),gm=qt("rtc");function mm(t,e=De){$r("ec",t,e)}const ym=Symbol.for("v-ndc");function _o(t,e,i,n){let r;const s=i,o=Y(t);if(o||_e(t)){const a=o&&Ri(t);let l=!1,c=!1;a&&(l=!lt(t),c=Qt(t),t=hr(t)),r=new Array(t.length);for(let u=0,f=t.length;u<f;u++)r[u]=e(l?c?br(Oe(t[u])):Oe(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){r=new Array(t);for(let a=0;a<t;a++)r[a]=e(a+1,a,void 0,s)}else if(ye(t))if(t[Symbol.iterator])r=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);r=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];r[l]=e(t[u],u,l,s)}}else r=[];return r}function bm(t,e,i={},n,r){if(Ne.ce||Ne.parent&&Ti(Ne.parent)&&Ne.parent.ce){const c=Object.keys(i).length>0;return oe(),Ir(qe,null,[Ce("slot",i,n)],c?-2:64)}let s=t[e];s&&s._c&&(s._d=!1),oe();const o=s&&Ic(s(i)),a=i.key||o&&o.key,l=Ir(qe,{key:(a&&!Dt(a)?a:`_${e}`)+(!o&&n?"_fb":"")},o||[],o&&t._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),s&&s._c&&(s._d=!0),l}function Ic(t){return t.some(e=>Oo(e)?!(e.type===Ht||e.type===qe&&!Ic(e.children)):!0)?t:null}const xo=t=>t?cu(t)?Tr(t):xo(t.parent):null,_n=Ae(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>xo(t.parent),$root:t=>xo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Lc(t),$forceUpdate:t=>t.f||(t.f=()=>{go(t.update)}),$nextTick:t=>t.n||(t.n=mn.bind(t.proxy)),$watch:t=>Bm.bind(t)}),So=(t,e)=>t!==ne&&!t.__isScriptSetup&&se(t,e),vm={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:n,data:r,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const p=o[e];if(p!==void 0)switch(p){case 1:return n[e];case 2:return r[e];case 4:return i[e];case 3:return s[e]}else{if(So(n,e))return o[e]=1,n[e];if(r!==ne&&se(r,e))return o[e]=2,r[e];if((c=t.propsOptions[0])&&se(c,e))return o[e]=3,s[e];if(i!==ne&&se(i,e))return o[e]=4,i[e];ko&&(o[e]=0)}}const u=_n[e];let f,h;if(u)return e==="$attrs"&&Me(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(i!==ne&&se(i,e))return o[e]=4,i[e];if(h=l.config.globalProperties,se(h,e))return h[e]},set({_:t},e,i){const{data:n,setupState:r,ctx:s}=t;return So(r,e)?(r[e]=i,!0):n!==ne&&se(n,e)?(n[e]=i,!0):se(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:n,appContext:r,propsOptions:s,type:o}},a){let l,c;return!!(i[a]||t!==ne&&a[0]!=="$"&&se(t,a)||So(e,a)||(l=s[0])&&se(l,a)||se(n,a)||se(_n,a)||se(r.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:se(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function Er(t){return Y(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function Ac(t,e){return!t||!e?t||e:Y(t)&&Y(e)?t.concat(e):Ae({},Er(t),Er(e))}let ko=!0;function wm(t){const e=Lc(t),i=t.proxy,n=t.ctx;ko=!1,e.beforeCreate&&Oc(e.beforeCreate,t,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:h,beforeUpdate:p,updated:d,activated:w,deactivated:S,beforeDestroy:E,beforeUnmount:M,destroyed:g,unmounted:y,render:v,renderTracked:x,renderTriggered:P,errorCaptured:L,serverPrefetch:C,expose:U,inheritAttrs:H,components:He,directives:dt,filters:Ki}=e;if(c&&_m(c,n,null),o)for(const me in o){const pe=o[me];Q(pe)&&(n[me]=pe.bind(i))}if(r){const me=r.call(i,i);ye(me)&&(t.data=uo(me))}if(ko=!0,s)for(const me in s){const pe=s[me],bi=Q(pe)?pe.bind(i,i):Q(pe.get)?pe.get.bind(i,i):St,ts=!Q(pe)&&Q(pe.set)?pe.set.bind(i):St,vi=It({get:bi,set:ts});Object.defineProperty(n,me,{enumerable:!0,configurable:!0,get:()=>vi.value,set:At=>vi.value=At})}if(a)for(const me in a)Tc(a[me],n,i,me);if(l){const me=Q(l)?l.call(i):l;Reflect.ownKeys(me).forEach(pe=>{jc(pe,me[pe])})}u&&Oc(u,t,"c");function ce(me,pe){Y(pe)?pe.forEach(bi=>me(bi.bind(i))):pe&&me(pe.bind(i))}if(ce(Rc,f),ce(wn,h),ce(fm,p),ce(dm,d),ce(lm,w),ce(cm,S),ce(mm,L),ce(gm,x),ce(pm,P),ce(vo,M),ce(wo,y),ce(hm,C),Y(U))if(U.length){const me=t.exposed||(t.exposed={});U.forEach(pe=>{Object.defineProperty(me,pe,{get:()=>i[pe],set:bi=>i[pe]=bi,enumerable:!0})})}else t.exposed||(t.exposed={});v&&t.render===St&&(t.render=v),H!=null&&(t.inheritAttrs=H),He&&(t.components=He),dt&&(t.directives=dt),C&&yo(t)}function _m(t,e,i=St){Y(t)&&(t=$o(t));for(const n in t){const r=t[n];let s;ye(r)?"default"in r?s=Sn(r.from||n,r.default,!0):s=Sn(r.from||n):s=Sn(r),Ie(s)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[n]=s}}function Oc(t,e,i){Et(Y(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,i)}function Tc(t,e,i,n){let r=n.includes(".")?Xc(i,n):()=>i[n];if(_e(t)){const s=e[t];Q(s)&&Mi(r,s)}else if(Q(t))Mi(r,t.bind(i));else if(ye(t))if(Y(t))t.forEach(s=>Tc(s,e,i,n));else{const s=Q(t.handler)?t.handler.bind(i):e[t.handler];Q(s)&&Mi(r,s,t)}}function Lc(t){const e=t.type,{mixins:i,extends:n}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!r.length&&!i&&!n?l=e:(l={},r.length&&r.forEach(c=>Pr(l,c,o,!0)),Pr(l,e,o)),ye(e)&&s.set(e,l),l}function Pr(t,e,i,n=!1){const{mixins:r,extends:s}=e;s&&Pr(t,s,i,!0),r&&r.forEach(o=>Pr(t,o,i,!0));for(const o in e)if(!(n&&o==="expose")){const a=xm[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const xm={data:Mc,props:Nc,emits:Nc,methods:xn,computed:xn,beforeCreate:Fe,created:Fe,beforeMount:Fe,mounted:Fe,beforeUpdate:Fe,updated:Fe,beforeDestroy:Fe,beforeUnmount:Fe,destroyed:Fe,unmounted:Fe,activated:Fe,deactivated:Fe,errorCaptured:Fe,serverPrefetch:Fe,components:xn,directives:xn,watch:km,provide:Mc,inject:Sm};function Mc(t,e){return e?t?function(){return Ae(Q(t)?t.call(this,this):t,Q(e)?e.call(this,this):e)}:e:t}function Sm(t,e){return xn($o(t),$o(e))}function $o(t){if(Y(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Fe(t,e){return t?[...new Set([].concat(t,e))]:e}function xn(t,e){return t?Ae(Object.create(null),t,e):e}function Nc(t,e){return t?Y(t)&&Y(e)?[...new Set([...t,...e])]:Ae(Object.create(null),Er(t),Er(e??{})):e}function km(t,e){if(!t)return e;if(!e)return t;const i=Ae(Object.create(null),t);for(const n in e)i[n]=Fe(t[n],e[n]);return i}function Dc(){return{app:null,config:{isNativeTag:Ul,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let $m=0;function Em(t,e){return function(n,r=null){Q(n)||(n=Ae({},n)),r!=null&&!ye(r)&&(r=null);const s=Dc(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:$m++,_component:n,_props:r,_container:null,_context:s,_instance:null,version:ly,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&Q(u.install)?(o.add(u),u.install(c,...f)):Q(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,h){if(!l){const p=c._ceVNode||Ce(n,r);return p.appContext=s,h===!0?h="svg":h===!1&&(h=void 0),t(p,u,h),l=!0,c._container=u,u.__vue_app__=c,Tr(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Et(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=Li;Li=c;try{return u()}finally{Li=f}}};return c}}let Li=null;function jc(t,e){if(De){let i=De.provides;const n=De.parent&&De.parent.provides;n===i&&(i=De.provides=Object.create(n)),i[t]=e}}function Sn(t,e,i=!1){const n=Lo();if(n||Li){let r=Li?Li._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&t in r)return r[t];if(arguments.length>1)return i&&Q(e)?e.call(n&&n.proxy):e}}const Uc={},Bc=()=>Object.create(Uc),Fc=t=>Object.getPrototypeOf(t)===Uc;function Pm(t,e,i,n=!1){const r={},s=Bc();t.propsDefaults=Object.create(null),qc(t,e,r,s);for(const o in t.propsOptions[0])o in r||(r[o]=void 0);i?t.props=n?r:Bg(r):t.type.props?t.props=r:t.props=s,t.attrs=s}function Cm(t,e,i,n){const{props:r,attrs:s,vnode:{patchFlag:o}}=t,a=ie(r),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(Cr(t.emitsOptions,h))continue;const p=e[h];if(l)if(se(s,h))p!==s[h]&&(s[h]=p,c=!0);else{const d=jt(h);r[d]=Eo(l,a,d,p,t,!1)}else p!==s[h]&&(s[h]=p,c=!0)}}}else{qc(t,e,r,s)&&(c=!0);let u;for(const f in a)(!e||!se(e,f)&&((u=Yt(f))===f||!se(e,u)))&&(l?i&&(i[f]!==void 0||i[u]!==void 0)&&(r[f]=Eo(l,a,f,void 0,t,!0)):delete r[f]);if(s!==a)for(const f in s)(!e||!se(e,f))&&(delete s[f],c=!0)}c&&Ut(t.attrs,"set","")}function qc(t,e,i,n){const[r,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(ln(l))continue;const c=e[l];let u;r&&se(r,u=jt(l))?!s||!s.includes(u)?i[u]=c:(a||(a={}))[u]=c:Cr(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(s){const l=ie(i),c=a||ne;for(let u=0;u<s.length;u++){const f=s[u];i[f]=Eo(r,l,f,c[f],t,!se(c,f))}}return o}function Eo(t,e,i,n,r,s){const o=t[i];if(o!=null){const a=se(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Q(l)){const{propsDefaults:c}=r;if(i in c)n=c[i];else{const u=Cn(r);n=c[i]=l.call(null,e),u()}}else n=l;r.ce&&r.ce._setProp(i,n)}o[0]&&(s&&!a?n=!1:o[1]&&(n===""||n===Yt(i))&&(n=!0))}return n}const Rm=new WeakMap;function Hc(t,e,i=!1){const n=i?Rm:e.propsCache,r=n.get(t);if(r)return r;const s=t.props,o={},a=[];let l=!1;if(!Q(t)){const u=f=>{l=!0;const[h,p]=Hc(f,e,!0);Ae(o,h),p&&a.push(...p)};!i&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return ye(t)&&n.set(t,Ei),Ei;if(Y(s))for(let u=0;u<s.length;u++){const f=jt(s[u]);zc(f)&&(o[f]=ne)}else if(s)for(const u in s){const f=jt(u);if(zc(f)){const h=s[u],p=o[f]=Y(h)||Q(h)?{type:h}:Ae({},h),d=p.type;let w=!1,S=!0;if(Y(d))for(let E=0;E<d.length;++E){const M=d[E],g=Q(M)&&M.name;if(g==="Boolean"){w=!0;break}else g==="String"&&(S=!1)}else w=Q(d)&&d.name==="Boolean";p[0]=w,p[1]=S,(w||se(p,"default"))&&a.push(f)}}const c=[o,a];return ye(t)&&n.set(t,c),c}function zc(t){return t[0]!=="$"&&!ln(t)}const Po=t=>t==="_"||t==="_ctx"||t==="$stable",Co=t=>Y(t)?t.map(Ct):[Ct(t)],Im=(t,e,i)=>{if(e._n)return e;const n=bn((...r)=>Co(e(...r)),i);return n._c=!1,n},Kc=(t,e,i)=>{const n=t._ctx;for(const r in t){if(Po(r))continue;const s=t[r];if(Q(s))e[r]=Im(r,s,n);else if(s!=null){const o=Co(s);e[r]=()=>o}}},Wc=(t,e)=>{const i=Co(e);t.slots.default=()=>i},Gc=(t,e,i)=>{for(const n in e)(i||!Po(n))&&(t[n]=e[n])},Am=(t,e,i)=>{const n=t.slots=Bc();if(t.vnode.shapeFlag&32){const r=e._;r?(Gc(n,e,i),i&&Kl(n,"_",r,!0)):Kc(e,n)}else e&&Wc(t,e)},Om=(t,e,i)=>{const{vnode:n,slots:r}=t;let s=!0,o=ne;if(n.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Gc(r,e,i):(s=!e.$stable,Kc(e,r)),o=e}else e&&(Wc(t,e),o={default:1});if(s)for(const a in r)!Po(a)&&o[a]==null&&delete r[a]},tt=Gm;function Tm(t){return Lm(t)}function Lm(t,e){const i=fr();i.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:h,setScopeId:p=St,insertStaticContent:d}=t,w=(b,_,k,T=null,I=null,A=null,B=void 0,j=null,N=!!_.dynamicChildren)=>{if(b===_)return;b&&!En(b,_)&&(T=is(b),At(b,I,A,!0),b=null),_.patchFlag===-2&&(N=!1,_.dynamicChildren=null);const{type:O,ref:K,shapeFlag:q}=_;switch(O){case Rr:S(b,_,k,T);break;case Ht:E(b,_,k,T);break;case Ao:b==null&&M(_,k,T,B);break;case qe:He(b,_,k,T,I,A,B,j,N);break;default:q&1?v(b,_,k,T,I,A,B,j,N):q&6?dt(b,_,k,T,I,A,B,j,N):(q&64||q&128)&&O.process(b,_,k,T,I,A,B,j,N,jn)}K!=null&&I?vn(K,b&&b.ref,A,_||b,!_):K==null&&b&&b.ref!=null&&vn(b.ref,null,A,b,!0)},S=(b,_,k,T)=>{if(b==null)n(_.el=a(_.children),k,T);else{const I=_.el=b.el;_.children!==b.children&&c(I,_.children)}},E=(b,_,k,T)=>{b==null?n(_.el=l(_.children||""),k,T):_.el=b.el},M=(b,_,k,T)=>{[b.el,b.anchor]=d(b.children,_,k,T,b.el,b.anchor)},g=({el:b,anchor:_},k,T)=>{let I;for(;b&&b!==_;)I=h(b),n(b,k,T),b=I;n(_,k,T)},y=({el:b,anchor:_})=>{let k;for(;b&&b!==_;)k=h(b),r(b),b=k;r(_)},v=(b,_,k,T,I,A,B,j,N)=>{if(_.type==="svg"?B="svg":_.type==="math"&&(B="mathml"),b==null)x(_,k,T,I,A,B,j,N);else{const O=b.el&&b.el._isVueCE?b.el:null;try{O&&O._beginPatch(),C(b,_,I,A,B,j,N)}finally{O&&O._endPatch()}}},x=(b,_,k,T,I,A,B,j)=>{let N,O;const{props:K,shapeFlag:q,transition:z,dirs:X}=b;if(N=b.el=o(b.type,A,K&&K.is,K),q&8?u(N,b.children):q&16&&L(b.children,N,null,T,I,Ro(b,A),B,j),X&&ui(b,null,T,"created"),P(N,b,b.scopeId,B,T),K){for(const ge in K)ge!=="value"&&!ln(ge)&&s(N,ge,null,K[ge],A,T);"value"in K&&s(N,"value",null,K.value,A),(O=K.onVnodeBeforeMount)&&Rt(O,T,b)}X&&ui(b,null,T,"beforeMount");const te=Mm(I,z);te&&z.beforeEnter(N),n(N,_,k),((O=K&&K.onVnodeMounted)||te||X)&&tt(()=>{O&&Rt(O,T,b),te&&z.enter(N),X&&ui(b,null,T,"mounted")},I)},P=(b,_,k,T,I)=>{if(k&&p(b,k),T)for(let A=0;A<T.length;A++)p(b,T[A]);if(I){let A=I.subTree;if(_===A||nu(A.type)&&(A.ssContent===_||A.ssFallback===_)){const B=I.vnode;P(b,B,B.scopeId,B.slotScopeIds,I.parent)}}},L=(b,_,k,T,I,A,B,j,N=0)=>{for(let O=N;O<b.length;O++){const K=b[O]=j?Zt(b[O]):Ct(b[O]);w(null,K,_,k,T,I,A,B,j)}},C=(b,_,k,T,I,A,B)=>{const j=_.el=b.el;let{patchFlag:N,dynamicChildren:O,dirs:K}=_;N|=b.patchFlag&16;const q=b.props||ne,z=_.props||ne;let X;if(k&&di(k,!1),(X=z.onVnodeBeforeUpdate)&&Rt(X,k,_,b),K&&ui(_,b,k,"beforeUpdate"),k&&di(k,!0),(q.innerHTML&&z.innerHTML==null||q.textContent&&z.textContent==null)&&u(j,""),O?U(b.dynamicChildren,O,j,k,T,Ro(_,I),A):B||pe(b,_,j,null,k,T,Ro(_,I),A,!1),N>0){if(N&16)H(j,q,z,k,I);else if(N&2&&q.class!==z.class&&s(j,"class",null,z.class,I),N&4&&s(j,"style",q.style,z.style,I),N&8){const te=_.dynamicProps;for(let ge=0;ge<te.length;ge++){const le=te[ge],Xe=q[le],Je=z[le];(Je!==Xe||le==="value")&&s(j,le,Xe,Je,I,k)}}N&1&&b.children!==_.children&&u(j,_.children)}else!B&&O==null&&H(j,q,z,k,I);((X=z.onVnodeUpdated)||K)&&tt(()=>{X&&Rt(X,k,_,b),K&&ui(_,b,k,"updated")},T)},U=(b,_,k,T,I,A,B)=>{for(let j=0;j<_.length;j++){const N=b[j],O=_[j],K=N.el&&(N.type===qe||!En(N,O)||N.shapeFlag&198)?f(N.el):k;w(N,O,K,null,T,I,A,B,!0)}},H=(b,_,k,T,I)=>{if(_!==k){if(_!==ne)for(const A in _)!ln(A)&&!(A in k)&&s(b,A,_[A],null,I,T);for(const A in k){if(ln(A))continue;const B=k[A],j=_[A];B!==j&&A!=="value"&&s(b,A,j,B,I,T)}"value"in k&&s(b,"value",_.value,k.value,I)}},He=(b,_,k,T,I,A,B,j,N)=>{const O=_.el=b?b.el:a(""),K=_.anchor=b?b.anchor:a("");let{patchFlag:q,dynamicChildren:z,slotScopeIds:X}=_;X&&(j=j?j.concat(X):X),b==null?(n(O,k,T),n(K,k,T),L(_.children||[],k,K,I,A,B,j,N)):q>0&&q&64&&z&&b.dynamicChildren?(U(b.dynamicChildren,z,k,I,A,B,j),(_.key!=null||I&&_===I.subTree)&&Vc(b,_,!0)):pe(b,_,k,K,I,A,B,j,N)},dt=(b,_,k,T,I,A,B,j,N)=>{_.slotScopeIds=j,b==null?_.shapeFlag&512?I.ctx.activate(_,k,T,B,N):Ki(_,k,T,I,A,B,N):ke(b,_,N)},Ki=(b,_,k,T,I,A,B)=>{const j=b.component=Zm(b,T,I);if(bo(b)&&(j.ctx.renderer=jn),ey(j,!1,B),j.asyncDep){if(I&&I.registerDep(j,ce,B),!b.el){const N=j.subTree=Ce(Ht);E(null,N,_,k),b.placeholder=N.el}}else ce(j,b,_,k,I,A,B)},ke=(b,_,k)=>{const T=_.component=b.component;if(Km(b,_,k))if(T.asyncDep&&!T.asyncResolved){me(T,_,k);return}else T.next=_,T.update();else _.el=b.el,T.vnode=_},ce=(b,_,k,T,I,A,B)=>{const j=()=>{if(b.isMounted){let{next:q,bu:z,u:X,parent:te,vnode:ge}=b;{const Tt=Yc(b);if(Tt){q&&(q.el=ge.el,me(b,q,B)),Tt.asyncDep.then(()=>{b.isUnmounted||j()});return}}let le=q,Xe;di(b,!1),q?(q.el=ge.el,me(b,q,B)):q=ge,z&&ur(z),(Xe=q.props&&q.props.onVnodeBeforeUpdate)&&Rt(Xe,te,q,ge),di(b,!0);const Je=tu(b),Ot=b.subTree;b.subTree=Je,w(Ot,Je,f(Ot.el),is(Ot),b,I,A),q.el=Je.el,le===null&&Wm(b,Je.el),X&&tt(X,I),(Xe=q.props&&q.props.onVnodeUpdated)&&tt(()=>Rt(Xe,te,q,ge),I)}else{let q;const{el:z,props:X}=_,{bm:te,m:ge,parent:le,root:Xe,type:Je}=b,Ot=Ti(_);di(b,!1),te&&ur(te),!Ot&&(q=X&&X.onVnodeBeforeMount)&&Rt(q,le,_),di(b,!0);{Xe.ce&&Xe.ce._def.shadowRoot!==!1&&Xe.ce._injectChildStyle(Je);const Tt=b.subTree=tu(b);w(null,Tt,k,T,b,I,A),_.el=Tt.el}if(ge&&tt(ge,I),!Ot&&(q=X&&X.onVnodeMounted)){const Tt=_;tt(()=>Rt(q,le,Tt),I)}(_.shapeFlag&256||le&&Ti(le.vnode)&&le.vnode.shapeFlag&256)&&b.a&&tt(b.a,I),b.isMounted=!0,_=k=T=null}};b.scope.on();const N=b.effect=new Ql(j);b.scope.off();const O=b.update=N.run.bind(N),K=b.job=N.runIfDirty.bind(N);K.i=b,K.id=b.uid,N.scheduler=()=>go(K),di(b,!0),O()},me=(b,_,k)=>{_.component=b;const T=b.vnode.props;b.vnode=_,b.next=null,Cm(b,_.props,T,k),Om(b,_.children,k),kt(),wc(b),$t()},pe=(b,_,k,T,I,A,B,j,N=!1)=>{const O=b&&b.children,K=b?b.shapeFlag:0,q=_.children,{patchFlag:z,shapeFlag:X}=_;if(z>0){if(z&128){ts(O,q,k,T,I,A,B,j,N);return}else if(z&256){bi(O,q,k,T,I,A,B,j,N);return}}X&8?(K&16&&Dn(O,I,A),q!==O&&u(k,q)):K&16?X&16?ts(O,q,k,T,I,A,B,j,N):Dn(O,I,A,!0):(K&8&&u(k,""),X&16&&L(q,k,T,I,A,B,j,N))},bi=(b,_,k,T,I,A,B,j,N)=>{b=b||Ei,_=_||Ei;const O=b.length,K=_.length,q=Math.min(O,K);let z;for(z=0;z<q;z++){const X=_[z]=N?Zt(_[z]):Ct(_[z]);w(b[z],X,k,null,I,A,B,j,N)}O>K?Dn(b,I,A,!0,!1,q):L(_,k,T,I,A,B,j,N,q)},ts=(b,_,k,T,I,A,B,j,N)=>{let O=0;const K=_.length;let q=b.length-1,z=K-1;for(;O<=q&&O<=z;){const X=b[O],te=_[O]=N?Zt(_[O]):Ct(_[O]);if(En(X,te))w(X,te,k,null,I,A,B,j,N);else break;O++}for(;O<=q&&O<=z;){const X=b[q],te=_[z]=N?Zt(_[z]):Ct(_[z]);if(En(X,te))w(X,te,k,null,I,A,B,j,N);else break;q--,z--}if(O>q){if(O<=z){const X=z+1,te=X<K?_[X].el:T;for(;O<=z;)w(null,_[O]=N?Zt(_[O]):Ct(_[O]),k,te,I,A,B,j,N),O++}}else if(O>z)for(;O<=q;)At(b[O],I,A,!0),O++;else{const X=O,te=O,ge=new Map;for(O=te;O<=z;O++){const st=_[O]=N?Zt(_[O]):Ct(_[O]);st.key!=null&&ge.set(st.key,O)}let le,Xe=0;const Je=z-te+1;let Ot=!1,Tt=0;const Un=new Array(Je);for(O=0;O<Je;O++)Un[O]=0;for(O=X;O<=q;O++){const st=b[O];if(Xe>=Je){At(st,I,A,!0);continue}let Lt;if(st.key!=null)Lt=ge.get(st.key);else for(le=te;le<=z;le++)if(Un[le-te]===0&&En(st,_[le])){Lt=le;break}Lt===void 0?At(st,I,A,!0):(Un[Lt-te]=O+1,Lt>=Tt?Tt=Lt:Ot=!0,w(st,_[Lt],k,null,I,A,B,j,N),Xe++)}const jf=Ot?Nm(Un):Ei;for(le=jf.length-1,O=Je-1;O>=0;O--){const st=te+O,Lt=_[st],Uf=_[st+1],Bf=st+1<K?Uf.el||Uf.placeholder:T;Un[O]===0?w(null,Lt,k,Bf,I,A,B,j,N):Ot&&(le<0||O!==jf[le]?vi(Lt,k,Bf,2):le--)}}},vi=(b,_,k,T,I=null)=>{const{el:A,type:B,transition:j,children:N,shapeFlag:O}=b;if(O&6){vi(b.component.subTree,_,k,T);return}if(O&128){b.suspense.move(_,k,T);return}if(O&64){B.move(b,_,k,jn);return}if(B===qe){n(A,_,k);for(let q=0;q<N.length;q++)vi(N[q],_,k,T);n(b.anchor,_,k);return}if(B===Ao){g(b,_,k);return}if(T!==2&&O&1&&j)if(T===0)j.beforeEnter(A),n(A,_,k),tt(()=>j.enter(A),I);else{const{leave:q,delayLeave:z,afterLeave:X}=j,te=()=>{b.ctx.isUnmounted?r(A):n(A,_,k)},ge=()=>{A._isLeaving&&A[sm](!0),q(A,()=>{te(),X&&X()})};z?z(A,te,ge):ge()}else n(A,_,k)},At=(b,_,k,T=!1,I=!1)=>{const{type:A,props:B,ref:j,children:N,dynamicChildren:O,shapeFlag:K,patchFlag:q,dirs:z,cacheIndex:X}=b;if(q===-2&&(I=!1),j!=null&&(kt(),vn(j,null,k,b,!0),$t()),X!=null&&(_.renderCache[X]=void 0),K&256){_.ctx.deactivate(b);return}const te=K&1&&z,ge=!Ti(b);let le;if(ge&&(le=B&&B.onVnodeBeforeUnmount)&&Rt(le,_,b),K&6)Lw(b.component,k,T);else{if(K&128){b.suspense.unmount(k,T);return}te&&ui(b,null,_,"beforeUnmount"),K&64?b.type.remove(b,_,k,jn,T):O&&!O.hasOnce&&(A!==qe||q>0&&q&64)?Dn(O,_,k,!1,!0):(A===qe&&q&384||!I&&K&16)&&Dn(N,_,k),T&&Nf(b)}(ge&&(le=B&&B.onVnodeUnmounted)||te)&&tt(()=>{le&&Rt(le,_,b),te&&ui(b,null,_,"unmounted")},k)},Nf=b=>{const{type:_,el:k,anchor:T,transition:I}=b;if(_===qe){Tw(k,T);return}if(_===Ao){y(b);return}const A=()=>{r(k),I&&!I.persisted&&I.afterLeave&&I.afterLeave()};if(b.shapeFlag&1&&I&&!I.persisted){const{leave:B,delayLeave:j}=I,N=()=>B(k,A);j?j(b.el,A,N):N()}else A()},Tw=(b,_)=>{let k;for(;b!==_;)k=h(b),r(b),b=k;r(_)},Lw=(b,_,k)=>{const{bum:T,scope:I,job:A,subTree:B,um:j,m:N,a:O}=b;Qc(N),Qc(O),T&&ur(T),I.stop(),A&&(A.flags|=8,At(B,b,_,k)),j&&tt(j,_),tt(()=>{b.isUnmounted=!0},_)},Dn=(b,_,k,T=!1,I=!1,A=0)=>{for(let B=A;B<b.length;B++)At(b[B],_,k,T,I)},is=b=>{if(b.shapeFlag&6)return is(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const _=h(b.anchor||b.el),k=_&&_[nm];return k?h(k):_};let fa=!1;const Df=(b,_,k)=>{b==null?_._vnode&&At(_._vnode,null,null,!0):w(_._vnode||null,b,_,null,null,null,k),_._vnode=b,fa||(fa=!0,wc(),_c(),fa=!1)},jn={p:w,um:At,m:vi,r:Nf,mt:Ki,mc:L,pc:pe,pbc:U,n:is,o:t};return{render:Df,hydrate:void 0,createApp:Em(Df)}}function Ro({type:t,props:e},i){return i==="svg"&&t==="foreignObject"||i==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:i}function di({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Mm(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Vc(t,e,i=!1){const n=t.children,r=e.children;if(Y(n)&&Y(r))for(let s=0;s<n.length;s++){const o=n[s];let a=r[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[s]=Zt(r[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Vc(o,a)),a.type===Rr&&a.patchFlag!==-1&&(a.el=o.el),a.type===Ht&&!a.el&&(a.el=o.el)}}function Nm(t){const e=t.slice(),i=[0];let n,r,s,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(r=i[i.length-1],t[r]<c){e[n]=r,i.push(n);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<c?s=a+1:o=a;c<t[i[s]]&&(s>0&&(e[n]=i[s-1]),i[s]=n)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function Yc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Yc(e)}function Qc(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const Dm=Symbol.for("v-scx"),jm=()=>Sn(Dm);function Um(t,e){return Io(t,null,{flush:"sync"})}function Mi(t,e,i){return Io(t,e,i)}function Io(t,e,i=ne){const{immediate:n,deep:r,flush:s,once:o}=i,a=Ae({},i),l=e&&n||!e&&s!=="post";let c;if(Di){if(s==="sync"){const p=jm();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=St,p.resume=St,p.pause=St,p}}const u=De;a.call=(p,d,w)=>Et(p,u,d,w);let f=!1;s==="post"?a.scheduler=p=>{tt(p,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(p,d)=>{d?p():go(p)}),a.augmentJob=p=>{e&&(p.flags|=4),f&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const h=Yg(t,e,a);return Di&&(c?c.push(h):l&&h()),h}function Bm(t,e,i){const n=this.proxy,r=_e(t)?t.includes(".")?Xc(n,t):()=>n[t]:t.bind(n,n);let s;Q(e)?s=e:(s=e.handler,i=e);const o=Cn(this),a=Io(r,s.bind(n),i);return o(),a}function Xc(t,e){const i=e.split(".");return()=>{let n=t;for(let r=0;r<i.length&&n;r++)n=n[i[r]];return n}}function Jc(t,e,i=ne){const n=Lo(),r=jt(e),s=Yt(e),o=Zc(t,r),a=Kg((l,c)=>{let u,f=ne,h;return Um(()=>{const p=t[r];Ve(u,p)&&(u=p,c())}),{get(){return l(),i.get?i.get(u):u},set(p){const d=i.set?i.set(p):p;if(!Ve(d,u)&&!(f!==ne&&Ve(p,f)))return;const w=n.vnode.props;w&&(e in w||r in w||s in w)&&(`onUpdate:${e}`in w||`onUpdate:${r}`in w||`onUpdate:${s}`in w)||(u=p,c()),n.emit(`update:${e}`,d),Ve(p,d)&&Ve(p,f)&&!Ve(d,h)&&c(),f=p,h=d}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||ne:a,done:!1}:{done:!0}}}},a}const Zc=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${jt(e)}Modifiers`]||t[`${Yt(e)}Modifiers`];function Fm(t,e,...i){if(t.isUnmounted)return;const n=t.vnode.props||ne;let r=i;const s=e.startsWith("update:"),o=s&&Zc(n,e.slice(7));o&&(o.trim&&(r=i.map(u=>_e(u)?u.trim():u)),o.number&&(r=i.map(Xs)));let a,l=n[a=Qs(e)]||n[a=Qs(jt(e))];!l&&s&&(l=n[a=Qs(Yt(e))]),l&&Et(l,t,6,r);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Et(c,t,6,r)}}const qm=new WeakMap;function eu(t,e,i=!1){const n=i?qm:e.emitsCache,r=n.get(t);if(r!==void 0)return r;const s=t.emits;let o={},a=!1;if(!Q(t)){const l=c=>{const u=eu(c,e,!0);u&&(a=!0,Ae(o,u))};!i&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(ye(t)&&n.set(t,null),null):(Y(s)?s.forEach(l=>o[l]=null):Ae(o,s),ye(t)&&n.set(t,o),o)}function Cr(t,e){return!t||!ar(e)?!1:(e=e.slice(2).replace(/Once$/,""),se(t,e[0].toLowerCase()+e.slice(1))||se(t,Yt(e))||se(t,e))}function Fw(){}function tu(t){const{type:e,vnode:i,proxy:n,withProxy:r,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:h,setupState:p,ctx:d,inheritAttrs:w}=t,S=xr(t);let E,M;try{if(i.shapeFlag&4){const y=r||n,v=y;E=Ct(c.call(v,y,u,f,p,h,d)),M=a}else{const y=e;E=Ct(y.length>1?y(f,{attrs:a,slots:o,emit:l}):y(f,null)),M=e.props?a:Hm(a)}}catch(y){kn.length=0,gn(y,t,1),E=Ce(Ht)}let g=E;if(M&&w!==!1){const y=Object.keys(M),{shapeFlag:v}=g;y.length&&v&7&&(s&&y.some(Gs)&&(M=zm(M,s)),g=Ni(g,M,!1,!0))}return i.dirs&&(g=Ni(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(i.dirs):i.dirs),i.transition&&mo(g,i.transition),E=g,xr(S),E}const Hm=t=>{let e;for(const i in t)(i==="class"||i==="style"||ar(i))&&((e||(e={}))[i]=t[i]);return e},zm=(t,e)=>{const i={};for(const n in t)(!Gs(n)||!(n.slice(9)in e))&&(i[n]=t[n]);return i};function Km(t,e,i){const{props:n,children:r,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&l>=0){if(l&1024)return!0;if(l&16)return n?iu(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(o[h]!==n[h]&&!Cr(c,h))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?iu(n,o,c):!0:!!o;return!1}function iu(t,e,i){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let r=0;r<n.length;r++){const s=n[r];if(e[s]!==t[s]&&!Cr(i,s))return!0}return!1}function Wm({vnode:t,parent:e},i){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.el=t.el),n===t)(t=e.vnode).el=i,e=e.parent;else break}}const nu=t=>t.__isSuspense;function Gm(t,e){e&&e.pendingBranch?Y(t)?e.effects.push(...t):e.effects.push(t):im(t)}const qe=Symbol.for("v-fgt"),Rr=Symbol.for("v-txt"),Ht=Symbol.for("v-cmt"),Ao=Symbol.for("v-stc"),kn=[];let it=null;function oe(t=!1){kn.push(it=t?null:[])}function Vm(){kn.pop(),it=kn[kn.length-1]||null}let $n=1;function ru(t,e=!1){$n+=t,t<0&&it&&e&&(it.hasOnce=!0)}function su(t){return t.dynamicChildren=$n>0?it||Ei:null,Vm(),$n>0&&it&&it.push(t),t}function de(t,e,i,n,r,s){return su(J(t,e,i,n,r,s,!0))}function Ir(t,e,i,n,r){return su(Ce(t,e,i,n,r,!0))}function Oo(t){return t?t.__v_isVNode===!0:!1}function En(t,e){return t.type===e.type&&t.key===e.key}const ou=({key:t})=>t??null,Ar=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?_e(t)||Ie(t)||Q(t)?{i:Ne,r:t,k:e,f:!!i}:t:null);function J(t,e=null,i=null,n=0,r=null,s=t===qe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&ou(e),ref:e&&Ar(e),scopeId:Sc,slotScopeIds:null,children:i,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:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ne};return a?(To(l,i),s&128&&t.normalize(l)):i&&(l.shapeFlag|=_e(i)?8:16),$n>0&&!o&&it&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&it.push(l),l}const Ce=Ym;function Ym(t,e=null,i=null,n=0,r=null,s=!1){if((!t||t===ym)&&(t=Ht),Oo(t)){const a=Ni(t,e,!0);return i&&To(a,i),$n>0&&!s&&it&&(a.shapeFlag&6?it[it.indexOf(t)]=a:it.push(a)),a.patchFlag=-2,a}if(ay(t)&&(t=t.__vccOpts),e){e=Qm(e);let{class:a,style:l}=e;a&&!_e(a)&&(e.class=pt(a)),ye(l)&&(ho(l)&&!Y(l)&&(l=Ae({},l)),e.style=Js(l))}const o=_e(t)?1:nu(t)?128:rm(t)?64:ye(t)?4:Q(t)?2:0;return J(t,e,i,n,r,o,s,!0)}function Qm(t){return t?ho(t)||Fc(t)?Ae({},t):t:null}function Ni(t,e,i=!1,n=!1){const{props:r,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?au(r||{},e):r,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&ou(c),ref:e&&e.ref?i&&s?Y(s)?s.concat(Ar(e)):[s,Ar(e)]:Ar(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==qe?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ni(t.ssContent),ssFallback:t.ssFallback&&Ni(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&mo(u,l.clone(u)),u}function Pn(t=" ",e=0){return Ce(Rr,null,t,e)}function Jt(t="",e=!1){return e?(oe(),Ir(Ht,null,t)):Ce(Ht,null,t)}function Ct(t){return t==null||typeof t=="boolean"?Ce(Ht):Y(t)?Ce(qe,null,t.slice()):Oo(t)?Zt(t):Ce(Rr,null,String(t))}function Zt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ni(t)}function To(t,e){let i=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(Y(e))i=16;else if(typeof e=="object")if(n&65){const r=e.default;r&&(r._c&&(r._d=!1),To(t,r()),r._c&&(r._d=!0));return}else{i=32;const r=e._;!r&&!Fc(e)?e._ctx=Ne:r===3&&Ne&&(Ne.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Q(e)?(e={default:e,_ctx:Ne},i=32):(e=String(e),n&64?(i=16,e=[Pn(e)]):i=8);t.children=e,t.shapeFlag|=i}function au(...t){const e={};for(let i=0;i<t.length;i++){const n=t[i];for(const r in n)if(r==="class")e.class!==n.class&&(e.class=pt([e.class,n.class]));else if(r==="style")e.style=Js([e.style,n.style]);else if(ar(r)){const s=e[r],o=n[r];o&&s!==o&&!(Y(s)&&s.includes(o))&&(e[r]=s?[].concat(s,o):o)}else r!==""&&(e[r]=n[r])}return e}function Rt(t,e,i,n=null){Et(t,e,7,[i,n])}const Xm=Dc();let Jm=0;function Zm(t,e,i){const n=t.type,r=(e?e.appContext:t.appContext)||Xm,s={uid:Jm++,vnode:t,type:n,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new wg(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Hc(n,r),emitsOptions:eu(n,r),emit:null,emitted:null,propsDefaults:ne,inheritAttrs:n.inheritAttrs,ctx:ne,data:ne,props:ne,attrs:ne,slots:ne,refs:ne,setupState:ne,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Fm.bind(null,s),t.ce&&t.ce(s),s}let De=null;const Lo=()=>De||Ne;let Or,Mo;{const t=fr(),e=(i,n)=>{let r;return(r=t[i])||(r=t[i]=[]),r.push(n),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};Or=e("__VUE_INSTANCE_SETTERS__",i=>De=i),Mo=e("__VUE_SSR_SETTERS__",i=>Di=i)}const Cn=t=>{const e=De;return Or(t),t.scope.on(),()=>{t.scope.off(),Or(e)}},lu=()=>{De&&De.scope.off(),Or(null)};function cu(t){return t.vnode.shapeFlag&4}let Di=!1;function ey(t,e=!1,i=!1){e&&Mo(e);const{props:n,children:r}=t.vnode,s=cu(t);Pm(t,n,s,e),Am(t,r,i||e);const o=s?ty(t,e):void 0;return e&&Mo(!1),o}function ty(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,vm);const{setup:n}=i;if(n){kt();const r=t.setupContext=n.length>1?ny(t):null,s=Cn(t),o=Ii(n,t,0,[t.props,r]),a=Fl(o);if($t(),s(),(a||t.sp)&&!Ti(t)&&yo(t),a){if(o.then(lu,lu),e)return o.then(l=>{uu(t,l)}).catch(l=>{gn(l,t,0)});t.asyncDep=o}else uu(t,o)}else fu(t)}function uu(t,e,i){Q(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ye(e)&&(t.setupState=mc(e)),fu(t)}function fu(t,e,i){const n=t.type;t.render||(t.render=n.render||St);{const r=Cn(t);kt();try{wm(t)}finally{$t(),r()}}}const iy={get(t,e){return Me(t,"get",""),t[e]}};function ny(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,iy),slots:t.slots,emit:t.emit,expose:e}}function Tr(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(mc(Fg(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in _n)return _n[i](t)},has(e,i){return i in e||i in _n}})):t.proxy}const ry=/(?:^|[-_])\w/g,sy=t=>t.replace(ry,e=>e.toUpperCase()).replace(/[-_]/g,"");function oy(t,e=!0){return Q(t)?t.displayName||t.name:t.name||e&&t.__name}function du(t,e,i=!1){let n=oy(e);if(!n&&e.__file){const r=e.__file.match(/([^/\\]+)\.\w+$/);r&&(n=r[1])}if(!n&&t&&t.parent){const r=s=>{for(const o in s)if(s[o]===e)return o};n=r(t.components||t.parent.type.components)||r(t.appContext.components)}return n?sy(n):i?"App":"Anonymous"}function ay(t){return Q(t)&&"__vccOpts"in t}const It=(t,e)=>Gg(t,e,Di),ly="3.5.24";let No;const hu=typeof window<"u"&&window.trustedTypes;if(hu)try{No=hu.createPolicy("vue",{createHTML:t=>t})}catch{}const pu=No?t=>No.createHTML(t):t=>t,cy="http://www.w3.org/2000/svg",uy="http://www.w3.org/1998/Math/MathML",zt=typeof document<"u"?document:null,gu=zt&&zt.createElement("template"),fy={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,n)=>{const r=e==="svg"?zt.createElementNS(cy,t):e==="mathml"?zt.createElementNS(uy,t):i?zt.createElement(t,{is:i}):zt.createElement(t);return t==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:t=>zt.createTextNode(t),createComment:t=>zt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>zt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,n,r,s){const o=i?i.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),i),!(r===s||!(r=r.nextSibling)););else{gu.innerHTML=pu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=gu.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,i)}return[o?o.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}},dy=Symbol("_vtc");function hy(t,e,i){const n=t[dy];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}const mu=Symbol("_vod"),py=Symbol("_vsh"),gy=Symbol(""),my=/(?:^|;)\s*display\s*:/;function yy(t,e,i){const n=t.style,r=_e(i);let s=!1;if(i&&!r){if(e)if(_e(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();i[a]==null&&Lr(n,a,"")}else for(const o in e)i[o]==null&&Lr(n,o,"");for(const o in i)o==="display"&&(s=!0),Lr(n,o,i[o])}else if(r){if(e!==i){const o=n[gy];o&&(i+=";"+o),n.cssText=i,s=my.test(i)}}else e&&t.removeAttribute("style");mu in t&&(t[mu]=s?n.display:"",t[py]&&(n.display="none"))}const yu=/\s*!important$/;function Lr(t,e,i){if(Y(i))i.forEach(n=>Lr(t,e,n));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const n=by(t,e);yu.test(i)?t.setProperty(Yt(n),i.replace(yu,""),"important"):t[n]=i}}const bu=["Webkit","Moz","ms"],Do={};function by(t,e){const i=Do[e];if(i)return i;let n=jt(e);if(n!=="filter"&&n in t)return Do[e]=n;n=zl(n);for(let r=0;r<bu.length;r++){const s=bu[r]+n;if(s in t)return Do[e]=s}return e}const vu="http://www.w3.org/1999/xlink";function wu(t,e,i,n,r,s=vg(e)){n&&e.startsWith("xlink:")?i==null?t.removeAttributeNS(vu,e.slice(6,e.length)):t.setAttributeNS(vu,e,i):i==null||s&&!Gl(i)?t.removeAttribute(e):t.setAttribute(e,s?"":Dt(i)?String(i):i)}function _u(t,e,i,n,r){if(e==="innerHTML"||e==="textContent"){i!=null&&(t[e]=e==="innerHTML"?pu(i):i);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=i==null?t.type==="checkbox"?"on":"":String(i);(a!==l||!("_value"in t))&&(t.value=l),i==null&&t.removeAttribute(e),t._value=i;return}let o=!1;if(i===""||i==null){const a=typeof t[e];a==="boolean"?i=Gl(i):i==null&&a==="string"?(i="",o=!0):a==="number"&&(i=0,o=!0)}try{t[e]=i}catch{}o&&t.removeAttribute(r||e)}function ji(t,e,i,n){t.addEventListener(e,i,n)}function vy(t,e,i,n){t.removeEventListener(e,i,n)}const xu=Symbol("_vei");function wy(t,e,i,n,r=null){const s=t[xu]||(t[xu]={}),o=s[e];if(n&&o)o.value=n;else{const[a,l]=_y(e);if(n){const c=s[e]=ky(n,r);ji(t,a,c,l)}else o&&(vy(t,a,o,l),s[e]=void 0)}}const Su=/(?:Once|Passive|Capture)$/;function _y(t){let e;if(Su.test(t)){e={};let n;for(;n=t.match(Su);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Yt(t.slice(2)),e]}let jo=0;const xy=Promise.resolve(),Sy=()=>jo||(xy.then(()=>jo=0),jo=Date.now());function ky(t,e){const i=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=i.attached)return;Et($y(n,i.value),e,5,[n])};return i.value=t,i.attached=Sy(),i}function $y(t,e){if(Y(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(n=>r=>!r._stopped&&n&&n(r))}else return e}const ku=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Ey=(t,e,i,n,r,s)=>{const o=r==="svg";e==="class"?hy(t,n,o):e==="style"?yy(t,i,n):ar(e)?Gs(e)||wy(t,e,i,n,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Py(t,e,n,o))?(_u(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&wu(t,e,n,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!_e(n))?_u(t,jt(e),n,s,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),wu(t,e,n,o))};function Py(t,e,i,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&ku(e)&&Q(i));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const r=t.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return ku(e)&&_e(i)?!1:e in t}const $u=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Y(e)?i=>ur(e,i):e};function Cy(t){t.target.composing=!0}function Eu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Uo=Symbol("_assign");function Pu(t,e,i){return e&&(t=t.trim()),i&&(t=Xs(t)),t}const Cu={created(t,{modifiers:{lazy:e,trim:i,number:n}},r){t[Uo]=$u(r);const s=n||r.props&&r.props.type==="number";ji(t,e?"change":"input",o=>{o.target.composing||t[Uo](Pu(t.value,i,s))}),(i||s)&&ji(t,"change",()=>{t.value=Pu(t.value,i,s)}),e||(ji(t,"compositionstart",Cy),ji(t,"compositionend",Eu),ji(t,"change",Eu))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:i,modifiers:{lazy:n,trim:r,number:s}},o){if(t[Uo]=$u(o),t.composing)return;const a=(s||t.type==="number")&&!/^0\d/.test(t.value)?Xs(t.value):t.value,l=e??"";a!==l&&(document.activeElement===t&&t.type!=="range"&&(n&&e===i||r&&t.value.trim()===l)||(t.value=l))}},Ry=Ae({patchProp:Ey},fy);let Ru;function Iy(){return Ru||(Ru=Tm(Ry))}const Ay=((...t)=>{const e=Iy().createApp(...t),{mount:i}=e;return e.mount=n=>{const r=Ty(n);if(!r)return;const s=e._component;!Q(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=i(r,!1,Oy(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e});function Oy(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ty(t){return _e(t)?document.querySelector(t):t}const Ly=1;var Mr;(t=>{t.PackageLoader=new R(R.object({kind:R.union(["autoload","module","umd","styles"]).required().default("autoload"),entry:R.string(),styles:R.array(R.string()),main_export:R.string()})),t.Package=new R(R.object({id:R.string().required(),name:R.string().required(),version:R.string().required(),description:R.string(),author:R.string(),license:R.string(),loader:t.PackageLoader.required()})),t.RegistryMaintainer=new R(R.object({name:R.string().required(),email:R.string()})),t.RegistryRepository=new R(R.object({type:R.union(["git"]).required().default("git"),url:R.string().required()})),t.Registry=new R(R.object({manifest_version:R.number().min(Ly).required(),name:R.string().required(),base_url:R.string().required(),homepage:R.string(),maintainers:R.array(t.RegistryMaintainer),repository:t.RegistryRepository,packages:R.array(t.Package).required()}))})(Mr||(Mr={}));const Bo=Symbol("IPEInjectKey"),My=(t,e)=>(e?e.provide(Bo,t):jc(Bo,t),t),Fo=()=>{const t=Sn(Bo);if(!t)throw new Error("InPageEdit instance is not provided");return t},Iu=(t,...e)=>{const i=Ay(...e);return My(t,i),i};var Ny=Object.create,qo=Object.defineProperty,Dy=Object.getOwnPropertyDescriptor,Au=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ou=t=>{throw TypeError(t)},jy=(t,e,i)=>e in t?qo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Uy=(t,e)=>qo(t,"name",{value:e,configurable:!0}),By=t=>[,,,Ny(t?.[Au("metadata")]??null)],Fy=["class","method","getter","setter","accessor","field","value","get","set"],Tu=t=>t!==void 0&&typeof t!="function"?Ou("Function expected"):t,qy=(t,e,i,n,r)=>({kind:Fy[t],name:e,metadata:n,addInitializer:s=>i._?Ou("Already initialized"):r.push(Tu(s||null))}),Hy=(t,e)=>jy(e,Au("metadata"),t[3]),zy=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Ky=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Dy(r,i));Uy(r,i);for(var d=n.length-1;d>=0;d--)l=qy(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Tu(o)&&(r=o);return Hy(t,r),p&&qo(r,i,p),u?c^4?s:p:r},Lu,Ho,Mu;const Nu=t=>{if(!t)return null;try{return t.split(".").reduce((e,i)=>e==null?e:e[i],globalThis)}catch{return null}},Du=(t,e,i)=>{if(/^https?:\/\//i.test(t))return t;const n=o=>o.endsWith("/")?o:o+"/";if(/^https?:\/\//i.test(e)){const o=n(e);return new URL(t,o).href}const r=(()=>{try{return new URL(i).href}catch{return new URL(i,location.origin).href}})(),s=new URL(n(e),r).href;return new URL(t,s).href};Lu=[Ee(["storage","preferences","resourceLoader","$"])];let Nr=(yt=class extends(Mu=et){constructor(e){super(e,{},"plugin-store"),this.ctx=e,this.regInfoDB=void 0,this._installedPlugins=new Map,this._onlineRegistryQueries=new Map,e.set("store",this),this.regInfoDB=e.storage.createDatabase(yt.REGISTRY_INFO_STORAGE_NAME,yt.REGISTRY_INFO_CACHE_TTL,1,"indexedDB")}async start(){this._installUserPlugins(),this._injectPreferenceUI()}async _installUserPlugins(){const e=await this.ctx.preferences.get("pluginStore.plugins",[]);if(e?.length)for(const i of e)this.install(i.registry,i.id,i.source)}async _createManagementApp(){const e=await this.ctx.withInject(["store"]);return Iu(e,am(()=>Promise.resolve().then(()=>ww)))}async _injectPreferenceUI(){const e=this.ctx,i=e.$;e.preferences.defineCategory({name:"plugin-store",label:i`Plugin Store`,description:i`Plugin Store`,index:90,autoGenerateForm:!1,customRenderer:async({onUnmount:n})=>{const r=m("div",{id:"ipe-plugin-store-preferences-vue"}),s=await this._createManagementApp();return s.mount(r),n(()=>{s.unmount(),this.ctx.logger.debug("Plugin Store preferences app unmounted")}),m("section",{children:r})}}),e.preferences.registerCustomConfig("plugin-store",R.object({"pluginStore.registries":R.array(R.string()).default([xt.PLUGIN_REGISTRY_URL]).description(i`Registry URLs`).hidden(),"pluginStore.cdnForNpm":R.string().description(i`CDN to install packages from npm`).default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? "@" + version : "" }}').hidden(),"pluginStore.plugins":R.array(R.object({source:R.union(["online_manifest","npm"]).default("online_manifest"),registry:R.string().required(),id:R.string().required()})).description(i`Installed plugins`).default([]).hidden()}),"plugin-store")}async showModal(){const e=this.ctx.modal.show({title:$`Plugin Store`,sizeClass:"small"}),i=m("section",{id:"ipe-plugin-store-vue"});e.setContent(i);const n=await this._createManagementApp();return n.mount(i),e.on(e.Event.Close,()=>{n.unmount()}),e}async install(e,i,n="online_manifest"){const r=await this.getRegistryInfo(e,n);if(!r)return this.ctx.logger.warn(`Registry ${e} not found`),null;const s=`${e}#${i}`;if(this._installedPlugins.has(s))return await this._installedPlugins.get(s)??null;const o=this._installOneByRegistryInfo(e,r,i);return this._installedPlugins.set(s,o),await o}async uninstall(e,i){const n=this._installedPlugins.get(`${e}#${i}`);if(n===void 0)return!0;this._installedPlugins.delete(`${e}#${i}`);const r=await n;return r?r.dispose?.()??!0:!0}async addToPreferences(e,i){let n=await this.ctx.preferences.get("pluginStore.plugins")||[];return n.some(s=>s.registry===e&&s.id===i)||(n.push({registry:e,id:i}),await this.ctx.preferences.set("pluginStore.plugins",n)),!0}async removeFromPreferences(e,i){let n=await this.ctx.preferences.get("pluginStore.plugins")||[];return n=n.filter(r=>r.registry!==e||r.id!==i),await this.ctx.preferences.set("pluginStore.plugins",n),!0}async installAndSetPreference(e,i){return await this.addToPreferences(e,i),this.install(e,i)}async uninstallAndRemovePreference(e,i){return await this.removeFromPreferences(e,i),this.uninstall(e,i)}async _installOneByRegistryInfo(e,i,n){const r=i.base_url,s=i.packages.find(d=>d.id===n);if(!s)return this.ctx.logger.warn(`Package ${n} not found in registry ${e}`),null;const o=s.loader,{kind:a,entry:l="index.js",styles:c=[],main_export:u=null}=o;let f=null;if(a!=="styles"){if(!l)return this.ctx.logger.warn(`Entry url missing for ${n}`,o),null;try{f=Du(l,r,e)}catch(d){return this.ctx.logger.warn(`Failed to resolve entry "${l}" with base "${r}" and registry "${e}"`,d),null}}const h={"data-plugin-registry":e,"data-plugin-id":n};let p=null;switch(a){case"autoload":{p=this.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${n}`,apply:d=>{f&&d.resourceLoader.loadScript(f,{...h})}});break}case"module":{if(!f)return this.ctx.logger.warn(`Entry url missing for module kind, package ${n}`),null;const d=await import(f).then(w=>(u?w[u]:w.default)??w);if(!d)return this.ctx.logger.warn(`Main export ${u} not found in module ${f}`),null;p=this.ctx.plugin(d);break}case"umd":{let d=Nu(u);if(!d){if(!f)return this.ctx.logger.warn(`Entry url missing for umd kind, package ${n}`),null;await this.ctx.resourceLoader.loadScript(f,{...h}),d=Nu(u)}if(!d)return this.ctx.logger.warn(`Main export ${u} not found on globalThis after loading ${f}`),null;p=this.ctx.plugin(d);break}}if(c&&c.length>0){let d=[];try{d=c.map(w=>Du(w,r,e)).filter(Boolean)}catch(w){this.ctx.logger.warn(`Failed to resolve styles for ${n}`,c,w)}p||(p=this.ctx.plugin({name:`plugin-store-${e}-${n}`,apply(){}})),p.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${n}-styles`,apply:w=>{d.forEach(S=>w.resourceLoader.loadStyle(S,{...h})),w.on("dispose",()=>{try{d.forEach(S=>w.resourceLoader.removeStyle(S))}catch{}})}})}return p}validateRegistry(e){return Mr.Registry(e)}async getRegistryInfo(e,i="online_manifest",n=!1){try{let s;switch(i){case"online_manifest":{s=await this._fetchOnlineRegistryInfo(e,n),this.logger.debug("Fetched registry info from online manifest",s),this.setRegistryCache(e,s);break}default:throw new Error(`Unsupported registry source: ${i}`)}return s}catch(s){this.ctx.logger.warn("Failed to fetch registry info",s)}const r=await this.getRegistryCache(e);if(!r)throw new Error(`Failed to fetch registry info: ${e}`);return r}async _fetchOnlineRegistryInfo(e,i=!1){if(!i&&this._onlineRegistryQueries.has(e))return await this._onlineRegistryQueries.get(e);const r=(async()=>{const s={method:"GET"};i&&(s.cache="no-store");const a=await(await fetch(e,s)).json();return this.validateRegistry(a)})();return this._onlineRegistryQueries.set(e,r),await r}async getRegistryCache(e){const i=await this.regInfoDB.get(e);if(i)try{return this.validateRegistry(i)}catch(n){this.ctx.logger.warn("Invalid cached registry",n,i),this.regInfoDB.delete(e)}return null}async setRegistryCache(e,i){return this.regInfoDB.set(e,i)}async deleteRegistryCache(e){await this.regInfoDB.delete(e)}async clearAllRegistryCaches(){await this.regInfoDB.clear(),this.ctx.logger.debug("All registry caches cleared")}async refreshRegistryCache(e){const i=await this.getRegistryInfo(e,"online_manifest",!0);if(!i)throw new Error(`Failed to refresh registry cache: ${e}`);return this.ctx.logger.debug("Registry cache refreshed:",e),i}async refreshAllRegistryCaches(){const e=await this.ctx.preferences.get("pluginStore.registries")||[],i=await Promise.allSettled(e.map(r=>this.refreshRegistryCache(r))),n={};for(const[r,s]of i.entries())s.status==="fulfilled"?n[e[r]]=s.value:n[e[r]]=null;return n}},yt.PluginStoreSchemas=Mr,yt.REGISTRY_INFO_CACHE_TTL=1e3*60*60*24,yt.REGISTRY_INFO_STORAGE_NAME="plugin-store-registry",yt.REGISTRY_ETAG_STORAGE_NAME="psreg-etag",yt);Ho=By(Mu),Nr=Ky(Ho,0,"PluginPluginStore",Lu,Nr),zy(Ho,1,Nr);const Wy=Object.freeze(Object.defineProperty({__proto__:null,PluginPluginStore:Nr},Symbol.toStringTag,{value:"Module"})),nt='@charset "UTF-8";:host{display:block;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system);color:var(--schema-color-fg, #111827)}*,*:before,*:after{box-sizing:border-box}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius, 10px);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}',ju={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},be=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Gy=(t,e,i)=>{if(!e.length)return;let n=t,r=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=n?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},n[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},n[l]=c),r=n,s=l,n=c}const o=e[e.length-1];if(n==null||typeof n!="object"){const a=typeof o=="number"?[]:{};if(r)r[s]=a,n=a;else return}try{n[o]=i}catch{try{const a=Array.isArray(n)?n.slice():{...n};a[o]=i,r&&(r[s]=a)}catch{}}},Rn=t=>t.map(String).join("."),Vy=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),ei=t=>`schema_${Vy(Rn(t)||"root")}`,hi=t=>Rn(t),ee=(t,...e)=>{const i=new Set(e);i.size&&t.setAttribute("part",Array.from(i).join(" "))},Yy=["wrapper","form","field","field-intersect","field-string","field-number","field-boolean","field-date","field-const","field-array","field-object","field-tuple","field-union","field-dict","field-label","field-helper","field-group","field-row","field-actions","field-button","field-button-primary","field-button-danger","field-button-secondary","field-toolbar","field-badge","field-input","field-input-text","field-input-number","field-input-date","field-input-select","field-input-textarea","field-input-checkbox","field-const-value","collection-row","field-checkbox","field-checkbox-text","field-toolbar-select"].join(" ");function zo(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const i=Number(e);return Number.isNaN(i)?void 0:i}case"boolean":return!!e;case"date":{if(!e)return;const i=new Date(e);return Number.isNaN(+i)?void 0:i}case"const":case"string":default:return e}}function Uu(t){return typeof t=="function"&&!!t?.type}function Bu(t){if(!t)throw new Error("schema is required");if(Uu(t))return t;try{const e=Schema.from(t);if(Uu(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function ct(t){return t?.meta??{}}function Qy(t){return t.length>0&&t.every(e=>e?.type==="const")}function pi(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const n=e.type;try{const r=t();if(r!==void 0)return r}catch{}switch(n){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const r=e.list||[];return r.length?pi(r[0]):void 0}case"const":return e.value;case"date":return;case"intersect":{const r=e.list||[],s=(a,l)=>{if(Array.isArray(a)&&Array.isArray(l))return l.slice();if(a&&l&&typeof a=="object"&&typeof l=="object"){const c={...a};for(const u of Object.keys(l))c[u]=u in c?s(c[u],l[u]):l[u];return c}return l??a};let o={};for(const a of r)o=s(o,pi(a));return o}default:return}}class mt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=ju,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=nt,this.$root.appendChild(e)}makeFieldContainer(e,i){const n=document.createElement("div");if(n.className=`field schema-form-item schema-type-${e}`,n.setAttribute("data-path",Rn(this._path)),ee(n,"field",`field-${e}`),this._label){const r=document.createElement("label");r.className="label",r.textContent=this._label,ee(r,"field-label"),n.appendChild(r)}if(i&&i!==this._label){const r=document.createElement("div");r.className="helper",r.textContent=i,ee(r,"field-helper"),n.appendChild(r)}return n}set schema(e){this._schema=Bu(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Fu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=!!this.$root.querySelector("label.label");if(!(this._label&&!s)){const o=this._value??"";this.$input.value!==o&&document.activeElement!==this.$input&&(this.$input.value=o);return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("string",e.description),n=document.createElement("input");this.$input=n,n.className="input",ee(n,"field-input","field-input-text"),n.type="text",n.name=hi(this._path),n.id=ei(this._path),e?.pattern?.source&&(n.pattern=e.pattern.source),e?.max!=null&&(n.maxLength=e.max),n.value=this._value??"",n.oninput=()=>this.emitChange(zo("string",n.value));const r=i.querySelector("label.label");r&&(r.htmlFor=n.id),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-string",Fu);class qu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=this._value??"";this.$input.value!==String(a)&&document.activeElement!==this.$input&&(this.$input.value=a);return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=this._schema?.type??"number",i=ct(this._schema),n=this.makeFieldContainer("number",i.description),r=document.createElement("input");this.$input=r,r.className="input",ee(r,"field-input","field-input-number"),r.name=hi(this._path),r.id=ei(this._path),i?.min!=null&&(r.min=String(i.min)),i?.max!=null&&(r.max=String(i.max)),i?.step!=null&&(r.step=String(i.step)),e==="percent"&&!r.step&&(r.step="0.01"),r.value=this._value??"",r.oninput=()=>this.emitChange(zo(e,r.value));const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),i.role==="slider"?r.type="range":r.type="number",n.appendChild(r),this.$root.appendChild(n)}}be("schema-form-number",qu);class Hu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("boolean",e.description),n=document.createElement("label");n.className="checkbox",ee(n,"field-checkbox");const r=document.createElement("input");r.type="checkbox",r.checked=!!this._value,r.name=hi(this._path),r.id=ei(this._path),ee(r,"field-input","field-input-checkbox");const s=document.createElement("span");s.textContent=e.description??this._label??"",ee(s,"field-checkbox-text"),r.onchange=()=>this.emitChange(r.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=r.id),n.append(r,s),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-boolean",Hu);function Dr(t){return String(t).padStart(2,"0")}function In(t){return`${t.getFullYear()}-${Dr(t.getMonth()+1)}-${Dr(t.getDate())}`}function Ko(t){return`${Dr(t.getHours())}:${Dr(t.getMinutes())}`}function jr(t){return`${In(t)}T${Ko(t)}`}class zu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=ct(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)a==="date"?this.$input.value=In(this._value):a==="time"?this.$input.value=Ko(this._value):a==="datetime"&&(this.$input.value=jr(this._value));else if(typeof this._value=="string"&&a!=="time"){const l=new Date(this._value);isNaN(+l)||(a==="date"?this.$input.value=In(l):a==="datetime"&&(this.$input.value=jr(l)))}else this._value||(this.$input.value="");return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("date",e.description),n=document.createElement("input");this.$input=n,n.className="input",ee(n,"field-input","field-input-date");const r=e.role||"date";if(r==="datetime"?n.type="datetime-local":r==="time"?n.type="time":n.type="date",n.name=hi(this._path),n.id=ei(this._path),this._value instanceof Date)r==="date"?n.value=In(this._value):r==="time"?n.value=Ko(this._value):r==="datetime"&&(n.value=jr(this._value));else if(typeof this._value=="string"&&r!=="time"){const o=new Date(this._value);isNaN(+o)||(r==="date"?n.value=In(o):r==="datetime"&&(n.value=jr(o)))}n.oninput=()=>{e.role;let o;if(!n.value)o=void 0;else{const a=new Date(n.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-date",zu);class Wo extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this._schema.value;if(e.role==="raw-html"){if(i instanceof Node){this.$root.append(i);return}else if(typeof i=="function"){this.$root.append(i());return}else if(typeof i=="string"){const o=document.createElement("div");o.innerHTML=String(i),ee(o,"field-const-value"),this.$root.appendChild(o);return}}const n=this.makeFieldContainer("const",e.description),r=document.createElement("section");r.className="const content",r.textContent=String(i),r.id=ei(this._path),ee(r,"field-const-value");const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}be("schema-form-const",Wo);class Ku extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("intersect",e.description);i.classList.remove("field");const n=document.createElement("div");n.classList.add("group"),ee(n,"field-group");const r=this._schema.list||[],s=r.length>0&&r.every(a=>a?.type==="object"),o=(a,l)=>{if(Array.isArray(a)&&Array.isArray(l))return l.slice();if(a&&l&&typeof a=="object"&&typeof l=="object"){const c={...a};for(const u of Object.keys(l))c[u]=u in c?o(c[u],l[u]):l[u];return c}return l??a};if(s){const a=this._value&&typeof this._value=="object"?this._value:{};r.forEach((l,c)=>{const u=l?.meta?.description??"",f=ti(l,this._path,a,u,this._i18n);f.addEventListener("change",h=>{h.stopPropagation();const p=o(this._value??{},h.detail.value);this.emitChange(p)}),n.appendChild(f)})}else{const a=r[r.length-1],l=ti(a,this._path,this._value,this._label,this._i18n);l.addEventListener("change",c=>{c.stopPropagation(),this.emitChange(c.detail.value)}),n.appendChild(l)}i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-intersect",Ku);function Xy(t){switch(t.type){case"intersect":return"schema-form-intersect";case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function ti(t,e,i,n,r){const s=Xy(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=n,r&&(o.i18n=r),o.setValue?.(i),o.setAttribute("exportparts",Yy),o}class Wu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("union",e.description),n=this._schema.list||[];if(Qy(n)){const r=document.createElement("select");r.className="input",ee(r,"field-input","field-input-select"),r.name=hi(this._path),r.id=ei(this._path),n.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.meta?.description||o.value||o.type),this._value===o.value&&(a.selected=!0),r.appendChild(a)}),r.onchange=()=>this.emitChange(zo("string",r.value));const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r)}else{const r=document.createElement("div");r.className="toolbar",ee(r,"field-toolbar");const s=document.createElement("select");s.className="input",ee(s,"field-input","field-input-select","field-toolbar-select"),s.name=hi(this._path)+".__type",s.id=ei(this._path)+"__type";let o=0;n.forEach((u,f)=>{const h=document.createElement("option");h.value=String(f),h.textContent=String(u.meta?.description||u.value||u.type),s.appendChild(h)}),s.onchange=()=>{o=Number(s.value);const u=n[o],f=pi(u);this.emitChange(f),c()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),r.appendChild(s),i.appendChild(r);const l=document.createElement("div");l.className="group",ee(l,"field-group");const c=()=>{l.innerHTML="";const u=n[o],f=ti(u,this._path,this._value,this._label);f instanceof Wo||(f.addEventListener("change",h=>{h.stopPropagation(),this.emitChange(h.detail.value)}),l.appendChild(f))};c(),i.appendChild(l)}this.$root.appendChild(i)}}be("schema-form-union",Wu);class Gu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("tuple",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=ti(s,[...this._path,o],r[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),n.appendChild(a)}),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-tuple",Gu);class Vu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("object",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.dict||{};Object.keys(r).forEach(s=>{if(r[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=ti(r[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),n.appendChild(a)}),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-object",Vu);const Zr=class Zr extends mt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Zr._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const i={};return e.querySelectorAll(".row").forEach(n=>{const r=n.dataset.uid;r&&(i[r]=n.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(n=>{const r=n.dataset.uid;if(!r)return;const s=i[r];if(!s)return;const o=n.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(n.style.transition="none",n.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{n.style.transition="transform .25s ease",n.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("array",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{n.innerHTML="",s().forEach((f,h)=>{const p=[...this._path,h],d=document.createElement("div");d.className="row schema-collection-row",ee(d,"field-row","collection-row");const w=this._itemIds[h];d.dataset.uid=w,d.setAttribute("data-path",Rn(p));const S=ti(r,p,f,`${this._label??""}[${h}]`);S.addEventListener("change",v=>{v.stopPropagation();const x=s().slice();x[h]=v.detail.value,this._value=x,this.emitChange(x)});const E=document.createElement("div");E.className="actions",ee(E,"field-actions");const M=document.createElement("button");M.type="button",M.className="btn",ee(M,"field-button","field-button-secondary"),M.textContent=this._i18n.arrayMoveUp??"↑",M.onclick=()=>{if(h<=0)return;const v=this.capturePositions(n),x=s().slice();[x[h-1],x[h]]=[x[h],x[h-1]],[this._itemIds[h-1],this._itemIds[h]]=[this._itemIds[h],this._itemIds[h-1]],this._value=x,o(v),this.emitChange(x)};const g=document.createElement("button");g.type="button",g.className="btn",ee(g,"field-button","field-button-secondary"),g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const v=s();if(h>=v.length-1)return;const x=this.capturePositions(n),P=v.slice();[P[h+1],P[h]]=[P[h],P[h+1]],[this._itemIds[h+1],this._itemIds[h]]=[this._itemIds[h],this._itemIds[h+1]],this._value=P,o(x),this.emitChange(P)};const y=document.createElement("button");y.type="button",y.className="btn danger",ee(y,"field-button","field-button-danger"),y.textContent=this._i18n.arrayRemove??"×",y.onclick=()=>{d.classList.add("leaving");const v=250;let x=!1;const P=()=>{if(x)return;x=!0,clearTimeout(L);const C=s().filter((H,He)=>He!==h);this._itemIds.splice(h,1);const U=this.capturePositions(n);this._value=C,o(U),this.emitChange(C)};d.addEventListener("transitionend",P,{once:!0});const L=setTimeout(P,v+80)},E.append(M,g,y),d.appendChild(S),d.appendChild(E),n.appendChild(d),u&&u===w&&(d.classList.add("enter"),requestAnimationFrame(()=>{d.classList.add("enter-active")}),requestAnimationFrame(()=>{d.classList.remove("enter")}))}),c&&this.playFLIP(n,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",ee(a,"field-button","field-button-primary"),a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(n),u=s().slice(),f=pi(r);u.push(f);const h=this.generateItemId();this._itemIds.push(h),this._value=u,o(c,h),this.emitChange(u)};const l=document.createElement("div");l.className="actions",ee(l,"field-actions"),l.appendChild(a),i.appendChild(n),i.appendChild(l),this.$root.appendChild(i)}};Zr._idCounter=0;let Ur=Zr;be("schema-form-array",Ur);class Yu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("dict",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.inner,s=this._value??{},o=h=>`d_${h}`,a=()=>{const h={};return n.querySelectorAll(".kv").forEach(p=>{const d=p.dataset.uid;d&&(h[d]=p.getBoundingClientRect())}),h},l=h=>{n.querySelectorAll(".kv").forEach(p=>{const d=p.dataset.uid;if(!d)return;const w=h[d];if(!w)return;const S=p.getBoundingClientRect(),E=w.left-S.left,M=w.top-S.top;(E||M)&&(p.style.transition="none",p.style.transform=`translate(${E}px, ${M}px)`,requestAnimationFrame(()=>{p.style.transition="transform .25s ease",p.style.transform=""}))})},c=(h,p)=>{n.innerHTML="",Object.keys(s).forEach(d=>{const w=[...this._path,d],S=document.createElement("div");S.className="kv schema-collection-row",ee(S,"field-row","collection-row"),S.dataset.uid=o(d),S.setAttribute("data-path",Rn(w));const E=document.createElement("input");E.className="input",ee(E,"field-input","field-input-text"),E.value=d,E.name=hi(w)+".__key",E.id=ei(w)+"__key";const M=ti(r,w,s[d],`${this._label??""}[${d}]`),g=document.createElement("button");g.type="button",g.className="btn danger",ee(g,"field-button","field-button-danger"),g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const y=a();delete s[d];const v={...this._value??{}};delete v[d],this._value=v,c(y),this.emitChange(v)},E.onchange=()=>{const y=E.value.trim();if(!y||y===d||s[y]!==void 0)return;const v=a();s[y]=s[d],delete s[d];const x={...this._value??{}};x[y]=x[d],delete x[d],this._value=x,c(v),this.emitChange(x)},M.addEventListener("change",y=>{y.stopPropagation();const v={...this._value??{}};v[d]=y.detail.value,this._value=v,this.emitChange(v)}),S.append(E,M,g),n.appendChild(S),p===d&&(S.classList.add("enter"),requestAnimationFrame(()=>S.classList.add("enter-active")),requestAnimationFrame(()=>S.classList.remove("enter")))}),h&&l(h)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",ee(u,"field-button","field-button-primary"),u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let h=Object.keys(s).length+1,p=`k${h}`;for(;s[p]!==void 0;)p=`k${++h}`;const d=a();s[p]=pi(r);const w={...this._value??{},[p]:s[p]};this._value=w,c(d,p),this.emitChange(w)};const f=document.createElement("div");f.className="actions",ee(f,"field-actions"),f.appendChild(u),i.appendChild(n),i.appendChild(f),this.$root.appendChild(i)}}be("schema-form-dict",Yu);class Qu extends HTMLElement{constructor(){super(),this._i18n={...ju},this._i18nCommitted=!1,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=nt,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",ee(i,"wrapper");const n=document.createElement("form");n.className="form",ee(n,"form"),i.appendChild(n),this.$root.appendChild(i),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:s,value:o}=r.detail;Array.isArray(s)&&s.length===0?this._state=o:Gy(this._state??(this._state={}),s,o),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:s,value:o,state:this._state}}))})}set schema(e){this._schema=Bu(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=pi(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,i={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=n,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const i=this._state;return e.validate?this._schema(i??null,{autofix:e.autofix}):i}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=pi(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18nCommitted||(this._i18n={...this._i18n,...e},this._i18nCommitted=!0,this.render())}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const i=ti(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}be("schema-form",Qu);function Jy(){be("schema-form",Qu),be("schema-form-string",Fu),be("schema-form-number",qu),be("schema-form-boolean",Hu),be("schema-form-date",zu),be("schema-form-const",Wo),be("schema-form-union",Wu),be("schema-form-tuple",Gu),be("schema-form-object",Vu),be("schema-form-array",Ur),be("schema-form-dict",Yu),be("schema-form-intersect",Ku)}const Zy=fi({__name:"SchemasteryFormVue",props:Ac({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Ac(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const n=Jc(t,"schema"),r=Jc(t,"value"),s=i,o=$c("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,h=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,r.value=h,mn(()=>{a=!1}),s("change",u.detail)};return Rc(()=>{Jy()}),wn(()=>{const u=o.value;n.value&&(u.schema=n.value),r.value!==void 0&&u.setData(r.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),vo(()=>{o.value?.removeEventListener("form-change",c)}),Mi(n,u=>{a||o.value&&u&&o.value.schema!==u&&(l=!0,o.value.schema=u,mn(()=>{l=!1}))},{deep:!0,immediate:!0}),Mi(r,u=>{if(a||!o.value||u===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u)&&(l=!0,o.value.setData(u,{validate:!1}),mn(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const h=o.value;h.setData(u,{validate:!!f?.validate}),f?.emit&&(r.value=h.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(n.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(oe(),de("schema-form",au({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function gi(t,e=new WeakMap){if(Ie(t))return gi(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const r=new Map;return e.set(t,r),Array.from(t.entries()).forEach(([s,o])=>{r.set(s,gi(o,e))}),r}if(t instanceof Set){const r=new Set;return e.set(t,r),Array.from(t).forEach(s=>{r.add(gi(s,e))}),r}if(Array.isArray(t)){const r=[];e.set(t,r);for(const s of t)r.push(gi(s,e));return r}const i=ie(t),n={};e.set(t,n);for(const r of Object.keys(i))n[r]=gi(i[r],e);for(const r of Object.getOwnPropertySymbols(i))n[r]=gi(i[r],e);return n}const Go=()=>{},eb={id:"preferences-ui-app"},tb={class:"tabbar"},ib={class:"tabbar-tabs"},nb=["onClick","data-value"],rb={class:"tabbar-content"},sb={key:0},ob={style:{"max-height":"20em",overflow:"auto"}},ab=fi({__name:"PreferencesApp",setup(t,{expose:e}){const i=Fo(),n=!1,r=pc([]),s=Ue([]),o=Ue(""),a=It(()=>s.value.find(d=>d.name===o.value)||null),l=It(()=>{const d=r.value.filter(w=>w.category===o.value).map(w=>w.schema);return d.length===0?null:R.intersect(d)}),c=It(()=>a.value&&typeof a.value.autoGenerateForm=="boolean"?a.value.autoGenerateForm:!0),u=Ue({});e({getValue(){return gi(u)},mergeValue(d){u.value={...u.value,...d}},selectTab(d){o.value=d}}),wn(async()=>{i.inject(["preferences"],async d=>{const w=await d.preferences.getAll();u.value=w,s.value=d.preferences.getConfigCategories(),r.value=d.preferences.getConfigRegistries(),o.value=s.value[0].name})});const f=(d,w)=>{d.preventDefault(),o.value=w;const S=d.currentTarget;S&&S.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},h=$c("customRenderContainerRef"),p=Ue([]);return wo(()=>{p.value.forEach(d=>d()),p.value=[]}),Mi(a,async d=>{p.value.forEach(S=>S()),p.value=[],await mn();const w=h.value;if(w&&(w.innerText="",d&&typeof d.customRenderer=="function")){let S=Go;const E=y=>{S=y},M=y=>{p.value.push(y)},g=await d.customRenderer({ctx:i,onMounted:E,onUnmount:M});g&&(w.appendChild(g),S?.(w))}},{immediate:!0,deep:!1}),(d,w)=>(oe(),de("div",eb,[J("div",tb,[J("div",ib,[(oe(!0),de(qe,null,_o(s.value,S=>(oe(),de("a",{class:pt(["tab",{active:o.value===S.name}]),key:S.name,onClick:E=>f(E,S.name),"data-value":S.name},ue(S.label),11,nb))),128))]),J("div",rb,[a.value&&a.value.customRenderer?(oe(),de("div",{class:"custom-render-container",ref_key:"customRenderContainerRef",ref:h,key:o.value})):Jt("",!0),c.value&&l.value?(oe(),Ir(Pe(Zy),{class:"auto-schema-form",key:o.value,"data-category":o.value,schema:l.value,value:u.value,"onUpdate:value":w[0]||(w[0]=S=>u.value={...u.value,...S}),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["data-category","schema","value"])):Jt("",!0)])]),Pe(n)?(oe(),de("details",sb,[J("pre",ob,ue(u.value),1)])):Jt("",!0)]))}}),Br=(t,e)=>{const i=t.__vccOpts||t;for(const[n,r]of e)i[n]=r;return i},lb=Br(ab,[["__scopeId","data-v-7f07706b"]]);var cb=Object.create,Vo=Object.defineProperty,ub=Object.getOwnPropertyDescriptor,Xu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ju=t=>{throw TypeError(t)},fb=(t,e,i)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,db=(t,e)=>Vo(t,"name",{value:e,configurable:!0}),hb=t=>[,,,cb(t?.[Xu("metadata")]??null)],pb=["class","method","getter","setter","accessor","field","value","get","set"],Zu=t=>t!==void 0&&typeof t!="function"?Ju("Function expected"):t,gb=(t,e,i,n,r)=>({kind:pb[t],name:e,metadata:n,addInitializer:s=>i._?Ju("Already initialized"):r.push(Zu(s||null))}),mb=(t,e)=>fb(e,Xu("metadata"),t[3]),yb=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},bb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&ub(r,i));db(r,i);for(var d=n.length-1;d>=0;d--)l=gb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Zu(o)&&(r=o);return mb(t,r),p&&Vo(r,i,p),u?c^4?s:p:r},ef,Yo,tf;ef=[Ee(["preferences","modal","$","$$"])];class Fr extends(tf=et){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,this._modal=null,this._form=null,e.set("preferencesUI",this);const i=e.$,n=e.$$;e.preferences.defineCategory({name:"general",label:i`prefs.general.label`,description:i`prefs.general.description`,autoGenerateForm:!0}),e.preferences.defineCategory({name:"editor",label:i`prefs.editor.label`,description:i`prefs.editor.description`,autoGenerateForm:!0}),e.preferences.defineCategory({name:"about",label:n`prefs.about.label`,description:n`prefs.about.description`,index:99,customRenderer:()=>m("section",{className:"theme-ipe-prose",children:[m("h2",{children:"✏️ InPageEdit NEXT"}),m("p",{children:n`prefs.about.intro`}),m("h3",{children:n`prefs.about.portals.header`}),m("ul",{children:[m("li",{children:m("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",children:n`prefs.about.portals.officialwebsite`})}),m("li",{children:m("a",{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version.split("-")[0]}`,target:"_blank",children:n`prefs.about.portals.updatelogs`})})]}),m("h3",{children:n`prefs.about.joinus.header`}),m("ul",{children:[m("li",{children:[m("strong",{children:n`prefs.about.joinus.github`}),":"," ",m("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:`${this.ctx.Endpoints.GITHUB_OWNER}/${this.ctx.Endpoints.GITHUB_REPO}`})]}),m("li",{children:[m("strong",{children:n`prefs.about.joinus.qqgroup`}),": ",this.ctx.Endpoints.QQ_GROUP_ID]})]}),m("hr",{}),m("p",{style:{textAlign:"center"},children:n`prefs.about.copyright`}),m("hr",{})]})}),e.inject(["toolbox"],r=>{r.toolbox.addButton({id:"preferences",icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:()=>i`Configure Preferences`,group:"group2",index:99,onClick:()=>this.showModal()}),this.addDisposeHandler(s=>{s.toolbox.removeButton("preferences")})})}async start(){Promise.resolve().then(()=>Ow).then(({PluginPrefSync:e})=>{this.ctx.plugin(e)}).catch(this.ctx.logger.warn),this.ctx.on("preferences/changed",e=>{this._form?.mergeValue?.(e.input)})}stop(){}showModal(){const e=this.ctx.$;if(this._modal&&!this._modal.isDestroyed)return this._modal;const i=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:`${e`InPageEdit Preferences`} (${this.ctx.version})`,content:m(_i,{children:m(ai,{})})});i.get$window().classList.add("dialog");const n=m("div",{id:"ipe-preferences-app",style:{minHeight:"calc(85dvh - var(--ipe-modal-spacing) * 2)"}});i.setContent(n),this.ctx.emit("preferences-ui/modal-shown",{ctx:this.ctx,modal:i});const r=this.createPreferencesUIApp(),s=r.mount(n);return this._form=s,this.ctx.emit("preferences-ui/vue-app-mounted",{ctx:this.ctx,app:r,form:s}),i.setButtons([{label:e`Close`,className:"is-ghost",method:()=>{i.close()}},{label:e`Save`,className:"is-primary is-ghost",method:async()=>{const o=s.getValue();try{const a=await this.ctx.preferences.setMany(o);this.logger.info("preferences saved",o,a)}catch(a){this.logger.error("failed to save preferences",a)}i.close(),this.ctx.modal.notify("success",{title:e`Preferences Saved`,content:m("p",{children:e`Some settings may take effect after reloading the page.`})})}}]),this._modal=i,i.on(i.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount(),this._modal=null,this._form=null,this.ctx.emit("preferences-ui/modal-closed",{ctx:this.ctx,modal:i})}),i}getCurrentModal(){return this._modal}closeCurrentModal(){return this._modal?.close()}async dispatchFormSave(e){e=e||this._form||void 0;const i=e?.getValue();return i?(this.ctx.preferences.setMany(i),!0):!1}getCurrentFormValue(){return this._form?.getValue()}mergeFormValue(e){return this._form?.mergeValue?.(e),!!this._form?.mergeValue}createPreferencesUIApp(){return Iu(this.ctx,lb)}}Yo=hb(tf),Fr=bb(Yo,0,"PluginPreferencesUI",ef,Fr),yb(Yo,1,Fr);const vb=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Fr}},Symbol.toStringTag,{value:"Module"})),wb=Symbol("@@apply"),_b=Symbol("@@ctor");function nf(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const i=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};i[wb]=i,i[_b]=t;const n=t?.constructor?.name;return n&&(i[Symbol.toStringTag]=n),new Proxy(i,{get(s,o,a){return o==="prototype"?Reflect.get(i,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const qr={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},Qo=t=>{const{type:e="default",title:i,content:n,closeable:r=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=i;typeof i>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:h,resolve:p}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),p()}),h},f=m("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${qr.mbox}`,...l,children:[c&&m("div",{className:`ipe-mbox-title ${qr.title}`,...s,children:c}),m("div",{className:`ipe-mbox-content ${qr.content}`,...o,children:a||n}),r&&m("a",{onClick:u,className:`ipe-mbox-close ${qr.close}`,children:"×"})]});return f.close=u,f},Hr=t=>{const{label:e,id:i,name:n,value:r,disabled:s,labelProps:o,inputProps:a,...l}=t;return m("div",{className:"theme-ipe ipe-input-box",...l,children:[m("label",{htmlFor:i,style:{display:"block"},...o,children:e}),m("input",{id:i,name:n,value:r,disabled:s,style:{width:"100%"},...a})]})},xb=t=>{const{id:e,name:i,value:n,label:r,inputProps:s,labelProps:o,children:a,...l}=t;return m("label",{className:"theme-ipe ipe-radio-box",...l,children:[m("input",{type:"radio",id:e,name:i,value:n,...s}),m("span",{className:"ipe-checkbox-box"}),m("span",{...o,children:r||a})]})},Ui=t=>{const{id:e,name:i,label:n,checked:r,inputProps:s,labelProps:o,children:a,...l}=t;return m("label",{className:"theme-ipe ipe-checkbox",...l,children:[m("input",{type:"checkbox",id:e,name:i,checked:r,...s}),m("span",{className:"ipe-checkbox-box"}),m("span",{...o,children:n||a})]})},Sb=(t=0)=>new Promise(e=>setTimeout(e,t));var kb=Object.create,Xo=Object.defineProperty,$b=Object.getOwnPropertyDescriptor,rf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),sf=t=>{throw TypeError(t)},Eb=(t,e,i)=>e in t?Xo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pb=(t,e)=>Xo(t,"name",{value:e,configurable:!0}),Cb=t=>[,,,kb(t?.[rf("metadata")]??null)],Rb=["class","method","getter","setter","accessor","field","value","get","set"],of=t=>t!==void 0&&typeof t!="function"?sf("Function expected"):t,Ib=(t,e,i,n,r)=>({kind:Rb[t],name:e,metadata:n,addInitializer:s=>i._?sf("Already initialized"):r.push(of(s||null))}),Ab=(t,e)=>Eb(e,rf("metadata"),t[3]),Ob=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Tb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&$b(r,i));Pb(r,i);for(var d=n.length-1;d>=0;d--)l=Ib(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,of(o)&&(r=o);return Ab(t,r),p&&Xo(r,i,p),u?c^4?s:p:r},af,Jo,lf;af=[Ee(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences","$"]),Vt(R.object({"quickEdit.editSummary":R.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":R.boolean().description('Default to checking "minor edit" option').default(!1),"quickEdit.outSideClose":R.boolean().description("Close editor modal by clicking outside").default(!0),"quickEdit.watchList":R.union([R.const(at.preferences).description("Follow MW preferences"),R.const(at.nochange).description("Keep the current watchlist status"),R.const(at.watch).description("Add the page to watchlist"),R.const(at.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(at.preferences),"quickEdit.keyshortcut.save":R.string().default("ctrl-s").description("save button key shortcut (blank to disable)"),"quickEdit.editFont":R.union([R.const("preferences").description("Follow MW preferences"),R.const("monospace").description("Monospace"),R.const("sans-serif").description("Sans-serif"),R.const("serif").description("Serif"),R.string().description("Custom font (same as CSS `font-family` property)").default("")]).description("Font to use in quick edit's textarea").default("preferences")}).description("Quick edit options").extra("category","editor"))];let zr=(yi=class extends(lf=et){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",nf(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){const i=this.ctx.$;if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const g=new URLSearchParams(window.location.search),y=this.ctx.currentPage.wikiTitle;e={...e,title:y?.getPrefixedDBKey(),revision:g.has("oldid")?Number(g.get("oldid")):void 0,pageId:g.has("curid")?Number(g.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const g=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);g&&g.title.getNamespaceId()>=0&&(e.title=g.title.getPrefixedDBKey(),e.section??(e.section=g.section))}const n=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),s=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),o=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),a=await this.getEditFontOptions(),l={...this.DEFAULT_OPTIONS,editSummary:s,editMinor:o,...e};l.editSummary||(l.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:l});const c=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();c.setTitle(m(_i,{children:["Loading: ",m("u",{children:l.title})]})),c.setContent(m("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:m(ai,{})})),c.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:i`Cancel`,method(){c.close()}}),c.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:c,options:l});let u;try{if(u=await this.getWikiPageFromPayload(l),u.pageInfo.special)throw new Error(i`Special page is not editable.`)}catch(g){c.off(c.Event.Close),c.close(),this.ctx.modal.notify("error",{content:g instanceof Error?g.message:String(g)});return}const f=l.section==="new"?"":u.revisions[0]?.content||"",h=u.revisions[0]?.revid,p=h&&h!==u.lastrevid,d=l.section==="new",w=u.pageid===0;c.setTitle(m(_i,{children:[d?i`New Section`:i`Quick ${w?"Create":"Edit"}`,": ",m("u",{children:u.pageInfo.title}),p?` (${i`Revision`} ${h})`:""]}));const S=[];w&&S.push(m(Qo,{title:i`Attention`,type:"important",children:m("p",{children:i`This page does not exist.`})})),p&&S.push(m(Qo,{title:i`Attention`,type:"warning",children:m("p",{innerHTML:i`You are editing a <em>historical version</em>; the content is not the latest!`})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:l,modal:c,wikiPage:u,editNotices:S});const E=m("form",{className:"ipe-quickEdit__form",children:[m("div",{className:"ipe-quickEdit__notices",children:S}),m("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[l.section==="new"&&m(_i,{children:m(Hr,{label:i`Section title`,id:"summary",name:"summary",value:"",inputProps:{placeholder:i`Topic for new section, this will be the h2 heading`}})}),m("textarea",{className:`ipe-quickEdit__textarea ${a.className}`,style:{fontFamily:a.fontFamily},name:"text",id:"wpTextbox1",children:f})]}),m("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!d&&m(Hr,{label:i`Summary`,id:"summary",name:"summary",value:l.editSummary}),m("div",{className:"ipe-input-box",children:[m("label",{htmlFor:"watchlist",style:{display:"block"},children:i`Watchlist`}),m("div",{style:{display:"flex",gap:"1rem"},children:[at.preferences,at.nochange,at.watch,at.unwatch].map(g=>m(xb,{name:"watchlist",value:g,inputProps:{checked:r===g},children:i`watchlist.${g}`},g))})]}),m("div",{style:{display:"flex",gap:"1rem"},children:[m(Ui,{name:"minor",id:"minor",checked:l.editMinor,children:i`Minor edit`}),m(Ui,{name:"reloadAfterSave",id:"reloadAfterSave",checked:l.reloadAfterSave,children:i`Reload after save`})]})]}),!1]});c.setContent(E),c.addButton({side:"left",className:"is-primary submit-btn",label:i`Submit`,keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const g=new FormData(E);c.setLoadingState(!0),this.handleSubmit({wikiPage:u,text:g.get("text"),summary:g.get("summary"),minor:g.get("minor")==="on",section:l.section,createonly:u.pageid===0,watchlist:r}).then(async()=>{c.setOptions({beforeClose:Go}),c.close(),this.ctx.modal.notify("success",{title:i`Submission Successful`,content:i`Your changes have been saved.`}),g.get("reloadAfterSave")&&(await Sb(500),location.reload())}).catch(y=>{this.ctx.modal.notify("error",{title:i`Submission Error`,content:y instanceof Error?y.message:String(y)}),c.setLoadingState(!1)})}},0),c.setOptions({beforeClose:()=>{const g=u.revisions[0]?.content||"";return(E.querySelector("textarea")?.value||"")===g?!0:(this.ctx.modal.confirm({className:"is-primary",title:i`Unsaved Changes`,content:i`All edit contents will be lost after closing the modal. Are you sure you want to close?`,center:!0,okBtn:{label:i`Give Up`,className:"is-danger is-ghost"},cancelBtn:{label:i`Continue Editing`,className:"is-primary is-ghost"}},v=>(v&&(c.setOptions({beforeClose:Go}),c.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:l,modal:c,wikiPage:u});const M=g=>E.querySelector("textarea")?.value===f?!0:(g.preventDefault(),i`You have unsaved changes. Are you sure you want to leave?`);window.addEventListener("beforeunload",M),c.on(c.Event.Close,()=>{window.removeEventListener("beforeunload",M)})}async handleSubmit(e){const i=e.wikiPage,n=e.summary||"",r=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return this.ctx.emit("quick-edit/submit",{ctx:this.ctx,wikiPage:i,summary:n,text:r,minor:s,createonly:o,watchlist:a}),i.edit({summary:n,text:r,watchlist:a,section:l},{minor:s,createonly:o})}async getEditFontOptions(){const e=await this.ctx.preferences.get("quickEdit.editFont");return yi.BUILT_IN_FONT_OPTIONS.includes(e)?{className:`mw-editfont-${e==="preferences"?this.ctx.wiki.userOptions?.editfont||"monospace":e}`,fontFamily:""}:{className:"mw-editfont-custom",fontFamily:e}}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.$,n=this.ctx.currentPage.wikiTitle,r=n&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),m("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),m("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:()=>r?i`Quick Edit`:i`Not editable`,onClick:()=>{const s=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:n?.getPrefixedText(),revision:s?Number(s):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}},yi.BUILT_IN_FONT_OPTIONS=["preferences","monospace","sans-serif","serif"],yi);Jo=Cb(lf),zr=Tb(Jo,0,"PluginQuickEdit",af,zr),Ob(Jo,1,zr);const Lb=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickEdit:zr},Symbol.toStringTag,{value:"Module"})),An={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},cf=t=>{const{inputs:e,enableSwap:i=!0,...n}=t,r=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(d=>d&&d.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const d=s[0],w=s[1],S=d.value,E=w.value;d.value=E,w.value=S,d.dispatchEvent(new Event("change")),w.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=d=>{if(!a)return;const w=d??!a.disabled;a.disabled=!w,w&&s.forEach(S=>{S&&(S.disabled=!1)})},h=m("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!i,ref:d=>a=d,children:m("svg",{ref:d=>l=d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M20 10h-16l5.5 -6"}),m("path",{d:"M4 14h16l-5.5 6"})]})}),p=m("div",{className:`twin-swap-input ${An.twinSwapInput}`,...n,children:[r.map((d,w)=>{const{label:S,id:E,name:M,value:g,disabled:y,required:v,inputProps:x}=d,P=w===0,L=E||M;return m("div",{className:`${An.inputWrapper} ${P?An.inputLeft:An.inputRight}`,children:[S&&m("label",{htmlFor:L,children:S}),m("input",{ref:C=>s[w]=C,type:"text",id:L,name:M,value:g,disabled:y,required:v,...x})]})}),m("div",{className:An.swapButton,children:h})]});return p.swap=u,p.toggleEnableSwap=f,p};var Mb=Object.create,Zo=Object.defineProperty,Nb=Object.getOwnPropertyDescriptor,uf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ff=t=>{throw TypeError(t)},Db=(t,e,i)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,jb=(t,e)=>Zo(t,"name",{value:e,configurable:!0}),Ub=t=>[,,,Mb(t?.[uf("metadata")]??null)],Bb=["class","method","getter","setter","accessor","field","value","get","set"],df=t=>t!==void 0&&typeof t!="function"?ff("Function expected"):t,Fb=(t,e,i,n,r)=>({kind:Bb[t],name:e,metadata:n,addInitializer:s=>i._?ff("Already initialized"):r.push(df(s||null))}),qb=(t,e)=>Db(e,uf("metadata"),t[3]),Hb=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},zb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Nb(r,i));jb(r,i);for(var d=n.length-1;d>=0;d--)l=Fb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,df(o)&&(r=o);return qb(t,r),p&&Zo(r,i,p),u?c^4?s:p:r},hf,ea,pf;hf=[Vt(R.object({"quickMove.reason":R.string().default("[IPE-NEXT] Quick move")}).description("Quick move options").extra("category","editor")),Ee(["modal","wiki","$"])];class Kr extends(pf=et){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this)}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const i=e.$,n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),m("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),m("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),m("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),m("path",{d:"M17 12h.01"}),m("path",{d:"M13 12h.01"})]}),tooltip:()=>i`Quick Move`,group:"group1",index:1,onClick:()=>{this.showModal(r?{lockFromField:!0,from:n}:{})}})}async showModal(e){const i=this.ctx.$,n=await this.ctx.preferences.get("quickMove.reason"),r=this.ctx.modal.createObject({title:i`Quick Move`,content:m(ai,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return r.setContent(m("form",{ref:o=>s=o,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:o=>{if(o.preventDefault(),s?.checkValidity(),!s?.reportValidity())return;const a=new FormData(s),l={from:a.get("from")?.toString().trim(),to:a.get("to")?.toString().trim(),reason:a.get("reason")||"",movetalk:a.get("movetalk")==="on",movesubpages:a.get("movesubpages")==="on",noredirect:a.get("noredirect")==="on"};if(!l.from||!l.to){this.ctx.modal.notify("error",{title:i`Failed to move`,content:"From and to are required."});return}this.ctx.emit("quick-move/submit",{ctx:this.ctx,modal:r,payload:l}),r.setLoadingState(!0),this.movePage(l).then(()=>{location.reload()}).catch(c=>{r.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to move`,content:c instanceof Error?c.message:String(c)})})},children:[m(cf,{inputs:[{label:i`Move from`,name:"from",value:e?.from,required:!0},{label:i`Move to`,name:"to",value:e?.to,required:!0}]}),m("div",{children:m(Ui,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:i`Move talk page`})}),m("div",{children:m(Ui,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:i`Move subpages (up to 100)`})}),this.ctx.wiki.hasRight("suppressredirect")&&m("div",{children:m(Ui,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:i`Move without leaving a redirect`})}),m(Hr,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??n??""})]})),r.setButtons([{label:i`Move`,className:"is-primary is-ghost",method:()=>{s?.dispatchEvent(new Event("submit"))}}]),r.show()}async movePage(e){const{from:i,to:n,reason:r="",...s}=e;if(!i||!n)throw new Error("From and to titles are required.");if(i===n)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(n,r,s)}}ea=Ub(pf),Kr=zb(ea,0,"PluginQuickMove",hf,Kr),Hb(ea,1,Kr);const Kb=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return Kr}},Symbol.toStringTag,{value:"Module"}));var Wb=Object.create,ta=Object.defineProperty,Gb=Object.getOwnPropertyDescriptor,gf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),mf=t=>{throw TypeError(t)},Vb=(t,e,i)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Yb=(t,e)=>ta(t,"name",{value:e,configurable:!0}),Qb=t=>[,,,Wb(t?.[gf("metadata")]??null)],Xb=["class","method","getter","setter","accessor","field","value","get","set"],yf=t=>t!==void 0&&typeof t!="function"?mf("Function expected"):t,Jb=(t,e,i,n,r)=>({kind:Xb[t],name:e,metadata:n,addInitializer:s=>i._?mf("Already initialized"):r.push(yf(s||null))}),Zb=(t,e)=>Vb(e,gf("metadata"),t[3]),ev=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},tv=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Gb(r,i));Yb(r,i);for(var d=n.length-1;d>=0;d--)l=Jb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,yf(o)&&(r=o);return Zb(t,r),p&&ta(r,i,p),u?c^4?s:p:r},bf,ia,vf;bf=[Ee(["api","wikiPage","modal","preferences","$"]),Vt(R.object({"quickPreview.keyshortcut":R.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","editor").description("Quick preview options"))];class Wr extends(vf=et){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",nf(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}stop(){}previewWikitext(e,i,n,r,s){const o=this.ctx.$;return n||(n=this.ctx.wikiPage.newBlankPage({title:"API"})),(!r||r.isDestroyed)&&(r=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),r.show(),r.setTitle(o`Preview - Loading...`),r.setContent(m(ai,{})),r.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:r,wikiPage:n}),n.preview(e,i).then(a=>{const{data:{parse:l}}=a;r.setTitle(o(l.title)`Preview - {{ $1 }}`);let c=null;r.setContent(m("section",{children:m("div",{ref:u=>c=u,className:"mw-parser-output",innerHTML:l.text})})),window.mw?.hook&&typeof jQuery=="function"&&window.mw.hook("wikipage.content").fire(jQuery(c)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:r,wikiPage:n,text:e,parseData:l})}).catch(a=>{r.setTitle(o`Preview - Failed`),r.setContent(m(_i,{children:[m("p",{children:o`Failed to preview`}),m("p",{children:a instanceof Error?a.message:String(a)})]}))}),r}async injectQuickEdit({options:e,modal:i,wikiPage:n}){const r=this.ctx.$;let s;i.addButton({label:r`Preview`,side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let o=i.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const a=i.get$content().querySelector('input[name="summary"]')?.value;a&&(o=`==${a}==
24
+ `],...Jg(i))}),e}function Jg({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",n=t.component?t.component.parent==null:!1,r=` at <${du(t.component,t.type,n)}`,s=">"+i;return t.props?[r,...Zg(t.props),s]:[r+s]}function Zg(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(n=>{e.push(...yc(n,t[n]))}),i.length>3&&e.push(" ..."),e}function yc(t,e,i){return _e(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:Ie(e)?(e=yc(t,ie(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):Q(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=ie(e),i?e:[`${t}=`,e])}function Ii(t,e,i,n){try{return n?t(...n):t()}catch(r){gn(r,e,i)}}function Et(t,e,i,n){if(Q(t)){const r=Ii(t,e,i,n);return r&&Fl(r)&&r.catch(s=>{gn(s,e,i)}),r}if(Y(t)){const r=[];for(let s=0;s<t.length;s++)r.push(Et(t[s],e,i,n));return r}}function gn(t,e,i,n=!0){const r=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ne;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){kt(),Ii(s,null,10,[t,l,c]),$t();return}}em(t,i,r,n,o)}function em(t,e,i,n=!0,r=!1){if(r)throw t}const Be=[];let Pt=-1;const Ai=[];let Xt=null,Oi=0;const bc=Promise.resolve();let _r=null;function mn(t){const e=_r||bc;return t?e.then(this?t.bind(this):t):e}function tm(t){let e=Pt+1,i=Be.length;for(;e<i;){const n=e+i>>>1,r=Be[n],s=yn(r);s<t||s===t&&r.flags&2?e=n+1:i=n}return e}function go(t){if(!(t.flags&1)){const e=yn(t),i=Be[Be.length-1];!i||!(t.flags&2)&&e>=yn(i)?Be.push(t):Be.splice(tm(e),0,t),t.flags|=1,vc()}}function vc(){_r||(_r=bc.then(xc))}function im(t){Y(t)?Ai.push(...t):Xt&&t.id===-1?Xt.splice(Oi+1,0,t):t.flags&1||(Ai.push(t),t.flags|=1),vc()}function wc(t,e,i=Pt+1){for(;i<Be.length;i++){const n=Be[i];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Be.splice(i,1),i--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function _c(t){if(Ai.length){const e=[...new Set(Ai)].sort((i,n)=>yn(i)-yn(n));if(Ai.length=0,Xt){Xt.push(...e);return}for(Xt=e,Oi=0;Oi<Xt.length;Oi++){const i=Xt[Oi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}Xt=null,Oi=0}}const yn=t=>t.id==null?t.flags&2?-1:1/0:t.id;function xc(t){try{for(Pt=0;Pt<Be.length;Pt++){const e=Be[Pt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ii(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Pt<Be.length;Pt++){const e=Be[Pt];e&&(e.flags&=-2)}Pt=-1,Be.length=0,_c(),_r=null,(Be.length||Ai.length)&&xc()}}let Ne=null,Sc=null;function xr(t){const e=Ne;return Ne=t,Sc=t&&t.type.__scopeId||null,e}function bn(t,e=Ne,i){if(!e||t._n)return t;const n=(...r)=>{n._d&&ru(-1);const s=xr(e);let o;try{o=t(...r)}finally{xr(s),n._d&&ru(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function kc(t,e){if(Ne===null)return t;const i=Tr(Ne),n=t.dirs||(t.dirs=[]);for(let r=0;r<e.length;r++){let[s,o,a,l=ne]=e[r];s&&(Q(s)&&(s={mounted:s,updated:s}),s.deep&&Ft(o),n.push({dir:s,instance:i,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function ui(t,e,i,n){const r=t.dirs,s=e&&e.dirs;for(let o=0;o<r.length;o++){const a=r[o];s&&(a.oldValue=s[o].value);let l=a.dir[n];l&&(kt(),Et(l,i,8,[t.el,a,t,e]),$t())}}const nm=Symbol("_vte"),rm=t=>t.__isTeleport,sm=Symbol("_leaveCb");function mo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,mo(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function fi(t,e){return Q(t)?Ae({name:t.name},e,{setup:t}):t}function yo(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function $c(t){const e=Lo(),i=pc(null);if(e){const r=e.refs===ne?e.refs={}:e.refs;Object.defineProperty(r,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const Sr=new WeakMap;function vn(t,e,i,n,r=!1){if(Y(t)){t.forEach((d,w)=>vn(d,e&&(Y(e)?e[w]:e),i,n,r));return}if(Ti(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&vn(t,e,i,n.component.subTree);return}const s=n.shapeFlag&4?Tr(n.component):n.el,o=r?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ne?a.refs={}:a.refs,f=a.setupState,h=ie(f),p=f===ne?Ul:d=>se(h,d);if(c!=null&&c!==l){if(Ec(e),_e(c))u[c]=null,p(c)&&(f[c]=null);else if(Ie(c)){c.value=null;const d=e;d.k&&(u[d.k]=null)}}if(Q(l))Ii(l,a,12,[o,u]);else{const d=_e(l),w=Ie(l);if(d||w){const S=()=>{if(t.f){const E=d?p(l)?f[l]:u[l]:l.value;if(r)Y(E)&&Vs(E,s);else if(Y(E))E.includes(s)||E.push(s);else if(d)u[l]=[s],p(l)&&(f[l]=u[l]);else{const M=[s];l.value=M,t.k&&(u[t.k]=M)}}else d?(u[l]=o,p(l)&&(f[l]=o)):w&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const E=()=>{S(),Sr.delete(t)};E.id=-1,Sr.set(t,E),tt(E,i)}else Ec(t),S()}}}function Ec(t){const e=Sr.get(t);e&&(e.flags|=8,Sr.delete(t))}const Pc=t=>t.nodeType===8;fr().requestIdleCallback,fr().cancelIdleCallback;function om(t,e){if(Pc(t)&&t.data==="["){let i=1,n=t.nextSibling;for(;n;){if(n.nodeType===1){if(e(n)===!1)break}else if(Pc(n))if(n.data==="]"){if(--i===0)break}else n.data==="["&&i++;n=n.nextSibling}}else e(t)}const Ti=t=>!!t.type.__asyncLoader;function am(t){Q(t)&&(t={loader:t});const{loader:e,loadingComponent:i,errorComponent:n,delay:r=200,hydrate:s,timeout:o,suspensible:a=!0,onError:l}=t;let c=null,u,f=0;const h=()=>(f++,c=null,p()),p=()=>{let d;return c||(d=c=e().catch(w=>{if(w=w instanceof Error?w:new Error(String(w)),l)return new Promise((S,E)=>{l(w,()=>S(h()),()=>E(w),f+1)});throw w}).then(w=>d!==c&&c?c:(w&&(w.__esModule||w[Symbol.toStringTag]==="Module")&&(w=w.default),u=w,w)))};return fi({name:"AsyncComponentWrapper",__asyncLoader:p,__asyncHydrate(d,w,S){let E=!1;(w.bu||(w.bu=[])).push(()=>E=!0);const M=()=>{E||S()},g=s?()=>{const y=s(M,v=>om(d,v));y&&(w.bum||(w.bum=[])).push(y)}:M;u?g():p().then(()=>!w.isUnmounted&&g())},get __asyncResolved(){return u},setup(){const d=De;if(yo(d),u)return()=>kr(u,d);const w=g=>{c=null,gn(g,d,13,!n)};if(a&&d.suspense||Di)return p().then(g=>()=>kr(g,d)).catch(g=>(w(g),()=>n?Ce(n,{error:g}):null));const S=Ue(!1),E=Ue(),M=Ue(!!r);return r&&setTimeout(()=>{M.value=!1},r),o!=null&&setTimeout(()=>{if(!S.value&&!E.value){const g=new Error(`Async component timed out after ${o}ms.`);w(g),E.value=g}},o),p().then(()=>{S.value=!0,d.parent&&bo(d.parent.vnode)&&d.parent.update()}).catch(g=>{w(g),E.value=g}),()=>{if(S.value&&u)return kr(u,d);if(E.value&&n)return Ce(n,{error:E.value});if(i&&!M.value)return kr(i,d)}}})}function kr(t,e){const{ref:i,props:n,children:r,ce:s}=e.vnode,o=Ce(t,n,r);return o.ref=i,o.ce=s,delete e.vnode.ce,o}const bo=t=>t.type.__isKeepAlive;function lm(t,e){Cc(t,"a",e)}function cm(t,e){Cc(t,"da",e)}function Cc(t,e,i=De){const n=t.__wdc||(t.__wdc=()=>{let r=i;for(;r;){if(r.isDeactivated)return;r=r.parent}return t()});if($r(e,n,i),i){let r=i.parent;for(;r&&r.parent;)bo(r.parent.vnode)&&um(n,e,i,r),r=r.parent}}function um(t,e,i,n){const r=$r(e,t,n,!0);wo(()=>{Vs(n[e],r)},i)}function $r(t,e,i=De,n=!1){if(i){const r=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{kt();const a=Cn(i),l=Et(e,i,t,o);return a(),$t(),l});return n?r.unshift(s):r.push(s),s}}const qt=t=>(e,i=De)=>{(!Di||t==="sp")&&$r(t,(...n)=>e(...n),i)},Rc=qt("bm"),wn=qt("m"),fm=qt("bu"),dm=qt("u"),vo=qt("bum"),wo=qt("um"),hm=qt("sp"),pm=qt("rtg"),gm=qt("rtc");function mm(t,e=De){$r("ec",t,e)}const ym=Symbol.for("v-ndc");function _o(t,e,i,n){let r;const s=i,o=Y(t);if(o||_e(t)){const a=o&&Ri(t);let l=!1,c=!1;a&&(l=!lt(t),c=Qt(t),t=hr(t)),r=new Array(t.length);for(let u=0,f=t.length;u<f;u++)r[u]=e(l?c?br(Oe(t[u])):Oe(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){r=new Array(t);for(let a=0;a<t;a++)r[a]=e(a+1,a,void 0,s)}else if(ye(t))if(t[Symbol.iterator])r=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);r=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];r[l]=e(t[u],u,l,s)}}else r=[];return r}function bm(t,e,i={},n,r){if(Ne.ce||Ne.parent&&Ti(Ne.parent)&&Ne.parent.ce){const c=Object.keys(i).length>0;return oe(),Ir(qe,null,[Ce("slot",i,n)],c?-2:64)}let s=t[e];s&&s._c&&(s._d=!1),oe();const o=s&&Ic(s(i)),a=i.key||o&&o.key,l=Ir(qe,{key:(a&&!Dt(a)?a:`_${e}`)+(!o&&n?"_fb":"")},o||[],o&&t._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),s&&s._c&&(s._d=!0),l}function Ic(t){return t.some(e=>Oo(e)?!(e.type===Ht||e.type===qe&&!Ic(e.children)):!0)?t:null}const xo=t=>t?cu(t)?Tr(t):xo(t.parent):null,_n=Ae(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>xo(t.parent),$root:t=>xo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Lc(t),$forceUpdate:t=>t.f||(t.f=()=>{go(t.update)}),$nextTick:t=>t.n||(t.n=mn.bind(t.proxy)),$watch:t=>Bm.bind(t)}),So=(t,e)=>t!==ne&&!t.__isScriptSetup&&se(t,e),vm={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:n,data:r,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const p=o[e];if(p!==void 0)switch(p){case 1:return n[e];case 2:return r[e];case 4:return i[e];case 3:return s[e]}else{if(So(n,e))return o[e]=1,n[e];if(r!==ne&&se(r,e))return o[e]=2,r[e];if((c=t.propsOptions[0])&&se(c,e))return o[e]=3,s[e];if(i!==ne&&se(i,e))return o[e]=4,i[e];ko&&(o[e]=0)}}const u=_n[e];let f,h;if(u)return e==="$attrs"&&Me(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(i!==ne&&se(i,e))return o[e]=4,i[e];if(h=l.config.globalProperties,se(h,e))return h[e]},set({_:t},e,i){const{data:n,setupState:r,ctx:s}=t;return So(r,e)?(r[e]=i,!0):n!==ne&&se(n,e)?(n[e]=i,!0):se(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:n,appContext:r,propsOptions:s,type:o}},a){let l,c;return!!(i[a]||t!==ne&&a[0]!=="$"&&se(t,a)||So(e,a)||(l=s[0])&&se(l,a)||se(n,a)||se(_n,a)||se(r.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:se(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function Er(t){return Y(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function Ac(t,e){return!t||!e?t||e:Y(t)&&Y(e)?t.concat(e):Ae({},Er(t),Er(e))}let ko=!0;function wm(t){const e=Lc(t),i=t.proxy,n=t.ctx;ko=!1,e.beforeCreate&&Oc(e.beforeCreate,t,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:h,beforeUpdate:p,updated:d,activated:w,deactivated:S,beforeDestroy:E,beforeUnmount:M,destroyed:g,unmounted:y,render:v,renderTracked:x,renderTriggered:P,errorCaptured:L,serverPrefetch:C,expose:U,inheritAttrs:H,components:He,directives:dt,filters:Ki}=e;if(c&&_m(c,n,null),o)for(const me in o){const pe=o[me];Q(pe)&&(n[me]=pe.bind(i))}if(r){const me=r.call(i,i);ye(me)&&(t.data=uo(me))}if(ko=!0,s)for(const me in s){const pe=s[me],bi=Q(pe)?pe.bind(i,i):Q(pe.get)?pe.get.bind(i,i):St,ts=!Q(pe)&&Q(pe.set)?pe.set.bind(i):St,vi=It({get:bi,set:ts});Object.defineProperty(n,me,{enumerable:!0,configurable:!0,get:()=>vi.value,set:At=>vi.value=At})}if(a)for(const me in a)Tc(a[me],n,i,me);if(l){const me=Q(l)?l.call(i):l;Reflect.ownKeys(me).forEach(pe=>{jc(pe,me[pe])})}u&&Oc(u,t,"c");function ce(me,pe){Y(pe)?pe.forEach(bi=>me(bi.bind(i))):pe&&me(pe.bind(i))}if(ce(Rc,f),ce(wn,h),ce(fm,p),ce(dm,d),ce(lm,w),ce(cm,S),ce(mm,L),ce(gm,x),ce(pm,P),ce(vo,M),ce(wo,y),ce(hm,C),Y(U))if(U.length){const me=t.exposed||(t.exposed={});U.forEach(pe=>{Object.defineProperty(me,pe,{get:()=>i[pe],set:bi=>i[pe]=bi,enumerable:!0})})}else t.exposed||(t.exposed={});v&&t.render===St&&(t.render=v),H!=null&&(t.inheritAttrs=H),He&&(t.components=He),dt&&(t.directives=dt),C&&yo(t)}function _m(t,e,i=St){Y(t)&&(t=$o(t));for(const n in t){const r=t[n];let s;ye(r)?"default"in r?s=Sn(r.from||n,r.default,!0):s=Sn(r.from||n):s=Sn(r),Ie(s)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[n]=s}}function Oc(t,e,i){Et(Y(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,i)}function Tc(t,e,i,n){let r=n.includes(".")?Xc(i,n):()=>i[n];if(_e(t)){const s=e[t];Q(s)&&Mi(r,s)}else if(Q(t))Mi(r,t.bind(i));else if(ye(t))if(Y(t))t.forEach(s=>Tc(s,e,i,n));else{const s=Q(t.handler)?t.handler.bind(i):e[t.handler];Q(s)&&Mi(r,s,t)}}function Lc(t){const e=t.type,{mixins:i,extends:n}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!r.length&&!i&&!n?l=e:(l={},r.length&&r.forEach(c=>Pr(l,c,o,!0)),Pr(l,e,o)),ye(e)&&s.set(e,l),l}function Pr(t,e,i,n=!1){const{mixins:r,extends:s}=e;s&&Pr(t,s,i,!0),r&&r.forEach(o=>Pr(t,o,i,!0));for(const o in e)if(!(n&&o==="expose")){const a=xm[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const xm={data:Mc,props:Nc,emits:Nc,methods:xn,computed:xn,beforeCreate:Fe,created:Fe,beforeMount:Fe,mounted:Fe,beforeUpdate:Fe,updated:Fe,beforeDestroy:Fe,beforeUnmount:Fe,destroyed:Fe,unmounted:Fe,activated:Fe,deactivated:Fe,errorCaptured:Fe,serverPrefetch:Fe,components:xn,directives:xn,watch:km,provide:Mc,inject:Sm};function Mc(t,e){return e?t?function(){return Ae(Q(t)?t.call(this,this):t,Q(e)?e.call(this,this):e)}:e:t}function Sm(t,e){return xn($o(t),$o(e))}function $o(t){if(Y(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Fe(t,e){return t?[...new Set([].concat(t,e))]:e}function xn(t,e){return t?Ae(Object.create(null),t,e):e}function Nc(t,e){return t?Y(t)&&Y(e)?[...new Set([...t,...e])]:Ae(Object.create(null),Er(t),Er(e??{})):e}function km(t,e){if(!t)return e;if(!e)return t;const i=Ae(Object.create(null),t);for(const n in e)i[n]=Fe(t[n],e[n]);return i}function Dc(){return{app:null,config:{isNativeTag:Ul,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let $m=0;function Em(t,e){return function(n,r=null){Q(n)||(n=Ae({},n)),r!=null&&!ye(r)&&(r=null);const s=Dc(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:$m++,_component:n,_props:r,_container:null,_context:s,_instance:null,version:ly,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&Q(u.install)?(o.add(u),u.install(c,...f)):Q(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,h){if(!l){const p=c._ceVNode||Ce(n,r);return p.appContext=s,h===!0?h="svg":h===!1&&(h=void 0),t(p,u,h),l=!0,c._container=u,u.__vue_app__=c,Tr(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Et(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=Li;Li=c;try{return u()}finally{Li=f}}};return c}}let Li=null;function jc(t,e){if(De){let i=De.provides;const n=De.parent&&De.parent.provides;n===i&&(i=De.provides=Object.create(n)),i[t]=e}}function Sn(t,e,i=!1){const n=Lo();if(n||Li){let r=Li?Li._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&t in r)return r[t];if(arguments.length>1)return i&&Q(e)?e.call(n&&n.proxy):e}}const Uc={},Bc=()=>Object.create(Uc),Fc=t=>Object.getPrototypeOf(t)===Uc;function Pm(t,e,i,n=!1){const r={},s=Bc();t.propsDefaults=Object.create(null),qc(t,e,r,s);for(const o in t.propsOptions[0])o in r||(r[o]=void 0);i?t.props=n?r:Bg(r):t.type.props?t.props=r:t.props=s,t.attrs=s}function Cm(t,e,i,n){const{props:r,attrs:s,vnode:{patchFlag:o}}=t,a=ie(r),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(Cr(t.emitsOptions,h))continue;const p=e[h];if(l)if(se(s,h))p!==s[h]&&(s[h]=p,c=!0);else{const d=jt(h);r[d]=Eo(l,a,d,p,t,!1)}else p!==s[h]&&(s[h]=p,c=!0)}}}else{qc(t,e,r,s)&&(c=!0);let u;for(const f in a)(!e||!se(e,f)&&((u=Yt(f))===f||!se(e,u)))&&(l?i&&(i[f]!==void 0||i[u]!==void 0)&&(r[f]=Eo(l,a,f,void 0,t,!0)):delete r[f]);if(s!==a)for(const f in s)(!e||!se(e,f))&&(delete s[f],c=!0)}c&&Ut(t.attrs,"set","")}function qc(t,e,i,n){const[r,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(ln(l))continue;const c=e[l];let u;r&&se(r,u=jt(l))?!s||!s.includes(u)?i[u]=c:(a||(a={}))[u]=c:Cr(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(s){const l=ie(i),c=a||ne;for(let u=0;u<s.length;u++){const f=s[u];i[f]=Eo(r,l,f,c[f],t,!se(c,f))}}return o}function Eo(t,e,i,n,r,s){const o=t[i];if(o!=null){const a=se(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Q(l)){const{propsDefaults:c}=r;if(i in c)n=c[i];else{const u=Cn(r);n=c[i]=l.call(null,e),u()}}else n=l;r.ce&&r.ce._setProp(i,n)}o[0]&&(s&&!a?n=!1:o[1]&&(n===""||n===Yt(i))&&(n=!0))}return n}const Rm=new WeakMap;function Hc(t,e,i=!1){const n=i?Rm:e.propsCache,r=n.get(t);if(r)return r;const s=t.props,o={},a=[];let l=!1;if(!Q(t)){const u=f=>{l=!0;const[h,p]=Hc(f,e,!0);Ae(o,h),p&&a.push(...p)};!i&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return ye(t)&&n.set(t,Ei),Ei;if(Y(s))for(let u=0;u<s.length;u++){const f=jt(s[u]);zc(f)&&(o[f]=ne)}else if(s)for(const u in s){const f=jt(u);if(zc(f)){const h=s[u],p=o[f]=Y(h)||Q(h)?{type:h}:Ae({},h),d=p.type;let w=!1,S=!0;if(Y(d))for(let E=0;E<d.length;++E){const M=d[E],g=Q(M)&&M.name;if(g==="Boolean"){w=!0;break}else g==="String"&&(S=!1)}else w=Q(d)&&d.name==="Boolean";p[0]=w,p[1]=S,(w||se(p,"default"))&&a.push(f)}}const c=[o,a];return ye(t)&&n.set(t,c),c}function zc(t){return t[0]!=="$"&&!ln(t)}const Po=t=>t==="_"||t==="_ctx"||t==="$stable",Co=t=>Y(t)?t.map(Ct):[Ct(t)],Im=(t,e,i)=>{if(e._n)return e;const n=bn((...r)=>Co(e(...r)),i);return n._c=!1,n},Kc=(t,e,i)=>{const n=t._ctx;for(const r in t){if(Po(r))continue;const s=t[r];if(Q(s))e[r]=Im(r,s,n);else if(s!=null){const o=Co(s);e[r]=()=>o}}},Wc=(t,e)=>{const i=Co(e);t.slots.default=()=>i},Gc=(t,e,i)=>{for(const n in e)(i||!Po(n))&&(t[n]=e[n])},Am=(t,e,i)=>{const n=t.slots=Bc();if(t.vnode.shapeFlag&32){const r=e._;r?(Gc(n,e,i),i&&Kl(n,"_",r,!0)):Kc(e,n)}else e&&Wc(t,e)},Om=(t,e,i)=>{const{vnode:n,slots:r}=t;let s=!0,o=ne;if(n.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Gc(r,e,i):(s=!e.$stable,Kc(e,r)),o=e}else e&&(Wc(t,e),o={default:1});if(s)for(const a in r)!Po(a)&&o[a]==null&&delete r[a]},tt=Gm;function Tm(t){return Lm(t)}function Lm(t,e){const i=fr();i.__VUE__=!0;const{insert:n,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:h,setScopeId:p=St,insertStaticContent:d}=t,w=(b,_,k,T=null,I=null,A=null,B=void 0,j=null,N=!!_.dynamicChildren)=>{if(b===_)return;b&&!En(b,_)&&(T=is(b),At(b,I,A,!0),b=null),_.patchFlag===-2&&(N=!1,_.dynamicChildren=null);const{type:O,ref:K,shapeFlag:q}=_;switch(O){case Rr:S(b,_,k,T);break;case Ht:E(b,_,k,T);break;case Ao:b==null&&M(_,k,T,B);break;case qe:He(b,_,k,T,I,A,B,j,N);break;default:q&1?v(b,_,k,T,I,A,B,j,N):q&6?dt(b,_,k,T,I,A,B,j,N):(q&64||q&128)&&O.process(b,_,k,T,I,A,B,j,N,jn)}K!=null&&I?vn(K,b&&b.ref,A,_||b,!_):K==null&&b&&b.ref!=null&&vn(b.ref,null,A,b,!0)},S=(b,_,k,T)=>{if(b==null)n(_.el=a(_.children),k,T);else{const I=_.el=b.el;_.children!==b.children&&c(I,_.children)}},E=(b,_,k,T)=>{b==null?n(_.el=l(_.children||""),k,T):_.el=b.el},M=(b,_,k,T)=>{[b.el,b.anchor]=d(b.children,_,k,T,b.el,b.anchor)},g=({el:b,anchor:_},k,T)=>{let I;for(;b&&b!==_;)I=h(b),n(b,k,T),b=I;n(_,k,T)},y=({el:b,anchor:_})=>{let k;for(;b&&b!==_;)k=h(b),r(b),b=k;r(_)},v=(b,_,k,T,I,A,B,j,N)=>{if(_.type==="svg"?B="svg":_.type==="math"&&(B="mathml"),b==null)x(_,k,T,I,A,B,j,N);else{const O=b.el&&b.el._isVueCE?b.el:null;try{O&&O._beginPatch(),C(b,_,I,A,B,j,N)}finally{O&&O._endPatch()}}},x=(b,_,k,T,I,A,B,j)=>{let N,O;const{props:K,shapeFlag:q,transition:z,dirs:X}=b;if(N=b.el=o(b.type,A,K&&K.is,K),q&8?u(N,b.children):q&16&&L(b.children,N,null,T,I,Ro(b,A),B,j),X&&ui(b,null,T,"created"),P(N,b,b.scopeId,B,T),K){for(const ge in K)ge!=="value"&&!ln(ge)&&s(N,ge,null,K[ge],A,T);"value"in K&&s(N,"value",null,K.value,A),(O=K.onVnodeBeforeMount)&&Rt(O,T,b)}X&&ui(b,null,T,"beforeMount");const te=Mm(I,z);te&&z.beforeEnter(N),n(N,_,k),((O=K&&K.onVnodeMounted)||te||X)&&tt(()=>{O&&Rt(O,T,b),te&&z.enter(N),X&&ui(b,null,T,"mounted")},I)},P=(b,_,k,T,I)=>{if(k&&p(b,k),T)for(let A=0;A<T.length;A++)p(b,T[A]);if(I){let A=I.subTree;if(_===A||nu(A.type)&&(A.ssContent===_||A.ssFallback===_)){const B=I.vnode;P(b,B,B.scopeId,B.slotScopeIds,I.parent)}}},L=(b,_,k,T,I,A,B,j,N=0)=>{for(let O=N;O<b.length;O++){const K=b[O]=j?Zt(b[O]):Ct(b[O]);w(null,K,_,k,T,I,A,B,j)}},C=(b,_,k,T,I,A,B)=>{const j=_.el=b.el;let{patchFlag:N,dynamicChildren:O,dirs:K}=_;N|=b.patchFlag&16;const q=b.props||ne,z=_.props||ne;let X;if(k&&di(k,!1),(X=z.onVnodeBeforeUpdate)&&Rt(X,k,_,b),K&&ui(_,b,k,"beforeUpdate"),k&&di(k,!0),(q.innerHTML&&z.innerHTML==null||q.textContent&&z.textContent==null)&&u(j,""),O?U(b.dynamicChildren,O,j,k,T,Ro(_,I),A):B||pe(b,_,j,null,k,T,Ro(_,I),A,!1),N>0){if(N&16)H(j,q,z,k,I);else if(N&2&&q.class!==z.class&&s(j,"class",null,z.class,I),N&4&&s(j,"style",q.style,z.style,I),N&8){const te=_.dynamicProps;for(let ge=0;ge<te.length;ge++){const le=te[ge],Xe=q[le],Je=z[le];(Je!==Xe||le==="value")&&s(j,le,Xe,Je,I,k)}}N&1&&b.children!==_.children&&u(j,_.children)}else!B&&O==null&&H(j,q,z,k,I);((X=z.onVnodeUpdated)||K)&&tt(()=>{X&&Rt(X,k,_,b),K&&ui(_,b,k,"updated")},T)},U=(b,_,k,T,I,A,B)=>{for(let j=0;j<_.length;j++){const N=b[j],O=_[j],K=N.el&&(N.type===qe||!En(N,O)||N.shapeFlag&198)?f(N.el):k;w(N,O,K,null,T,I,A,B,!0)}},H=(b,_,k,T,I)=>{if(_!==k){if(_!==ne)for(const A in _)!ln(A)&&!(A in k)&&s(b,A,_[A],null,I,T);for(const A in k){if(ln(A))continue;const B=k[A],j=_[A];B!==j&&A!=="value"&&s(b,A,j,B,I,T)}"value"in k&&s(b,"value",_.value,k.value,I)}},He=(b,_,k,T,I,A,B,j,N)=>{const O=_.el=b?b.el:a(""),K=_.anchor=b?b.anchor:a("");let{patchFlag:q,dynamicChildren:z,slotScopeIds:X}=_;X&&(j=j?j.concat(X):X),b==null?(n(O,k,T),n(K,k,T),L(_.children||[],k,K,I,A,B,j,N)):q>0&&q&64&&z&&b.dynamicChildren?(U(b.dynamicChildren,z,k,I,A,B,j),(_.key!=null||I&&_===I.subTree)&&Vc(b,_,!0)):pe(b,_,k,K,I,A,B,j,N)},dt=(b,_,k,T,I,A,B,j,N)=>{_.slotScopeIds=j,b==null?_.shapeFlag&512?I.ctx.activate(_,k,T,B,N):Ki(_,k,T,I,A,B,N):ke(b,_,N)},Ki=(b,_,k,T,I,A,B)=>{const j=b.component=Zm(b,T,I);if(bo(b)&&(j.ctx.renderer=jn),ey(j,!1,B),j.asyncDep){if(I&&I.registerDep(j,ce,B),!b.el){const N=j.subTree=Ce(Ht);E(null,N,_,k),b.placeholder=N.el}}else ce(j,b,_,k,I,A,B)},ke=(b,_,k)=>{const T=_.component=b.component;if(Km(b,_,k))if(T.asyncDep&&!T.asyncResolved){me(T,_,k);return}else T.next=_,T.update();else _.el=b.el,T.vnode=_},ce=(b,_,k,T,I,A,B)=>{const j=()=>{if(b.isMounted){let{next:q,bu:z,u:X,parent:te,vnode:ge}=b;{const Tt=Yc(b);if(Tt){q&&(q.el=ge.el,me(b,q,B)),Tt.asyncDep.then(()=>{b.isUnmounted||j()});return}}let le=q,Xe;di(b,!1),q?(q.el=ge.el,me(b,q,B)):q=ge,z&&ur(z),(Xe=q.props&&q.props.onVnodeBeforeUpdate)&&Rt(Xe,te,q,ge),di(b,!0);const Je=tu(b),Ot=b.subTree;b.subTree=Je,w(Ot,Je,f(Ot.el),is(Ot),b,I,A),q.el=Je.el,le===null&&Wm(b,Je.el),X&&tt(X,I),(Xe=q.props&&q.props.onVnodeUpdated)&&tt(()=>Rt(Xe,te,q,ge),I)}else{let q;const{el:z,props:X}=_,{bm:te,m:ge,parent:le,root:Xe,type:Je}=b,Ot=Ti(_);di(b,!1),te&&ur(te),!Ot&&(q=X&&X.onVnodeBeforeMount)&&Rt(q,le,_),di(b,!0);{Xe.ce&&Xe.ce._def.shadowRoot!==!1&&Xe.ce._injectChildStyle(Je);const Tt=b.subTree=tu(b);w(null,Tt,k,T,b,I,A),_.el=Tt.el}if(ge&&tt(ge,I),!Ot&&(q=X&&X.onVnodeMounted)){const Tt=_;tt(()=>Rt(q,le,Tt),I)}(_.shapeFlag&256||le&&Ti(le.vnode)&&le.vnode.shapeFlag&256)&&b.a&&tt(b.a,I),b.isMounted=!0,_=k=T=null}};b.scope.on();const N=b.effect=new Ql(j);b.scope.off();const O=b.update=N.run.bind(N),K=b.job=N.runIfDirty.bind(N);K.i=b,K.id=b.uid,N.scheduler=()=>go(K),di(b,!0),O()},me=(b,_,k)=>{_.component=b;const T=b.vnode.props;b.vnode=_,b.next=null,Cm(b,_.props,T,k),Om(b,_.children,k),kt(),wc(b),$t()},pe=(b,_,k,T,I,A,B,j,N=!1)=>{const O=b&&b.children,K=b?b.shapeFlag:0,q=_.children,{patchFlag:z,shapeFlag:X}=_;if(z>0){if(z&128){ts(O,q,k,T,I,A,B,j,N);return}else if(z&256){bi(O,q,k,T,I,A,B,j,N);return}}X&8?(K&16&&Dn(O,I,A),q!==O&&u(k,q)):K&16?X&16?ts(O,q,k,T,I,A,B,j,N):Dn(O,I,A,!0):(K&8&&u(k,""),X&16&&L(q,k,T,I,A,B,j,N))},bi=(b,_,k,T,I,A,B,j,N)=>{b=b||Ei,_=_||Ei;const O=b.length,K=_.length,q=Math.min(O,K);let z;for(z=0;z<q;z++){const X=_[z]=N?Zt(_[z]):Ct(_[z]);w(b[z],X,k,null,I,A,B,j,N)}O>K?Dn(b,I,A,!0,!1,q):L(_,k,T,I,A,B,j,N,q)},ts=(b,_,k,T,I,A,B,j,N)=>{let O=0;const K=_.length;let q=b.length-1,z=K-1;for(;O<=q&&O<=z;){const X=b[O],te=_[O]=N?Zt(_[O]):Ct(_[O]);if(En(X,te))w(X,te,k,null,I,A,B,j,N);else break;O++}for(;O<=q&&O<=z;){const X=b[q],te=_[z]=N?Zt(_[z]):Ct(_[z]);if(En(X,te))w(X,te,k,null,I,A,B,j,N);else break;q--,z--}if(O>q){if(O<=z){const X=z+1,te=X<K?_[X].el:T;for(;O<=z;)w(null,_[O]=N?Zt(_[O]):Ct(_[O]),k,te,I,A,B,j,N),O++}}else if(O>z)for(;O<=q;)At(b[O],I,A,!0),O++;else{const X=O,te=O,ge=new Map;for(O=te;O<=z;O++){const st=_[O]=N?Zt(_[O]):Ct(_[O]);st.key!=null&&ge.set(st.key,O)}let le,Xe=0;const Je=z-te+1;let Ot=!1,Tt=0;const Un=new Array(Je);for(O=0;O<Je;O++)Un[O]=0;for(O=X;O<=q;O++){const st=b[O];if(Xe>=Je){At(st,I,A,!0);continue}let Lt;if(st.key!=null)Lt=ge.get(st.key);else for(le=te;le<=z;le++)if(Un[le-te]===0&&En(st,_[le])){Lt=le;break}Lt===void 0?At(st,I,A,!0):(Un[Lt-te]=O+1,Lt>=Tt?Tt=Lt:Ot=!0,w(st,_[Lt],k,null,I,A,B,j,N),Xe++)}const jf=Ot?Nm(Un):Ei;for(le=jf.length-1,O=Je-1;O>=0;O--){const st=te+O,Lt=_[st],Uf=_[st+1],Bf=st+1<K?Uf.el||Uf.placeholder:T;Un[O]===0?w(null,Lt,k,Bf,I,A,B,j,N):Ot&&(le<0||O!==jf[le]?vi(Lt,k,Bf,2):le--)}}},vi=(b,_,k,T,I=null)=>{const{el:A,type:B,transition:j,children:N,shapeFlag:O}=b;if(O&6){vi(b.component.subTree,_,k,T);return}if(O&128){b.suspense.move(_,k,T);return}if(O&64){B.move(b,_,k,jn);return}if(B===qe){n(A,_,k);for(let q=0;q<N.length;q++)vi(N[q],_,k,T);n(b.anchor,_,k);return}if(B===Ao){g(b,_,k);return}if(T!==2&&O&1&&j)if(T===0)j.beforeEnter(A),n(A,_,k),tt(()=>j.enter(A),I);else{const{leave:q,delayLeave:z,afterLeave:X}=j,te=()=>{b.ctx.isUnmounted?r(A):n(A,_,k)},ge=()=>{A._isLeaving&&A[sm](!0),q(A,()=>{te(),X&&X()})};z?z(A,te,ge):ge()}else n(A,_,k)},At=(b,_,k,T=!1,I=!1)=>{const{type:A,props:B,ref:j,children:N,dynamicChildren:O,shapeFlag:K,patchFlag:q,dirs:z,cacheIndex:X}=b;if(q===-2&&(I=!1),j!=null&&(kt(),vn(j,null,k,b,!0),$t()),X!=null&&(_.renderCache[X]=void 0),K&256){_.ctx.deactivate(b);return}const te=K&1&&z,ge=!Ti(b);let le;if(ge&&(le=B&&B.onVnodeBeforeUnmount)&&Rt(le,_,b),K&6)Lw(b.component,k,T);else{if(K&128){b.suspense.unmount(k,T);return}te&&ui(b,null,_,"beforeUnmount"),K&64?b.type.remove(b,_,k,jn,T):O&&!O.hasOnce&&(A!==qe||q>0&&q&64)?Dn(O,_,k,!1,!0):(A===qe&&q&384||!I&&K&16)&&Dn(N,_,k),T&&Nf(b)}(ge&&(le=B&&B.onVnodeUnmounted)||te)&&tt(()=>{le&&Rt(le,_,b),te&&ui(b,null,_,"unmounted")},k)},Nf=b=>{const{type:_,el:k,anchor:T,transition:I}=b;if(_===qe){Tw(k,T);return}if(_===Ao){y(b);return}const A=()=>{r(k),I&&!I.persisted&&I.afterLeave&&I.afterLeave()};if(b.shapeFlag&1&&I&&!I.persisted){const{leave:B,delayLeave:j}=I,N=()=>B(k,A);j?j(b.el,A,N):N()}else A()},Tw=(b,_)=>{let k;for(;b!==_;)k=h(b),r(b),b=k;r(_)},Lw=(b,_,k)=>{const{bum:T,scope:I,job:A,subTree:B,um:j,m:N,a:O}=b;Qc(N),Qc(O),T&&ur(T),I.stop(),A&&(A.flags|=8,At(B,b,_,k)),j&&tt(j,_),tt(()=>{b.isUnmounted=!0},_)},Dn=(b,_,k,T=!1,I=!1,A=0)=>{for(let B=A;B<b.length;B++)At(b[B],_,k,T,I)},is=b=>{if(b.shapeFlag&6)return is(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const _=h(b.anchor||b.el),k=_&&_[nm];return k?h(k):_};let fa=!1;const Df=(b,_,k)=>{b==null?_._vnode&&At(_._vnode,null,null,!0):w(_._vnode||null,b,_,null,null,null,k),_._vnode=b,fa||(fa=!0,wc(),_c(),fa=!1)},jn={p:w,um:At,m:vi,r:Nf,mt:Ki,mc:L,pc:pe,pbc:U,n:is,o:t};return{render:Df,hydrate:void 0,createApp:Em(Df)}}function Ro({type:t,props:e},i){return i==="svg"&&t==="foreignObject"||i==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:i}function di({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Mm(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Vc(t,e,i=!1){const n=t.children,r=e.children;if(Y(n)&&Y(r))for(let s=0;s<n.length;s++){const o=n[s];let a=r[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[s]=Zt(r[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Vc(o,a)),a.type===Rr&&a.patchFlag!==-1&&(a.el=o.el),a.type===Ht&&!a.el&&(a.el=o.el)}}function Nm(t){const e=t.slice(),i=[0];let n,r,s,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(r=i[i.length-1],t[r]<c){e[n]=r,i.push(n);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<c?s=a+1:o=a;c<t[i[s]]&&(s>0&&(e[n]=i[s-1]),i[s]=n)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function Yc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Yc(e)}function Qc(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const Dm=Symbol.for("v-scx"),jm=()=>Sn(Dm);function Um(t,e){return Io(t,null,{flush:"sync"})}function Mi(t,e,i){return Io(t,e,i)}function Io(t,e,i=ne){const{immediate:n,deep:r,flush:s,once:o}=i,a=Ae({},i),l=e&&n||!e&&s!=="post";let c;if(Di){if(s==="sync"){const p=jm();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=St,p.resume=St,p.pause=St,p}}const u=De;a.call=(p,d,w)=>Et(p,u,d,w);let f=!1;s==="post"?a.scheduler=p=>{tt(p,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(p,d)=>{d?p():go(p)}),a.augmentJob=p=>{e&&(p.flags|=4),f&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const h=Yg(t,e,a);return Di&&(c?c.push(h):l&&h()),h}function Bm(t,e,i){const n=this.proxy,r=_e(t)?t.includes(".")?Xc(n,t):()=>n[t]:t.bind(n,n);let s;Q(e)?s=e:(s=e.handler,i=e);const o=Cn(this),a=Io(r,s.bind(n),i);return o(),a}function Xc(t,e){const i=e.split(".");return()=>{let n=t;for(let r=0;r<i.length&&n;r++)n=n[i[r]];return n}}function Jc(t,e,i=ne){const n=Lo(),r=jt(e),s=Yt(e),o=Zc(t,r),a=Kg((l,c)=>{let u,f=ne,h;return Um(()=>{const p=t[r];Ve(u,p)&&(u=p,c())}),{get(){return l(),i.get?i.get(u):u},set(p){const d=i.set?i.set(p):p;if(!Ve(d,u)&&!(f!==ne&&Ve(p,f)))return;const w=n.vnode.props;w&&(e in w||r in w||s in w)&&(`onUpdate:${e}`in w||`onUpdate:${r}`in w||`onUpdate:${s}`in w)||(u=p,c()),n.emit(`update:${e}`,d),Ve(p,d)&&Ve(p,f)&&!Ve(d,h)&&c(),f=p,h=d}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||ne:a,done:!1}:{done:!0}}}},a}const Zc=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${jt(e)}Modifiers`]||t[`${Yt(e)}Modifiers`];function Fm(t,e,...i){if(t.isUnmounted)return;const n=t.vnode.props||ne;let r=i;const s=e.startsWith("update:"),o=s&&Zc(n,e.slice(7));o&&(o.trim&&(r=i.map(u=>_e(u)?u.trim():u)),o.number&&(r=i.map(Xs)));let a,l=n[a=Qs(e)]||n[a=Qs(jt(e))];!l&&s&&(l=n[a=Qs(Yt(e))]),l&&Et(l,t,6,r);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,Et(c,t,6,r)}}const qm=new WeakMap;function eu(t,e,i=!1){const n=i?qm:e.emitsCache,r=n.get(t);if(r!==void 0)return r;const s=t.emits;let o={},a=!1;if(!Q(t)){const l=c=>{const u=eu(c,e,!0);u&&(a=!0,Ae(o,u))};!i&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(ye(t)&&n.set(t,null),null):(Y(s)?s.forEach(l=>o[l]=null):Ae(o,s),ye(t)&&n.set(t,o),o)}function Cr(t,e){return!t||!ar(e)?!1:(e=e.slice(2).replace(/Once$/,""),se(t,e[0].toLowerCase()+e.slice(1))||se(t,Yt(e))||se(t,e))}function Fw(){}function tu(t){const{type:e,vnode:i,proxy:n,withProxy:r,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:h,setupState:p,ctx:d,inheritAttrs:w}=t,S=xr(t);let E,M;try{if(i.shapeFlag&4){const y=r||n,v=y;E=Ct(c.call(v,y,u,f,p,h,d)),M=a}else{const y=e;E=Ct(y.length>1?y(f,{attrs:a,slots:o,emit:l}):y(f,null)),M=e.props?a:Hm(a)}}catch(y){kn.length=0,gn(y,t,1),E=Ce(Ht)}let g=E;if(M&&w!==!1){const y=Object.keys(M),{shapeFlag:v}=g;y.length&&v&7&&(s&&y.some(Gs)&&(M=zm(M,s)),g=Ni(g,M,!1,!0))}return i.dirs&&(g=Ni(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(i.dirs):i.dirs),i.transition&&mo(g,i.transition),E=g,xr(S),E}const Hm=t=>{let e;for(const i in t)(i==="class"||i==="style"||ar(i))&&((e||(e={}))[i]=t[i]);return e},zm=(t,e)=>{const i={};for(const n in t)(!Gs(n)||!(n.slice(9)in e))&&(i[n]=t[n]);return i};function Km(t,e,i){const{props:n,children:r,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&l>=0){if(l&1024)return!0;if(l&16)return n?iu(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(o[h]!==n[h]&&!Cr(c,h))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?iu(n,o,c):!0:!!o;return!1}function iu(t,e,i){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let r=0;r<n.length;r++){const s=n[r];if(e[s]!==t[s]&&!Cr(i,s))return!0}return!1}function Wm({vnode:t,parent:e},i){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.el=t.el),n===t)(t=e.vnode).el=i,e=e.parent;else break}}const nu=t=>t.__isSuspense;function Gm(t,e){e&&e.pendingBranch?Y(t)?e.effects.push(...t):e.effects.push(t):im(t)}const qe=Symbol.for("v-fgt"),Rr=Symbol.for("v-txt"),Ht=Symbol.for("v-cmt"),Ao=Symbol.for("v-stc"),kn=[];let it=null;function oe(t=!1){kn.push(it=t?null:[])}function Vm(){kn.pop(),it=kn[kn.length-1]||null}let $n=1;function ru(t,e=!1){$n+=t,t<0&&it&&e&&(it.hasOnce=!0)}function su(t){return t.dynamicChildren=$n>0?it||Ei:null,Vm(),$n>0&&it&&it.push(t),t}function de(t,e,i,n,r,s){return su(J(t,e,i,n,r,s,!0))}function Ir(t,e,i,n,r){return su(Ce(t,e,i,n,r,!0))}function Oo(t){return t?t.__v_isVNode===!0:!1}function En(t,e){return t.type===e.type&&t.key===e.key}const ou=({key:t})=>t??null,Ar=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?_e(t)||Ie(t)||Q(t)?{i:Ne,r:t,k:e,f:!!i}:t:null);function J(t,e=null,i=null,n=0,r=null,s=t===qe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&ou(e),ref:e&&Ar(e),scopeId:Sc,slotScopeIds:null,children:i,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:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Ne};return a?(To(l,i),s&128&&t.normalize(l)):i&&(l.shapeFlag|=_e(i)?8:16),$n>0&&!o&&it&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&it.push(l),l}const Ce=Ym;function Ym(t,e=null,i=null,n=0,r=null,s=!1){if((!t||t===ym)&&(t=Ht),Oo(t)){const a=Ni(t,e,!0);return i&&To(a,i),$n>0&&!s&&it&&(a.shapeFlag&6?it[it.indexOf(t)]=a:it.push(a)),a.patchFlag=-2,a}if(ay(t)&&(t=t.__vccOpts),e){e=Qm(e);let{class:a,style:l}=e;a&&!_e(a)&&(e.class=pt(a)),ye(l)&&(ho(l)&&!Y(l)&&(l=Ae({},l)),e.style=Js(l))}const o=_e(t)?1:nu(t)?128:rm(t)?64:ye(t)?4:Q(t)?2:0;return J(t,e,i,n,r,o,s,!0)}function Qm(t){return t?ho(t)||Fc(t)?Ae({},t):t:null}function Ni(t,e,i=!1,n=!1){const{props:r,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?au(r||{},e):r,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&ou(c),ref:e&&e.ref?i&&s?Y(s)?s.concat(Ar(e)):[s,Ar(e)]:Ar(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==qe?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ni(t.ssContent),ssFallback:t.ssFallback&&Ni(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&mo(u,l.clone(u)),u}function Pn(t=" ",e=0){return Ce(Rr,null,t,e)}function Jt(t="",e=!1){return e?(oe(),Ir(Ht,null,t)):Ce(Ht,null,t)}function Ct(t){return t==null||typeof t=="boolean"?Ce(Ht):Y(t)?Ce(qe,null,t.slice()):Oo(t)?Zt(t):Ce(Rr,null,String(t))}function Zt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ni(t)}function To(t,e){let i=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(Y(e))i=16;else if(typeof e=="object")if(n&65){const r=e.default;r&&(r._c&&(r._d=!1),To(t,r()),r._c&&(r._d=!0));return}else{i=32;const r=e._;!r&&!Fc(e)?e._ctx=Ne:r===3&&Ne&&(Ne.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Q(e)?(e={default:e,_ctx:Ne},i=32):(e=String(e),n&64?(i=16,e=[Pn(e)]):i=8);t.children=e,t.shapeFlag|=i}function au(...t){const e={};for(let i=0;i<t.length;i++){const n=t[i];for(const r in n)if(r==="class")e.class!==n.class&&(e.class=pt([e.class,n.class]));else if(r==="style")e.style=Js([e.style,n.style]);else if(ar(r)){const s=e[r],o=n[r];o&&s!==o&&!(Y(s)&&s.includes(o))&&(e[r]=s?[].concat(s,o):o)}else r!==""&&(e[r]=n[r])}return e}function Rt(t,e,i,n=null){Et(t,e,7,[i,n])}const Xm=Dc();let Jm=0;function Zm(t,e,i){const n=t.type,r=(e?e.appContext:t.appContext)||Xm,s={uid:Jm++,vnode:t,type:n,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new wg(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Hc(n,r),emitsOptions:eu(n,r),emit:null,emitted:null,propsDefaults:ne,inheritAttrs:n.inheritAttrs,ctx:ne,data:ne,props:ne,attrs:ne,slots:ne,refs:ne,setupState:ne,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=Fm.bind(null,s),t.ce&&t.ce(s),s}let De=null;const Lo=()=>De||Ne;let Or,Mo;{const t=fr(),e=(i,n)=>{let r;return(r=t[i])||(r=t[i]=[]),r.push(n),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};Or=e("__VUE_INSTANCE_SETTERS__",i=>De=i),Mo=e("__VUE_SSR_SETTERS__",i=>Di=i)}const Cn=t=>{const e=De;return Or(t),t.scope.on(),()=>{t.scope.off(),Or(e)}},lu=()=>{De&&De.scope.off(),Or(null)};function cu(t){return t.vnode.shapeFlag&4}let Di=!1;function ey(t,e=!1,i=!1){e&&Mo(e);const{props:n,children:r}=t.vnode,s=cu(t);Pm(t,n,s,e),Am(t,r,i||e);const o=s?ty(t,e):void 0;return e&&Mo(!1),o}function ty(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,vm);const{setup:n}=i;if(n){kt();const r=t.setupContext=n.length>1?ny(t):null,s=Cn(t),o=Ii(n,t,0,[t.props,r]),a=Fl(o);if($t(),s(),(a||t.sp)&&!Ti(t)&&yo(t),a){if(o.then(lu,lu),e)return o.then(l=>{uu(t,l)}).catch(l=>{gn(l,t,0)});t.asyncDep=o}else uu(t,o)}else fu(t)}function uu(t,e,i){Q(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ye(e)&&(t.setupState=mc(e)),fu(t)}function fu(t,e,i){const n=t.type;t.render||(t.render=n.render||St);{const r=Cn(t);kt();try{wm(t)}finally{$t(),r()}}}const iy={get(t,e){return Me(t,"get",""),t[e]}};function ny(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,iy),slots:t.slots,emit:t.emit,expose:e}}function Tr(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(mc(Fg(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in _n)return _n[i](t)},has(e,i){return i in e||i in _n}})):t.proxy}const ry=/(?:^|[-_])\w/g,sy=t=>t.replace(ry,e=>e.toUpperCase()).replace(/[-_]/g,"");function oy(t,e=!0){return Q(t)?t.displayName||t.name:t.name||e&&t.__name}function du(t,e,i=!1){let n=oy(e);if(!n&&e.__file){const r=e.__file.match(/([^/\\]+)\.\w+$/);r&&(n=r[1])}if(!n&&t&&t.parent){const r=s=>{for(const o in s)if(s[o]===e)return o};n=r(t.components||t.parent.type.components)||r(t.appContext.components)}return n?sy(n):i?"App":"Anonymous"}function ay(t){return Q(t)&&"__vccOpts"in t}const It=(t,e)=>Gg(t,e,Di),ly="3.5.24";let No;const hu=typeof window<"u"&&window.trustedTypes;if(hu)try{No=hu.createPolicy("vue",{createHTML:t=>t})}catch{}const pu=No?t=>No.createHTML(t):t=>t,cy="http://www.w3.org/2000/svg",uy="http://www.w3.org/1998/Math/MathML",zt=typeof document<"u"?document:null,gu=zt&&zt.createElement("template"),fy={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,n)=>{const r=e==="svg"?zt.createElementNS(cy,t):e==="mathml"?zt.createElementNS(uy,t):i?zt.createElement(t,{is:i}):zt.createElement(t);return t==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:t=>zt.createTextNode(t),createComment:t=>zt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>zt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,n,r,s){const o=i?i.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),i),!(r===s||!(r=r.nextSibling)););else{gu.innerHTML=pu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=gu.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,i)}return[o?o.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}},dy=Symbol("_vtc");function hy(t,e,i){const n=t[dy];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}const mu=Symbol("_vod"),py=Symbol("_vsh"),gy=Symbol(""),my=/(?:^|;)\s*display\s*:/;function yy(t,e,i){const n=t.style,r=_e(i);let s=!1;if(i&&!r){if(e)if(_e(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();i[a]==null&&Lr(n,a,"")}else for(const o in e)i[o]==null&&Lr(n,o,"");for(const o in i)o==="display"&&(s=!0),Lr(n,o,i[o])}else if(r){if(e!==i){const o=n[gy];o&&(i+=";"+o),n.cssText=i,s=my.test(i)}}else e&&t.removeAttribute("style");mu in t&&(t[mu]=s?n.display:"",t[py]&&(n.display="none"))}const yu=/\s*!important$/;function Lr(t,e,i){if(Y(i))i.forEach(n=>Lr(t,e,n));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const n=by(t,e);yu.test(i)?t.setProperty(Yt(n),i.replace(yu,""),"important"):t[n]=i}}const bu=["Webkit","Moz","ms"],Do={};function by(t,e){const i=Do[e];if(i)return i;let n=jt(e);if(n!=="filter"&&n in t)return Do[e]=n;n=zl(n);for(let r=0;r<bu.length;r++){const s=bu[r]+n;if(s in t)return Do[e]=s}return e}const vu="http://www.w3.org/1999/xlink";function wu(t,e,i,n,r,s=vg(e)){n&&e.startsWith("xlink:")?i==null?t.removeAttributeNS(vu,e.slice(6,e.length)):t.setAttributeNS(vu,e,i):i==null||s&&!Gl(i)?t.removeAttribute(e):t.setAttribute(e,s?"":Dt(i)?String(i):i)}function _u(t,e,i,n,r){if(e==="innerHTML"||e==="textContent"){i!=null&&(t[e]=e==="innerHTML"?pu(i):i);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=i==null?t.type==="checkbox"?"on":"":String(i);(a!==l||!("_value"in t))&&(t.value=l),i==null&&t.removeAttribute(e),t._value=i;return}let o=!1;if(i===""||i==null){const a=typeof t[e];a==="boolean"?i=Gl(i):i==null&&a==="string"?(i="",o=!0):a==="number"&&(i=0,o=!0)}try{t[e]=i}catch{}o&&t.removeAttribute(r||e)}function ji(t,e,i,n){t.addEventListener(e,i,n)}function vy(t,e,i,n){t.removeEventListener(e,i,n)}const xu=Symbol("_vei");function wy(t,e,i,n,r=null){const s=t[xu]||(t[xu]={}),o=s[e];if(n&&o)o.value=n;else{const[a,l]=_y(e);if(n){const c=s[e]=ky(n,r);ji(t,a,c,l)}else o&&(vy(t,a,o,l),s[e]=void 0)}}const Su=/(?:Once|Passive|Capture)$/;function _y(t){let e;if(Su.test(t)){e={};let n;for(;n=t.match(Su);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Yt(t.slice(2)),e]}let jo=0;const xy=Promise.resolve(),Sy=()=>jo||(xy.then(()=>jo=0),jo=Date.now());function ky(t,e){const i=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=i.attached)return;Et($y(n,i.value),e,5,[n])};return i.value=t,i.attached=Sy(),i}function $y(t,e){if(Y(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(n=>r=>!r._stopped&&n&&n(r))}else return e}const ku=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Ey=(t,e,i,n,r,s)=>{const o=r==="svg";e==="class"?hy(t,n,o):e==="style"?yy(t,i,n):ar(e)?Gs(e)||wy(t,e,i,n,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Py(t,e,n,o))?(_u(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&wu(t,e,n,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!_e(n))?_u(t,jt(e),n,s,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),wu(t,e,n,o))};function Py(t,e,i,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&ku(e)&&Q(i));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const r=t.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return ku(e)&&_e(i)?!1:e in t}const $u=t=>{const e=t.props["onUpdate:modelValue"]||!1;return Y(e)?i=>ur(e,i):e};function Cy(t){t.target.composing=!0}function Eu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Uo=Symbol("_assign");function Pu(t,e,i){return e&&(t=t.trim()),i&&(t=Xs(t)),t}const Cu={created(t,{modifiers:{lazy:e,trim:i,number:n}},r){t[Uo]=$u(r);const s=n||r.props&&r.props.type==="number";ji(t,e?"change":"input",o=>{o.target.composing||t[Uo](Pu(t.value,i,s))}),(i||s)&&ji(t,"change",()=>{t.value=Pu(t.value,i,s)}),e||(ji(t,"compositionstart",Cy),ji(t,"compositionend",Eu),ji(t,"change",Eu))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:i,modifiers:{lazy:n,trim:r,number:s}},o){if(t[Uo]=$u(o),t.composing)return;const a=(s||t.type==="number")&&!/^0\d/.test(t.value)?Xs(t.value):t.value,l=e??"";a!==l&&(document.activeElement===t&&t.type!=="range"&&(n&&e===i||r&&t.value.trim()===l)||(t.value=l))}},Ry=Ae({patchProp:Ey},fy);let Ru;function Iy(){return Ru||(Ru=Tm(Ry))}const Ay=((...t)=>{const e=Iy().createApp(...t),{mount:i}=e;return e.mount=n=>{const r=Ty(n);if(!r)return;const s=e._component;!Q(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=i(r,!1,Oy(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e});function Oy(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Ty(t){return _e(t)?document.querySelector(t):t}const Ly=1;var Mr;(t=>{t.PackageLoader=new R(R.object({kind:R.union(["autoload","module","umd","styles"]).required().default("autoload"),entry:R.string(),styles:R.array(R.string()),main_export:R.string()})),t.Package=new R(R.object({id:R.string().required(),name:R.string().required(),version:R.string().required(),description:R.string(),author:R.string(),license:R.string(),loader:t.PackageLoader.required()})),t.RegistryMaintainer=new R(R.object({name:R.string().required(),email:R.string()})),t.RegistryRepository=new R(R.object({type:R.string().required(),url:R.string().required()})),t.Registry=new R(R.object({manifest_version:R.number().min(Ly).required(),name:R.string().required(),base_url:R.string().required(),homepage:R.string(),maintainers:R.array(t.RegistryMaintainer),repository:t.RegistryRepository,packages:R.array(t.Package).required()}))})(Mr||(Mr={}));const Bo=Symbol("IPEInjectKey"),My=(t,e)=>(e?e.provide(Bo,t):jc(Bo,t),t),Fo=()=>{const t=Sn(Bo);if(!t)throw new Error("InPageEdit instance is not provided");return t},Iu=(t,...e)=>{const i=Ay(...e);return My(t,i),i};var Ny=Object.create,qo=Object.defineProperty,Dy=Object.getOwnPropertyDescriptor,Au=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ou=t=>{throw TypeError(t)},jy=(t,e,i)=>e in t?qo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Uy=(t,e)=>qo(t,"name",{value:e,configurable:!0}),By=t=>[,,,Ny(t?.[Au("metadata")]??null)],Fy=["class","method","getter","setter","accessor","field","value","get","set"],Tu=t=>t!==void 0&&typeof t!="function"?Ou("Function expected"):t,qy=(t,e,i,n,r)=>({kind:Fy[t],name:e,metadata:n,addInitializer:s=>i._?Ou("Already initialized"):r.push(Tu(s||null))}),Hy=(t,e)=>jy(e,Au("metadata"),t[3]),zy=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Ky=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Dy(r,i));Uy(r,i);for(var d=n.length-1;d>=0;d--)l=qy(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Tu(o)&&(r=o);return Hy(t,r),p&&qo(r,i,p),u?c^4?s:p:r},Lu,Ho,Mu;const Nu=t=>{if(!t)return null;try{return t.split(".").reduce((e,i)=>e==null?e:e[i],globalThis)}catch{return null}},Du=(t,e,i)=>{if(/^https?:\/\//i.test(t))return t;const n=o=>o.endsWith("/")?o:o+"/";if(/^https?:\/\//i.test(e)){const o=n(e);return new URL(t,o).href}const r=(()=>{try{return new URL(i).href}catch{return new URL(i,location.origin).href}})(),s=new URL(n(e),r).href;return new URL(t,s).href};Lu=[Ee(["storage","preferences","resourceLoader","$"])];let Nr=(yt=class extends(Mu=et){constructor(e){super(e,{},"plugin-store"),this.ctx=e,this.regInfoDB=void 0,this._installedPlugins=new Map,this._onlineRegistryQueries=new Map,e.set("store",this),this.regInfoDB=e.storage.createDatabase(yt.REGISTRY_INFO_STORAGE_NAME,yt.REGISTRY_INFO_CACHE_TTL,1,"indexedDB")}async start(){this._installUserPlugins(),this._injectPreferenceUI()}async _installUserPlugins(){const e=await this.ctx.preferences.get("pluginStore.plugins",[]);if(e?.length)for(const i of e)this.install(i.registry,i.id,i.source,"user-preference")}async _createManagementApp(){const e=await this.ctx.withInject(["store"]);return Iu(e,am(()=>Promise.resolve().then(()=>ww)))}async _injectPreferenceUI(){const e=this.ctx,i=e.$;e.preferences.defineCategory({name:"plugin-store",label:i`Plugin Store`,description:i`Plugin Store`,index:90,autoGenerateForm:!1,customRenderer:async({onUnmount:n})=>{const r=m("div",{id:"ipe-plugin-store-preferences-vue"}),s=await this._createManagementApp();return s.mount(r),n(()=>{s.unmount(),this.ctx.logger.debug("Plugin Store preferences app unmounted")}),m("section",{children:r})}}),e.preferences.registerCustomConfig("plugin-store",R.object({"pluginStore.registries":R.array(R.string()).default([xt.PLUGIN_REGISTRY_URL]).description(i`Registry URLs`).hidden(),"pluginStore.cdnForNpm":R.string().description(i`CDN to install packages from npm`).default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? "@" + version : "" }}').hidden(),"pluginStore.plugins":R.array(R.object({source:R.union(["online_manifest","npm"]).default("online_manifest"),registry:R.string().required(),id:R.string().required()})).description(i`Installed plugins`).default([]).hidden()}),"plugin-store")}async showModal(){const e=this.ctx.modal.show({title:$`Plugin Store`,sizeClass:"small"}),i=m("section",{id:"ipe-plugin-store-vue"});e.setContent(i);const n=await this._createManagementApp();return n.mount(i),e.on(e.Event.Close,()=>{n.unmount()}),e}async install(e,i,n="online_manifest",r="new-added"){const s=await this.getRegistryInfo(e,n);if(!s)return this.ctx.logger.warn(`Registry ${e} not found`),null;const o=`${e}#${i}`;if(this._installedPlugins.has(o))return await this._installedPlugins.get(o)??null;const a=this._installOneByRegistryInfo(e,s,i);this._installedPlugins.set(o,a);const l=await a;return l&&this.ctx.emit("plugin-store/plugin-installed",{ctx:this.ctx,registry:s,id:i,by:r}),l}async uninstall(e,i){const n=this._installedPlugins.get(`${e}#${i}`);if(n===void 0)return!0;this._installedPlugins.delete(`${e}#${i}`);const r=await n;if(r){const s=r.dispose?.()??!0;try{const o=await this.getRegistryCache(e)||await this.getRegistryInfo(e).catch(()=>null);o&&this.ctx.emit("plugin-store/plugin-uninstalled",{ctx:this.ctx,registry:o,id:i})}catch{}return s}return!0}async addToPreferences(e,i){let n=await this.ctx.preferences.get("pluginStore.plugins")||[];return n.some(s=>s.registry===e&&s.id===i)||(n.push({registry:e,id:i}),await this.ctx.preferences.set("pluginStore.plugins",n)),!0}async removeFromPreferences(e,i){let n=await this.ctx.preferences.get("pluginStore.plugins")||[];return n=n.filter(r=>r.registry!==e||r.id!==i),await this.ctx.preferences.set("pluginStore.plugins",n),!0}async installAndSetPreference(e,i){return await this.addToPreferences(e,i),this.install(e,i,"online_manifest","new-added")}async uninstallAndRemovePreference(e,i){return await this.removeFromPreferences(e,i),this.uninstall(e,i)}async _installOneByRegistryInfo(e,i,n){const r=i.base_url,s=i.packages.find(d=>d.id===n);if(!s)return this.ctx.logger.warn(`Package ${n} not found in registry ${e}`),null;const o=s.loader,{kind:a,entry:l="index.js",styles:c=[],main_export:u=null}=o;let f=null;if(a!=="styles"){if(!l)return this.ctx.logger.warn(`Entry url missing for ${n}`,o),null;try{f=Du(l,r,e)}catch(d){return this.ctx.logger.warn(`Failed to resolve entry "${l}" with base "${r}" and registry "${e}"`,d),null}}const h={"data-plugin-registry":e,"data-plugin-id":n};let p=null;switch(a){case"autoload":{p=this.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${n}`,apply:d=>{f&&d.resourceLoader.loadScript(f,{...h})}});break}case"module":{if(!f)return this.ctx.logger.warn(`Entry url missing for module kind, package ${n}`),null;const d=await import(f).then(w=>(u?w[u]:w.default)??w);if(!d)return this.ctx.logger.warn(`Main export ${u} not found in module ${f}`),null;p=this.ctx.plugin(d);break}case"umd":{let d=Nu(u);if(!d){if(!f)return this.ctx.logger.warn(`Entry url missing for umd kind, package ${n}`),null;await this.ctx.resourceLoader.loadScript(f,{...h}),d=Nu(u)}if(!d)return this.ctx.logger.warn(`Main export ${u} not found on globalThis after loading ${f}`),null;p=this.ctx.plugin(d);break}}if(c&&c.length>0){let d=[];try{d=c.map(w=>Du(w,r,e)).filter(Boolean)}catch(w){this.ctx.logger.warn(`Failed to resolve styles for ${n}`,c,w)}p||(p=this.ctx.plugin({name:`plugin-store-${e}-${n}`,apply(){}})),p.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${n}-styles`,apply:w=>{d.forEach(S=>w.resourceLoader.loadStyle(S,{...h})),w.on("dispose",()=>{try{d.forEach(S=>w.resourceLoader.removeStyle(S))}catch{}})}})}return p}validateRegistry(e){return Mr.Registry(e)}async getRegistryInfo(e,i="online_manifest",n=!1){try{let s;switch(i){case"online_manifest":{s=await this._fetchOnlineRegistryInfo(e,n),this.logger.debug("Fetched registry info from online manifest",s),this.setRegistryCache(e,s);break}default:throw new Error(`Unsupported registry source: ${i}`)}return s}catch(s){this.ctx.logger.warn("Failed to fetch registry info",s)}const r=await this.getRegistryCache(e);if(!r)throw this.ctx.emit("plugin-store/registry-not-found",{ctx:this.ctx,registryUrl:e}),new Error(`Failed to fetch registry info: ${e}`);return r}async _fetchOnlineRegistryInfo(e,i=!1){if(!i&&this._onlineRegistryQueries.has(e))return await this._onlineRegistryQueries.get(e);const r=(async()=>{const s={method:"GET"};i&&(s.cache="no-store");const a=await(await fetch(e,s)).json(),l=this.validateRegistry(a);return this.ctx.emit("plugin-store/registry-fetched",{ctx:this.ctx,registry:l}),l})();return this._onlineRegistryQueries.set(e,r),await r}async getRegistryCache(e){const i=await this.regInfoDB.get(e);if(i)try{return this.validateRegistry(i)}catch(n){this.ctx.logger.warn("Invalid cached registry",n,i),this.regInfoDB.delete(e)}return null}async setRegistryCache(e,i){return this.regInfoDB.set(e,i)}async deleteRegistryCache(e){await this.regInfoDB.delete(e),this.ctx.emit("plugin-store/registry-removed",{ctx:this.ctx,registryUrl:e})}async clearAllRegistryCaches(){await this.regInfoDB.clear(),this.ctx.logger.debug("All registry caches cleared")}async refreshRegistryCache(e){const i=await this.getRegistryInfo(e,"online_manifest",!0);if(!i)throw new Error(`Failed to refresh registry cache: ${e}`);return this.ctx.logger.debug("Registry cache refreshed:",e),i}async refreshAllRegistryCaches(){const e=await this.ctx.preferences.get("pluginStore.registries")||[],i=await Promise.allSettled(e.map(r=>this.refreshRegistryCache(r))),n={};for(const[r,s]of i.entries())s.status==="fulfilled"?n[e[r]]=s.value:n[e[r]]=null;return n}},yt.PluginStoreSchemas=Mr,yt.REGISTRY_INFO_CACHE_TTL=1e3*60*60*24,yt.REGISTRY_INFO_STORAGE_NAME="plugin-store-registry",yt.REGISTRY_ETAG_STORAGE_NAME="psreg-etag",yt);Ho=By(Mu),Nr=Ky(Ho,0,"PluginPluginStore",Lu,Nr),zy(Ho,1,Nr);const Wy=Object.freeze(Object.defineProperty({__proto__:null,PluginPluginStore:Nr},Symbol.toStringTag,{value:"Module"})),nt='@charset "UTF-8";:host{display:block;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system);color:var(--schema-color-fg, #111827)}*,*:before,*:after{box-sizing:border-box}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius, 10px);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}',ju={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},be=(t,e)=>{customElements.get(t)||customElements.define(t,e)},Gy=(t,e,i)=>{if(!e.length)return;let n=t,r=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=n?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},n[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},n[l]=c),r=n,s=l,n=c}const o=e[e.length-1];if(n==null||typeof n!="object"){const a=typeof o=="number"?[]:{};if(r)r[s]=a,n=a;else return}try{n[o]=i}catch{try{const a=Array.isArray(n)?n.slice():{...n};a[o]=i,r&&(r[s]=a)}catch{}}},Rn=t=>t.map(String).join("."),Vy=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),ei=t=>`schema_${Vy(Rn(t)||"root")}`,hi=t=>Rn(t),ee=(t,...e)=>{const i=new Set(e);i.size&&t.setAttribute("part",Array.from(i).join(" "))},Yy=["wrapper","form","field","field-intersect","field-string","field-number","field-boolean","field-date","field-const","field-array","field-object","field-tuple","field-union","field-dict","field-label","field-helper","field-group","field-row","field-actions","field-button","field-button-primary","field-button-danger","field-button-secondary","field-toolbar","field-badge","field-input","field-input-text","field-input-number","field-input-date","field-input-select","field-input-textarea","field-input-checkbox","field-const-value","collection-row","field-checkbox","field-checkbox-text","field-toolbar-select"].join(" ");function zo(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const i=Number(e);return Number.isNaN(i)?void 0:i}case"boolean":return!!e;case"date":{if(!e)return;const i=new Date(e);return Number.isNaN(+i)?void 0:i}case"const":case"string":default:return e}}function Uu(t){return typeof t=="function"&&!!t?.type}function Bu(t){if(!t)throw new Error("schema is required");if(Uu(t))return t;try{const e=Schema.from(t);if(Uu(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function ct(t){return t?.meta??{}}function Qy(t){return t.length>0&&t.every(e=>e?.type==="const")}function pi(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const n=e.type;try{const r=t();if(r!==void 0)return r}catch{}switch(n){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const r=e.list||[];return r.length?pi(r[0]):void 0}case"const":return e.value;case"date":return;case"intersect":{const r=e.list||[],s=(a,l)=>{if(Array.isArray(a)&&Array.isArray(l))return l.slice();if(a&&l&&typeof a=="object"&&typeof l=="object"){const c={...a};for(const u of Object.keys(l))c[u]=u in c?s(c[u],l[u]):l[u];return c}return l??a};let o={};for(const a of r)o=s(o,pi(a));return o}default:return}}class mt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=ju,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=nt,this.$root.appendChild(e)}makeFieldContainer(e,i){const n=document.createElement("div");if(n.className=`field schema-form-item schema-type-${e}`,n.setAttribute("data-path",Rn(this._path)),ee(n,"field",`field-${e}`),this._label){const r=document.createElement("label");r.className="label",r.textContent=this._label,ee(r,"field-label"),n.appendChild(r)}if(i&&i!==this._label){const r=document.createElement("div");r.className="helper",r.textContent=i,ee(r,"field-helper"),n.appendChild(r)}return n}set schema(e){this._schema=Bu(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Fu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=!!this.$root.querySelector("label.label");if(!(this._label&&!s)){const o=this._value??"";this.$input.value!==o&&document.activeElement!==this.$input&&(this.$input.value=o);return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("string",e.description),n=document.createElement("input");this.$input=n,n.className="input",ee(n,"field-input","field-input-text"),n.type="text",n.name=hi(this._path),n.id=ei(this._path),e?.pattern?.source&&(n.pattern=e.pattern.source),e?.max!=null&&(n.maxLength=e.max),n.value=this._value??"",n.oninput=()=>this.emitChange(zo("string",n.value));const r=i.querySelector("label.label");r&&(r.htmlFor=n.id),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-string",Fu);class qu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=this._value??"";this.$input.value!==String(a)&&document.activeElement!==this.$input&&(this.$input.value=a);return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=this._schema?.type??"number",i=ct(this._schema),n=this.makeFieldContainer("number",i.description),r=document.createElement("input");this.$input=r,r.className="input",ee(r,"field-input","field-input-number"),r.name=hi(this._path),r.id=ei(this._path),i?.min!=null&&(r.min=String(i.min)),i?.max!=null&&(r.max=String(i.max)),i?.step!=null&&(r.step=String(i.step)),e==="percent"&&!r.step&&(r.step="0.01"),r.value=this._value??"",r.oninput=()=>this.emitChange(zo(e,r.value));const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),i.role==="slider"?r.type="range":r.type="number",n.appendChild(r),this.$root.appendChild(n)}}be("schema-form-number",qu);class Hu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("boolean",e.description),n=document.createElement("label");n.className="checkbox",ee(n,"field-checkbox");const r=document.createElement("input");r.type="checkbox",r.checked=!!this._value,r.name=hi(this._path),r.id=ei(this._path),ee(r,"field-input","field-input-checkbox");const s=document.createElement("span");s.textContent=e.description??this._label??"",ee(s,"field-checkbox-text"),r.onchange=()=>this.emitChange(r.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=r.id),n.append(r,s),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-boolean",Hu);function Dr(t){return String(t).padStart(2,"0")}function In(t){return`${t.getFullYear()}-${Dr(t.getMonth()+1)}-${Dr(t.getDate())}`}function Ko(t){return`${Dr(t.getHours())}:${Dr(t.getMinutes())}`}function jr(t){return`${In(t)}T${Ko(t)}`}class zu extends mt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=ct(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)a==="date"?this.$input.value=In(this._value):a==="time"?this.$input.value=Ko(this._value):a==="datetime"&&(this.$input.value=jr(this._value));else if(typeof this._value=="string"&&a!=="time"){const l=new Date(this._value);isNaN(+l)||(a==="date"?this.$input.value=In(l):a==="datetime"&&(this.$input.value=jr(l)))}else this._value||(this.$input.value="");return}}this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("date",e.description),n=document.createElement("input");this.$input=n,n.className="input",ee(n,"field-input","field-input-date");const r=e.role||"date";if(r==="datetime"?n.type="datetime-local":r==="time"?n.type="time":n.type="date",n.name=hi(this._path),n.id=ei(this._path),this._value instanceof Date)r==="date"?n.value=In(this._value):r==="time"?n.value=Ko(this._value):r==="datetime"&&(n.value=jr(this._value));else if(typeof this._value=="string"&&r!=="time"){const o=new Date(this._value);isNaN(+o)||(r==="date"?n.value=In(o):r==="datetime"&&(n.value=jr(o)))}n.oninput=()=>{e.role;let o;if(!n.value)o=void 0;else{const a=new Date(n.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-date",zu);class Wo extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this._schema.value;if(e.role==="raw-html"){if(i instanceof Node){this.$root.append(i);return}else if(typeof i=="function"){this.$root.append(i());return}else if(typeof i=="string"){const o=document.createElement("div");o.innerHTML=String(i),ee(o,"field-const-value"),this.$root.appendChild(o);return}}const n=this.makeFieldContainer("const",e.description),r=document.createElement("section");r.className="const content",r.textContent=String(i),r.id=ei(this._path),ee(r,"field-const-value");const s=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}be("schema-form-const",Wo);class Ku extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("intersect",e.description);i.classList.remove("field");const n=document.createElement("div");n.classList.add("group"),ee(n,"field-group");const r=this._schema.list||[],s=r.length>0&&r.every(a=>a?.type==="object"),o=(a,l)=>{if(Array.isArray(a)&&Array.isArray(l))return l.slice();if(a&&l&&typeof a=="object"&&typeof l=="object"){const c={...a};for(const u of Object.keys(l))c[u]=u in c?o(c[u],l[u]):l[u];return c}return l??a};if(s){const a=this._value&&typeof this._value=="object"?this._value:{};r.forEach((l,c)=>{const u=l?.meta?.description??"",f=ti(l,this._path,a,u,this._i18n);f.addEventListener("change",h=>{h.stopPropagation();const p=o(this._value??{},h.detail.value);this.emitChange(p)}),n.appendChild(f)})}else{const a=r[r.length-1],l=ti(a,this._path,this._value,this._label,this._i18n);l.addEventListener("change",c=>{c.stopPropagation(),this.emitChange(c.detail.value)}),n.appendChild(l)}i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-intersect",Ku);function Xy(t){switch(t.type){case"intersect":return"schema-form-intersect";case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function ti(t,e,i,n,r){const s=Xy(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=n,r&&(o.i18n=r),o.setValue?.(i),o.setAttribute("exportparts",Yy),o}class Wu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("union",e.description),n=this._schema.list||[];if(Qy(n)){const r=document.createElement("select");r.className="input",ee(r,"field-input","field-input-select"),r.name=hi(this._path),r.id=ei(this._path),n.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.meta?.description||o.value||o.type),this._value===o.value&&(a.selected=!0),r.appendChild(a)}),r.onchange=()=>this.emitChange(zo("string",r.value));const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r)}else{const r=document.createElement("div");r.className="toolbar",ee(r,"field-toolbar");const s=document.createElement("select");s.className="input",ee(s,"field-input","field-input-select","field-toolbar-select"),s.name=hi(this._path)+".__type",s.id=ei(this._path)+"__type";let o=0;n.forEach((u,f)=>{const h=document.createElement("option");h.value=String(f),h.textContent=String(u.meta?.description||u.value||u.type),s.appendChild(h)}),s.onchange=()=>{o=Number(s.value);const u=n[o],f=pi(u);this.emitChange(f),c()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),r.appendChild(s),i.appendChild(r);const l=document.createElement("div");l.className="group",ee(l,"field-group");const c=()=>{l.innerHTML="";const u=n[o],f=ti(u,this._path,this._value,this._label);f instanceof Wo||(f.addEventListener("change",h=>{h.stopPropagation(),this.emitChange(h.detail.value)}),l.appendChild(f))};c(),i.appendChild(l)}this.$root.appendChild(i)}}be("schema-form-union",Wu);class Gu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("tuple",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=ti(s,[...this._path,o],r[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),n.appendChild(a)}),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-tuple",Gu);class Vu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("object",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.dict||{};Object.keys(r).forEach(s=>{if(r[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=ti(r[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),n.appendChild(a)}),i.appendChild(n),this.$root.appendChild(i)}}be("schema-form-object",Vu);const Zr=class Zr extends mt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Zr._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const i={};return e.querySelectorAll(".row").forEach(n=>{const r=n.dataset.uid;r&&(i[r]=n.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(n=>{const r=n.dataset.uid;if(!r)return;const s=i[r];if(!s)return;const o=n.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(n.style.transition="none",n.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{n.style.transition="transform .25s ease",n.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("array",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{n.innerHTML="",s().forEach((f,h)=>{const p=[...this._path,h],d=document.createElement("div");d.className="row schema-collection-row",ee(d,"field-row","collection-row");const w=this._itemIds[h];d.dataset.uid=w,d.setAttribute("data-path",Rn(p));const S=ti(r,p,f,`${this._label??""}[${h}]`);S.addEventListener("change",v=>{v.stopPropagation();const x=s().slice();x[h]=v.detail.value,this._value=x,this.emitChange(x)});const E=document.createElement("div");E.className="actions",ee(E,"field-actions");const M=document.createElement("button");M.type="button",M.className="btn",ee(M,"field-button","field-button-secondary"),M.textContent=this._i18n.arrayMoveUp??"↑",M.onclick=()=>{if(h<=0)return;const v=this.capturePositions(n),x=s().slice();[x[h-1],x[h]]=[x[h],x[h-1]],[this._itemIds[h-1],this._itemIds[h]]=[this._itemIds[h],this._itemIds[h-1]],this._value=x,o(v),this.emitChange(x)};const g=document.createElement("button");g.type="button",g.className="btn",ee(g,"field-button","field-button-secondary"),g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const v=s();if(h>=v.length-1)return;const x=this.capturePositions(n),P=v.slice();[P[h+1],P[h]]=[P[h],P[h+1]],[this._itemIds[h+1],this._itemIds[h]]=[this._itemIds[h],this._itemIds[h+1]],this._value=P,o(x),this.emitChange(P)};const y=document.createElement("button");y.type="button",y.className="btn danger",ee(y,"field-button","field-button-danger"),y.textContent=this._i18n.arrayRemove??"×",y.onclick=()=>{d.classList.add("leaving");const v=250;let x=!1;const P=()=>{if(x)return;x=!0,clearTimeout(L);const C=s().filter((H,He)=>He!==h);this._itemIds.splice(h,1);const U=this.capturePositions(n);this._value=C,o(U),this.emitChange(C)};d.addEventListener("transitionend",P,{once:!0});const L=setTimeout(P,v+80)},E.append(M,g,y),d.appendChild(S),d.appendChild(E),n.appendChild(d),u&&u===w&&(d.classList.add("enter"),requestAnimationFrame(()=>{d.classList.add("enter-active")}),requestAnimationFrame(()=>{d.classList.remove("enter")}))}),c&&this.playFLIP(n,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",ee(a,"field-button","field-button-primary"),a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(n),u=s().slice(),f=pi(r);u.push(f);const h=this.generateItemId();this._itemIds.push(h),this._value=u,o(c,h),this.emitChange(u)};const l=document.createElement("div");l.className="actions",ee(l,"field-actions"),l.appendChild(a),i.appendChild(n),i.appendChild(l),this.$root.appendChild(i)}};Zr._idCounter=0;let Ur=Zr;be("schema-form-array",Ur);class Yu extends mt{render(){this.$root.innerHTML=`<style>${nt}</style>`;const e=ct(this._schema),i=this.makeFieldContainer("dict",e.description),n=document.createElement("div");n.className="group",ee(n,"field-group");const r=this._schema.inner,s=this._value??{},o=h=>`d_${h}`,a=()=>{const h={};return n.querySelectorAll(".kv").forEach(p=>{const d=p.dataset.uid;d&&(h[d]=p.getBoundingClientRect())}),h},l=h=>{n.querySelectorAll(".kv").forEach(p=>{const d=p.dataset.uid;if(!d)return;const w=h[d];if(!w)return;const S=p.getBoundingClientRect(),E=w.left-S.left,M=w.top-S.top;(E||M)&&(p.style.transition="none",p.style.transform=`translate(${E}px, ${M}px)`,requestAnimationFrame(()=>{p.style.transition="transform .25s ease",p.style.transform=""}))})},c=(h,p)=>{n.innerHTML="",Object.keys(s).forEach(d=>{const w=[...this._path,d],S=document.createElement("div");S.className="kv schema-collection-row",ee(S,"field-row","collection-row"),S.dataset.uid=o(d),S.setAttribute("data-path",Rn(w));const E=document.createElement("input");E.className="input",ee(E,"field-input","field-input-text"),E.value=d,E.name=hi(w)+".__key",E.id=ei(w)+"__key";const M=ti(r,w,s[d],`${this._label??""}[${d}]`),g=document.createElement("button");g.type="button",g.className="btn danger",ee(g,"field-button","field-button-danger"),g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const y=a();delete s[d];const v={...this._value??{}};delete v[d],this._value=v,c(y),this.emitChange(v)},E.onchange=()=>{const y=E.value.trim();if(!y||y===d||s[y]!==void 0)return;const v=a();s[y]=s[d],delete s[d];const x={...this._value??{}};x[y]=x[d],delete x[d],this._value=x,c(v),this.emitChange(x)},M.addEventListener("change",y=>{y.stopPropagation();const v={...this._value??{}};v[d]=y.detail.value,this._value=v,this.emitChange(v)}),S.append(E,M,g),n.appendChild(S),p===d&&(S.classList.add("enter"),requestAnimationFrame(()=>S.classList.add("enter-active")),requestAnimationFrame(()=>S.classList.remove("enter")))}),h&&l(h)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",ee(u,"field-button","field-button-primary"),u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let h=Object.keys(s).length+1,p=`k${h}`;for(;s[p]!==void 0;)p=`k${++h}`;const d=a();s[p]=pi(r);const w={...this._value??{},[p]:s[p]};this._value=w,c(d,p),this.emitChange(w)};const f=document.createElement("div");f.className="actions",ee(f,"field-actions"),f.appendChild(u),i.appendChild(n),i.appendChild(f),this.$root.appendChild(i)}}be("schema-form-dict",Yu);class Qu extends HTMLElement{constructor(){super(),this._i18n={...ju},this._i18nCommitted=!1,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=nt,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",ee(i,"wrapper");const n=document.createElement("form");n.className="form",ee(n,"form"),i.appendChild(n),this.$root.appendChild(i),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:s,value:o}=r.detail;Array.isArray(s)&&s.length===0?this._state=o:Gy(this._state??(this._state={}),s,o),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:s,value:o,state:this._state}}))})}set schema(e){this._schema=Bu(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=pi(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,i={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=n,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const i=this._state;return e.validate?this._schema(i??null,{autofix:e.autofix}):i}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=pi(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18nCommitted||(this._i18n={...this._i18n,...e},this._i18nCommitted=!0,this.render())}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const i=ti(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}be("schema-form",Qu);function Jy(){be("schema-form",Qu),be("schema-form-string",Fu),be("schema-form-number",qu),be("schema-form-boolean",Hu),be("schema-form-date",zu),be("schema-form-const",Wo),be("schema-form-union",Wu),be("schema-form-tuple",Gu),be("schema-form-object",Vu),be("schema-form-array",Ur),be("schema-form-dict",Yu),be("schema-form-intersect",Ku)}const Zy=fi({__name:"SchemasteryFormVue",props:Ac({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Ac(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const n=Jc(t,"schema"),r=Jc(t,"value"),s=i,o=$c("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,h=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,r.value=h,mn(()=>{a=!1}),s("change",u.detail)};return Rc(()=>{Jy()}),wn(()=>{const u=o.value;n.value&&(u.schema=n.value),r.value!==void 0&&u.setData(r.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),vo(()=>{o.value?.removeEventListener("form-change",c)}),Mi(n,u=>{a||o.value&&u&&o.value.schema!==u&&(l=!0,o.value.schema=u,mn(()=>{l=!1}))},{deep:!0,immediate:!0}),Mi(r,u=>{if(a||!o.value||u===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u)&&(l=!0,o.value.setData(u,{validate:!1}),mn(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const h=o.value;h.setData(u,{validate:!!f?.validate}),f?.emit&&(r.value=h.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(n.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(oe(),de("schema-form",au({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function gi(t,e=new WeakMap){if(Ie(t))return gi(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const r=new Map;return e.set(t,r),Array.from(t.entries()).forEach(([s,o])=>{r.set(s,gi(o,e))}),r}if(t instanceof Set){const r=new Set;return e.set(t,r),Array.from(t).forEach(s=>{r.add(gi(s,e))}),r}if(Array.isArray(t)){const r=[];e.set(t,r);for(const s of t)r.push(gi(s,e));return r}const i=ie(t),n={};e.set(t,n);for(const r of Object.keys(i))n[r]=gi(i[r],e);for(const r of Object.getOwnPropertySymbols(i))n[r]=gi(i[r],e);return n}const Go=()=>{},eb={id:"preferences-ui-app"},tb={class:"tabbar"},ib={class:"tabbar-tabs"},nb=["onClick","data-value"],rb={class:"tabbar-content"},sb={key:0},ob={style:{"max-height":"20em",overflow:"auto"}},ab=fi({__name:"PreferencesApp",setup(t,{expose:e}){const i=Fo(),n=!1,r=pc([]),s=Ue([]),o=Ue(""),a=It(()=>s.value.find(d=>d.name===o.value)||null),l=It(()=>{const d=r.value.filter(w=>w.category===o.value).map(w=>w.schema);return d.length===0?null:R.intersect(d)}),c=It(()=>a.value&&typeof a.value.autoGenerateForm=="boolean"?a.value.autoGenerateForm:!0),u=Ue({});e({getValue(){return gi(u)},mergeValue(d){u.value={...u.value,...d}},selectTab(d){o.value=d}}),wn(async()=>{i.inject(["preferences"],async d=>{const w=await d.preferences.getAll();u.value=w,s.value=d.preferences.getConfigCategories(),r.value=d.preferences.getConfigRegistries(),o.value=s.value[0].name})});const f=(d,w)=>{d.preventDefault(),o.value=w;const S=d.currentTarget;S&&S.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},h=$c("customRenderContainerRef"),p=Ue([]);return wo(()=>{p.value.forEach(d=>d()),p.value=[]}),Mi(a,async d=>{p.value.forEach(S=>S()),p.value=[],await mn();const w=h.value;if(w&&(w.innerText="",d&&typeof d.customRenderer=="function")){let S=Go;const E=y=>{S=y},M=y=>{p.value.push(y)},g=await d.customRenderer({ctx:i,onMounted:E,onUnmount:M});g&&(w.appendChild(g),S?.(w))}},{immediate:!0,deep:!1}),(d,w)=>(oe(),de("div",eb,[J("div",tb,[J("div",ib,[(oe(!0),de(qe,null,_o(s.value,S=>(oe(),de("a",{class:pt(["tab",{active:o.value===S.name}]),key:S.name,onClick:E=>f(E,S.name),"data-value":S.name},ue(S.label),11,nb))),128))]),J("div",rb,[a.value&&a.value.customRenderer?(oe(),de("div",{class:"custom-render-container",ref_key:"customRenderContainerRef",ref:h,key:o.value})):Jt("",!0),c.value&&l.value?(oe(),Ir(Pe(Zy),{class:"auto-schema-form",key:o.value,"data-category":o.value,schema:l.value,value:u.value,"onUpdate:value":w[0]||(w[0]=S=>u.value={...u.value,...S}),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["data-category","schema","value"])):Jt("",!0)])]),Pe(n)?(oe(),de("details",sb,[J("pre",ob,ue(u.value),1)])):Jt("",!0)]))}}),Br=(t,e)=>{const i=t.__vccOpts||t;for(const[n,r]of e)i[n]=r;return i},lb=Br(ab,[["__scopeId","data-v-7f07706b"]]);var cb=Object.create,Vo=Object.defineProperty,ub=Object.getOwnPropertyDescriptor,Xu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ju=t=>{throw TypeError(t)},fb=(t,e,i)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,db=(t,e)=>Vo(t,"name",{value:e,configurable:!0}),hb=t=>[,,,cb(t?.[Xu("metadata")]??null)],pb=["class","method","getter","setter","accessor","field","value","get","set"],Zu=t=>t!==void 0&&typeof t!="function"?Ju("Function expected"):t,gb=(t,e,i,n,r)=>({kind:pb[t],name:e,metadata:n,addInitializer:s=>i._?Ju("Already initialized"):r.push(Zu(s||null))}),mb=(t,e)=>fb(e,Xu("metadata"),t[3]),yb=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},bb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&ub(r,i));db(r,i);for(var d=n.length-1;d>=0;d--)l=gb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Zu(o)&&(r=o);return mb(t,r),p&&Vo(r,i,p),u?c^4?s:p:r},ef,Yo,tf;ef=[Ee(["preferences","modal","$","$$"])];class Fr extends(tf=et){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,this._modal=null,this._form=null,e.set("preferencesUI",this);const i=e.$,n=e.$$;e.preferences.defineCategory({name:"general",label:i`prefs.general.label`,description:i`prefs.general.description`,autoGenerateForm:!0}),e.preferences.defineCategory({name:"editor",label:i`prefs.editor.label`,description:i`prefs.editor.description`,autoGenerateForm:!0}),e.preferences.defineCategory({name:"about",label:n`prefs.about.label`,description:n`prefs.about.description`,index:99,customRenderer:()=>m("section",{className:"theme-ipe-prose",children:[m("h2",{children:"✏️ InPageEdit NEXT"}),m("p",{children:n`prefs.about.intro`}),m("h3",{children:n`prefs.about.portals.header`}),m("ul",{children:[m("li",{children:m("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",children:n`prefs.about.portals.officialwebsite`})}),m("li",{children:m("a",{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version.split("-")[0]}`,target:"_blank",children:n`prefs.about.portals.updatelogs`})})]}),m("h3",{children:n`prefs.about.joinus.header`}),m("ul",{children:[m("li",{children:[m("strong",{children:n`prefs.about.joinus.github`}),":"," ",m("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:`${this.ctx.Endpoints.GITHUB_OWNER}/${this.ctx.Endpoints.GITHUB_REPO}`})]}),m("li",{children:[m("strong",{children:n`prefs.about.joinus.qqgroup`}),": ",this.ctx.Endpoints.QQ_GROUP_ID]})]}),m("hr",{}),m("p",{style:{textAlign:"center"},children:n`prefs.about.copyright`}),m("hr",{})]})}),e.inject(["toolbox"],r=>{r.toolbox.addButton({id:"preferences",icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:()=>i`Configure Preferences`,group:"group2",index:99,onClick:()=>this.showModal()}),this.addDisposeHandler(s=>{s.toolbox.removeButton("preferences")})})}async start(){Promise.resolve().then(()=>Ow).then(({PluginPrefSync:e})=>{this.ctx.plugin(e)}).catch(this.ctx.logger.warn),this.ctx.on("preferences/changed",e=>{this._form?.mergeValue?.(e.input)})}stop(){}showModal(){const e=this.ctx.$;if(this._modal&&!this._modal.isDestroyed)return this._modal;const i=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:`${e`InPageEdit Preferences`} (${this.ctx.version})`,content:m(_i,{children:m(ai,{})})});i.get$window().classList.add("dialog");const n=m("div",{id:"ipe-preferences-app",style:{minHeight:"calc(85dvh - var(--ipe-modal-spacing) * 2)"}});i.setContent(n),this.ctx.emit("preferences-ui/modal-shown",{ctx:this.ctx,modal:i});const r=this.createPreferencesUIApp(),s=r.mount(n);return this._form=s,this.ctx.emit("preferences-ui/vue-app-mounted",{ctx:this.ctx,app:r,form:s}),i.setButtons([{label:e`Close`,className:"is-ghost",method:()=>{i.close()}},{label:e`Save`,className:"is-primary is-ghost",method:async()=>{const o=s.getValue();try{const a=await this.ctx.preferences.setMany(o);this.logger.info("preferences saved",o,a)}catch(a){this.logger.error("failed to save preferences",a)}i.close(),this.ctx.modal.notify("success",{title:e`Preferences Saved`,content:m("p",{children:e`Some settings may take effect after reloading the page.`})})}}]),this._modal=i,i.on(i.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount(),this._modal=null,this._form=null,this.ctx.emit("preferences-ui/modal-closed",{ctx:this.ctx,modal:i})}),i}getCurrentModal(){return this._modal}closeCurrentModal(){return this._modal?.close()}async dispatchFormSave(e){e=e||this._form||void 0;const i=e?.getValue();return i?(this.ctx.preferences.setMany(i),!0):!1}getCurrentFormValue(){return this._form?.getValue()}mergeFormValue(e){return this._form?.mergeValue?.(e),!!this._form?.mergeValue}createPreferencesUIApp(){return Iu(this.ctx,lb)}}Yo=hb(tf),Fr=bb(Yo,0,"PluginPreferencesUI",ef,Fr),yb(Yo,1,Fr);const vb=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Fr}},Symbol.toStringTag,{value:"Module"})),wb=Symbol("@@apply"),_b=Symbol("@@ctor");function nf(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const i=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};i[wb]=i,i[_b]=t;const n=t?.constructor?.name;return n&&(i[Symbol.toStringTag]=n),new Proxy(i,{get(s,o,a){return o==="prototype"?Reflect.get(i,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const qr={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},Qo=t=>{const{type:e="default",title:i,content:n,closeable:r=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=i;typeof i>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:h,resolve:p}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),p()}),h},f=m("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${qr.mbox}`,...l,children:[c&&m("div",{className:`ipe-mbox-title ${qr.title}`,...s,children:c}),m("div",{className:`ipe-mbox-content ${qr.content}`,...o,children:a||n}),r&&m("a",{onClick:u,className:`ipe-mbox-close ${qr.close}`,children:"×"})]});return f.close=u,f},Hr=t=>{const{label:e,id:i,name:n,value:r,disabled:s,labelProps:o,inputProps:a,...l}=t;return m("div",{className:"theme-ipe ipe-input-box",...l,children:[m("label",{htmlFor:i,style:{display:"block"},...o,children:e}),m("input",{id:i,name:n,value:r,disabled:s,style:{width:"100%"},...a})]})},xb=t=>{const{id:e,name:i,value:n,label:r,inputProps:s,labelProps:o,children:a,...l}=t;return m("label",{className:"theme-ipe ipe-radio-box",...l,children:[m("input",{type:"radio",id:e,name:i,value:n,...s}),m("span",{className:"ipe-checkbox-box"}),m("span",{...o,children:r||a})]})},Ui=t=>{const{id:e,name:i,label:n,checked:r,inputProps:s,labelProps:o,children:a,...l}=t;return m("label",{className:"theme-ipe ipe-checkbox",...l,children:[m("input",{type:"checkbox",id:e,name:i,checked:r,...s}),m("span",{className:"ipe-checkbox-box"}),m("span",{...o,children:n||a})]})},Sb=(t=0)=>new Promise(e=>setTimeout(e,t));var kb=Object.create,Xo=Object.defineProperty,$b=Object.getOwnPropertyDescriptor,rf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),sf=t=>{throw TypeError(t)},Eb=(t,e,i)=>e in t?Xo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pb=(t,e)=>Xo(t,"name",{value:e,configurable:!0}),Cb=t=>[,,,kb(t?.[rf("metadata")]??null)],Rb=["class","method","getter","setter","accessor","field","value","get","set"],of=t=>t!==void 0&&typeof t!="function"?sf("Function expected"):t,Ib=(t,e,i,n,r)=>({kind:Rb[t],name:e,metadata:n,addInitializer:s=>i._?sf("Already initialized"):r.push(of(s||null))}),Ab=(t,e)=>Eb(e,rf("metadata"),t[3]),Ob=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Tb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&$b(r,i));Pb(r,i);for(var d=n.length-1;d>=0;d--)l=Ib(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,of(o)&&(r=o);return Ab(t,r),p&&Xo(r,i,p),u?c^4?s:p:r},af,Jo,lf;af=[Ee(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences","$"]),Vt(R.object({"quickEdit.editSummary":R.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":R.boolean().description('Default to checking "minor edit" option').default(!1),"quickEdit.outSideClose":R.boolean().description("Close editor modal by clicking outside").default(!0),"quickEdit.watchList":R.union([R.const(at.preferences).description("Follow MW preferences"),R.const(at.nochange).description("Keep the current watchlist status"),R.const(at.watch).description("Add the page to watchlist"),R.const(at.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(at.preferences),"quickEdit.keyshortcut.save":R.string().default("ctrl-s").description("save button key shortcut (blank to disable)"),"quickEdit.editFont":R.union([R.const("preferences").description("Follow MW preferences"),R.const("monospace").description("Monospace"),R.const("sans-serif").description("Sans-serif"),R.const("serif").description("Serif"),R.string().description("Custom font (same as CSS `font-family` property)").default("")]).description("Font to use in quick edit's textarea").default("preferences")}).description("Quick edit options").extra("category","editor"))];let zr=(yi=class extends(lf=et){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",nf(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){const i=this.ctx.$;if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const g=new URLSearchParams(window.location.search),y=this.ctx.currentPage.wikiTitle;e={...e,title:y?.getPrefixedDBKey(),revision:g.has("oldid")?Number(g.get("oldid")):void 0,pageId:g.has("curid")?Number(g.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const g=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);g&&g.title.getNamespaceId()>=0&&(e.title=g.title.getPrefixedDBKey(),e.section??(e.section=g.section))}const n=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),s=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),o=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),a=await this.getEditFontOptions(),l={...this.DEFAULT_OPTIONS,editSummary:s,editMinor:o,...e};l.editSummary||(l.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:l});const c=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:n}).init();c.setTitle(m(_i,{children:["Loading: ",m("u",{children:l.title})]})),c.setContent(m("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:m(ai,{})})),c.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:i`Cancel`,method(){c.close()}}),c.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:c,options:l});let u;try{if(u=await this.getWikiPageFromPayload(l),u.pageInfo.special)throw new Error(i`Special page is not editable.`)}catch(g){c.off(c.Event.Close),c.close(),this.ctx.modal.notify("error",{content:g instanceof Error?g.message:String(g)});return}const f=l.section==="new"?"":u.revisions[0]?.content||"",h=u.revisions[0]?.revid,p=h&&h!==u.lastrevid,d=l.section==="new",w=u.pageid===0;c.setTitle(m(_i,{children:[d?i`New Section`:i`Quick ${w?"Create":"Edit"}`,": ",m("u",{children:u.pageInfo.title}),p?` (${i`Revision`} ${h})`:""]}));const S=[];w&&S.push(m(Qo,{title:i`Attention`,type:"important",children:m("p",{children:i`This page does not exist.`})})),p&&S.push(m(Qo,{title:i`Attention`,type:"warning",children:m("p",{innerHTML:i`You are editing a <em>historical version</em>; the content is not the latest!`})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:l,modal:c,wikiPage:u,editNotices:S});const E=m("form",{className:"ipe-quickEdit__form",children:[m("div",{className:"ipe-quickEdit__notices",children:S}),m("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[l.section==="new"&&m(_i,{children:m(Hr,{label:i`Section title`,id:"summary",name:"summary",value:"",inputProps:{placeholder:i`Topic for new section, this will be the h2 heading`}})}),m("textarea",{className:`ipe-quickEdit__textarea ${a.className}`,style:{fontFamily:a.fontFamily},name:"text",id:"wpTextbox1",children:f})]}),m("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!d&&m(Hr,{label:i`Summary`,id:"summary",name:"summary",value:l.editSummary}),m("div",{className:"ipe-input-box",children:[m("label",{htmlFor:"watchlist",style:{display:"block"},children:i`Watchlist`}),m("div",{style:{display:"flex",gap:"1rem"},children:[at.preferences,at.nochange,at.watch,at.unwatch].map(g=>m(xb,{name:"watchlist",value:g,inputProps:{checked:r===g},children:i`watchlist.${g}`},g))})]}),m("div",{style:{display:"flex",gap:"1rem"},children:[m(Ui,{name:"minor",id:"minor",checked:l.editMinor,children:i`Minor edit`}),m(Ui,{name:"reloadAfterSave",id:"reloadAfterSave",checked:l.reloadAfterSave,children:i`Reload after save`})]})]}),!1]});c.setContent(E),c.addButton({side:"left",className:"is-primary submit-btn",label:i`Submit`,keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const g=new FormData(E);c.setLoadingState(!0),this.handleSubmit({wikiPage:u,text:g.get("text"),summary:g.get("summary"),minor:g.get("minor")==="on",section:l.section,createonly:u.pageid===0,watchlist:r}).then(async()=>{c.setOptions({beforeClose:Go}),c.close(),this.ctx.modal.notify("success",{title:i`Submission Successful`,content:i`Your changes have been saved.`}),g.get("reloadAfterSave")&&(await Sb(500),location.reload())}).catch(y=>{this.ctx.modal.notify("error",{title:i`Submission Error`,content:y instanceof Error?y.message:String(y)}),c.setLoadingState(!1)})}},0),c.setOptions({beforeClose:()=>{const g=u.revisions[0]?.content||"";return(E.querySelector("textarea")?.value||"")===g?!0:(this.ctx.modal.confirm({className:"is-primary",title:i`Unsaved Changes`,content:i`All edit contents will be lost after closing the modal. Are you sure you want to close?`,center:!0,okBtn:{label:i`Give Up`,className:"is-danger is-ghost"},cancelBtn:{label:i`Continue Editing`,className:"is-primary is-ghost"}},v=>(v&&(c.setOptions({beforeClose:Go}),c.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:l,modal:c,wikiPage:u});const M=g=>E.querySelector("textarea")?.value===f?!0:(g.preventDefault(),i`You have unsaved changes. Are you sure you want to leave?`);window.addEventListener("beforeunload",M),c.on(c.Event.Close,()=>{window.removeEventListener("beforeunload",M)})}async handleSubmit(e){const i=e.wikiPage,n=e.summary||"",r=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return this.ctx.emit("quick-edit/submit",{ctx:this.ctx,wikiPage:i,summary:n,text:r,minor:s,createonly:o,watchlist:a}),i.edit({summary:n,text:r,watchlist:a,section:l},{minor:s,createonly:o})}async getEditFontOptions(){const e=await this.ctx.preferences.get("quickEdit.editFont");return yi.BUILT_IN_FONT_OPTIONS.includes(e)?{className:`mw-editfont-${e==="preferences"?this.ctx.wiki.userOptions?.editfont||"monospace":e}`,fontFamily:""}:{className:"mw-editfont-custom",fontFamily:e}}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.$,n=this.ctx.currentPage.wikiTitle,r=n&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),m("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),m("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:()=>r?i`Quick Edit`:i`Not editable`,onClick:()=>{const s=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:n?.getPrefixedText(),revision:s?Number(s):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}},yi.BUILT_IN_FONT_OPTIONS=["preferences","monospace","sans-serif","serif"],yi);Jo=Cb(lf),zr=Tb(Jo,0,"PluginQuickEdit",af,zr),Ob(Jo,1,zr);const Lb=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickEdit:zr},Symbol.toStringTag,{value:"Module"})),An={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},cf=t=>{const{inputs:e,enableSwap:i=!0,...n}=t,r=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(d=>d&&d.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const d=s[0],w=s[1],S=d.value,E=w.value;d.value=E,w.value=S,d.dispatchEvent(new Event("change")),w.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=d=>{if(!a)return;const w=d??!a.disabled;a.disabled=!w,w&&s.forEach(S=>{S&&(S.disabled=!1)})},h=m("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!i,ref:d=>a=d,children:m("svg",{ref:d=>l=d,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M20 10h-16l5.5 -6"}),m("path",{d:"M4 14h16l-5.5 6"})]})}),p=m("div",{className:`twin-swap-input ${An.twinSwapInput}`,...n,children:[r.map((d,w)=>{const{label:S,id:E,name:M,value:g,disabled:y,required:v,inputProps:x}=d,P=w===0,L=E||M;return m("div",{className:`${An.inputWrapper} ${P?An.inputLeft:An.inputRight}`,children:[S&&m("label",{htmlFor:L,children:S}),m("input",{ref:C=>s[w]=C,type:"text",id:L,name:M,value:g,disabled:y,required:v,...x})]})}),m("div",{className:An.swapButton,children:h})]});return p.swap=u,p.toggleEnableSwap=f,p};var Mb=Object.create,Zo=Object.defineProperty,Nb=Object.getOwnPropertyDescriptor,uf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ff=t=>{throw TypeError(t)},Db=(t,e,i)=>e in t?Zo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,jb=(t,e)=>Zo(t,"name",{value:e,configurable:!0}),Ub=t=>[,,,Mb(t?.[uf("metadata")]??null)],Bb=["class","method","getter","setter","accessor","field","value","get","set"],df=t=>t!==void 0&&typeof t!="function"?ff("Function expected"):t,Fb=(t,e,i,n,r)=>({kind:Bb[t],name:e,metadata:n,addInitializer:s=>i._?ff("Already initialized"):r.push(df(s||null))}),qb=(t,e)=>Db(e,uf("metadata"),t[3]),Hb=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},zb=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Nb(r,i));jb(r,i);for(var d=n.length-1;d>=0;d--)l=Fb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,df(o)&&(r=o);return qb(t,r),p&&Zo(r,i,p),u?c^4?s:p:r},hf,ea,pf;hf=[Vt(R.object({"quickMove.reason":R.string().default("[IPE-NEXT] Quick move")}).description("Quick move options").extra("category","editor")),Ee(["modal","wiki","$"])];class Kr extends(pf=et){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this)}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const i=e.$,n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),m("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),m("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),m("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),m("path",{d:"M17 12h.01"}),m("path",{d:"M13 12h.01"})]}),tooltip:()=>i`Quick Move`,group:"group1",index:1,onClick:()=>{this.showModal(r?{lockFromField:!0,from:n}:{})}})}async showModal(e){const i=this.ctx.$,n=await this.ctx.preferences.get("quickMove.reason"),r=this.ctx.modal.createObject({title:i`Quick Move`,content:m(ai,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return r.setContent(m("form",{ref:o=>s=o,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:o=>{if(o.preventDefault(),s?.checkValidity(),!s?.reportValidity())return;const a=new FormData(s),l={from:a.get("from")?.toString().trim(),to:a.get("to")?.toString().trim(),reason:a.get("reason")||"",movetalk:a.get("movetalk")==="on",movesubpages:a.get("movesubpages")==="on",noredirect:a.get("noredirect")==="on"};if(!l.from||!l.to){this.ctx.modal.notify("error",{title:i`Failed to move`,content:"From and to are required."});return}this.ctx.emit("quick-move/submit",{ctx:this.ctx,modal:r,payload:l}),r.setLoadingState(!0),this.movePage(l).then(()=>{location.reload()}).catch(c=>{r.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to move`,content:c instanceof Error?c.message:String(c)})})},children:[m(cf,{inputs:[{label:i`Move from`,name:"from",value:e?.from,required:!0},{label:i`Move to`,name:"to",value:e?.to,required:!0}]}),m("div",{children:m(Ui,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:i`Move talk page`})}),m("div",{children:m(Ui,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:i`Move subpages (up to 100)`})}),this.ctx.wiki.hasRight("suppressredirect")&&m("div",{children:m(Ui,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:i`Move without leaving a redirect`})}),m(Hr,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??n??""})]})),r.setButtons([{label:i`Move`,className:"is-primary is-ghost",method:()=>{s?.dispatchEvent(new Event("submit"))}}]),r.show()}async movePage(e){const{from:i,to:n,reason:r="",...s}=e;if(!i||!n)throw new Error("From and to titles are required.");if(i===n)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(n,r,s)}}ea=Ub(pf),Kr=zb(ea,0,"PluginQuickMove",hf,Kr),Hb(ea,1,Kr);const Kb=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return Kr}},Symbol.toStringTag,{value:"Module"}));var Wb=Object.create,ta=Object.defineProperty,Gb=Object.getOwnPropertyDescriptor,gf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),mf=t=>{throw TypeError(t)},Vb=(t,e,i)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Yb=(t,e)=>ta(t,"name",{value:e,configurable:!0}),Qb=t=>[,,,Wb(t?.[gf("metadata")]??null)],Xb=["class","method","getter","setter","accessor","field","value","get","set"],yf=t=>t!==void 0&&typeof t!="function"?mf("Function expected"):t,Jb=(t,e,i,n,r)=>({kind:Xb[t],name:e,metadata:n,addInitializer:s=>i._?mf("Already initialized"):r.push(yf(s||null))}),Zb=(t,e)=>Vb(e,gf("metadata"),t[3]),ev=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},tv=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&Gb(r,i));Yb(r,i);for(var d=n.length-1;d>=0;d--)l=Jb(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,yf(o)&&(r=o);return Zb(t,r),p&&ta(r,i,p),u?c^4?s:p:r},bf,ia,vf;bf=[Ee(["api","wikiPage","modal","preferences","$"]),Vt(R.object({"quickPreview.keyshortcut":R.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","editor").description("Quick preview options"))];class Wr extends(vf=et){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",nf(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}stop(){}previewWikitext(e,i,n,r,s){const o=this.ctx.$;return n||(n=this.ctx.wikiPage.newBlankPage({title:"API"})),(!r||r.isDestroyed)&&(r=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),r.show(),r.setTitle(o`Preview - Loading...`),r.setContent(m(ai,{})),r.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:r,wikiPage:n}),n.preview(e,i).then(a=>{const{data:{parse:l}}=a;r.setTitle(o(l.title)`Preview - {{ $1 }}`);let c=null;r.setContent(m("section",{children:m("div",{ref:u=>c=u,className:"mw-parser-output",innerHTML:l.text})})),window.mw?.hook&&typeof jQuery=="function"&&window.mw.hook("wikipage.content").fire(jQuery(c)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:r,wikiPage:n,text:e,parseData:l})}).catch(a=>{r.setTitle(o`Preview - Failed`),r.setContent(m(_i,{children:[m("p",{children:o`Failed to preview`}),m("p",{children:a instanceof Error?a.message:String(a)})]}))}),r}async injectQuickEdit({options:e,modal:i,wikiPage:n}){const r=this.ctx.$;let s;i.addButton({label:r`Preview`,side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let o=i.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const a=i.get$content().querySelector('input[name="summary"]')?.value;a&&(o=`==${a}==
25
25
  ${o}`)}s=this.previewWikitext(o,void 0,n,s,{backdrop:!1,draggable:!0})}},1),i.on(i.Event.Close,()=>{s?.destroy(),s=void 0})}}ia=Qb(vf),Wr=tv(ia,0,"PluginQuickPreview",bf,Wr),ev(ia,1,Wr);const iv=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return Wr}},Symbol.toStringTag,{value:"Module"})),nv=t=>{let{user:e,target:i,ctx:n}=t;const r=n.getUrl.bind(n);return m("span",{className:"mw-userlinks",children:[m("a",{href:r(`User:${e}`),className:"mw-userlink",target:i,children:e})," ",m("span",{className:"mw-usertoollinks",children:["(",m("a",{href:r(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:i,children:"talk"})," | ",m("a",{href:r(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:i,children:"contribs"})," | ",m("a",{href:r(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:i,children:"block"}),")"]})]})};var Gr=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(Gr||{});const rv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,wf=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return m("td",{colSpan:2,className:e,children:m("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const i=n=>{n.preventDefault(),n.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return m("td",{colSpan:2,className:e,children:[m("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),m("div",{className:"mw-diff-title--actions",children:m("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:i,children:[m(Tl,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),m("div",{className:"mw-diff-title--user",children:t.username&&m(nv,{ctx:t.ctx,user:t.username,target:"_blank"})}),m("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&rv(new Date(t.timestamp))}),m("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&m(_i,{children:["(",m("i",{innerHTML:t.parsedcomment}),")"]})})]})},sv=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const i=(n,r,s)=>{n.preventDefault(),n.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:r,torev:s},bubbles:!0}))};return m("tr",{className:"mw-diff-title--navigation",children:[m("td",{colSpan:2,children:e.prev?m("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:n=>i(n,e.prev,e.fromrevid),children:"← Previous"}):m("i",{children:"Oldest version"})}),m("td",{colSpan:2,children:e.next?m("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:n=>i(n,e.torevid,e.next),children:"Next →"}):m("i",{children:"Newest version"})})]})},ov=t=>{const{data:e,...i}=t,n=m("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...i,children:[m("colgroup",{children:[m("col",{className:"diff-marker"}),m("col",{className:"diff-content"}),m("col",{className:"diff-marker"}),m("col",{className:"diff-content"})]}),m("tbody",{children:[m("tr",{children:[m(wf,{ctx:t.ctx,type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),m(wf,{ctx:t.ctx,type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),m(sv,{data:e,ctx:t.ctx}),m("div",{id:"diffbody"}),m("tr",{className:"diff-size",style:{textAlign:"center"},children:[m("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),m("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return n.querySelector("#diffbody").outerHTML=e.body||m("tr",{children:m("td",{colSpan:4,children:m("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:m("i",{children:"No changes"})})})}).outerHTML,n},av=(t,e=document)=>e.querySelector(t),lv=(t,e=document)=>e.querySelectorAll(t);var cv=Object.create,na=Object.defineProperty,uv=Object.getOwnPropertyDescriptor,_f=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xf=t=>{throw TypeError(t)},fv=(t,e,i)=>e in t?na(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,dv=(t,e)=>na(t,"name",{value:e,configurable:!0}),hv=t=>[,,,cv(t?.[_f("metadata")]??null)],pv=["class","method","getter","setter","accessor","field","value","get","set"],Sf=t=>t!==void 0&&typeof t!="function"?xf("Function expected"):t,gv=(t,e,i,n,r)=>({kind:pv[t],name:e,metadata:n,addInitializer:s=>i._?xf("Already initialized"):r.push(Sf(s||null))}),mv=(t,e)=>fv(e,_f("metadata"),t[3]),yv=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},bv=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&uv(r,i));dv(r,i);for(var d=n.length-1;d>=0;d--)l=gv(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Sf(o)&&(r=o);return mv(t,r),p&&na(r,i,p),u?c^4?s:p:r},kf,ra,$f;kf=[Ee(["wiki","getUrl","preferences","$"]),Vt(R.object({"quickDiff.keyshortcut":R.string().default("ctrl-d").description("Key shortcut to open quick diff in quick edit modal")}).description("Quick diff options").extra("category","editor"))];class Vr extends($f=et){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){}injectHistoryPage(){const e=this.ctx.$,i=av("#mw-history-compare");if(!i)return;lv(".mw-history-compareselectedversions-button",i).forEach(r=>{r.after(m("button",{className:"cdx-button",onClick:s=>{s.preventDefault();const o=new FormData(i),a=Number(o.get("oldid"))||0,l=Number(o.get("diff"))||0;if(!o.get("title")||!a||!l)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:a,torev:l})},children:e`Quick Diff`}))})}async injectQuickEdit({modal:e,wikiPage:i,options:n}){if(i.pageid===0||n.section==="new")return;const r=this.ctx.$;let s;e.addButton({label:r`Diff`,side:"left",keyPress:await this.ctx.preferences.get("quickDiff.keyshortcut")||void 0,className:"btn btn-secondary",method:()=>{const o=i.title,a=i.revisions?.[0]?.content||"",l=e.get$content().querySelector('textarea[name="text"]')?.value||"";return a===l?this.ctx.modal.notify("info",{title:r`Quick Diff`,content:r`No changes`}):(this.ctx.emit("quick-diff/quick-edit-modal",{ctx:this.ctx,modal:e,wikiPage:i}),s=this.comparePages({fromtitle:o,fromtext:a,totitle:o,totext:l,topst:!0},s,{backdrop:!1,draggable:!0}),s)}},2),e.on(e.Event.Close,()=>{s?.destroy(),s=void 0})}comparePages(e,i,n){const r=this.ctx.$;return!i||i.isDestroyed?i=this.ctx.modal.createObject({title:r`Loading diff...`,content:"",className:"quick-diff",center:!1,...n}).init():i.removeButton("*"),this.ctx.emit("quick-diff/init-options",{ctx:this.ctx,options:e}),i.setContent(m("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:m(ai,{})})),i.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(s=>{if(!s.data.compare)throw new Error("No compare data received",{cause:s});const{data:{compare:o}}=s;i.setTitle(o.fromtitle&&o.totitle?`${o.fromtitle}${o.fromrevid?` (${o.fromrevid})`:""} ⇔ ${o.totitle}${o.torevid?` (${o.torevid})`:""}`:r`Differences`);let a;i.setContent(m("section",{style:{minHeight:"70vh"},children:m(ov,{ref:l=>a=l,data:o,ctx:this.ctx})})),a.addEventListener(Gr.update,l=>{l.stopPropagation(),this.comparePages({fromrev:l.detail.fromrev,torev:l.detail.torev},i,n)},{once:!0}),this.ctx.inject(["quickEdit"],l=>{const c=u=>{u.stopPropagation(),l.quickEdit({revision:u.detail.revid})};a.addEventListener(Gr.edit,c),i.on(i.Event.Close,()=>{a.removeEventListener(Gr.edit,c)})}),o.fromrevid&&o.torevid&&i.addButton({label:r`Original Compare Page`,side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:o.fromrevid,diff:o.torevid})}}),this.ctx.emit("quick-diff/loaded",{ctx:this.ctx,modal:i,compare:o})}).catch(s=>{i.setContent(m(Qo,{title:r`Failed to load diff`,type:"error",children:m("pre",{children:s instanceof Error?s.message:String(s)})}))}),i.show()}}ra=hv($f),Vr=bv(ra,0,"PluginQuickDiff",kf,Vr),yv(ra,1,Vr);const vv=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDiff(){return Vr}},Symbol.toStringTag,{value:"Module"})),es=class es extends et{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this);const e=this.ctx.$,i=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),m("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),m("path",{d:"M9 17l3 -3l-3 -3"}),m("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),m("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:()=>e`Quick Redirect`,group:"group1",index:2,onClick:()=>{this.showModal(n?{to:i}:{})}}),this.addDisposeHandler(s=>{s.toolbox.removeButton("quick-redirect")})})}stop(){}async showModal(e){const i=this.ctx.$,n=await this.ctx.preferences.get("quickRedirect.reason");e||(e={}),this.ctx.emit("quick-redirect/init-options",{ctx:this.ctx,options:e});const r=this.ctx.modal.createObject({title:i`Quick Redirect`,content:m(ai,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return r.setContent(m("form",{ref:o=>s=o,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:o=>{if(o.preventDefault(),s?.checkValidity(),!s?.reportValidity())return;const a=new FormData(s),l={from:a.get("from")?.toString().trim(),to:a.get("to")?.toString().trim(),reason:a.get("reason")||"",overwrite:a.get("overwrite")==="on"};if(!l.from||!l.to){this.ctx.modal.notify("error",{title:i`Failed to redirect`,content:i`From and to are required.`});return}this.ctx.emit("quick-redirect/submit",{ctx:this.ctx,payload:l}),r.setLoadingState(!0),this.redirectPage(l).then(c=>{r.close(),this.ctx.modal.notify("success",{title:i`Redirect successful`,content:i`The redirect has been created.`})}).catch(c=>{r.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to redirect`,content:c instanceof Error?c.message:String(c)})})},children:[m(cf,{inputs:[{label:i`Redirect from`,name:"from",value:e?.from,required:!0},{label:i`Redirect to`,name:"to",value:e?.to,required:!0}]}),m(Hr,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??n??""}),m("div",{children:m(Ui,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:i`Force create redirect even if the from page already exists`})})]})),r.setButtons([{label:i`Create Redirect`,className:"is-primary is-ghost",method:()=>{s?.dispatchEvent(new Event("submit"))}}]),this.ctx.emit("quick-redirect/show-modal",{ctx:this.ctx,modal:r}),r.show()}async redirectPage(e){const{from:i,to:n,reason:r="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:i}),a=`#REDIRECT [[:${n}]]`;return o.edit({text:a,summary:r},{createonly:!s})}};es.inject=["api","wikiPage","modal","$"],es.PreferencesSchema=R.object({"quickRedirect.reason":R.string().default("[IPE-NEXT] Quick redirect")}).description("Quick redirect options").extra("category","editor");let sa=es;const wv=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:sa},Symbol.toStringTag,{value:"Module"}));var _v=Object.create,oa=Object.defineProperty,xv=Object.getOwnPropertyDescriptor,Ef=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Pf=t=>{throw TypeError(t)},Sv=(t,e,i)=>e in t?oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,kv=(t,e)=>oa(t,"name",{value:e,configurable:!0}),$v=t=>[,,,_v(t?.[Ef("metadata")]??null)],Ev=["class","method","getter","setter","accessor","field","value","get","set"],Cf=t=>t!==void 0&&typeof t!="function"?Pf("Function expected"):t,Pv=(t,e,i,n,r)=>({kind:Ev[t],name:e,metadata:n,addInitializer:s=>i._?Pf("Already initialized"):r.push(Cf(s||null))}),Cv=(t,e)=>Sv(e,Ef("metadata"),t[3]),Rv=(t,e,i,n)=>{for(var r=0,s=t[e>>1],o=s&&s.length;r<o;r++)s[r].call(i);return n},Iv=(t,e,i,n,r,s)=>{var o,a,l,c=e&7,u=!1,f=0,h=t[f]||(t[f]=[]),p=c&&(r=r.prototype,c<5&&(c>3||!u)&&xv(r,i));kv(r,i);for(var d=n.length-1;d>=0;d--)l=Pv(c,i,a={},t[3],h),o=(0,n[d])(r,l),a._=1,Cf(o)&&(r=o);return Cv(t,r),p&&oa(r,i,p),u?c^4?s:p:r},Rf,aa,If;Rf=[Vt(R.object({toolboxAlwaysShow:R.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),Ee(["preferences"])];class Yr extends(If=wt){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0,this.buttons=[],this.seqCounter=0,this.seqMap=new Map,this.compareButtons=(i,n)=>{const r=this.orderKey(i),s=this.orderKey(n),o=r??0,a=s??0;if(o<a)return-1;if(o>a)return 1;const l=this.seqMap.get(i.id)??0,c=this.seqMap.get(n.id)??0;return r===null&&s===null?l!==c?l-c:0:r===null&&s!==null?-1:r!==null&&s===null?1:l!==c?l-c:0}}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.ctx.on("i18n/changed",()=>{this.renderAll()})}stop(){this.container?.remove()}get isPersistent(){return this.container.classList.contains("is-persistent")}setupHoverLogic(){let e=null;this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),this.isPersistent||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{this.isPersistent||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,i){if(i<=1)return 0;const n=.15,r=e/(i-1),s=n*Math.sqrt(r);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(i=>{const n=i.querySelectorAll(".btn-tip-group"),r=n.length;n.forEach((s,o)=>{const a=this.calculateButtonDelay(o,r);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return m("div",{id:"ipe-edit-toolbox",children:[m("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),m("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),m("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[m("rect",{width:"448",height:"512",fill:"none"}),m("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/[\s.#]+/g,"-")}chooseAutoGroup(){const e=this.buttons.filter(n=>n.group==="group1").length,i=this.buttons.filter(n=>n.group==="group2").length;return e<=i?"group1":"group2"}orderKey(e){const i=e.index;return typeof i=="number"?Number.isNaN(i)?null:i:null}addButton(e){e.id=(e.id||"").trim(),e.id||(this.ctx.logger("toolbox").warn("Button id is empty, generating a random one."),e.id=Math.random().toString(36).slice(2,10));const i=this.buttons.findIndex(r=>r.id===e.id),n=(()=>{if(i!==-1){const r=this.buttons[i];return!e.group||e.group==="auto"?r.group:e.group}return!e.group||e.group==="auto"?this.chooseAutoGroup():e.group})();if(this.seqMap.has(e.id)||this.seqMap.set(e.id,this.seqCounter++),i!==-1){const r=this.buttons[i],s=typeof e.index=="number"&&!Number.isNaN(e.index)?e.index:r.index,o={...r,...e,group:n,index:s};this.buttons.splice(i,1,o)}else{const r=typeof e.index=="number"&&!Number.isNaN(e.index)?e.index:void 0,s={...e,group:n,index:r};this.buttons.push(s)}this.ctx.emit("toolbox/button-added",{ctx:this.ctx,payload:e}),this.renderAll()}removeButton(e){const i=this.buttons.findIndex(n=>n.id===e);if(i!==-1){const n=this.buttons[i];this.buttons.splice(i,1),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,payload:n}),this.renderAll()}}renderButton(e){let{id:i,icon:n,index:r,tooltip:s,itemProps:o,buttonProps:a,onClick:l}=e;const c=this.normalizeButtonId(i);return m("li",{class:"btn-tip-group",id:c,"data-id":i,"data-index":r,...o,children:[m("div",{class:"btn-tip",children:fl(s)}),m("button",{id:`${c}-btn`,"data-id":e.id,class:"ipe-toolbox-btn",onClick:f=>{l?.(f),this.ctx.emit("toolbox/button-clicked",{ctx:this.ctx,event:f,payload:e})},...a,children:fl(n)})]})}renderAll(){const e=this.buttons.filter(s=>s.group==="group1").slice().sort(this.compareButtons),i=this.buttons.filter(s=>s.group==="group2").slice().sort(this.compareButtons),n=this.container.querySelector(".btn-group.group1"),r=this.container.querySelector(".btn-group.group2");n.innerHTML="",r.innerHTML="",e.forEach(s=>{n.appendChild(this.renderButton(s))}),i.forEach(s=>{r.appendChild(this.renderButton(s))}),this.updateButtonDelays()}getContainer(){return this.container}get isOpened(){return this.container.classList.contains("is-persistent")||this.container.classList.contains("is-hovered")}toggle(e){const i=this.isPersistent,n=typeof e=="boolean"?e:!i;this.container.classList.toggle("is-persistent",n),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",n),this.ctx.emit("toolbox/toggle",{ctx:this.ctx,opened:this.isOpened})}}aa=$v(If),Yr=Iv(aa,0,"PluginToolbox",Rf,Yr),Rv(aa,1,Yr);const Av=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return Yr}},Symbol.toStringTag,{value:"Module"})),Qr=fi({__name:"UIBaseButton",props:{variant:{default:"neutral"},active:{type:Boolean,default:!1}},setup(t){const e=t,i=It(()=>({"is-active":e.active,"is-danger":e.variant==="danger","is-primary":e.variant==="primary","is-ghost":e.variant==="ghost","is-accent":e.variant==="accent"}));return(n,r)=>(oe(),de("button",{class:pt(["ipeps-button",i.value])},[bm(n.$slots,"default")],2))}}),Ov={id:"ipe-registry-manager"},Tv={class:"ipeps-header"},Lv={class:"ipeps-header-title"},Mv={class:"ipeps-input-wrapper"},Nv=["placeholder","disabled"],Dv={key:0,class:"ipeps-list"},jv={class:"registry-info"},Uv={class:"item-name"},Bv={class:"item-desc"},Fv={class:"homepage"},qv=["href"],Hv={class:"url"},zv={class:"item-meta"},Kv={class:"ipeps-actions"},Wv={key:1,class:"ipeps-empty"},Gv={class:"text"},Vv={class:"description"},Yv=Br(fi({__name:"RegistryManager",setup(t){const e=Fo(),i=e.$,n=e.$$,r=Ue([]),s=Ue(""),o=Ue(!1),a=d=>{try{return new URL(d).hostname}catch{return d}};async function l(){const d=await e.preferences.get("pluginStore.registries")||[],w=await Promise.allSettled(d.map(async S=>{const E=await e.store.getRegistryInfo(S);return{registryUrl:S,label:a(S),...E}}));r.value=w.filter(S=>S.status==="fulfilled").map(S=>S.value)}async function c(){const d=s.value.trim();if(d){if(r.value.some(w=>w.registryUrl===d)){e.modal.notify("info",{content:"Registry already exists."});return}o.value=!0;try{const w=await e.store.getRegistryInfo(d,"online_manifest",!0);if(!w)throw new Error("Invalid registry or unreachable");const S=await e.preferences.get("pluginStore.registries")||[];S.push(d),await e.preferences.set("pluginStore.registries",S),r.value.push({registryUrl:d,label:a(d),...w}),s.value="",e.modal.notify("success",{content:"Registry added."})}catch(w){e.modal.notify("error",{content:w instanceof Error?w.message:String(w)})}finally{o.value=!1}}}async function u(d){const S=(await e.preferences.get("pluginStore.registries")||[]).filter(E=>E!==d);await e.preferences.set("pluginStore.registries",S),r.value=r.value.filter(E=>E.registryUrl!==d)}async function f(d){const S=(await e.preferences.get("pluginStore.plugins")||[]).filter(E=>E.registry===d);if(S.length===0){e.modal.confirm({title:n`plugin-store.remove-registry.title`,content:n`plugin-store.remove-registry.tip-content`+`
26
26
  ${d}`,cancelBtn:{label:i`Cancel`,className:"is-ghost"},okBtn:{label:i`Remove`,className:"is-danger"}},async E=>{E&&(await u(d),e.modal.notify("success",{content:n`plugin-store.remove-registry.remove-success`}))});return}e.modal.dialog({title:n`plugin-store.remove-registry.title`,content:nn("div",{class:"theme-ipe-prose"},[nn("p",{},n({$1:S.length})`plugin-store.remove-registry.confirm-content`),nn("ul",{},S.map(E=>nn("li",{},E.id)))]),buttons:[{label:n`plugin-store.remove-registry.buttons.remove-only`,className:"is-danger is-ghost",method:async(E,M)=>{await u(d),e.modal.notify("success",{content:n`plugin-store.remove-registry.remove-success`}),M.close()}},{label:n`plugin-store.remove-registry.buttons.remove-and-uninstall`,className:"is-danger",method:async(E,M)=>{await u(d);for(const g of S)try{await e.store.uninstallAndRemovePreference(g.registry,g.id)}catch(y){e.modal.notify("error",{content:y instanceof Error?`Failed to uninstall ${g.id}: ${y.message}`:`Failed to uninstall ${g.id}`})}e.modal.notify("success",{content:n({$1:S.length})`plugin-store.remove-registry.remove-with-plugins-success`}),M.close()}}]},()=>{})}function h(d){const w=d.changes["pluginStore.registries"];Array.isArray(w)&&l()}function p(){const d=xt.PLUGIN_REGISTRY_URL;s.value=d,c()}return wn(()=>{l(),e.on("preferences/changed",h)}),(d,w)=>(oe(),de("div",Ov,[J("div",Tv,[J("div",Lv,ue(Pe(i)`Registries`),1),J("div",Mv,[kc(J("input",{class:"ipeps-input with-icon","onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S),type:"url",placeholder:Pe(i)`Add registry URL`+" (https://...)",disabled:o.value},null,8,Nv),[[Cu,s.value,void 0,{trim:!0}]]),w[1]||(w[1]=J("div",{class:"ipeps-input-icon"},"📦",-1))]),Ce(Qr,{onClick:c,disabled:o.value||!s.value,variant:"primary"},{default:bn(()=>[Pn(ue(o.value?Pe(i)`Adding...`:Pe(i)`Add`),1)]),_:1},8,["disabled"])]),r.value.length?(oe(),de("div",Dv,[(oe(!0),de(qe,null,_o(r.value,S=>(oe(),de("div",{class:"ipeps-item",key:S.registryUrl},[J("div",jv,[J("div",Uv,ue(S.label),1),J("div",Bv,[J("div",Fv,[S.homepage?(oe(),de("a",{key:0,href:S.homepage,target:"_blank"},ue(S.homepage),9,qv)):Jt("",!0)]),J("div",Hv,ue(S.registryUrl),1)]),J("div",zv,ue(S.packages.length)+" packages",1)]),J("div",Kv,[Ce(Qr,{onClick:E=>f(S.registryUrl),variant:"danger"},{default:bn(()=>[Pn(ue(Pe(i)`Remove`),1)]),_:1},8,["onClick"])])]))),128))])):(oe(),de("div",Wv,[w[2]||(w[2]=J("div",{class:"icon"},"🗂️",-1)),J("div",Gv,ue(Pe(i)`No registries configured`),1),J("div",Vv,[Ce(Qr,{onClick:p,variant:"primary",style:{padding:"0.25rem 0.5rem"}},{default:bn(()=>[Pn(ue(Pe(i)`Setup default registry`),1)]),_:1})])]))]))}}),[["__scopeId","data-v-971ee6d5"]]),Qv={id:"ipe-plugin-install-manager"},Xv={class:"ipeps-header"},Jv={class:"ipeps-header-title"},Zv={class:"ipeps-input-wrapper"},ew=["disabled"],tw=["disabled"],iw={key:0,class:"ipeps-loading"},nw={class:"loading-text"},rw={key:1,class:"ipeps-list"},sw={class:"plugin-info"},ow={class:"plugin-header"},aw={class:"item-name"},lw={class:"ipeps-tags"},cw=["href","title"],uw=["title"],fw={class:"plugin-meta"},dw={key:0,class:"version"},hw={key:1,class:"author"},pw={key:2,class:"license"},gw={key:2,class:"ipeps-empty"},yw={class:"plugin-empty-text"},bw=Br(fi({__name:"PluginInstallManager",setup(t){const e=Fo(),i=e.$,n=e.$$,r=Ue([]),s=Ue([]),o=Ue(""),a=Ue(!1),l=(C,U)=>`${C}
27
27
  ${U}`,c=It(()=>new Set(s.value.map(C=>l(C.registry,C.id)))),u=C=>c.value.has(C),f=C=>{try{return new URL(C).hostname}catch{return C}},h=Ue(!1),p=It(()=>r.value.length>0),d=It(()=>r.value.flatMap(C=>(C.packages||[]).map(U=>({...U,_key:l(C.registryUrl,U.id),registry:C.registryUrl,registryHomepage:C.homepage,registryLabel:f(C.registryUrl),isBroken:!1,isRegistryMissing:!1})))),w=It(()=>{const C=o.value.trim().toLowerCase(),U=d.value,H=new Set(U.map(ke=>ke._key)),He=new Set(r.value.map(ke=>ke.registryUrl)),dt=s.value.filter(ke=>!H.has(l(ke.registry,ke.id))).map(ke=>{const ce=r.value.find(me=>me.registryUrl===ke.registry);return{id:ke.id,name:void 0,description:void 0,version:void 0,author:void 0,license:void 0,_key:l(ke.registry,ke.id),registry:ke.registry,registryHomepage:ce?.homepage,registryLabel:f(ke.registry),isBroken:!0,isRegistryMissing:!He.has(ke.registry)}}),Ki=ke=>C?ke.filter(ce=>ce.name&&ce.name.toLowerCase().includes(C)||ce.id&&ce.id.toLowerCase().includes(C)||ce.description&&ce.description.toLowerCase().includes(C)||ce.author&&ce.author.toLowerCase().includes(C)||ce.registry&&ce.registry.toLowerCase().includes(C)):ke;return[...Ki(dt),...Ki(U)]}),S=It(()=>w.value),E=C=>C.description?C.description:C.isBroken?C.isRegistryMissing?n`plugin-store.broken.registry-unavailable`:n`plugin-store.broken.plugin-removed`:"",M=async(C,U)=>{e.store.installAndSetPreference(C,U)},g=async(C,U)=>{e.store.uninstallAndRemovePreference(C,U)},y=(C,U)=>u(l(C,U))?g(C,U):M(C,U),v=C=>y(C.registry,C.id),x=async()=>{if(a.value)return;if(r.value.length===0){e.modal.notify("info",{content:"No registry configured. Please add a registry first."});return}a.value=!0;const C=await e.store.refreshAllRegistryCaches(),U=Object.entries(C).filter(([He,dt])=>dt!==null);r.value=U.map(([He,dt])=>({...dt,registryUrl:He}));const H=Object.entries(C).filter(([He,dt])=>dt===null).map(([He])=>He);a.value=!1,U.length===0?e.modal.notify("error",{content:"All registries failed to refresh"}):(e.modal.notify("success",{content:`${U.length} ${U.length===1?"registry":"registries"} refreshed successfully.`}),H.length>0&&e.modal.notify("warning",{content:`${H.length} ${H.length===1?"registry":"registries"} failed to refresh: