@inpageedit/core 0.17.2 → 0.17.4

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.
Files changed (44) hide show
  1. package/dist/InPageEdit.js +1 -1
  2. package/dist/{PluginImagesUsed-bCsiMdd5.js → PluginImagesUsed-DIsW4sQH.js} +2 -2
  3. package/dist/{PluginImagesUsed-bCsiMdd5.js.map → PluginImagesUsed-DIsW4sQH.js.map} +1 -1
  4. package/dist/{PluginPrefSync-CjVsY-Ei.js → PluginPrefSync-BM1-tOBL.js} +2 -2
  5. package/dist/{PluginPrefSync-CjVsY-Ei.js.map → PluginPrefSync-BM1-tOBL.js.map} +1 -1
  6. package/dist/{PluginStoreApp-DKxtArs5.js → PluginStoreApp-By2yV_Kl.js} +2 -2
  7. package/dist/{PluginStoreApp-DKxtArs5.js.map → PluginStoreApp-By2yV_Kl.js.map} +1 -1
  8. package/dist/{PluginTemplatesUsed-CSrc0hi5.js → PluginTemplatesUsed-BhNX1xSY.js} +2 -2
  9. package/dist/{PluginTemplatesUsed-CSrc0hi5.js.map → PluginTemplatesUsed-BhNX1xSY.js.map} +1 -1
  10. package/dist/core.js +2 -2
  11. package/dist/{index-BPZDprsy.js → index-B5KNZ_9z.js} +2 -2
  12. package/dist/{index-BPZDprsy.js.map → index-B5KNZ_9z.js.map} +1 -1
  13. package/dist/{index-CxckcdDI.js → index-BAJiXDPz.js} +14 -14
  14. package/dist/{index-CxckcdDI.js.map → index-BAJiXDPz.js.map} +1 -1
  15. package/dist/{index-CkKY3iId.js → index-BFdMEvlW.js} +2 -2
  16. package/dist/{index-CkKY3iId.js.map → index-BFdMEvlW.js.map} +1 -1
  17. package/dist/{index-wpZvFBVX.js → index-Bd_cTayA.js} +3 -3
  18. package/dist/{index-wpZvFBVX.js.map → index-Bd_cTayA.js.map} +1 -1
  19. package/dist/{index-0iItkJyW.js → index-Bf8jOXlz.js} +3 -3
  20. package/dist/{index-0iItkJyW.js.map → index-Bf8jOXlz.js.map} +1 -1
  21. package/dist/{index-DRpv1zoB.js → index-BoVgsh8u.js} +2 -2
  22. package/dist/{index-DRpv1zoB.js.map → index-BoVgsh8u.js.map} +1 -1
  23. package/dist/{index-67KKEC1h.js → index-CZfEZBOj.js} +2 -2
  24. package/dist/{index-67KKEC1h.js.map → index-CZfEZBOj.js.map} +1 -1
  25. package/dist/{index-CFwPBIwv.js → index-CoX1x5ls.js} +2 -2
  26. package/dist/{index-CFwPBIwv.js.map → index-CoX1x5ls.js.map} +1 -1
  27. package/dist/{index-Bf9sWKqX.js → index-D8_-baBt.js} +2 -2
  28. package/dist/{index-Bf9sWKqX.js.map → index-D8_-baBt.js.map} +1 -1
  29. package/dist/{index-DtXCZneF.js → index-DHitL1S2.js} +2 -2
  30. package/dist/{index-DtXCZneF.js.map → index-DHitL1S2.js.map} +1 -1
  31. package/dist/{index-BGSq0cLS.js → index-QZjXZBoj.js} +22 -13
  32. package/dist/index-QZjXZBoj.js.map +1 -0
  33. package/dist/{index-D78nVTYO.js → index-S6Jhp39r.js} +2 -2
  34. package/dist/{index-D78nVTYO.js.map → index-S6Jhp39r.js.map} +1 -1
  35. package/dist/{index-BonYcMRR.js → index-ruv3nAtX.js} +2 -2
  36. package/dist/{index-BonYcMRR.js.map → index-ruv3nAtX.js.map} +1 -1
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +2 -2
  39. package/dist/plugins/index.js +12 -12
  40. package/dist/services/index.js +1 -1
  41. package/lib/index.umd.js +2 -2
  42. package/lib/index.umd.js.map +1 -1
  43. package/package.json +3 -3
  44. package/dist/index-BGSq0cLS.js.map +0 -1
package/lib/index.umd.js CHANGED
@@ -9,7 +9,7 @@
9
9
  } catch (e) {
10
10
  throw e;
11
11
  }
12
- `);return(i,r)=>{const n=new Proxy(r,{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,n)}}function ic(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Fi(t){return ic(t).replace(/_/g,"-").replace(/.[A-Z]+/g,e=>e[0]+"-"+e.slice(1).toLowerCase())}function Ng(t){return ic(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}function li(t,e){let i=t[0]??"";for(let r=0;r<e.length;r++)i+=String(e[r])+(t[r+1]??"");return i}class Mg{constructor(e,i){this.languages=new Map,this.currentLanguage="en",this.missingKeys=new Map,this.usedKeys=new Set;const r=i?.language||"en";this.currentLanguage=r,this.interpolate=tc(i?.globals),e&&Object.keys(e).length&&this.setLanguageData(r,e)}setGlobals(e){return this.interpolate=tc(e),this}set(e,i){const r=this.currentLanguage,n=this.ensureLanguageMap(r);if(typeof e=="string"&&typeof i=="string")n.set(e,i);else if(typeof e=="object"){const s=this.toStringRecord(e);for(const[o,a]of Object.entries(s))n.set(o,a)}return this}setLanguageData(e,i){e=Fi(e).toLowerCase();const r=this.ensureLanguageMap(e),n=this.toStringRecord(i);for(const[s,o]of Object.entries(n))r.set(s,o);return this}setLanguage(e){return e=Fi(e).toLowerCase(),this.currentLanguage=e,this}getLanguage(){return this.currentLanguage}hasLanguage(e){e=Fi(e).toLowerCase();const i=this.languages.get(e);return i&&Object.keys(i).length>0}toStringRecord(e,i){const r={};for(const[n,s]of Object.entries(e)){const o=i?`${i}.${n}`:n;if(s&&typeof s=="object"&&!Array.isArray(s)){const a=this.toStringRecord(s,o);for(const[c,l]of Object.entries(a))r[c]=String(l)}else r[o]=String(s)}return r}has(e){const i=this.resolveLanguageOrder(this.currentLanguage);for(const r of i)if(this.languages.get(r)?.has(e))return!0;return!1}get(e){this.recordUsedKey(e);const i=this.resolveLanguageOrder(this.currentLanguage),r=[];for(const n of i){const o=this.languages.get(n)?.get(e);if(typeof o<"u")return r.length&&this.recordMissing(e,r),o;r.push(n)}r.length&&this.recordMissing(e,r)}translate(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const r=this.get(e);return typeof r>"u"?this.interpolate(e,...i):this.interpolate(r,...i)}$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],s=e.slice(1),o=li(n,s);return this.translate(o)}const r=e;return(n,...s)=>{const o=li(n,s);return this.translate(o,...r)}}translateRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??e:""}$raw(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],n=e.slice(1),s=li(r,n);return this.translateRaw(s)}return(r,...n)=>{const s=li(r,n);return this.translateRaw(s)}}message(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const r=this.get(e);return typeof r>"u"?`(${e})`:this.interpolate(r,...i)}$$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],s=e.slice(1),o=li(n,s);return this.message(o)}const r=e;return(n,...s)=>{const o=li(n,s);return this.message(o,...r)}}messageRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??`(${e})`:""}$$raw(...e){if(Array.isArray(e[0])&&e[0].raw){const r=e[0],n=e.slice(1),s=li(r,n);return this.messageRaw(s)}return(r,...n)=>{const s=li(r,n);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 r=this.missingKeys.get(e)||[];for(const n of i)r.includes(n)||r.push(n);this.missingKeys.set(e,r)}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}}var Dg=Object.create,fo=Object.defineProperty,jg=Object.getOwnPropertyDescriptor,rc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),nc=t=>{throw TypeError(t)},Ug=(t,e,i)=>e in t?fo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Fg=(t,e)=>fo(t,"name",{value:e,configurable:!0}),qg=t=>[,,,Dg(t?.[rc("metadata")]??null)],Bg=["class","method","getter","setter","accessor","field","value","get","set"],sc=t=>t!==void 0&&typeof t!="function"?nc("Function expected"):t,Hg=(t,e,i,r,n)=>({kind:Bg[t],name:e,metadata:r,addInitializer:s=>i._?nc("Already initialized"):n.push(sc(s||null))}),zg=(t,e)=>Ug(e,rc("metadata"),t[3]),Wg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Kg=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&jg(n,i));Fg(n,i);for(var h=r.length-1;h>=0;h--)c=Hg(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,sc(o)&&(n=o);return zg(t,n),p&&fo(n,i,p),u?l^4?s:p:n},oc,ho,ac;const lc=new A(A.object({manifest_version:A.const(1).required(),base_language:A.string().required(),last_modified:A.string().required(),languages:A.dict(A.object({file:A.string().required(),fallback:A.string(),iso_name:A.string(),endonym:A.string(),data:A.transform(A.dict(A.any()).default({}),t=>Object.keys(t).length>0?t:void 0)})).required()}));oc=[xe(["wiki","preferences"]),Ot(A.object({"i18n.index_url":A.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(xt.I18N_INDEX_URL)}).description("").extra("category","general"))];class _n extends(ac=ht){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 Mg({},{language:"",globals:{userName:this.ctx.wiki.userInfo.name||"",userId:this.ctx.wiki.userInfo.id||0,siteName:this.ctx.wiki.siteInfo.general.sitename||""}}),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",A.object({language:A.union(["@user","@site",A.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 r=await this.ctx.preferences.get("language"),n=this.normalizeLanguageCode(r);this.logger.debug("Settings",{prefer:r,normalized:n});try{await this.switchLanguage(n),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",A.object({language:A.union([A.const("@user").description(this.$`Same as your personal language`),A.const("@site").description(this.$`Same as the site language`),...this.getAvailableLanguageCodes().map(({code:s,endonym:o,iso_name:a})=>A.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"),Fi(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,r){const n=r?.namespace?{[r.namespace]:i}:i;this.manager.setLanguageData(e,n),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,r])=>(e.push({code:i,...r}),e),[])}findLanguageMeta(e,i){const r=Fi(String(i)).toLowerCase(),n=e.languages[r];if(n)return{code:r,...n};{const s=e.languages.en;if(s)return{code:"en",...s}}}async getI18nIndex(e,i=!1){if(!i){const n=await this.i18nIndexDB.get(e);if(n)try{return lc(n)}catch(s){this.logger.error("Failed to parse cached i18n index",s),this.i18nIndexDB.delete(e)}}const r=await this.fetchI18nIndex(e);return this.i18nIndexDB.set(e,r),r}async fetchI18nIndex(e){const i=await fetch(e).then(r=>r.json());return lc(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 r=this.findLanguageMeta(this._indexCache,e);if(!r)return{};const n=`${this._indexUrl}#${r.file}`;if(!i){const o=await this.i18nDataDB.get(n);if(o&&Object.keys(o).length>0)return this.logger.debug("Using cached language data",e,o),o}const s=r.data||await fetch(new URL(r.file,this._indexUrl).toString()).then(o=>o.json());return this.i18nDataDB.set(n,s),this.logger.debug("Language data fetched",e,r.file,s),s}getMissingReport(){return this.manager.getMissingReport()}clearMissingReport(){this.manager.clearMissingReport()}async onClearCache(){await this.i18nIndexDB.clear(),await this.i18nDataDB.clear()}}ho=qg(ac),_n=Kg(ho,0,"I18nService",oc,_n),Wg(ho,1,_n);const Vg=new TextEncoder;function Gg(t){if(typeof t=="string")return Vg.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("Unsupported input type")}function Qg(t){let e="";for(let i=0;i<t.length;i++){const r=t[i].toString(16).padStart(2,"0");e+=r}return e}function Yg(t,e){return t<<e|t>>>32-e}const Xg=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Jg=new Array(64).fill(0).map((t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function Zg(t){const e=Gg(t),i=(56-(e.length+1)%64+64)%64,r=e.length+1+i+8,n=new Uint8Array(r);n.set(e,0),n[e.length]=128;const s=e.length,o=s<<3>>>0,a=s>>>29>>>0,c=new DataView(n.buffer);c.setUint32(r-8,o,!0),c.setUint32(r-4,a,!0);let l=1732584193,u=4023233417,d=2562383102,m=271733878;const p=new Uint32Array(16);for(let k=0;k<n.length;k+=64){for(let w=0;w<16;w++)p[w]=c.getUint32(k+w*4,!0);let P=l,b=u,y=d,g=m;for(let w=0;w<64;w++){let S,I;w<16?(S=b&y|~b&g,I=w):w<32?(S=g&b|~g&y,I=(5*w+1)%16):w<48?(S=b^y^g,I=(3*w+5)%16):(S=y^(b|~g),I=7*w%16);const F=g,N=P+S+Jg[w]+p[I]>>>0;g=y,y=b,b=b+Yg(N,Xg[w])>>>0,P=F}l=l+P>>>0,u=u+b>>>0,d=d+y>>>0,m=m+g>>>0}const h=new Uint8Array(16),_=new DataView(h.buffer);return _.setUint32(0,l,!0),_.setUint32(4,u,!0),_.setUint32(8,d,!0),_.setUint32(12,m,!0),h}var em=Object.create,po=Object.defineProperty,tm=Object.getOwnPropertyDescriptor,cc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),uc=t=>{throw TypeError(t)},im=(t,e,i)=>e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,rm=(t,e)=>po(t,"name",{value:e,configurable:!0}),nm=t=>[,,,em(t?.[cc("metadata")]??null)],sm=["class","method","getter","setter","accessor","field","value","get","set"],dc=t=>t!==void 0&&typeof t!="function"?uc("Function expected"):t,om=(t,e,i,r,n)=>({kind:sm[t],name:e,metadata:r,addInitializer:s=>i._?uc("Already initialized"):n.push(dc(s||null))}),am=(t,e)=>im(e,cc("metadata"),t[3]),lm=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},cm=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&tm(n,i));rm(n,i);for(var h=r.length-1;h>=0;h--)c=om(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,dc(o)&&(n=o);return am(t,n),p&&po(n,i,p),u?l^4?s:p:n},fc,go,hc;fc=[xe(["wiki","wikiTitle","wikiPage","apiService"])];class xn extends(hc=ht){constructor(e){super(e,"wikiFile",!0),this.ctx=e}get fileRepos(){return this.ctx.wiki.fileRepos||[]}get defaultFileRepo(){return this.localFileRepo||this.fileRepos[0]}get localFileRepo(){return this.fileRepos.find(e=>e.local)}get writableFileRepo(){return this.fileRepos.find(e=>e.canUpload)}getFileName(e){if(e=this.ctx.wikiTitle.newTitle(e,6),![6,-2].includes(e.getNamespaceId()))throw new Error("Not a file title");return e.getMainDBKey().split("/").pop()||""}getHashPath(e,i=2){const r=this.getFileName(e),n=Qg(Zg(r));let s=[];for(let o=1;o<=i;o++)s.push(n.slice(0,o));return s.push(r),s.join("/")}getFileUrl(e,i){if(i=i||this.defaultFileRepo,!i)throw new Error("No file repository found");const r=this.getHashPath(e);return new URL(`${i.rootUrl}/${r}`,location.origin).toString()}async upload(e,i){if(i=i||this.writableFileRepo,!i?.canUpload)throw new Error("No writable file repository found");if(!e.file&&!e.url&&!e.chunk&&!e.filekey)throw new Error('At least one of "file", "url", "chunk", or "filekey" is required');return this.ctx.apiService.getClientByFileRepo(i).postWithToken("csrf",{action:"upload",...e},{fexiosOptions:{timeout:0}})}}go=nm(hc),xn=cm(go,0,"WikiFileService",fc,xn),lm(go,1,xn);const Qr=class Qr extends Ze{constructor(i){super({name:"InPageEdit"});Mi(this,vt);this.version="0.17.2",this.Endpoints=xt,this.schema=A,this.config=Rt(Qr.DEFAULT_CONFIG,i),this.logger=al({name:"IPE",color:"#33aaff",level:this.config.logLevel}),wt(this,vt,Vf).call(this)}async withInject(i){const{promise:r,resolve:n}=_r();return this.inject(i,s=>{n(s)}),r}};vt=new WeakSet,Vf=async function(){await wt(this,vt,Gf).call(this),this.config.autoInstallCorePlugins&&wt(this,vt,Yf).call(this),wt(this,vt,Xf).call(this)},Gf=async function(){this.plugin(_n),this.plugin(Lh,this.config.apiConfigs),this.plugin(Kh),this.plugin(Vh),this.plugin(jp),this.plugin(wn),this.plugin(tg,{dbName:this.config.storageNamespace}),this.plugin(vn),this.plugin(xn),this.plugin(bn),this.plugin(ao),this.plugin(lo),wt(this,vt,Qf).call(this,["i18n","$","$$","api","currentPage","resourceLoader","modal","preferences","storage","theme","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Qf=function(i){if(!Array.isArray(i)||i.length===0)return this;for(const r of i){const n=this[Qr.internal][r];n?.type==="service"&&(n.builtin=!0)}return this},Yf=async function(){[Promise.resolve().then(()=>xm).then(({PluginAnalytics:r})=>r),Promise.resolve().then(()=>Om).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>gv).then(({PluginPluginStore:r})=>r),Promise.resolve().then(()=>Bv).then(({PluginPreferencesUI:r})=>r),Promise.resolve().then(()=>rw).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>pw).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>$w).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Bw).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Hw).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>i_).then(({PluginQuickUpload:r})=>r),Promise.resolve().then(()=>n_).then(({PluginQuickUsage:r})=>r),Promise.resolve().then(()=>g_).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},Xf=async function(){this.inject(["resourceLoader"],i=>{})},Qr.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:Ls.info,storageNamespace:"InPageEdit",autoloadStyles:!0,autoInstallCorePlugins:!0};let qi=Qr;const vs=class vs{constructor(e,i=void 0,r){Mi(this,Yr);this.ctx=e,this.disposeHandlers=[],this.name=r||"",this.config=i||{};const{promise:n,resolve:s,reject:o}=_r();queueMicrotask(()=>{this.name||(this.name=this.constructor.name);try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(c=>{this.logger.error("start() returns a rejected promise",c),o(c)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}n.then(()=>{this.logger.debug("started")}),n.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){je(this,Yr,Ng(e).toUpperCase())}get name(){return ce(this,Yr)}get logger(){return this.ctx.logger(this.name)}};Yr=new WeakMap,vs.inject=[],vs.reusable=!1;let Ue=vs;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),dm("InPageEdit#autoload",()=>{const t=pc();t&&um({baseURL:t,InPageEdit:qi})});async function um(t={baseURL:pc(),InPageEdit:qi}){const{baseURL:e,InPageEdit:i}=t;typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const r=window.InPageEdit||{},n=new i({apiConfigs:{baseURL:e},legacyPreferences:r?.myPreferences||{}});if(window.ipe=n,await n.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(n)}),Array.isArray(window.__IPE_MODULES__)){const s=[];for(;window.__IPE_MODULES__.length;)try{const o=window.__IPE_MODULES__.shift();typeof o=="function"&&o?.(n),s.push(o)}catch{}window.__IPE_MODULES__={push:o=>{typeof o=="function"&&o(n),s.push(o)}},n.on("dispose",()=>{window.__IPE_MODULES__=s})}n.logger("AUTOLOAD").info(`
12
+ `);return(i,r)=>{const n=new Proxy(r,{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,n)}}function ic(t){return t.charAt(0).toLowerCase()+t.slice(1)}function Fi(t){return ic(t).replace(/_/g,"-").replace(/.[A-Z]+/g,e=>e[0]+"-"+e.slice(1).toLowerCase())}function Ng(t){return ic(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}function li(t,e){let i=t[0]??"";for(let r=0;r<e.length;r++)i+=String(e[r])+(t[r+1]??"");return i}class Mg{constructor(e,i){this.languages=new Map,this.currentLanguage="en",this.missingKeys=new Map,this.usedKeys=new Set;const r=i?.language||"en";this.currentLanguage=r,this.interpolate=tc(i?.globals),e&&Object.keys(e).length&&this.setLanguageData(r,e)}setGlobals(e){return this.interpolate=tc(e),this}set(e,i){const r=this.currentLanguage,n=this.ensureLanguageMap(r);if(typeof e=="string"&&typeof i=="string")n.set(e,i);else if(typeof e=="object"){const s=this.toStringRecord(e);for(const[o,a]of Object.entries(s))n.set(o,a)}return this}setLanguageData(e,i){e=Fi(e).toLowerCase();const r=this.ensureLanguageMap(e),n=this.toStringRecord(i);for(const[s,o]of Object.entries(n))r.set(s,o);return this}setLanguage(e){return e=Fi(e).toLowerCase(),this.currentLanguage=e,this}getLanguage(){return this.currentLanguage}hasLanguage(e){e=Fi(e).toLowerCase();const i=this.languages.get(e);return i&&Object.keys(i).length>0}toStringRecord(e,i){const r={};for(const[n,s]of Object.entries(e)){const o=i?`${i}.${n}`:n;if(s&&typeof s=="object"&&!Array.isArray(s)){const a=this.toStringRecord(s,o);for(const[c,l]of Object.entries(a))r[c]=String(l)}else r[o]=String(s)}return r}has(e){const i=this.resolveLanguageOrder(this.currentLanguage);for(const r of i)if(this.languages.get(r)?.has(e))return!0;return!1}get(e){this.recordUsedKey(e);const i=this.resolveLanguageOrder(this.currentLanguage),r=[];for(const n of i){const o=this.languages.get(n)?.get(e);if(typeof o<"u")return r.length&&this.recordMissing(e,r),o;r.push(n)}r.length&&this.recordMissing(e,r)}translate(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const r=this.get(e);return typeof r>"u"?this.interpolate(e,...i):this.interpolate(r,...i)}$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],s=e.slice(1),o=li(n,s);return this.translate(o)}const r=e;return(n,...s)=>{const o=li(n,s);return this.translate(o,...r)}}translateRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??e:""}$raw(...e){if(Array.isArray(e[0])&&e[0]?.raw){const r=e[0],n=e.slice(1),s=li(r,n);return this.translateRaw(s)}return(r,...n)=>{const s=li(r,n);return this.translateRaw(s)}}message(e,...i){if(!e)return"";if(this.currentLanguage==="qqx")return`⧼${e}⧽`;const r=this.get(e);return typeof r>"u"?`(${e})`:this.interpolate(r,...i)}$$(...e){if(Array.isArray(e[0])&&e[0]?.raw){const n=e[0],s=e.slice(1),o=li(n,s);return this.message(o)}const r=e;return(n,...s)=>{const o=li(n,s);return this.message(o,...r)}}messageRaw(e){return e?this.currentLanguage==="qqx"?`⧼${e}⧽`:this.get(e)??`(${e})`:""}$$raw(...e){if(Array.isArray(e[0])&&e[0].raw){const r=e[0],n=e.slice(1),s=li(r,n);return this.messageRaw(s)}return(r,...n)=>{const s=li(r,n);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 r=this.missingKeys.get(e)||[];for(const n of i)r.includes(n)||r.push(n);this.missingKeys.set(e,r)}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}}var Dg=Object.create,fo=Object.defineProperty,jg=Object.getOwnPropertyDescriptor,rc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),nc=t=>{throw TypeError(t)},Ug=(t,e,i)=>e in t?fo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Fg=(t,e)=>fo(t,"name",{value:e,configurable:!0}),qg=t=>[,,,Dg(t?.[rc("metadata")]??null)],Bg=["class","method","getter","setter","accessor","field","value","get","set"],sc=t=>t!==void 0&&typeof t!="function"?nc("Function expected"):t,Hg=(t,e,i,r,n)=>({kind:Bg[t],name:e,metadata:r,addInitializer:s=>i._?nc("Already initialized"):n.push(sc(s||null))}),zg=(t,e)=>Ug(e,rc("metadata"),t[3]),Wg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Kg=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&jg(n,i));Fg(n,i);for(var h=r.length-1;h>=0;h--)c=Hg(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,sc(o)&&(n=o);return zg(t,n),p&&fo(n,i,p),u?l^4?s:p:n},oc,ho,ac;const lc=new A(A.object({manifest_version:A.const(1).required(),base_language:A.string().required(),last_modified:A.string().required(),languages:A.dict(A.object({file:A.string().required(),fallback:A.string(),iso_name:A.string(),endonym:A.string(),data:A.transform(A.dict(A.any()).default({}),t=>Object.keys(t).length>0?t:void 0)})).required()}));oc=[xe(["wiki","preferences"]),Ot(A.object({"i18n.index_url":A.string().description("I18n index URL (DO NOT CHANGE THIS) ").default(xt.I18N_INDEX_URL)}).description("").extra("category","general"))];class _n extends(ac=ht){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 Mg({},{language:"",globals:{userName:this.ctx.wiki.userInfo.name||"",userId:this.ctx.wiki.userInfo.id||0,siteName:this.ctx.wiki.siteInfo.general.sitename||""}}),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",A.object({language:A.union(["@user","@site",A.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 r=await this.ctx.preferences.get("language"),n=this.normalizeLanguageCode(r);this.logger.debug("Settings",{prefer:r,normalized:n});try{await this.switchLanguage(n),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",A.object({language:A.union([A.const("@user").description(this.$`Same as your personal language`),A.const("@site").description(this.$`Same as the site language`),...this.getAvailableLanguageCodes().map(({code:s,endonym:o,iso_name:a})=>A.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"),Fi(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,r){const n=r?.namespace?{[r.namespace]:i}:i;this.manager.setLanguageData(e,n),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,r])=>(e.push({code:i,...r}),e),[])}findLanguageMeta(e,i){const r=Fi(String(i)).toLowerCase(),n=e.languages[r];if(n)return{code:r,...n};{const s=e.languages.en;if(s)return{code:"en",...s}}}async getI18nIndex(e,i=!1){if(!i){const n=await this.i18nIndexDB.get(e);if(n)try{return lc(n)}catch(s){this.logger.error("Failed to parse cached i18n index",s),this.i18nIndexDB.delete(e)}}const r=await this.fetchI18nIndex(e);return this.i18nIndexDB.set(e,r),r}async fetchI18nIndex(e){const i=await fetch(e).then(r=>r.json());return lc(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 r=this.findLanguageMeta(this._indexCache,e);if(!r)return{};const n=`${this._indexUrl}#${r.file}`;if(!i){const o=await this.i18nDataDB.get(n);if(o&&Object.keys(o).length>0)return this.logger.debug("Using cached language data",e,o),o}const s=r.data||await fetch(new URL(r.file,this._indexUrl).toString()).then(o=>o.json());return this.i18nDataDB.set(n,s),this.logger.debug("Language data fetched",e,r.file,s),s}getMissingReport(){return this.manager.getMissingReport()}clearMissingReport(){this.manager.clearMissingReport()}async onClearCache(){await this.i18nIndexDB.clear(),await this.i18nDataDB.clear()}}ho=qg(ac),_n=Kg(ho,0,"I18nService",oc,_n),Wg(ho,1,_n);const Vg=new TextEncoder;function Gg(t){if(typeof t=="string")return Vg.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("Unsupported input type")}function Qg(t){let e="";for(let i=0;i<t.length;i++){const r=t[i].toString(16).padStart(2,"0");e+=r}return e}function Yg(t,e){return t<<e|t>>>32-e}const Xg=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Jg=new Array(64).fill(0).map((t,e)=>Math.floor(Math.abs(Math.sin(e+1))*2**32)>>>0);function Zg(t){const e=Gg(t),i=(56-(e.length+1)%64+64)%64,r=e.length+1+i+8,n=new Uint8Array(r);n.set(e,0),n[e.length]=128;const s=e.length,o=s<<3>>>0,a=s>>>29>>>0,c=new DataView(n.buffer);c.setUint32(r-8,o,!0),c.setUint32(r-4,a,!0);let l=1732584193,u=4023233417,d=2562383102,m=271733878;const p=new Uint32Array(16);for(let k=0;k<n.length;k+=64){for(let w=0;w<16;w++)p[w]=c.getUint32(k+w*4,!0);let P=l,b=u,y=d,g=m;for(let w=0;w<64;w++){let S,I;w<16?(S=b&y|~b&g,I=w):w<32?(S=g&b|~g&y,I=(5*w+1)%16):w<48?(S=b^y^g,I=(3*w+5)%16):(S=y^(b|~g),I=7*w%16);const F=g,N=P+S+Jg[w]+p[I]>>>0;g=y,y=b,b=b+Yg(N,Xg[w])>>>0,P=F}l=l+P>>>0,u=u+b>>>0,d=d+y>>>0,m=m+g>>>0}const h=new Uint8Array(16),_=new DataView(h.buffer);return _.setUint32(0,l,!0),_.setUint32(4,u,!0),_.setUint32(8,d,!0),_.setUint32(12,m,!0),h}var em=Object.create,po=Object.defineProperty,tm=Object.getOwnPropertyDescriptor,cc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),uc=t=>{throw TypeError(t)},im=(t,e,i)=>e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,rm=(t,e)=>po(t,"name",{value:e,configurable:!0}),nm=t=>[,,,em(t?.[cc("metadata")]??null)],sm=["class","method","getter","setter","accessor","field","value","get","set"],dc=t=>t!==void 0&&typeof t!="function"?uc("Function expected"):t,om=(t,e,i,r,n)=>({kind:sm[t],name:e,metadata:r,addInitializer:s=>i._?uc("Already initialized"):n.push(dc(s||null))}),am=(t,e)=>im(e,cc("metadata"),t[3]),lm=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},cm=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&tm(n,i));rm(n,i);for(var h=r.length-1;h>=0;h--)c=om(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,dc(o)&&(n=o);return am(t,n),p&&po(n,i,p),u?l^4?s:p:n},fc,go,hc;fc=[xe(["wiki","wikiTitle","wikiPage","apiService"])];class xn extends(hc=ht){constructor(e){super(e,"wikiFile",!0),this.ctx=e}get fileRepos(){return this.ctx.wiki.fileRepos||[]}get defaultFileRepo(){return this.localFileRepo||this.fileRepos[0]}get localFileRepo(){return this.fileRepos.find(e=>e.local)}get writableFileRepo(){return this.fileRepos.find(e=>e.canUpload)}getFileName(e){if(e=this.ctx.wikiTitle.newTitle(e,6),![6,-2].includes(e.getNamespaceId()))throw new Error("Not a file title");return e.getMainDBKey().split("/").pop()||""}getHashPath(e,i=2){const r=this.getFileName(e),n=Qg(Zg(r));let s=[];for(let o=1;o<=i;o++)s.push(n.slice(0,o));return s.push(r),s.join("/")}getFileUrl(e,i){if(i=i||this.defaultFileRepo,!i)throw new Error("No file repository found");const r=this.getHashPath(e);return new URL(`${i.rootUrl}/${r}`,location.origin).toString()}async upload(e,i){if(i=i||this.writableFileRepo,!i?.canUpload)throw new Error("No writable file repository found");if(!e.file&&!e.url&&!e.chunk&&!e.filekey)throw new Error('At least one of "file", "url", "chunk", or "filekey" is required');return this.ctx.apiService.getClientByFileRepo(i).postWithToken("csrf",{action:"upload",...e},{fexiosOptions:{timeout:0}})}}go=nm(hc),xn=cm(go,0,"WikiFileService",fc,xn),lm(go,1,xn);const Qr=class Qr extends Ze{constructor(i){super({name:"InPageEdit"});Mi(this,vt);this.version="0.17.4",this.Endpoints=xt,this.schema=A,this.config=Rt(Qr.DEFAULT_CONFIG,i),this.logger=al({name:"IPE",color:"#33aaff",level:this.config.logLevel}),wt(this,vt,Vf).call(this)}async withInject(i){const{promise:r,resolve:n}=_r();return this.inject(i,s=>{n(s)}),r}};vt=new WeakSet,Vf=async function(){await wt(this,vt,Gf).call(this),this.config.autoInstallCorePlugins&&wt(this,vt,Yf).call(this),wt(this,vt,Xf).call(this)},Gf=async function(){this.plugin(_n),this.plugin(Lh,this.config.apiConfigs),this.plugin(Kh),this.plugin(Vh),this.plugin(jp),this.plugin(wn),this.plugin(tg,{dbName:this.config.storageNamespace}),this.plugin(vn),this.plugin(xn),this.plugin(bn),this.plugin(ao),this.plugin(lo),wt(this,vt,Qf).call(this,["i18n","$","$$","api","currentPage","resourceLoader","modal","preferences","storage","theme","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Qf=function(i){if(!Array.isArray(i)||i.length===0)return this;for(const r of i){const n=this[Qr.internal][r];n?.type==="service"&&(n.builtin=!0)}return this},Yf=async function(){[Promise.resolve().then(()=>xm).then(({PluginAnalytics:r})=>r),Promise.resolve().then(()=>Om).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>gv).then(({PluginPluginStore:r})=>r),Promise.resolve().then(()=>Bv).then(({PluginPreferencesUI:r})=>r),Promise.resolve().then(()=>rw).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>pw).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>$w).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Bw).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Hw).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>i_).then(({PluginQuickUpload:r})=>r),Promise.resolve().then(()=>n_).then(({PluginQuickUsage:r})=>r),Promise.resolve().then(()=>g_).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},Xf=async function(){this.inject(["resourceLoader"],i=>{})},Qr.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:Ls.info,storageNamespace:"InPageEdit",autoloadStyles:!0,autoInstallCorePlugins:!0};let qi=Qr;const vs=class vs{constructor(e,i=void 0,r){Mi(this,Yr);this.ctx=e,this.disposeHandlers=[],this.name=r||"",this.config=i||{};const{promise:n,resolve:s,reject:o}=_r();queueMicrotask(()=>{this.name||(this.name=this.constructor.name);try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(c=>{this.logger.error("start() returns a rejected promise",c),o(c)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}n.then(()=>{this.logger.debug("started")}),n.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){je(this,Yr,Ng(e).toUpperCase())}get name(){return ce(this,Yr)}get logger(){return this.ctx.logger(this.name)}};Yr=new WeakMap,vs.inject=[],vs.reusable=!1;let Ue=vs;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),dm("InPageEdit#autoload",()=>{const t=pc();t&&um({baseURL:t,InPageEdit:qi})});async function um(t={baseURL:pc(),InPageEdit:qi}){const{baseURL:e,InPageEdit:i}=t;typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const r=window.InPageEdit||{},n=new i({apiConfigs:{baseURL:e},legacyPreferences:r?.myPreferences||{}});if(window.ipe=n,await n.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(n)}),Array.isArray(window.__IPE_MODULES__)){const s=[];for(;window.__IPE_MODULES__.length;)try{const o=window.__IPE_MODULES__.shift();typeof o=="function"&&o?.(n),s.push(o)}catch{}window.__IPE_MODULES__={push:o=>{typeof o=="function"&&o(n),s.push(o)}},n.on("dispose",()=>{window.__IPE_MODULES__=s})}n.logger("AUTOLOAD").info(`
13
13
  ____ ____ ______ ___ __
14
14
  / _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
15
15
  / // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
@@ -21,7 +21,7 @@
21
21
  - Bug Reports: ${xt.GITHUB_URL}`)}function pc(){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 dm(t,e){const i=Symbol.for(t);return window[i]?!1:(window[i]=!0,e(),!0)}var fm=Object.create,mo=Object.defineProperty,hm=Object.getOwnPropertyDescriptor,gc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),mc=t=>{throw TypeError(t)},pm=(t,e,i)=>e in t?mo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,gm=(t,e)=>mo(t,"name",{value:e,configurable:!0}),mm=t=>[,,,fm(t?.[gc("metadata")]??null)],ym=["class","method","getter","setter","accessor","field","value","get","set"],yc=t=>t!==void 0&&typeof t!="function"?mc("Function expected"):t,bm=(t,e,i,r,n)=>({kind:ym[t],name:e,metadata:r,addInitializer:s=>i._?mc("Already initialized"):n.push(yc(s||null))}),vm=(t,e)=>pm(e,gc("metadata"),t[3]),wm=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},_m=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&hm(n,i));gm(n,i);for(var h=r.length-1;h>=0;h--)c=bm(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,yc(o)&&(n=o);return vm(t,n),p&&mo(n,i,p),u?l^4?s:p:n},bc,yo,vc;bc=[xe(["wiki","preferences","$"])];class kn extends(vc=Ue){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",A.object({"analytics._intro":A.const(f("section",{children:[f("h3",{children:i`InPageEdit Analytics`}),f("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.`}),f("h4",{children:i`What data will be collected?`}),f("ol",{style:{listStyle:"number",paddingLeft:"1em"},children:[f("li",{children:[f("strong",{children:i`Usage data`}),":"," ",i`When and which features you use, what pages you edit, etc.`]}),f("li",{children:[f("strong",{children:i`User information`}),": ",i`Your user name and user ID.`]}),f("li",{children:[f("strong",{children:i`Site information`}),": ",i`This wiki's url and site name.`]})]}),f("p",{children:f("strong",{children:i`NO sensitive data will be collected.`})}),f("div",{style:{display:"grid",gap:"0.5rem"},children:[f("a",{href:this.analyticsDashUrl,target:"_blank",rel:"noopener noreferrer",children:f("button",{className:"btn",style:{width:"100%"},children:i`Analytics Platform`})}),f("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:f("button",{className:"btn",style:{width:"100%"},children:i`View My Data`})})]})]})).role("raw-html"),"analytics.enabled":A.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 r="analytics/confirm-shown",n=await i.storage.simpleKV.get(r),s=await i.preferences.get("analytics.enabled");n||s||i.modal.notify("confirm",{title:e`Enable Analytics`,content:f("div",{children:[f("p",{children:e`Help us improve InPageEdit by sharing your usage data with us.`}),f("p",{children:e`What data will be collected?`}),f("ul",{style:{listStyle:"auto",paddingLeft:"1.5em"},children:[f("li",{children:[e`Usage data`,": ",e`When and which features you use, what pages you edit, etc.`]}),f("li",{children:[e`User information`,": ",e`Your user name and user ID.`]}),f("li",{children:[e`Site information`,": ",e`This wiki's url and site name.`]})]}),f("p",{children:f("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(r,1)}},o=>{i.preferences.set("analytics.enabled",o),o&&this.addEvent("analytics","enabled")})})}_initPluginListeners(){const e=this.ctx;e.on("analytics/event",i=>{i&&this.addEvent(i.feature,i.subtype,i.page)}),e.on("in-article-links/anchor-clicked",i=>{this.addEvent("in-article-links",Fi(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:r,by:n})=>{n==="new-added"&&this.addEvent("plugin-store","plugin-installed",`${r}@${i.name}`)}),e.on("plugin-store/plugin-uninstalled",({registry:i,id:r})=>{this.addEvent("plugin-store","plugin-uninstalled",`${r}@${i.name}`)})}addEvent(e,i,r){if(!e)return;const n={ts:Date.now(),feature:e,subtype:i,page:r};return this._usages.push(n),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),r={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},n=JSON.stringify(r),s=`${this.analyticsApiBase}/submit`;if(navigator?.sendBeacon?.(s,n))return this.logger.debug("Beacon sent successfully",r),!0;{this.logger.debug("Beacon failed, sending via XMLHttpRequest");const{promise:a,resolve:c,reject:l}=_r();try{const u=new XMLHttpRequest;u.open("POST",s,!0),u.setRequestHeader("Content-Type","application/json"),u.send(n),u.onload=()=>{this.logger.debug("Beacon sent successfully via XMLHttpRequest",r),c(u.status>=200&&u.status<300)},u.onerror=()=>{l(new Error("Failed to send beacon"))}}catch(u){l(u)}return a}}stop(){this._timer!==null&&(clearInterval(this._timer),this._timer=null),this._usages.length>0&&this.sendBeacon()}}yo=mm(vc),kn=_m(yo,0,"PluginAnalytics",bc,kn),wm(yo,1,kn);const xm=Object.freeze(Object.defineProperty({__proto__:null,get PluginAnalytics(){return kn}},Symbol.toStringTag,{value:"Module"}));var km=Object.create,bo=Object.defineProperty,Sm=Object.getOwnPropertyDescriptor,wc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),_c=t=>{throw TypeError(t)},Em=(t,e,i)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$m=(t,e)=>bo(t,"name",{value:e,configurable:!0}),Pm=t=>[,,,km(t?.[wc("metadata")]??null)],Cm=["class","method","getter","setter","accessor","field","value","get","set"],xc=t=>t!==void 0&&typeof t!="function"?_c("Function expected"):t,Im=(t,e,i,r,n)=>({kind:Cm[t],name:e,metadata:r,addInitializer:s=>i._?_c("Already initialized"):n.push(xc(s||null))}),Am=(t,e)=>Em(e,wc("metadata"),t[3]),Rm=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Tm=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Sm(n,i));$m(n,i);for(var h=r.length-1;h>=0;h--)c=Im(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,xc(o)&&(n=o);return Am(t,n),p&&bo(n,i,p),u?l^4?s:p:n},kc,vo,Sc;kc=[xe(["wiki","wikiTitle","preferences","$"]),Ot(A.object({"inArticleLinks.enable":A.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":A.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":A.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":A.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class Sn extends(Sc=Ue){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 r=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(r))return null;const n=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(n);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!r.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 r=e.querySelectorAll("a[href]");return Array.from(r).map(n=>this.parseAnchor(n)).filter(n=>n!==null&&(!i||i(n)))}onContentReady(e){const i=()=>{if(!window.mw)return;window.mw.hook("wikipage.content").add(e);const r=window.$?.("#mw-content-text");r?.length&&e(r)};window.mw&&typeof window.mw.hook=="function"?i():(window.RLQ=window.RLQ||[],window.RLQ.push(["mediawiki.base",i]))}async handleQuickEdit(){let e=!1;const i=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],r=>{e=!0,r.on("dispose",()=>{e=!1}),this.onContentReady(n=>{if(!e||!n?.length)return;this.scanAnchors(n.get(0),({action:o,title:a,redlink:c})=>i||!c?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(o=>{const{$el:a,title:c,pageId:l,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 m=c?.getPrefixedDBKey()||"",p=u.get("section")?.replace(/^T-/,"")||void 0,h=u.get("oldid"),_=u.has("redlink");let k;p==="new"||c?.isSpecial("newsection")?k="new":p&&/^\d+$/.test(p)&&(k=parseInt(p,10));const P=h?parseInt(h,10):void 0,b={title:m,pageId:l||void 0,section:k,revision:P,createOnly:_},y=r.quickEdit.createQuickEditButton(b,{label:""});y.classList.add(this.config.linkClassName),y.addEventListener("click",g=>{this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:g,action:"quickEdit"})}),a.insertAdjacentElement("afterend",y)})})})}handleQuickDiff(){let e=!1;const i=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),this.onContentReady(n=>{if(!e||!n?.length)return;this.scanAnchors(n.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(o=>{const{$el:a,title:c,params:l}=o;if(a.dataset.ipeDiffMounted)return;a.dataset.ipeDiffMounted="1";let u,d;if(c?.getNamespaceId()===-1?([,d,u]=c.getMainDBKey().split("/"),u||(u="prev")):(u=l.get("diff"),d=l.get("oldid")),!u||!d)return;const m={};i(u)?(m.fromrev=parseInt(d),m.torelative=u):(m.fromrev=parseInt(d),m.torev=parseInt(u));const p=this.ctx.quickDiff.createQuickDiffButton(m,{label:""});p.classList.add(this.config.linkClassName),p.addEventListener("click",h=>{this.ctx.emit("in-article-links/anchor-clicked",{ctx:this.ctx,anchor:a,info:o,event:h,action:"quickDiff"})}),a.insertAdjacentElement("afterend",p)})})})}}vo=Pm(Sc),Sn=Tm(vo,0,"PluginInArticleLinks",kc,Sn),Rm(vo,1,Sn);const Om=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return Sn}},Symbol.toStringTag,{value:"Module"}));function wo(t){const e=Object.create(null);for(const i of t.split(","))e[i]=1;return i=>i in e}const le={},Bi=[],Nt=()=>{},Ec=()=>!1,En=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),_o=t=>t.startsWith("onUpdate:"),Fe=Object.assign,xo=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},Lm=Object.prototype.hasOwnProperty,ue=(t,e)=>Lm.call(t,e),J=Array.isArray,Hi=t=>$n(t)==="[object Map]",$c=t=>$n(t)==="[object Set]",Z=t=>typeof t=="function",Ae=t=>typeof t=="string",Qt=t=>typeof t=="symbol",ke=t=>t!==null&&typeof t=="object",Pc=t=>(ke(t)||Z(t))&&Z(t.then)&&Z(t.catch),Cc=Object.prototype.toString,$n=t=>Cc.call(t),Nm=t=>$n(t).slice(8,-1),Ic=t=>$n(t)==="[object Object]",ko=t=>Ae(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,xr=wo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Pn=t=>{const e=Object.create(null);return(i=>e[i]||(e[i]=t(i)))},Mm=/-\w/g,Yt=Pn(t=>t.replace(Mm,e=>e.slice(1).toUpperCase())),Dm=/\B([A-Z])/g,ci=Pn(t=>t.replace(Dm,"-$1").toLowerCase()),Ac=Pn(t=>t.charAt(0).toUpperCase()+t.slice(1)),So=Pn(t=>t?`on${Ac(t)}`:""),it=(t,e)=>!Object.is(t,e),Cn=(t,...e)=>{for(let i=0;i<t.length;i++)t[i](...e)},Rc=(t,e,i,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:i})},Eo=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Tc;const In=()=>Tc||(Tc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function $o(t){if(J(t)){const e={};for(let i=0;i<t.length;i++){const r=t[i],n=Ae(r)?qm(r):$o(r);if(n)for(const s in n)e[s]=n[s]}return e}else if(Ae(t)||ke(t))return t}const jm=/;(?![^(]*\))/g,Um=/:([^]+)/,Fm=/\/\*[^]*?\*\//g;function qm(t){const e={};return t.replace(Fm,"").split(jm).forEach(i=>{if(i){const r=i.split(Um);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function kt(t){let e="";if(Ae(t))e=t;else if(J(t))for(let i=0;i<t.length;i++){const r=kt(t[i]);r&&(e+=r+" ")}else if(ke(t))for(const i in t)t[i]&&(e+=i+" ");return e.trim()}const Bm=wo("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Oc(t){return!!t||t===""}const Lc=t=>!!(t&&t.__v_isRef===!0),ye=t=>Ae(t)?t:t==null?"":J(t)||ke(t)&&(t.toString===Cc||!Z(t.toString))?Lc(t)?ye(t.value):JSON.stringify(t,Nc,2):String(t),Nc=(t,e)=>Lc(e)?Nc(t,e.value):Hi(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((i,[r,n],s)=>(i[Po(r,s)+" =>"]=n,i),{})}:$c(e)?{[`Set(${e.size})`]:[...e.values()].map(i=>Po(i))}:Qt(e)?Po(e):ke(e)&&!J(e)&&!Ic(e)?String(e):e,Po=(t,e="")=>{var i;return Qt(t)?`Symbol(${(i=t.description)!=null?i:e})`:t};let rt;class Hm{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=rt,!e&&rt&&(this.index=(rt.scopes||(rt.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=rt;try{return rt=this,e()}finally{rt=i}}}on(){++this._on===1&&(this.prevScope=rt,rt=this)}off(){this._on>0&&--this._on===0&&(rt=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let i,r;for(i=0,r=this.effects.length;i<r;i++)this.effects[i].stop();for(this.effects.length=0,i=0,r=this.cleanups.length;i<r;i++)this.cleanups[i]();if(this.cleanups.length=0,this.scopes){for(i=0,r=this.scopes.length;i<r;i++)this.scopes[i].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function zm(){return rt}let be;const Co=new WeakSet;class Mc{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,rt&&rt.active&&rt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Co.has(this)&&(Co.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||jc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Hc(this),Uc(this);const e=be,i=St;be=this,St=!0;try{return this.fn()}finally{Fc(this),be=e,St=i,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)To(e);this.deps=this.depsTail=void 0,Hc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Co.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ro(this)&&this.run()}get dirty(){return Ro(this)}}let Dc=0,kr,Sr;function jc(t,e=!1){if(t.flags|=8,e){t.next=Sr,Sr=t;return}t.next=kr,kr=t}function Io(){Dc++}function Ao(){if(--Dc>0)return;if(Sr){let e=Sr;for(Sr=void 0;e;){const i=e.next;e.next=void 0,e.flags&=-9,e=i}}let t;for(;kr;){let e=kr;for(kr=void 0;e;){const i=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=i}}if(t)throw t}function Uc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Fc(t){let e,i=t.depsTail,r=i;for(;r;){const n=r.prevDep;r.version===-1?(r===i&&(i=n),To(r),Wm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=i}function Ro(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function qc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Er)||(t.globalVersion=Er,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Ro(t))))return;t.flags|=2;const e=t.dep,i=be,r=St;be=t,St=!0;try{Uc(t);const n=t.fn(t._value);(e.version===0||it(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{be=i,St=r,Fc(t),t.flags&=-3}}function To(t,e=!1){const{dep:i,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),i.subs===t&&(i.subs=r,!r&&i.computed)){i.computed.flags&=-5;for(let s=i.computed.deps;s;s=s.nextDep)To(s,!0)}!e&&!--i.sc&&i.map&&i.map.delete(i.key)}function Wm(t){const{prevDep:e,nextDep:i}=t;e&&(e.nextDep=i,t.prevDep=void 0),i&&(i.prevDep=e,t.nextDep=void 0)}let St=!0;const Bc=[];function Mt(){Bc.push(St),St=!1}function Dt(){const t=Bc.pop();St=t===void 0?!0:t}function Hc(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const i=be;be=void 0;try{e()}finally{be=i}}}let Er=0;class Km{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 An{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(!be||!St||be===this.computed)return;let i=this.activeLink;if(i===void 0||i.sub!==be)i=this.activeLink=new Km(be,this),be.deps?(i.prevDep=be.depsTail,be.depsTail.nextDep=i,be.depsTail=i):be.deps=be.depsTail=i,zc(i);else if(i.version===-1&&(i.version=this.version,i.nextDep)){const r=i.nextDep;r.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=r),i.prevDep=be.depsTail,i.nextDep=void 0,be.depsTail.nextDep=i,be.depsTail=i,be.deps===i&&(be.deps=r)}return i}trigger(e){this.version++,Er++,this.notify(e)}notify(e){Io();try{for(let i=this.subs;i;i=i.prevSub)i.sub.notify()&&i.sub.dep.notify()}finally{Ao()}}}function zc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)zc(r)}const i=t.dep.subs;i!==t&&(t.prevSub=i,i&&(i.nextSub=t)),t.dep.subs=t}}const Oo=new WeakMap,xi=Symbol(""),Lo=Symbol(""),$r=Symbol("");function He(t,e,i){if(St&&be){let r=Oo.get(t);r||Oo.set(t,r=new Map);let n=r.get(i);n||(r.set(i,n=new An),n.map=r,n.key=i),n.track()}}function Xt(t,e,i,r,n,s){const o=Oo.get(t);if(!o){Er++;return}const a=c=>{c&&c.trigger()};if(Io(),e==="clear")o.forEach(a);else{const c=J(t),l=c&&ko(i);if(c&&i==="length"){const u=Number(r);o.forEach((d,m)=>{(m==="length"||m===$r||!Qt(m)&&m>=u)&&a(d)})}else switch((i!==void 0||o.has(void 0))&&a(o.get(i)),l&&a(o.get($r)),e){case"add":c?l&&a(o.get("length")):(a(o.get(xi)),Hi(t)&&a(o.get(Lo)));break;case"delete":c||(a(o.get(xi)),Hi(t)&&a(o.get(Lo)));break;case"set":Hi(t)&&a(o.get(xi));break}}Ao()}function zi(t){const e=oe(t);return e===t?e:(He(e,"iterate",$r),gt(t)?e:e.map(Et))}function Rn(t){return He(t=oe(t),"iterate",$r),t}function ui(t,e){return Zt(t)?ki(t)?Wi(Et(e)):Wi(e):Et(e)}const Vm={__proto__:null,[Symbol.iterator](){return No(this,Symbol.iterator,t=>ui(this,t))},concat(...t){return zi(this).concat(...t.map(e=>J(e)?zi(e):e))},entries(){return No(this,"entries",t=>(t[1]=ui(this,t[1]),t))},every(t,e){return Jt(this,"every",t,e,void 0,arguments)},filter(t,e){return Jt(this,"filter",t,e,i=>i.map(r=>ui(this,r)),arguments)},find(t,e){return Jt(this,"find",t,e,i=>ui(this,i),arguments)},findIndex(t,e){return Jt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Jt(this,"findLast",t,e,i=>ui(this,i),arguments)},findLastIndex(t,e){return Jt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Jt(this,"forEach",t,e,void 0,arguments)},includes(...t){return Mo(this,"includes",t)},indexOf(...t){return Mo(this,"indexOf",t)},join(t){return zi(this).join(t)},lastIndexOf(...t){return Mo(this,"lastIndexOf",t)},map(t,e){return Jt(this,"map",t,e,void 0,arguments)},pop(){return Pr(this,"pop")},push(...t){return Pr(this,"push",t)},reduce(t,...e){return Wc(this,"reduce",t,e)},reduceRight(t,...e){return Wc(this,"reduceRight",t,e)},shift(){return Pr(this,"shift")},some(t,e){return Jt(this,"some",t,e,void 0,arguments)},splice(...t){return Pr(this,"splice",t)},toReversed(){return zi(this).toReversed()},toSorted(t){return zi(this).toSorted(t)},toSpliced(...t){return zi(this).toSpliced(...t)},unshift(...t){return Pr(this,"unshift",t)},values(){return No(this,"values",t=>ui(this,t))}};function No(t,e,i){const r=Rn(t),n=r[e]();return r!==t&&!gt(t)&&(n._next=n.next,n.next=()=>{const s=n._next();return s.done||(s.value=i(s.value)),s}),n}const Gm=Array.prototype;function Jt(t,e,i,r,n,s){const o=Rn(t),a=o!==t&&!gt(t),c=o[e];if(c!==Gm[e]){const d=c.apply(t,s);return a?Et(d):d}let l=i;o!==t&&(a?l=function(d,m){return i.call(this,ui(t,d),m,t)}:i.length>2&&(l=function(d,m){return i.call(this,d,m,t)}));const u=c.call(o,l,r);return a&&n?n(u):u}function Wc(t,e,i,r){const n=Rn(t);let s=i;return n!==t&&(gt(t)?i.length>3&&(s=function(o,a,c){return i.call(this,o,a,c,t)}):s=function(o,a,c){return i.call(this,o,ui(t,a),c,t)}),n[e](s,...r)}function Mo(t,e,i){const r=oe(t);He(r,"iterate",$r);const n=r[e](...i);return(n===-1||n===!1)&&Fo(i[0])?(i[0]=oe(i[0]),r[e](...i)):n}function Pr(t,e,i=[]){Mt(),Io();const r=oe(t)[e].apply(t,i);return Ao(),Dt(),r}const Qm=wo("__proto__,__v_isRef,__isVue"),Kc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Qt));function Ym(t){Qt(t)||(t=String(t));const e=oe(this);return He(e,"has",t),e.hasOwnProperty(t)}class Vc{constructor(e=!1,i=!1){this._isReadonly=e,this._isShallow=i}get(e,i,r){if(i==="__v_skip")return e.__v_skip;const n=this._isReadonly,s=this._isShallow;if(i==="__v_isReactive")return!n;if(i==="__v_isReadonly")return n;if(i==="__v_isShallow")return s;if(i==="__v_raw")return r===(n?s?Zc:Jc:s?Xc:Yc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=J(e);if(!n){let c;if(o&&(c=Vm[i]))return c;if(i==="hasOwnProperty")return Ym}const a=Reflect.get(e,i,De(e)?e:r);if((Qt(i)?Kc.has(i):Qm(i))||(n||He(e,"get",i),s))return a;if(De(a)){const c=o&&ko(i)?a:a.value;return n&&ke(c)?Uo(c):c}return ke(a)?n?Uo(a):jo(a):a}}class Gc extends Vc{constructor(e=!1){super(!1,e)}set(e,i,r,n){let s=e[i];const o=J(e)&&ko(i);if(!this._isShallow){const l=Zt(s);if(!gt(r)&&!Zt(r)&&(s=oe(s),r=oe(r)),!o&&De(s)&&!De(r))return l||(s.value=r),!0}const a=o?Number(i)<e.length:ue(e,i),c=Reflect.set(e,i,r,De(e)?e:n);return e===oe(n)&&(a?it(r,s)&&Xt(e,"set",i,r):Xt(e,"add",i,r)),c}deleteProperty(e,i){const r=ue(e,i);e[i];const n=Reflect.deleteProperty(e,i);return n&&r&&Xt(e,"delete",i,void 0),n}has(e,i){const r=Reflect.has(e,i);return(!Qt(i)||!Kc.has(i))&&He(e,"has",i),r}ownKeys(e){return He(e,"iterate",J(e)?"length":xi),Reflect.ownKeys(e)}}class Qc extends Vc{constructor(e=!1){super(!0,e)}set(e,i){return!0}deleteProperty(e,i){return!0}}const Xm=new Gc,Jm=new Qc,Zm=new Gc(!0),ey=new Qc(!0),Do=t=>t,Tn=t=>Reflect.getPrototypeOf(t);function ty(t,e,i){return function(...r){const n=this.__v_raw,s=oe(n),o=Hi(s),a=t==="entries"||t===Symbol.iterator&&o,c=t==="keys"&&o,l=n[t](...r),u=i?Do:e?Wi:Et;return!e&&He(s,"iterate",c?Lo:xi),{next(){const{value:d,done:m}=l.next();return m?{value:d,done:m}:{value:a?[u(d[0]),u(d[1])]:u(d),done:m}},[Symbol.iterator](){return this}}}}function On(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function iy(t,e){const i={get(n){const s=this.__v_raw,o=oe(s),a=oe(n);t||(it(n,a)&&He(o,"get",n),He(o,"get",a));const{has:c}=Tn(o),l=e?Do:t?Wi:Et;if(c.call(o,n))return l(s.get(n));if(c.call(o,a))return l(s.get(a));s!==o&&s.get(n)},get size(){const n=this.__v_raw;return!t&&He(oe(n),"iterate",xi),n.size},has(n){const s=this.__v_raw,o=oe(s),a=oe(n);return t||(it(n,a)&&He(o,"has",n),He(o,"has",a)),n===a?s.has(n):s.has(n)||s.has(a)},forEach(n,s){const o=this,a=o.__v_raw,c=oe(a),l=e?Do:t?Wi:Et;return!t&&He(c,"iterate",xi),a.forEach((u,d)=>n.call(s,l(u),l(d),o))}};return Fe(i,t?{add:On("add"),set:On("set"),delete:On("delete"),clear:On("clear")}:{add(n){!e&&!gt(n)&&!Zt(n)&&(n=oe(n));const s=oe(this);return Tn(s).has.call(s,n)||(s.add(n),Xt(s,"add",n,n)),this},set(n,s){!e&&!gt(s)&&!Zt(s)&&(s=oe(s));const o=oe(this),{has:a,get:c}=Tn(o);let l=a.call(o,n);l||(n=oe(n),l=a.call(o,n));const u=c.call(o,n);return o.set(n,s),l?it(s,u)&&Xt(o,"set",n,s):Xt(o,"add",n,s),this},delete(n){const s=oe(this),{has:o,get:a}=Tn(s);let c=o.call(s,n);c||(n=oe(n),c=o.call(s,n)),a&&a.call(s,n);const l=s.delete(n);return c&&Xt(s,"delete",n,void 0),l},clear(){const n=oe(this),s=n.size!==0,o=n.clear();return s&&Xt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{i[n]=ty(n,t,e)}),i}function Ln(t,e){const i=iy(t,e);return(r,n,s)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(ue(i,n)&&n in r?i:r,n,s)}const ry={get:Ln(!1,!1)},ny={get:Ln(!1,!0)},sy={get:Ln(!0,!1)},oy={get:Ln(!0,!0)},Yc=new WeakMap,Xc=new WeakMap,Jc=new WeakMap,Zc=new WeakMap;function ay(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ly(t){return t.__v_skip||!Object.isExtensible(t)?0:ay(Nm(t))}function jo(t){return Zt(t)?t:Nn(t,!1,Xm,ry,Yc)}function cy(t){return Nn(t,!1,Zm,ny,Xc)}function Uo(t){return Nn(t,!0,Jm,sy,Jc)}function q0(t){return Nn(t,!0,ey,oy,Zc)}function Nn(t,e,i,r,n){if(!ke(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=ly(t);if(s===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,s===2?r:i);return n.set(t,a),a}function ki(t){return Zt(t)?ki(t.__v_raw):!!(t&&t.__v_isReactive)}function Zt(t){return!!(t&&t.__v_isReadonly)}function gt(t){return!!(t&&t.__v_isShallow)}function Fo(t){return t?!!t.__v_raw:!1}function oe(t){const e=t&&t.__v_raw;return e?oe(e):t}function uy(t){return!ue(t,"__v_skip")&&Object.isExtensible(t)&&Rc(t,"__v_skip",!0),t}const Et=t=>ke(t)?jo(t):t,Wi=t=>ke(t)?Uo(t):t;function De(t){return t?t.__v_isRef===!0:!1}function Qe(t){return tu(t,!1)}function eu(t){return tu(t,!0)}function tu(t,e){return De(t)?t:new dy(t,e)}class dy{constructor(e,i){this.dep=new An,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=i?e:oe(e),this._value=i?e:Et(e),this.__v_isShallow=i}get value(){return this.dep.track(),this._value}set value(e){const i=this._rawValue,r=this.__v_isShallow||gt(e)||Zt(e);e=r?e:oe(e),it(e,i)&&(this._rawValue=e,this._value=r?e:Et(e),this.dep.trigger())}}function Oe(t){return De(t)?t.value:t}const fy={get:(t,e,i)=>e==="__v_raw"?t:Oe(Reflect.get(t,e,i)),set:(t,e,i,r)=>{const n=t[e];return De(n)&&!De(i)?(n.value=i,!0):Reflect.set(t,e,i,r)}};function iu(t){return ki(t)?t:new Proxy(t,fy)}class hy{constructor(e){this.__v_isRef=!0,this._value=void 0;const i=this.dep=new An,{get:r,set:n}=e(i.track.bind(i),i.trigger.bind(i));this._get=r,this._set=n}get value(){return this._value=this._get()}set value(e){this._set(e)}}function py(t){return new hy(t)}class gy{constructor(e,i,r){this.fn=e,this.setter=i,this._value=void 0,this.dep=new An(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Er-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!i,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&be!==this)return jc(this,!0),!0}get value(){const e=this.dep.track();return qc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function my(t,e,i=!1){let r,n;return Z(t)?r=t:(r=t.get,n=t.set),new gy(r,n,i)}const Mn={},Dn=new WeakMap;let Si;function yy(t,e=!1,i=Si){if(i){let r=Dn.get(i);r||Dn.set(i,r=[]),r.push(t)}}function by(t,e,i=le){const{immediate:r,deep:n,once:s,scheduler:o,augmentJob:a,call:c}=i,l=g=>n?g:gt(g)||n===!1||n===0?ei(g,1):ei(g);let u,d,m,p,h=!1,_=!1;if(De(t)?(d=()=>t.value,h=gt(t)):ki(t)?(d=()=>l(t),h=!0):J(t)?(_=!0,h=t.some(g=>ki(g)||gt(g)),d=()=>t.map(g=>{if(De(g))return g.value;if(ki(g))return l(g);if(Z(g))return c?c(g,2):g()})):Z(t)?e?d=c?()=>c(t,2):t:d=()=>{if(m){Mt();try{m()}finally{Dt()}}const g=Si;Si=u;try{return c?c(t,3,[p]):t(p)}finally{Si=g}}:d=Nt,e&&n){const g=d,w=n===!0?1/0:n;d=()=>ei(g(),w)}const k=zm(),P=()=>{u.stop(),k&&k.active&&xo(k.effects,u)};if(s&&e){const g=e;e=(...w)=>{g(...w),P()}}let b=_?new Array(t.length).fill(Mn):Mn;const y=g=>{if(!(!(u.flags&1)||!u.dirty&&!g))if(e){const w=u.run();if(n||h||(_?w.some((S,I)=>it(S,b[I])):it(w,b))){m&&m();const S=Si;Si=u;try{const I=[w,b===Mn?void 0:_&&b[0]===Mn?[]:b,p];b=w,c?c(e,3,I):e(...I)}finally{Si=S}}}else u.run()};return a&&a(y),u=new Mc(d),u.scheduler=o?()=>o(y,!1):y,p=g=>yy(g,!1,u),m=u.onStop=()=>{const g=Dn.get(u);if(g){if(c)c(g,4);else for(const w of g)w();Dn.delete(u)}},e?r?y(!0):b=u.run():o?o(y.bind(null,!0),!0):u.run(),P.pause=u.pause.bind(u),P.resume=u.resume.bind(u),P.stop=P,P}function ei(t,e=1/0,i){if(e<=0||!ke(t)||t.__v_skip||(i=i||new Map,(i.get(t)||0)>=e))return t;if(i.set(t,e),e--,De(t))ei(t.value,e,i);else if(J(t))for(let r=0;r<t.length;r++)ei(t[r],e,i);else if($c(t)||Hi(t))t.forEach(r=>{ei(r,e,i)});else if(Ic(t)){for(const r in t)ei(t[r],e,i);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&ei(t[r],e,i)}return t}const Cr=[];let qo=!1;function B0(t,...e){if(qo)return;qo=!0,Mt();const i=Cr.length?Cr[Cr.length-1].component:null,r=i&&i.appContext.config.warnHandler,n=vy();if(r)Ki(r,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,n.map(({vnode:s})=>`at <${Zu(i,s.type)}>`).join(`
22
22
  `),n]);else{const s=[`[Vue warn]: ${t}`,...e];n.length&&s.push(`
23
23
  `,...wy(n))}Dt(),qo=!1}function vy(){let t=Cr[Cr.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 r=t.component&&t.component.parent;t=r&&r.vnode}return e}function wy(t){const e=[];return t.forEach((i,r)=>{e.push(...r===0?[]:[`
24
- `],..._y(i))}),e}function _y({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${Zu(t.component,t.type,r)}`,s=">"+i;return t.props?[n,...xy(t.props),s]:[n+s]}function xy(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(r=>{e.push(...ru(r,t[r]))}),i.length>3&&e.push(" ..."),e}function ru(t,e,i){return Ae(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:De(e)?(e=ru(t,oe(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):Z(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=oe(e),i?e:[`${t}=`,e])}function Ki(t,e,i,r){try{return r?t(...r):t()}catch(n){Ir(n,e,i)}}function jt(t,e,i,r){if(Z(t)){const n=Ki(t,e,i,r);return n&&Pc(n)&&n.catch(s=>{Ir(s,e,i)}),n}if(J(t)){const n=[];for(let s=0;s<t.length;s++)n.push(jt(t[s],e,i,r));return n}}function Ir(t,e,i,r=!0){const n=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||le;if(e){let a=e.parent;const c=e.proxy,l=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,c,l)===!1)return}a=a.parent}if(s){Mt(),Ki(s,null,10,[t,c,l]),Dt();return}}ky(t,i,n,r,o)}function ky(t,e,i,r=!0,n=!1){if(n)throw t}const Ye=[];let Ut=-1;const Vi=[];let di=null,Gi=0;const nu=Promise.resolve();let jn=null;function Ar(t){const e=jn||nu;return t?e.then(this?t.bind(this):t):e}function Sy(t){let e=Ut+1,i=Ye.length;for(;e<i;){const r=e+i>>>1,n=Ye[r],s=Rr(n);s<t||s===t&&n.flags&2?e=r+1:i=r}return e}function Bo(t){if(!(t.flags&1)){const e=Rr(t),i=Ye[Ye.length-1];!i||!(t.flags&2)&&e>=Rr(i)?Ye.push(t):Ye.splice(Sy(e),0,t),t.flags|=1,su()}}function su(){jn||(jn=nu.then(lu))}function Ey(t){J(t)?Vi.push(...t):di&&t.id===-1?di.splice(Gi+1,0,t):t.flags&1||(Vi.push(t),t.flags|=1),su()}function ou(t,e,i=Ut+1){for(;i<Ye.length;i++){const r=Ye[i];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ye.splice(i,1),i--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function au(t){if(Vi.length){const e=[...new Set(Vi)].sort((i,r)=>Rr(i)-Rr(r));if(Vi.length=0,di){di.push(...e);return}for(di=e,Gi=0;Gi<di.length;Gi++){const i=di[Gi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}di=null,Gi=0}}const Rr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function lu(t){try{for(Ut=0;Ut<Ye.length;Ut++){const e=Ye[Ut];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ki(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ut<Ye.length;Ut++){const e=Ye[Ut];e&&(e.flags&=-2)}Ut=-1,Ye.length=0,au(),jn=null,(Ye.length||Vi.length)&&lu()}}let ze=null,cu=null;function Un(t){const e=ze;return ze=t,cu=t&&t.type.__scopeId||null,e}function Tr(t,e=ze,i){if(!e||t._n)return t;const r=(...n)=>{r._d&&Wu(-1);const s=Un(e);let o;try{o=t(...n)}finally{Un(s),r._d&&Wu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function uu(t,e){if(ze===null)return t;const i=Yn(ze),r=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[s,o,a,c=le]=e[n];s&&(Z(s)&&(s={mounted:s,updated:s}),s.deep&&ei(o),r.push({dir:s,instance:i,value:o,oldValue:void 0,arg:a,modifiers:c}))}return t}function Ei(t,e,i,r){const n=t.dirs,s=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];s&&(a.oldValue=s[o].value);let c=a.dir[r];c&&(Mt(),jt(c,i,8,[t.el,a,t,e]),Dt())}}function du(t,e){if(Ke){let i=Ke.provides;const r=Ke.parent&&Ke.parent.provides;r===i&&(i=Ke.provides=Object.create(r)),i[t]=e}}function Or(t,e,i=!1){const r=aa();if(r||Xi){let n=Xi?Xi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return i&&Z(e)?e.call(r&&r.proxy):e}}const $y=Symbol.for("v-scx"),Py=()=>Or($y);function Cy(t,e){return Ho(t,null,{flush:"sync"})}function Qi(t,e,i){return Ho(t,e,i)}function Ho(t,e,i=le){const{immediate:r,deep:n,flush:s,once:o}=i,a=Fe({},i),c=e&&r||!e&&s!=="post";let l;if(Zi){if(s==="sync"){const p=Py();l=p.__watcherHandles||(p.__watcherHandles=[])}else if(!c){const p=()=>{};return p.stop=Nt,p.resume=Nt,p.pause=Nt,p}}const u=Ke;a.call=(p,h,_)=>jt(p,u,h,_);let d=!1;s==="post"?a.scheduler=p=>{at(p,u&&u.suspense)}:s!=="sync"&&(d=!0,a.scheduler=(p,h)=>{h?p():Bo(p)}),a.augmentJob=p=>{e&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const m=by(t,e,a);return Zi&&(l?l.push(m):c&&m()),m}function Iy(t,e,i){const r=this.proxy,n=Ae(t)?t.includes(".")?fu(r,t):()=>r[t]:t.bind(r,r);let s;Z(e)?s=e:(s=e.handler,i=e);const o=Br(this),a=Ho(n,s.bind(r),i);return o(),a}function fu(t,e){const i=e.split(".");return()=>{let r=t;for(let n=0;n<i.length&&r;n++)r=r[i[n]];return r}}const Ay=Symbol("_vte"),Ry=t=>t.__isTeleport,Ty=Symbol("_leaveCb");function zo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,zo(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 $i(t,e){return Z(t)?Fe({name:t.name},e,{setup:t}):t}function Wo(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function hu(t){const e=aa(),i=eu(null);if(e){const n=e.refs===le?e.refs={}:e.refs;Object.defineProperty(n,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const Fn=new WeakMap;function Lr(t,e,i,r,n=!1){if(J(t)){t.forEach((h,_)=>Lr(h,e&&(J(e)?e[_]:e),i,r,n));return}if(Yi(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Lr(t,e,i,r.component.subTree);return}const s=r.shapeFlag&4?Yn(r.component):r.el,o=n?null:s,{i:a,r:c}=t,l=e&&e.r,u=a.refs===le?a.refs={}:a.refs,d=a.setupState,m=oe(d),p=d===le?Ec:h=>ue(m,h);if(l!=null&&l!==c){if(pu(e),Ae(l))u[l]=null,p(l)&&(d[l]=null);else if(De(l)){l.value=null;const h=e;h.k&&(u[h.k]=null)}}if(Z(c))Ki(c,a,12,[o,u]);else{const h=Ae(c),_=De(c);if(h||_){const k=()=>{if(t.f){const P=h?p(c)?d[c]:u[c]:c.value;if(n)J(P)&&xo(P,s);else if(J(P))P.includes(s)||P.push(s);else if(h)u[c]=[s],p(c)&&(d[c]=u[c]);else{const b=[s];c.value=b,t.k&&(u[t.k]=b)}}else h?(u[c]=o,p(c)&&(d[c]=o)):_&&(c.value=o,t.k&&(u[t.k]=o))};if(o){const P=()=>{k(),Fn.delete(t)};P.id=-1,Fn.set(t,P),at(P,i)}else pu(t),k()}}}function pu(t){const e=Fn.get(t);e&&(e.flags|=8,Fn.delete(t))}const gu=t=>t.nodeType===8;In().requestIdleCallback,In().cancelIdleCallback;function Oy(t,e){if(gu(t)&&t.data==="["){let i=1,r=t.nextSibling;for(;r;){if(r.nodeType===1){if(e(r)===!1)break}else if(gu(r))if(r.data==="]"){if(--i===0)break}else r.data==="["&&i++;r=r.nextSibling}}else e(t)}const Yi=t=>!!t.type.__asyncLoader;function Ly(t){Z(t)&&(t={loader:t});const{loader:e,loadingComponent:i,errorComponent:r,delay:n=200,hydrate:s,timeout:o,suspensible:a=!0,onError:c}=t;let l=null,u,d=0;const m=()=>(d++,l=null,p()),p=()=>{let h;return l||(h=l=e().catch(_=>{if(_=_ instanceof Error?_:new Error(String(_)),c)return new Promise((k,P)=>{c(_,()=>k(m()),()=>P(_),d+1)});throw _}).then(_=>h!==l&&l?l:(_&&(_.__esModule||_[Symbol.toStringTag]==="Module")&&(_=_.default),u=_,_)))};return $i({name:"AsyncComponentWrapper",__asyncLoader:p,__asyncHydrate(h,_,k){let P=!1;(_.bu||(_.bu=[])).push(()=>P=!0);const b=()=>{P||k()},y=s?()=>{const g=s(b,w=>Oy(h,w));g&&(_.bum||(_.bum=[])).push(g)}:b;u?y():p().then(()=>!_.isUnmounted&&y())},get __asyncResolved(){return u},setup(){const h=Ke;if(Wo(h),u)return()=>qn(u,h);const _=y=>{l=null,Ir(y,h,13,!r)};if(a&&h.suspense||Zi)return p().then(y=>()=>qn(y,h)).catch(y=>(_(y),()=>r?Ne(r,{error:y}):null));const k=Qe(!1),P=Qe(),b=Qe(!!n);return n&&setTimeout(()=>{b.value=!1},n),o!=null&&setTimeout(()=>{if(!k.value&&!P.value){const y=new Error(`Async component timed out after ${o}ms.`);_(y),P.value=y}},o),p().then(()=>{k.value=!0,h.parent&&Ko(h.parent.vnode)&&h.parent.update()}).catch(y=>{_(y),P.value=y}),()=>{if(k.value&&u)return qn(u,h);if(P.value&&r)return Ne(r,{error:P.value});if(i&&!b.value)return qn(i,h)}}})}function qn(t,e){const{ref:i,props:r,children:n,ce:s}=e.vnode,o=Ne(t,r,n);return o.ref=i,o.ce=s,delete e.vnode.ce,o}const Ko=t=>t.type.__isKeepAlive;function Ny(t,e){mu(t,"a",e)}function My(t,e){mu(t,"da",e)}function mu(t,e,i=Ke){const r=t.__wdc||(t.__wdc=()=>{let n=i;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(Bn(e,r,i),i){let n=i.parent;for(;n&&n.parent;)Ko(n.parent.vnode)&&Dy(r,e,i,n),n=n.parent}}function Dy(t,e,i,r){const n=Bn(e,t,r,!0);Go(()=>{xo(r[e],n)},i)}function Bn(t,e,i=Ke,r=!1){if(i){const n=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Mt();const a=Br(i),c=jt(e,i,t,o);return a(),Dt(),c});return r?n.unshift(s):n.push(s),s}}const ti=t=>(e,i=Ke)=>{(!Zi||t==="sp")&&Bn(t,(...r)=>e(...r),i)},yu=ti("bm"),Nr=ti("m"),jy=ti("bu"),Uy=ti("u"),Vo=ti("bum"),Go=ti("um"),Fy=ti("sp"),qy=ti("rtg"),By=ti("rtc");function Hy(t,e=Ke){Bn("ec",t,e)}const zy=Symbol.for("v-ndc");function Qo(t,e,i,r){let n;const s=i,o=J(t);if(o||Ae(t)){const a=o&&ki(t);let c=!1,l=!1;a&&(c=!gt(t),l=Zt(t),t=Rn(t)),n=new Array(t.length);for(let u=0,d=t.length;u<d;u++)n[u]=e(c?l?Wi(Et(t[u])):Et(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,s)}else if(ke(t))if(t[Symbol.iterator])n=Array.from(t,(a,c)=>e(a,c,void 0,s));else{const a=Object.keys(t);n=new Array(a.length);for(let c=0,l=a.length;c<l;c++){const u=a[c];n[c]=e(t[u],u,c,s)}}else n=[];return n}function Wy(t,e,i={},r,n){if(ze.ce||ze.parent&&Yi(ze.parent)&&ze.parent.ce){const l=Object.keys(i).length>0;return de(),Vn(We,null,[Ne("slot",i,r)],l?-2:64)}let s=t[e];s&&s._c&&(s._d=!1),de();const o=s&&bu(s(i)),a=i.key||o&&o.key,c=Vn(We,{key:(a&&!Qt(a)?a:`_${e}`)+(!o&&r?"_fb":"")},o||[],o&&t._===1?64:-2);return c.scopeId&&(c.slotScopeIds=[c.scopeId+"-s"]),s&&s._c&&(s._d=!0),c}function bu(t){return t.some(e=>sa(e)?!(e.type===ii||e.type===We&&!bu(e.children)):!0)?t:null}const Yo=t=>t?Yu(t)?Yn(t):Yo(t.parent):null,Mr=Fe(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=>Yo(t.parent),$root:t=>Yo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>xu(t),$forceUpdate:t=>t.f||(t.f=()=>{Bo(t.update)}),$nextTick:t=>t.n||(t.n=Ar.bind(t.proxy)),$watch:t=>Iy.bind(t)}),Xo=(t,e)=>t!==le&&!t.__isScriptSetup&&ue(t,e),Ky={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:r,data:n,props:s,accessCache:o,type:a,appContext:c}=t;if(e[0]!=="$"){const m=o[e];if(m!==void 0)switch(m){case 1:return r[e];case 2:return n[e];case 4:return i[e];case 3:return s[e]}else{if(Xo(r,e))return o[e]=1,r[e];if(n!==le&&ue(n,e))return o[e]=2,n[e];if(ue(s,e))return o[e]=3,s[e];if(i!==le&&ue(i,e))return o[e]=4,i[e];Jo&&(o[e]=0)}}const l=Mr[e];let u,d;if(l)return e==="$attrs"&&He(t.attrs,"get",""),l(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(i!==le&&ue(i,e))return o[e]=4,i[e];if(d=c.config.globalProperties,ue(d,e))return d[e]},set({_:t},e,i){const{data:r,setupState:n,ctx:s}=t;return Xo(n,e)?(n[e]=i,!0):r!==le&&ue(r,e)?(r[e]=i,!0):ue(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:r,appContext:n,props:s,type:o}},a){let c;return!!(i[a]||t!==le&&a[0]!=="$"&&ue(t,a)||Xo(e,a)||ue(s,a)||ue(r,a)||ue(Mr,a)||ue(n.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:ue(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function Hn(t){return J(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function vu(t,e){return!t||!e?t||e:J(t)&&J(e)?t.concat(e):Fe({},Hn(t),Hn(e))}let Jo=!0;function Vy(t){const e=xu(t),i=t.proxy,r=t.ctx;Jo=!1,e.beforeCreate&&wu(e.beforeCreate,t,"bc");const{data:n,computed:s,methods:o,watch:a,provide:c,inject:l,created:u,beforeMount:d,mounted:m,beforeUpdate:p,updated:h,activated:_,deactivated:k,beforeDestroy:P,beforeUnmount:b,destroyed:y,unmounted:g,render:w,renderTracked:S,renderTriggered:I,errorCaptured:F,serverPrefetch:N,expose:G,inheritAttrs:K,components:qe,directives:fe,filters:Re}=e;if(l&&Gy(l,r,null),o)for(const me in o){const ge=o[me];Z(ge)&&(r[me]=ge.bind(i))}if(n){const me=n.call(i,i);ke(me)&&(t.data=jo(me))}if(Jo=!0,s)for(const me in s){const ge=s[me],ni=Z(ge)?ge.bind(i,i):Z(ge.get)?ge.get.bind(i,i):Nt,lr=!Z(ge)&&Z(ge.set)?ge.set.bind(i):Nt,si=Bt({get:ni,set:lr});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>si.value,set:Ct=>si.value=Ct})}if(a)for(const me in a)_u(a[me],r,i,me);if(c){const me=Z(c)?c.call(i):c;Reflect.ownKeys(me).forEach(ge=>{du(ge,me[ge])})}u&&wu(u,t,"c");function ae(me,ge){J(ge)?ge.forEach(ni=>me(ni.bind(i))):ge&&me(ge.bind(i))}if(ae(yu,d),ae(Nr,m),ae(jy,p),ae(Uy,h),ae(Ny,_),ae(My,k),ae(Hy,F),ae(By,S),ae(qy,I),ae(Vo,b),ae(Go,g),ae(Fy,N),J(G))if(G.length){const me=t.exposed||(t.exposed={});G.forEach(ge=>{Object.defineProperty(me,ge,{get:()=>i[ge],set:ni=>i[ge]=ni,enumerable:!0})})}else t.exposed||(t.exposed={});w&&t.render===Nt&&(t.render=w),K!=null&&(t.inheritAttrs=K),qe&&(t.components=qe),fe&&(t.directives=fe),N&&Wo(t)}function Gy(t,e,i=Nt){J(t)&&(t=Zo(t));for(const r in t){const n=t[r];let s;ke(n)?"default"in n?s=Or(n.from||r,n.default,!0):s=Or(n.from||r):s=Or(n),De(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function wu(t,e,i){jt(J(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,i)}function _u(t,e,i,r){let n=r.includes(".")?fu(i,r):()=>i[r];if(Ae(t)){const s=e[t];Z(s)&&Qi(n,s)}else if(Z(t))Qi(n,t.bind(i));else if(ke(t))if(J(t))t.forEach(s=>_u(s,e,i,r));else{const s=Z(t.handler)?t.handler.bind(i):e[t.handler];Z(s)&&Qi(n,s,t)}}function xu(t){const e=t.type,{mixins:i,extends:r}=e,{mixins:n,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let c;return a?c=a:!n.length&&!i&&!r?c=e:(c={},n.length&&n.forEach(l=>zn(c,l,o,!0)),zn(c,e,o)),ke(e)&&s.set(e,c),c}function zn(t,e,i,r=!1){const{mixins:n,extends:s}=e;s&&zn(t,s,i,!0),n&&n.forEach(o=>zn(t,o,i,!0));for(const o in e)if(!(r&&o==="expose")){const a=Qy[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Qy={data:ku,props:Su,emits:Su,methods:Dr,computed:Dr,beforeCreate:Xe,created:Xe,beforeMount:Xe,mounted:Xe,beforeUpdate:Xe,updated:Xe,beforeDestroy:Xe,beforeUnmount:Xe,destroyed:Xe,unmounted:Xe,activated:Xe,deactivated:Xe,errorCaptured:Xe,serverPrefetch:Xe,components:Dr,directives:Dr,watch:Xy,provide:ku,inject:Yy};function ku(t,e){return e?t?function(){return Fe(Z(t)?t.call(this,this):t,Z(e)?e.call(this,this):e)}:e:t}function Yy(t,e){return Dr(Zo(t),Zo(e))}function Zo(t){if(J(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Xe(t,e){return t?[...new Set([].concat(t,e))]:e}function Dr(t,e){return t?Fe(Object.create(null),t,e):e}function Su(t,e){return t?J(t)&&J(e)?[...new Set([...t,...e])]:Fe(Object.create(null),Hn(t),Hn(e??{})):e}function Xy(t,e){if(!t)return e;if(!e)return t;const i=Fe(Object.create(null),t);for(const r in e)i[r]=Xe(t[r],e[r]);return i}function Eu(){return{app:null,config:{isNativeTag:Ec,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 Jy=0;function Zy(t,e){return function(r,n=null){Z(r)||(r=Fe({},r)),n!=null&&!ke(n)&&(n=null);const s=Eu(),o=new WeakSet,a=[];let c=!1;const l=s.app={_uid:Jy++,_component:r,_props:n,_container:null,_context:s,_instance:null,version:Rb,get config(){return s.config},set config(u){},use(u,...d){return o.has(u)||(u&&Z(u.install)?(o.add(u),u.install(l,...d)):Z(u)&&(o.add(u),u(l,...d))),l},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),l},component(u,d){return d?(s.components[u]=d,l):s.components[u]},directive(u,d){return d?(s.directives[u]=d,l):s.directives[u]},mount(u,d,m){if(!c){const p=l._ceVNode||Ne(r,n);return p.appContext=s,m===!0?m="svg":m===!1&&(m=void 0),t(p,u,m),c=!0,l._container=u,u.__vue_app__=l,Yn(p.component)}},onUnmount(u){a.push(u)},unmount(){c&&(jt(a,l._instance,16),t(null,l._container),delete l._container.__vue_app__)},provide(u,d){return s.provides[u]=d,l},runWithContext(u){const d=Xi;Xi=l;try{return u()}finally{Xi=d}}};return l}}let Xi=null;function $u(t,e,i=le){const r=aa(),n=Yt(e),s=ci(e),o=Pu(t,n),a=py((c,l)=>{let u,d=le,m;return Cy(()=>{const p=t[n];it(u,p)&&(u=p,l())}),{get(){return c(),i.get?i.get(u):u},set(p){const h=i.set?i.set(p):p;if(!it(h,u)&&!(d!==le&&it(p,d)))return;const _=r.vnode.props;_&&(e in _||n in _||s in _)&&(`onUpdate:${e}`in _||`onUpdate:${n}`in _||`onUpdate:${s}`in _)||(u=p,l()),r.emit(`update:${e}`,h),it(p,h)&&it(p,d)&&!it(h,m)&&l(),d=p,m=h}}});return a[Symbol.iterator]=()=>{let c=0;return{next(){return c<2?{value:c++?o||le:a,done:!1}:{done:!0}}}},a}const Pu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Yt(e)}Modifiers`]||t[`${ci(e)}Modifiers`];function eb(t,e,...i){if(t.isUnmounted)return;const r=t.vnode.props||le;let n=i;const s=e.startsWith("update:"),o=s&&Pu(r,e.slice(7));o&&(o.trim&&(n=i.map(u=>Ae(u)?u.trim():u)),o.number&&(n=i.map(Eo)));let a,c=r[a=So(e)]||r[a=So(Yt(e))];!c&&s&&(c=r[a=So(ci(e))]),c&&jt(c,t,6,n);const l=r[a+"Once"];if(l){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,jt(l,t,6,n)}}const tb=new WeakMap;function Cu(t,e,i=!1){const r=i?tb:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const s=t.emits;let o={},a=!1;if(!Z(t)){const c=l=>{const u=Cu(l,e,!0);u&&(a=!0,Fe(o,u))};!i&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!s&&!a?(ke(t)&&r.set(t,null),null):(J(s)?s.forEach(c=>o[c]=null):Fe(o,s),ke(t)&&r.set(t,o),o)}function Wn(t,e){return!t||!En(e)?!1:(e=e.slice(2).replace(/Once$/,""),ue(t,e[0].toLowerCase()+e.slice(1))||ue(t,ci(e))||ue(t,e))}function H0(){}function Iu(t){const{type:e,vnode:i,proxy:r,withProxy:n,propsOptions:[s],slots:o,attrs:a,emit:c,render:l,renderCache:u,props:d,data:m,setupState:p,ctx:h,inheritAttrs:_}=t,k=Un(t);let P,b;try{if(i.shapeFlag&4){const g=n||r,w=g;P=Ft(l.call(w,g,u,d,p,m,h)),b=a}else{const g=e;P=Ft(g.length>1?g(d,{attrs:a,slots:o,emit:c}):g(d,null)),b=e.props?a:ib(a)}}catch(g){jr.length=0,Ir(g,t,1),P=Ne(ii)}let y=P;if(b&&_!==!1){const g=Object.keys(b),{shapeFlag:w}=y;g.length&&w&7&&(s&&g.some(_o)&&(b=rb(b,s)),y=Ji(y,b,!1,!0))}return i.dirs&&(y=Ji(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(i.dirs):i.dirs),i.transition&&zo(y,i.transition),P=y,Un(k),P}const ib=t=>{let e;for(const i in t)(i==="class"||i==="style"||En(i))&&((e||(e={}))[i]=t[i]);return e},rb=(t,e)=>{const i={};for(const r in t)(!_o(r)||!(r.slice(9)in e))&&(i[r]=t[r]);return i};function nb(t,e,i){const{props:r,children:n,component:s}=t,{props:o,children:a,patchFlag:c}=e,l=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&c>=0){if(c&1024)return!0;if(c&16)return r?Au(r,o,l):!!o;if(c&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const m=u[d];if(o[m]!==r[m]&&!Wn(l,m))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?Au(r,o,l):!0:!!o;return!1}function Au(t,e,i){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const s=r[n];if(e[s]!==t[s]&&!Wn(i,s))return!0}return!1}function sb({vnode:t,parent:e},i){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=i,e=e.parent;else break}}const Ru={},Tu=()=>Object.create(Ru),Ou=t=>Object.getPrototypeOf(t)===Ru;function ob(t,e,i,r=!1){const n={},s=Tu();t.propsDefaults=Object.create(null),Lu(t,e,n,s);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);i?t.props=r?n:cy(n):t.type.props?t.props=n:t.props=s,t.attrs=s}function ab(t,e,i,r){const{props:n,attrs:s,vnode:{patchFlag:o}}=t,a=oe(n),[c]=t.propsOptions;let l=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let m=u[d];if(Wn(t.emitsOptions,m))continue;const p=e[m];if(c)if(ue(s,m))p!==s[m]&&(s[m]=p,l=!0);else{const h=Yt(m);n[h]=ea(c,a,h,p,t,!1)}else p!==s[m]&&(s[m]=p,l=!0)}}}else{Lu(t,e,n,s)&&(l=!0);let u;for(const d in a)(!e||!ue(e,d)&&((u=ci(d))===d||!ue(e,u)))&&(c?i&&(i[d]!==void 0||i[u]!==void 0)&&(n[d]=ea(c,a,d,void 0,t,!0)):delete n[d]);if(s!==a)for(const d in s)(!e||!ue(e,d))&&(delete s[d],l=!0)}l&&Xt(t.attrs,"set","")}function Lu(t,e,i,r){const[n,s]=t.propsOptions;let o=!1,a;if(e)for(let c in e){if(xr(c))continue;const l=e[c];let u;n&&ue(n,u=Yt(c))?!s||!s.includes(u)?i[u]=l:(a||(a={}))[u]=l:Wn(t.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(s){const c=oe(i),l=a||le;for(let u=0;u<s.length;u++){const d=s[u];i[d]=ea(n,c,d,l[d],t,!ue(l,d))}}return o}function ea(t,e,i,r,n,s){const o=t[i];if(o!=null){const a=ue(o,"default");if(a&&r===void 0){const c=o.default;if(o.type!==Function&&!o.skipFactory&&Z(c)){const{propsDefaults:l}=n;if(i in l)r=l[i];else{const u=Br(n);r=l[i]=c.call(null,e),u()}}else r=c;n.ce&&n.ce._setProp(i,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===ci(i))&&(r=!0))}return r}const lb=new WeakMap;function Nu(t,e,i=!1){const r=i?lb:e.propsCache,n=r.get(t);if(n)return n;const s=t.props,o={},a=[];let c=!1;if(!Z(t)){const u=d=>{c=!0;const[m,p]=Nu(d,e,!0);Fe(o,m),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&&!c)return ke(t)&&r.set(t,Bi),Bi;if(J(s))for(let u=0;u<s.length;u++){const d=Yt(s[u]);Mu(d)&&(o[d]=le)}else if(s)for(const u in s){const d=Yt(u);if(Mu(d)){const m=s[u],p=o[d]=J(m)||Z(m)?{type:m}:Fe({},m),h=p.type;let _=!1,k=!0;if(J(h))for(let P=0;P<h.length;++P){const b=h[P],y=Z(b)&&b.name;if(y==="Boolean"){_=!0;break}else y==="String"&&(k=!1)}else _=Z(h)&&h.name==="Boolean";p[0]=_,p[1]=k,(_||ue(p,"default"))&&a.push(d)}}const l=[o,a];return ke(t)&&r.set(t,l),l}function Mu(t){return t[0]!=="$"&&!xr(t)}const ta=t=>t==="_"||t==="_ctx"||t==="$stable",ia=t=>J(t)?t.map(Ft):[Ft(t)],cb=(t,e,i)=>{if(e._n)return e;const r=Tr((...n)=>ia(e(...n)),i);return r._c=!1,r},Du=(t,e,i)=>{const r=t._ctx;for(const n in t){if(ta(n))continue;const s=t[n];if(Z(s))e[n]=cb(n,s,r);else if(s!=null){const o=ia(s);e[n]=()=>o}}},ju=(t,e)=>{const i=ia(e);t.slots.default=()=>i},Uu=(t,e,i)=>{for(const r in e)(i||!ta(r))&&(t[r]=e[r])},ub=(t,e,i)=>{const r=t.slots=Tu();if(t.vnode.shapeFlag&32){const n=e._;n?(Uu(r,e,i),i&&Rc(r,"_",n,!0)):Du(e,r)}else e&&ju(t,e)},db=(t,e,i)=>{const{vnode:r,slots:n}=t;let s=!0,o=le;if(r.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Uu(n,e,i):(s=!e.$stable,Du(e,n)),o=e}else e&&(ju(t,e),o={default:1});if(s)for(const a in n)!ta(a)&&o[a]==null&&delete n[a]},at=mb;function fb(t){return hb(t)}function hb(t,e){const i=In();i.__VUE__=!0;const{insert:r,remove:n,patchProp:s,createElement:o,createText:a,createComment:c,setText:l,setElementText:u,parentNode:d,nextSibling:m,setScopeId:p=Nt,insertStaticContent:h}=t,_=(v,x,E,T=null,R=null,O=null,B=void 0,q=null,D=!!x.dynamicChildren)=>{if(v===x)return;v&&!Fr(v,x)&&(T=H(v),Ct(v,R,O,!0),v=null),x.patchFlag===-2&&(D=!1,x.dynamicChildren=null);const{type:L,ref:Q,shapeFlag:z}=x;switch(L){case Kn:k(v,x,E,T);break;case ii:P(v,x,E,T);break;case na:v==null&&b(x,E,T,B);break;case We:qe(v,x,E,T,R,O,B,q,D);break;default:z&1?w(v,x,E,T,R,O,B,q,D):z&6?fe(v,x,E,T,R,O,B,q,D):(z&64||z&128)&&L.process(v,x,E,T,R,O,B,q,D,we)}Q!=null&&R?Lr(Q,v&&v.ref,O,x||v,!x):Q==null&&v&&v.ref!=null&&Lr(v.ref,null,O,v,!0)},k=(v,x,E,T)=>{if(v==null)r(x.el=a(x.children),E,T);else{const R=x.el=v.el;x.children!==v.children&&l(R,x.children)}},P=(v,x,E,T)=>{v==null?r(x.el=c(x.children||""),E,T):x.el=v.el},b=(v,x,E,T)=>{[v.el,v.anchor]=h(v.children,x,E,T,v.el,v.anchor)},y=({el:v,anchor:x},E,T)=>{let R;for(;v&&v!==x;)R=m(v),r(v,E,T),v=R;r(x,E,T)},g=({el:v,anchor:x})=>{let E;for(;v&&v!==x;)E=m(v),n(v),v=E;n(x)},w=(v,x,E,T,R,O,B,q,D)=>{if(x.type==="svg"?B="svg":x.type==="math"&&(B="mathml"),v==null)S(x,E,T,R,O,B,q,D);else{const L=v.el&&v.el._isVueCE?v.el:null;try{L&&L._beginPatch(),N(v,x,R,O,B,q,D)}finally{L&&L._endPatch()}}},S=(v,x,E,T,R,O,B,q)=>{let D,L;const{props:Q,shapeFlag:z,transition:V,dirs:ee}=v;if(D=v.el=o(v.type,O,Q&&Q.is,Q),z&8?u(D,v.children):z&16&&F(v.children,D,null,T,R,ra(v,O),B,q),ee&&Ei(v,null,T,"created"),I(D,v,v.scopeId,B,T),Q){for(const _e in Q)_e!=="value"&&!xr(_e)&&s(D,_e,null,Q[_e],O,T);"value"in Q&&s(D,"value",null,Q.value,O),(L=Q.onVnodeBeforeMount)&&qt(L,T,v)}ee&&Ei(v,null,T,"beforeMount");const se=pb(R,V);se&&V.beforeEnter(D),r(D,x,E),((L=Q&&Q.onVnodeMounted)||se||ee)&&at(()=>{L&&qt(L,T,v),se&&V.enter(D),ee&&Ei(v,null,T,"mounted")},R)},I=(v,x,E,T,R)=>{if(E&&p(v,E),T)for(let O=0;O<T.length;O++)p(v,T[O]);if(R){let O=R.subTree;if(x===O||zu(O.type)&&(O.ssContent===x||O.ssFallback===x)){const B=R.vnode;I(v,B,B.scopeId,B.slotScopeIds,R.parent)}}},F=(v,x,E,T,R,O,B,q,D=0)=>{for(let L=D;L<v.length;L++){const Q=v[L]=q?hi(v[L]):Ft(v[L]);_(null,Q,x,E,T,R,O,B,q)}},N=(v,x,E,T,R,O,B)=>{const q=x.el=v.el;let{patchFlag:D,dynamicChildren:L,dirs:Q}=x;D|=v.patchFlag&16;const z=v.props||le,V=x.props||le;let ee;if(E&&Pi(E,!1),(ee=V.onVnodeBeforeUpdate)&&qt(ee,E,x,v),Q&&Ei(x,v,E,"beforeUpdate"),E&&Pi(E,!0),(z.innerHTML&&V.innerHTML==null||z.textContent&&V.textContent==null)&&u(q,""),L?G(v.dynamicChildren,L,q,E,T,ra(x,R),O):B||ge(v,x,q,null,E,T,ra(x,R),O,!1),D>0){if(D&16)K(q,z,V,E,R);else if(D&2&&z.class!==V.class&&s(q,"class",null,V.class,R),D&4&&s(q,"style",z.style,V.style,R),D&8){const se=x.dynamicProps;for(let _e=0;_e<se.length;_e++){const he=se[_e],nt=z[he],st=V[he];(st!==nt||he==="value")&&s(q,he,nt,st,R,E)}}D&1&&v.children!==x.children&&u(q,x.children)}else!B&&L==null&&K(q,z,V,E,R);((ee=V.onVnodeUpdated)||Q)&&at(()=>{ee&&qt(ee,E,x,v),Q&&Ei(x,v,E,"updated")},T)},G=(v,x,E,T,R,O,B)=>{for(let q=0;q<x.length;q++){const D=v[q],L=x[q],Q=D.el&&(D.type===We||!Fr(D,L)||D.shapeFlag&198)?d(D.el):E;_(D,L,Q,null,T,R,O,B,!0)}},K=(v,x,E,T,R)=>{if(x!==E){if(x!==le)for(const O in x)!xr(O)&&!(O in E)&&s(v,O,x[O],null,R,T);for(const O in E){if(xr(O))continue;const B=E[O],q=x[O];B!==q&&O!=="value"&&s(v,O,q,B,R,T)}"value"in E&&s(v,"value",x.value,E.value,R)}},qe=(v,x,E,T,R,O,B,q,D)=>{const L=x.el=v?v.el:a(""),Q=x.anchor=v?v.anchor:a("");let{patchFlag:z,dynamicChildren:V,slotScopeIds:ee}=x;ee&&(q=q?q.concat(ee):ee),v==null?(r(L,E,T),r(Q,E,T),F(x.children||[],E,Q,R,O,B,q,D)):z>0&&z&64&&V&&v.dynamicChildren&&v.dynamicChildren.length===V.length?(G(v.dynamicChildren,V,E,R,O,B,q),(x.key!=null||R&&x===R.subTree)&&Fu(v,x,!0)):ge(v,x,E,Q,R,O,B,q,D)},fe=(v,x,E,T,R,O,B,q,D)=>{x.slotScopeIds=q,v==null?x.shapeFlag&512?R.ctx.activate(x,E,T,B,D):Re(x,E,T,R,O,B,D):Pe(v,x,D)},Re=(v,x,E,T,R,O,B)=>{const q=v.component=xb(v,T,R);if(Ko(v)&&(q.ctx.renderer=we),kb(q,!1,B),q.asyncDep){if(R&&R.registerDep(q,ae,B),!v.el){const D=q.subTree=Ne(ii);P(null,D,x,E),v.placeholder=D.el}}else ae(q,v,x,E,R,O,B)},Pe=(v,x,E)=>{const T=x.component=v.component;if(nb(v,x,E))if(T.asyncDep&&!T.asyncResolved){me(T,x,E);return}else T.next=x,T.update();else x.el=v.el,T.vnode=x},ae=(v,x,E,T,R,O,B)=>{const q=()=>{if(v.isMounted){let{next:z,bu:V,u:ee,parent:se,vnode:_e}=v;{const zt=qu(v);if(zt){z&&(z.el=_e.el,me(v,z,B)),zt.asyncDep.then(()=>{v.isUnmounted||q()});return}}let he=z,nt;Pi(v,!1),z?(z.el=_e.el,me(v,z,B)):z=_e,V&&Cn(V),(nt=z.props&&z.props.onVnodeBeforeUpdate)&&qt(nt,se,z,_e),Pi(v,!0);const st=Iu(v),Ht=v.subTree;v.subTree=st,_(Ht,st,d(Ht.el),H(Ht),v,R,O),z.el=st.el,he===null&&sb(v,st.el),ee&&at(ee,R),(nt=z.props&&z.props.onVnodeUpdated)&&at(()=>qt(nt,se,z,_e),R)}else{let z;const{el:V,props:ee}=x,{bm:se,m:_e,parent:he,root:nt,type:st}=v,Ht=Yi(x);Pi(v,!1),se&&Cn(se),!Ht&&(z=ee&&ee.onVnodeBeforeMount)&&qt(z,he,x),Pi(v,!0);{nt.ce&&nt.ce._def.shadowRoot!==!1&&nt.ce._injectChildStyle(st);const zt=v.subTree=Iu(v);_(null,zt,E,T,v,R,O),x.el=zt.el}if(_e&&at(_e,R),!Ht&&(z=ee&&ee.onVnodeMounted)){const zt=x;at(()=>qt(z,he,zt),R)}(x.shapeFlag&256||he&&Yi(he.vnode)&&he.vnode.shapeFlag&256)&&v.a&&at(v.a,R),v.isMounted=!0,x=E=T=null}};v.scope.on();const D=v.effect=new Mc(q);v.scope.off();const L=v.update=D.run.bind(D),Q=v.job=D.runIfDirty.bind(D);Q.i=v,Q.id=v.uid,D.scheduler=()=>Bo(Q),Pi(v,!0),L()},me=(v,x,E)=>{x.component=v;const T=v.vnode.props;v.vnode=x,v.next=null,ab(v,x.props,T,E),db(v,x.children,E),Mt(),ou(v),Dt()},ge=(v,x,E,T,R,O,B,q,D=!1)=>{const L=v&&v.children,Q=v?v.shapeFlag:0,z=x.children,{patchFlag:V,shapeFlag:ee}=x;if(V>0){if(V&128){lr(L,z,E,T,R,O,B,q,D);return}else if(V&256){ni(L,z,E,T,R,O,B,q,D);return}}ee&8?(Q&16&&M(L,R,O),z!==L&&u(E,z)):Q&16?ee&16?lr(L,z,E,T,R,O,B,q,D):M(L,R,O,!0):(Q&8&&u(E,""),ee&16&&F(z,E,T,R,O,B,q,D))},ni=(v,x,E,T,R,O,B,q,D)=>{v=v||Bi,x=x||Bi;const L=v.length,Q=x.length,z=Math.min(L,Q);let V;for(V=0;V<z;V++){const ee=x[V]=D?hi(x[V]):Ft(x[V]);_(v[V],ee,E,null,R,O,B,q,D)}L>Q?M(v,R,O,!0,!1,z):F(x,E,T,R,O,B,q,D,z)},lr=(v,x,E,T,R,O,B,q,D)=>{let L=0;const Q=x.length;let z=v.length-1,V=Q-1;for(;L<=z&&L<=V;){const ee=v[L],se=x[L]=D?hi(x[L]):Ft(x[L]);if(Fr(ee,se))_(ee,se,E,null,R,O,B,q,D);else break;L++}for(;L<=z&&L<=V;){const ee=v[z],se=x[V]=D?hi(x[V]):Ft(x[V]);if(Fr(ee,se))_(ee,se,E,null,R,O,B,q,D);else break;z--,V--}if(L>z){if(L<=V){const ee=V+1,se=ee<Q?x[ee].el:T;for(;L<=V;)_(null,x[L]=D?hi(x[L]):Ft(x[L]),E,se,R,O,B,q,D),L++}}else if(L>V)for(;L<=z;)Ct(v[L],R,O,!0),L++;else{const ee=L,se=L,_e=new Map;for(L=se;L<=V;L++){const ft=x[L]=D?hi(x[L]):Ft(x[L]);ft.key!=null&&_e.set(ft.key,L)}let he,nt=0;const st=V-se+1;let Ht=!1,zt=0;const Xr=new Array(st);for(L=0;L<st;L++)Xr[L]=0;for(L=ee;L<=z;L++){const ft=v[L];if(nt>=st){Ct(ft,R,O,!0);continue}let Wt;if(ft.key!=null)Wt=_e.get(ft.key);else for(he=se;he<=V;he++)if(Xr[he-se]===0&&Fr(ft,x[he])){Wt=he;break}Wt===void 0?Ct(ft,R,O,!0):(Xr[Wt-se]=L+1,Wt>=zt?zt=Wt:Ht=!0,_(ft,x[Wt],E,null,R,O,B,q,D),nt++)}const Uf=Ht?gb(Xr):Bi;for(he=Uf.length-1,L=st-1;L>=0;L--){const ft=se+L,Wt=x[ft],Ff=x[ft+1],qf=ft+1<Q?Ff.el||Hu(Ff):T;Xr[L]===0?_(null,Wt,E,qf,R,O,B,q,D):Ht&&(he<0||L!==Uf[he]?si(Wt,E,qf,2):he--)}}},si=(v,x,E,T,R=null)=>{const{el:O,type:B,transition:q,children:D,shapeFlag:L}=v;if(L&6){si(v.component.subTree,x,E,T);return}if(L&128){v.suspense.move(x,E,T);return}if(L&64){B.move(v,x,E,we);return}if(B===We){r(O,x,E);for(let z=0;z<D.length;z++)si(D[z],x,E,T);r(v.anchor,x,E);return}if(B===na){y(v,x,E);return}if(T!==2&&L&1&&q)if(T===0)q.beforeEnter(O),r(O,x,E),at(()=>q.enter(O),R);else{const{leave:z,delayLeave:V,afterLeave:ee}=q,se=()=>{v.ctx.isUnmounted?n(O):r(O,x,E)},_e=()=>{O._isLeaving&&O[Ty](!0),z(O,()=>{se(),ee&&ee()})};V?V(O,se,_e):_e()}else r(O,x,E)},Ct=(v,x,E,T=!1,R=!1)=>{const{type:O,props:B,ref:q,children:D,dynamicChildren:L,shapeFlag:Q,patchFlag:z,dirs:V,cacheIndex:ee}=v;if(z===-2&&(R=!1),q!=null&&(Mt(),Lr(q,null,E,v,!0),Dt()),ee!=null&&(x.renderCache[ee]=void 0),Q&256){x.ctx.deactivate(v);return}const se=Q&1&&V,_e=!Yi(v);let he;if(_e&&(he=B&&B.onVnodeBeforeUnmount)&&qt(he,x,v),Q&6)C(v.component,E,T);else{if(Q&128){v.suspense.unmount(E,T);return}se&&Ei(v,null,x,"beforeUnmount"),Q&64?v.type.remove(v,x,E,we,T):L&&!L.hasOnce&&(O!==We||z>0&&z&64)?M(L,x,E,!1,!0):(O===We&&z&384||!R&&Q&16)&&M(D,x,E),T&&xs(v)}(_e&&(he=B&&B.onVnodeUnmounted)||se)&&at(()=>{he&&qt(he,x,v),se&&Ei(v,null,x,"unmounted")},E)},xs=v=>{const{type:x,el:E,anchor:T,transition:R}=v;if(x===We){Ni(E,T);return}if(x===na){g(v);return}const O=()=>{n(E),R&&!R.persisted&&R.afterLeave&&R.afterLeave()};if(v.shapeFlag&1&&R&&!R.persisted){const{leave:B,delayLeave:q}=R,D=()=>B(E,O);q?q(v.el,O,D):D()}else O()},Ni=(v,x)=>{let E;for(;v!==x;)E=m(v),n(v),v=E;n(x)},C=(v,x,E)=>{const{bum:T,scope:R,job:O,subTree:B,um:q,m:D,a:L}=v;Bu(D),Bu(L),T&&Cn(T),R.stop(),O&&(O.flags|=8,Ct(B,v,x,E)),q&&at(q,x),at(()=>{v.isUnmounted=!0},x)},M=(v,x,E,T=!1,R=!1,O=0)=>{for(let B=O;B<v.length;B++)Ct(v[B],x,E,T,R)},H=v=>{if(v.shapeFlag&6)return H(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const x=m(v.anchor||v.el),E=x&&x[Ay];return E?m(E):x};let te=!1;const Je=(v,x,E)=>{let T;v==null?x._vnode&&(Ct(x._vnode,null,null,!0),T=x._vnode.component):_(x._vnode||null,v,x,null,null,null,E),x._vnode=v,te||(te=!0,ou(T),au(),te=!1)},we={p:_,um:Ct,m:si,r:xs,mt:Re,mc:F,pc:ge,pbc:G,n:H,o:t};return{render:Je,hydrate:void 0,createApp:Zy(Je)}}function ra({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 Pi({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function pb(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Fu(t,e,i=!1){const r=t.children,n=e.children;if(J(r)&&J(n))for(let s=0;s<r.length;s++){const o=r[s];let a=n[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[s]=hi(n[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Fu(o,a)),a.type===Kn&&(a.patchFlag!==-1?a.el=o.el:a.__elIndex=s+(t.type===We?1:0)),a.type===ii&&!a.el&&(a.el=o.el)}}function gb(t){const e=t.slice(),i=[0];let r,n,s,o,a;const c=t.length;for(r=0;r<c;r++){const l=t[r];if(l!==0){if(n=i[i.length-1],t[n]<l){e[r]=n,i.push(r);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<l?s=a+1:o=a;l<t[i[s]]&&(s>0&&(e[r]=i[s-1]),i[s]=r)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function qu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:qu(e)}function Bu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Hu(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Hu(e.subTree):null}const zu=t=>t.__isSuspense;function mb(t,e){e&&e.pendingBranch?J(t)?e.effects.push(...t):e.effects.push(t):Ey(t)}const We=Symbol.for("v-fgt"),Kn=Symbol.for("v-txt"),ii=Symbol.for("v-cmt"),na=Symbol.for("v-stc"),jr=[];let lt=null;function de(t=!1){jr.push(lt=t?null:[])}function yb(){jr.pop(),lt=jr[jr.length-1]||null}let Ur=1;function Wu(t,e=!1){Ur+=t,t<0&&lt&&e&&(lt.hasOnce=!0)}function Ku(t){return t.dynamicChildren=Ur>0?lt||Bi:null,yb(),Ur>0&&lt&&lt.push(t),t}function ve(t,e,i,r,n,s){return Ku(ie(t,e,i,r,n,s,!0))}function Vn(t,e,i,r,n){return Ku(Ne(t,e,i,r,n,!0))}function sa(t){return t?t.__v_isVNode===!0:!1}function Fr(t,e){return t.type===e.type&&t.key===e.key}const Vu=({key:t})=>t??null,Gn=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?Ae(t)||De(t)||Z(t)?{i:ze,r:t,k:e,f:!!i}:t:null);function ie(t,e=null,i=null,r=0,n=null,s=t===We?0:1,o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Vu(e),ref:e&&Gn(e),scopeId:cu,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:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:ze};return a?(oa(c,i),s&128&&t.normalize(c)):i&&(c.shapeFlag|=Ae(i)?8:16),Ur>0&&!o&&lt&&(c.patchFlag>0||s&6)&&c.patchFlag!==32&&lt.push(c),c}const Ne=bb;function bb(t,e=null,i=null,r=0,n=null,s=!1){if((!t||t===zy)&&(t=ii),sa(t)){const a=Ji(t,e,!0);return i&&oa(a,i),Ur>0&&!s&&lt&&(a.shapeFlag&6?lt[lt.indexOf(t)]=a:lt.push(a)),a.patchFlag=-2,a}if(Ab(t)&&(t=t.__vccOpts),e){e=vb(e);let{class:a,style:c}=e;a&&!Ae(a)&&(e.class=kt(a)),ke(c)&&(Fo(c)&&!J(c)&&(c=Fe({},c)),e.style=$o(c))}const o=Ae(t)?1:zu(t)?128:Ry(t)?64:ke(t)?4:Z(t)?2:0;return ie(t,e,i,r,n,o,s,!0)}function vb(t){return t?Fo(t)||Ou(t)?Fe({},t):t:null}function Ji(t,e,i=!1,r=!1){const{props:n,ref:s,patchFlag:o,children:a,transition:c}=t,l=e?Gu(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Vu(l),ref:e&&e.ref?i&&s?J(s)?s.concat(Gn(e)):[s,Gn(e)]:Gn(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!==We?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:c,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ji(t.ssContent),ssFallback:t.ssFallback&&Ji(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&r&&zo(u,c.clone(u)),u}function qr(t=" ",e=0){return Ne(Kn,null,t,e)}function fi(t="",e=!1){return e?(de(),Vn(ii,null,t)):Ne(ii,null,t)}function Ft(t){return t==null||typeof t=="boolean"?Ne(ii):J(t)?Ne(We,null,t.slice()):sa(t)?hi(t):Ne(Kn,null,String(t))}function hi(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ji(t)}function oa(t,e){let i=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(J(e))i=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),oa(t,n()),n._c&&(n._d=!0));return}else{i=32;const n=e._;!n&&!Ou(e)?e._ctx=ze:n===3&&ze&&(ze.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Z(e)?(e={default:e,_ctx:ze},i=32):(e=String(e),r&64?(i=16,e=[qr(e)]):i=8);t.children=e,t.shapeFlag|=i}function Gu(...t){const e={};for(let i=0;i<t.length;i++){const r=t[i];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=kt([e.class,r.class]));else if(n==="style")e.style=$o([e.style,r.style]);else if(En(n)){const s=e[n],o=r[n];o&&s!==o&&!(J(s)&&s.includes(o))&&(e[n]=s?[].concat(s,o):o)}else n!==""&&(e[n]=r[n])}return e}function qt(t,e,i,r=null){jt(t,e,7,[i,r])}const wb=Eu();let _b=0;function xb(t,e,i){const r=t.type,n=(e?e.appContext:t.appContext)||wb,s={uid:_b++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Hm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Nu(r,n),emitsOptions:Cu(r,n),emit:null,emitted:null,propsDefaults:le,inheritAttrs:r.inheritAttrs,ctx:le,data:le,props:le,attrs:le,slots:le,refs:le,setupState:le,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=eb.bind(null,s),t.ce&&t.ce(s),s}let Ke=null;const aa=()=>Ke||ze;let Qn,la;{const t=In(),e=(i,r)=>{let n;return(n=t[i])||(n=t[i]=[]),n.push(r),s=>{n.length>1?n.forEach(o=>o(s)):n[0](s)}};Qn=e("__VUE_INSTANCE_SETTERS__",i=>Ke=i),la=e("__VUE_SSR_SETTERS__",i=>Zi=i)}const Br=t=>{const e=Ke;return Qn(t),t.scope.on(),()=>{t.scope.off(),Qn(e)}},Qu=()=>{Ke&&Ke.scope.off(),Qn(null)};function Yu(t){return t.vnode.shapeFlag&4}let Zi=!1;function kb(t,e=!1,i=!1){e&&la(e);const{props:r,children:n}=t.vnode,s=Yu(t);ob(t,r,s,e),ub(t,n,i||e);const o=s?Sb(t,e):void 0;return e&&la(!1),o}function Sb(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Ky);const{setup:r}=i;if(r){Mt();const n=t.setupContext=r.length>1?$b(t):null,s=Br(t),o=Ki(r,t,0,[t.props,n]),a=Pc(o);if(Dt(),s(),(a||t.sp)&&!Yi(t)&&Wo(t),a){if(o.then(Qu,Qu),e)return o.then(c=>{Xu(t,c)}).catch(c=>{Ir(c,t,0)});t.asyncDep=o}else Xu(t,o)}else Ju(t)}function Xu(t,e,i){Z(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ke(e)&&(t.setupState=iu(e)),Ju(t)}function Ju(t,e,i){const r=t.type;t.render||(t.render=r.render||Nt);{const n=Br(t);Mt();try{Vy(t)}finally{Dt(),n()}}}const Eb={get(t,e){return He(t,"get",""),t[e]}};function $b(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,Eb),slots:t.slots,emit:t.emit,expose:e}}function Yn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(iu(uy(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in Mr)return Mr[i](t)},has(e,i){return i in e||i in Mr}})):t.proxy}const Pb=/(?:^|[-_])\w/g,Cb=t=>t.replace(Pb,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ib(t,e=!0){return Z(t)?t.displayName||t.name:t.name||e&&t.__name}function Zu(t,e,i=!1){let r=Ib(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t){const n=s=>{for(const o in s)if(s[o]===e)return o};r=n(t.components)||t.parent&&n(t.parent.type.components)||n(t.appContext.components)}return r?Cb(r):i?"App":"Anonymous"}function Ab(t){return Z(t)&&"__vccOpts"in t}const Bt=(t,e)=>my(t,e,Zi),Rb="3.5.26";let ca;const ed=typeof window<"u"&&window.trustedTypes;if(ed)try{ca=ed.createPolicy("vue",{createHTML:t=>t})}catch{}const td=ca?t=>ca.createHTML(t):t=>t,Tb="http://www.w3.org/2000/svg",Ob="http://www.w3.org/1998/Math/MathML",ri=typeof document<"u"?document:null,id=ri&&ri.createElement("template"),Lb={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,r)=>{const n=e==="svg"?ri.createElementNS(Tb,t):e==="mathml"?ri.createElementNS(Ob,t):i?ri.createElement(t,{is:i}):ri.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>ri.createTextNode(t),createComment:t=>ri.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>ri.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,r,n,s){const o=i?i.previousSibling:e.lastChild;if(n&&(n===s||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),i),!(n===s||!(n=n.nextSibling)););else{id.innerHTML=td(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=id.content;if(r==="svg"||r==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}e.insertBefore(a,i)}return[o?o.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}},Nb=Symbol("_vtc");function Mb(t,e,i){const r=t[Nb];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}const rd=Symbol("_vod"),Db=Symbol("_vsh"),jb=Symbol(""),Ub=/(?:^|;)\s*display\s*:/;function Fb(t,e,i){const r=t.style,n=Ae(i);let s=!1;if(i&&!n){if(e)if(Ae(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();i[a]==null&&Xn(r,a,"")}else for(const o in e)i[o]==null&&Xn(r,o,"");for(const o in i)o==="display"&&(s=!0),Xn(r,o,i[o])}else if(n){if(e!==i){const o=r[jb];o&&(i+=";"+o),r.cssText=i,s=Ub.test(i)}}else e&&t.removeAttribute("style");rd in t&&(t[rd]=s?r.display:"",t[Db]&&(r.display="none"))}const nd=/\s*!important$/;function Xn(t,e,i){if(J(i))i.forEach(r=>Xn(t,e,r));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const r=qb(t,e);nd.test(i)?t.setProperty(ci(r),i.replace(nd,""),"important"):t[r]=i}}const sd=["Webkit","Moz","ms"],ua={};function qb(t,e){const i=ua[e];if(i)return i;let r=Yt(e);if(r!=="filter"&&r in t)return ua[e]=r;r=Ac(r);for(let n=0;n<sd.length;n++){const s=sd[n]+r;if(s in t)return ua[e]=s}return e}const od="http://www.w3.org/1999/xlink";function ad(t,e,i,r,n,s=Bm(e)){r&&e.startsWith("xlink:")?i==null?t.removeAttributeNS(od,e.slice(6,e.length)):t.setAttributeNS(od,e,i):i==null||s&&!Oc(i)?t.removeAttribute(e):t.setAttribute(e,s?"":Qt(i)?String(i):i)}function ld(t,e,i,r,n){if(e==="innerHTML"||e==="textContent"){i!=null&&(t[e]=e==="innerHTML"?td(i):i);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,c=i==null?t.type==="checkbox"?"on":"":String(i);(a!==c||!("_value"in t))&&(t.value=c),i==null&&t.removeAttribute(e),t._value=i;return}let o=!1;if(i===""||i==null){const a=typeof t[e];a==="boolean"?i=Oc(i):i==null&&a==="string"?(i="",o=!0):a==="number"&&(i=0,o=!0)}try{t[e]=i}catch{}o&&t.removeAttribute(n||e)}function er(t,e,i,r){t.addEventListener(e,i,r)}function Bb(t,e,i,r){t.removeEventListener(e,i,r)}const cd=Symbol("_vei");function Hb(t,e,i,r,n=null){const s=t[cd]||(t[cd]={}),o=s[e];if(r&&o)o.value=r;else{const[a,c]=zb(e);if(r){const l=s[e]=Vb(r,n);er(t,a,l,c)}else o&&(Bb(t,a,o,c),s[e]=void 0)}}const ud=/(?:Once|Passive|Capture)$/;function zb(t){let e;if(ud.test(t)){e={};let r;for(;r=t.match(ud);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):ci(t.slice(2)),e]}let da=0;const Wb=Promise.resolve(),Kb=()=>da||(Wb.then(()=>da=0),da=Date.now());function Vb(t,e){const i=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=i.attached)return;jt(Gb(r,i.value),e,5,[r])};return i.value=t,i.attached=Kb(),i}function Gb(t,e){if(J(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(r=>n=>!n._stopped&&r&&r(n))}else return e}const dd=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Qb=(t,e,i,r,n,s)=>{const o=n==="svg";e==="class"?Mb(t,r,o):e==="style"?Fb(t,i,r):En(e)?_o(e)||Hb(t,e,i,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Yb(t,e,r,o))?(ld(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&ad(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Ae(r))?ld(t,Yt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),ad(t,e,r,o))};function Yb(t,e,i,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&dd(e)&&Z(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 n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return dd(e)&&Ae(i)?!1:e in t}const fd=t=>{const e=t.props["onUpdate:modelValue"]||!1;return J(e)?i=>Cn(e,i):e};function Xb(t){t.target.composing=!0}function hd(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const fa=Symbol("_assign");function pd(t,e,i){return e&&(t=t.trim()),i&&(t=Eo(t)),t}const gd={created(t,{modifiers:{lazy:e,trim:i,number:r}},n){t[fa]=fd(n);const s=r||n.props&&n.props.type==="number";er(t,e?"change":"input",o=>{o.target.composing||t[fa](pd(t.value,i,s))}),(i||s)&&er(t,"change",()=>{t.value=pd(t.value,i,s)}),e||(er(t,"compositionstart",Xb),er(t,"compositionend",hd),er(t,"change",hd))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:i,modifiers:{lazy:r,trim:n,number:s}},o){if(t[fa]=fd(o),t.composing)return;const a=(s||t.type==="number")&&!/^0\d/.test(t.value)?Eo(t.value):t.value,c=e??"";a!==c&&(document.activeElement===t&&t.type!=="range"&&(r&&e===i||n&&t.value.trim()===c)||(t.value=c))}},Jb=Fe({patchProp:Qb},Lb);let md;function Zb(){return md||(md=fb(Jb))}const ev=((...t)=>{const e=Zb().createApp(...t),{mount:i}=e;return e.mount=r=>{const n=iv(r);if(!n)return;const s=e._component;!Z(s)&&!s.render&&!s.template&&(s.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=i(n,!1,tv(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function tv(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function iv(t){return Ae(t)?document.querySelector(t):t}const rv=1;var Jn;(t=>{t.PackageLoader=new A(A.object({kind:A.union(["autoload","module","umd","styles"]).required().default("autoload"),entry:A.string(),styles:A.array(A.string()),main_export:A.string()})),t.Package=new A(A.object({id:A.string().required(),name:A.string().required(),version:A.string().required(),description:A.string(),author:A.string(),license:A.string(),loader:t.PackageLoader.required()})),t.RegistryMaintainer=new A(A.object({name:A.string().required(),email:A.string()})),t.RegistryRepository=new A(A.object({type:A.string().required(),url:A.string().required()})),t.Registry=new A(A.object({manifest_version:A.number().min(rv).required(),name:A.string().required(),base_url:A.string().required(),homepage:A.string(),maintainers:A.array(t.RegistryMaintainer),repository:t.RegistryRepository,packages:A.array(t.Package).required()}))})(Jn||(Jn={}));const ha=Symbol("IPEInjectKey"),nv=(t,e)=>(e?e.provide(ha,t):du(ha,t),t),pa=()=>{const t=Or(ha);if(!t)throw new Error("InPageEdit instance is not provided");return t},yd=(t,...e)=>{const i=ev(...e);return nv(t,i),i};var sv=Object.create,ga=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,bd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vd=t=>{throw TypeError(t)},av=(t,e,i)=>e in t?ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,lv=(t,e)=>ga(t,"name",{value:e,configurable:!0}),cv=t=>[,,,sv(t?.[bd("metadata")]??null)],uv=["class","method","getter","setter","accessor","field","value","get","set"],wd=t=>t!==void 0&&typeof t!="function"?vd("Function expected"):t,dv=(t,e,i,r,n)=>({kind:uv[t],name:e,metadata:r,addInitializer:s=>i._?vd("Already initialized"):n.push(wd(s||null))}),fv=(t,e)=>av(e,bd("metadata"),t[3]),hv=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},pv=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&ov(n,i));lv(n,i);for(var h=r.length-1;h>=0;h--)c=dv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,wd(o)&&(n=o);return fv(t,n),p&&ga(n,i,p),u?l^4?s:p:n},_d,ma,xd;const kd=t=>{if(!t)return null;try{return t.split(".").reduce((e,i)=>e==null?e:e[i],globalThis)}catch{return null}},Sd=(t,e,i)=>{if(/^https?:\/\//i.test(t))return t;const r=o=>o.endsWith("/")?o:o+"/";if(/^https?:\/\//i.test(e)){const o=r(e);return new URL(t,o).href}const n=(()=>{try{return new URL(i).href}catch{return new URL(i,location.origin).href}})(),s=new URL(r(e),n).href;return new URL(t,s).href};_d=[xe(["storage","preferences","resourceLoader","$"])];let Zn=(Pt=class extends(xd=Ue){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(Pt.REGISTRY_INFO_STORAGE_NAME,Pt.REGISTRY_INFO_CACHE_TTL,1,"indexedDB")}async start(){this._installUserPlugins(),this._checkAprilFool(),this._injectPreferenceUI()}async _checkAprilFool(){const e=new Date;if(e.getMonth()!==3||e.getDate()!==1)return;const i=e.getFullYear(),r=`april-fool-auto-installed-${i}`;if(localStorage.getItem(r))return;localStorage.setItem(r,"1");const n=xt.PLUGIN_REGISTRY_URL,s=`april-fool-${i}`;try{if(!(await this.getRegistryInfo(n)).packages?.find(c=>c.id===s))return;this.logger.info(`🎉 April Fool! Auto-installing ${s}`),this.install(n,s,"online_manifest","new-added")}catch{}}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 yd(e,Ly(()=>Promise.resolve().then(()=>r0)))}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:r})=>{const n=f("div",{id:"ipe-plugin-store-preferences-vue"}),s=await this._createManagementApp();return s.mount(n),r(()=>{s.unmount(),this.ctx.logger.debug("Plugin Store preferences app unmounted")}),f("section",{children:n})}}),e.preferences.registerCustomConfig("plugin-store",A.object({"pluginStore.registries":A.array(A.string()).default([xt.PLUGIN_REGISTRY_URL]).description(i`Registry URLs`).hidden(),"pluginStore.cdnForNpm":A.string().description(i`CDN to install packages from npm`).default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? "@" + version : "" }}').hidden(),"pluginStore.plugins":A.array(A.object({source:A.union(["online_manifest","npm"]).default("online_manifest"),registry:A.string().required(),id:A.string().required()})).description(i`Installed plugins`).default([]).hidden()}),"plugin-store")}async showModal(){const e=this.ctx.modal.show({title:$`Plugin Store`,sizeClass:"small"}),i=f("section",{id:"ipe-plugin-store-vue"});e.setContent(i);const r=await this._createManagementApp();return r.mount(i),e.on(e.Event.Close,()=>{r.unmount()}),e}async install(e,i,r="online_manifest",n="new-added"){const s=await this.getRegistryInfo(e,r);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 c=await a;return c&&this.ctx.emit("plugin-store/plugin-installed",{ctx:this.ctx,registry:s,id:i,by:n}),c}async uninstall(e,i){const r=this._installedPlugins.get(`${e}#${i}`);if(r===void 0)return!0;this._installedPlugins.delete(`${e}#${i}`);const n=await r;if(n){const s=n.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 r=await this.ctx.preferences.get("pluginStore.plugins")||[];return r.some(s=>s.registry===e&&s.id===i)||(r.push({registry:e,id:i}),await this.ctx.preferences.set("pluginStore.plugins",r)),!0}async removeFromPreferences(e,i){let r=await this.ctx.preferences.get("pluginStore.plugins")||[];return r=r.filter(n=>n.registry!==e||n.id!==i),await this.ctx.preferences.set("pluginStore.plugins",r),!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,r){const n=i.base_url,s=i.packages.find(h=>h.id===r);if(!s)return this.ctx.logger.warn(`Package ${r} not found in registry ${e}`),null;const o=s.loader,{kind:a,entry:c="index.js",styles:l=[],main_export:u=null}=o;let d=null;if(a!=="styles"){if(!c)return this.ctx.logger.warn(`Entry url missing for ${r}`,o),null;try{d=Sd(c,n,e)}catch(h){return this.ctx.logger.warn(`Failed to resolve entry "${c}" with base "${n}" and registry "${e}"`,h),null}}const m={"data-plugin-registry":e,"data-plugin-id":r};let p=null;switch(a){case"autoload":{p=this.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${r}`,apply:h=>{d&&h.resourceLoader.loadScript(d,{...m})}});break}case"module":{if(!d)return this.ctx.logger.warn(`Entry url missing for module kind, package ${r}`),null;const h=await import(d).then(_=>(u?_[u]:_.default)??_);if(!h)return this.ctx.logger.warn(`Main export ${u} not found in module ${d}`),null;p=this.ctx.plugin(h);break}case"umd":{let h=kd(u);if(!h){if(!d)return this.ctx.logger.warn(`Entry url missing for umd kind, package ${r}`),null;await this.ctx.resourceLoader.loadScript(d,{...m}),h=kd(u)}if(!h)return this.ctx.logger.warn(`Main export ${u} not found on globalThis after loading ${d}`),null;p=this.ctx.plugin(h);break}}if(l&&l.length>0){let h=[];try{h=l.map(_=>Sd(_,n,e)).filter(Boolean)}catch(_){this.ctx.logger.warn(`Failed to resolve styles for ${r}`,l,_)}p||(p=this.ctx.plugin({name:`plugin-store-${e}-${r}`,apply(){}})),p.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${r}-styles`,apply:_=>{h.forEach(k=>_.resourceLoader.loadStyle(k,{...m})),_.on("dispose",()=>{try{h.forEach(k=>_.resourceLoader.removeStyle(k))}catch{}})}})}return p}validateRegistry(e){return Jn.Registry(e)}async getRegistryInfo(e,i="online_manifest",r=!1){try{let s;if(i==="online_manifest")s=await this._fetchOnlineRegistryInfo(e,r),this.logger.debug("Fetched registry info from online manifest",s),this.setRegistryCache(e,s);else throw new Error(`Unsupported registry source: ${i}`);return s}catch(s){this.ctx.logger.warn("Failed to fetch registry info",s)}const n=await this.getRegistryCache(e);if(!n)throw this.ctx.emit("plugin-store/registry-not-found",{ctx:this.ctx,registryUrl:e}),new Error(`Failed to fetch registry info: ${e}`);return n}async _fetchOnlineRegistryInfo(e,i=!1){if(!i&&this._onlineRegistryQueries.has(e))return await this._onlineRegistryQueries.get(e);const n=(async()=>{const s={method:"GET"};i&&(s.cache="no-store");const a=await(await fetch(e,s)).json(),c=this.validateRegistry(a);return this.ctx.emit("plugin-store/registry-fetched",{ctx:this.ctx,registry:c}),c})();return this._onlineRegistryQueries.set(e,n),await n}async getRegistryCache(e){const i=await this.regInfoDB.get(e);if(i)try{return this.validateRegistry(i)}catch(r){this.ctx.logger.warn("Invalid cached registry",r,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(n=>this.refreshRegistryCache(n))),r={};for(const[n,s]of i.entries())s.status==="fulfilled"?r[e[n]]=s.value:r[e[n]]=null;return r}},Pt.PluginStoreSchemas=Jn,Pt.REGISTRY_INFO_CACHE_TTL=1e3*60*60*24,Pt.REGISTRY_INFO_STORAGE_NAME="plugin-store-registry",Pt.REGISTRY_ETAG_STORAGE_NAME="psreg-etag",Pt);ma=cv(xd),Zn=pv(ma,0,"PluginPluginStore",_d,Zn),hv(ma,1,Zn);const gv=Object.freeze(Object.defineProperty({__proto__:null,PluginPluginStore:Zn},Symbol.toStringTag,{value:"Module"})),ct='@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;color:var(--schema-color-fg)}.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}.keyshortcut-wrap{display:flex;gap:.5em;align-items:center}.keyshortcut-btn{padding:6px 8px;font-size:1em}.keyshortcut-btn.recording{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent;animation:keyshortcut-pulse .5s ease-in-out infinite}@keyframes keyshortcut-pulse{0%,to{opacity:1}50%{opacity:.6}}',Ed={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Se=(t,e)=>{customElements.get(t)||customElements.define(t,e)},mv=(t,e,i)=>{if(!e.length)return;let r=t,n=null,s=null;for(let a=0;a<e.length-1;a++){const c=e[a];let l=r?.[c];l==null?(l=typeof e[a+1]=="number"?[]:{},r[c]=l):typeof l!="object"&&(l=typeof e[a+1]=="number"?[]:{},r[c]=l),n=r,s=c,r=l}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(n)n[s]=a,r=a;else return}try{r[o]=i}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=i,n&&(n[s]=a)}catch{}}},Hr=t=>t.map(String).join("."),yv=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),pi=t=>`schema_${yv(Hr(t)||"root")}`,Ci=t=>Hr(t),ne=(t,...e)=>{const i=new Set(e);i.size&&t.setAttribute("part",Array.from(i).join(" "))},bv=["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 ya(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}default:return e}}function $d(t){return typeof t=="function"&&!!t?.type}function Pd(t){if(!t)throw new Error("schema is required");if($d(t))return t;try{const e=Schema.from(t);if($d(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 mt(t){return t?.meta??{}}function vv(t){return t.length>0&&t.every(e=>e?.type==="const")}function Ii(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const r=e.type;try{const n=t();if(n!==void 0)return n}catch{}switch(r){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 n=e.list||[];return n.length?Ii(n[0]):void 0}case"const":return e.value;case"date":return;case"intersect":{const n=e.list||[],s=(a,c)=>{if(Array.isArray(a)&&Array.isArray(c))return c.slice();if(a&&c&&typeof a=="object"&&typeof c=="object"){const l={...a};for(const u of Object.keys(c))l[u]=u in l?s(l[u],c[u]):c[u];return l}return c??a};let o={};for(const a of n)o=s(o,Ii(a));return o}default:return}}class $t extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Ed,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ct,this.$root.appendChild(e)}makeFieldContainer(e,i){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Hr(this._path)),ne(r,"field",`field-${e}`),this._label){const n=document.createElement("label");n.className="label",n.textContent=this._label,ne(n,"field-label"),r.appendChild(n)}if(i&&i!==this._label){const n=document.createElement("div");n.className="helper",n.textContent=i,ne(n,"field-helper"),r.appendChild(n)}return r}set schema(e){this._schema=Pd(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}}))}}const Oi=class Oi extends $t{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>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",ne(r,"field-input","field-input-text"),r.type="text",r.name=Ci(this._path),r.id=pi(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(ya("string",r.value));const n=i.querySelector("label.label");if(n&&(n.htmlFor=r.id),e.role==="keyshortcut"){const s=document.createElement("div");s.className="keyshortcut-wrap";const o=document.createElement("button");o.type="button",o.className="btn keyshortcut-btn",o.title="Record shortcut",o.textContent="⌨";let a=null;const c=()=>{a&&(a(),a=null,o.classList.remove("recording"),o.title="Record shortcut",Oi.recEnd===c&&(Oi.recEnd=null))};o.onclick=()=>{if(a){c();return}Oi.recEnd?.(),Oi.recEnd=c,o.classList.add("recording"),o.title="Press your keys! (Esc to cancel)";const l=u=>{if(u.preventDefault(),u.stopPropagation(),u.key==="Escape"){c();return}const d=[];u.ctrlKey&&d.push("ctrl"),u.metaKey&&d.push("meta"),u.altKey&&d.push("alt"),u.shiftKey&&d.push("shift");const m=u.key.toLowerCase();if(["control","meta","alt","shift"].includes(m))return;d.push(m);const p=d.join("-"),h=r.value.trimEnd();h.toLowerCase().split(/\s*,\s*/).includes(p)||(r.value=h?h.replace(/,+$/,"")+", "+p:p,this.emitChange(r.value)),c()};document.addEventListener("keydown",l,{capture:!0}),a=()=>document.removeEventListener("keydown",l,{capture:!0})},s.appendChild(r),s.appendChild(o),i.appendChild(s)}else i.appendChild(r);this.$root.appendChild(i)}};Oi.recEnd=null;let es=Oi;Se("schema-form-string",es);class Cd extends $t{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>${ct}</style>`;const e=this._schema?.type??"number",i=mt(this._schema),r=this.makeFieldContainer("number",i.description),n=document.createElement("input");this.$input=n,n.className="input",ne(n,"field-input","field-input-number"),n.name=Ci(this._path),n.id=pi(this._path),i?.min!=null&&(n.min=String(i.min)),i?.max!=null&&(n.max=String(i.max)),i?.step!=null&&(n.step=String(i.step)),e==="percent"&&!n.step&&(n.step="0.01"),n.value=this._value??"",n.oninput=()=>this.emitChange(ya(e,n.value));const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),i.role==="slider"?n.type="range":n.type="number",r.appendChild(n),this.$root.appendChild(r)}}Se("schema-form-number",Cd);class Id extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox",ne(r,"field-checkbox");const n=document.createElement("input");n.type="checkbox",n.checked=!!this._value,n.name=Ci(this._path),n.id=pi(this._path),ne(n,"field-input","field-input-checkbox");const s=document.createElement("span");s.textContent=e.description??this._label??"",ne(s,"field-checkbox-text"),n.onchange=()=>this.emitChange(n.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=n.id),r.append(n,s),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-boolean",Id);function ts(t){return String(t).padStart(2,"0")}function zr(t){return`${t.getFullYear()}-${ts(t.getMonth()+1)}-${ts(t.getDate())}`}function ba(t){return`${ts(t.getHours())}:${ts(t.getMinutes())}`}function is(t){return`${zr(t)}T${ba(t)}`}class Ad extends $t{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=mt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)a==="date"?this.$input.value=zr(this._value):a==="time"?this.$input.value=ba(this._value):a==="datetime"&&(this.$input.value=is(this._value));else if(typeof this._value=="string"&&a!=="time"){const c=new Date(this._value);isNaN(+c)||(a==="date"?this.$input.value=zr(c):a==="datetime"&&(this.$input.value=is(c)))}else this._value||(this.$input.value="");return}}this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input",ne(r,"field-input","field-input-date");const n=e.role||"date";if(n==="datetime"?r.type="datetime-local":n==="time"?r.type="time":r.type="date",r.name=Ci(this._path),r.id=pi(this._path),this._value instanceof Date)n==="date"?r.value=zr(this._value):n==="time"?r.value=ba(this._value):n==="datetime"&&(r.value=is(this._value));else if(typeof this._value=="string"&&n!=="time"){const o=new Date(this._value);isNaN(+o)||(n==="date"?r.value=zr(o):n==="datetime"&&(r.value=is(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-date",Ad);class va extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(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),ne(o,"field-const-value"),this.$root.appendChild(o);return}}const r=this.makeFieldContainer("const",e.description),n=document.createElement("section");n.className="const content",n.textContent=String(i),n.id=pi(this._path),ne(n,"field-const-value");const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),r.appendChild(n),this.$root.appendChild(r)}}Se("schema-form-const",va);class Rd extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("intersect",e.description);i.classList.remove("field");const r=document.createElement("div");r.classList.add("group"),ne(r,"field-group");const n=this._schema.list||[],s=n.length>0&&n.every(a=>a?.type==="object"),o=(a,c)=>{if(Array.isArray(a)&&Array.isArray(c))return c.slice();if(a&&c&&typeof a=="object"&&typeof c=="object"){const l={...a};for(const u of Object.keys(c))l[u]=u in l?o(l[u],c[u]):c[u];return l}return c??a};if(s){const a=this._value&&typeof this._value=="object"?this._value:{};n.forEach((c,l)=>{const u=c?.meta?.description??"",d=gi(c,this._path,a,u,this._i18n);d.addEventListener("change",m=>{m.stopPropagation();const p=o(this._value??{},m.detail.value);this.emitChange(p)}),r.appendChild(d)})}else{const a=n[n.length-1],c=gi(a,this._path,this._value,this._label,this._i18n);c.addEventListener("change",l=>{l.stopPropagation(),this.emitChange(l.detail.value)}),r.appendChild(c)}i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-intersect",Rd);function wv(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 gi(t,e,i,r,n){const s=wv(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,n&&(o.i18n=n),o.setValue?.(i),o.setAttribute("exportparts",bv),o}class Td extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(vv(r)){const n=document.createElement("select");n.className="input",ne(n,"field-input","field-input-select"),n.name=Ci(this._path),n.id=pi(this._path),r.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),n.appendChild(a)}),n.onchange=()=>this.emitChange(ya("string",n.value));const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n)}else{const n=document.createElement("div");n.className="toolbar",ne(n,"field-toolbar");const s=document.createElement("select");s.className="input",ne(s,"field-input","field-input-select","field-toolbar-select"),s.name=Ci(this._path)+".__type",s.id=pi(this._path)+"__type";let o=0;r.forEach((u,d)=>{const m=document.createElement("option");m.value=String(d),m.textContent=String(u.meta?.description||u.value||u.type),s.appendChild(m)}),s.onchange=()=>{o=Number(s.value);const u=r[o],d=Ii(u);this.emitChange(d),l()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),n.appendChild(s),i.appendChild(n);const c=document.createElement("div");c.className="group",ne(c,"field-group");const l=()=>{c.innerHTML="";const u=r[o],d=gi(u,this._path,this._value,this._label);d instanceof va||(d.addEventListener("change",m=>{m.stopPropagation(),this.emitChange(m.detail.value)}),c.appendChild(d))};l(),i.appendChild(c)}this.$root.appendChild(i)}}Se("schema-form-union",Td);class Od extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=gi(s,[...this._path,o],n[o],`${this._label??""}[${o}]`);a.addEventListener("change",c=>{c.stopPropagation();const l=Array.isArray(this._value)?this._value.slice():[];l[o]=c.detail.value,this.emitChange(l)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-tuple",Od);class Ld extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.dict||{};Object.keys(n).forEach(s=>{if(n[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=gi(n[s],[...this._path,s],o,s);a.addEventListener("change",c=>{c.stopPropagation();const l={...this._value??{}};l[s]=c.detail.value,this.emitChange(l)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-object",Ld);const ws=class ws extends $t{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+ws._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(r=>{const n=r.dataset.uid;n&&(i[n]=r.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(r=>{const n=r.dataset.uid;if(!n)return;const s=i[n];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,c=s.top-o.top;(a||c)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${c}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(l,u)=>{r.innerHTML="",s().forEach((d,m)=>{const p=[...this._path,m],h=document.createElement("div");h.className="row schema-collection-row",ne(h,"field-row","collection-row");const _=this._itemIds[m];h.dataset.uid=_,h.setAttribute("data-path",Hr(p));const k=gi(n,p,d,`${this._label??""}[${m}]`);k.addEventListener("change",w=>{w.stopPropagation();const S=s().slice();S[m]=w.detail.value,this._value=S,this.emitChange(S)});const P=document.createElement("div");P.className="actions",ne(P,"field-actions");const b=document.createElement("button");b.type="button",b.className="btn",ne(b,"field-button","field-button-secondary"),b.textContent=this._i18n.arrayMoveUp??"↑",b.onclick=()=>{if(m<=0)return;const w=this.capturePositions(r),S=s().slice();[S[m-1],S[m]]=[S[m],S[m-1]],[this._itemIds[m-1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m-1]],this._value=S,o(w),this.emitChange(S)};const y=document.createElement("button");y.type="button",y.className="btn",ne(y,"field-button","field-button-secondary"),y.textContent=this._i18n.arrayMoveDown??"↓",y.onclick=()=>{const w=s();if(m>=w.length-1)return;const S=this.capturePositions(r),I=w.slice();[I[m+1],I[m]]=[I[m],I[m+1]],[this._itemIds[m+1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m+1]],this._value=I,o(S),this.emitChange(I)};const g=document.createElement("button");g.type="button",g.className="btn danger",ne(g,"field-button","field-button-danger"),g.textContent=this._i18n.arrayRemove??"×",g.onclick=()=>{h.classList.add("leaving");const w=250;let S=!1;const I=()=>{if(S)return;S=!0,clearTimeout(F);const N=s().filter((K,qe)=>qe!==m);this._itemIds.splice(m,1);const G=this.capturePositions(r);this._value=N,o(G),this.emitChange(N)};h.addEventListener("transitionend",I,{once:!0});const F=setTimeout(I,w+80)},P.append(b,y,g),h.appendChild(k),h.appendChild(P),r.appendChild(h),u&&u===_&&(h.classList.add("enter"),requestAnimationFrame(()=>{h.classList.add("enter-active")}),requestAnimationFrame(()=>{h.classList.remove("enter")}))}),l&&this.playFLIP(r,l)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",ne(a,"field-button","field-button-primary"),a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const l=this.capturePositions(r),u=s().slice(),d=Ii(n);u.push(d);const m=this.generateItemId();this._itemIds.push(m),this._value=u,o(l,m),this.emitChange(u)};const c=document.createElement("div");c.className="actions",ne(c,"field-actions"),c.appendChild(a),i.appendChild(r),i.appendChild(c),this.$root.appendChild(i)}};ws._idCounter=0;let rs=ws;Se("schema-form-array",rs);class Nd extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.inner,s=this._value??{},o=m=>`d_${m}`,a=()=>{const m={};return r.querySelectorAll(".kv").forEach(p=>{const h=p.dataset.uid;h&&(m[h]=p.getBoundingClientRect())}),m},c=m=>{r.querySelectorAll(".kv").forEach(p=>{const h=p.dataset.uid;if(!h)return;const _=m[h];if(!_)return;const k=p.getBoundingClientRect(),P=_.left-k.left,b=_.top-k.top;(P||b)&&(p.style.transition="none",p.style.transform=`translate(${P}px, ${b}px)`,requestAnimationFrame(()=>{p.style.transition="transform .25s ease",p.style.transform=""}))})},l=(m,p)=>{r.innerHTML="",Object.keys(s).forEach(h=>{const _=[...this._path,h],k=document.createElement("div");k.className="kv schema-collection-row",ne(k,"field-row","collection-row"),k.dataset.uid=o(h),k.setAttribute("data-path",Hr(_));const P=document.createElement("input");P.className="input",ne(P,"field-input","field-input-text"),P.value=h,P.name=Ci(_)+".__key",P.id=pi(_)+"__key";const b=gi(n,_,s[h],`${this._label??""}[${h}]`),y=document.createElement("button");y.type="button",y.className="btn danger",ne(y,"field-button","field-button-danger"),y.textContent=this._i18n.dictRemove??"×",y.onclick=()=>{const g=a();delete s[h];const w={...this._value??{}};delete w[h],this._value=w,l(g),this.emitChange(w)},P.onchange=()=>{const g=P.value.trim();if(!g||g===h||s[g]!==void 0)return;const w=a();s[g]=s[h],delete s[h];const S={...this._value??{}};S[g]=S[h],delete S[h],this._value=S,l(w),this.emitChange(S)},b.addEventListener("change",g=>{g.stopPropagation();const w={...this._value??{}};w[h]=g.detail.value,this._value=w,this.emitChange(w)}),k.append(P,b,y),r.appendChild(k),p===h&&(k.classList.add("enter"),requestAnimationFrame(()=>k.classList.add("enter-active")),requestAnimationFrame(()=>k.classList.remove("enter")))}),m&&c(m)};l();const u=document.createElement("button");u.type="button",u.className="btn primary",ne(u,"field-button","field-button-primary"),u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let m=Object.keys(s).length+1,p=`k${m}`;for(;s[p]!==void 0;)p=`k${++m}`;const h=a();s[p]=Ii(n);const _={...this._value??{},[p]:s[p]};this._value=_,l(h,p),this.emitChange(_)};const d=document.createElement("div");d.className="actions",ne(d,"field-actions"),d.appendChild(u),i.appendChild(r),i.appendChild(d),this.$root.appendChild(i)}}Se("schema-form-dict",Nd);class Md extends HTMLElement{constructor(){super(),this._i18n={...Ed},this._i18nCommitted=!1,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ct,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",ne(i,"wrapper");const r=document.createElement("form");r.className="form",ne(r,"form"),i.appendChild(r),this.$root.appendChild(i),this.addEventListener("change",n=>{if(!n?.detail)return;const{path:s,value:o}=n.detail;Array.isArray(s)&&s.length===0?this._state=o:mv(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=Pd(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Ii(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 r=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=r,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=Ii(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=gi(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}Se("schema-form",Md);function _v(){Se("schema-form",Md),Se("schema-form-string",es),Se("schema-form-number",Cd),Se("schema-form-boolean",Id),Se("schema-form-date",Ad),Se("schema-form-const",va),Se("schema-form-union",Td),Se("schema-form-tuple",Od),Se("schema-form-object",Ld),Se("schema-form-array",rs),Se("schema-form-dict",Nd),Se("schema-form-intersect",Rd)}const xv=$i({__name:"SchemasteryFormVue",props:vu({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:vu(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const r=$u(t,"schema"),n=$u(t,"value"),s=i,o=hu("elRef");let a=!1,c=!1;const l=u=>{if(c)return;const d=o.value,m=t.validateOnChange?d.getData({validate:!0}):u.detail.state;a=!0,n.value=m,Ar(()=>{a=!1}),s("change",u.detail)};return yu(()=>{_v()}),Nr(()=>{const u=o.value;r.value&&(u.schema=r.value),n.value!==void 0&&u.setData(n.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",l)}),Vo(()=>{o.value?.removeEventListener("form-change",l)}),Qi(r,u=>{a||o.value&&u&&o.value.schema!==u&&(c=!0,o.value.schema=u,Ar(()=>{c=!1}))},{deep:!0,immediate:!0}),Qi(n,u=>{if(a||!o.value||u===void 0)return;const d=o.value.getData({validate:!1});JSON.stringify(d)!==JSON.stringify(u)&&(c=!0,o.value.setData(u,{validate:!1}),Ar(()=>{c=!1}))},{deep:!0,immediate:!0}),e({setData(u,d){const m=o.value;m.setData(u,{validate:!!d?.validate}),d?.emit&&(n.value=m.getData({validate:!!d?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,d=!0){o.value.schema=u,d&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,d)=>(de(),ve("schema-form",Gu({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function Ai(t,e=new WeakMap){if(De(t))return Ai(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 n=new Map;return e.set(t,n),Array.from(t.entries()).forEach(([s,o])=>{n.set(s,Ai(o,e))}),n}if(t instanceof Set){const n=new Set;return e.set(t,n),Array.from(t).forEach(s=>{n.add(Ai(s,e))}),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(const s of t)n.push(Ai(s,e));return n}const i=oe(t),r={};e.set(t,r);for(const n of Object.keys(i))r[n]=Ai(i[n],e);for(const n of Object.getOwnPropertySymbols(i))r[n]=Ai(i[n],e);return r}const wa=()=>{},kv={id:"preferences-ui-app"},Sv={class:"tabbar"},Ev={class:"tabbar-tabs"},$v=["onClick","data-value"],Pv={class:"tabbar-content"},Cv={key:0},Iv={style:{"max-height":"20em",overflow:"auto"}},Av=$i({__name:"PreferencesApp",setup(t,{expose:e}){const i=pa(),r=!1,n=eu([]),s=Qe([]),o=Qe(""),a=Bt(()=>s.value.find(h=>h.name===o.value)||null),c=Bt(()=>{const h=n.value.filter(_=>_.category===o.value).map(_=>_.schema);return h.length===0?null:A.intersect(h)}),l=Bt(()=>a.value&&typeof a.value.autoGenerateForm=="boolean"?a.value.autoGenerateForm:!0),u=Qe({});e({getValue(){return Ai(u)},mergeValue(h){u.value={...u.value,...h}},selectTab(h){o.value=h}}),Nr(async()=>{i.inject(["preferences"],async h=>{const _=await h.preferences.getAll();u.value=_,s.value=h.preferences.getConfigCategories(),n.value=h.preferences.getConfigRegistries(),o.value=s.value[0].name})});const d=(h,_)=>{h.preventDefault(),o.value=_;const k=h.currentTarget;k&&k.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},m=hu("customRenderContainerRef"),p=Qe([]);return Go(()=>{p.value.forEach(h=>h()),p.value=[]}),Qi(a,async h=>{p.value.forEach(k=>k()),p.value=[],await Ar();const _=m.value;if(_&&(_.innerText="",h&&typeof h.customRenderer=="function")){let k=wa;const P=g=>{k=g},b=g=>{p.value.push(g)},y=await h.customRenderer({ctx:i,onMounted:P,onUnmount:b});y&&(_.appendChild(y),k?.(_))}},{immediate:!0,deep:!1}),(h,_)=>(de(),ve("div",kv,[ie("div",Sv,[ie("div",Ev,[(de(!0),ve(We,null,Qo(s.value,k=>(de(),ve("a",{class:kt(["tab",{active:o.value===k.name}]),key:k.name,onClick:P=>d(P,k.name),"data-value":k.name},ye(k.label),11,$v))),128))]),ie("div",Pv,[a.value&&a.value.customRenderer?(de(),ve("div",{class:"custom-render-container",ref_key:"customRenderContainerRef",ref:m,key:o.value})):fi("",!0),l.value&&c.value?(de(),Vn(Oe(xv),{class:"auto-schema-form",key:o.value,"data-category":o.value,schema:c.value,value:u.value,"onUpdate:value":_[0]||(_[0]=k=>u.value={...u.value,...k}),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["data-category","schema","value"])):fi("",!0)])]),Oe(r)?(de(),ve("details",Cv,[ie("pre",Iv,ye(u.value),1)])):fi("",!0)]))}}),ns=(t,e)=>{const i=t.__vccOpts||t;for(const[r,n]of e)i[r]=n;return i},Rv=ns(Av,[["__scopeId","data-v-775e2739"]]);var Tv=Object.create,_a=Object.defineProperty,Ov=Object.getOwnPropertyDescriptor,Dd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),jd=t=>{throw TypeError(t)},Lv=(t,e,i)=>e in t?_a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Nv=(t,e)=>_a(t,"name",{value:e,configurable:!0}),Mv=t=>[,,,Tv(t?.[Dd("metadata")]??null)],Dv=["class","method","getter","setter","accessor","field","value","get","set"],Ud=t=>t!==void 0&&typeof t!="function"?jd("Function expected"):t,jv=(t,e,i,r,n)=>({kind:Dv[t],name:e,metadata:r,addInitializer:s=>i._?jd("Already initialized"):n.push(Ud(s||null))}),Uv=(t,e)=>Lv(e,Dd("metadata"),t[3]),Fv=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},qv=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Ov(n,i));Nv(n,i);for(var h=r.length-1;h>=0;h--)c=jv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Ud(o)&&(n=o);return Uv(t,n),p&&_a(n,i,p),u?l^4?s:p:n},Fd,xa,qd;Fd=[xe(["preferences","modal","$","$$"])];class ss extends(qd=Ue){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,this._modal=null,this._form=null,e.set("preferencesUI",this);const i=e.$,r=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:r`prefs.about.label`,description:r`prefs.about.description`,index:99,customRenderer:()=>f("section",{className:"theme-ipe-prose",children:[f("h2",{children:"✏️ InPageEdit NEXT"}),f("p",{children:r`prefs.about.intro`}),f("h3",{children:r`prefs.about.portals.header`}),f("ul",{children:[f("li",{children:f("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",children:r`prefs.about.portals.officialwebsite`})}),f("li",{children:f("a",{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version.split("-")[0]}`,target:"_blank",children:r`prefs.about.portals.updatelogs`})})]}),f("h3",{children:r`prefs.about.joinus.header`}),f("ul",{children:[f("li",{children:[f("strong",{children:r`prefs.about.joinus.github`}),":"," ",f("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:`${this.ctx.Endpoints.GITHUB_OWNER}/${this.ctx.Endpoints.GITHUB_REPO}`})]}),f("li",{children:[f("strong",{children:r`prefs.about.joinus.qqgroup`}),": ",this.ctx.Endpoints.QQ_GROUP_ID]})]}),f("hr",{}),f("p",{style:{textAlign:"center"},children:r`prefs.about.copyright`}),f("hr",{})]})}),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("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(()=>p0).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:f(bi,{children:f(_i,{})})});i.get$window().classList.add("dialog");const r=f("div",{id:"ipe-preferences-app",style:{minHeight:"calc(85dvh - var(--ipe-modal-spacing) * 2)"}});i.setContent(r),this.ctx.emit("preferences-ui/modal-shown",{ctx:this.ctx,modal:i});const n=this.createPreferencesUIApp(),s=n.mount(r);return this._form=s,this.ctx.emit("preferences-ui/vue-app-mounted",{ctx:this.ctx,app:n,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:f("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"),n.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 yd(this.ctx,Rv)}}xa=Mv(qd),ss=qv(xa,0,"PluginPreferencesUI",Fd,ss),Fv(xa,1,ss);const Bv=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return ss}},Symbol.toStringTag,{value:"Module"})),Hv=Symbol("@@apply"),zv=Symbol("@@ctor");function Bd(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[Hv]=i,i[zv]=t;const r=t?.constructor?.name;return r&&(i[Symbol.toStringTag]=r),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 os={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},ka=t=>{const{type:e="default",title:i,content:r,closeable:n=!0,titleProps:s,contentProps:o,children:a,...c}=t;let l=i;typeof i>"u"&&e!=="default"&&(l=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!d)return Promise.resolve();const{promise:m,resolve:p}=_r();return d.animate([{opacity:"1",height:d.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{d.remove(),p()}),m},d=f("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${os.mbox}`,...c,children:[l&&f("div",{className:`ipe-mbox-title ${os.title}`,...s,children:l}),f("div",{className:`ipe-mbox-content ${os.content}`,...o,children:a||r}),n&&f("a",{onClick:u,className:`ipe-mbox-close ${os.close}`,children:"×"})]});return d.close=u,d},as=t=>{const{label:e,id:i,name:r,value:n,placeholder:s,disabled:o,required:a,labelProps:c,inputProps:l,children:u,...d}=t;return f("div",{className:"theme-ipe ipe-input-box",...d,children:[f("label",{htmlFor:i,style:{display:"block"},...c,children:[e,a&&f(bi,{children:[" ",f("span",{className:"required",children:"*"})]})]}),u??f("input",{id:i,name:r,value:n,disabled:o,placeholder:s,required:a,style:{width:"100%"},...l})]})},Wv=t=>{const{id:e,name:i,value:r,label:n,inputProps:s,labelProps:o,children:a,...c}=t;return f("label",{className:"theme-ipe ipe-radio-box",...c,children:[f("input",{type:"radio",id:e,name:i,value:r,...s}),f("span",{className:"ipe-checkbox-box"}),f("span",{...o,children:n||a})]})},Ri=t=>{const{id:e,name:i,label:r,checked:n,inputProps:s,labelProps:o,children:a,...c}=t;return f("label",{className:"theme-ipe ipe-checkbox",...c,children:[f("input",{type:"checkbox",id:e,name:i,checked:n,...s}),f("span",{className:"ipe-checkbox-box"}),f("span",{...o,children:r||a})]})},Kv=(t=0)=>new Promise(e=>setTimeout(e,t)),Hd=t=>f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),f("path",{d:"M13.5 6.5l4 4"}),f("path",{d:"M19 16l-2 3h4l-2 3"})]});var Vv=Object.create,Sa=Object.defineProperty,Gv=Object.getOwnPropertyDescriptor,zd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wd=t=>{throw TypeError(t)},Qv=(t,e,i)=>e in t?Sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Yv=(t,e)=>Sa(t,"name",{value:e,configurable:!0}),Xv=t=>[,,,Vv(t?.[zd("metadata")]??null)],Jv=["class","method","getter","setter","accessor","field","value","get","set"],Kd=t=>t!==void 0&&typeof t!="function"?Wd("Function expected"):t,Zv=(t,e,i,r,n)=>({kind:Jv[t],name:e,metadata:r,addInitializer:s=>i._?Wd("Already initialized"):n.push(Kd(s||null))}),ew=(t,e)=>Qv(e,zd("metadata"),t[3]),tw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},iw=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Gv(n,i));Yv(n,i);for(var h=r.length-1;h>=0;h--)c=Zv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Kd(o)&&(n=o);return ew(t,n),p&&Sa(n,i,p),u?l^4?s:p:n},Vd,Ea,Gd;Vd=[xe(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences","$"]),Ot(A.object({"quickEdit.editSummary":A.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":A.boolean().description('Default to checking "minor edit" option').default(!1),"quickEdit.outSideClose":A.boolean().description("Close editor modal by clicking outside").default(!0),"quickEdit.watchList":A.union([A.const(_t.preferences).description("Follow MW preferences"),A.const(_t.nochange).description("Keep the current watchlist status"),A.const(_t.watch).description("Add the page to watchlist"),A.const(_t.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(_t.preferences),"quickEdit.keyshortcut.save":A.string().default("ctrl-s").role("keyshortcut").description("save button key shortcut (blank to disable)"),"quickEdit.editFont":A.union([A.const("preferences").description("Follow MW preferences"),A.const("monospace").description("Monospace"),A.const("sans-serif").description("Sans-serif"),A.const("serif").description("Serif"),A.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 ls=(Li=class extends(Gd=Ue){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",Bd(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),w=this.ctx.currentPage.wikiTitle;e={...e,title:w?.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 r=await this.ctx.preferences.get("quickEdit.outSideClose"),n=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(),c={...this.DEFAULT_OPTIONS,editSummary:s,editMinor:o,...e};c.editSummary||(c.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:c});const l=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:r}).init();l.setTitle(f(bi,{children:["Loading: ",f("u",{children:c.title})]})),l.setContent(f("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:f(_i,{})})),l.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:i`Cancel`,method(){l.close()}}),l.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:l,options:c});let u;try{if(u=await this.getWikiPageFromPayload(c),u.pageInfo.special)throw new Error(i`Special page is not editable.`)}catch(g){l.off(l.Event.Close),l.close(),this.ctx.modal.notify("error",{content:g instanceof Error?g.message:String(g)});return}const d=c.section==="new"?"":u.revisions[0]?.content||"",m=u.revisions[0]?.revid,p=m&&m!==u.lastrevid,h=c.section==="new",_=u.pageid===0;l.setTitle(f(bi,{children:[h?i`New Section`:i`Quick ${_?"Create":"Edit"}`,": ",f("u",{children:u.pageInfo.title}),p?` (${i`Revision`} ${m})`:""]}));const k=[];_&&k.push(f(ka,{title:i`Attention`,type:"important",children:f("p",{children:i`This page does not exist.`})})),p&&k.push(f(ka,{title:i`Attention`,type:"warning",children:f("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:c,modal:l,wikiPage:u,editNotices:k});const P=f("form",{className:"ipe-quickEdit__form",children:[f("div",{className:"ipe-quickEdit__notices",children:k}),f("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.section==="new"&&f(bi,{children:f(as,{label:i`Section title`,id:"summary",name:"summary",value:"",inputProps:{placeholder:i`Topic for new section, this will be the h2 heading`}})}),f("textarea",{className:`ipe-quickEdit__textarea ${a.className}`,style:{fontFamily:a.fontFamily},name:"text",id:"wpTextbox1",children:d})]}),f("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!h&&f(as,{label:i`Summary`,id:"summary",name:"summary",value:c.editSummary}),f("div",{className:"ipe-input-box",children:[f("label",{htmlFor:"watchlist",style:{display:"block"},children:i`Watchlist`}),f("div",{style:{display:"flex",gap:"1rem",whiteSpace:"nowrap",overflowX:"auto"},children:[_t.preferences,_t.nochange,_t.watch,_t.unwatch].map(g=>f(Wv,{name:"watchlist",value:g,inputProps:{checked:n===g,onChange:w=>{w.target&&w.target.closest("label")?.scrollIntoView({behavior:"smooth",inline:"center"})}},children:i`watchlist.${g}`},g))})]}),f("div",{style:{display:"flex",gap:"1rem"},children:[f(Ri,{name:"minor",id:"minor",checked:c.editMinor,children:i`Minor edit`}),f(Ri,{name:"reloadAfterSave",id:"reloadAfterSave",checked:c.reloadAfterSave,children:i`Reload after save`})]})]}),!1]});l.setContent(P);let b=!1;l.addButton({side:"left",className:"is-primary submit-btn",label:i`Submit`,keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:async()=>{const g=new FormData(P);l.setLoadingState(!0);try{await this.handleSubmit({wikiPage:u,text:g.get("text"),summary:g.get("summary"),minor:g.get("minor")==="on",section:c.section,watchlist:n,createonly:u.pageid===0&&!b,recreate:u.pageid===0&&b}),l.setOptions({beforeClose:wa}),l.close(),this.ctx.modal.notify("success",{title:i`Submission Successful`,content:i`Your changes have been saved.`}),g.get("reloadAfterSave")&&(await Kv(500),location.reload())}catch(w){if(l.setLoadingState(!1),Tt.is(w)&&(w.code==="pagedeleted"||w.code==="editconflict"||w.code==="articleexists")){b=!0,this.ctx.modal.notify("warning",{title:i`Submission Error`,content:f("div",{children:[f("p",{children:f("strong",{children:w.message})}),f("p",{children:i`You can try to submit again to dismiss the warnings.`})]}),closeAfter:15*1e3});return}this.ctx.modal.notify("error",{title:i`Submission Error`,content:w instanceof Error?w.message:String(w)})}}},0),l.setOptions({beforeClose:()=>{const g=u.revisions[0]?.content||"";return(P.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"}},S=>(S&&(l.setOptions({beforeClose:wa}),l.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:c,modal:l,wikiPage:u});const y=g=>P.querySelector("textarea")?.value===d?!0:(g.preventDefault(),i`You have unsaved changes. Are you sure you want to leave?`);window.addEventListener("beforeunload",y),l.on(l.Event.Close,()=>{window.removeEventListener("beforeunload",y)})}async handleSubmit(e){const{wikiPage:i,...r}=e;return this.ctx.emit("quick-edit/submit",{ctx:this.ctx,wikiPage:i,...r}),i.edit({...r})}async getEditFontOptions(){const e=await this.ctx.preferences.get("quickEdit.editFont");return Li.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,r=this.ctx.currentPage.wikiTitle,n=r&&r.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),f("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),f("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!n},tooltip:()=>n?i`Quick Edit`:i`Not editable`,onClick:()=>{const s=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:r?.getPrefixedText(),revision:s?Number(s):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}createQuickEditButton(e,i){const{$:r}=this.ctx,n=i?.icon??f(Hd,{className:"ipe-icon"}),s=i?.label??r`Quick Edit`;return f("a",{href:"#ipe://quick-edit/",dataset:e,className:`ipe-quick-edit ${e.createOnly?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:o=>{o.preventDefault(),this.showModal(e)},children:[n,s]})}},Li.BUILT_IN_FONT_OPTIONS=["preferences","monospace","sans-serif","serif"],Li);Ea=Xv(Gd),ls=iw(Ea,0,"PluginQuickEdit",Vd,ls),tw(Ea,1,ls);const rw=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickEdit:ls},Symbol.toStringTag,{value:"Module"})),Wr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},Qd=t=>{const{inputs:e,enableSwap:i=!0,...r}=t,n=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,c=null;const l=()=>s.some(h=>h&&h.disabled),u=()=>{if(!s[0]||!s[1]||l())return;const h=s[0],_=s[1],k=h.value,P=_.value;h.value=P,_.value=k,h.dispatchEvent(new Event("change")),_.dispatchEvent(new Event("change")),o++,c&&(c.style.transform=`rotateY(${o*-180}deg)`,c.style.transition="transform 200ms ease")},d=h=>{if(!a)return;const _=h??!a.disabled;a.disabled=!_,_&&s.forEach(k=>{k&&(k.disabled=!1)})},m=f("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:l()||!i,ref:h=>a=h,children:f("svg",{ref:h=>c=h,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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M20 10h-16l5.5 -6"}),f("path",{d:"M4 14h16l-5.5 6"})]})}),p=f("div",{className:`twin-swap-input ${Wr.twinSwapInput}`,...r,children:[n.map((h,_)=>{const{label:k,id:P,name:b,value:y,disabled:g,required:w,inputProps:S}=h,I=_===0,F=P||b;return f("div",{className:`${Wr.inputWrapper} ${I?Wr.inputLeft:Wr.inputRight}`,children:[k&&f("label",{htmlFor:F,children:k}),f("input",{ref:N=>s[_]=N,type:"text",id:F,name:b,value:y,disabled:g,required:w,...S})]})}),f("div",{className:Wr.swapButton,children:m})]});return p.swap=u,p.toggleEnableSwap=d,p};var nw=Object.create,$a=Object.defineProperty,sw=Object.getOwnPropertyDescriptor,Yd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Xd=t=>{throw TypeError(t)},ow=(t,e,i)=>e in t?$a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,aw=(t,e)=>$a(t,"name",{value:e,configurable:!0}),lw=t=>[,,,nw(t?.[Yd("metadata")]??null)],cw=["class","method","getter","setter","accessor","field","value","get","set"],Jd=t=>t!==void 0&&typeof t!="function"?Xd("Function expected"):t,uw=(t,e,i,r,n)=>({kind:cw[t],name:e,metadata:r,addInitializer:s=>i._?Xd("Already initialized"):n.push(Jd(s||null))}),dw=(t,e)=>ow(e,Yd("metadata"),t[3]),fw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},hw=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&sw(n,i));aw(n,i);for(var h=r.length-1;h>=0;h--)c=uw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Jd(o)&&(n=o);return dw(t,n),p&&$a(n,i,p),u?l^4?s:p:n},Zd,Pa,ef;Zd=[Ot(A.object({"quickMove.reason":A.string().default("[IPE-NEXT] Quick move")}).description("Quick move options").extra("category","editor")),xe(["modal","wiki","$"])];class cs extends(ef=Ue){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.$,r=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),f("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),f("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),f("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),f("path",{d:"M17 12h.01"}),f("path",{d:"M13 12h.01"})]}),tooltip:()=>i`Quick Move`,group:"group1",index:1,onClick:()=>{this.showModal(n?{lockFromField:!0,from:r}:{})}})}async showModal(e){const{$:i}=this.ctx,r=await this.ctx.preferences.get("quickMove.reason"),n=this.ctx.modal.createObject({title:i`Quick Move`,content:f(_i,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return n.setContent(f("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),c={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(!c.from||!c.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:n,payload:c}),n.setLoadingState(!0),this.movePage(c).then(()=>{location.reload()}).catch(l=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to move`,content:l instanceof Error?l.message:String(l)})})},children:[f(Qd,{inputs:[{label:i`Move from`,name:"from",value:e?.from,required:!0},{label:i`Move to`,name:"to",value:e?.to,required:!0}]}),f("div",{children:f(Ri,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:i`Move talk page`})}),f("div",{children:f(Ri,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:i`Move subpages (up to 100)`})}),this.ctx.wiki.hasRight("suppressredirect")&&f("div",{children:f(Ri,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:i`Move without leaving a redirect`})}),f(as,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??r??""})]})),n.setButtons([{label:i`Move`,className:"is-primary is-ghost",method:()=>{s?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:i,to:r,reason:n="",...s}=e;if(!i||!r)throw new Error("From and to titles are required.");if(i===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(r,n,s)}}Pa=lw(ef),cs=hw(Pa,0,"PluginQuickMove",Zd,cs),fw(Pa,1,cs);const pw=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return cs}},Symbol.toStringTag,{value:"Module"}));var gw=Object.create,Ca=Object.defineProperty,yw=Object.getOwnPropertyDescriptor,tf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),rf=t=>{throw TypeError(t)},bw=(t,e,i)=>e in t?Ca(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,vw=(t,e)=>Ca(t,"name",{value:e,configurable:!0}),ww=t=>[,,,gw(t?.[tf("metadata")]??null)],_w=["class","method","getter","setter","accessor","field","value","get","set"],nf=t=>t!==void 0&&typeof t!="function"?rf("Function expected"):t,xw=(t,e,i,r,n)=>({kind:_w[t],name:e,metadata:r,addInitializer:s=>i._?rf("Already initialized"):n.push(nf(s||null))}),kw=(t,e)=>bw(e,tf("metadata"),t[3]),Sw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Ew=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&yw(n,i));vw(n,i);for(var h=r.length-1;h>=0;h--)c=xw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,nf(o)&&(n=o);return kw(t,n),p&&Ca(n,i,p),u?l^4?s:p:n},sf,Ia,of;sf=[xe(["api","wikiPage","modal","preferences","$"]),Ot(A.object({"quickPreview.keyshortcut":A.string().default("ctrl-i").role("keyshortcut").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","editor").description("Quick preview options"))];class us extends(of=Ue){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this._contentTypeCache=new Map,this._objectUrls=new WeakMap,this.ctx.set("quickPreview",Bd(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}stop(){}previewWikitext(e,i,r,n,s){const{$:o}=this.ctx;return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),n.show(),n.setTitle(o`Preview - Loading...`),n.setContent(f(_i,{})),n.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:n,wikiPage:r}),r.preview(e,i).then(a=>{const{data:{parse:c}}=a;n.setTitle(o(c.title)`Preview - {{ $1 }}`);let l=null;n.setContent(f("section",{children:f("div",{ref:u=>l=u,className:"mw-parser-output",innerHTML:c.text})})),window.mw?.hook&&typeof jQuery=="function"&&window.mw.hook("wikipage.content").fire(jQuery(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:n,wikiPage:r,text:e,parseData:c})}).catch(a=>{n.setTitle(o`Preview - Failed`),n.setContent(f(bi,{children:[f("p",{children:o`Failed to preview`}),f("p",{children:a instanceof Error?a.message:String(a)})]}))}),n}async injectQuickEdit({options:e,modal:i,wikiPage:r}){const{$:n}=this.ctx;let s;i.addButton({label:n`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
+ `],..._y(i))}),e}function _y({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${Zu(t.component,t.type,r)}`,s=">"+i;return t.props?[n,...xy(t.props),s]:[n+s]}function xy(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(r=>{e.push(...ru(r,t[r]))}),i.length>3&&e.push(" ..."),e}function ru(t,e,i){return Ae(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:De(e)?(e=ru(t,oe(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):Z(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=oe(e),i?e:[`${t}=`,e])}function Ki(t,e,i,r){try{return r?t(...r):t()}catch(n){Ir(n,e,i)}}function jt(t,e,i,r){if(Z(t)){const n=Ki(t,e,i,r);return n&&Pc(n)&&n.catch(s=>{Ir(s,e,i)}),n}if(J(t)){const n=[];for(let s=0;s<t.length;s++)n.push(jt(t[s],e,i,r));return n}}function Ir(t,e,i,r=!0){const n=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||le;if(e){let a=e.parent;const c=e.proxy,l=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](t,c,l)===!1)return}a=a.parent}if(s){Mt(),Ki(s,null,10,[t,c,l]),Dt();return}}ky(t,i,n,r,o)}function ky(t,e,i,r=!0,n=!1){if(n)throw t}const Ye=[];let Ut=-1;const Vi=[];let di=null,Gi=0;const nu=Promise.resolve();let jn=null;function Ar(t){const e=jn||nu;return t?e.then(this?t.bind(this):t):e}function Sy(t){let e=Ut+1,i=Ye.length;for(;e<i;){const r=e+i>>>1,n=Ye[r],s=Rr(n);s<t||s===t&&n.flags&2?e=r+1:i=r}return e}function Bo(t){if(!(t.flags&1)){const e=Rr(t),i=Ye[Ye.length-1];!i||!(t.flags&2)&&e>=Rr(i)?Ye.push(t):Ye.splice(Sy(e),0,t),t.flags|=1,su()}}function su(){jn||(jn=nu.then(lu))}function Ey(t){J(t)?Vi.push(...t):di&&t.id===-1?di.splice(Gi+1,0,t):t.flags&1||(Vi.push(t),t.flags|=1),su()}function ou(t,e,i=Ut+1){for(;i<Ye.length;i++){const r=Ye[i];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ye.splice(i,1),i--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function au(t){if(Vi.length){const e=[...new Set(Vi)].sort((i,r)=>Rr(i)-Rr(r));if(Vi.length=0,di){di.push(...e);return}for(di=e,Gi=0;Gi<di.length;Gi++){const i=di[Gi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}di=null,Gi=0}}const Rr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function lu(t){try{for(Ut=0;Ut<Ye.length;Ut++){const e=Ye[Ut];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ki(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ut<Ye.length;Ut++){const e=Ye[Ut];e&&(e.flags&=-2)}Ut=-1,Ye.length=0,au(),jn=null,(Ye.length||Vi.length)&&lu()}}let ze=null,cu=null;function Un(t){const e=ze;return ze=t,cu=t&&t.type.__scopeId||null,e}function Tr(t,e=ze,i){if(!e||t._n)return t;const r=(...n)=>{r._d&&Wu(-1);const s=Un(e);let o;try{o=t(...n)}finally{Un(s),r._d&&Wu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function uu(t,e){if(ze===null)return t;const i=Yn(ze),r=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[s,o,a,c=le]=e[n];s&&(Z(s)&&(s={mounted:s,updated:s}),s.deep&&ei(o),r.push({dir:s,instance:i,value:o,oldValue:void 0,arg:a,modifiers:c}))}return t}function Ei(t,e,i,r){const n=t.dirs,s=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];s&&(a.oldValue=s[o].value);let c=a.dir[r];c&&(Mt(),jt(c,i,8,[t.el,a,t,e]),Dt())}}function du(t,e){if(Ke){let i=Ke.provides;const r=Ke.parent&&Ke.parent.provides;r===i&&(i=Ke.provides=Object.create(r)),i[t]=e}}function Or(t,e,i=!1){const r=aa();if(r||Xi){let n=Xi?Xi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return i&&Z(e)?e.call(r&&r.proxy):e}}const $y=Symbol.for("v-scx"),Py=()=>Or($y);function Cy(t,e){return Ho(t,null,{flush:"sync"})}function Qi(t,e,i){return Ho(t,e,i)}function Ho(t,e,i=le){const{immediate:r,deep:n,flush:s,once:o}=i,a=Fe({},i),c=e&&r||!e&&s!=="post";let l;if(Zi){if(s==="sync"){const p=Py();l=p.__watcherHandles||(p.__watcherHandles=[])}else if(!c){const p=()=>{};return p.stop=Nt,p.resume=Nt,p.pause=Nt,p}}const u=Ke;a.call=(p,h,_)=>jt(p,u,h,_);let d=!1;s==="post"?a.scheduler=p=>{at(p,u&&u.suspense)}:s!=="sync"&&(d=!0,a.scheduler=(p,h)=>{h?p():Bo(p)}),a.augmentJob=p=>{e&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const m=by(t,e,a);return Zi&&(l?l.push(m):c&&m()),m}function Iy(t,e,i){const r=this.proxy,n=Ae(t)?t.includes(".")?fu(r,t):()=>r[t]:t.bind(r,r);let s;Z(e)?s=e:(s=e.handler,i=e);const o=Br(this),a=Ho(n,s.bind(r),i);return o(),a}function fu(t,e){const i=e.split(".");return()=>{let r=t;for(let n=0;n<i.length&&r;n++)r=r[i[n]];return r}}const Ay=Symbol("_vte"),Ry=t=>t.__isTeleport,Ty=Symbol("_leaveCb");function zo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,zo(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 $i(t,e){return Z(t)?Fe({name:t.name},e,{setup:t}):t}function Wo(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function hu(t){const e=aa(),i=eu(null);if(e){const n=e.refs===le?e.refs={}:e.refs;Object.defineProperty(n,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const Fn=new WeakMap;function Lr(t,e,i,r,n=!1){if(J(t)){t.forEach((h,_)=>Lr(h,e&&(J(e)?e[_]:e),i,r,n));return}if(Yi(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Lr(t,e,i,r.component.subTree);return}const s=r.shapeFlag&4?Yn(r.component):r.el,o=n?null:s,{i:a,r:c}=t,l=e&&e.r,u=a.refs===le?a.refs={}:a.refs,d=a.setupState,m=oe(d),p=d===le?Ec:h=>ue(m,h);if(l!=null&&l!==c){if(pu(e),Ae(l))u[l]=null,p(l)&&(d[l]=null);else if(De(l)){l.value=null;const h=e;h.k&&(u[h.k]=null)}}if(Z(c))Ki(c,a,12,[o,u]);else{const h=Ae(c),_=De(c);if(h||_){const k=()=>{if(t.f){const P=h?p(c)?d[c]:u[c]:c.value;if(n)J(P)&&xo(P,s);else if(J(P))P.includes(s)||P.push(s);else if(h)u[c]=[s],p(c)&&(d[c]=u[c]);else{const b=[s];c.value=b,t.k&&(u[t.k]=b)}}else h?(u[c]=o,p(c)&&(d[c]=o)):_&&(c.value=o,t.k&&(u[t.k]=o))};if(o){const P=()=>{k(),Fn.delete(t)};P.id=-1,Fn.set(t,P),at(P,i)}else pu(t),k()}}}function pu(t){const e=Fn.get(t);e&&(e.flags|=8,Fn.delete(t))}const gu=t=>t.nodeType===8;In().requestIdleCallback,In().cancelIdleCallback;function Oy(t,e){if(gu(t)&&t.data==="["){let i=1,r=t.nextSibling;for(;r;){if(r.nodeType===1){if(e(r)===!1)break}else if(gu(r))if(r.data==="]"){if(--i===0)break}else r.data==="["&&i++;r=r.nextSibling}}else e(t)}const Yi=t=>!!t.type.__asyncLoader;function Ly(t){Z(t)&&(t={loader:t});const{loader:e,loadingComponent:i,errorComponent:r,delay:n=200,hydrate:s,timeout:o,suspensible:a=!0,onError:c}=t;let l=null,u,d=0;const m=()=>(d++,l=null,p()),p=()=>{let h;return l||(h=l=e().catch(_=>{if(_=_ instanceof Error?_:new Error(String(_)),c)return new Promise((k,P)=>{c(_,()=>k(m()),()=>P(_),d+1)});throw _}).then(_=>h!==l&&l?l:(_&&(_.__esModule||_[Symbol.toStringTag]==="Module")&&(_=_.default),u=_,_)))};return $i({name:"AsyncComponentWrapper",__asyncLoader:p,__asyncHydrate(h,_,k){let P=!1;(_.bu||(_.bu=[])).push(()=>P=!0);const b=()=>{P||k()},y=s?()=>{const g=s(b,w=>Oy(h,w));g&&(_.bum||(_.bum=[])).push(g)}:b;u?y():p().then(()=>!_.isUnmounted&&y())},get __asyncResolved(){return u},setup(){const h=Ke;if(Wo(h),u)return()=>qn(u,h);const _=y=>{l=null,Ir(y,h,13,!r)};if(a&&h.suspense||Zi)return p().then(y=>()=>qn(y,h)).catch(y=>(_(y),()=>r?Ne(r,{error:y}):null));const k=Qe(!1),P=Qe(),b=Qe(!!n);return n&&setTimeout(()=>{b.value=!1},n),o!=null&&setTimeout(()=>{if(!k.value&&!P.value){const y=new Error(`Async component timed out after ${o}ms.`);_(y),P.value=y}},o),p().then(()=>{k.value=!0,h.parent&&Ko(h.parent.vnode)&&h.parent.update()}).catch(y=>{_(y),P.value=y}),()=>{if(k.value&&u)return qn(u,h);if(P.value&&r)return Ne(r,{error:P.value});if(i&&!b.value)return qn(i,h)}}})}function qn(t,e){const{ref:i,props:r,children:n,ce:s}=e.vnode,o=Ne(t,r,n);return o.ref=i,o.ce=s,delete e.vnode.ce,o}const Ko=t=>t.type.__isKeepAlive;function Ny(t,e){mu(t,"a",e)}function My(t,e){mu(t,"da",e)}function mu(t,e,i=Ke){const r=t.__wdc||(t.__wdc=()=>{let n=i;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(Bn(e,r,i),i){let n=i.parent;for(;n&&n.parent;)Ko(n.parent.vnode)&&Dy(r,e,i,n),n=n.parent}}function Dy(t,e,i,r){const n=Bn(e,t,r,!0);Go(()=>{xo(r[e],n)},i)}function Bn(t,e,i=Ke,r=!1){if(i){const n=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Mt();const a=Br(i),c=jt(e,i,t,o);return a(),Dt(),c});return r?n.unshift(s):n.push(s),s}}const ti=t=>(e,i=Ke)=>{(!Zi||t==="sp")&&Bn(t,(...r)=>e(...r),i)},yu=ti("bm"),Nr=ti("m"),jy=ti("bu"),Uy=ti("u"),Vo=ti("bum"),Go=ti("um"),Fy=ti("sp"),qy=ti("rtg"),By=ti("rtc");function Hy(t,e=Ke){Bn("ec",t,e)}const zy=Symbol.for("v-ndc");function Qo(t,e,i,r){let n;const s=i,o=J(t);if(o||Ae(t)){const a=o&&ki(t);let c=!1,l=!1;a&&(c=!gt(t),l=Zt(t),t=Rn(t)),n=new Array(t.length);for(let u=0,d=t.length;u<d;u++)n[u]=e(c?l?Wi(Et(t[u])):Et(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,s)}else if(ke(t))if(t[Symbol.iterator])n=Array.from(t,(a,c)=>e(a,c,void 0,s));else{const a=Object.keys(t);n=new Array(a.length);for(let c=0,l=a.length;c<l;c++){const u=a[c];n[c]=e(t[u],u,c,s)}}else n=[];return n}function Wy(t,e,i={},r,n){if(ze.ce||ze.parent&&Yi(ze.parent)&&ze.parent.ce){const l=Object.keys(i).length>0;return de(),Vn(We,null,[Ne("slot",i,r)],l?-2:64)}let s=t[e];s&&s._c&&(s._d=!1),de();const o=s&&bu(s(i)),a=i.key||o&&o.key,c=Vn(We,{key:(a&&!Qt(a)?a:`_${e}`)+(!o&&r?"_fb":"")},o||[],o&&t._===1?64:-2);return c.scopeId&&(c.slotScopeIds=[c.scopeId+"-s"]),s&&s._c&&(s._d=!0),c}function bu(t){return t.some(e=>sa(e)?!(e.type===ii||e.type===We&&!bu(e.children)):!0)?t:null}const Yo=t=>t?Yu(t)?Yn(t):Yo(t.parent):null,Mr=Fe(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=>Yo(t.parent),$root:t=>Yo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>xu(t),$forceUpdate:t=>t.f||(t.f=()=>{Bo(t.update)}),$nextTick:t=>t.n||(t.n=Ar.bind(t.proxy)),$watch:t=>Iy.bind(t)}),Xo=(t,e)=>t!==le&&!t.__isScriptSetup&&ue(t,e),Ky={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:r,data:n,props:s,accessCache:o,type:a,appContext:c}=t;if(e[0]!=="$"){const m=o[e];if(m!==void 0)switch(m){case 1:return r[e];case 2:return n[e];case 4:return i[e];case 3:return s[e]}else{if(Xo(r,e))return o[e]=1,r[e];if(n!==le&&ue(n,e))return o[e]=2,n[e];if(ue(s,e))return o[e]=3,s[e];if(i!==le&&ue(i,e))return o[e]=4,i[e];Jo&&(o[e]=0)}}const l=Mr[e];let u,d;if(l)return e==="$attrs"&&He(t.attrs,"get",""),l(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(i!==le&&ue(i,e))return o[e]=4,i[e];if(d=c.config.globalProperties,ue(d,e))return d[e]},set({_:t},e,i){const{data:r,setupState:n,ctx:s}=t;return Xo(n,e)?(n[e]=i,!0):r!==le&&ue(r,e)?(r[e]=i,!0):ue(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:r,appContext:n,props:s,type:o}},a){let c;return!!(i[a]||t!==le&&a[0]!=="$"&&ue(t,a)||Xo(e,a)||ue(s,a)||ue(r,a)||ue(Mr,a)||ue(n.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:ue(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function Hn(t){return J(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function vu(t,e){return!t||!e?t||e:J(t)&&J(e)?t.concat(e):Fe({},Hn(t),Hn(e))}let Jo=!0;function Vy(t){const e=xu(t),i=t.proxy,r=t.ctx;Jo=!1,e.beforeCreate&&wu(e.beforeCreate,t,"bc");const{data:n,computed:s,methods:o,watch:a,provide:c,inject:l,created:u,beforeMount:d,mounted:m,beforeUpdate:p,updated:h,activated:_,deactivated:k,beforeDestroy:P,beforeUnmount:b,destroyed:y,unmounted:g,render:w,renderTracked:S,renderTriggered:I,errorCaptured:F,serverPrefetch:N,expose:G,inheritAttrs:K,components:qe,directives:fe,filters:Re}=e;if(l&&Gy(l,r,null),o)for(const me in o){const ge=o[me];Z(ge)&&(r[me]=ge.bind(i))}if(n){const me=n.call(i,i);ke(me)&&(t.data=jo(me))}if(Jo=!0,s)for(const me in s){const ge=s[me],ni=Z(ge)?ge.bind(i,i):Z(ge.get)?ge.get.bind(i,i):Nt,lr=!Z(ge)&&Z(ge.set)?ge.set.bind(i):Nt,si=Bt({get:ni,set:lr});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>si.value,set:Ct=>si.value=Ct})}if(a)for(const me in a)_u(a[me],r,i,me);if(c){const me=Z(c)?c.call(i):c;Reflect.ownKeys(me).forEach(ge=>{du(ge,me[ge])})}u&&wu(u,t,"c");function ae(me,ge){J(ge)?ge.forEach(ni=>me(ni.bind(i))):ge&&me(ge.bind(i))}if(ae(yu,d),ae(Nr,m),ae(jy,p),ae(Uy,h),ae(Ny,_),ae(My,k),ae(Hy,F),ae(By,S),ae(qy,I),ae(Vo,b),ae(Go,g),ae(Fy,N),J(G))if(G.length){const me=t.exposed||(t.exposed={});G.forEach(ge=>{Object.defineProperty(me,ge,{get:()=>i[ge],set:ni=>i[ge]=ni,enumerable:!0})})}else t.exposed||(t.exposed={});w&&t.render===Nt&&(t.render=w),K!=null&&(t.inheritAttrs=K),qe&&(t.components=qe),fe&&(t.directives=fe),N&&Wo(t)}function Gy(t,e,i=Nt){J(t)&&(t=Zo(t));for(const r in t){const n=t[r];let s;ke(n)?"default"in n?s=Or(n.from||r,n.default,!0):s=Or(n.from||r):s=Or(n),De(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function wu(t,e,i){jt(J(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,i)}function _u(t,e,i,r){let n=r.includes(".")?fu(i,r):()=>i[r];if(Ae(t)){const s=e[t];Z(s)&&Qi(n,s)}else if(Z(t))Qi(n,t.bind(i));else if(ke(t))if(J(t))t.forEach(s=>_u(s,e,i,r));else{const s=Z(t.handler)?t.handler.bind(i):e[t.handler];Z(s)&&Qi(n,s,t)}}function xu(t){const e=t.type,{mixins:i,extends:r}=e,{mixins:n,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let c;return a?c=a:!n.length&&!i&&!r?c=e:(c={},n.length&&n.forEach(l=>zn(c,l,o,!0)),zn(c,e,o)),ke(e)&&s.set(e,c),c}function zn(t,e,i,r=!1){const{mixins:n,extends:s}=e;s&&zn(t,s,i,!0),n&&n.forEach(o=>zn(t,o,i,!0));for(const o in e)if(!(r&&o==="expose")){const a=Qy[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Qy={data:ku,props:Su,emits:Su,methods:Dr,computed:Dr,beforeCreate:Xe,created:Xe,beforeMount:Xe,mounted:Xe,beforeUpdate:Xe,updated:Xe,beforeDestroy:Xe,beforeUnmount:Xe,destroyed:Xe,unmounted:Xe,activated:Xe,deactivated:Xe,errorCaptured:Xe,serverPrefetch:Xe,components:Dr,directives:Dr,watch:Xy,provide:ku,inject:Yy};function ku(t,e){return e?t?function(){return Fe(Z(t)?t.call(this,this):t,Z(e)?e.call(this,this):e)}:e:t}function Yy(t,e){return Dr(Zo(t),Zo(e))}function Zo(t){if(J(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Xe(t,e){return t?[...new Set([].concat(t,e))]:e}function Dr(t,e){return t?Fe(Object.create(null),t,e):e}function Su(t,e){return t?J(t)&&J(e)?[...new Set([...t,...e])]:Fe(Object.create(null),Hn(t),Hn(e??{})):e}function Xy(t,e){if(!t)return e;if(!e)return t;const i=Fe(Object.create(null),t);for(const r in e)i[r]=Xe(t[r],e[r]);return i}function Eu(){return{app:null,config:{isNativeTag:Ec,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 Jy=0;function Zy(t,e){return function(r,n=null){Z(r)||(r=Fe({},r)),n!=null&&!ke(n)&&(n=null);const s=Eu(),o=new WeakSet,a=[];let c=!1;const l=s.app={_uid:Jy++,_component:r,_props:n,_container:null,_context:s,_instance:null,version:Rb,get config(){return s.config},set config(u){},use(u,...d){return o.has(u)||(u&&Z(u.install)?(o.add(u),u.install(l,...d)):Z(u)&&(o.add(u),u(l,...d))),l},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),l},component(u,d){return d?(s.components[u]=d,l):s.components[u]},directive(u,d){return d?(s.directives[u]=d,l):s.directives[u]},mount(u,d,m){if(!c){const p=l._ceVNode||Ne(r,n);return p.appContext=s,m===!0?m="svg":m===!1&&(m=void 0),t(p,u,m),c=!0,l._container=u,u.__vue_app__=l,Yn(p.component)}},onUnmount(u){a.push(u)},unmount(){c&&(jt(a,l._instance,16),t(null,l._container),delete l._container.__vue_app__)},provide(u,d){return s.provides[u]=d,l},runWithContext(u){const d=Xi;Xi=l;try{return u()}finally{Xi=d}}};return l}}let Xi=null;function $u(t,e,i=le){const r=aa(),n=Yt(e),s=ci(e),o=Pu(t,n),a=py((c,l)=>{let u,d=le,m;return Cy(()=>{const p=t[n];it(u,p)&&(u=p,l())}),{get(){return c(),i.get?i.get(u):u},set(p){const h=i.set?i.set(p):p;if(!it(h,u)&&!(d!==le&&it(p,d)))return;const _=r.vnode.props;_&&(e in _||n in _||s in _)&&(`onUpdate:${e}`in _||`onUpdate:${n}`in _||`onUpdate:${s}`in _)||(u=p,l()),r.emit(`update:${e}`,h),it(p,h)&&it(p,d)&&!it(h,m)&&l(),d=p,m=h}}});return a[Symbol.iterator]=()=>{let c=0;return{next(){return c<2?{value:c++?o||le:a,done:!1}:{done:!0}}}},a}const Pu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Yt(e)}Modifiers`]||t[`${ci(e)}Modifiers`];function eb(t,e,...i){if(t.isUnmounted)return;const r=t.vnode.props||le;let n=i;const s=e.startsWith("update:"),o=s&&Pu(r,e.slice(7));o&&(o.trim&&(n=i.map(u=>Ae(u)?u.trim():u)),o.number&&(n=i.map(Eo)));let a,c=r[a=So(e)]||r[a=So(Yt(e))];!c&&s&&(c=r[a=So(ci(e))]),c&&jt(c,t,6,n);const l=r[a+"Once"];if(l){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,jt(l,t,6,n)}}const tb=new WeakMap;function Cu(t,e,i=!1){const r=i?tb:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const s=t.emits;let o={},a=!1;if(!Z(t)){const c=l=>{const u=Cu(l,e,!0);u&&(a=!0,Fe(o,u))};!i&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}return!s&&!a?(ke(t)&&r.set(t,null),null):(J(s)?s.forEach(c=>o[c]=null):Fe(o,s),ke(t)&&r.set(t,o),o)}function Wn(t,e){return!t||!En(e)?!1:(e=e.slice(2).replace(/Once$/,""),ue(t,e[0].toLowerCase()+e.slice(1))||ue(t,ci(e))||ue(t,e))}function H0(){}function Iu(t){const{type:e,vnode:i,proxy:r,withProxy:n,propsOptions:[s],slots:o,attrs:a,emit:c,render:l,renderCache:u,props:d,data:m,setupState:p,ctx:h,inheritAttrs:_}=t,k=Un(t);let P,b;try{if(i.shapeFlag&4){const g=n||r,w=g;P=Ft(l.call(w,g,u,d,p,m,h)),b=a}else{const g=e;P=Ft(g.length>1?g(d,{attrs:a,slots:o,emit:c}):g(d,null)),b=e.props?a:ib(a)}}catch(g){jr.length=0,Ir(g,t,1),P=Ne(ii)}let y=P;if(b&&_!==!1){const g=Object.keys(b),{shapeFlag:w}=y;g.length&&w&7&&(s&&g.some(_o)&&(b=rb(b,s)),y=Ji(y,b,!1,!0))}return i.dirs&&(y=Ji(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(i.dirs):i.dirs),i.transition&&zo(y,i.transition),P=y,Un(k),P}const ib=t=>{let e;for(const i in t)(i==="class"||i==="style"||En(i))&&((e||(e={}))[i]=t[i]);return e},rb=(t,e)=>{const i={};for(const r in t)(!_o(r)||!(r.slice(9)in e))&&(i[r]=t[r]);return i};function nb(t,e,i){const{props:r,children:n,component:s}=t,{props:o,children:a,patchFlag:c}=e,l=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&c>=0){if(c&1024)return!0;if(c&16)return r?Au(r,o,l):!!o;if(c&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const m=u[d];if(o[m]!==r[m]&&!Wn(l,m))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?Au(r,o,l):!0:!!o;return!1}function Au(t,e,i){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const s=r[n];if(e[s]!==t[s]&&!Wn(i,s))return!0}return!1}function sb({vnode:t,parent:e},i){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=i,e=e.parent;else break}}const Ru={},Tu=()=>Object.create(Ru),Ou=t=>Object.getPrototypeOf(t)===Ru;function ob(t,e,i,r=!1){const n={},s=Tu();t.propsDefaults=Object.create(null),Lu(t,e,n,s);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);i?t.props=r?n:cy(n):t.type.props?t.props=n:t.props=s,t.attrs=s}function ab(t,e,i,r){const{props:n,attrs:s,vnode:{patchFlag:o}}=t,a=oe(n),[c]=t.propsOptions;let l=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let m=u[d];if(Wn(t.emitsOptions,m))continue;const p=e[m];if(c)if(ue(s,m))p!==s[m]&&(s[m]=p,l=!0);else{const h=Yt(m);n[h]=ea(c,a,h,p,t,!1)}else p!==s[m]&&(s[m]=p,l=!0)}}}else{Lu(t,e,n,s)&&(l=!0);let u;for(const d in a)(!e||!ue(e,d)&&((u=ci(d))===d||!ue(e,u)))&&(c?i&&(i[d]!==void 0||i[u]!==void 0)&&(n[d]=ea(c,a,d,void 0,t,!0)):delete n[d]);if(s!==a)for(const d in s)(!e||!ue(e,d))&&(delete s[d],l=!0)}l&&Xt(t.attrs,"set","")}function Lu(t,e,i,r){const[n,s]=t.propsOptions;let o=!1,a;if(e)for(let c in e){if(xr(c))continue;const l=e[c];let u;n&&ue(n,u=Yt(c))?!s||!s.includes(u)?i[u]=l:(a||(a={}))[u]=l:Wn(t.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(s){const c=oe(i),l=a||le;for(let u=0;u<s.length;u++){const d=s[u];i[d]=ea(n,c,d,l[d],t,!ue(l,d))}}return o}function ea(t,e,i,r,n,s){const o=t[i];if(o!=null){const a=ue(o,"default");if(a&&r===void 0){const c=o.default;if(o.type!==Function&&!o.skipFactory&&Z(c)){const{propsDefaults:l}=n;if(i in l)r=l[i];else{const u=Br(n);r=l[i]=c.call(null,e),u()}}else r=c;n.ce&&n.ce._setProp(i,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===ci(i))&&(r=!0))}return r}const lb=new WeakMap;function Nu(t,e,i=!1){const r=i?lb:e.propsCache,n=r.get(t);if(n)return n;const s=t.props,o={},a=[];let c=!1;if(!Z(t)){const u=d=>{c=!0;const[m,p]=Nu(d,e,!0);Fe(o,m),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&&!c)return ke(t)&&r.set(t,Bi),Bi;if(J(s))for(let u=0;u<s.length;u++){const d=Yt(s[u]);Mu(d)&&(o[d]=le)}else if(s)for(const u in s){const d=Yt(u);if(Mu(d)){const m=s[u],p=o[d]=J(m)||Z(m)?{type:m}:Fe({},m),h=p.type;let _=!1,k=!0;if(J(h))for(let P=0;P<h.length;++P){const b=h[P],y=Z(b)&&b.name;if(y==="Boolean"){_=!0;break}else y==="String"&&(k=!1)}else _=Z(h)&&h.name==="Boolean";p[0]=_,p[1]=k,(_||ue(p,"default"))&&a.push(d)}}const l=[o,a];return ke(t)&&r.set(t,l),l}function Mu(t){return t[0]!=="$"&&!xr(t)}const ta=t=>t==="_"||t==="_ctx"||t==="$stable",ia=t=>J(t)?t.map(Ft):[Ft(t)],cb=(t,e,i)=>{if(e._n)return e;const r=Tr((...n)=>ia(e(...n)),i);return r._c=!1,r},Du=(t,e,i)=>{const r=t._ctx;for(const n in t){if(ta(n))continue;const s=t[n];if(Z(s))e[n]=cb(n,s,r);else if(s!=null){const o=ia(s);e[n]=()=>o}}},ju=(t,e)=>{const i=ia(e);t.slots.default=()=>i},Uu=(t,e,i)=>{for(const r in e)(i||!ta(r))&&(t[r]=e[r])},ub=(t,e,i)=>{const r=t.slots=Tu();if(t.vnode.shapeFlag&32){const n=e._;n?(Uu(r,e,i),i&&Rc(r,"_",n,!0)):Du(e,r)}else e&&ju(t,e)},db=(t,e,i)=>{const{vnode:r,slots:n}=t;let s=!0,o=le;if(r.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Uu(n,e,i):(s=!e.$stable,Du(e,n)),o=e}else e&&(ju(t,e),o={default:1});if(s)for(const a in n)!ta(a)&&o[a]==null&&delete n[a]},at=mb;function fb(t){return hb(t)}function hb(t,e){const i=In();i.__VUE__=!0;const{insert:r,remove:n,patchProp:s,createElement:o,createText:a,createComment:c,setText:l,setElementText:u,parentNode:d,nextSibling:m,setScopeId:p=Nt,insertStaticContent:h}=t,_=(v,x,E,T=null,R=null,O=null,B=void 0,q=null,D=!!x.dynamicChildren)=>{if(v===x)return;v&&!Fr(v,x)&&(T=H(v),Ct(v,R,O,!0),v=null),x.patchFlag===-2&&(D=!1,x.dynamicChildren=null);const{type:L,ref:Q,shapeFlag:z}=x;switch(L){case Kn:k(v,x,E,T);break;case ii:P(v,x,E,T);break;case na:v==null&&b(x,E,T,B);break;case We:qe(v,x,E,T,R,O,B,q,D);break;default:z&1?w(v,x,E,T,R,O,B,q,D):z&6?fe(v,x,E,T,R,O,B,q,D):(z&64||z&128)&&L.process(v,x,E,T,R,O,B,q,D,we)}Q!=null&&R?Lr(Q,v&&v.ref,O,x||v,!x):Q==null&&v&&v.ref!=null&&Lr(v.ref,null,O,v,!0)},k=(v,x,E,T)=>{if(v==null)r(x.el=a(x.children),E,T);else{const R=x.el=v.el;x.children!==v.children&&l(R,x.children)}},P=(v,x,E,T)=>{v==null?r(x.el=c(x.children||""),E,T):x.el=v.el},b=(v,x,E,T)=>{[v.el,v.anchor]=h(v.children,x,E,T,v.el,v.anchor)},y=({el:v,anchor:x},E,T)=>{let R;for(;v&&v!==x;)R=m(v),r(v,E,T),v=R;r(x,E,T)},g=({el:v,anchor:x})=>{let E;for(;v&&v!==x;)E=m(v),n(v),v=E;n(x)},w=(v,x,E,T,R,O,B,q,D)=>{if(x.type==="svg"?B="svg":x.type==="math"&&(B="mathml"),v==null)S(x,E,T,R,O,B,q,D);else{const L=v.el&&v.el._isVueCE?v.el:null;try{L&&L._beginPatch(),N(v,x,R,O,B,q,D)}finally{L&&L._endPatch()}}},S=(v,x,E,T,R,O,B,q)=>{let D,L;const{props:Q,shapeFlag:z,transition:V,dirs:ee}=v;if(D=v.el=o(v.type,O,Q&&Q.is,Q),z&8?u(D,v.children):z&16&&F(v.children,D,null,T,R,ra(v,O),B,q),ee&&Ei(v,null,T,"created"),I(D,v,v.scopeId,B,T),Q){for(const _e in Q)_e!=="value"&&!xr(_e)&&s(D,_e,null,Q[_e],O,T);"value"in Q&&s(D,"value",null,Q.value,O),(L=Q.onVnodeBeforeMount)&&qt(L,T,v)}ee&&Ei(v,null,T,"beforeMount");const se=pb(R,V);se&&V.beforeEnter(D),r(D,x,E),((L=Q&&Q.onVnodeMounted)||se||ee)&&at(()=>{L&&qt(L,T,v),se&&V.enter(D),ee&&Ei(v,null,T,"mounted")},R)},I=(v,x,E,T,R)=>{if(E&&p(v,E),T)for(let O=0;O<T.length;O++)p(v,T[O]);if(R){let O=R.subTree;if(x===O||zu(O.type)&&(O.ssContent===x||O.ssFallback===x)){const B=R.vnode;I(v,B,B.scopeId,B.slotScopeIds,R.parent)}}},F=(v,x,E,T,R,O,B,q,D=0)=>{for(let L=D;L<v.length;L++){const Q=v[L]=q?hi(v[L]):Ft(v[L]);_(null,Q,x,E,T,R,O,B,q)}},N=(v,x,E,T,R,O,B)=>{const q=x.el=v.el;let{patchFlag:D,dynamicChildren:L,dirs:Q}=x;D|=v.patchFlag&16;const z=v.props||le,V=x.props||le;let ee;if(E&&Pi(E,!1),(ee=V.onVnodeBeforeUpdate)&&qt(ee,E,x,v),Q&&Ei(x,v,E,"beforeUpdate"),E&&Pi(E,!0),(z.innerHTML&&V.innerHTML==null||z.textContent&&V.textContent==null)&&u(q,""),L?G(v.dynamicChildren,L,q,E,T,ra(x,R),O):B||ge(v,x,q,null,E,T,ra(x,R),O,!1),D>0){if(D&16)K(q,z,V,E,R);else if(D&2&&z.class!==V.class&&s(q,"class",null,V.class,R),D&4&&s(q,"style",z.style,V.style,R),D&8){const se=x.dynamicProps;for(let _e=0;_e<se.length;_e++){const he=se[_e],nt=z[he],st=V[he];(st!==nt||he==="value")&&s(q,he,nt,st,R,E)}}D&1&&v.children!==x.children&&u(q,x.children)}else!B&&L==null&&K(q,z,V,E,R);((ee=V.onVnodeUpdated)||Q)&&at(()=>{ee&&qt(ee,E,x,v),Q&&Ei(x,v,E,"updated")},T)},G=(v,x,E,T,R,O,B)=>{for(let q=0;q<x.length;q++){const D=v[q],L=x[q],Q=D.el&&(D.type===We||!Fr(D,L)||D.shapeFlag&198)?d(D.el):E;_(D,L,Q,null,T,R,O,B,!0)}},K=(v,x,E,T,R)=>{if(x!==E){if(x!==le)for(const O in x)!xr(O)&&!(O in E)&&s(v,O,x[O],null,R,T);for(const O in E){if(xr(O))continue;const B=E[O],q=x[O];B!==q&&O!=="value"&&s(v,O,q,B,R,T)}"value"in E&&s(v,"value",x.value,E.value,R)}},qe=(v,x,E,T,R,O,B,q,D)=>{const L=x.el=v?v.el:a(""),Q=x.anchor=v?v.anchor:a("");let{patchFlag:z,dynamicChildren:V,slotScopeIds:ee}=x;ee&&(q=q?q.concat(ee):ee),v==null?(r(L,E,T),r(Q,E,T),F(x.children||[],E,Q,R,O,B,q,D)):z>0&&z&64&&V&&v.dynamicChildren&&v.dynamicChildren.length===V.length?(G(v.dynamicChildren,V,E,R,O,B,q),(x.key!=null||R&&x===R.subTree)&&Fu(v,x,!0)):ge(v,x,E,Q,R,O,B,q,D)},fe=(v,x,E,T,R,O,B,q,D)=>{x.slotScopeIds=q,v==null?x.shapeFlag&512?R.ctx.activate(x,E,T,B,D):Re(x,E,T,R,O,B,D):Pe(v,x,D)},Re=(v,x,E,T,R,O,B)=>{const q=v.component=xb(v,T,R);if(Ko(v)&&(q.ctx.renderer=we),kb(q,!1,B),q.asyncDep){if(R&&R.registerDep(q,ae,B),!v.el){const D=q.subTree=Ne(ii);P(null,D,x,E),v.placeholder=D.el}}else ae(q,v,x,E,R,O,B)},Pe=(v,x,E)=>{const T=x.component=v.component;if(nb(v,x,E))if(T.asyncDep&&!T.asyncResolved){me(T,x,E);return}else T.next=x,T.update();else x.el=v.el,T.vnode=x},ae=(v,x,E,T,R,O,B)=>{const q=()=>{if(v.isMounted){let{next:z,bu:V,u:ee,parent:se,vnode:_e}=v;{const zt=qu(v);if(zt){z&&(z.el=_e.el,me(v,z,B)),zt.asyncDep.then(()=>{v.isUnmounted||q()});return}}let he=z,nt;Pi(v,!1),z?(z.el=_e.el,me(v,z,B)):z=_e,V&&Cn(V),(nt=z.props&&z.props.onVnodeBeforeUpdate)&&qt(nt,se,z,_e),Pi(v,!0);const st=Iu(v),Ht=v.subTree;v.subTree=st,_(Ht,st,d(Ht.el),H(Ht),v,R,O),z.el=st.el,he===null&&sb(v,st.el),ee&&at(ee,R),(nt=z.props&&z.props.onVnodeUpdated)&&at(()=>qt(nt,se,z,_e),R)}else{let z;const{el:V,props:ee}=x,{bm:se,m:_e,parent:he,root:nt,type:st}=v,Ht=Yi(x);Pi(v,!1),se&&Cn(se),!Ht&&(z=ee&&ee.onVnodeBeforeMount)&&qt(z,he,x),Pi(v,!0);{nt.ce&&nt.ce._def.shadowRoot!==!1&&nt.ce._injectChildStyle(st);const zt=v.subTree=Iu(v);_(null,zt,E,T,v,R,O),x.el=zt.el}if(_e&&at(_e,R),!Ht&&(z=ee&&ee.onVnodeMounted)){const zt=x;at(()=>qt(z,he,zt),R)}(x.shapeFlag&256||he&&Yi(he.vnode)&&he.vnode.shapeFlag&256)&&v.a&&at(v.a,R),v.isMounted=!0,x=E=T=null}};v.scope.on();const D=v.effect=new Mc(q);v.scope.off();const L=v.update=D.run.bind(D),Q=v.job=D.runIfDirty.bind(D);Q.i=v,Q.id=v.uid,D.scheduler=()=>Bo(Q),Pi(v,!0),L()},me=(v,x,E)=>{x.component=v;const T=v.vnode.props;v.vnode=x,v.next=null,ab(v,x.props,T,E),db(v,x.children,E),Mt(),ou(v),Dt()},ge=(v,x,E,T,R,O,B,q,D=!1)=>{const L=v&&v.children,Q=v?v.shapeFlag:0,z=x.children,{patchFlag:V,shapeFlag:ee}=x;if(V>0){if(V&128){lr(L,z,E,T,R,O,B,q,D);return}else if(V&256){ni(L,z,E,T,R,O,B,q,D);return}}ee&8?(Q&16&&M(L,R,O),z!==L&&u(E,z)):Q&16?ee&16?lr(L,z,E,T,R,O,B,q,D):M(L,R,O,!0):(Q&8&&u(E,""),ee&16&&F(z,E,T,R,O,B,q,D))},ni=(v,x,E,T,R,O,B,q,D)=>{v=v||Bi,x=x||Bi;const L=v.length,Q=x.length,z=Math.min(L,Q);let V;for(V=0;V<z;V++){const ee=x[V]=D?hi(x[V]):Ft(x[V]);_(v[V],ee,E,null,R,O,B,q,D)}L>Q?M(v,R,O,!0,!1,z):F(x,E,T,R,O,B,q,D,z)},lr=(v,x,E,T,R,O,B,q,D)=>{let L=0;const Q=x.length;let z=v.length-1,V=Q-1;for(;L<=z&&L<=V;){const ee=v[L],se=x[L]=D?hi(x[L]):Ft(x[L]);if(Fr(ee,se))_(ee,se,E,null,R,O,B,q,D);else break;L++}for(;L<=z&&L<=V;){const ee=v[z],se=x[V]=D?hi(x[V]):Ft(x[V]);if(Fr(ee,se))_(ee,se,E,null,R,O,B,q,D);else break;z--,V--}if(L>z){if(L<=V){const ee=V+1,se=ee<Q?x[ee].el:T;for(;L<=V;)_(null,x[L]=D?hi(x[L]):Ft(x[L]),E,se,R,O,B,q,D),L++}}else if(L>V)for(;L<=z;)Ct(v[L],R,O,!0),L++;else{const ee=L,se=L,_e=new Map;for(L=se;L<=V;L++){const ft=x[L]=D?hi(x[L]):Ft(x[L]);ft.key!=null&&_e.set(ft.key,L)}let he,nt=0;const st=V-se+1;let Ht=!1,zt=0;const Xr=new Array(st);for(L=0;L<st;L++)Xr[L]=0;for(L=ee;L<=z;L++){const ft=v[L];if(nt>=st){Ct(ft,R,O,!0);continue}let Wt;if(ft.key!=null)Wt=_e.get(ft.key);else for(he=se;he<=V;he++)if(Xr[he-se]===0&&Fr(ft,x[he])){Wt=he;break}Wt===void 0?Ct(ft,R,O,!0):(Xr[Wt-se]=L+1,Wt>=zt?zt=Wt:Ht=!0,_(ft,x[Wt],E,null,R,O,B,q,D),nt++)}const Uf=Ht?gb(Xr):Bi;for(he=Uf.length-1,L=st-1;L>=0;L--){const ft=se+L,Wt=x[ft],Ff=x[ft+1],qf=ft+1<Q?Ff.el||Hu(Ff):T;Xr[L]===0?_(null,Wt,E,qf,R,O,B,q,D):Ht&&(he<0||L!==Uf[he]?si(Wt,E,qf,2):he--)}}},si=(v,x,E,T,R=null)=>{const{el:O,type:B,transition:q,children:D,shapeFlag:L}=v;if(L&6){si(v.component.subTree,x,E,T);return}if(L&128){v.suspense.move(x,E,T);return}if(L&64){B.move(v,x,E,we);return}if(B===We){r(O,x,E);for(let z=0;z<D.length;z++)si(D[z],x,E,T);r(v.anchor,x,E);return}if(B===na){y(v,x,E);return}if(T!==2&&L&1&&q)if(T===0)q.beforeEnter(O),r(O,x,E),at(()=>q.enter(O),R);else{const{leave:z,delayLeave:V,afterLeave:ee}=q,se=()=>{v.ctx.isUnmounted?n(O):r(O,x,E)},_e=()=>{O._isLeaving&&O[Ty](!0),z(O,()=>{se(),ee&&ee()})};V?V(O,se,_e):_e()}else r(O,x,E)},Ct=(v,x,E,T=!1,R=!1)=>{const{type:O,props:B,ref:q,children:D,dynamicChildren:L,shapeFlag:Q,patchFlag:z,dirs:V,cacheIndex:ee}=v;if(z===-2&&(R=!1),q!=null&&(Mt(),Lr(q,null,E,v,!0),Dt()),ee!=null&&(x.renderCache[ee]=void 0),Q&256){x.ctx.deactivate(v);return}const se=Q&1&&V,_e=!Yi(v);let he;if(_e&&(he=B&&B.onVnodeBeforeUnmount)&&qt(he,x,v),Q&6)C(v.component,E,T);else{if(Q&128){v.suspense.unmount(E,T);return}se&&Ei(v,null,x,"beforeUnmount"),Q&64?v.type.remove(v,x,E,we,T):L&&!L.hasOnce&&(O!==We||z>0&&z&64)?M(L,x,E,!1,!0):(O===We&&z&384||!R&&Q&16)&&M(D,x,E),T&&xs(v)}(_e&&(he=B&&B.onVnodeUnmounted)||se)&&at(()=>{he&&qt(he,x,v),se&&Ei(v,null,x,"unmounted")},E)},xs=v=>{const{type:x,el:E,anchor:T,transition:R}=v;if(x===We){Ni(E,T);return}if(x===na){g(v);return}const O=()=>{n(E),R&&!R.persisted&&R.afterLeave&&R.afterLeave()};if(v.shapeFlag&1&&R&&!R.persisted){const{leave:B,delayLeave:q}=R,D=()=>B(E,O);q?q(v.el,O,D):D()}else O()},Ni=(v,x)=>{let E;for(;v!==x;)E=m(v),n(v),v=E;n(x)},C=(v,x,E)=>{const{bum:T,scope:R,job:O,subTree:B,um:q,m:D,a:L}=v;Bu(D),Bu(L),T&&Cn(T),R.stop(),O&&(O.flags|=8,Ct(B,v,x,E)),q&&at(q,x),at(()=>{v.isUnmounted=!0},x)},M=(v,x,E,T=!1,R=!1,O=0)=>{for(let B=O;B<v.length;B++)Ct(v[B],x,E,T,R)},H=v=>{if(v.shapeFlag&6)return H(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const x=m(v.anchor||v.el),E=x&&x[Ay];return E?m(E):x};let te=!1;const Je=(v,x,E)=>{let T;v==null?x._vnode&&(Ct(x._vnode,null,null,!0),T=x._vnode.component):_(x._vnode||null,v,x,null,null,null,E),x._vnode=v,te||(te=!0,ou(T),au(),te=!1)},we={p:_,um:Ct,m:si,r:xs,mt:Re,mc:F,pc:ge,pbc:G,n:H,o:t};return{render:Je,hydrate:void 0,createApp:Zy(Je)}}function ra({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 Pi({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function pb(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Fu(t,e,i=!1){const r=t.children,n=e.children;if(J(r)&&J(n))for(let s=0;s<r.length;s++){const o=r[s];let a=n[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[s]=hi(n[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Fu(o,a)),a.type===Kn&&(a.patchFlag!==-1?a.el=o.el:a.__elIndex=s+(t.type===We?1:0)),a.type===ii&&!a.el&&(a.el=o.el)}}function gb(t){const e=t.slice(),i=[0];let r,n,s,o,a;const c=t.length;for(r=0;r<c;r++){const l=t[r];if(l!==0){if(n=i[i.length-1],t[n]<l){e[r]=n,i.push(r);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<l?s=a+1:o=a;l<t[i[s]]&&(s>0&&(e[r]=i[s-1]),i[s]=r)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function qu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:qu(e)}function Bu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Hu(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Hu(e.subTree):null}const zu=t=>t.__isSuspense;function mb(t,e){e&&e.pendingBranch?J(t)?e.effects.push(...t):e.effects.push(t):Ey(t)}const We=Symbol.for("v-fgt"),Kn=Symbol.for("v-txt"),ii=Symbol.for("v-cmt"),na=Symbol.for("v-stc"),jr=[];let lt=null;function de(t=!1){jr.push(lt=t?null:[])}function yb(){jr.pop(),lt=jr[jr.length-1]||null}let Ur=1;function Wu(t,e=!1){Ur+=t,t<0&&lt&&e&&(lt.hasOnce=!0)}function Ku(t){return t.dynamicChildren=Ur>0?lt||Bi:null,yb(),Ur>0&&lt&&lt.push(t),t}function ve(t,e,i,r,n,s){return Ku(ie(t,e,i,r,n,s,!0))}function Vn(t,e,i,r,n){return Ku(Ne(t,e,i,r,n,!0))}function sa(t){return t?t.__v_isVNode===!0:!1}function Fr(t,e){return t.type===e.type&&t.key===e.key}const Vu=({key:t})=>t??null,Gn=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?Ae(t)||De(t)||Z(t)?{i:ze,r:t,k:e,f:!!i}:t:null);function ie(t,e=null,i=null,r=0,n=null,s=t===We?0:1,o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Vu(e),ref:e&&Gn(e),scopeId:cu,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:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:ze};return a?(oa(c,i),s&128&&t.normalize(c)):i&&(c.shapeFlag|=Ae(i)?8:16),Ur>0&&!o&&lt&&(c.patchFlag>0||s&6)&&c.patchFlag!==32&&lt.push(c),c}const Ne=bb;function bb(t,e=null,i=null,r=0,n=null,s=!1){if((!t||t===zy)&&(t=ii),sa(t)){const a=Ji(t,e,!0);return i&&oa(a,i),Ur>0&&!s&&lt&&(a.shapeFlag&6?lt[lt.indexOf(t)]=a:lt.push(a)),a.patchFlag=-2,a}if(Ab(t)&&(t=t.__vccOpts),e){e=vb(e);let{class:a,style:c}=e;a&&!Ae(a)&&(e.class=kt(a)),ke(c)&&(Fo(c)&&!J(c)&&(c=Fe({},c)),e.style=$o(c))}const o=Ae(t)?1:zu(t)?128:Ry(t)?64:ke(t)?4:Z(t)?2:0;return ie(t,e,i,r,n,o,s,!0)}function vb(t){return t?Fo(t)||Ou(t)?Fe({},t):t:null}function Ji(t,e,i=!1,r=!1){const{props:n,ref:s,patchFlag:o,children:a,transition:c}=t,l=e?Gu(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:l,key:l&&Vu(l),ref:e&&e.ref?i&&s?J(s)?s.concat(Gn(e)):[s,Gn(e)]:Gn(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!==We?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:c,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Ji(t.ssContent),ssFallback:t.ssFallback&&Ji(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return c&&r&&zo(u,c.clone(u)),u}function qr(t=" ",e=0){return Ne(Kn,null,t,e)}function fi(t="",e=!1){return e?(de(),Vn(ii,null,t)):Ne(ii,null,t)}function Ft(t){return t==null||typeof t=="boolean"?Ne(ii):J(t)?Ne(We,null,t.slice()):sa(t)?hi(t):Ne(Kn,null,String(t))}function hi(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ji(t)}function oa(t,e){let i=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(J(e))i=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),oa(t,n()),n._c&&(n._d=!0));return}else{i=32;const n=e._;!n&&!Ou(e)?e._ctx=ze:n===3&&ze&&(ze.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Z(e)?(e={default:e,_ctx:ze},i=32):(e=String(e),r&64?(i=16,e=[qr(e)]):i=8);t.children=e,t.shapeFlag|=i}function Gu(...t){const e={};for(let i=0;i<t.length;i++){const r=t[i];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=kt([e.class,r.class]));else if(n==="style")e.style=$o([e.style,r.style]);else if(En(n)){const s=e[n],o=r[n];o&&s!==o&&!(J(s)&&s.includes(o))&&(e[n]=s?[].concat(s,o):o)}else n!==""&&(e[n]=r[n])}return e}function qt(t,e,i,r=null){jt(t,e,7,[i,r])}const wb=Eu();let _b=0;function xb(t,e,i){const r=t.type,n=(e?e.appContext:t.appContext)||wb,s={uid:_b++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Hm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Nu(r,n),emitsOptions:Cu(r,n),emit:null,emitted:null,propsDefaults:le,inheritAttrs:r.inheritAttrs,ctx:le,data:le,props:le,attrs:le,slots:le,refs:le,setupState:le,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=eb.bind(null,s),t.ce&&t.ce(s),s}let Ke=null;const aa=()=>Ke||ze;let Qn,la;{const t=In(),e=(i,r)=>{let n;return(n=t[i])||(n=t[i]=[]),n.push(r),s=>{n.length>1?n.forEach(o=>o(s)):n[0](s)}};Qn=e("__VUE_INSTANCE_SETTERS__",i=>Ke=i),la=e("__VUE_SSR_SETTERS__",i=>Zi=i)}const Br=t=>{const e=Ke;return Qn(t),t.scope.on(),()=>{t.scope.off(),Qn(e)}},Qu=()=>{Ke&&Ke.scope.off(),Qn(null)};function Yu(t){return t.vnode.shapeFlag&4}let Zi=!1;function kb(t,e=!1,i=!1){e&&la(e);const{props:r,children:n}=t.vnode,s=Yu(t);ob(t,r,s,e),ub(t,n,i||e);const o=s?Sb(t,e):void 0;return e&&la(!1),o}function Sb(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Ky);const{setup:r}=i;if(r){Mt();const n=t.setupContext=r.length>1?$b(t):null,s=Br(t),o=Ki(r,t,0,[t.props,n]),a=Pc(o);if(Dt(),s(),(a||t.sp)&&!Yi(t)&&Wo(t),a){if(o.then(Qu,Qu),e)return o.then(c=>{Xu(t,c)}).catch(c=>{Ir(c,t,0)});t.asyncDep=o}else Xu(t,o)}else Ju(t)}function Xu(t,e,i){Z(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ke(e)&&(t.setupState=iu(e)),Ju(t)}function Ju(t,e,i){const r=t.type;t.render||(t.render=r.render||Nt);{const n=Br(t);Mt();try{Vy(t)}finally{Dt(),n()}}}const Eb={get(t,e){return He(t,"get",""),t[e]}};function $b(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,Eb),slots:t.slots,emit:t.emit,expose:e}}function Yn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(iu(uy(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in Mr)return Mr[i](t)},has(e,i){return i in e||i in Mr}})):t.proxy}const Pb=/(?:^|[-_])\w/g,Cb=t=>t.replace(Pb,e=>e.toUpperCase()).replace(/[-_]/g,"");function Ib(t,e=!0){return Z(t)?t.displayName||t.name:t.name||e&&t.__name}function Zu(t,e,i=!1){let r=Ib(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t){const n=s=>{for(const o in s)if(s[o]===e)return o};r=n(t.components)||t.parent&&n(t.parent.type.components)||n(t.appContext.components)}return r?Cb(r):i?"App":"Anonymous"}function Ab(t){return Z(t)&&"__vccOpts"in t}const Bt=(t,e)=>my(t,e,Zi),Rb="3.5.26";let ca;const ed=typeof window<"u"&&window.trustedTypes;if(ed)try{ca=ed.createPolicy("vue",{createHTML:t=>t})}catch{}const td=ca?t=>ca.createHTML(t):t=>t,Tb="http://www.w3.org/2000/svg",Ob="http://www.w3.org/1998/Math/MathML",ri=typeof document<"u"?document:null,id=ri&&ri.createElement("template"),Lb={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,r)=>{const n=e==="svg"?ri.createElementNS(Tb,t):e==="mathml"?ri.createElementNS(Ob,t):i?ri.createElement(t,{is:i}):ri.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>ri.createTextNode(t),createComment:t=>ri.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>ri.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,r,n,s){const o=i?i.previousSibling:e.lastChild;if(n&&(n===s||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),i),!(n===s||!(n=n.nextSibling)););else{id.innerHTML=td(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=id.content;if(r==="svg"||r==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}e.insertBefore(a,i)}return[o?o.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}},Nb=Symbol("_vtc");function Mb(t,e,i){const r=t[Nb];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}const rd=Symbol("_vod"),Db=Symbol("_vsh"),jb=Symbol(""),Ub=/(?:^|;)\s*display\s*:/;function Fb(t,e,i){const r=t.style,n=Ae(i);let s=!1;if(i&&!n){if(e)if(Ae(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();i[a]==null&&Xn(r,a,"")}else for(const o in e)i[o]==null&&Xn(r,o,"");for(const o in i)o==="display"&&(s=!0),Xn(r,o,i[o])}else if(n){if(e!==i){const o=r[jb];o&&(i+=";"+o),r.cssText=i,s=Ub.test(i)}}else e&&t.removeAttribute("style");rd in t&&(t[rd]=s?r.display:"",t[Db]&&(r.display="none"))}const nd=/\s*!important$/;function Xn(t,e,i){if(J(i))i.forEach(r=>Xn(t,e,r));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const r=qb(t,e);nd.test(i)?t.setProperty(ci(r),i.replace(nd,""),"important"):t[r]=i}}const sd=["Webkit","Moz","ms"],ua={};function qb(t,e){const i=ua[e];if(i)return i;let r=Yt(e);if(r!=="filter"&&r in t)return ua[e]=r;r=Ac(r);for(let n=0;n<sd.length;n++){const s=sd[n]+r;if(s in t)return ua[e]=s}return e}const od="http://www.w3.org/1999/xlink";function ad(t,e,i,r,n,s=Bm(e)){r&&e.startsWith("xlink:")?i==null?t.removeAttributeNS(od,e.slice(6,e.length)):t.setAttributeNS(od,e,i):i==null||s&&!Oc(i)?t.removeAttribute(e):t.setAttribute(e,s?"":Qt(i)?String(i):i)}function ld(t,e,i,r,n){if(e==="innerHTML"||e==="textContent"){i!=null&&(t[e]=e==="innerHTML"?td(i):i);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,c=i==null?t.type==="checkbox"?"on":"":String(i);(a!==c||!("_value"in t))&&(t.value=c),i==null&&t.removeAttribute(e),t._value=i;return}let o=!1;if(i===""||i==null){const a=typeof t[e];a==="boolean"?i=Oc(i):i==null&&a==="string"?(i="",o=!0):a==="number"&&(i=0,o=!0)}try{t[e]=i}catch{}o&&t.removeAttribute(n||e)}function er(t,e,i,r){t.addEventListener(e,i,r)}function Bb(t,e,i,r){t.removeEventListener(e,i,r)}const cd=Symbol("_vei");function Hb(t,e,i,r,n=null){const s=t[cd]||(t[cd]={}),o=s[e];if(r&&o)o.value=r;else{const[a,c]=zb(e);if(r){const l=s[e]=Vb(r,n);er(t,a,l,c)}else o&&(Bb(t,a,o,c),s[e]=void 0)}}const ud=/(?:Once|Passive|Capture)$/;function zb(t){let e;if(ud.test(t)){e={};let r;for(;r=t.match(ud);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):ci(t.slice(2)),e]}let da=0;const Wb=Promise.resolve(),Kb=()=>da||(Wb.then(()=>da=0),da=Date.now());function Vb(t,e){const i=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=i.attached)return;jt(Gb(r,i.value),e,5,[r])};return i.value=t,i.attached=Kb(),i}function Gb(t,e){if(J(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(r=>n=>!n._stopped&&r&&r(n))}else return e}const dd=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Qb=(t,e,i,r,n,s)=>{const o=n==="svg";e==="class"?Mb(t,r,o):e==="style"?Fb(t,i,r):En(e)?_o(e)||Hb(t,e,i,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Yb(t,e,r,o))?(ld(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&ad(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!Ae(r))?ld(t,Yt(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),ad(t,e,r,o))};function Yb(t,e,i,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&dd(e)&&Z(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 n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return dd(e)&&Ae(i)?!1:e in t}const fd=t=>{const e=t.props["onUpdate:modelValue"]||!1;return J(e)?i=>Cn(e,i):e};function Xb(t){t.target.composing=!0}function hd(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const fa=Symbol("_assign");function pd(t,e,i){return e&&(t=t.trim()),i&&(t=Eo(t)),t}const gd={created(t,{modifiers:{lazy:e,trim:i,number:r}},n){t[fa]=fd(n);const s=r||n.props&&n.props.type==="number";er(t,e?"change":"input",o=>{o.target.composing||t[fa](pd(t.value,i,s))}),(i||s)&&er(t,"change",()=>{t.value=pd(t.value,i,s)}),e||(er(t,"compositionstart",Xb),er(t,"compositionend",hd),er(t,"change",hd))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:i,modifiers:{lazy:r,trim:n,number:s}},o){if(t[fa]=fd(o),t.composing)return;const a=(s||t.type==="number")&&!/^0\d/.test(t.value)?Eo(t.value):t.value,c=e??"";a!==c&&(document.activeElement===t&&t.type!=="range"&&(r&&e===i||n&&t.value.trim()===c)||(t.value=c))}},Jb=Fe({patchProp:Qb},Lb);let md;function Zb(){return md||(md=fb(Jb))}const ev=((...t)=>{const e=Zb().createApp(...t),{mount:i}=e;return e.mount=r=>{const n=iv(r);if(!n)return;const s=e._component;!Z(s)&&!s.render&&!s.template&&(s.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=i(n,!1,tv(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function tv(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function iv(t){return Ae(t)?document.querySelector(t):t}const rv=1;var Jn;(t=>{t.PackageLoader=new A(A.object({kind:A.union(["autoload","module","umd","styles"]).required().default("autoload"),entry:A.string(),styles:A.array(A.string()),main_export:A.string()})),t.Package=new A(A.object({id:A.string().required(),name:A.string().required(),version:A.string().required(),description:A.string(),author:A.string(),license:A.string(),loader:t.PackageLoader.required()})),t.RegistryMaintainer=new A(A.object({name:A.string().required(),email:A.string()})),t.RegistryRepository=new A(A.object({type:A.string().required(),url:A.string().required()})),t.Registry=new A(A.object({manifest_version:A.number().min(rv).required(),name:A.string().required(),base_url:A.string().required(),homepage:A.string(),maintainers:A.array(t.RegistryMaintainer),repository:t.RegistryRepository,packages:A.array(t.Package).required()}))})(Jn||(Jn={}));const ha=Symbol("IPEInjectKey"),nv=(t,e)=>(e?e.provide(ha,t):du(ha,t),t),pa=()=>{const t=Or(ha);if(!t)throw new Error("InPageEdit instance is not provided");return t},yd=(t,...e)=>{const i=ev(...e);return nv(t,i),i};var sv=Object.create,ga=Object.defineProperty,ov=Object.getOwnPropertyDescriptor,bd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vd=t=>{throw TypeError(t)},av=(t,e,i)=>e in t?ga(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,lv=(t,e)=>ga(t,"name",{value:e,configurable:!0}),cv=t=>[,,,sv(t?.[bd("metadata")]??null)],uv=["class","method","getter","setter","accessor","field","value","get","set"],wd=t=>t!==void 0&&typeof t!="function"?vd("Function expected"):t,dv=(t,e,i,r,n)=>({kind:uv[t],name:e,metadata:r,addInitializer:s=>i._?vd("Already initialized"):n.push(wd(s||null))}),fv=(t,e)=>av(e,bd("metadata"),t[3]),hv=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},pv=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&ov(n,i));lv(n,i);for(var h=r.length-1;h>=0;h--)c=dv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,wd(o)&&(n=o);return fv(t,n),p&&ga(n,i,p),u?l^4?s:p:n},_d,ma,xd;const kd=t=>{if(!t)return null;try{return t.split(".").reduce((e,i)=>e==null?e:e[i],globalThis)}catch{return null}},Sd=(t,e,i)=>{if(/^https?:\/\//i.test(t))return t;const r=o=>o.endsWith("/")?o:o+"/";if(/^https?:\/\//i.test(e)){const o=r(e);return new URL(t,o).href}const n=(()=>{try{return new URL(i).href}catch{return new URL(i,location.origin).href}})(),s=new URL(r(e),n).href;return new URL(t,s).href};_d=[xe(["storage","preferences","resourceLoader","$"])];let Zn=(Pt=class extends(xd=Ue){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(Pt.REGISTRY_INFO_STORAGE_NAME,Pt.REGISTRY_INFO_CACHE_TTL,1,"indexedDB")}async start(){this._installUserPlugins(),this._checkAprilFool(),this._injectPreferenceUI()}async _checkAprilFool(){const e=new Date;if(e.getMonth()!==3||e.getDate()!==1)return;const i=e.getFullYear(),r=`InPageEdit:april-fool-auto/${i}`;if(localStorage.getItem(r))return;const n=xt.PLUGIN_REGISTRY_URL,s=`april-fool-${i}`;try{if(!(await this.getRegistryInfo(n,"online_manifest",!0))?.packages?.some(c=>c.id===s)){this.logger.debug("No april fool plugin found in the official registry");return}const a=await this.installAndSetPreference(n,s,"online_manifest","new-added");localStorage.setItem(r,"1")}catch{}}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 yd(e,Ly(()=>Promise.resolve().then(()=>r0)))}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:r})=>{const n=f("div",{id:"ipe-plugin-store-preferences-vue"}),s=await this._createManagementApp();return s.mount(n),r(()=>{s.unmount(),this.ctx.logger.debug("Plugin Store preferences app unmounted")}),f("section",{children:n})}}),e.preferences.registerCustomConfig("plugin-store",A.object({"pluginStore.registries":A.array(A.string()).default([xt.PLUGIN_REGISTRY_URL]).description(i`Registry URLs`).hidden(),"pluginStore.cdnForNpm":A.string().description(i`CDN to install packages from npm`).default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? "@" + version : "" }}').hidden(),"pluginStore.plugins":A.array(A.object({source:A.union(["online_manifest","npm"]).default("online_manifest"),registry:A.string().required(),id:A.string().required()})).description(i`Installed plugins`).default([]).hidden()}),"plugin-store")}async showModal(){const e=this.ctx.modal.show({title:$`Plugin Store`,sizeClass:"small"}),i=f("section",{id:"ipe-plugin-store-vue"});e.setContent(i);const r=await this._createManagementApp();return r.mount(i),e.on(e.Event.Close,()=>{r.unmount()}),e}async install(e,i,r="online_manifest",n="new-added"){const s=await this.getRegistryInfo(e,r);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 c=await a;return c&&this.ctx.emit("plugin-store/plugin-installed",{ctx:this.ctx,registry:s,id:i,by:n}),c}async uninstall(e,i){const r=this._installedPlugins.get(`${e}#${i}`);if(r===void 0)return!0;this._installedPlugins.delete(`${e}#${i}`);const n=await r;if(n){const s=n.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 r=await this.ctx.preferences.get("pluginStore.plugins")||[];return r.some(s=>s.registry===e&&s.id===i)||(r.push({registry:e,id:i}),await this.ctx.preferences.set("pluginStore.plugins",r)),!0}async removeFromPreferences(e,i){let r=await this.ctx.preferences.get("pluginStore.plugins")||[];return r=r.filter(n=>n.registry!==e||n.id!==i),await this.ctx.preferences.set("pluginStore.plugins",r),!0}async installAndSetPreference(e,i,r="online_manifest",n="new-added"){const s=await this.install(e,i,r,n);return s&&await this.addToPreferences(e,i),s}async uninstallAndRemovePreference(e,i){return await this.removeFromPreferences(e,i),this.uninstall(e,i)}async _installOneByRegistryInfo(e,i,r){const n=i.base_url,s=i.packages.find(h=>h.id===r);if(!s)return this.ctx.logger.warn(`Package ${r} not found in registry ${e}`),null;const o=s.loader,{kind:a,entry:c="index.js",styles:l=[],main_export:u=null}=o;let d=null;if(a!=="styles"){if(!c)return this.ctx.logger.warn(`Entry url missing for ${r}`,o),null;try{d=Sd(c,n,e)}catch(h){return this.ctx.logger.warn(`Failed to resolve entry "${c}" with base "${n}" and registry "${e}"`,h),null}}const m={"data-plugin-registry":e,"data-plugin-id":r};let p=null;switch(a){case"autoload":{p=this.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${r}`,apply:h=>{d&&h.resourceLoader.loadScript(d,{...m})}});break}case"module":{if(!d)return this.ctx.logger.warn(`Entry url missing for module kind, package ${r}`),null;const h=await import(d).then(_=>(u?_[u]:_.default)??_);if(!h)return this.ctx.logger.warn(`Main export ${u} not found in module ${d}`),null;p=this.ctx.plugin(h);break}case"umd":{let h=kd(u);if(!h){if(!d)return this.ctx.logger.warn(`Entry url missing for umd kind, package ${r}`),null;await this.ctx.resourceLoader.loadScript(d,{...m}),h=kd(u)}if(!h)return this.ctx.logger.warn(`Main export ${u} not found on globalThis after loading ${d}`),null;p=this.ctx.plugin(h);break}}if(l&&l.length>0){let h=[];try{h=l.map(_=>Sd(_,n,e)).filter(Boolean)}catch(_){this.ctx.logger.warn(`Failed to resolve styles for ${r}`,l,_)}p||(p=this.ctx.plugin({name:`plugin-store-${e}-${r}`,apply(){}})),p.ctx.plugin({inject:["resourceLoader"],name:`plugin-store-${e}-${r}-styles`,apply:_=>{h.forEach(k=>_.resourceLoader.loadStyle(k,{...m})),_.on("dispose",()=>{try{h.forEach(k=>_.resourceLoader.removeStyle(k))}catch{}})}})}return p}validateRegistry(e){return Jn.Registry(e)}async getRegistryInfo(e,i="online_manifest",r=!1){try{let s;if(i==="online_manifest")s=await this._fetchOnlineRegistryInfo(e,r),this.logger.debug("Fetched registry info from online manifest",s),this.setRegistryCache(e,s);else throw new Error(`Unsupported registry source: ${i}`);return s}catch(s){this.ctx.logger.warn("Failed to fetch registry info",s)}const n=await this.getRegistryCache(e);if(!n)throw this.ctx.emit("plugin-store/registry-not-found",{ctx:this.ctx,registryUrl:e}),new Error(`Failed to fetch registry info: ${e}`);return n}async _fetchOnlineRegistryInfo(e,i=!1){if(!i&&this._onlineRegistryQueries.has(e))return await this._onlineRegistryQueries.get(e);const n=(async()=>{const s={method:"GET"};i&&(s.cache="no-store");const a=await(await fetch(e,s)).json(),c=this.validateRegistry(a);return this.ctx.emit("plugin-store/registry-fetched",{ctx:this.ctx,registry:c}),c})();return this._onlineRegistryQueries.set(e,n),await n}async getRegistryCache(e){const i=await this.regInfoDB.get(e);if(i)try{return this.validateRegistry(i)}catch(r){this.ctx.logger.warn("Invalid cached registry",r,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(n=>this.refreshRegistryCache(n))),r={};for(const[n,s]of i.entries())s.status==="fulfilled"?r[e[n]]=s.value:r[e[n]]=null;return r}},Pt.PluginStoreSchemas=Jn,Pt.REGISTRY_INFO_CACHE_TTL=1e3*60*60*24,Pt.REGISTRY_INFO_STORAGE_NAME="plugin-store-registry",Pt.REGISTRY_ETAG_STORAGE_NAME="psreg-etag",Pt);ma=cv(xd),Zn=pv(ma,0,"PluginPluginStore",_d,Zn),hv(ma,1,Zn);const gv=Object.freeze(Object.defineProperty({__proto__:null,PluginPluginStore:Zn},Symbol.toStringTag,{value:"Module"})),ct='@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;color:var(--schema-color-fg)}.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}.keyshortcut-wrap{display:flex;gap:.5em;align-items:center}.keyshortcut-btn{padding:6px 8px;font-size:1em}.keyshortcut-btn.recording{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent;animation:keyshortcut-pulse .5s ease-in-out infinite}@keyframes keyshortcut-pulse{0%,to{opacity:1}50%{opacity:.6}}',Ed={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Se=(t,e)=>{customElements.get(t)||customElements.define(t,e)},mv=(t,e,i)=>{if(!e.length)return;let r=t,n=null,s=null;for(let a=0;a<e.length-1;a++){const c=e[a];let l=r?.[c];l==null?(l=typeof e[a+1]=="number"?[]:{},r[c]=l):typeof l!="object"&&(l=typeof e[a+1]=="number"?[]:{},r[c]=l),n=r,s=c,r=l}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(n)n[s]=a,r=a;else return}try{r[o]=i}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=i,n&&(n[s]=a)}catch{}}},Hr=t=>t.map(String).join("."),yv=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),pi=t=>`schema_${yv(Hr(t)||"root")}`,Ci=t=>Hr(t),ne=(t,...e)=>{const i=new Set(e);i.size&&t.setAttribute("part",Array.from(i).join(" "))},bv=["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 ya(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}default:return e}}function $d(t){return typeof t=="function"&&!!t?.type}function Pd(t){if(!t)throw new Error("schema is required");if($d(t))return t;try{const e=Schema.from(t);if($d(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 mt(t){return t?.meta??{}}function vv(t){return t.length>0&&t.every(e=>e?.type==="const")}function Ii(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const r=e.type;try{const n=t();if(n!==void 0)return n}catch{}switch(r){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 n=e.list||[];return n.length?Ii(n[0]):void 0}case"const":return e.value;case"date":return;case"intersect":{const n=e.list||[],s=(a,c)=>{if(Array.isArray(a)&&Array.isArray(c))return c.slice();if(a&&c&&typeof a=="object"&&typeof c=="object"){const l={...a};for(const u of Object.keys(c))l[u]=u in l?s(l[u],c[u]):c[u];return l}return c??a};let o={};for(const a of n)o=s(o,Ii(a));return o}default:return}}class $t extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Ed,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ct,this.$root.appendChild(e)}makeFieldContainer(e,i){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Hr(this._path)),ne(r,"field",`field-${e}`),this._label){const n=document.createElement("label");n.className="label",n.textContent=this._label,ne(n,"field-label"),r.appendChild(n)}if(i&&i!==this._label){const n=document.createElement("div");n.className="helper",n.textContent=i,ne(n,"field-helper"),r.appendChild(n)}return r}set schema(e){this._schema=Pd(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}}))}}const Oi=class Oi extends $t{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>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",ne(r,"field-input","field-input-text"),r.type="text",r.name=Ci(this._path),r.id=pi(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(ya("string",r.value));const n=i.querySelector("label.label");if(n&&(n.htmlFor=r.id),e.role==="keyshortcut"){const s=document.createElement("div");s.className="keyshortcut-wrap";const o=document.createElement("button");o.type="button",o.className="btn keyshortcut-btn",o.title="Record shortcut",o.textContent="⌨";let a=null;const c=()=>{a&&(a(),a=null,o.classList.remove("recording"),o.title="Record shortcut",Oi.recEnd===c&&(Oi.recEnd=null))};o.onclick=()=>{if(a){c();return}Oi.recEnd?.(),Oi.recEnd=c,o.classList.add("recording"),o.title="Press your keys! (Esc to cancel)";const l=u=>{if(u.preventDefault(),u.stopPropagation(),u.key==="Escape"){c();return}const d=[];u.ctrlKey&&d.push("ctrl"),u.metaKey&&d.push("meta"),u.altKey&&d.push("alt"),u.shiftKey&&d.push("shift");const m=u.key.toLowerCase();if(["control","meta","alt","shift"].includes(m))return;d.push(m);const p=d.join("-"),h=r.value.trimEnd();h.toLowerCase().split(/\s*,\s*/).includes(p)||(r.value=h?h.replace(/,+$/,"")+", "+p:p,this.emitChange(r.value)),c()};document.addEventListener("keydown",l,{capture:!0}),a=()=>document.removeEventListener("keydown",l,{capture:!0})},s.appendChild(r),s.appendChild(o),i.appendChild(s)}else i.appendChild(r);this.$root.appendChild(i)}};Oi.recEnd=null;let es=Oi;Se("schema-form-string",es);class Cd extends $t{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>${ct}</style>`;const e=this._schema?.type??"number",i=mt(this._schema),r=this.makeFieldContainer("number",i.description),n=document.createElement("input");this.$input=n,n.className="input",ne(n,"field-input","field-input-number"),n.name=Ci(this._path),n.id=pi(this._path),i?.min!=null&&(n.min=String(i.min)),i?.max!=null&&(n.max=String(i.max)),i?.step!=null&&(n.step=String(i.step)),e==="percent"&&!n.step&&(n.step="0.01"),n.value=this._value??"",n.oninput=()=>this.emitChange(ya(e,n.value));const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),i.role==="slider"?n.type="range":n.type="number",r.appendChild(n),this.$root.appendChild(r)}}Se("schema-form-number",Cd);class Id extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox",ne(r,"field-checkbox");const n=document.createElement("input");n.type="checkbox",n.checked=!!this._value,n.name=Ci(this._path),n.id=pi(this._path),ne(n,"field-input","field-input-checkbox");const s=document.createElement("span");s.textContent=e.description??this._label??"",ne(s,"field-checkbox-text"),n.onchange=()=>this.emitChange(n.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=n.id),r.append(n,s),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-boolean",Id);function ts(t){return String(t).padStart(2,"0")}function zr(t){return`${t.getFullYear()}-${ts(t.getMonth()+1)}-${ts(t.getDate())}`}function ba(t){return`${ts(t.getHours())}:${ts(t.getMinutes())}`}function is(t){return`${zr(t)}T${ba(t)}`}class Ad extends $t{render(){if(this.$input&&this.$root.contains(this.$input)){const o=!!this.$root.querySelector("label.label");if(!(this._label&&!o)){const a=mt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)a==="date"?this.$input.value=zr(this._value):a==="time"?this.$input.value=ba(this._value):a==="datetime"&&(this.$input.value=is(this._value));else if(typeof this._value=="string"&&a!=="time"){const c=new Date(this._value);isNaN(+c)||(a==="date"?this.$input.value=zr(c):a==="datetime"&&(this.$input.value=is(c)))}else this._value||(this.$input.value="");return}}this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input",ne(r,"field-input","field-input-date");const n=e.role||"date";if(n==="datetime"?r.type="datetime-local":n==="time"?r.type="time":r.type="date",r.name=Ci(this._path),r.id=pi(this._path),this._value instanceof Date)n==="date"?r.value=zr(this._value):n==="time"?r.value=ba(this._value):n==="datetime"&&(r.value=is(this._value));else if(typeof this._value=="string"&&n!=="time"){const o=new Date(this._value);isNaN(+o)||(n==="date"?r.value=zr(o):n==="datetime"&&(r.value=is(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-date",Ad);class va extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(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),ne(o,"field-const-value"),this.$root.appendChild(o);return}}const r=this.makeFieldContainer("const",e.description),n=document.createElement("section");n.className="const content",n.textContent=String(i),n.id=pi(this._path),ne(n,"field-const-value");const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),r.appendChild(n),this.$root.appendChild(r)}}Se("schema-form-const",va);class Rd extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("intersect",e.description);i.classList.remove("field");const r=document.createElement("div");r.classList.add("group"),ne(r,"field-group");const n=this._schema.list||[],s=n.length>0&&n.every(a=>a?.type==="object"),o=(a,c)=>{if(Array.isArray(a)&&Array.isArray(c))return c.slice();if(a&&c&&typeof a=="object"&&typeof c=="object"){const l={...a};for(const u of Object.keys(c))l[u]=u in l?o(l[u],c[u]):c[u];return l}return c??a};if(s){const a=this._value&&typeof this._value=="object"?this._value:{};n.forEach((c,l)=>{const u=c?.meta?.description??"",d=gi(c,this._path,a,u,this._i18n);d.addEventListener("change",m=>{m.stopPropagation();const p=o(this._value??{},m.detail.value);this.emitChange(p)}),r.appendChild(d)})}else{const a=n[n.length-1],c=gi(a,this._path,this._value,this._label,this._i18n);c.addEventListener("change",l=>{l.stopPropagation(),this.emitChange(l.detail.value)}),r.appendChild(c)}i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-intersect",Rd);function wv(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 gi(t,e,i,r,n){const s=wv(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,n&&(o.i18n=n),o.setValue?.(i),o.setAttribute("exportparts",bv),o}class Td extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(vv(r)){const n=document.createElement("select");n.className="input",ne(n,"field-input","field-input-select"),n.name=Ci(this._path),n.id=pi(this._path),r.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),n.appendChild(a)}),n.onchange=()=>this.emitChange(ya("string",n.value));const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n)}else{const n=document.createElement("div");n.className="toolbar",ne(n,"field-toolbar");const s=document.createElement("select");s.className="input",ne(s,"field-input","field-input-select","field-toolbar-select"),s.name=Ci(this._path)+".__type",s.id=pi(this._path)+"__type";let o=0;r.forEach((u,d)=>{const m=document.createElement("option");m.value=String(d),m.textContent=String(u.meta?.description||u.value||u.type),s.appendChild(m)}),s.onchange=()=>{o=Number(s.value);const u=r[o],d=Ii(u);this.emitChange(d),l()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),n.appendChild(s),i.appendChild(n);const c=document.createElement("div");c.className="group",ne(c,"field-group");const l=()=>{c.innerHTML="";const u=r[o],d=gi(u,this._path,this._value,this._label);d instanceof va||(d.addEventListener("change",m=>{m.stopPropagation(),this.emitChange(m.detail.value)}),c.appendChild(d))};l(),i.appendChild(c)}this.$root.appendChild(i)}}Se("schema-form-union",Td);class Od extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=gi(s,[...this._path,o],n[o],`${this._label??""}[${o}]`);a.addEventListener("change",c=>{c.stopPropagation();const l=Array.isArray(this._value)?this._value.slice():[];l[o]=c.detail.value,this.emitChange(l)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-tuple",Od);class Ld extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.dict||{};Object.keys(n).forEach(s=>{if(n[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=gi(n[s],[...this._path,s],o,s);a.addEventListener("change",c=>{c.stopPropagation();const l={...this._value??{}};l[s]=c.detail.value,this.emitChange(l)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}Se("schema-form-object",Ld);const ws=class ws extends $t{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+ws._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(r=>{const n=r.dataset.uid;n&&(i[n]=r.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(r=>{const n=r.dataset.uid;if(!n)return;const s=i[n];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,c=s.top-o.top;(a||c)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${c}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(l,u)=>{r.innerHTML="",s().forEach((d,m)=>{const p=[...this._path,m],h=document.createElement("div");h.className="row schema-collection-row",ne(h,"field-row","collection-row");const _=this._itemIds[m];h.dataset.uid=_,h.setAttribute("data-path",Hr(p));const k=gi(n,p,d,`${this._label??""}[${m}]`);k.addEventListener("change",w=>{w.stopPropagation();const S=s().slice();S[m]=w.detail.value,this._value=S,this.emitChange(S)});const P=document.createElement("div");P.className="actions",ne(P,"field-actions");const b=document.createElement("button");b.type="button",b.className="btn",ne(b,"field-button","field-button-secondary"),b.textContent=this._i18n.arrayMoveUp??"↑",b.onclick=()=>{if(m<=0)return;const w=this.capturePositions(r),S=s().slice();[S[m-1],S[m]]=[S[m],S[m-1]],[this._itemIds[m-1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m-1]],this._value=S,o(w),this.emitChange(S)};const y=document.createElement("button");y.type="button",y.className="btn",ne(y,"field-button","field-button-secondary"),y.textContent=this._i18n.arrayMoveDown??"↓",y.onclick=()=>{const w=s();if(m>=w.length-1)return;const S=this.capturePositions(r),I=w.slice();[I[m+1],I[m]]=[I[m],I[m+1]],[this._itemIds[m+1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m+1]],this._value=I,o(S),this.emitChange(I)};const g=document.createElement("button");g.type="button",g.className="btn danger",ne(g,"field-button","field-button-danger"),g.textContent=this._i18n.arrayRemove??"×",g.onclick=()=>{h.classList.add("leaving");const w=250;let S=!1;const I=()=>{if(S)return;S=!0,clearTimeout(F);const N=s().filter((K,qe)=>qe!==m);this._itemIds.splice(m,1);const G=this.capturePositions(r);this._value=N,o(G),this.emitChange(N)};h.addEventListener("transitionend",I,{once:!0});const F=setTimeout(I,w+80)},P.append(b,y,g),h.appendChild(k),h.appendChild(P),r.appendChild(h),u&&u===_&&(h.classList.add("enter"),requestAnimationFrame(()=>{h.classList.add("enter-active")}),requestAnimationFrame(()=>{h.classList.remove("enter")}))}),l&&this.playFLIP(r,l)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",ne(a,"field-button","field-button-primary"),a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const l=this.capturePositions(r),u=s().slice(),d=Ii(n);u.push(d);const m=this.generateItemId();this._itemIds.push(m),this._value=u,o(l,m),this.emitChange(u)};const c=document.createElement("div");c.className="actions",ne(c,"field-actions"),c.appendChild(a),i.appendChild(r),i.appendChild(c),this.$root.appendChild(i)}};ws._idCounter=0;let rs=ws;Se("schema-form-array",rs);class Nd extends $t{render(){this.$root.innerHTML=`<style>${ct}</style>`;const e=mt(this._schema),i=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group",ne(r,"field-group");const n=this._schema.inner,s=this._value??{},o=m=>`d_${m}`,a=()=>{const m={};return r.querySelectorAll(".kv").forEach(p=>{const h=p.dataset.uid;h&&(m[h]=p.getBoundingClientRect())}),m},c=m=>{r.querySelectorAll(".kv").forEach(p=>{const h=p.dataset.uid;if(!h)return;const _=m[h];if(!_)return;const k=p.getBoundingClientRect(),P=_.left-k.left,b=_.top-k.top;(P||b)&&(p.style.transition="none",p.style.transform=`translate(${P}px, ${b}px)`,requestAnimationFrame(()=>{p.style.transition="transform .25s ease",p.style.transform=""}))})},l=(m,p)=>{r.innerHTML="",Object.keys(s).forEach(h=>{const _=[...this._path,h],k=document.createElement("div");k.className="kv schema-collection-row",ne(k,"field-row","collection-row"),k.dataset.uid=o(h),k.setAttribute("data-path",Hr(_));const P=document.createElement("input");P.className="input",ne(P,"field-input","field-input-text"),P.value=h,P.name=Ci(_)+".__key",P.id=pi(_)+"__key";const b=gi(n,_,s[h],`${this._label??""}[${h}]`),y=document.createElement("button");y.type="button",y.className="btn danger",ne(y,"field-button","field-button-danger"),y.textContent=this._i18n.dictRemove??"×",y.onclick=()=>{const g=a();delete s[h];const w={...this._value??{}};delete w[h],this._value=w,l(g),this.emitChange(w)},P.onchange=()=>{const g=P.value.trim();if(!g||g===h||s[g]!==void 0)return;const w=a();s[g]=s[h],delete s[h];const S={...this._value??{}};S[g]=S[h],delete S[h],this._value=S,l(w),this.emitChange(S)},b.addEventListener("change",g=>{g.stopPropagation();const w={...this._value??{}};w[h]=g.detail.value,this._value=w,this.emitChange(w)}),k.append(P,b,y),r.appendChild(k),p===h&&(k.classList.add("enter"),requestAnimationFrame(()=>k.classList.add("enter-active")),requestAnimationFrame(()=>k.classList.remove("enter")))}),m&&c(m)};l();const u=document.createElement("button");u.type="button",u.className="btn primary",ne(u,"field-button","field-button-primary"),u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let m=Object.keys(s).length+1,p=`k${m}`;for(;s[p]!==void 0;)p=`k${++m}`;const h=a();s[p]=Ii(n);const _={...this._value??{},[p]:s[p]};this._value=_,l(h,p),this.emitChange(_)};const d=document.createElement("div");d.className="actions",ne(d,"field-actions"),d.appendChild(u),i.appendChild(r),i.appendChild(d),this.$root.appendChild(i)}}Se("schema-form-dict",Nd);class Md extends HTMLElement{constructor(){super(),this._i18n={...Ed},this._i18nCommitted=!1,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ct,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",ne(i,"wrapper");const r=document.createElement("form");r.className="form",ne(r,"form"),i.appendChild(r),this.$root.appendChild(i),this.addEventListener("change",n=>{if(!n?.detail)return;const{path:s,value:o}=n.detail;Array.isArray(s)&&s.length===0?this._state=o:mv(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=Pd(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Ii(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 r=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=r,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=Ii(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=gi(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}Se("schema-form",Md);function _v(){Se("schema-form",Md),Se("schema-form-string",es),Se("schema-form-number",Cd),Se("schema-form-boolean",Id),Se("schema-form-date",Ad),Se("schema-form-const",va),Se("schema-form-union",Td),Se("schema-form-tuple",Od),Se("schema-form-object",Ld),Se("schema-form-array",rs),Se("schema-form-dict",Nd),Se("schema-form-intersect",Rd)}const xv=$i({__name:"SchemasteryFormVue",props:vu({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:vu(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const r=$u(t,"schema"),n=$u(t,"value"),s=i,o=hu("elRef");let a=!1,c=!1;const l=u=>{if(c)return;const d=o.value,m=t.validateOnChange?d.getData({validate:!0}):u.detail.state;a=!0,n.value=m,Ar(()=>{a=!1}),s("change",u.detail)};return yu(()=>{_v()}),Nr(()=>{const u=o.value;r.value&&(u.schema=r.value),n.value!==void 0&&u.setData(n.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",l)}),Vo(()=>{o.value?.removeEventListener("form-change",l)}),Qi(r,u=>{a||o.value&&u&&o.value.schema!==u&&(c=!0,o.value.schema=u,Ar(()=>{c=!1}))},{deep:!0,immediate:!0}),Qi(n,u=>{if(a||!o.value||u===void 0)return;const d=o.value.getData({validate:!1});JSON.stringify(d)!==JSON.stringify(u)&&(c=!0,o.value.setData(u,{validate:!1}),Ar(()=>{c=!1}))},{deep:!0,immediate:!0}),e({setData(u,d){const m=o.value;m.setData(u,{validate:!!d?.validate}),d?.emit&&(n.value=m.getData({validate:!!d?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,d=!0){o.value.schema=u,d&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,d)=>(de(),ve("schema-form",Gu({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function Ai(t,e=new WeakMap){if(De(t))return Ai(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 n=new Map;return e.set(t,n),Array.from(t.entries()).forEach(([s,o])=>{n.set(s,Ai(o,e))}),n}if(t instanceof Set){const n=new Set;return e.set(t,n),Array.from(t).forEach(s=>{n.add(Ai(s,e))}),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(const s of t)n.push(Ai(s,e));return n}const i=oe(t),r={};e.set(t,r);for(const n of Object.keys(i))r[n]=Ai(i[n],e);for(const n of Object.getOwnPropertySymbols(i))r[n]=Ai(i[n],e);return r}const wa=()=>{},kv={id:"preferences-ui-app"},Sv={class:"tabbar"},Ev={class:"tabbar-tabs"},$v=["onClick","data-value"],Pv={class:"tabbar-content"},Cv={key:0},Iv={style:{"max-height":"20em",overflow:"auto"}},Av=$i({__name:"PreferencesApp",setup(t,{expose:e}){const i=pa(),r=!1,n=eu([]),s=Qe([]),o=Qe(""),a=Bt(()=>s.value.find(h=>h.name===o.value)||null),c=Bt(()=>{const h=n.value.filter(_=>_.category===o.value).map(_=>_.schema);return h.length===0?null:A.intersect(h)}),l=Bt(()=>a.value&&typeof a.value.autoGenerateForm=="boolean"?a.value.autoGenerateForm:!0),u=Qe({});e({getValue(){return Ai(u)},mergeValue(h){u.value={...u.value,...h}},selectTab(h){o.value=h}}),Nr(async()=>{i.inject(["preferences"],async h=>{const _=await h.preferences.getAll();u.value=_,s.value=h.preferences.getConfigCategories(),n.value=h.preferences.getConfigRegistries(),o.value=s.value[0].name})});const d=(h,_)=>{h.preventDefault(),o.value=_;const k=h.currentTarget;k&&k.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},m=hu("customRenderContainerRef"),p=Qe([]);return Go(()=>{p.value.forEach(h=>h()),p.value=[]}),Qi(a,async h=>{p.value.forEach(k=>k()),p.value=[],await Ar();const _=m.value;if(_&&(_.innerText="",h&&typeof h.customRenderer=="function")){let k=wa;const P=g=>{k=g},b=g=>{p.value.push(g)},y=await h.customRenderer({ctx:i,onMounted:P,onUnmount:b});y&&(_.appendChild(y),k?.(_))}},{immediate:!0,deep:!1}),(h,_)=>(de(),ve("div",kv,[ie("div",Sv,[ie("div",Ev,[(de(!0),ve(We,null,Qo(s.value,k=>(de(),ve("a",{class:kt(["tab",{active:o.value===k.name}]),key:k.name,onClick:P=>d(P,k.name),"data-value":k.name},ye(k.label),11,$v))),128))]),ie("div",Pv,[a.value&&a.value.customRenderer?(de(),ve("div",{class:"custom-render-container",ref_key:"customRenderContainerRef",ref:m,key:o.value})):fi("",!0),l.value&&c.value?(de(),Vn(Oe(xv),{class:"auto-schema-form",key:o.value,"data-category":o.value,schema:c.value,value:u.value,"onUpdate:value":_[0]||(_[0]=k=>u.value={...u.value,...k}),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["data-category","schema","value"])):fi("",!0)])]),Oe(r)?(de(),ve("details",Cv,[ie("pre",Iv,ye(u.value),1)])):fi("",!0)]))}}),ns=(t,e)=>{const i=t.__vccOpts||t;for(const[r,n]of e)i[r]=n;return i},Rv=ns(Av,[["__scopeId","data-v-775e2739"]]);var Tv=Object.create,_a=Object.defineProperty,Ov=Object.getOwnPropertyDescriptor,Dd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),jd=t=>{throw TypeError(t)},Lv=(t,e,i)=>e in t?_a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Nv=(t,e)=>_a(t,"name",{value:e,configurable:!0}),Mv=t=>[,,,Tv(t?.[Dd("metadata")]??null)],Dv=["class","method","getter","setter","accessor","field","value","get","set"],Ud=t=>t!==void 0&&typeof t!="function"?jd("Function expected"):t,jv=(t,e,i,r,n)=>({kind:Dv[t],name:e,metadata:r,addInitializer:s=>i._?jd("Already initialized"):n.push(Ud(s||null))}),Uv=(t,e)=>Lv(e,Dd("metadata"),t[3]),Fv=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},qv=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Ov(n,i));Nv(n,i);for(var h=r.length-1;h>=0;h--)c=jv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Ud(o)&&(n=o);return Uv(t,n),p&&_a(n,i,p),u?l^4?s:p:n},Fd,xa,qd;Fd=[xe(["preferences","modal","$","$$"])];class ss extends(qd=Ue){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,this._modal=null,this._form=null,e.set("preferencesUI",this);const i=e.$,r=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:r`prefs.about.label`,description:r`prefs.about.description`,index:99,customRenderer:()=>f("section",{className:"theme-ipe-prose",children:[f("h2",{children:"✏️ InPageEdit NEXT"}),f("p",{children:r`prefs.about.intro`}),f("h3",{children:r`prefs.about.portals.header`}),f("ul",{children:[f("li",{children:f("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",children:r`prefs.about.portals.officialwebsite`})}),f("li",{children:f("a",{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version.split("-")[0]}`,target:"_blank",children:r`prefs.about.portals.updatelogs`})})]}),f("h3",{children:r`prefs.about.joinus.header`}),f("ul",{children:[f("li",{children:[f("strong",{children:r`prefs.about.joinus.github`}),":"," ",f("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:`${this.ctx.Endpoints.GITHUB_OWNER}/${this.ctx.Endpoints.GITHUB_REPO}`})]}),f("li",{children:[f("strong",{children:r`prefs.about.joinus.qqgroup`}),": ",this.ctx.Endpoints.QQ_GROUP_ID]})]}),f("hr",{}),f("p",{style:{textAlign:"center"},children:r`prefs.about.copyright`}),f("hr",{})]})}),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("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(()=>p0).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:f(bi,{children:f(_i,{})})});i.get$window().classList.add("dialog");const r=f("div",{id:"ipe-preferences-app",style:{minHeight:"calc(85dvh - var(--ipe-modal-spacing) * 2)"}});i.setContent(r),this.ctx.emit("preferences-ui/modal-shown",{ctx:this.ctx,modal:i});const n=this.createPreferencesUIApp(),s=n.mount(r);return this._form=s,this.ctx.emit("preferences-ui/vue-app-mounted",{ctx:this.ctx,app:n,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:f("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"),n.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 yd(this.ctx,Rv)}}xa=Mv(qd),ss=qv(xa,0,"PluginPreferencesUI",Fd,ss),Fv(xa,1,ss);const Bv=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return ss}},Symbol.toStringTag,{value:"Module"})),Hv=Symbol("@@apply"),zv=Symbol("@@ctor");function Bd(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[Hv]=i,i[zv]=t;const r=t?.constructor?.name;return r&&(i[Symbol.toStringTag]=r),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 os={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},ka=t=>{const{type:e="default",title:i,content:r,closeable:n=!0,titleProps:s,contentProps:o,children:a,...c}=t;let l=i;typeof i>"u"&&e!=="default"&&(l=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!d)return Promise.resolve();const{promise:m,resolve:p}=_r();return d.animate([{opacity:"1",height:d.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{d.remove(),p()}),m},d=f("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${os.mbox}`,...c,children:[l&&f("div",{className:`ipe-mbox-title ${os.title}`,...s,children:l}),f("div",{className:`ipe-mbox-content ${os.content}`,...o,children:a||r}),n&&f("a",{onClick:u,className:`ipe-mbox-close ${os.close}`,children:"×"})]});return d.close=u,d},as=t=>{const{label:e,id:i,name:r,value:n,placeholder:s,disabled:o,required:a,labelProps:c,inputProps:l,children:u,...d}=t;return f("div",{className:"theme-ipe ipe-input-box",...d,children:[f("label",{htmlFor:i,style:{display:"block"},...c,children:[e,a&&f(bi,{children:[" ",f("span",{className:"required",children:"*"})]})]}),u??f("input",{id:i,name:r,value:n,disabled:o,placeholder:s,required:a,style:{width:"100%"},...l})]})},Wv=t=>{const{id:e,name:i,value:r,label:n,inputProps:s,labelProps:o,children:a,...c}=t;return f("label",{className:"theme-ipe ipe-radio-box",...c,children:[f("input",{type:"radio",id:e,name:i,value:r,...s}),f("span",{className:"ipe-checkbox-box"}),f("span",{...o,children:n||a})]})},Ri=t=>{const{id:e,name:i,label:r,checked:n,inputProps:s,labelProps:o,children:a,...c}=t;return f("label",{className:"theme-ipe ipe-checkbox",...c,children:[f("input",{type:"checkbox",id:e,name:i,checked:n,...s}),f("span",{className:"ipe-checkbox-box"}),f("span",{...o,children:r||a})]})},Kv=(t=0)=>new Promise(e=>setTimeout(e,t)),Hd=t=>f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),f("path",{d:"M13.5 6.5l4 4"}),f("path",{d:"M19 16l-2 3h4l-2 3"})]});var Vv=Object.create,Sa=Object.defineProperty,Gv=Object.getOwnPropertyDescriptor,zd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wd=t=>{throw TypeError(t)},Qv=(t,e,i)=>e in t?Sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Yv=(t,e)=>Sa(t,"name",{value:e,configurable:!0}),Xv=t=>[,,,Vv(t?.[zd("metadata")]??null)],Jv=["class","method","getter","setter","accessor","field","value","get","set"],Kd=t=>t!==void 0&&typeof t!="function"?Wd("Function expected"):t,Zv=(t,e,i,r,n)=>({kind:Jv[t],name:e,metadata:r,addInitializer:s=>i._?Wd("Already initialized"):n.push(Kd(s||null))}),ew=(t,e)=>Qv(e,zd("metadata"),t[3]),tw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},iw=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Gv(n,i));Yv(n,i);for(var h=r.length-1;h>=0;h--)c=Zv(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Kd(o)&&(n=o);return ew(t,n),p&&Sa(n,i,p),u?l^4?s:p:n},Vd,Ea,Gd;Vd=[xe(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences","$"]),Ot(A.object({"quickEdit.editSummary":A.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":A.boolean().description('Default to checking "minor edit" option').default(!1),"quickEdit.outSideClose":A.boolean().description("Close editor modal by clicking outside").default(!0),"quickEdit.watchList":A.union([A.const(_t.preferences).description("Follow MW preferences"),A.const(_t.nochange).description("Keep the current watchlist status"),A.const(_t.watch).description("Add the page to watchlist"),A.const(_t.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(_t.preferences),"quickEdit.keyshortcut.save":A.string().default("ctrl-s").role("keyshortcut").description("save button key shortcut (blank to disable)"),"quickEdit.editFont":A.union([A.const("preferences").description("Follow MW preferences"),A.const("monospace").description("Monospace"),A.const("sans-serif").description("Sans-serif"),A.const("serif").description("Serif"),A.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 ls=(Li=class extends(Gd=Ue){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",Bd(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),w=this.ctx.currentPage.wikiTitle;e={...e,title:w?.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 r=await this.ctx.preferences.get("quickEdit.outSideClose"),n=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(),c={...this.DEFAULT_OPTIONS,editSummary:s,editMinor:o,...e};c.editSummary||(c.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:c});const l=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:r}).init();l.setTitle(f(bi,{children:["Loading: ",f("u",{children:c.title})]})),l.setContent(f("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:f(_i,{})})),l.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:i`Cancel`,method(){l.close()}}),l.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:l,options:c});let u;try{if(u=await this.getWikiPageFromPayload(c),u.pageInfo.special)throw new Error(i`Special page is not editable.`)}catch(g){l.off(l.Event.Close),l.close(),this.ctx.modal.notify("error",{content:g instanceof Error?g.message:String(g)});return}const d=c.section==="new"?"":u.revisions[0]?.content||"",m=u.revisions[0]?.revid,p=m&&m!==u.lastrevid,h=c.section==="new",_=u.pageid===0;l.setTitle(f(bi,{children:[h?i`New Section`:i`Quick ${_?"Create":"Edit"}`,": ",f("u",{children:u.pageInfo.title}),p?` (${i`Revision`} ${m})`:""]}));const k=[];_&&k.push(f(ka,{title:i`Attention`,type:"important",children:f("p",{children:i`This page does not exist.`})})),p&&k.push(f(ka,{title:i`Attention`,type:"warning",children:f("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:c,modal:l,wikiPage:u,editNotices:k});const P=f("form",{className:"ipe-quickEdit__form",children:[f("div",{className:"ipe-quickEdit__notices",children:k}),f("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c.section==="new"&&f(bi,{children:f(as,{label:i`Section title`,id:"summary",name:"summary",value:"",inputProps:{placeholder:i`Topic for new section, this will be the h2 heading`}})}),f("textarea",{className:`ipe-quickEdit__textarea ${a.className}`,style:{fontFamily:a.fontFamily},name:"text",id:"wpTextbox1",children:d})]}),f("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!h&&f(as,{label:i`Summary`,id:"summary",name:"summary",value:c.editSummary}),f("div",{className:"ipe-input-box",children:[f("label",{htmlFor:"watchlist",style:{display:"block"},children:i`Watchlist`}),f("div",{style:{display:"flex",gap:"1rem",whiteSpace:"nowrap",overflowX:"auto"},children:[_t.preferences,_t.nochange,_t.watch,_t.unwatch].map(g=>f(Wv,{name:"watchlist",value:g,inputProps:{checked:n===g,onChange:w=>{w.target&&w.target.closest("label")?.scrollIntoView({behavior:"smooth",inline:"center"})}},children:i`watchlist.${g}`},g))})]}),f("div",{style:{display:"flex",gap:"1rem"},children:[f(Ri,{name:"minor",id:"minor",checked:c.editMinor,children:i`Minor edit`}),f(Ri,{name:"reloadAfterSave",id:"reloadAfterSave",checked:c.reloadAfterSave,children:i`Reload after save`})]})]}),!1]});l.setContent(P);let b=!1;l.addButton({side:"left",className:"is-primary submit-btn",label:i`Submit`,keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:async()=>{const g=new FormData(P);l.setLoadingState(!0);try{await this.handleSubmit({wikiPage:u,text:g.get("text"),summary:g.get("summary"),minor:g.get("minor")==="on",section:c.section,watchlist:n,createonly:u.pageid===0&&!b,recreate:u.pageid===0&&b}),l.setOptions({beforeClose:wa}),l.close(),this.ctx.modal.notify("success",{title:i`Submission Successful`,content:i`Your changes have been saved.`}),g.get("reloadAfterSave")&&(await Kv(500),location.reload())}catch(w){if(l.setLoadingState(!1),Tt.is(w)&&(w.code==="pagedeleted"||w.code==="editconflict"||w.code==="articleexists")){b=!0,this.ctx.modal.notify("warning",{title:i`Submission Error`,content:f("div",{children:[f("p",{children:f("strong",{children:w.message})}),f("p",{children:i`You can try to submit again to dismiss the warnings.`})]}),closeAfter:15*1e3});return}this.ctx.modal.notify("error",{title:i`Submission Error`,content:w instanceof Error?w.message:String(w)})}}},0),l.setOptions({beforeClose:()=>{const g=u.revisions[0]?.content||"";return(P.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"}},S=>(S&&(l.setOptions({beforeClose:wa}),l.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:c,modal:l,wikiPage:u});const y=g=>P.querySelector("textarea")?.value===d?!0:(g.preventDefault(),i`You have unsaved changes. Are you sure you want to leave?`);window.addEventListener("beforeunload",y),l.on(l.Event.Close,()=>{window.removeEventListener("beforeunload",y)})}async handleSubmit(e){const{wikiPage:i,...r}=e;return this.ctx.emit("quick-edit/submit",{ctx:this.ctx,wikiPage:i,...r}),i.edit({...r})}async getEditFontOptions(){const e=await this.ctx.preferences.get("quickEdit.editFont");return Li.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,r=this.ctx.currentPage.wikiTitle,n=r&&r.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),f("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),f("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!n},tooltip:()=>n?i`Quick Edit`:i`Not editable`,onClick:()=>{const s=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:r?.getPrefixedText(),revision:s?Number(s):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}createQuickEditButton(e,i){const{$:r}=this.ctx,n=i?.icon??f(Hd,{className:"ipe-icon"}),s=i?.label??r`Quick Edit`;return f("a",{href:"#ipe://quick-edit/",dataset:e,className:`ipe-quick-edit ${e.createOnly?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:o=>{o.preventDefault(),this.showModal(e)},children:[n,s]})}},Li.BUILT_IN_FONT_OPTIONS=["preferences","monospace","sans-serif","serif"],Li);Ea=Xv(Gd),ls=iw(Ea,0,"PluginQuickEdit",Vd,ls),tw(Ea,1,ls);const rw=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickEdit:ls},Symbol.toStringTag,{value:"Module"})),Wr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},Qd=t=>{const{inputs:e,enableSwap:i=!0,...r}=t,n=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,c=null;const l=()=>s.some(h=>h&&h.disabled),u=()=>{if(!s[0]||!s[1]||l())return;const h=s[0],_=s[1],k=h.value,P=_.value;h.value=P,_.value=k,h.dispatchEvent(new Event("change")),_.dispatchEvent(new Event("change")),o++,c&&(c.style.transform=`rotateY(${o*-180}deg)`,c.style.transition="transform 200ms ease")},d=h=>{if(!a)return;const _=h??!a.disabled;a.disabled=!_,_&&s.forEach(k=>{k&&(k.disabled=!1)})},m=f("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:l()||!i,ref:h=>a=h,children:f("svg",{ref:h=>c=h,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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M20 10h-16l5.5 -6"}),f("path",{d:"M4 14h16l-5.5 6"})]})}),p=f("div",{className:`twin-swap-input ${Wr.twinSwapInput}`,...r,children:[n.map((h,_)=>{const{label:k,id:P,name:b,value:y,disabled:g,required:w,inputProps:S}=h,I=_===0,F=P||b;return f("div",{className:`${Wr.inputWrapper} ${I?Wr.inputLeft:Wr.inputRight}`,children:[k&&f("label",{htmlFor:F,children:k}),f("input",{ref:N=>s[_]=N,type:"text",id:F,name:b,value:y,disabled:g,required:w,...S})]})}),f("div",{className:Wr.swapButton,children:m})]});return p.swap=u,p.toggleEnableSwap=d,p};var nw=Object.create,$a=Object.defineProperty,sw=Object.getOwnPropertyDescriptor,Yd=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Xd=t=>{throw TypeError(t)},ow=(t,e,i)=>e in t?$a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,aw=(t,e)=>$a(t,"name",{value:e,configurable:!0}),lw=t=>[,,,nw(t?.[Yd("metadata")]??null)],cw=["class","method","getter","setter","accessor","field","value","get","set"],Jd=t=>t!==void 0&&typeof t!="function"?Xd("Function expected"):t,uw=(t,e,i,r,n)=>({kind:cw[t],name:e,metadata:r,addInitializer:s=>i._?Xd("Already initialized"):n.push(Jd(s||null))}),dw=(t,e)=>ow(e,Yd("metadata"),t[3]),fw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},hw=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&sw(n,i));aw(n,i);for(var h=r.length-1;h>=0;h--)c=uw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,Jd(o)&&(n=o);return dw(t,n),p&&$a(n,i,p),u?l^4?s:p:n},Zd,Pa,ef;Zd=[Ot(A.object({"quickMove.reason":A.string().default("[IPE-NEXT] Quick move")}).description("Quick move options").extra("category","editor")),xe(["modal","wiki","$"])];class cs extends(ef=Ue){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.$,r=window.mw?.config.get("wgPageName")||"",n=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),f("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),f("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),f("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),f("path",{d:"M17 12h.01"}),f("path",{d:"M13 12h.01"})]}),tooltip:()=>i`Quick Move`,group:"group1",index:1,onClick:()=>{this.showModal(n?{lockFromField:!0,from:r}:{})}})}async showModal(e){const{$:i}=this.ctx,r=await this.ctx.preferences.get("quickMove.reason"),n=this.ctx.modal.createObject({title:i`Quick Move`,content:f(_i,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return n.setContent(f("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),c={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(!c.from||!c.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:n,payload:c}),n.setLoadingState(!0),this.movePage(c).then(()=>{location.reload()}).catch(l=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to move`,content:l instanceof Error?l.message:String(l)})})},children:[f(Qd,{inputs:[{label:i`Move from`,name:"from",value:e?.from,required:!0},{label:i`Move to`,name:"to",value:e?.to,required:!0}]}),f("div",{children:f(Ri,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:i`Move talk page`})}),f("div",{children:f(Ri,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:i`Move subpages (up to 100)`})}),this.ctx.wiki.hasRight("suppressredirect")&&f("div",{children:f(Ri,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:i`Move without leaving a redirect`})}),f(as,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??r??""})]})),n.setButtons([{label:i`Move`,className:"is-primary is-ghost",method:()=>{s?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:i,to:r,reason:n="",...s}=e;if(!i||!r)throw new Error("From and to titles are required.");if(i===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(r,n,s)}}Pa=lw(ef),cs=hw(Pa,0,"PluginQuickMove",Zd,cs),fw(Pa,1,cs);const pw=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return cs}},Symbol.toStringTag,{value:"Module"}));var gw=Object.create,Ca=Object.defineProperty,yw=Object.getOwnPropertyDescriptor,tf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),rf=t=>{throw TypeError(t)},bw=(t,e,i)=>e in t?Ca(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,vw=(t,e)=>Ca(t,"name",{value:e,configurable:!0}),ww=t=>[,,,gw(t?.[tf("metadata")]??null)],_w=["class","method","getter","setter","accessor","field","value","get","set"],nf=t=>t!==void 0&&typeof t!="function"?rf("Function expected"):t,xw=(t,e,i,r,n)=>({kind:_w[t],name:e,metadata:r,addInitializer:s=>i._?rf("Already initialized"):n.push(nf(s||null))}),kw=(t,e)=>bw(e,tf("metadata"),t[3]),Sw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Ew=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&yw(n,i));vw(n,i);for(var h=r.length-1;h>=0;h--)c=xw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,nf(o)&&(n=o);return kw(t,n),p&&Ca(n,i,p),u?l^4?s:p:n},sf,Ia,of;sf=[xe(["api","wikiPage","modal","preferences","$"]),Ot(A.object({"quickPreview.keyshortcut":A.string().default("ctrl-i").role("keyshortcut").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","editor").description("Quick preview options"))];class us extends(of=Ue){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this._contentTypeCache=new Map,this._objectUrls=new WeakMap,this.ctx.set("quickPreview",Bd(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}stop(){}previewWikitext(e,i,r,n,s){const{$:o}=this.ctx;return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),n.show(),n.setTitle(o`Preview - Loading...`),n.setContent(f(_i,{})),n.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:n,wikiPage:r}),r.preview(e,i).then(a=>{const{data:{parse:c}}=a;n.setTitle(o(c.title)`Preview - {{ $1 }}`);let l=null;n.setContent(f("section",{children:f("div",{ref:u=>l=u,className:"mw-parser-output",innerHTML:c.text})})),window.mw?.hook&&typeof jQuery=="function"&&window.mw.hook("wikipage.content").fire(jQuery(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:n,wikiPage:r,text:e,parseData:c})}).catch(a=>{n.setTitle(o`Preview - Failed`),n.setContent(f(bi,{children:[f("p",{children:o`Failed to preview`}),f("p",{children:a instanceof Error?a.message:String(a)})]}))}),n}async injectQuickEdit({options:e,modal:i,wikiPage:r}){const{$:n}=this.ctx;let s;i.addButton({label:n`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,r,s,{backdrop:!1,draggable:!0})}},1),i.on(i.Event.Close,()=>{s?.destroy(),s=void 0})}fetchContentType(e){const i=this._contentTypeCache.get(e);if(i)return i;const r=fetch(e,{method:"HEAD"}).then(n=>n.headers.get("content-type")||"").catch(()=>(this._contentTypeCache.delete(e),""));return this._contentTypeCache.set(e,r),r}async getPreviewType(e){if(!e)return"unknown";let i,r;if(e instanceof File)i=e.type,r=e.name.split(".").pop()?.toLowerCase()||"";else{const n=new URL(e,location.origin);n.protocol==="data:"||n.protocol==="blob:"||n.protocol.startsWith("http")?i=await this.fetchContentType(n.href):i="",r=n.pathname.split(".").pop()?.toLowerCase()||""}return i.startsWith("image/")&&!i.includes("pdf")?"image":i.startsWith("video/")?"video":i.startsWith("audio/")?"audio":i.startsWith("text/html")?"html":r==="md"?"markdown":i.startsWith("text/")?"text":["jpg","jpeg","png","gif","bmp","tiff","ico","webp"].includes(r)?"image":["mp4","webm","ogg","flv","avi","mov","wmv","mkv"].includes(r)?"video":["mp3","wav","ogg","flac","aac","m4a","wma"].includes(r)?"audio":["html","htm"].includes(r)?"html":["json","yml","yaml","toml","py"].includes(r)?"text":["pdf"].includes(r)?"pdf":"unknown"}async previewFile(e,i){const r=await this.getPreviewElement(e,i);return r?this.ctx.modal.dialog({className:"in-page-edit ipe-quickPreview",sizeClass:"mediumToLarge",center:!0,title:i??(e instanceof File?e.name:e),content:f("section",{className:"ipe-quickPreview__content",children:r})}):void 0}getObjectUrl(e){if(!this._objectUrls.has(e)){const i=URL.createObjectURL(e);this._objectUrls.set(e,i)}return this._objectUrls.get(e)}async getPreviewElement(e,i){const r=await this.getPreviewType(e),n=e instanceof File?this.getObjectUrl(e):e;switch(r){case"image":return f("img",{src:n,alt:i??(e instanceof File?e.name:e)});case"video":return f("video",{src:n,controls:!0,"aria-label":i});case"audio":return f("audio",{src:n,controls:!0,"aria-label":i});case"pdf":return f("embed",{type:"application/pdf",src:n,"aria-label":i})}return null}previewWikiPage(e){throw new Error("Not implemented")}}Ia=ww(of),us=Ew(Ia,0,"PluginQuickPreview",sf,us),Sw(Ia,1,us);const $w=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return us}},Symbol.toStringTag,{value:"Module"})),Pw=t=>{let{user:e,target:i,ctx:r}=t;const n=r.getUrl.bind(r);return f("span",{className:"mw-userlinks",children:[f("a",{href:n(`User:${e}`),className:"mw-userlink",target:i,children:e})," ",f("span",{className:"mw-usertoollinks",children:["(",f("a",{href:n(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:i,children:"talk"})," | ",f("a",{href:n(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:i,children:"contribs"})," | ",f("a",{href:n(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:i,children:"block"}),")"]})]})};var ds=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(ds||{});const Cw=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,af=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 f("td",{colSpan:2,className:e,children:f("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const i=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return f("td",{colSpan:2,className:e,children:[f("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),f("div",{className:"mw-diff-title--actions",children:f("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:i,children:[f(Hd,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),f("div",{className:"mw-diff-title--user",children:t.username&&f(Pw,{ctx:t.ctx,user:t.username,target:"_blank"})}),f("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&Cw(new Date(t.timestamp))}),f("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&f(bi,{children:["(",f("i",{innerHTML:t.parsedcomment}),")"]})})]})},Iw=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const i=(r,n,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:n,torev:s},bubbles:!0}))};return f("tr",{className:"mw-diff-title--navigation",children:[f("td",{colSpan:2,children:e.prev?f("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>i(r,e.prev,e.fromrevid),children:"← Previous"}):f("i",{children:"Oldest version"})}),f("td",{colSpan:2,children:e.next?f("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>i(r,e.torevid,e.next),children:"Next →"}):f("i",{children:"Newest version"})})]})},Aw=t=>{const{data:e,...i}=t,r=f("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...i,children:[f("colgroup",{children:[f("col",{className:"diff-marker"}),f("col",{className:"diff-content"}),f("col",{className:"diff-marker"}),f("col",{className:"diff-content"})]}),f("tbody",{children:[f("tr",{children:[f(af,{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}),f(af,{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})]}),f(Iw,{data:e,ctx:t.ctx}),f("div",{id:"diffbody"}),f("tr",{className:"diff-size",style:{textAlign:"center"},children:[f("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),f("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||f("tr",{children:f("td",{colSpan:4,children:f("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:f("i",{children:"No changes"})})})}).outerHTML,r},Rw=t=>f("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-file-diff ${t.className||""}`,children:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),f("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"}),f("path",{d:"M12 10l0 4"}),f("path",{d:"M10 12l4 0"}),f("path",{d:"M10 17l4 0"})]});var Tw=Object.create,Aa=Object.defineProperty,Ow=Object.getOwnPropertyDescriptor,lf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),cf=t=>{throw TypeError(t)},Lw=(t,e,i)=>e in t?Aa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Nw=(t,e)=>Aa(t,"name",{value:e,configurable:!0}),Mw=t=>[,,,Tw(t?.[lf("metadata")]??null)],Dw=["class","method","getter","setter","accessor","field","value","get","set"],uf=t=>t!==void 0&&typeof t!="function"?cf("Function expected"):t,jw=(t,e,i,r,n)=>({kind:Dw[t],name:e,metadata:r,addInitializer:s=>i._?cf("Already initialized"):n.push(uf(s||null))}),Uw=(t,e)=>Lw(e,lf("metadata"),t[3]),Fw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},qw=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Ow(n,i));Nw(n,i);for(var h=r.length-1;h>=0;h--)c=jw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,uf(o)&&(n=o);return Uw(t,n),p&&Aa(n,i,p),u?l^4?s:p:n},df,Ra,ff;df=[xe(["wiki","getUrl","preferences","$"]),Ot(A.object({"quickDiff.keyshortcut":A.string().default("ctrl-d").role("keyshortcut").description("Key shortcut to open quick diff in quick edit modal")}).description("Quick diff options").extra("category","editor"))];class fs extends(ff=Ue){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=Fs("#mw-history-compare");if(!i)return;Nh(".mw-history-compareselectedversions-button",i).forEach(n=>{n.after(f("button",{className:"cdx-button",onClick:s=>{s.preventDefault();const o=new FormData(i),a=Number(o.get("oldid"))||0,c=Number(o.get("diff"))||0;if(!o.get("title")||!a||!c)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:a,torev:c})},children:e`Quick Diff`}))})}async injectQuickEdit({modal:e,wikiPage:i,options:r}){if(i.pageid===0||r.section==="new")return;const{$:n}=this.ctx;let s;e.addButton({label:n`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||"",c=e.get$content().querySelector('textarea[name="text"]')?.value||"";return a===c?this.ctx.modal.notify("info",{title:n`Quick Diff`,content:n`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:c,topst:!0},s,{backdrop:!1,draggable:!0}),s)}},2),e.on(e.Event.Close,()=>{s?.destroy(),s=void 0})}comparePages(e,i,r){const{$:n}=this.ctx;return!i||i.isDestroyed?i=this.ctx.modal.createObject({title:n`Loading diff...`,content:"",className:"quick-diff",center:!1,...r}).init():i.removeButton("*"),this.ctx.emit("quick-diff/init-options",{ctx:this.ctx,options:e}),i.setContent(f("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:f(_i,{})})),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})`:""}`:n`Differences`);let a;i.setContent(f("section",{style:{minHeight:"70vh"},children:f(Aw,{ref:c=>a=c,data:o,ctx:this.ctx})})),a.addEventListener(ds.update,c=>{c.stopPropagation(),this.comparePages({fromrev:c.detail.fromrev,torev:c.detail.torev},i,r)},{once:!0}),this.ctx.inject(["quickEdit"],c=>{const l=u=>{u.stopPropagation(),c.quickEdit({revision:u.detail.revid})};a.addEventListener(ds.edit,l),i.on(i.Event.Close,()=>{a.removeEventListener(ds.edit,l)})}),o.fromrevid&&o.torevid&&i.addButton({label:n`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(f(ka,{title:n`Failed to load diff`,type:"error",children:f("pre",{children:s instanceof Error?s.message:String(s)})}))}),i.show()}createQuickDiffButton(e,i){const{$:r}=this.ctx,n=i?.icon??f(Rw,{className:"ipe-icon"}),s=i?.label??r`Quick Diff`;return f("a",{href:"#ipe://quick-diff/",dataset:e,className:"ipe-quick-diff",style:{userSelect:"none",marginLeft:"0.2em"},onClick:o=>{o.preventDefault(),this.comparePages(e)},children:[n,s]})}}Ra=Mw(ff),fs=qw(Ra,0,"PluginQuickDiff",df,fs),Fw(Ra,1,fs);const Bw=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDiff(){return fs}},Symbol.toStringTag,{value:"Module"})),_s=class _s extends Ue{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")||"",r=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],n=>{this.ctx=n,n.toolbox.addButton({id:"quick-redirect",icon:f("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:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),f("path",{d:"M9 17l3 -3l-3 -3"}),f("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),f("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(r?{to:i}:{})}}),this.addDisposeHandler(s=>{s.toolbox.removeButton("quick-redirect")})})}stop(){}async showModal(e){const{$:i}=this.ctx,r=await this.ctx.preferences.get("quickRedirect.reason");e||(e={}),this.ctx.emit("quick-redirect/init-options",{ctx:this.ctx,options:e});const n=this.ctx.modal.createObject({title:i`Quick Redirect`,content:f(_i,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let s=null;return n.setContent(f("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),c={from:a.get("from")?.toString().trim(),to:a.get("to")?.toString().trim(),reason:a.get("reason")||"",overwrite:a.get("overwrite")==="on"};if(!c.from||!c.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:c}),n.setLoadingState(!0),this.redirectPage(c).then(l=>{n.close(),this.ctx.modal.notify("success",{title:i`Redirect successful`,content:i`The redirect has been created.`})}).catch(l=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:i`Failed to redirect`,content:l instanceof Error?l.message:String(l)})})},children:[f(Qd,{inputs:[{label:i`Redirect from`,name:"from",value:e?.from,required:!0},{label:i`Redirect to`,name:"to",value:e?.to,required:!0}]}),f(as,{label:i`Reason`,id:"reason",name:"reason",value:e?.reason??r??""}),f("div",{children:f(Ri,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:i`Force create redirect even if the from page already exists`})})]})),n.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:n}),n.show()}async redirectPage(e){const{from:i,to:r,reason:n="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:i}),a=`#REDIRECT [[:${r}]]`;return o.edit({text:a,summary:n},{createonly:!s})}};_s.inject=["api","wikiPage","modal","$"],_s.PreferencesSchema=A.object({"quickRedirect.reason":A.string().default("[IPE-NEXT] Quick redirect")}).description("Quick redirect options").extra("category","editor");let Ta=_s;const Hw=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:Ta},Symbol.toStringTag,{value:"Module"})),hf=t=>f("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-upload ${t.className||""}`,children:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"}),f("path",{d:"M7 9l5 -5l5 5"}),f("path",{d:"M12 4l0 12"})]}),zw=window?.location?.origin,Kr=({type:t,tag:e,href:i,target:r,children:n,...s})=>(e=e||(i?"a":"button"),typeof r>"u"&&i&&i.startsWith("http")&&!i.startsWith(zw)&&(r="_blank"),mr(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?i:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?i:void 0,...s},n));var Ww=Object.create,Oa=Object.defineProperty,Kw=Object.getOwnPropertyDescriptor,pf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),gf=t=>{throw TypeError(t)},Vw=(t,e,i)=>e in t?Oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Gw=(t,e)=>Oa(t,"name",{value:e,configurable:!0}),Qw=t=>[,,,Ww(t?.[pf("metadata")]??null)],Yw=["class","method","getter","setter","accessor","field","value","get","set"],mf=t=>t!==void 0&&typeof t!="function"?gf("Function expected"):t,Xw=(t,e,i,r,n)=>({kind:Yw[t],name:e,metadata:r,addInitializer:s=>i._?gf("Already initialized"):n.push(mf(s||null))}),Jw=(t,e)=>Vw(e,pf("metadata"),t[3]),Zw=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},e_=(t,e,i,r,n,s)=>{var o,a,c,l=e&7,u=!1,d=0,m=t[d]||(t[d]=[]),p=l&&(n=n.prototype,l<5&&(l>3||!u)&&Kw(n,i));Gw(n,i);for(var h=r.length-1;h>=0;h--)c=Xw(l,i,a={},t[3],m),o=(0,r[h])(n,c),a._=1,mf(o)&&(n=o);return Jw(t,n),p&&Oa(n,i,p),u?l^4?s:p:n},yf,La,bf;const t_=({$:t})=>f("div",{className:"ipe-quickUpload__preview-placeholder is-na",children:f("span",{children:[f("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-file-unknown",children:[f("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),f("path",{d:"M12 2l.117 .007a1 1 0 0 1 .876 .876l.007 .117v4l.005 .15a2 2 0 0 0 1.838 1.844l.157 .006h4l.117 .007a1 1 0 0 1 .876 .876l.007 .117v9a3 3 0 0 1 -2.824 2.995l-.176 .005h-10a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-14a3 3 0 0 1 2.824 -2.995l.176 -.005zm0 15a1 1 0 0 0 -.993 .883l-.007 .127a1 1 0 0 0 1.993 .117l.007 -.127a1 1 0 0 0 -1 -1m1.136 -5.727a2.5 2.5 0 0 0 -3.037 .604a1 1 0 0 0 1.434 1.389l.088 -.09a.5 .5 0 1 1 .379 .824a1 1 0 0 0 -.002 2a2.5 2.5 0 0 0 1.137 -4.727"}),f("path",{d:"M19 7h-4l-.001 -4.001z"})]}),f("p",{children:t`No preview available`})]})});yf=[Ot(A.object({"quickUpload.summary":A.string().description("Default summary of the quick upload").default("[IPE-NEXT] Quick upload")})),xe(["modal","$","wikiTitle","wikiFile","quickPreview","preferences"])];class hs extends(bf=Ue){constructor(e){super(e,{},"quick-upload"),this.ctx=e}async start(){this.injectToolbox(),this.ctx.set("quickUpload",this)}async stop(){}injectToolbox(){const{$:e}=this.ctx;this.ctx.inject(["toolbox"],i=>{i.toolbox.addButton({id:"quick-upload",group:"group2",index:2,icon:f(hf,{}),tooltip:()=>e`Quick Upload`,onClick:r=>{r.preventDefault(),this.showModal()}}),i.on("dispose",()=>{i.toolbox.removeButton("quick-upload")})})}formatFileSize(e=0){if(e=Number(e),!Number.isFinite(e)||e<0)return"0 B";const i=["B","KB","MB","GB","TB"];let r=0;for(;e>=1024&&r<i.length-1;)e/=1024,r++;return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(e)} ${i[r]}`}isFileAccepted(e,i){if(!i)return!0;const r=i.split(",").map(o=>o.trim()).filter(Boolean);if(!r.length)return!0;const n=e.type||"",s=e.name||"";return r.some(o=>{if(o.startsWith("."))return s.toLowerCase().endsWith(o.toLowerCase());if(o.endsWith("/*")){const a=o.slice(0,-1);return n.startsWith(a)}return n===o})}getDefaultPreviewPlaceholder(){const{$:e}=this.ctx;return f("div",{className:"ipe-quickUpload__preview-placeholder",children:f("span",{children:[f(hf,{}),f("p",{children:e`You can drag & drop files to this modal`})]})})}safeId(){return`mu_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}async showModal(){const{$:e}=this.ctx;let i=!1,r=!1;const n=(C,M,H)=>{this.ctx.modal.notify(C,{title:M,content:H,closeAfter:C==="success"?3e3:8e3})},s=this.ctx.modal.show({className:"ipe-quickUpload compact-buttons",sizeClass:"mediumToLarge",center:!1,title:e`Quick Upload`,content:e`Quick Upload`,outSideClose:!1,beforeClose:()=>i?(n("warning",e`Upload in progress`,e`Please pause or wait for it to finish.`),!1):!0}),o=await this.ctx.preferences.get("quickUpload.summary")||"",a="image/*,video/*,audio/*,application/pdf",c=20;let l=[],u=null;const d={fileInput:null,listEl:null,previewWrapper:null,progressEl:null,progressTextEl:null,summaryInput:null,ignoreWarnings:null},m=(C,M)=>{l=l.map(H=>H.id===C?{...H,...M}:H)},p=C=>{l=l.filter(M=>M.id!==C),u===C&&(u=l[0]?.id??null)},h=(C,M)=>{l=l.map(H=>C.has(H.id)?M(H):H)},_=C=>{const M=[],H=te=>te==null?"":String(te);if(C instanceof Error){M.push(C.message);let te=C;for(;te?.cause&&(te=te.cause,te instanceof Error);)M.push(te.message)}else C?.data?.error?.info?M.push(H(C.data.error.info)):C?.error?.info?M.push(H(C.error.info)):C?.message&&M.push(H(C.message));return M.filter(Boolean)},k=C=>{let M=_(C);M.length===0&&(M=["Upload failed with unknown error."]);const H=M.join(`
26
26
  `),te=H.toLowerCase();return te.includes("file is larger")||te.includes("files larger than")||te.includes("maximum upload size")?{message:`File too large
27
27
  ${H}`,retryable:!1}:te.includes("network")||te.includes("timeout")||te.includes("timed out")?{message:`Network issue