From bb72fc2afbae3869cfdf96fc554fa1eeb2037ba5 Mon Sep 17 00:00:00 2001 From: srg-kostyrko Date: Tue, 16 Jan 2024 08:29:26 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=2074081?= =?UTF-8?q?6b16b3f6f80f116464fbe40331498903ade=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/{index-riNPXv-n.js => index-FvDoYlFd.js} | 4 ++-- index.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename assets/{index-riNPXv-n.js => index-FvDoYlFd.js} (90%) diff --git a/assets/index-riNPXv-n.js b/assets/index-FvDoYlFd.js similarity index 90% rename from assets/index-riNPXv-n.js rename to assets/index-FvDoYlFd.js index e80abee..dda67e2 100644 --- a/assets/index-riNPXv-n.js +++ b/assets/index-FvDoYlFd.js @@ -93,7 +93,7 @@ return ret; font-weight: ${fr||"normal"}; } `);const cr=document.createElement("style");cr.innerText=ar.join(` -`),cr.dataset.qspiderResource="style",document.head.appendChild(cr)}function clearAdditionalResources(){document.querySelectorAll("[data-qspider-resource]").forEach(or=>or.remove())}const BOOLEAN_ATTRIBUTES=new Set(["autofocus","autoplay","checked","controls","default","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","novalidate","open","readonly","required","reversed","selected"]),valueProcessors={href(or){return or.startsWith("javascript:")?"#":or}};function extractAttributes(or){const ar={};return Array.from(or.attributes).forEach(cr=>{const{name:lr,value:ur}=cr;lr!=="is"&&(lr==="style"?ar.style=processStyles(ur):BOOLEAN_ATTRIBUTES.has(lr)?ar[lr]=!0:ar[lr]=lr in valueProcessors?valueProcessors[lr](ur):ur)}),ar}function processStyles(or){const ar=or.split(";"),cr={};for(const lr of ar){const[ur,fr]=lr.trim().split(":"),dr=ur.replace(/^-ms-/,"ms-").replace(/-./g,mr=>mr.substring(1).toUpperCase());let pr=fr;dr==="backgroundImage"&&!fr.includes("url(")?pr=`url("${fr}")`:/^[+-]?\d+(\.\d+)?$/.test(fr)&&(pr=parseFloat(fr)),cr[dr]=pr}return cr}const CLASSIC_THEME="qspider:classic",AERO_THEME="qspider:aero",DEFAULT_LIST_FORMAT='
%TEXT%
',DEFAULT_SELECTED_LIST_FORMAT='
%TEXT%
',TEXT_PLACEHOLDER="%TEXT%",IMAGE_PLACEHOLDER="%IMAGE%",themeRegistry$=create({},or=>({add(ar,cr){or.update(lr=>({...lr,[ar]:cr}))},reset(){or.update(ar=>Object.entries(ar).reduce((cr,[lr,ur])=>(ur.is_user_defined||(cr[lr]=ur),cr),{}))}})),currentTheme$=create(CLASSIC_THEME),currentThemeData$=create(or=>or(themeRegistry$)[or(currentTheme$)]),defaultClassicTheme$=create(or=>or(themeRegistry$)["qspider:classic"]),currentCssVariables$=create(or=>or(currentThemeData$).css_variables),currentCssLinks$=create(or=>or(currentThemeData$).css_links),currentScriptLinks$=create(or=>or(currentThemeData$).script_links),currentTranslations$=create(or=>or(currentThemeData$).translations);function useFormatVariable(or,ar){return useQspVariable(or,"",0,ar??"")}async function registerThemes(or){for(const ar of or){const cr=await getTextContent(ar),lr=parseTheme(cr);for(const[ur,fr]of Object.entries(lr))themeRegistry$.actions.add(ur,fr)}}const defaultThemes=["themes/classic.html","themes/aero.html"];async function registerDefaultThemes(or){for(const ar of defaultThemes){const cr=await getTextContent(or+ar),lr=parseTheme(cr,!1);for(const[ur,fr]of Object.entries(lr))themeRegistry$.actions.add(ur,fr)}}const parser=new DOMParser;function parseTheme(or,ar=!0){const cr={},ur=parser.parseFromString(or,"text/html").querySelectorAll("qspider-theme");for(const fr of ur){const dr=fr.getAttribute("name");if(!dr){console.error("Malformed theme definition - missing theme name in qspider-theme tag");continue}cr[dr]={is_user_defined:ar,css_variables:extractCssVariables(fr),translations:extractTranslations(fr),css_links:extractLinks(fr,"css-link"),script_links:extractLinks(fr,"script-link"),qsp_player:extractTagData(fr,"qsp-player")}}return cr}function extractTagData(or,ar){const cr=or.querySelector(ar);if(cr)return{attrs:extractAttributes(cr),template:cr.innerHTML.replace(/[ \t]*\r?\n[ \t]*/gm,"")}}function extractCssVariables(or){const ar=[];for(const cr of or.querySelectorAll("definitions qsp-css-variable")){const lr=cr.getAttribute("name"),ur=cr.getAttribute("from");!lr||!ur||ar.push({name:lr,from:ur,defaultValue:cr.getAttribute("default-value")||"",type:cr.getAttribute("type"),unit:cr.getAttribute("unit"),withSize:cr.hasAttribute("with-size"),withContrast:cr.hasAttribute("with-contrast"),withInverted:cr.hasAttribute("with-inverted")})}return ar}function extractTranslations(or){const ar=[];for(const cr of or.querySelectorAll("definitions qsp-translation")){const lr=cr.getAttribute("lang")||"",ur=cr.getAttribute("tkey")||"",fr=cr.getAttribute("value")||"";ar.push({lang:lr,tkey:ur,value:fr})}return ar}function extractLinks(or,ar){const cr=[];for(const lr of or.querySelectorAll(ar)){const ur=lr.getAttribute("src");ur&&cr.push(ur)}return cr}const counterDelay$=create(500),isPaused$=create(!1),counterTimeout$=create();async function withCounterPaused(or){const ar=isPaused$.value;try{isPaused$.set(!0),await or()}finally{isPaused$.set(ar)}}function scheduleCounter(){counterTimeout$.set(setTimeout(()=>{var or;(or=qspApi$.value)==null||or.execCounter(),scheduleCounter()},counterDelay$.value))}isPaused$.watch(or=>{or?clearTimeout(counterTimeout$.value):scheduleCounter()});counterDelay$.subscribe(()=>{clearTimeout(counterTimeout$.value),isPaused$.value||scheduleCounter()});var howler={};/*! +`),cr.dataset.qspiderResource="style",document.head.appendChild(cr)}function clearAdditionalResources(){document.querySelectorAll("[data-qspider-resource]").forEach(or=>or.remove())}const BOOLEAN_ATTRIBUTES=new Set(["autofocus","autoplay","checked","controls","default","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","novalidate","open","readonly","required","reversed","selected"]),valueProcessors={href(or){return or.startsWith("javascript:")?"#":or}};function extractAttributes(or){const ar={};return Array.from(or.attributes).forEach(cr=>{const{name:lr,value:ur}=cr;lr!=="is"&&(lr==="style"?ar.style=processStyles(ur):BOOLEAN_ATTRIBUTES.has(lr)?ar[lr]=!0:ar[lr]=lr in valueProcessors?valueProcessors[lr](ur):ur)}),ar}function processStyles(or){const ar=or.split(";"),cr={};for(const lr of ar){const[ur,fr]=lr.trim().split(":"),dr=ur.replace(/^-ms-/,"ms-").replace(/-./g,mr=>mr.substring(1).toUpperCase());let pr=fr;dr==="backgroundImage"&&!fr.includes("url(")?pr=`url("${fr}")`:/^[+-]?\d+(\.\d+)?$/.test(fr)&&(pr=parseFloat(fr)),cr[dr]=pr}return cr}const CLASSIC_THEME="qspider:classic",AERO_THEME="qspider:aero",DEFAULT_LIST_FORMAT='
%TEXT%
',DEFAULT_SELECTED_LIST_FORMAT='
%TEXT%
',TEXT_PLACEHOLDER="%TEXT%",IMAGE_PLACEHOLDER="%IMAGE%",themeRegistry$=create({},or=>({add(ar,cr){or.update(lr=>({...lr,[ar]:cr}))},reset(){or.update(ar=>Object.entries(ar).reduce((cr,[lr,ur])=>(ur.is_user_defined||(cr[lr]=ur),cr),{}))}})),currentTheme$=create(CLASSIC_THEME),currentThemeData$=create(or=>or(themeRegistry$)[or(currentTheme$)]),defaultClassicTheme$=create(or=>or(themeRegistry$)["qspider:classic"]),currentCssVariables$=create(or=>or(currentThemeData$).css_variables),currentCssLinks$=create(or=>or(currentThemeData$).css_links),currentScriptLinks$=create(or=>or(currentThemeData$).script_links),currentTranslations$=create(or=>or(currentThemeData$).translations);function useFormatVariable(or,ar){return useQspVariable(or,"",0,ar??"")}async function registerThemes(or){for(const ar of or){const cr=await getTextContent(ar),lr=parseTheme(cr);for(const[ur,fr]of Object.entries(lr))themeRegistry$.actions.add(ur,fr)}}const defaultThemes=["themes/classic.html","themes/aero.html"];async function registerDefaultThemes(or){for(const ar of defaultThemes){const cr=await getTextContent(new URL(ar,or).toString()),lr=parseTheme(cr,!1);for(const[ur,fr]of Object.entries(lr))themeRegistry$.actions.add(ur,fr)}}const parser=new DOMParser;function parseTheme(or,ar=!0){const cr={},ur=parser.parseFromString(or,"text/html").querySelectorAll("qspider-theme");for(const fr of ur){const dr=fr.getAttribute("name");if(!dr){console.error("Malformed theme definition - missing theme name in qspider-theme tag");continue}cr[dr]={is_user_defined:ar,css_variables:extractCssVariables(fr),translations:extractTranslations(fr),css_links:extractLinks(fr,"css-link"),script_links:extractLinks(fr,"script-link"),qsp_player:extractTagData(fr,"qsp-player")}}return cr}function extractTagData(or,ar){const cr=or.querySelector(ar);if(cr)return{attrs:extractAttributes(cr),template:cr.innerHTML.replace(/[ \t]*\r?\n[ \t]*/gm,"")}}function extractCssVariables(or){const ar=[];for(const cr of or.querySelectorAll("definitions qsp-css-variable")){const lr=cr.getAttribute("name"),ur=cr.getAttribute("from");!lr||!ur||ar.push({name:lr,from:ur,defaultValue:cr.getAttribute("default-value")||"",type:cr.getAttribute("type"),unit:cr.getAttribute("unit"),withSize:cr.hasAttribute("with-size"),withContrast:cr.hasAttribute("with-contrast"),withInverted:cr.hasAttribute("with-inverted")})}return ar}function extractTranslations(or){const ar=[];for(const cr of or.querySelectorAll("definitions qsp-translation")){const lr=cr.getAttribute("lang")||"",ur=cr.getAttribute("tkey")||"",fr=cr.getAttribute("value")||"";ar.push({lang:lr,tkey:ur,value:fr})}return ar}function extractLinks(or,ar){const cr=[];for(const lr of or.querySelectorAll(ar)){const ur=lr.getAttribute("src");ur&&cr.push(ur)}return cr}const counterDelay$=create(500),isPaused$=create(!1),counterTimeout$=create();async function withCounterPaused(or){const ar=isPaused$.value;try{isPaused$.set(!0),await or()}finally{isPaused$.set(ar)}}function scheduleCounter(){counterTimeout$.set(setTimeout(()=>{var or;(or=qspApi$.value)==null||or.execCounter(),scheduleCounter()},counterDelay$.value))}isPaused$.watch(or=>{or?clearTimeout(counterTimeout$.value):scheduleCounter()});counterDelay$.subscribe(()=>{clearTimeout(counterTimeout$.value),isPaused$.value||scheduleCounter()});var howler={};/*! * howler.js v2.2.4 * howlerjs.com * @@ -111,7 +111,7 @@ return ret; * goldfirestudios.com * * MIT License - */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(cr){var lr=this;if(!lr.ctx||!lr.ctx.listener)return lr;for(var ur=lr._howls.length-1;ur>=0;ur--)lr._howls[ur].stereo(cr);return lr},HowlerGlobal.prototype.pos=function(cr,lr,ur){var fr=this;if(!fr.ctx||!fr.ctx.listener)return fr;if(lr=typeof lr!="number"?fr._pos[1]:lr,ur=typeof ur!="number"?fr._pos[2]:ur,typeof cr=="number")fr._pos=[cr,lr,ur],typeof fr.ctx.listener.positionX<"u"?(fr.ctx.listener.positionX.setTargetAtTime(fr._pos[0],Howler.ctx.currentTime,.1),fr.ctx.listener.positionY.setTargetAtTime(fr._pos[1],Howler.ctx.currentTime,.1),fr.ctx.listener.positionZ.setTargetAtTime(fr._pos[2],Howler.ctx.currentTime,.1)):fr.ctx.listener.setPosition(fr._pos[0],fr._pos[1],fr._pos[2]);else return fr._pos;return fr},HowlerGlobal.prototype.orientation=function(cr,lr,ur,fr,dr,pr){var mr=this;if(!mr.ctx||!mr.ctx.listener)return mr;var gr=mr._orientation;if(lr=typeof lr!="number"?gr[1]:lr,ur=typeof ur!="number"?gr[2]:ur,fr=typeof fr!="number"?gr[3]:fr,dr=typeof dr!="number"?gr[4]:dr,pr=typeof pr!="number"?gr[5]:pr,typeof cr=="number")mr._orientation=[cr,lr,ur,fr,dr,pr],typeof mr.ctx.listener.forwardX<"u"?(mr.ctx.listener.forwardX.setTargetAtTime(cr,Howler.ctx.currentTime,.1),mr.ctx.listener.forwardY.setTargetAtTime(lr,Howler.ctx.currentTime,.1),mr.ctx.listener.forwardZ.setTargetAtTime(ur,Howler.ctx.currentTime,.1),mr.ctx.listener.upX.setTargetAtTime(fr,Howler.ctx.currentTime,.1),mr.ctx.listener.upY.setTargetAtTime(dr,Howler.ctx.currentTime,.1),mr.ctx.listener.upZ.setTargetAtTime(pr,Howler.ctx.currentTime,.1)):mr.ctx.listener.setOrientation(cr,lr,ur,fr,dr,pr);else return gr;return mr},Howl.prototype.init=function(cr){return function(lr){var ur=this;return ur._orientation=lr.orientation||[1,0,0],ur._stereo=lr.stereo||null,ur._pos=lr.pos||null,ur._pannerAttr={coneInnerAngle:typeof lr.coneInnerAngle<"u"?lr.coneInnerAngle:360,coneOuterAngle:typeof lr.coneOuterAngle<"u"?lr.coneOuterAngle:360,coneOuterGain:typeof lr.coneOuterGain<"u"?lr.coneOuterGain:0,distanceModel:typeof lr.distanceModel<"u"?lr.distanceModel:"inverse",maxDistance:typeof lr.maxDistance<"u"?lr.maxDistance:1e4,panningModel:typeof lr.panningModel<"u"?lr.panningModel:"HRTF",refDistance:typeof lr.refDistance<"u"?lr.refDistance:1,rolloffFactor:typeof lr.rolloffFactor<"u"?lr.rolloffFactor:1},ur._onstereo=lr.onstereo?[{fn:lr.onstereo}]:[],ur._onpos=lr.onpos?[{fn:lr.onpos}]:[],ur._onorientation=lr.onorientation?[{fn:lr.onorientation}]:[],cr.call(this,lr)}}(Howl.prototype.init),Howl.prototype.stereo=function(cr,lr){var ur=this;if(!ur._webAudio)return ur;if(ur._state!=="loaded")return ur._queue.push({event:"stereo",action:function(){ur.stereo(cr,lr)}}),ur;var fr=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof lr>"u")if(typeof cr=="number")ur._stereo=cr,ur._pos=[cr,0,0];else return ur._stereo;for(var dr=ur._getSoundIds(lr),pr=0;pr"u")if(typeof cr=="number")dr._pos=[cr,lr,ur];else return dr._pos;for(var pr=dr._getSoundIds(fr),mr=0;mr"u")if(typeof cr=="number")dr._orientation=[cr,lr,ur];else return dr._orientation;for(var pr=dr._getSoundIds(fr),mr=0;mr"u"&&(ur.pannerAttr||(ur.pannerAttr={coneInnerAngle:ur.coneInnerAngle,coneOuterAngle:ur.coneOuterAngle,coneOuterGain:ur.coneOuterGain,distanceModel:ur.distanceModel,maxDistance:ur.maxDistance,refDistance:ur.refDistance,rolloffFactor:ur.rolloffFactor,panningModel:ur.panningModel}),cr._pannerAttr={coneInnerAngle:typeof ur.pannerAttr.coneInnerAngle<"u"?ur.pannerAttr.coneInnerAngle:cr._coneInnerAngle,coneOuterAngle:typeof ur.pannerAttr.coneOuterAngle<"u"?ur.pannerAttr.coneOuterAngle:cr._coneOuterAngle,coneOuterGain:typeof ur.pannerAttr.coneOuterGain<"u"?ur.pannerAttr.coneOuterGain:cr._coneOuterGain,distanceModel:typeof ur.pannerAttr.distanceModel<"u"?ur.pannerAttr.distanceModel:cr._distanceModel,maxDistance:typeof ur.pannerAttr.maxDistance<"u"?ur.pannerAttr.maxDistance:cr._maxDistance,refDistance:typeof ur.pannerAttr.refDistance<"u"?ur.pannerAttr.refDistance:cr._refDistance,rolloffFactor:typeof ur.pannerAttr.rolloffFactor<"u"?ur.pannerAttr.rolloffFactor:cr._rolloffFactor,panningModel:typeof ur.pannerAttr.panningModel<"u"?ur.pannerAttr.panningModel:cr._panningModel});else return dr=cr._soundById(parseInt(lr[0],10)),dr?dr._pannerAttr:cr._pannerAttr;else lr.length===2&&(ur=lr[0],fr=parseInt(lr[1],10));for(var pr=cr._getSoundIds(fr),mr=0;mror>1?or*.01:or;let Sound$1=class Ml{constructor(ar,cr){this._state=0,this._error=null,this.isScheduled=!1,this.howl=new howler.Howl({src:[ar],volume:normalizeVolume(cr),loop:!1,preload:!0,autoplay:!1,onload:()=>{this._state=2,this.isScheduled&&this.howl.play()},onloaderror:(lr,ur)=>{console.error(ar,ur),this._state=1,this._error=ur},onplayerror:(lr,ur)=>{console.error(ar,ur),this._state=3,this._error=ur},onplay:()=>{this._state=4},onend:()=>{this._state=6},onpause:()=>{this._state=5},onstop:()=>{this._state=6},onunlock:()=>{this._state===2&&this.isScheduled&&(this._state=4,this.howl.play())}})}static create(ar,cr){return new Ml(ar,cr)}get state(){return this._state}get error(){return this._error}get isPlaying(){return this._state===4||this._state===0}play(ar){this.howl.volume(normalizeVolume(ar)),this.isScheduled=!0,this.howl.state()==="loaded"&&!this.howl.playing()&&this.howl.play()}stop(){this.isScheduled=!1,this.howl.stop()}dispose(){this.isScheduled=!1,this.howl.stop(),this.howl.unload()}};const VOLUME_STEP=10,sounds$=create(new Map,or=>({isPlaying(ar){const cr=getFileKey(ar),lr=or.value.get(cr);return!!(lr!=null&&lr.isPlaying)},play(ar,cr){const lr=getFileKey(ar);let ur=or.value.get(lr);ur||(ur=Sound$1.create(ar,cr),or.value.set(lr,ur)),ur.play(cr)},close(ar){const cr=getFileKey(ar),lr=or.value.get(cr);lr&&lr.stop()},closeAll(){for(const ar of or.value.values())ar.stop()},clear(){for(const ar of or.value.values())ar.dispose();or.set(new Map)}})),muted$=create(!1),volume$=create(100,or=>({increase(){or.update(ar=>clamp$2(ar+VOLUME_STEP,0,100))},decrease(){or.update(ar=>clamp$2(ar-VOLUME_STEP,0,100))}}));muted$.watch(or=>{howler.Howler.mute(or)});volume$.watch(or=>{howler.Howler.volume(normalizeVolume(clamp$2(or,0,100)))});function getFileKey(or){return or.replace("/","__").toUpperCase()}const isPauseScreenVisible$=create(!1),pauseScreenCurrentPanel$=create("credits");isPauseScreenVisible$.subscribe(or=>{or?isPaused$.set(!0):isPaused$.set(!1)});const saveLoadedCallback$=create(),gameSavedCallback$=create(),saveSlots$=create([]),namedSlots$=create([]),requestedAction$=create(null),QUICK_SAVE_KEY="__quicksave_qspider__";async function loadSaveList(){var lr,ur;const or=currentGameEntry$.value;if(!or){saveSlots$.set([]),namedSlots$.set([]);return}const ar=await((lr=storage$.value)==null?void 0:lr.getSavedSlots(or.id));saveSlots$.set(ar||[]);const cr=await((ur=storage$.value)==null?void 0:ur.getNamedSaves(or.id));namedSlots$.set(cr||[])}async function saveToSlot(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=(dr=qspApi$.value)==null?void 0:dr.saveGame();lr&&await((pr=storage$.value)==null?void 0:pr.saveBySlot(cr.id,or,lr));const ur=gameSavedCallback$.value;ur==null||ur(),gameSavedCallback$.set(null),requestedAction$.set(null),await loadSaveList()}async function saveToPath(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=(dr=qspApi$.value)==null?void 0:dr.saveGame();lr&&await((pr=storage$.value)==null?void 0:pr.saveByKey(cr.id,or,lr));const ur=gameSavedCallback$.value;ur==null||ur(),gameSavedCallback$.set(null),requestedAction$.set(null),await loadSaveList()}async function restoreFromSlot(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=await((dr=storage$.value)==null?void 0:dr.getSaveDataBySlot(cr.id,or)),ur=saveLoadedCallback$.value;ur==null||ur(),saveLoadedCallback$.set(null),requestedAction$.set(null),lr&&((pr=qspApi$.value)==null||pr.loadSave(lr))}async function restoreFromPath(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=await((dr=storage$.value)==null?void 0:dr.getSaveDataByKey(cr.id,or)),ur=saveLoadedCallback$.value;ur==null||ur(),saveLoadedCallback$.set(null),requestedAction$.set(null),lr&&((pr=qspApi$.value)==null||pr.loadSave(lr))}async function clearSlot(or){var cr;const ar=currentGameEntry$.value;ar&&(await((cr=storage$.value)==null?void 0:cr.clearSaveSlot(ar.id,or)),await loadSaveList())}async function clearPath(or){var cr;const ar=currentGameEntry$.value;ar&&(await((cr=storage$.value)==null?void 0:cr.clearSaveKey(ar.id,or)),await loadSaveList())}async function quickSave(){var cr;if((cr=qspApi$.value)==null?void 0:cr.readVariable("NOSAVE"))return;const ar=currentGameEntry$.value;ar&&await withCounterPaused(async()=>{var ur,fr;const lr=(ur=qspApi$.value)==null?void 0:ur.saveGame();lr&&await((fr=storage$.value)==null?void 0:fr.saveByKey(ar.id,QUICK_SAVE_KEY,lr))})}async function quickLoad(){var cr;if((cr=qspApi$.value)==null?void 0:cr.readVariable("NOSAVE"))return;const ar=currentGameEntry$.value;ar&&await withCounterPaused(async()=>{var ur,fr;const lr=await((ur=storage$.value)==null?void 0:ur.getSaveDataByKey(ar.id,QUICK_SAVE_KEY));lr&&((fr=qspApi$.value)==null||fr.loadSave(lr),onRestore())})}async function onSaveCommand(or,ar){const{slot_index:cr,save_path:lr}=ar;switch(or){case"load":cr>0?await restoreFromSlot(cr):lr&&await restoreFromPath(lr),onRestore(),isPauseScreenVisible$.set(!1);break;case"save":cr>0?await saveToSlot(cr):lr&&await saveToPath(lr),isPauseScreenVisible$.set(!1);break;case"clear":cr>0?clearSlot(cr):lr&&clearPath(lr);break;default:console.error(`Unknown save action: ${or}`)}}var mousetrap={exports:{}};(function(or){(function(ar,cr,lr){if(!ar)return;for(var ur={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},fr={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},dr={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},pr={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},mr,gr=1;gr<20;++gr)ur[111+gr]="f"+gr;for(gr=0;gr<=9;++gr)ur[gr+96]=gr.toString();function vr(Tr,jr,Rr){if(Tr.addEventListener){Tr.addEventListener(jr,Rr,!1);return}Tr.attachEvent("on"+jr,Rr)}function hr(Tr){if(Tr.type=="keypress"){var jr=String.fromCharCode(Tr.which);return Tr.shiftKey||(jr=jr.toLowerCase()),jr}return ur[Tr.which]?ur[Tr.which]:fr[Tr.which]?fr[Tr.which]:String.fromCharCode(Tr.which).toLowerCase()}function $r(Tr,jr){return Tr.sort().join(",")===jr.sort().join(",")}function xr(Tr){var jr=[];return Tr.shiftKey&&jr.push("shift"),Tr.altKey&&jr.push("alt"),Tr.ctrlKey&&jr.push("ctrl"),Tr.metaKey&&jr.push("meta"),jr}function br(Tr){if(Tr.preventDefault){Tr.preventDefault();return}Tr.returnValue=!1}function Er(Tr){if(Tr.stopPropagation){Tr.stopPropagation();return}Tr.cancelBubble=!0}function wr(Tr){return Tr=="shift"||Tr=="ctrl"||Tr=="alt"||Tr=="meta"}function yr(){if(!mr){mr={};for(var Tr in ur)Tr>95&&Tr<112||ur.hasOwnProperty(Tr)&&(mr[ur[Tr]]=Tr)}return mr}function _r(Tr,jr,Rr){return Rr||(Rr=yr()[Tr]?"keydown":"keypress"),Rr=="keypress"&&jr.length&&(Rr="keydown"),Rr}function Sr(Tr){return Tr==="+"?["+"]:(Tr=Tr.replace(/\+{2}/g,"+plus"),Tr.split("+"))}function Pr(Tr,jr){var Rr,Fr,Vr,Zr=[];for(Rr=Sr(Tr),Vr=0;Vr1){Br(Gr,io,Qr,lo);return}Jr=Pr(Gr,lo),jr._callbacks[Jr.key]=jr._callbacks[Jr.key]||[],Kr(Jr.key,Jr.modifiers,{type:Jr.action},ao,Gr,Yr),jr._callbacks[Jr.key][ao?"unshift":"push"]({callback:Qr,modifiers:Jr.modifiers,action:Jr.action,seq:ao,level:Yr,combo:Gr})}jr._bindMultiple=function(Gr,Qr,lo){for(var ao=0;ao-1||Or(jr,Rr.target))return!1;if("composedPath"in Tr&&typeof Tr.composedPath=="function"){var Fr=Tr.composedPath()[0];Fr!==Tr.target&&(jr=Fr)}return jr.tagName=="INPUT"||jr.tagName=="SELECT"||jr.tagName=="TEXTAREA"||jr.isContentEditable},Lr.prototype.handleKey=function(){var Tr=this;return Tr._handleKey.apply(Tr,arguments)},Lr.addKeycodes=function(Tr){for(var jr in Tr)Tr.hasOwnProperty(jr)&&(ur[jr]=Tr[jr]);mr=null},Lr.init=function(){var Tr=Lr(cr);for(var jr in Tr)jr.charAt(0)!=="_"&&(Lr[jr]=function(Rr){return function(){return Tr[Rr].apply(Tr,arguments)}}(jr))},Lr.init(),ar.Mousetrap=Lr,or.exports&&(or.exports=Lr),typeof lr=="function"&&lr.amd&&lr(function(){return Lr})})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(mousetrap);var mousetrapExports=mousetrap.exports;const Mousetrap=getDefaultExportFromCjs(mousetrapExports),windowManager$=create(),globalHotKeys$=create([{when_paused:!1,description:"Action #1",keys:"1",on_press:{type:"action",index:0}},{when_paused:!1,description:"Action #2",keys:"2",on_press:{type:"action",index:1}},{when_paused:!1,description:"Action #3",keys:"3",on_press:{type:"action",index:2}},{when_paused:!1,description:"Action #4",keys:"4",on_press:{type:"action",index:3}},{when_paused:!1,description:"Action #5",keys:"5",on_press:{type:"action",index:4}},{when_paused:!1,description:"Action #6",keys:"6",on_press:{type:"action",index:5}},{when_paused:!1,description:"Action #7",keys:"7",on_press:{type:"action",index:6}},{when_paused:!1,description:"Action #8",keys:"8",on_press:{type:"action",index:7}},{when_paused:!1,description:"Action #9",keys:"9",on_press:{type:"action",index:8}},{when_paused:!1,keys:"space",description:"Single action",on_press:()=>isPaused$.value?void 0:(actions$.value.length===1&&(selectAction(0),execSelectedAction()),!1)},{when_paused:!0,description:"Restart",keys:"mod+r",on_press:{type:"game_action",action:"restart"}},{when_paused:!1,description:"Quicksave",keys:"f5",on_press:{type:"game_action",action:"quicksave"}},{when_paused:!1,description:"Quickload",keys:"f9",on_press:{type:"game_action",action:"quickload"}},{when_paused:!1,keys:"mod+s",description:"Save",on_press:()=>(requestedAction$.set("save"),onGameCommand("pause:saves"),!1)},{when_paused:!1,keys:"mod+o",description:"Load",on_press:()=>(requestedAction$.set("load"),onGameCommand("pause:saves"),!1)},{when_paused:!0,keys:"pageup",description:"Increase volume",on_press:()=>(volume$.actions.increase(),!1)},{when_paused:!0,keys:"pagedown",description:"Decrease volume",on_press:()=>(volume$.actions.decrease(),!1)},{when_paused:!0,description:"Mute",keys:"home",on_press:{type:"game_action",action:"mute"}},{when_paused:!0,description:"Unmute",keys:"end",on_press:{type:"game_action",action:"unmute"}}]);function setupGlobalHotKeys(){for(const or of globalHotKeys$.value)Mousetrap.bind([or.keys],(ar,cr)=>{if(!(!or.when_paused&&isPaused$.value)){if(typeof or.on_press=="function")return or.on_press(ar,cr);if(or.on_press.type==="action")return selectAction(or.on_press.index),execSelectedAction(),!1;if(or.on_press.type==="game_action")return onGameCommand(or.on_press.action),!1}})}function setupCustomHotKeys(or){for(const[ar,cr]of Object.entries(or))Mousetrap.bind(ar,()=>{var lr;return(lr=qspApi$.value)==null||lr.execLoc(cr),!1})}const prettySymbolsCommon={backspace:"BackSpace",tab:"Tab",enter:"↵ Enter",capslock:"CapsLock",space:"Space",pageup:"PageUp",pagedown:"PageDown",end:"End",home:"Home",left:"←",up:"↑",right:"→",down:"↓",ins:"Insert",del:"Delete",plus:"+",shift:"Shift",ctrl:"Ctrl",alt:"Alt",mod:"Ctrl"},prettySymbolsMacOs={shift:"⇧",ctrl:"⌃",alt:"⌥",mod:"⌘"};function prettifyHotkeys(or){var lr;const ar=[],cr=or.split(" ");for(let ur=0;ur(or[or.top=1]="top",or[or.right=2]="right",or[or.bottom=3]="bottom",or[or.left=4]="left",or[or.center=5]="center",or))(WxWidgetsDirection||{});const qspGuiCfg$=create(null),qspGuiLayout$=create(or=>{var fr;const ar=or(qspGuiCfg$);if(!ar)return null;const cr=((fr=or(defaultClassicTheme$).qsp_player)==null?void 0:fr.template)??"",lr=buildLayoutTree(ar.Panels);let ur="";lr.layer&&(ur+=convertLayer(lr.layer,ar.Docks,cr));for(const dr of lr.floating)ur+=convertPane(dr,cr,!0);return ur});function buildLayoutTree(or){const ar=getMaxLayer(or),cr=or.filter(fr=>fr.floating&&fr.name==="imgview"),lr=or.filter(fr=>!fr.floating);let ur=null;for(let fr=0;fr<=ar;fr++){const dr=getLayerPanels(fr,lr);ur={index:fr,top:[],right:[],bottom:[],left:[],center:ur||[]};for(const pr of dr)pr.dir==="center"&&pr.name!=="desc"||ur[pr.dir].push(pr)}return{layer:ur,floating:cr}}function convertLayer(or,ar,cr){return`${convertDock("top",or.top,ar,cr)}${convertDock("left",or.left,ar,cr)}${Array.isArray(or.center)?convertDock("center",or.center,ar,cr):convertLayer(or.center,ar,cr)}${convertDock("right",or.right,ar,cr)}${convertDock("bottom",or.bottom,ar,cr)}`}function convertDock(or,ar,cr,lr){if(!ar.length)return"";const ur=ar.map(gr=>gr.name!=="desc"?gr.name:"").filter(Boolean),fr=ur.length>0?` visibility="${ur.join("|")}"`:"",[dr]=ar,pr=`${WxWidgetsDirection[dr.dir]},${dr.layer},${dr.row}`,mr=or!=="center"&&cr[pr]?` size="${cr[pr]}"`:"";return`${ar.map(gr=>convertPane(gr,lr,!1)).join("")}`}function convertPane(or,ar,cr){return`${extractFromDefaultTheme(or.name,ar,cr)}`}function getMaxLayer(or){return Math.max(...or.map(({layer:ar})=>ar))}function getLayerPanels(or,ar){return ar.filter(cr=>cr.layer===or).sort((cr,lr)=>cr.pos-lr.pos)}const paneToTagMap={imgview:"qsp-view",acts:"qsp-actions",desc:"qsp-main",objs:"qsp-objects",vars:"qsp-stats",input:"qsp-cmd"};function extractFromDefaultTheme(or,ar,cr){const lr=paneToTagMap[or];if(!lr)return"";const ur=new RegExp(`<${lr}([\\s\\S]*?)`,"im"),fr=ar.match(ur),dr=(fr==null?void 0:fr[0])??"";return cr?dr.replace(new RegExp(`<${lr}(.*?)>`,"im"),`<${lr} modal>`):dr.replace(new RegExp(`<${lr}(.*?)>`,"im"),`<${lr}>`)}const GROUP_REGEXP=/\[(.*?)\]/i,LINE_REGEXP=/(.*?)=(.*)/i,DOCK_LINE=/dock_size\((.*?)\)=(.*)/,IS_FLOATABLE_MASK=1,asNumber=(or,ar)=>({[or]:Number(ar)}),asString=(or,ar)=>({[or]:ar}),converters={BackColor:asNumber,FontColor:asNumber,LinkColor:asNumber,FontSize:asNumber,FontName:asString,Panels:parsePanels,dir:(or,ar)=>({[or]:WxWidgetsDirection[ar]}),layer:asNumber,name:asString,pos:asNumber,row:asNumber,prop:asNumber};function processData(or,ar){const cr=converters[or];return(cr==null?void 0:cr(or,ar))??{}}function parsePanels(or,ar){const cr=[],lr={};for(const ur of ar.split("|").filter(Boolean))if(ur!=="layout2")if(ur.startsWith("dock_size")){const fr=ur.match(DOCK_LINE);if(fr){const[,dr,pr]=fr;dr&&pr&&(lr[dr]=Number(pr))}}else{const fr=ur.split(";").map(extractLineData).reduce((dr,[pr,mr])=>{if(pr==="state")dr.floating=(Number(mr)&IS_FLOATABLE_MASK)!==0;else if(pr&&mr&&pr in converters)return{...dr,...processData(pr,mr)};return dr},{});cr.push(fr)}return{Panels:cr,Docks:lr}}function extractLineData(or){const ar=or.match(LINE_REGEXP);if(ar){const[,cr,lr]=ar;return[cr,lr]}return[]}function parseCfg(or){let ar={};for(const cr of or.split(/\r?\n/gim).filter(Boolean)){if(GROUP_REGEXP.test(cr))continue;const[lr,ur]=extractLineData(cr);lr&&ur&&lr in converters&&(ar={...ar,...processData(lr,ur)})}return ar}const consoleLogger={type:"logger",log(or){this.output("log",or)},warn(or){this.output("warn",or)},error(or){this.output("error",or)},output(or,ar){console&&console[or]&&console[or].apply(console,ar)}};class Logger{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(ar,cr)}init(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=cr.prefix||"i18next:",this.logger=ar||consoleLogger,this.options=cr,this.debug=cr.debug}log(){for(var ar=arguments.length,cr=new Array(ar),lr=0;lr{this.observers[lr]=this.observers[lr]||[],this.observers[lr].push(cr)}),this}off(ar,cr){if(this.observers[ar]){if(!cr){delete this.observers[ar];return}this.observers[ar]=this.observers[ar].filter(lr=>lr!==cr)}}emit(ar){for(var cr=arguments.length,lr=new Array(cr>1?cr-1:0),ur=1;ur{dr(...lr)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(dr=>{dr.apply(dr,[ar,...lr])})}}function defer(){let or,ar;const cr=new Promise((lr,ur)=>{or=lr,ar=ur});return cr.resolve=or,cr.reject=ar,cr}function makeString(or){return or==null?"":""+or}function copy(or,ar,cr){or.forEach(lr=>{ar[lr]&&(cr[lr]=ar[lr])})}function getLastOfPath(or,ar,cr){function lr(dr){return dr&&dr.indexOf("###")>-1?dr.replace(/###/g,"."):dr}function ur(){return!or||typeof or=="string"}const fr=typeof ar!="string"?[].concat(ar):ar.split(".");for(;fr.length>1;){if(ur())return{};const dr=lr(fr.shift());!or[dr]&&cr&&(or[dr]=new cr),Object.prototype.hasOwnProperty.call(or,dr)?or=or[dr]:or={}}return ur()?{}:{obj:or,k:lr(fr.shift())}}function setPath(or,ar,cr){const{obj:lr,k:ur}=getLastOfPath(or,ar,Object);lr[ur]=cr}function pushPath(or,ar,cr,lr){const{obj:ur,k:fr}=getLastOfPath(or,ar,Object);ur[fr]=ur[fr]||[],lr&&(ur[fr]=ur[fr].concat(cr)),lr||ur[fr].push(cr)}function getPath(or,ar){const{obj:cr,k:lr}=getLastOfPath(or,ar);if(cr)return cr[lr]}function getPathWithDefaults(or,ar,cr){const lr=getPath(or,cr);return lr!==void 0?lr:getPath(ar,cr)}function deepExtend(or,ar,cr){for(const lr in ar)lr!=="__proto__"&&lr!=="constructor"&&(lr in or?typeof or[lr]=="string"||or[lr]instanceof String||typeof ar[lr]=="string"||ar[lr]instanceof String?cr&&(or[lr]=ar[lr]):deepExtend(or[lr],ar[lr],cr):or[lr]=ar[lr]);return or}function regexEscape(or){return or.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape(or){return typeof or=="string"?or.replace(/[&<>"'\/]/g,ar=>_entityMap[ar]):or}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(or,ar,cr){ar=ar||"",cr=cr||"";const lr=chars.filter(dr=>ar.indexOf(dr)<0&&cr.indexOf(dr)<0);if(lr.length===0)return!0;const ur=new RegExp(`(${lr.map(dr=>dr==="?"?"\\?":dr).join("|")})`);let fr=!ur.test(or);if(!fr){const dr=or.indexOf(cr);dr>0&&!ur.test(or.substring(0,dr))&&(fr=!0)}return fr}function deepFind(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!or)return;if(or[ar])return or[ar];const lr=ar.split(cr);let ur=or;for(let fr=0;frfr+dr;)dr++,pr=lr.slice(fr,fr+dr).join(cr),mr=ur[pr];if(mr===void 0)return;if(mr===null)return null;if(ar.endsWith(pr)){if(typeof mr=="string")return mr;if(pr&&typeof mr[pr]=="string")return mr[pr]}const gr=lr.slice(fr+dr).join(cr);return gr?deepFind(mr,gr,cr):void 0}ur=ur[lr[fr]]}return ur}function getCleanedCode(or){return or&&or.indexOf("_")>0?or.replace("_","-"):or}class ResourceStore extends EventEmitter{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=ar||{},this.options=cr,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(ar){this.options.ns.indexOf(ar)<0&&this.options.ns.push(ar)}removeNamespaces(ar){const cr=this.options.ns.indexOf(ar);cr>-1&&this.options.ns.splice(cr,1)}getResource(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const fr=ur.keySeparator!==void 0?ur.keySeparator:this.options.keySeparator,dr=ur.ignoreJSONStructure!==void 0?ur.ignoreJSONStructure:this.options.ignoreJSONStructure;let pr=[ar,cr];lr&&typeof lr!="string"&&(pr=pr.concat(lr)),lr&&typeof lr=="string"&&(pr=pr.concat(fr?lr.split(fr):lr)),ar.indexOf(".")>-1&&(pr=ar.split("."));const mr=getPath(this.data,pr);return mr||!dr||typeof lr!="string"?mr:deepFind(this.data&&this.data[ar]&&this.data[ar][cr],lr,fr)}addResource(ar,cr,lr,ur){let fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const dr=fr.keySeparator!==void 0?fr.keySeparator:this.options.keySeparator;let pr=[ar,cr];lr&&(pr=pr.concat(dr?lr.split(dr):lr)),ar.indexOf(".")>-1&&(pr=ar.split("."),ur=cr,cr=pr[1]),this.addNamespaces(cr),setPath(this.data,pr,ur),fr.silent||this.emit("added",ar,cr,lr,ur)}addResources(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const fr in lr)(typeof lr[fr]=="string"||Object.prototype.toString.apply(lr[fr])==="[object Array]")&&this.addResource(ar,cr,fr,lr[fr],{silent:!0});ur.silent||this.emit("added",ar,cr,lr)}addResourceBundle(ar,cr,lr,ur,fr){let dr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},pr=[ar,cr];ar.indexOf(".")>-1&&(pr=ar.split("."),ur=lr,lr=cr,cr=pr[1]),this.addNamespaces(cr);let mr=getPath(this.data,pr)||{};ur?deepExtend(mr,lr,fr):mr={...mr,...lr},setPath(this.data,pr,mr),dr.silent||this.emit("added",ar,cr,lr)}removeResourceBundle(ar,cr){this.hasResourceBundle(ar,cr)&&delete this.data[ar][cr],this.removeNamespaces(cr),this.emit("removed",ar,cr)}hasResourceBundle(ar,cr){return this.getResource(ar,cr)!==void 0}getResourceBundle(ar,cr){return cr||(cr=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(ar,cr)}:this.getResource(ar,cr)}getDataByLanguage(ar){return this.data[ar]}hasLanguageSomeTranslations(ar){const cr=this.getDataByLanguage(ar);return!!(cr&&Object.keys(cr)||[]).find(ur=>cr[ur]&&Object.keys(cr[ur]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(or){this.processors[or.name]=or},handle(or,ar,cr,lr,ur){return or.forEach(fr=>{this.processors[fr]&&(ar=this.processors[fr].process(ar,cr,lr,ur))}),ar}};const checkedLoadedFor={};class Translator extends EventEmitter{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],ar,this),this.options=cr,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(ar){ar&&(this.language=ar)}exists(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(ar==null)return!1;const lr=this.resolve(ar,cr);return lr&&lr.res!==void 0}extractFromKey(ar,cr){let lr=cr.nsSeparator!==void 0?cr.nsSeparator:this.options.nsSeparator;lr===void 0&&(lr=":");const ur=cr.keySeparator!==void 0?cr.keySeparator:this.options.keySeparator;let fr=cr.ns||this.options.defaultNS||[];const dr=lr&&ar.indexOf(lr)>-1,pr=!this.options.userDefinedKeySeparator&&!cr.keySeparator&&!this.options.userDefinedNsSeparator&&!cr.nsSeparator&&!looksLikeObjectPath(ar,lr,ur);if(dr&&!pr){const mr=ar.match(this.interpolator.nestingRegexp);if(mr&&mr.length>0)return{key:ar,namespaces:fr};const gr=ar.split(lr);(lr!==ur||lr===ur&&this.options.ns.indexOf(gr[0])>-1)&&(fr=gr.shift()),ar=gr.join(ur)}return typeof fr=="string"&&(fr=[fr]),{key:ar,namespaces:fr}}translate(ar,cr,lr){if(typeof cr!="object"&&this.options.overloadTranslationOptionHandler&&(cr=this.options.overloadTranslationOptionHandler(arguments)),typeof cr=="object"&&(cr={...cr}),cr||(cr={}),ar==null)return"";Array.isArray(ar)||(ar=[String(ar)]);const ur=cr.returnDetails!==void 0?cr.returnDetails:this.options.returnDetails,fr=cr.keySeparator!==void 0?cr.keySeparator:this.options.keySeparator,{key:dr,namespaces:pr}=this.extractFromKey(ar[ar.length-1],cr),mr=pr[pr.length-1],gr=cr.lng||this.language,vr=cr.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(gr&&gr.toLowerCase()==="cimode"){if(vr){const Pr=cr.nsSeparator||this.options.nsSeparator;return ur?{res:`${mr}${Pr}${dr}`,usedKey:dr,exactUsedKey:dr,usedLng:gr,usedNS:mr,usedParams:this.getUsedParamsDetails(cr)}:`${mr}${Pr}${dr}`}return ur?{res:dr,usedKey:dr,exactUsedKey:dr,usedLng:gr,usedNS:mr,usedParams:this.getUsedParamsDetails(cr)}:dr}const hr=this.resolve(ar,cr);let $r=hr&&hr.res;const xr=hr&&hr.usedKey||dr,br=hr&&hr.exactUsedKey||dr,Er=Object.prototype.toString.apply($r),wr=["[object Number]","[object Function]","[object RegExp]"],yr=cr.joinArrays!==void 0?cr.joinArrays:this.options.joinArrays,_r=!this.i18nFormat||this.i18nFormat.handleAsObject;if(_r&&$r&&(typeof $r!="string"&&typeof $r!="boolean"&&typeof $r!="number")&&wr.indexOf(Er)<0&&!(typeof yr=="string"&&Er==="[object Array]")){if(!cr.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Pr=this.options.returnedObjectHandler?this.options.returnedObjectHandler(xr,$r,{...cr,ns:pr}):`key '${dr} (${this.language})' returned an object instead of string.`;return ur?(hr.res=Pr,hr.usedParams=this.getUsedParamsDetails(cr),hr):Pr}if(fr){const Pr=Er==="[object Array]",Or=Pr?[]:{},Lr=Pr?br:xr;for(const Tr in $r)if(Object.prototype.hasOwnProperty.call($r,Tr)){const jr=`${Lr}${fr}${Tr}`;Or[Tr]=this.translate(jr,{...cr,joinArrays:!1,ns:pr}),Or[Tr]===jr&&(Or[Tr]=$r[Tr])}$r=Or}}else if(_r&&typeof yr=="string"&&Er==="[object Array]")$r=$r.join(yr),$r&&($r=this.extendTranslation($r,ar,cr,lr));else{let Pr=!1,Or=!1;const Lr=cr.count!==void 0&&typeof cr.count!="string",Tr=Translator.hasDefaultValue(cr),jr=Lr?this.pluralResolver.getSuffix(gr,cr.count,cr):"",Rr=cr.ordinal&&Lr?this.pluralResolver.getSuffix(gr,cr.count,{ordinal:!1}):"",Fr=cr[`defaultValue${jr}`]||cr[`defaultValue${Rr}`]||cr.defaultValue;!this.isValidLookup($r)&&Tr&&(Pr=!0,$r=Fr),this.isValidLookup($r)||(Or=!0,$r=dr);const Zr=(cr.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Or?void 0:$r,so=Tr&&Fr!==$r&&this.options.updateMissing;if(Or||Pr||so){if(this.logger.log(so?"updateKey":"missingKey",gr,mr,dr,so?Fr:$r),fr){const eo=this.resolve(dr,{...cr,keySeparator:!1});eo&&eo.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Ir=[];const Kr=this.languageUtils.getFallbackCodes(this.options.fallbackLng,cr.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Kr&&Kr[0])for(let eo=0;eo{const ro=Tr&&Br!==$r?Br:Zr;this.options.missingKeyHandler?this.options.missingKeyHandler(eo,mr,Wr,ro,so,cr):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(eo,mr,Wr,ro,so,cr),this.emit("missingKey",eo,mr,Wr,$r)};this.options.saveMissing&&(this.options.saveMissingPlurals&&Lr?Ir.forEach(eo=>{this.pluralResolver.getSuffixes(eo,cr).forEach(Wr=>{no([eo],dr+Wr,cr[`defaultValue${Wr}`]||Fr)})}):no(Ir,dr,Fr))}$r=this.extendTranslation($r,ar,cr,hr,lr),Or&&$r===dr&&this.options.appendNamespaceToMissingKey&&($r=`${mr}:${dr}`),(Or||Pr)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?$r=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${mr}:${dr}`:dr,Pr?$r:void 0):$r=this.options.parseMissingKeyHandler($r))}return ur?(hr.res=$r,hr.usedParams=this.getUsedParamsDetails(cr),hr):$r}extendTranslation(ar,cr,lr,ur,fr){var dr=this;if(this.i18nFormat&&this.i18nFormat.parse)ar=this.i18nFormat.parse(ar,{...this.options.interpolation.defaultVariables,...lr},lr.lng||this.language||ur.usedLng,ur.usedNS,ur.usedKey,{resolved:ur});else if(!lr.skipInterpolation){lr.interpolation&&this.interpolator.init({...lr,interpolation:{...this.options.interpolation,...lr.interpolation}});const gr=typeof ar=="string"&&(lr&&lr.interpolation&&lr.interpolation.skipOnVariables!==void 0?lr.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let vr;if(gr){const $r=ar.match(this.interpolator.nestingRegexp);vr=$r&&$r.length}let hr=lr.replace&&typeof lr.replace!="string"?lr.replace:lr;if(this.options.interpolation.defaultVariables&&(hr={...this.options.interpolation.defaultVariables,...hr}),ar=this.interpolator.interpolate(ar,hr,lr.lng||this.language,lr),gr){const $r=ar.match(this.interpolator.nestingRegexp),xr=$r&&$r.length;vr1&&arguments[1]!==void 0?arguments[1]:{},lr,ur,fr,dr,pr;return typeof ar=="string"&&(ar=[ar]),ar.forEach(mr=>{if(this.isValidLookup(lr))return;const gr=this.extractFromKey(mr,cr),vr=gr.key;ur=vr;let hr=gr.namespaces;this.options.fallbackNS&&(hr=hr.concat(this.options.fallbackNS));const $r=cr.count!==void 0&&typeof cr.count!="string",xr=$r&&!cr.ordinal&&cr.count===0&&this.pluralResolver.shouldUseIntlApi(),br=cr.context!==void 0&&(typeof cr.context=="string"||typeof cr.context=="number")&&cr.context!=="",Er=cr.lngs?cr.lngs:this.languageUtils.toResolveHierarchy(cr.lng||this.language,cr.fallbackLng);hr.forEach(wr=>{this.isValidLookup(lr)||(pr=wr,!checkedLoadedFor[`${Er[0]}-${wr}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(pr)&&(checkedLoadedFor[`${Er[0]}-${wr}`]=!0,this.logger.warn(`key "${ur}" for languages "${Er.join(", ")}" won't get resolved as namespace "${pr}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),Er.forEach(yr=>{if(this.isValidLookup(lr))return;dr=yr;const _r=[vr];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(_r,vr,yr,wr,cr);else{let Pr;$r&&(Pr=this.pluralResolver.getSuffix(yr,cr.count,cr));const Or=`${this.options.pluralSeparator}zero`,Lr=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if($r&&(_r.push(vr+Pr),cr.ordinal&&Pr.indexOf(Lr)===0&&_r.push(vr+Pr.replace(Lr,this.options.pluralSeparator)),xr&&_r.push(vr+Or)),br){const Tr=`${vr}${this.options.contextSeparator}${cr.context}`;_r.push(Tr),$r&&(_r.push(Tr+Pr),cr.ordinal&&Pr.indexOf(Lr)===0&&_r.push(Tr+Pr.replace(Lr,this.options.pluralSeparator)),xr&&_r.push(Tr+Or))}}let Sr;for(;Sr=_r.pop();)this.isValidLookup(lr)||(fr=Sr,lr=this.getResource(yr,wr,Sr,cr))}))})}),{res:lr,usedKey:ur,exactUsedKey:fr,usedLng:dr,usedNS:pr}}isValidLookup(ar){return ar!==void 0&&!(!this.options.returnNull&&ar===null)&&!(!this.options.returnEmptyString&&ar==="")}getResource(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(ar,cr,lr,ur):this.resourceStore.getResource(ar,cr,lr,ur)}getUsedParamsDetails(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const cr=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],lr=ar.replace&&typeof ar.replace!="string";let ur=lr?ar.replace:ar;if(lr&&typeof ar.count<"u"&&(ur.count=ar.count),this.options.interpolation.defaultVariables&&(ur={...this.options.interpolation.defaultVariables,...ur}),!lr){ur={...ur};for(const fr of cr)delete ur[fr]}return ur}static hasDefaultValue(ar){const cr="defaultValue";for(const lr in ar)if(Object.prototype.hasOwnProperty.call(ar,lr)&&cr===lr.substring(0,cr.length)&&ar[lr]!==void 0)return!0;return!1}}function capitalize(or){return or.charAt(0).toUpperCase()+or.slice(1)}class LanguageUtil{constructor(ar){this.options=ar,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(ar){if(ar=getCleanedCode(ar),!ar||ar.indexOf("-")<0)return null;const cr=ar.split("-");return cr.length===2||(cr.pop(),cr[cr.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(cr.join("-"))}getLanguagePartFromCode(ar){if(ar=getCleanedCode(ar),!ar||ar.indexOf("-")<0)return ar;const cr=ar.split("-");return this.formatLanguageCode(cr[0])}formatLanguageCode(ar){if(typeof ar=="string"&&ar.indexOf("-")>-1){const cr=["hans","hant","latn","cyrl","cans","mong","arab"];let lr=ar.split("-");return this.options.lowerCaseLng?lr=lr.map(ur=>ur.toLowerCase()):lr.length===2?(lr[0]=lr[0].toLowerCase(),lr[1]=lr[1].toUpperCase(),cr.indexOf(lr[1].toLowerCase())>-1&&(lr[1]=capitalize(lr[1].toLowerCase()))):lr.length===3&&(lr[0]=lr[0].toLowerCase(),lr[1].length===2&&(lr[1]=lr[1].toUpperCase()),lr[0]!=="sgn"&&lr[2].length===2&&(lr[2]=lr[2].toUpperCase()),cr.indexOf(lr[1].toLowerCase())>-1&&(lr[1]=capitalize(lr[1].toLowerCase())),cr.indexOf(lr[2].toLowerCase())>-1&&(lr[2]=capitalize(lr[2].toLowerCase()))),lr.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?ar.toLowerCase():ar}isSupportedCode(ar){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(ar=this.getLanguagePartFromCode(ar)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(ar)>-1}getBestMatchFromCodes(ar){if(!ar)return null;let cr;return ar.forEach(lr=>{if(cr)return;const ur=this.formatLanguageCode(lr);(!this.options.supportedLngs||this.isSupportedCode(ur))&&(cr=ur)}),!cr&&this.options.supportedLngs&&ar.forEach(lr=>{if(cr)return;const ur=this.getLanguagePartFromCode(lr);if(this.isSupportedCode(ur))return cr=ur;cr=this.options.supportedLngs.find(fr=>{if(fr===ur)return fr;if(!(fr.indexOf("-")<0&&ur.indexOf("-")<0)&&fr.indexOf(ur)===0)return fr})}),cr||(cr=this.getFallbackCodes(this.options.fallbackLng)[0]),cr}getFallbackCodes(ar,cr){if(!ar)return[];if(typeof ar=="function"&&(ar=ar(cr)),typeof ar=="string"&&(ar=[ar]),Object.prototype.toString.apply(ar)==="[object Array]")return ar;if(!cr)return ar.default||[];let lr=ar[cr];return lr||(lr=ar[this.getScriptPartFromCode(cr)]),lr||(lr=ar[this.formatLanguageCode(cr)]),lr||(lr=ar[this.getLanguagePartFromCode(cr)]),lr||(lr=ar.default),lr||[]}toResolveHierarchy(ar,cr){const lr=this.getFallbackCodes(cr||this.options.fallbackLng||[],ar),ur=[],fr=dr=>{dr&&(this.isSupportedCode(dr)?ur.push(dr):this.logger.warn(`rejecting language code not found in supportedLngs: ${dr}`))};return typeof ar=="string"&&(ar.indexOf("-")>-1||ar.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&fr(this.formatLanguageCode(ar)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&fr(this.getScriptPartFromCode(ar)),this.options.load!=="currentOnly"&&fr(this.getLanguagePartFromCode(ar))):typeof ar=="string"&&fr(this.formatLanguageCode(ar)),lr.forEach(dr=>{ur.indexOf(dr)<0&&fr(this.formatLanguageCode(dr))}),ur}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(or){return+(or>1)},2:function(or){return+(or!=1)},3:function(or){return 0},4:function(or){return or%10==1&&or%100!=11?0:or%10>=2&&or%10<=4&&(or%100<10||or%100>=20)?1:2},5:function(or){return or==0?0:or==1?1:or==2?2:or%100>=3&&or%100<=10?3:or%100>=11?4:5},6:function(or){return or==1?0:or>=2&&or<=4?1:2},7:function(or){return or==1?0:or%10>=2&&or%10<=4&&(or%100<10||or%100>=20)?1:2},8:function(or){return or==1?0:or==2?1:or!=8&&or!=11?2:3},9:function(or){return+(or>=2)},10:function(or){return or==1?0:or==2?1:or<7?2:or<11?3:4},11:function(or){return or==1||or==11?0:or==2||or==12?1:or>2&&or<20?2:3},12:function(or){return+(or%10!=1||or%100==11)},13:function(or){return+(or!==0)},14:function(or){return or==1?0:or==2?1:or==3?2:3},15:function(or){return or%10==1&&or%100!=11?0:or%10>=2&&(or%100<10||or%100>=20)?1:2},16:function(or){return or%10==1&&or%100!=11?0:or!==0?1:2},17:function(or){return or==1||or%10==1&&or%100!=11?0:1},18:function(or){return or==0?0:or==1?1:2},19:function(or){return or==1?0:or==0||or%100>1&&or%100<11?1:or%100>10&&or%100<20?2:3},20:function(or){return or==1?0:or==0||or%100>0&&or%100<20?1:2},21:function(or){return or%100==1?1:or%100==2?2:or%100==3||or%100==4?3:0},22:function(or){return or==1?0:or==2?1:(or<0||or>10)&&or%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const or={};return sets.forEach(ar=>{ar.lngs.forEach(cr=>{or[cr]={numbers:ar.nr,plurals:_rulesPluralsTypes[ar.fc]}})}),or}class PluralResolver{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=ar,this.options=cr,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(ar,cr){this.rules[ar]=cr}getRule(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(ar),{type:cr.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[ar]||this.rules[this.languageUtils.getLanguagePartFromCode(ar)]}needsPlural(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const lr=this.getRule(ar,cr);return this.shouldUseIntlApi()?lr&&lr.resolvedOptions().pluralCategories.length>1:lr&&lr.numbers.length>1}getPluralFormsOfKey(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(ar,lr).map(ur=>`${cr}${ur}`)}getSuffixes(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const lr=this.getRule(ar,cr);return lr?this.shouldUseIntlApi()?lr.resolvedOptions().pluralCategories.sort((ur,fr)=>suffixesOrder[ur]-suffixesOrder[fr]).map(ur=>`${this.options.prepend}${cr.ordinal?`ordinal${this.options.prepend}`:""}${ur}`):lr.numbers.map(ur=>this.getSuffix(ar,ur,cr)):[]}getSuffix(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ur=this.getRule(ar,lr);return ur?this.shouldUseIntlApi()?`${this.options.prepend}${lr.ordinal?`ordinal${this.options.prepend}`:""}${ur.select(cr)}`:this.getSuffixRetroCompatible(ur,cr):(this.logger.warn(`no plural rule found for: ${ar}`),"")}getSuffixRetroCompatible(ar,cr){const lr=ar.noAbs?ar.plurals(cr):ar.plurals(Math.abs(cr));let ur=ar.numbers[lr];this.options.simplifyPluralSuffix&&ar.numbers.length===2&&ar.numbers[0]===1&&(ur===2?ur="plural":ur===1&&(ur=""));const fr=()=>this.options.prepend&&ur.toString()?this.options.prepend+ur.toString():ur.toString();return this.options.compatibilityJSON==="v1"?ur===1?"":typeof ur=="number"?`_plural_${ur.toString()}`:fr():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&ar.numbers.length===2&&ar.numbers[0]===1?fr():this.options.prepend&&lr.toString()?this.options.prepend+lr.toString():lr.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(or,ar,cr){let lr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",ur=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,fr=getPathWithDefaults(or,ar,cr);return!fr&&ur&&typeof cr=="string"&&(fr=deepFind(or,cr,lr),fr===void 0&&(fr=deepFind(ar,cr,lr))),fr}class Interpolator{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=ar,this.format=ar.interpolation&&ar.interpolation.format||(cr=>cr),this.init(ar)}init(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ar.interpolation||(ar.interpolation={escapeValue:!0});const cr=ar.interpolation;this.escape=cr.escape!==void 0?cr.escape:escape,this.escapeValue=cr.escapeValue!==void 0?cr.escapeValue:!0,this.useRawValueToEscape=cr.useRawValueToEscape!==void 0?cr.useRawValueToEscape:!1,this.prefix=cr.prefix?regexEscape(cr.prefix):cr.prefixEscaped||"{{",this.suffix=cr.suffix?regexEscape(cr.suffix):cr.suffixEscaped||"}}",this.formatSeparator=cr.formatSeparator?cr.formatSeparator:cr.formatSeparator||",",this.unescapePrefix=cr.unescapeSuffix?"":cr.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":cr.unescapeSuffix||"",this.nestingPrefix=cr.nestingPrefix?regexEscape(cr.nestingPrefix):cr.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=cr.nestingSuffix?regexEscape(cr.nestingSuffix):cr.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=cr.nestingOptionsSeparator?cr.nestingOptionsSeparator:cr.nestingOptionsSeparator||",",this.maxReplaces=cr.maxReplaces?cr.maxReplaces:1e3,this.alwaysFormat=cr.alwaysFormat!==void 0?cr.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const ar=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(ar,"g");const cr=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(cr,"g");const lr=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(lr,"g")}interpolate(ar,cr,lr,ur){let fr,dr,pr;const mr=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function gr(br){return br.replace(/\$/g,"$$$$")}const vr=br=>{if(br.indexOf(this.formatSeparator)<0){const _r=deepFindWithDefaults(cr,mr,br,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_r,void 0,lr,{...ur,...cr,interpolationkey:br}):_r}const Er=br.split(this.formatSeparator),wr=Er.shift().trim(),yr=Er.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(cr,mr,wr,this.options.keySeparator,this.options.ignoreJSONStructure),yr,lr,{...ur,...cr,interpolationkey:wr})};this.resetRegExp();const hr=ur&&ur.missingInterpolationHandler||this.options.missingInterpolationHandler,$r=ur&&ur.interpolation&&ur.interpolation.skipOnVariables!==void 0?ur.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:br=>gr(br)},{regex:this.regexp,safeValue:br=>this.escapeValue?gr(this.escape(br)):gr(br)}].forEach(br=>{for(pr=0;fr=br.regex.exec(ar);){const Er=fr[1].trim();if(dr=vr(Er),dr===void 0)if(typeof hr=="function"){const yr=hr(ar,fr,ur);dr=typeof yr=="string"?yr:""}else if(ur&&Object.prototype.hasOwnProperty.call(ur,Er))dr="";else if($r){dr=fr[0];continue}else this.logger.warn(`missed to pass in variable ${Er} for interpolating ${ar}`),dr="";else typeof dr!="string"&&!this.useRawValueToEscape&&(dr=makeString(dr));const wr=br.safeValue(dr);if(ar=ar.replace(fr[0],wr),$r?(br.regex.lastIndex+=dr.length,br.regex.lastIndex-=fr[0].length):br.regex.lastIndex=0,pr++,pr>=this.maxReplaces)break}}),ar}nest(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ur,fr,dr;function pr(mr,gr){const vr=this.nestingOptionsSeparator;if(mr.indexOf(vr)<0)return mr;const hr=mr.split(new RegExp(`${vr}[ ]*{`));let $r=`{${hr[1]}`;mr=hr[0],$r=this.interpolate($r,dr);const xr=$r.match(/'/g),br=$r.match(/"/g);(xr&&xr.length%2===0&&!br||br.length%2!==0)&&($r=$r.replace(/'/g,'"'));try{dr=JSON.parse($r),gr&&(dr={...gr,...dr})}catch(Er){return this.logger.warn(`failed parsing options string in nesting for key ${mr}`,Er),`${mr}${vr}${$r}`}return delete dr.defaultValue,mr}for(;ur=this.nestingRegexp.exec(ar);){let mr=[];dr={...lr},dr=dr.replace&&typeof dr.replace!="string"?dr.replace:dr,dr.applyPostProcessor=!1,delete dr.defaultValue;let gr=!1;if(ur[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(ur[1])){const vr=ur[1].split(this.formatSeparator).map(hr=>hr.trim());ur[1]=vr.shift(),mr=vr,gr=!0}if(fr=cr(pr.call(this,ur[1].trim(),dr),dr),fr&&ur[0]===ar&&typeof fr!="string")return fr;typeof fr!="string"&&(fr=makeString(fr)),fr||(this.logger.warn(`missed to resolve ${ur[1]} for nesting ${ar}`),fr=""),gr&&(fr=mr.reduce((vr,hr)=>this.format(vr,hr,lr.lng,{...lr,interpolationkey:ur[1].trim()}),fr.trim())),ar=ar.replace(ur[0],fr),this.regexp.lastIndex=0}return ar}}function parseFormatStr(or){let ar=or.toLowerCase().trim();const cr={};if(or.indexOf("(")>-1){const lr=or.split("(");ar=lr[0].toLowerCase().trim();const ur=lr[1].substring(0,lr[1].length-1);ar==="currency"&&ur.indexOf(":")<0?cr.currency||(cr.currency=ur.trim()):ar==="relativetime"&&ur.indexOf(":")<0?cr.range||(cr.range=ur.trim()):ur.split(";").forEach(dr=>{if(!dr)return;const[pr,...mr]=dr.split(":"),gr=mr.join(":").trim().replace(/^'+|'+$/g,"");cr[pr.trim()]||(cr[pr.trim()]=gr),gr==="false"&&(cr[pr.trim()]=!1),gr==="true"&&(cr[pr.trim()]=!0),isNaN(gr)||(cr[pr.trim()]=parseInt(gr,10))})}return{formatName:ar,formatOptions:cr}}function createCachedFormatter(or){const ar={};return function(lr,ur,fr){const dr=ur+JSON.stringify(fr);let pr=ar[dr];return pr||(pr=or(getCleanedCode(ur),fr),ar[dr]=pr),pr(lr)}}class Formatter{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=ar,this.formats={number:createCachedFormatter((cr,lr)=>{const ur=new Intl.NumberFormat(cr,{...lr});return fr=>ur.format(fr)}),currency:createCachedFormatter((cr,lr)=>{const ur=new Intl.NumberFormat(cr,{...lr,style:"currency"});return fr=>ur.format(fr)}),datetime:createCachedFormatter((cr,lr)=>{const ur=new Intl.DateTimeFormat(cr,{...lr});return fr=>ur.format(fr)}),relativetime:createCachedFormatter((cr,lr)=>{const ur=new Intl.RelativeTimeFormat(cr,{...lr});return fr=>ur.format(fr,lr.range||"day")}),list:createCachedFormatter((cr,lr)=>{const ur=new Intl.ListFormat(cr,{...lr});return fr=>ur.format(fr)})},this.init(ar)}init(ar){const lr=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=lr.formatSeparator?lr.formatSeparator:lr.formatSeparator||","}add(ar,cr){this.formats[ar.toLowerCase().trim()]=cr}addCached(ar,cr){this.formats[ar.toLowerCase().trim()]=createCachedFormatter(cr)}format(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return cr.split(this.formatSeparator).reduce((pr,mr)=>{const{formatName:gr,formatOptions:vr}=parseFormatStr(mr);if(this.formats[gr]){let hr=pr;try{const $r=ur&&ur.formatParams&&ur.formatParams[ur.interpolationkey]||{},xr=$r.locale||$r.lng||ur.locale||ur.lng||lr;hr=this.formats[gr](pr,xr,{...vr,...ur,...$r})}catch($r){this.logger.warn($r)}return hr}else this.logger.warn(`there was no format function for ${gr}`);return pr},ar)}}function removePending(or,ar){or.pending[ar]!==void 0&&(delete or.pending[ar],or.pendingCount--)}class Connector extends EventEmitter{constructor(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=ar,this.store=cr,this.services=lr,this.languageUtils=lr.languageUtils,this.options=ur,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=ur.maxParallelReads||10,this.readingCalls=0,this.maxRetries=ur.maxRetries>=0?ur.maxRetries:5,this.retryTimeout=ur.retryTimeout>=1?ur.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(lr,ur.backend,ur)}queueLoad(ar,cr,lr,ur){const fr={},dr={},pr={},mr={};return ar.forEach(gr=>{let vr=!0;cr.forEach(hr=>{const $r=`${gr}|${hr}`;!lr.reload&&this.store.hasResourceBundle(gr,hr)?this.state[$r]=2:this.state[$r]<0||(this.state[$r]===1?dr[$r]===void 0&&(dr[$r]=!0):(this.state[$r]=1,vr=!1,dr[$r]===void 0&&(dr[$r]=!0),fr[$r]===void 0&&(fr[$r]=!0),mr[hr]===void 0&&(mr[hr]=!0)))}),vr||(pr[gr]=!0)}),(Object.keys(fr).length||Object.keys(dr).length)&&this.queue.push({pending:dr,pendingCount:Object.keys(dr).length,loaded:{},errors:[],callback:ur}),{toLoad:Object.keys(fr),pending:Object.keys(dr),toLoadLanguages:Object.keys(pr),toLoadNamespaces:Object.keys(mr)}}loaded(ar,cr,lr){const ur=ar.split("|"),fr=ur[0],dr=ur[1];cr&&this.emit("failedLoading",fr,dr,cr),lr&&this.store.addResourceBundle(fr,dr,lr),this.state[ar]=cr?-1:2;const pr={};this.queue.forEach(mr=>{pushPath(mr.loaded,[fr],dr),removePending(mr,ar),cr&&mr.errors.push(cr),mr.pendingCount===0&&!mr.done&&(Object.keys(mr.loaded).forEach(gr=>{pr[gr]||(pr[gr]={});const vr=mr.loaded[gr];vr.length&&vr.forEach(hr=>{pr[gr][hr]===void 0&&(pr[gr][hr]=!0)})}),mr.done=!0,mr.errors.length?mr.callback(mr.errors):mr.callback())}),this.emit("loaded",pr),this.queue=this.queue.filter(mr=>!mr.done)}read(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,dr=arguments.length>5?arguments[5]:void 0;if(!ar.length)return dr(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:ar,ns:cr,fcName:lr,tried:ur,wait:fr,callback:dr});return}this.readingCalls++;const pr=(gr,vr)=>{if(this.readingCalls--,this.waitingReads.length>0){const hr=this.waitingReads.shift();this.read(hr.lng,hr.ns,hr.fcName,hr.tried,hr.wait,hr.callback)}if(gr&&vr&&ur{this.read.call(this,ar,cr,lr,ur+1,fr*2,dr)},fr);return}dr(gr,vr)},mr=this.backend[lr].bind(this.backend);if(mr.length===2){try{const gr=mr(ar,cr);gr&&typeof gr.then=="function"?gr.then(vr=>pr(null,vr)).catch(pr):pr(null,gr)}catch(gr){pr(gr)}return}return mr(ar,cr,pr)}prepareLoading(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ur=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),ur&&ur();typeof ar=="string"&&(ar=this.languageUtils.toResolveHierarchy(ar)),typeof cr=="string"&&(cr=[cr]);const fr=this.queueLoad(ar,cr,lr,ur);if(!fr.toLoad.length)return fr.pending.length||ur(),null;fr.toLoad.forEach(dr=>{this.loadOne(dr)})}load(ar,cr,lr){this.prepareLoading(ar,cr,{},lr)}reload(ar,cr,lr){this.prepareLoading(ar,cr,{reload:!0},lr)}loadOne(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const lr=ar.split("|"),ur=lr[0],fr=lr[1];this.read(ur,fr,"read",void 0,void 0,(dr,pr)=>{dr&&this.logger.warn(`${cr}loading namespace ${fr} for language ${ur} failed`,dr),!dr&&pr&&this.logger.log(`${cr}loaded namespace ${fr} for language ${ur}`,pr),this.loaded(ar,dr,pr)})}saveMissing(ar,cr,lr,ur,fr){let dr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},pr=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(cr)){this.logger.warn(`did not save key "${lr}" as the namespace "${cr}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(lr==null||lr==="")){if(this.backend&&this.backend.create){const mr={...dr,isUpdate:fr},gr=this.backend.create.bind(this.backend);if(gr.length<6)try{let vr;gr.length===5?vr=gr(ar,cr,lr,ur,mr):vr=gr(ar,cr,lr,ur),vr&&typeof vr.then=="function"?vr.then(hr=>pr(null,hr)).catch(pr):pr(null,vr)}catch(vr){pr(vr)}else gr(ar,cr,lr,ur,pr,mr)}!ar||!ar[0]||this.store.addResource(ar[0],cr,lr,ur)}}}function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(ar){let cr={};if(typeof ar[1]=="object"&&(cr=ar[1]),typeof ar[1]=="string"&&(cr.defaultValue=ar[1]),typeof ar[2]=="string"&&(cr.tDescription=ar[2]),typeof ar[2]=="object"||typeof ar[3]=="object"){const lr=ar[3]||ar[2];Object.keys(lr).forEach(ur=>{cr[ur]=lr[ur]})}return cr},interpolation:{escapeValue:!0,format:(or,ar,cr,lr)=>or,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(or){return typeof or.ns=="string"&&(or.ns=[or.ns]),typeof or.fallbackLng=="string"&&(or.fallbackLng=[or.fallbackLng]),typeof or.fallbackNS=="string"&&(or.fallbackNS=[or.fallbackNS]),or.supportedLngs&&or.supportedLngs.indexOf("cimode")<0&&(or.supportedLngs=or.supportedLngs.concat(["cimode"])),or}function noop$2(){}function bindMemberFunctions(or){Object.getOwnPropertyNames(Object.getPrototypeOf(or)).forEach(cr=>{typeof or[cr]=="function"&&(or[cr]=or[cr].bind(or))})}class I18n extends EventEmitter{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(ar),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),cr&&!this.isInitialized&&!ar.isClone){if(!this.options.initImmediate)return this.init(ar,cr),this;setTimeout(()=>{this.init(ar,cr)},0)}}init(){var ar=this;let cr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lr=arguments.length>1?arguments[1]:void 0;typeof cr=="function"&&(lr=cr,cr={}),!cr.defaultNS&&cr.defaultNS!==!1&&cr.ns&&(typeof cr.ns=="string"?cr.defaultNS=cr.ns:cr.ns.indexOf("translation")<0&&(cr.defaultNS=cr.ns[0]));const ur=get();this.options={...ur,...this.options,...transformOptions(cr)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...ur.interpolation,...this.options.interpolation}),cr.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=cr.keySeparator),cr.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=cr.nsSeparator);function fr(vr){return vr?typeof vr=="function"?new vr:vr:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(fr(this.modules.logger),this.options):baseLogger.init(null,this.options);let vr;this.modules.formatter?vr=this.modules.formatter:typeof Intl<"u"&&(vr=Formatter);const hr=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const $r=this.services;$r.logger=baseLogger,$r.resourceStore=this.store,$r.languageUtils=hr,$r.pluralResolver=new PluralResolver(hr,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),vr&&(!this.options.interpolation.format||this.options.interpolation.format===ur.interpolation.format)&&($r.formatter=fr(vr),$r.formatter.init($r,this.options),this.options.interpolation.format=$r.formatter.format.bind($r.formatter)),$r.interpolator=new Interpolator(this.options),$r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},$r.backendConnector=new Connector(fr(this.modules.backend),$r.resourceStore,$r,this.options),$r.backendConnector.on("*",function(xr){for(var br=arguments.length,Er=new Array(br>1?br-1:0),wr=1;wr1?br-1:0),wr=1;wr{xr.init&&xr.init(this)})}if(this.format=this.options.interpolation.format,lr||(lr=noop$2),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const vr=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);vr.length>0&&vr[0]!=="dev"&&(this.options.lng=vr[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(vr=>{this[vr]=function(){return ar.store[vr](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(vr=>{this[vr]=function(){return ar.store[vr](...arguments),ar}});const mr=defer(),gr=()=>{const vr=(hr,$r)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),mr.resolve($r),lr(hr,$r)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return vr(null,this.t.bind(this));this.changeLanguage(this.options.lng,vr)};return this.options.resources||!this.options.initImmediate?gr():setTimeout(gr,0),mr}loadResources(ar){let lr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const ur=typeof ar=="string"?ar:this.language;if(typeof ar=="function"&&(lr=ar),!this.options.resources||this.options.partialBundledLanguages){if(ur&&ur.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return lr();const fr=[],dr=pr=>{if(!pr||pr==="cimode")return;this.services.languageUtils.toResolveHierarchy(pr).forEach(gr=>{gr!=="cimode"&&fr.indexOf(gr)<0&&fr.push(gr)})};ur?dr(ur):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(mr=>dr(mr)),this.options.preload&&this.options.preload.forEach(pr=>dr(pr)),this.services.backendConnector.load(fr,this.options.ns,pr=>{!pr&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),lr(pr)})}else lr(null)}reloadResources(ar,cr,lr){const ur=defer();return ar||(ar=this.languages),cr||(cr=this.options.ns),lr||(lr=noop$2),this.services.backendConnector.reload(ar,cr,fr=>{ur.resolve(),lr(fr)}),ur}use(ar){if(!ar)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!ar.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return ar.type==="backend"&&(this.modules.backend=ar),(ar.type==="logger"||ar.log&&ar.warn&&ar.error)&&(this.modules.logger=ar),ar.type==="languageDetector"&&(this.modules.languageDetector=ar),ar.type==="i18nFormat"&&(this.modules.i18nFormat=ar),ar.type==="postProcessor"&&postProcessor.addPostProcessor(ar),ar.type==="formatter"&&(this.modules.formatter=ar),ar.type==="3rdParty"&&this.modules.external.push(ar),this}setResolvedLanguage(ar){if(!(!ar||!this.languages)&&!(["cimode","dev"].indexOf(ar)>-1))for(let cr=0;cr-1)&&this.store.hasLanguageSomeTranslations(lr)){this.resolvedLanguage=lr;break}}}changeLanguage(ar,cr){var lr=this;this.isLanguageChangingTo=ar;const ur=defer();this.emit("languageChanging",ar);const fr=mr=>{this.language=mr,this.languages=this.services.languageUtils.toResolveHierarchy(mr),this.resolvedLanguage=void 0,this.setResolvedLanguage(mr)},dr=(mr,gr)=>{gr?(fr(gr),this.translator.changeLanguage(gr),this.isLanguageChangingTo=void 0,this.emit("languageChanged",gr),this.logger.log("languageChanged",gr)):this.isLanguageChangingTo=void 0,ur.resolve(function(){return lr.t(...arguments)}),cr&&cr(mr,function(){return lr.t(...arguments)})},pr=mr=>{!ar&&!mr&&this.services.languageDetector&&(mr=[]);const gr=typeof mr=="string"?mr:this.services.languageUtils.getBestMatchFromCodes(mr);gr&&(this.language||fr(gr),this.translator.language||this.translator.changeLanguage(gr),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(gr)),this.loadResources(gr,vr=>{dr(vr,gr)})};return!ar&&this.services.languageDetector&&!this.services.languageDetector.async?pr(this.services.languageDetector.detect()):!ar&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(pr):this.services.languageDetector.detect(pr):pr(ar),ur}getFixedT(ar,cr,lr){var ur=this;const fr=function(dr,pr){let mr;if(typeof pr!="object"){for(var gr=arguments.length,vr=new Array(gr>2?gr-2:0),hr=2;hr`${mr.keyPrefix}${$r}${br}`):xr=mr.keyPrefix?`${mr.keyPrefix}${$r}${dr}`:dr,ur.t(xr,mr)};return typeof ar=="string"?fr.lng=ar:fr.lngs=ar,fr.ns=cr,fr.keyPrefix=lr,fr}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(ar){this.options.defaultNS=ar}hasLoadedNamespace(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const lr=cr.lng||this.resolvedLanguage||this.languages[0],ur=this.options?this.options.fallbackLng:!1,fr=this.languages[this.languages.length-1];if(lr.toLowerCase()==="cimode")return!0;const dr=(pr,mr)=>{const gr=this.services.backendConnector.state[`${pr}|${mr}`];return gr===-1||gr===2};if(cr.precheck){const pr=cr.precheck(this,dr);if(pr!==void 0)return pr}return!!(this.hasResourceBundle(lr,ar)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||dr(lr,ar)&&(!ur||dr(fr,ar)))}loadNamespaces(ar,cr){const lr=defer();return this.options.ns?(typeof ar=="string"&&(ar=[ar]),ar.forEach(ur=>{this.options.ns.indexOf(ur)<0&&this.options.ns.push(ur)}),this.loadResources(ur=>{lr.resolve(),cr&&cr(ur)}),lr):(cr&&cr(),Promise.resolve())}loadLanguages(ar,cr){const lr=defer();typeof ar=="string"&&(ar=[ar]);const ur=this.options.preload||[],fr=ar.filter(dr=>ur.indexOf(dr)<0);return fr.length?(this.options.preload=ur.concat(fr),this.loadResources(dr=>{lr.resolve(),cr&&cr(dr)}),lr):(cr&&cr(),Promise.resolve())}dir(ar){if(ar||(ar=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!ar)return"rtl";const cr=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],lr=this.services&&this.services.languageUtils||new LanguageUtil(get());return cr.indexOf(lr.getLanguagePartFromCode(ar))>-1||ar.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1?arguments[1]:void 0;return new I18n(ar,cr)}cloneInstance(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const lr=ar.forkResourceStore;lr&&delete ar.forkResourceStore;const ur={...this.options,...ar,isClone:!0},fr=new I18n(ur);return(ar.debug!==void 0||ar.prefix!==void 0)&&(fr.logger=fr.logger.clone(ar)),["store","services","language"].forEach(pr=>{fr[pr]=this[pr]}),fr.services={...this.services},fr.services.utils={hasLoadedNamespace:fr.hasLoadedNamespace.bind(fr)},lr&&(fr.store=new ResourceStore(this.store.data,ur),fr.services.resourceStore=fr.store),fr.translator=new Translator(fr.services,ur),fr.translator.on("*",function(pr){for(var mr=arguments.length,gr=new Array(mr>1?mr-1:0),vr=1;vr()=>{if(or.isInitialized)ar();else{const cr=()=>{setTimeout(()=>{or.off("initialized",cr)},0),ar()};or.on("initialized",cr)}};function loadNamespaces(or,ar,cr){or.loadNamespaces(ar,loadedClb(or,cr))}function loadLanguages(or,ar,cr,lr){typeof cr=="string"&&(cr=[cr]),cr.forEach(ur=>{or.options.ns.indexOf(ur)<0&&or.options.ns.push(ur)}),or.loadLanguages(ar,loadedClb(or,lr))}function oldI18nextHasLoadedNamespace(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const lr=ar.languages[0],ur=ar.options?ar.options.fallbackLng:!1,fr=ar.languages[ar.languages.length-1];if(lr.toLowerCase()==="cimode")return!0;const dr=(pr,mr)=>{const gr=ar.services.backendConnector.state[`${pr}|${mr}`];return gr===-1||gr===2};return cr.bindI18n&&cr.bindI18n.indexOf("languageChanging")>-1&&ar.services.backendConnector.backend&&ar.isLanguageChangingTo&&!dr(ar.isLanguageChangingTo,or)?!1:!!(ar.hasResourceBundle(lr,or)||!ar.services.backendConnector.backend||ar.options.resources&&!ar.options.partialBundledLanguages||dr(lr,or)&&(!ur||dr(fr,or)))}function hasLoadedNamespace(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!ar.languages||!ar.languages.length?(warnOnce("i18n.languages were undefined or empty",ar.languages),!0):ar.options.ignoreJSONStructure!==void 0?ar.hasLoadedNamespace(or,{lng:cr.lng,precheck:(ur,fr)=>{if(cr.bindI18n&&cr.bindI18n.indexOf("languageChanging")>-1&&ur.services.backendConnector.backend&&ur.isLanguageChangingTo&&!fr(ur.isLanguageChangingTo,or))return!1}}):oldI18nextHasLoadedNamespace(or,ar,cr)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=or=>htmlEntities[or],unescape=or=>or.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};function setDefaults(){let or=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions={...defaultOptions,...or}}function getDefaults$2(){return defaultOptions}let i18nInstance;function setI18n(or){i18nInstance=or}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(or){setDefaults(or.options.react),setI18n(or)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(ar){ar.forEach(cr=>{this.usedNamespaces[cr]||(this.usedNamespaces[cr]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious$1=(or,ar)=>{const cr=reactExports.useRef();return reactExports.useEffect(()=>{cr.current=ar?cr.current:or},[or,ar]),cr.current};function useTranslation(or){let ar=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:cr}=ar,{i18n:lr,defaultNS:ur}=reactExports.useContext(I18nContext)||{},fr=cr||lr||getI18n();if(fr&&!fr.reportNamespaces&&(fr.reportNamespaces=new ReportNamespaces),!fr){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const Sr=(Or,Lr)=>typeof Lr=="string"?Lr:Lr&&typeof Lr=="object"&&typeof Lr.defaultValue=="string"?Lr.defaultValue:Array.isArray(Or)?Or[Or.length-1]:Or,Pr=[Sr,{},!1];return Pr.t=Sr,Pr.i18n={},Pr.ready=!1,Pr}fr.options.react&&fr.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const dr={...getDefaults$2(),...fr.options.react,...ar},{useSuspense:pr,keyPrefix:mr}=dr;let gr=or||ur||fr.options&&fr.options.defaultNS;gr=typeof gr=="string"?[gr]:gr||["translation"],fr.reportNamespaces.addUsedNamespaces&&fr.reportNamespaces.addUsedNamespaces(gr);const vr=(fr.isInitialized||fr.initializedStoreOnce)&&gr.every(Sr=>hasLoadedNamespace(Sr,fr,dr));function hr(){return fr.getFixedT(ar.lng||null,dr.nsMode==="fallback"?gr:gr[0],mr)}const[$r,xr]=reactExports.useState(hr);let br=gr.join();ar.lng&&(br=`${ar.lng}${br}`);const Er=usePrevious$1(br),wr=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:Sr,bindI18nStore:Pr}=dr;wr.current=!0,!vr&&!pr&&(ar.lng?loadLanguages(fr,ar.lng,gr,()=>{wr.current&&xr(hr)}):loadNamespaces(fr,gr,()=>{wr.current&&xr(hr)})),vr&&Er&&Er!==br&&wr.current&&xr(hr);function Or(){wr.current&&xr(hr)}return Sr&&fr&&fr.on(Sr,Or),Pr&&fr&&fr.store.on(Pr,Or),()=>{wr.current=!1,Sr&&fr&&Sr.split(" ").forEach(Lr=>fr.off(Lr,Or)),Pr&&fr&&Pr.split(" ").forEach(Lr=>fr.store.off(Lr,Or))}},[fr,br]);const yr=reactExports.useRef(!0);reactExports.useEffect(()=>{wr.current&&!yr.current&&xr(hr),yr.current=!1},[fr,mr]);const _r=[$r,fr,vr];if(_r.t=$r,_r.i18n=fr,_r.ready=vr,vr||!vr&&!pr)return _r;throw new Promise(Sr=>{ar.lng?loadLanguages(fr,ar.lng,gr,()=>Sr()):loadNamespaces(fr,gr,()=>Sr())})}function _classCallCheck(or,ar){if(!(or instanceof ar))throw new TypeError("Cannot call a class as a function")}function _typeof(or){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ar){return typeof ar}:function(ar){return ar&&typeof Symbol=="function"&&ar.constructor===Symbol&&ar!==Symbol.prototype?"symbol":typeof ar},_typeof(or)}function toPrimitive(or,ar){if(_typeof(or)!="object"||!or)return or;var cr=or[Symbol.toPrimitive];if(cr!==void 0){var lr=cr.call(or,ar||"default");if(_typeof(lr)!="object")return lr;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ar==="string"?String:Number)(or)}function toPropertyKey(or){var ar=toPrimitive(or,"string");return _typeof(ar)=="symbol"?ar:String(ar)}function _defineProperties(or,ar){for(var cr=0;cr1&&arguments[1]!==void 0?arguments[1]:{},lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};_classCallCheck(this,or),this.backends=[],this.type="backend",this.allOptions=lr,this.init(ar,cr)}return _createClass(or,[{key:"init",value:function(cr){var lr=this,ur=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=cr,this.options=defaults$3(ur,this.options||{},getDefaults$1()),this.allOptions=fr,this.options.backends&&this.options.backends.forEach(function(dr,pr){lr.backends[pr]=lr.backends[pr]||createClassOnDemand(dr),lr.backends[pr].init(cr,lr.options.backendOptions&&lr.options.backendOptions[pr]||{},fr)}),this.services&&this.options.reloadInterval&&setInterval(function(){return lr.reload()},this.options.reloadInterval)}},{key:"read",value:function(cr,lr,ur){var fr=this,dr=this.backends.length,pr=function gr(vr){if(vr>=dr)return ur(new Error("non of the backend loaded data",!0));var hr=vr===dr-1,$r=fr.options.handleEmptyResourcesAsFailed&&!hr?0:-1,xr=fr.backends[vr];xr.read?handleCorrectReadFunction(xr,cr,lr,function(br,Er,wr){if(!br&&Er&&Object.keys(Er).length>$r){if(ur(null,Er,vr),mr(vr-1,Er),xr.save&&fr.options.cacheHitMode&&["refresh","refreshAndUpdateStore"].indexOf(fr.options.cacheHitMode)>-1){if(wr&&fr.options.refreshExpirationTime&&wr+fr.options.refreshExpirationTime>Date.now())return;var yr=fr.backends[vr+1];yr&&yr.read&&handleCorrectReadFunction(yr,cr,lr,function(_r,Sr){_r||Sr&&(Object.keys(Sr).length<=$r||(mr(vr,Sr),fr.options.cacheHitMode==="refreshAndUpdateStore"&&fr.services&&fr.services.resourceStore&&fr.services.resourceStore.addResourceBundle(cr,lr,Sr)))})}}else gr(vr+1)}):gr(vr+1)},mr=function gr(vr,hr){if(!(vr<0)){var $r=fr.backends[vr];$r.save&&$r.save(cr,lr,hr),gr(vr-1,hr)}};pr(0)}},{key:"create",value:function(cr,lr,ur,fr){var dr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},pr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(mr){if(mr.create){var gr=mr.create.bind(mr);if(gr.length<6){try{var vr;gr.length===5?vr=gr(cr,lr,ur,fr,pr):vr=gr(cr,lr,ur,fr),vr&&typeof vr.then=="function"?vr.then(function(hr){return dr(null,hr)}).catch(dr):dr(null,vr)}catch(hr){dr(hr)}return}gr(cr,lr,ur,fr,dr,pr)}})}},{key:"reload",value:function(){var cr=this,lr=this.services,ur=lr.backendConnector,fr=lr.languageUtils,dr=lr.logger,pr=ur.language;if(!(pr&&pr.toLowerCase()==="cimode")){var mr=[],gr=function(hr){var $r=fr.toResolveHierarchy(hr);$r.forEach(function(xr){mr.indexOf(xr)<0&&mr.push(xr)})};gr(pr),this.allOptions.preload&&this.allOptions.preload.forEach(function(vr){return gr(vr)}),mr.forEach(function(vr){cr.allOptions.ns.forEach(function(hr){ur.read(vr,hr,"read",null,null,function($r,xr){$r&&dr.warn("loading namespace ".concat(hr," for language ").concat(vr," failed"),$r),!$r&&xr&&dr.log("loaded namespace ".concat(hr," for language ").concat(vr),xr),ur.loaded("".concat(vr,"|").concat(hr),$r,xr)})})})}}}]),or}();Backend$1.type="backend";const defaults$2={loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",multiSeparator:"+",allowMultiLoading:!1,fetch:typeof fetch>"u"?void 0:fetch,parse:JSON.parse,stringify:JSON.stringify,requestOptions:{}},arrify=or=>Array.isArray(or)?or:[or],normalize=(or,...ar)=>typeof or=="function"?or(...ar):or;class BackendError extends Error{constructor(cr,lr=!1){super(cr);Fs(this,"retry",null);this.retry=lr}}class Backend{constructor(ar,cr){Fs(this,"type","backend");this.init(ar,cr)}init(ar,cr={}){this.services=ar,this.options={...defaults$2,...this.options,...cr}}getLoadPath(ar,cr){return normalize(this.options.loadPath,ar,cr)}read(ar,cr,lr){const ur=this.getLoadPath(ar,cr),fr=this.services.interpolator.interpolate(ur,{lng:ar,ns:cr});this.loadUrl(fr,lr)}readMulti(ar,cr,lr){const ur=this.getLoadPath(ar,cr),{multiSeparator:fr}=this.options,dr=this.services.interpolator.interpolate(ur,{lng:ar.join(fr),ns:cr.join(fr)});this.loadUrl(dr,lr)}loadUrl(ar,cr){const{fetch:lr,requestOptions:ur,parse:fr}=this.options;lr(ar,ur).then(dr=>{const{ok:pr,status:mr}=dr;if(!pr){const gr=mr>=500&&mr<600;throw new BackendError(`failed loading ${ar}`,gr)}return dr.text()},()=>{throw new BackendError(`failed loading ${ar}`)}).then(dr=>{try{return cr(null,fr(dr,ar))}catch{throw new BackendError(`failed parsing ${ar} to json`,!1)}}).catch(dr=>{dr instanceof BackendError&&cr(dr.message,dr.retry)})}create(ar,cr,lr,ur){const fr={[lr]:ur||""};arrify(ar).forEach(dr=>{const{addPath:pr,requestOptions:mr,fetch:gr,stringify:vr}=this.options,hr=this.services.interpolator.interpolate(pr,{lng:dr,ns:cr});try{gr(hr,{method:"POST",body:vr(fr),...mr})}catch($r){console.error($r)}})}}Fs(Backend,"type","backend");var arr=[],each$1=arr.forEach,slice=arr.slice;function defaults$1(or){return each$1.call(slice.call(arguments,1),function(ar){if(ar)for(var cr in ar)or[cr]===void 0&&(or[cr]=ar[cr])}),or}var fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,serializeCookie=function or(ar,cr,lr){var ur=lr||{};ur.path=ur.path||"/";var fr=encodeURIComponent(cr),dr="".concat(ar,"=").concat(fr);if(ur.maxAge>0){var pr=ur.maxAge-0;if(Number.isNaN(pr))throw new Error("maxAge should be a Number");dr+="; Max-Age=".concat(Math.floor(pr))}if(ur.domain){if(!fieldContentRegExp.test(ur.domain))throw new TypeError("option domain is invalid");dr+="; Domain=".concat(ur.domain)}if(ur.path){if(!fieldContentRegExp.test(ur.path))throw new TypeError("option path is invalid");dr+="; Path=".concat(ur.path)}if(ur.expires){if(typeof ur.expires.toUTCString!="function")throw new TypeError("option expires is invalid");dr+="; Expires=".concat(ur.expires.toUTCString())}if(ur.httpOnly&&(dr+="; HttpOnly"),ur.secure&&(dr+="; Secure"),ur.sameSite){var mr=typeof ur.sameSite=="string"?ur.sameSite.toLowerCase():ur.sameSite;switch(mr){case!0:dr+="; SameSite=Strict";break;case"lax":dr+="; SameSite=Lax";break;case"strict":dr+="; SameSite=Strict";break;case"none":dr+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return dr},cookie={create:function or(ar,cr,lr,ur){var fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};lr&&(fr.expires=new Date,fr.expires.setTime(fr.expires.getTime()+lr*60*1e3)),ur&&(fr.domain=ur),document.cookie=serializeCookie(ar,encodeURIComponent(cr),fr)},read:function or(ar){for(var cr="".concat(ar,"="),lr=document.cookie.split(";"),ur=0;ur-1&&(lr=window.location.hash.substring(window.location.hash.indexOf("?")));for(var ur=lr.substring(1),fr=ur.split("&"),dr=0;dr0){var mr=fr[dr].substring(0,pr);mr===ar.lookupQuerystring&&(cr=fr[dr].substring(pr+1))}}}return cr}},hasLocalStorageSupport=null,localStorageAvailable=function or(){if(hasLocalStorageSupport!==null)return hasLocalStorageSupport;try{hasLocalStorageSupport=window!=="undefined"&&window.localStorage!==null;var ar="i18next.translate.boo";window.localStorage.setItem(ar,"foo"),window.localStorage.removeItem(ar)}catch{hasLocalStorageSupport=!1}return hasLocalStorageSupport},localStorage$1={name:"localStorage",lookup:function or(ar){var cr;if(ar.lookupLocalStorage&&localStorageAvailable()){var lr=window.localStorage.getItem(ar.lookupLocalStorage);lr&&(cr=lr)}return cr},cacheUserLanguage:function or(ar,cr){cr.lookupLocalStorage&&localStorageAvailable()&&window.localStorage.setItem(cr.lookupLocalStorage,ar)}},hasSessionStorageSupport=null,sessionStorageAvailable=function or(){if(hasSessionStorageSupport!==null)return hasSessionStorageSupport;try{hasSessionStorageSupport=window!=="undefined"&&window.sessionStorage!==null;var ar="i18next.translate.boo";window.sessionStorage.setItem(ar,"foo"),window.sessionStorage.removeItem(ar)}catch{hasSessionStorageSupport=!1}return hasSessionStorageSupport},sessionStorage={name:"sessionStorage",lookup:function or(ar){var cr;if(ar.lookupSessionStorage&&sessionStorageAvailable()){var lr=window.sessionStorage.getItem(ar.lookupSessionStorage);lr&&(cr=lr)}return cr},cacheUserLanguage:function or(ar,cr){cr.lookupSessionStorage&&sessionStorageAvailable()&&window.sessionStorage.setItem(cr.lookupSessionStorage,ar)}},navigator$1={name:"navigator",lookup:function or(ar){var cr=[];if(typeof navigator<"u"){if(navigator.languages)for(var lr=0;lr0?cr:void 0}},htmlTag={name:"htmlTag",lookup:function or(ar){var cr,lr=ar.htmlTag||(typeof document<"u"?document.documentElement:null);return lr&&typeof lr.getAttribute=="function"&&(cr=lr.getAttribute("lang")),cr}},path={name:"path",lookup:function or(ar){var cr;if(typeof window<"u"){var lr=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(lr instanceof Array)if(typeof ar.lookupFromPathIndex=="number"){if(typeof lr[ar.lookupFromPathIndex]!="string")return;cr=lr[ar.lookupFromPathIndex].replace("/","")}else cr=lr[0].replace("/","")}return cr}},subdomain={name:"subdomain",lookup:function or(ar){var cr=typeof ar.lookupFromSubdomainIndex=="number"?ar.lookupFromSubdomainIndex+1:1,lr=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(lr)return lr[cr]}};function getDefaults(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(ar){return ar}}}var Browser$1=function(){function or(ar){var cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_classCallCheck(this,or),this.type="languageDetector",this.detectors={},this.init(ar,cr)}return _createClass(or,[{key:"init",value:function(cr){var lr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ur=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=cr||{languageUtils:{}},this.options=defaults$1(lr,this.options||{},getDefaults()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(fr){return fr.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=ur,this.addDetector(cookie$1),this.addDetector(querystring),this.addDetector(localStorage$1),this.addDetector(sessionStorage),this.addDetector(navigator$1),this.addDetector(htmlTag),this.addDetector(path),this.addDetector(subdomain)}},{key:"addDetector",value:function(cr){this.detectors[cr.name]=cr}},{key:"detect",value:function(cr){var lr=this;cr||(cr=this.options.order);var ur=[];return cr.forEach(function(fr){if(lr.detectors[fr]){var dr=lr.detectors[fr].lookup(lr.options);dr&&typeof dr=="string"&&(dr=[dr]),dr&&(ur=ur.concat(dr))}}),ur=ur.map(function(fr){return lr.options.convertDetectedLanguage(fr)}),this.services.languageUtils.getBestMatchFromCodes?ur:ur.length>0?ur[0]:null}},{key:"cacheUserLanguage",value:function(cr,lr){var ur=this;lr||(lr=this.options.caches),lr&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(cr)>-1||lr.forEach(function(fr){ur.detectors[fr]&&ur.detectors[fr].cacheUserLanguage(cr,ur.options)}))}}]),or}();Browser$1.type="languageDetector";const locales=["en-US","en","ru-RU","uk-UA"];instance.use(Backend$1).use(Browser$1).use(initReactI18next).init({fallbackLng:"en",supportedLngs:locales,defaultNS:"theme",fallbackNS:"translation",load:"currentOnly",debug:!0,interpolation:{escapeValue:!1},backend:{backends:[Backend],backendOptions:[{loadPath:new URL("locales/",window.location.href).href+"{{lng}}/{{ns}}.json"}]}});function loadThemeTranslations(or){const ar={};for(const cr of or){if(!locales.includes(cr.lang))continue;const lr=ar[cr.lang]??{};lr[cr.tkey]=cr.value,ar[cr.lang]=lr}for(const[cr,lr]of Object.entries(ar))instance.addResourceBundle(cr,"theme",lr,!0,!0)}function unloadThemeTranslations(){for(const or of locales)instance.removeResourceBundle(or,"theme")}function formatDate(or){return new Intl.DateTimeFormat(instance.language,{dateStyle:"long",timeStyle:"short"}).format(or)}const baseInit$=create(!1),initDeferred$=create(defer$1()),initialBaseUrl$=create("/"),input$=create({isOpen:!1,content:"",entered:"",onfinished:null},or=>{const ar=or.focus(lr=>lr.isOpen),cr=or.focus(lr=>lr.entered);return{open(lr,ur){or.set({isOpen:!0,content:lr,entered:"",onfinished:ur})},enter(lr){cr.set(lr)},finish(){var lr,ur;ar.value&&(ar.set(!1),(ur=(lr=or.value).onfinished)==null||ur.call(lr,cr.value))},close(){var lr,ur;ar.value&&(ar.set(!1),(ur=(lr=or.value).onfinished)==null||ur.call(lr,""))},clear(){var lr,ur;ar.value&&((ur=(lr=or.value).onfinished)==null||ur.call(lr,"")),or.set({isOpen:!1,content:"",entered:"",onfinished:null})}}}),menu$=create({isOpen:!1,items:[],onselect:null},or=>{const ar=or.focus(cr=>cr.isOpen);return{open(cr,lr){or.set({isOpen:!0,items:cr,onselect:lr})},select(cr){var lr,ur;ar.set(!1),(ur=(lr=or.value).onselect)==null||ur.call(lr,cr),or.value.onselect=null},close(){var cr,lr;ar.set(!1),(lr=(cr=or.value).onselect)==null||lr.call(cr,-1),or.value.onselect=null},clear(){var cr,lr;ar.value&&((lr=(cr=or.value).onselect)==null||lr.call(cr,-1)),or.set({isOpen:!1,items:[],onselect:null})}}}),msg$=create({isOpen:!1,content:"",onclosed:null},or=>{const ar=or.focus(cr=>cr.isOpen);return{open(cr,lr){or.set({isOpen:!0,content:cr,onclosed:lr})},close(){var cr,lr;ar.value&&(ar.set(!1),(lr=(cr=or.value).onclosed)==null||lr.call(cr))},clear(){var cr,lr;ar.value&&((lr=(cr=or.value).onclosed)==null||lr.call(cr)),or.set({isOpen:!1,content:"",onclosed:null})}}}),currentGameEntry$=create(null),currentGame$=create(),currentGameMode$=create(or=>{var ar;return((ar=or(currentGame$))==null?void 0:ar.mode)||"classic"}),currentAeroWidth$=create(or=>{var ar,cr;return((cr=(ar=or(currentGame$))==null?void 0:ar.aero)==null?void 0:cr.width)??800}),currentAeroHeight$=create(or=>{var ar,cr;return((cr=(ar=or(currentGame$))==null?void 0:ar.aero)==null?void 0:cr.height)??600}),saveSlotsCount$=create(or=>{var ar;return((ar=or(currentGame$))==null?void 0:ar.save_slots)??9}),onGameEnd$=create(null),baseUrl$=create("");async function runGame(or){var ur,fr,dr,pr,mr,gr,vr;if(!or)throw new Error("Game not found");baseUrl$.set(or.loadConfig.url);let ar=or.loadConfig.descriptor||{id:or.id,mode:or.mode,title:or.title,file:""};try{const hr=await fetchProxyFallback("game.cfg").then(xr=>xr.text()),$r=parse$1(hr);if(((ur=$r.game)==null?void 0:ur.length)===1)[ar]=$r.game;else{const xr=(fr=$r.game)==null?void 0:fr.find(br=>br.id===or.id);if(!xr)throw new Error("Config not found");ar=xr}}catch{}if((ar==null?void 0:ar.mode)==="classic"||!(ar!=null&&ar.mode))try{const hr=await fetchProxyFallback("qspgui.cfg");if(!hr.ok)throw new Error("No config file");const $r=await hr.text(),xr=parseCfg($r);if(xr||!Object.keys(xr).length)throw new Error("Invalid config file");qspGuiCfg$.set(xr)}catch{}if(ar.mode==="aero")if(ar.aero)ar.window={...ar.window??{},...ar.aero,resizable:!1};else try{const hr=await fetchProxyFallback("config.xml");if(!hr.ok)throw new Error("No config file");const $r=await hr.text(),Er=new DOMParser().parseFromString($r,"application/xml").querySelector("game");if(Er){const wr=parseInt(Er.getAttribute("width")||"800"),yr=parseInt(Er.getAttribute("height")||"600");ar.aero={width:wr,height:yr},ar.window={...ar.window??{},width:wr,height:yr,resizable:!1}}}catch{ar.aero={width:800,height:600},ar.window={...ar.window??{},width:800,height:600,resizable:!1}}let cr=await fetchProxyFallback(or.loadConfig.entrypoint).then(hr=>hr.arrayBuffer());if(!cr)throw new Error("Failed to load game");or.loadConfig.entrypoint.toLowerCase().endsWith(".qsps")&&(cr=convertQsps(cr)),(dr=windowManager$.value)==null||dr.setTitle(or.title),setupGlobalHotKeys(),ar!=null&&ar.hotkeys&&setupCustomHotKeys(ar.hotkeys),(pr=ar==null?void 0:ar.resources)!=null&&pr.icon&&((mr=windowManager$.value)==null||mr.setIcon(ar.resources.icon)),loadAdditionalResources(ar==null?void 0:ar.resources),ar!=null&&ar.themes&&await registerThemes(ar.themes),ar!=null&&ar.defaultTheme?currentTheme$.set(ar.defaultTheme):(ar==null?void 0:ar.mode)==="aero"?currentTheme$.set(AERO_THEME):currentTheme$.set(CLASSIC_THEME),loadThemeTranslations(currentTranslations$.value),(gr=qspApi$.value)==null||gr.openGame(cr,!0),(vr=qspApi$.value)==null||vr.restartGame(),currentGameEntry$.set(or),ar&¤tGame$.set(ar),loadSaveList(),console.log(ar),ar&&applyWindowSettings(ar.window)}let wasResized=!1;async function applyWindowSettings(or){var ar,cr,lr,ur;if(or){or.width&&or.height&&(await((ar=windowManager$.value)==null?void 0:ar.resize(or.width,or.height)),wasResized=!0);const fr=or.resizable??!0;(cr=windowManager$.value)==null||cr.setResizable(fr),fr&&(or.minWidth&&or.minHeight&&await((lr=windowManager$.value)==null?void 0:lr.setMinSize(or.minWidth,or.minHeight)),or.maxWidth&&or.maxHeight&&await((ur=windowManager$.value)==null?void 0:ur.setMaxSize(or.maxWidth,or.maxHeight))),or.fullscreen&&setTimeout(()=>{var dr;return(dr=windowManager$.value)==null?void 0:dr.goFullscreen()},0)}}baseUrl$.subscribe(or=>{const ar=document.querySelector("#page-base");ar.href=or||"/"});function stopCurrentGame(){var ar;baseUrl$.set(initialBaseUrl$.value),currentGameEntry$.set(null),currentGame$.set(null),qspGuiCfg$.set(null),isPauseScreenVisible$.set(!1),pauseScreenCurrentPanel$.set("credits"),isPaused$.set(!0),input$.actions.clear(),menu$.actions.clear(),msg$.actions.clear(),mainContent$.set(""),statsContent$.set(""),actions$.set([]),objects$.set([]),cmdText$.set("");const or=windowManager$.value;or&&(or.setTitle("qSpider"),or.setIcon("favicon.ico"),or.setResizable(!0),or.unsetMaxSize(),or.unsetMinSize(),wasResized&&or.resize(1024,768)),sounds$.actions.clear(),regions$.set({}),layers$.set({}),clearAdditionalResources(),clearHotkeys(),unloadThemeTranslations(),currentTheme$.set(CLASSIC_THEME),themeRegistry$.actions.reset(),window.dispatchEvent(new Event("game-unload")),wasResized=!1,(ar=onGameEnd$.value)==null||ar.call(onGameEnd$)}function onRestart(){reloadRegions(),reloadLayers()}function onRestore(){reloadRegions(),reloadLayers()}function onGameCommand(or){var ar;if(or.startsWith("pause:")){const[,cr]=or.split(":");isPauseScreenVisible$.value||isPauseScreenVisible$.set(!0),pauseScreenCurrentPanel$.set(cr)}else if(or.startsWith("scroll:")){const[,cr,lr]=or.split(":");switch(cr){case"main":mainScroll$.update(ur=>lr==="top"?-1:Math.max(ur,0)+1);break;case"stats":statsScroll$.update(ur=>lr==="top"?-1:Math.max(ur,0)+1);break}}switch(or){case"quit":stopCurrentGame();break;case"restart":isPaused$.set(!0),(ar=qspApi$.value)==null||ar.restartGame(),onRestart(),isPauseScreenVisible$.set(!1),pauseScreenCurrentPanel$.set("credits");break;case"resume":isPauseScreenVisible$.set(!1);break;case"mute":muted$.set(!0);break;case"unmute":muted$.set(!1);break;case"toggle-mute":muted$.update(cr=>!cr);break;case"quicksave":quickSave();break;case"quickload":quickLoad();break}}const wait$=create(null),waitTimeout$=create();function finishWait(){const or=wait$.value;or&&(clearTimeout(waitTimeout$.value),isPaused$.set(!1),wait$.set(null),or.finish())}wait$.subscribe(or=>{or&&(clearTimeout(waitTimeout$.value),isPaused$.set(!0),waitTimeout$.set(setTimeout(()=>{finishWait()},or.ms)))});const errorMessage$=create(""),isErrorShown$=create(!1);function showError(or){errorMessage$.set(or),isErrorShown$.set(!0)}const noticeMessage$=create(""),isNoticeShown$=create(!1);let noticeTimeout=null;function showNotice(or){noticeMessage$.set(or),isNoticeShown$.set(!0),noticeTimeout&&clearTimeout(noticeTimeout),noticeTimeout=setTimeout(()=>{isNoticeShown$.set(!1)},3e3)}const qspiderCommands={"action:"(or){onGameCommand(or)},"event:"(or){setTimeout(()=>{const ar=or.trim().match(/(.*?)(\[(.*?)\])/i);if(ar){const cr=ar[1],lr=ar[3].split(",").map(ur=>{const fr=ur.trim();return fr.startsWith('"')||fr.startsWith("'")?fr.replace(/['"](.*?)['"]/gim,(dr,pr)=>pr):parseInt(fr)});window.dispatchEvent(new CustomEvent("qspider-event",{detail:{name:cr,args:lr}}))}else window.dispatchEvent(new CustomEvent("qspider-event",{detail:{name:or.trim()}}))},0)},"change_theme:"(or){if(!themeRegistry$.value[or]){errorMessage$.set(`Theme ${or} is not registered`);return}currentTheme$.set(or)},"update_region:"(or){var cr;regions$.focus(lr=>lr[or]).set(((cr=qspApi$.value)==null?void 0:cr.readVariableByKey("$qspider_region",or))??"")},"scroll_region:"(or){const[ar,cr]=or.split(":"),lr=regionsScroll$.focus(ur=>ur[ar]);cr==="top"?lr.set(-1):lr.update(ur=>Math.max(ur,0)+1)},"update_layer:"(or){layers$.focus(cr=>cr[or]).set(readLayerState(or))},update_layers(){const or=layers$.value??{},ar={};for(const cr of Object.keys(or))ar[cr]=readLayerState(cr);layers$.set(ar)},"fullscreen:"(or){var ar,cr;or==="on"?(ar=windowManager$.value)==null||ar.goFullscreen():(cr=windowManager$.value)==null||cr.goWindowed()},quit(){stopCurrentGame()}},qspiderModuleContent=`# qspider_change_theme + */(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(cr){var lr=this;if(!lr.ctx||!lr.ctx.listener)return lr;for(var ur=lr._howls.length-1;ur>=0;ur--)lr._howls[ur].stereo(cr);return lr},HowlerGlobal.prototype.pos=function(cr,lr,ur){var fr=this;if(!fr.ctx||!fr.ctx.listener)return fr;if(lr=typeof lr!="number"?fr._pos[1]:lr,ur=typeof ur!="number"?fr._pos[2]:ur,typeof cr=="number")fr._pos=[cr,lr,ur],typeof fr.ctx.listener.positionX<"u"?(fr.ctx.listener.positionX.setTargetAtTime(fr._pos[0],Howler.ctx.currentTime,.1),fr.ctx.listener.positionY.setTargetAtTime(fr._pos[1],Howler.ctx.currentTime,.1),fr.ctx.listener.positionZ.setTargetAtTime(fr._pos[2],Howler.ctx.currentTime,.1)):fr.ctx.listener.setPosition(fr._pos[0],fr._pos[1],fr._pos[2]);else return fr._pos;return fr},HowlerGlobal.prototype.orientation=function(cr,lr,ur,fr,dr,pr){var mr=this;if(!mr.ctx||!mr.ctx.listener)return mr;var gr=mr._orientation;if(lr=typeof lr!="number"?gr[1]:lr,ur=typeof ur!="number"?gr[2]:ur,fr=typeof fr!="number"?gr[3]:fr,dr=typeof dr!="number"?gr[4]:dr,pr=typeof pr!="number"?gr[5]:pr,typeof cr=="number")mr._orientation=[cr,lr,ur,fr,dr,pr],typeof mr.ctx.listener.forwardX<"u"?(mr.ctx.listener.forwardX.setTargetAtTime(cr,Howler.ctx.currentTime,.1),mr.ctx.listener.forwardY.setTargetAtTime(lr,Howler.ctx.currentTime,.1),mr.ctx.listener.forwardZ.setTargetAtTime(ur,Howler.ctx.currentTime,.1),mr.ctx.listener.upX.setTargetAtTime(fr,Howler.ctx.currentTime,.1),mr.ctx.listener.upY.setTargetAtTime(dr,Howler.ctx.currentTime,.1),mr.ctx.listener.upZ.setTargetAtTime(pr,Howler.ctx.currentTime,.1)):mr.ctx.listener.setOrientation(cr,lr,ur,fr,dr,pr);else return gr;return mr},Howl.prototype.init=function(cr){return function(lr){var ur=this;return ur._orientation=lr.orientation||[1,0,0],ur._stereo=lr.stereo||null,ur._pos=lr.pos||null,ur._pannerAttr={coneInnerAngle:typeof lr.coneInnerAngle<"u"?lr.coneInnerAngle:360,coneOuterAngle:typeof lr.coneOuterAngle<"u"?lr.coneOuterAngle:360,coneOuterGain:typeof lr.coneOuterGain<"u"?lr.coneOuterGain:0,distanceModel:typeof lr.distanceModel<"u"?lr.distanceModel:"inverse",maxDistance:typeof lr.maxDistance<"u"?lr.maxDistance:1e4,panningModel:typeof lr.panningModel<"u"?lr.panningModel:"HRTF",refDistance:typeof lr.refDistance<"u"?lr.refDistance:1,rolloffFactor:typeof lr.rolloffFactor<"u"?lr.rolloffFactor:1},ur._onstereo=lr.onstereo?[{fn:lr.onstereo}]:[],ur._onpos=lr.onpos?[{fn:lr.onpos}]:[],ur._onorientation=lr.onorientation?[{fn:lr.onorientation}]:[],cr.call(this,lr)}}(Howl.prototype.init),Howl.prototype.stereo=function(cr,lr){var ur=this;if(!ur._webAudio)return ur;if(ur._state!=="loaded")return ur._queue.push({event:"stereo",action:function(){ur.stereo(cr,lr)}}),ur;var fr=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof lr>"u")if(typeof cr=="number")ur._stereo=cr,ur._pos=[cr,0,0];else return ur._stereo;for(var dr=ur._getSoundIds(lr),pr=0;pr"u")if(typeof cr=="number")dr._pos=[cr,lr,ur];else return dr._pos;for(var pr=dr._getSoundIds(fr),mr=0;mr"u")if(typeof cr=="number")dr._orientation=[cr,lr,ur];else return dr._orientation;for(var pr=dr._getSoundIds(fr),mr=0;mr"u"&&(ur.pannerAttr||(ur.pannerAttr={coneInnerAngle:ur.coneInnerAngle,coneOuterAngle:ur.coneOuterAngle,coneOuterGain:ur.coneOuterGain,distanceModel:ur.distanceModel,maxDistance:ur.maxDistance,refDistance:ur.refDistance,rolloffFactor:ur.rolloffFactor,panningModel:ur.panningModel}),cr._pannerAttr={coneInnerAngle:typeof ur.pannerAttr.coneInnerAngle<"u"?ur.pannerAttr.coneInnerAngle:cr._coneInnerAngle,coneOuterAngle:typeof ur.pannerAttr.coneOuterAngle<"u"?ur.pannerAttr.coneOuterAngle:cr._coneOuterAngle,coneOuterGain:typeof ur.pannerAttr.coneOuterGain<"u"?ur.pannerAttr.coneOuterGain:cr._coneOuterGain,distanceModel:typeof ur.pannerAttr.distanceModel<"u"?ur.pannerAttr.distanceModel:cr._distanceModel,maxDistance:typeof ur.pannerAttr.maxDistance<"u"?ur.pannerAttr.maxDistance:cr._maxDistance,refDistance:typeof ur.pannerAttr.refDistance<"u"?ur.pannerAttr.refDistance:cr._refDistance,rolloffFactor:typeof ur.pannerAttr.rolloffFactor<"u"?ur.pannerAttr.rolloffFactor:cr._rolloffFactor,panningModel:typeof ur.pannerAttr.panningModel<"u"?ur.pannerAttr.panningModel:cr._panningModel});else return dr=cr._soundById(parseInt(lr[0],10)),dr?dr._pannerAttr:cr._pannerAttr;else lr.length===2&&(ur=lr[0],fr=parseInt(lr[1],10));for(var pr=cr._getSoundIds(fr),mr=0;mror>1?or*.01:or;let Sound$1=class Ml{constructor(ar,cr){this._state=0,this._error=null,this.isScheduled=!1,this.howl=new howler.Howl({src:[ar],volume:normalizeVolume(cr),loop:!1,preload:!0,autoplay:!1,onload:()=>{this._state=2,this.isScheduled&&this.howl.play()},onloaderror:(lr,ur)=>{console.error(ar,ur),this._state=1,this._error=ur},onplayerror:(lr,ur)=>{console.error(ar,ur),this._state=3,this._error=ur},onplay:()=>{this._state=4},onend:()=>{this._state=6},onpause:()=>{this._state=5},onstop:()=>{this._state=6},onunlock:()=>{this._state===2&&this.isScheduled&&(this._state=4,this.howl.play())}})}static create(ar,cr){return new Ml(ar,cr)}get state(){return this._state}get error(){return this._error}get isPlaying(){return this._state===4||this._state===0}play(ar){this.howl.volume(normalizeVolume(ar)),this.isScheduled=!0,this.howl.state()==="loaded"&&!this.howl.playing()&&this.howl.play()}stop(){this.isScheduled=!1,this.howl.stop()}dispose(){this.isScheduled=!1,this.howl.stop(),this.howl.unload()}};const VOLUME_STEP=10,sounds$=create(new Map,or=>({isPlaying(ar){const cr=getFileKey(ar),lr=or.value.get(cr);return!!(lr!=null&&lr.isPlaying)},play(ar,cr){const lr=getFileKey(ar);let ur=or.value.get(lr);ur||(ur=Sound$1.create(ar,cr),or.value.set(lr,ur)),ur.play(cr)},close(ar){const cr=getFileKey(ar),lr=or.value.get(cr);lr&&lr.stop()},closeAll(){for(const ar of or.value.values())ar.stop()},clear(){for(const ar of or.value.values())ar.dispose();or.set(new Map)}})),muted$=create(!1),volume$=create(100,or=>({increase(){or.update(ar=>clamp$2(ar+VOLUME_STEP,0,100))},decrease(){or.update(ar=>clamp$2(ar-VOLUME_STEP,0,100))}}));muted$.watch(or=>{howler.Howler.mute(or)});volume$.watch(or=>{howler.Howler.volume(normalizeVolume(clamp$2(or,0,100)))});function getFileKey(or){return or.replace("/","__").toUpperCase()}const isPauseScreenVisible$=create(!1),pauseScreenCurrentPanel$=create("credits");isPauseScreenVisible$.subscribe(or=>{or?isPaused$.set(!0):isPaused$.set(!1)});const saveLoadedCallback$=create(),gameSavedCallback$=create(),saveSlots$=create([]),namedSlots$=create([]),requestedAction$=create(null),QUICK_SAVE_KEY="__quicksave_qspider__";async function loadSaveList(){var lr,ur;const or=currentGameEntry$.value;if(!or){saveSlots$.set([]),namedSlots$.set([]);return}const ar=await((lr=storage$.value)==null?void 0:lr.getSavedSlots(or.id));saveSlots$.set(ar||[]);const cr=await((ur=storage$.value)==null?void 0:ur.getNamedSaves(or.id));namedSlots$.set(cr||[])}async function saveToSlot(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=(dr=qspApi$.value)==null?void 0:dr.saveGame();lr&&await((pr=storage$.value)==null?void 0:pr.saveBySlot(cr.id,or,lr));const ur=gameSavedCallback$.value;ur==null||ur(),gameSavedCallback$.set(null),requestedAction$.set(null),await loadSaveList()}async function saveToPath(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=(dr=qspApi$.value)==null?void 0:dr.saveGame();lr&&await((pr=storage$.value)==null?void 0:pr.saveByKey(cr.id,or,lr));const ur=gameSavedCallback$.value;ur==null||ur(),gameSavedCallback$.set(null),requestedAction$.set(null),await loadSaveList()}async function restoreFromSlot(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=await((dr=storage$.value)==null?void 0:dr.getSaveDataBySlot(cr.id,or)),ur=saveLoadedCallback$.value;ur==null||ur(),saveLoadedCallback$.set(null),requestedAction$.set(null),lr&&((pr=qspApi$.value)==null||pr.loadSave(lr))}async function restoreFromPath(or){var fr,dr,pr;if((fr=qspApi$.value)==null?void 0:fr.readVariable("NOSAVE"))return;const cr=currentGameEntry$.value;if(!cr)return;const lr=await((dr=storage$.value)==null?void 0:dr.getSaveDataByKey(cr.id,or)),ur=saveLoadedCallback$.value;ur==null||ur(),saveLoadedCallback$.set(null),requestedAction$.set(null),lr&&((pr=qspApi$.value)==null||pr.loadSave(lr))}async function clearSlot(or){var cr;const ar=currentGameEntry$.value;ar&&(await((cr=storage$.value)==null?void 0:cr.clearSaveSlot(ar.id,or)),await loadSaveList())}async function clearPath(or){var cr;const ar=currentGameEntry$.value;ar&&(await((cr=storage$.value)==null?void 0:cr.clearSaveKey(ar.id,or)),await loadSaveList())}async function quickSave(){var cr;if((cr=qspApi$.value)==null?void 0:cr.readVariable("NOSAVE"))return;const ar=currentGameEntry$.value;ar&&await withCounterPaused(async()=>{var ur,fr;const lr=(ur=qspApi$.value)==null?void 0:ur.saveGame();lr&&await((fr=storage$.value)==null?void 0:fr.saveByKey(ar.id,QUICK_SAVE_KEY,lr))})}async function quickLoad(){var cr;if((cr=qspApi$.value)==null?void 0:cr.readVariable("NOSAVE"))return;const ar=currentGameEntry$.value;ar&&await withCounterPaused(async()=>{var ur,fr;const lr=await((ur=storage$.value)==null?void 0:ur.getSaveDataByKey(ar.id,QUICK_SAVE_KEY));lr&&((fr=qspApi$.value)==null||fr.loadSave(lr),onRestore())})}async function onSaveCommand(or,ar){const{slot_index:cr,save_path:lr}=ar;switch(or){case"load":cr>0?await restoreFromSlot(cr):lr&&await restoreFromPath(lr),onRestore(),isPauseScreenVisible$.set(!1);break;case"save":cr>0?await saveToSlot(cr):lr&&await saveToPath(lr),isPauseScreenVisible$.set(!1);break;case"clear":cr>0?clearSlot(cr):lr&&clearPath(lr);break;default:console.error(`Unknown save action: ${or}`)}}var mousetrap={exports:{}};(function(or){(function(ar,cr,lr){if(!ar)return;for(var ur={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},fr={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},dr={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},pr={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},mr,gr=1;gr<20;++gr)ur[111+gr]="f"+gr;for(gr=0;gr<=9;++gr)ur[gr+96]=gr.toString();function vr(Tr,jr,Rr){if(Tr.addEventListener){Tr.addEventListener(jr,Rr,!1);return}Tr.attachEvent("on"+jr,Rr)}function hr(Tr){if(Tr.type=="keypress"){var jr=String.fromCharCode(Tr.which);return Tr.shiftKey||(jr=jr.toLowerCase()),jr}return ur[Tr.which]?ur[Tr.which]:fr[Tr.which]?fr[Tr.which]:String.fromCharCode(Tr.which).toLowerCase()}function $r(Tr,jr){return Tr.sort().join(",")===jr.sort().join(",")}function xr(Tr){var jr=[];return Tr.shiftKey&&jr.push("shift"),Tr.altKey&&jr.push("alt"),Tr.ctrlKey&&jr.push("ctrl"),Tr.metaKey&&jr.push("meta"),jr}function br(Tr){if(Tr.preventDefault){Tr.preventDefault();return}Tr.returnValue=!1}function Er(Tr){if(Tr.stopPropagation){Tr.stopPropagation();return}Tr.cancelBubble=!0}function wr(Tr){return Tr=="shift"||Tr=="ctrl"||Tr=="alt"||Tr=="meta"}function yr(){if(!mr){mr={};for(var Tr in ur)Tr>95&&Tr<112||ur.hasOwnProperty(Tr)&&(mr[ur[Tr]]=Tr)}return mr}function _r(Tr,jr,Rr){return Rr||(Rr=yr()[Tr]?"keydown":"keypress"),Rr=="keypress"&&jr.length&&(Rr="keydown"),Rr}function Sr(Tr){return Tr==="+"?["+"]:(Tr=Tr.replace(/\+{2}/g,"+plus"),Tr.split("+"))}function Pr(Tr,jr){var Rr,Fr,Vr,Zr=[];for(Rr=Sr(Tr),Vr=0;Vr1){Br(Gr,io,Qr,lo);return}Jr=Pr(Gr,lo),jr._callbacks[Jr.key]=jr._callbacks[Jr.key]||[],Kr(Jr.key,Jr.modifiers,{type:Jr.action},ao,Gr,Yr),jr._callbacks[Jr.key][ao?"unshift":"push"]({callback:Qr,modifiers:Jr.modifiers,action:Jr.action,seq:ao,level:Yr,combo:Gr})}jr._bindMultiple=function(Gr,Qr,lo){for(var ao=0;ao-1||Or(jr,Rr.target))return!1;if("composedPath"in Tr&&typeof Tr.composedPath=="function"){var Fr=Tr.composedPath()[0];Fr!==Tr.target&&(jr=Fr)}return jr.tagName=="INPUT"||jr.tagName=="SELECT"||jr.tagName=="TEXTAREA"||jr.isContentEditable},Lr.prototype.handleKey=function(){var Tr=this;return Tr._handleKey.apply(Tr,arguments)},Lr.addKeycodes=function(Tr){for(var jr in Tr)Tr.hasOwnProperty(jr)&&(ur[jr]=Tr[jr]);mr=null},Lr.init=function(){var Tr=Lr(cr);for(var jr in Tr)jr.charAt(0)!=="_"&&(Lr[jr]=function(Rr){return function(){return Tr[Rr].apply(Tr,arguments)}}(jr))},Lr.init(),ar.Mousetrap=Lr,or.exports&&(or.exports=Lr),typeof lr=="function"&&lr.amd&&lr(function(){return Lr})})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(mousetrap);var mousetrapExports=mousetrap.exports;const Mousetrap=getDefaultExportFromCjs(mousetrapExports),windowManager$=create(),globalHotKeys$=create([{when_paused:!1,description:"Action #1",keys:"1",on_press:{type:"action",index:0}},{when_paused:!1,description:"Action #2",keys:"2",on_press:{type:"action",index:1}},{when_paused:!1,description:"Action #3",keys:"3",on_press:{type:"action",index:2}},{when_paused:!1,description:"Action #4",keys:"4",on_press:{type:"action",index:3}},{when_paused:!1,description:"Action #5",keys:"5",on_press:{type:"action",index:4}},{when_paused:!1,description:"Action #6",keys:"6",on_press:{type:"action",index:5}},{when_paused:!1,description:"Action #7",keys:"7",on_press:{type:"action",index:6}},{when_paused:!1,description:"Action #8",keys:"8",on_press:{type:"action",index:7}},{when_paused:!1,description:"Action #9",keys:"9",on_press:{type:"action",index:8}},{when_paused:!1,keys:"space",description:"Single action",on_press:()=>isPaused$.value?void 0:(actions$.value.length===1&&(selectAction(0),execSelectedAction()),!1)},{when_paused:!0,description:"Restart",keys:"mod+r",on_press:{type:"game_action",action:"restart"}},{when_paused:!1,description:"Quicksave",keys:"f5",on_press:{type:"game_action",action:"quicksave"}},{when_paused:!1,description:"Quickload",keys:"f9",on_press:{type:"game_action",action:"quickload"}},{when_paused:!1,keys:"mod+s",description:"Save",on_press:()=>(requestedAction$.set("save"),onGameCommand("pause:saves"),!1)},{when_paused:!1,keys:"mod+o",description:"Load",on_press:()=>(requestedAction$.set("load"),onGameCommand("pause:saves"),!1)},{when_paused:!0,keys:"pageup",description:"Increase volume",on_press:()=>(volume$.actions.increase(),!1)},{when_paused:!0,keys:"pagedown",description:"Decrease volume",on_press:()=>(volume$.actions.decrease(),!1)},{when_paused:!0,description:"Mute",keys:"home",on_press:{type:"game_action",action:"mute"}},{when_paused:!0,description:"Unmute",keys:"end",on_press:{type:"game_action",action:"unmute"}}]);function setupGlobalHotKeys(){for(const or of globalHotKeys$.value)Mousetrap.bind([or.keys],(ar,cr)=>{if(!(!or.when_paused&&isPaused$.value)){if(typeof or.on_press=="function")return or.on_press(ar,cr);if(or.on_press.type==="action")return selectAction(or.on_press.index),execSelectedAction(),!1;if(or.on_press.type==="game_action")return onGameCommand(or.on_press.action),!1}})}function setupCustomHotKeys(or){for(const[ar,cr]of Object.entries(or))Mousetrap.bind(ar,()=>{var lr;if(!isPaused$.value)return(lr=qspApi$.value)==null||lr.execLoc(cr),!1})}const prettySymbolsCommon={backspace:"BackSpace",tab:"Tab",enter:"↵ Enter",capslock:"CapsLock",space:"Space",pageup:"PageUp",pagedown:"PageDown",end:"End",home:"Home",left:"←",up:"↑",right:"→",down:"↓",ins:"Insert",del:"Delete",plus:"+",shift:"Shift",ctrl:"Ctrl",alt:"Alt",mod:"Ctrl"},prettySymbolsMacOs={shift:"⇧",ctrl:"⌃",alt:"⌥",mod:"⌘"};function prettifyHotkeys(or){var lr;const ar=[],cr=or.split(" ");for(let ur=0;ur(or[or.top=1]="top",or[or.right=2]="right",or[or.bottom=3]="bottom",or[or.left=4]="left",or[or.center=5]="center",or))(WxWidgetsDirection||{});const qspGuiCfg$=create(null),qspGuiLayout$=create(or=>{var fr;const ar=or(qspGuiCfg$);if(!ar)return null;const cr=((fr=or(defaultClassicTheme$).qsp_player)==null?void 0:fr.template)??"",lr=buildLayoutTree(ar.Panels);let ur="";lr.layer&&(ur+=convertLayer(lr.layer,ar.Docks,cr));for(const dr of lr.floating)ur+=convertPane(dr,cr,!0);return ur});function buildLayoutTree(or){const ar=getMaxLayer(or),cr=or.filter(fr=>fr.floating&&fr.name==="imgview"),lr=or.filter(fr=>!fr.floating);let ur=null;for(let fr=0;fr<=ar;fr++){const dr=getLayerPanels(fr,lr);ur={index:fr,top:[],right:[],bottom:[],left:[],center:ur||[]};for(const pr of dr)pr.dir==="center"&&pr.name!=="desc"||ur[pr.dir].push(pr)}return{layer:ur,floating:cr}}function convertLayer(or,ar,cr){return`${convertDock("top",or.top,ar,cr)}${convertDock("left",or.left,ar,cr)}${Array.isArray(or.center)?convertDock("center",or.center,ar,cr):convertLayer(or.center,ar,cr)}${convertDock("right",or.right,ar,cr)}${convertDock("bottom",or.bottom,ar,cr)}`}function convertDock(or,ar,cr,lr){if(!ar.length)return"";const ur=ar.map(gr=>gr.name!=="desc"?gr.name:"").filter(Boolean),fr=ur.length>0?` visibility="${ur.join("|")}"`:"",[dr]=ar,pr=`${WxWidgetsDirection[dr.dir]},${dr.layer},${dr.row}`,mr=or!=="center"&&cr[pr]?` size="${cr[pr]}"`:"";return`${ar.map(gr=>convertPane(gr,lr,!1)).join("")}`}function convertPane(or,ar,cr){return`${extractFromDefaultTheme(or.name,ar,cr)}`}function getMaxLayer(or){return Math.max(...or.map(({layer:ar})=>ar))}function getLayerPanels(or,ar){return ar.filter(cr=>cr.layer===or).sort((cr,lr)=>cr.pos-lr.pos)}const paneToTagMap={imgview:"qsp-view",acts:"qsp-actions",desc:"qsp-main",objs:"qsp-objects",vars:"qsp-stats",input:"qsp-cmd"};function extractFromDefaultTheme(or,ar,cr){const lr=paneToTagMap[or];if(!lr)return"";const ur=new RegExp(`<${lr}([\\s\\S]*?)`,"im"),fr=ar.match(ur),dr=(fr==null?void 0:fr[0])??"";return cr?dr.replace(new RegExp(`<${lr}(.*?)>`,"im"),`<${lr} modal>`):dr.replace(new RegExp(`<${lr}(.*?)>`,"im"),`<${lr}>`)}const GROUP_REGEXP=/\[(.*?)\]/i,LINE_REGEXP=/(.*?)=(.*)/i,DOCK_LINE=/dock_size\((.*?)\)=(.*)/,IS_FLOATABLE_MASK=1,asNumber=(or,ar)=>({[or]:Number(ar)}),asString=(or,ar)=>({[or]:ar}),converters={BackColor:asNumber,FontColor:asNumber,LinkColor:asNumber,FontSize:asNumber,FontName:asString,Panels:parsePanels,dir:(or,ar)=>({[or]:WxWidgetsDirection[ar]}),layer:asNumber,name:asString,pos:asNumber,row:asNumber,prop:asNumber};function processData(or,ar){const cr=converters[or];return(cr==null?void 0:cr(or,ar))??{}}function parsePanels(or,ar){const cr=[],lr={};for(const ur of ar.split("|").filter(Boolean))if(ur!=="layout2")if(ur.startsWith("dock_size")){const fr=ur.match(DOCK_LINE);if(fr){const[,dr,pr]=fr;dr&&pr&&(lr[dr]=Number(pr))}}else{const fr=ur.split(";").map(extractLineData).reduce((dr,[pr,mr])=>{if(pr==="state")dr.floating=(Number(mr)&IS_FLOATABLE_MASK)!==0;else if(pr&&mr&&pr in converters)return{...dr,...processData(pr,mr)};return dr},{});cr.push(fr)}return{Panels:cr,Docks:lr}}function extractLineData(or){const ar=or.match(LINE_REGEXP);if(ar){const[,cr,lr]=ar;return[cr,lr]}return[]}function parseCfg(or){let ar={};for(const cr of or.split(/\r?\n/gim).filter(Boolean)){if(GROUP_REGEXP.test(cr))continue;const[lr,ur]=extractLineData(cr);lr&&ur&&lr in converters&&(ar={...ar,...processData(lr,ur)})}return ar}const consoleLogger={type:"logger",log(or){this.output("log",or)},warn(or){this.output("warn",or)},error(or){this.output("error",or)},output(or,ar){console&&console[or]&&console[or].apply(console,ar)}};class Logger{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(ar,cr)}init(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=cr.prefix||"i18next:",this.logger=ar||consoleLogger,this.options=cr,this.debug=cr.debug}log(){for(var ar=arguments.length,cr=new Array(ar),lr=0;lr{this.observers[lr]=this.observers[lr]||[],this.observers[lr].push(cr)}),this}off(ar,cr){if(this.observers[ar]){if(!cr){delete this.observers[ar];return}this.observers[ar]=this.observers[ar].filter(lr=>lr!==cr)}}emit(ar){for(var cr=arguments.length,lr=new Array(cr>1?cr-1:0),ur=1;ur{dr(...lr)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(dr=>{dr.apply(dr,[ar,...lr])})}}function defer(){let or,ar;const cr=new Promise((lr,ur)=>{or=lr,ar=ur});return cr.resolve=or,cr.reject=ar,cr}function makeString(or){return or==null?"":""+or}function copy(or,ar,cr){or.forEach(lr=>{ar[lr]&&(cr[lr]=ar[lr])})}function getLastOfPath(or,ar,cr){function lr(dr){return dr&&dr.indexOf("###")>-1?dr.replace(/###/g,"."):dr}function ur(){return!or||typeof or=="string"}const fr=typeof ar!="string"?[].concat(ar):ar.split(".");for(;fr.length>1;){if(ur())return{};const dr=lr(fr.shift());!or[dr]&&cr&&(or[dr]=new cr),Object.prototype.hasOwnProperty.call(or,dr)?or=or[dr]:or={}}return ur()?{}:{obj:or,k:lr(fr.shift())}}function setPath(or,ar,cr){const{obj:lr,k:ur}=getLastOfPath(or,ar,Object);lr[ur]=cr}function pushPath(or,ar,cr,lr){const{obj:ur,k:fr}=getLastOfPath(or,ar,Object);ur[fr]=ur[fr]||[],lr&&(ur[fr]=ur[fr].concat(cr)),lr||ur[fr].push(cr)}function getPath(or,ar){const{obj:cr,k:lr}=getLastOfPath(or,ar);if(cr)return cr[lr]}function getPathWithDefaults(or,ar,cr){const lr=getPath(or,cr);return lr!==void 0?lr:getPath(ar,cr)}function deepExtend(or,ar,cr){for(const lr in ar)lr!=="__proto__"&&lr!=="constructor"&&(lr in or?typeof or[lr]=="string"||or[lr]instanceof String||typeof ar[lr]=="string"||ar[lr]instanceof String?cr&&(or[lr]=ar[lr]):deepExtend(or[lr],ar[lr],cr):or[lr]=ar[lr]);return or}function regexEscape(or){return or.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function escape(or){return typeof or=="string"?or.replace(/[&<>"'\/]/g,ar=>_entityMap[ar]):or}const chars=[" ",",","?","!",";"];function looksLikeObjectPath(or,ar,cr){ar=ar||"",cr=cr||"";const lr=chars.filter(dr=>ar.indexOf(dr)<0&&cr.indexOf(dr)<0);if(lr.length===0)return!0;const ur=new RegExp(`(${lr.map(dr=>dr==="?"?"\\?":dr).join("|")})`);let fr=!ur.test(or);if(!fr){const dr=or.indexOf(cr);dr>0&&!ur.test(or.substring(0,dr))&&(fr=!0)}return fr}function deepFind(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!or)return;if(or[ar])return or[ar];const lr=ar.split(cr);let ur=or;for(let fr=0;frfr+dr;)dr++,pr=lr.slice(fr,fr+dr).join(cr),mr=ur[pr];if(mr===void 0)return;if(mr===null)return null;if(ar.endsWith(pr)){if(typeof mr=="string")return mr;if(pr&&typeof mr[pr]=="string")return mr[pr]}const gr=lr.slice(fr+dr).join(cr);return gr?deepFind(mr,gr,cr):void 0}ur=ur[lr[fr]]}return ur}function getCleanedCode(or){return or&&or.indexOf("_")>0?or.replace("_","-"):or}class ResourceStore extends EventEmitter{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=ar||{},this.options=cr,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(ar){this.options.ns.indexOf(ar)<0&&this.options.ns.push(ar)}removeNamespaces(ar){const cr=this.options.ns.indexOf(ar);cr>-1&&this.options.ns.splice(cr,1)}getResource(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const fr=ur.keySeparator!==void 0?ur.keySeparator:this.options.keySeparator,dr=ur.ignoreJSONStructure!==void 0?ur.ignoreJSONStructure:this.options.ignoreJSONStructure;let pr=[ar,cr];lr&&typeof lr!="string"&&(pr=pr.concat(lr)),lr&&typeof lr=="string"&&(pr=pr.concat(fr?lr.split(fr):lr)),ar.indexOf(".")>-1&&(pr=ar.split("."));const mr=getPath(this.data,pr);return mr||!dr||typeof lr!="string"?mr:deepFind(this.data&&this.data[ar]&&this.data[ar][cr],lr,fr)}addResource(ar,cr,lr,ur){let fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const dr=fr.keySeparator!==void 0?fr.keySeparator:this.options.keySeparator;let pr=[ar,cr];lr&&(pr=pr.concat(dr?lr.split(dr):lr)),ar.indexOf(".")>-1&&(pr=ar.split("."),ur=cr,cr=pr[1]),this.addNamespaces(cr),setPath(this.data,pr,ur),fr.silent||this.emit("added",ar,cr,lr,ur)}addResources(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const fr in lr)(typeof lr[fr]=="string"||Object.prototype.toString.apply(lr[fr])==="[object Array]")&&this.addResource(ar,cr,fr,lr[fr],{silent:!0});ur.silent||this.emit("added",ar,cr,lr)}addResourceBundle(ar,cr,lr,ur,fr){let dr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},pr=[ar,cr];ar.indexOf(".")>-1&&(pr=ar.split("."),ur=lr,lr=cr,cr=pr[1]),this.addNamespaces(cr);let mr=getPath(this.data,pr)||{};ur?deepExtend(mr,lr,fr):mr={...mr,...lr},setPath(this.data,pr,mr),dr.silent||this.emit("added",ar,cr,lr)}removeResourceBundle(ar,cr){this.hasResourceBundle(ar,cr)&&delete this.data[ar][cr],this.removeNamespaces(cr),this.emit("removed",ar,cr)}hasResourceBundle(ar,cr){return this.getResource(ar,cr)!==void 0}getResourceBundle(ar,cr){return cr||(cr=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(ar,cr)}:this.getResource(ar,cr)}getDataByLanguage(ar){return this.data[ar]}hasLanguageSomeTranslations(ar){const cr=this.getDataByLanguage(ar);return!!(cr&&Object.keys(cr)||[]).find(ur=>cr[ur]&&Object.keys(cr[ur]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(or){this.processors[or.name]=or},handle(or,ar,cr,lr,ur){return or.forEach(fr=>{this.processors[fr]&&(ar=this.processors[fr].process(ar,cr,lr,ur))}),ar}};const checkedLoadedFor={};class Translator extends EventEmitter{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],ar,this),this.options=cr,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(ar){ar&&(this.language=ar)}exists(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(ar==null)return!1;const lr=this.resolve(ar,cr);return lr&&lr.res!==void 0}extractFromKey(ar,cr){let lr=cr.nsSeparator!==void 0?cr.nsSeparator:this.options.nsSeparator;lr===void 0&&(lr=":");const ur=cr.keySeparator!==void 0?cr.keySeparator:this.options.keySeparator;let fr=cr.ns||this.options.defaultNS||[];const dr=lr&&ar.indexOf(lr)>-1,pr=!this.options.userDefinedKeySeparator&&!cr.keySeparator&&!this.options.userDefinedNsSeparator&&!cr.nsSeparator&&!looksLikeObjectPath(ar,lr,ur);if(dr&&!pr){const mr=ar.match(this.interpolator.nestingRegexp);if(mr&&mr.length>0)return{key:ar,namespaces:fr};const gr=ar.split(lr);(lr!==ur||lr===ur&&this.options.ns.indexOf(gr[0])>-1)&&(fr=gr.shift()),ar=gr.join(ur)}return typeof fr=="string"&&(fr=[fr]),{key:ar,namespaces:fr}}translate(ar,cr,lr){if(typeof cr!="object"&&this.options.overloadTranslationOptionHandler&&(cr=this.options.overloadTranslationOptionHandler(arguments)),typeof cr=="object"&&(cr={...cr}),cr||(cr={}),ar==null)return"";Array.isArray(ar)||(ar=[String(ar)]);const ur=cr.returnDetails!==void 0?cr.returnDetails:this.options.returnDetails,fr=cr.keySeparator!==void 0?cr.keySeparator:this.options.keySeparator,{key:dr,namespaces:pr}=this.extractFromKey(ar[ar.length-1],cr),mr=pr[pr.length-1],gr=cr.lng||this.language,vr=cr.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(gr&&gr.toLowerCase()==="cimode"){if(vr){const Pr=cr.nsSeparator||this.options.nsSeparator;return ur?{res:`${mr}${Pr}${dr}`,usedKey:dr,exactUsedKey:dr,usedLng:gr,usedNS:mr,usedParams:this.getUsedParamsDetails(cr)}:`${mr}${Pr}${dr}`}return ur?{res:dr,usedKey:dr,exactUsedKey:dr,usedLng:gr,usedNS:mr,usedParams:this.getUsedParamsDetails(cr)}:dr}const hr=this.resolve(ar,cr);let $r=hr&&hr.res;const xr=hr&&hr.usedKey||dr,br=hr&&hr.exactUsedKey||dr,Er=Object.prototype.toString.apply($r),wr=["[object Number]","[object Function]","[object RegExp]"],yr=cr.joinArrays!==void 0?cr.joinArrays:this.options.joinArrays,_r=!this.i18nFormat||this.i18nFormat.handleAsObject;if(_r&&$r&&(typeof $r!="string"&&typeof $r!="boolean"&&typeof $r!="number")&&wr.indexOf(Er)<0&&!(typeof yr=="string"&&Er==="[object Array]")){if(!cr.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Pr=this.options.returnedObjectHandler?this.options.returnedObjectHandler(xr,$r,{...cr,ns:pr}):`key '${dr} (${this.language})' returned an object instead of string.`;return ur?(hr.res=Pr,hr.usedParams=this.getUsedParamsDetails(cr),hr):Pr}if(fr){const Pr=Er==="[object Array]",Or=Pr?[]:{},Lr=Pr?br:xr;for(const Tr in $r)if(Object.prototype.hasOwnProperty.call($r,Tr)){const jr=`${Lr}${fr}${Tr}`;Or[Tr]=this.translate(jr,{...cr,joinArrays:!1,ns:pr}),Or[Tr]===jr&&(Or[Tr]=$r[Tr])}$r=Or}}else if(_r&&typeof yr=="string"&&Er==="[object Array]")$r=$r.join(yr),$r&&($r=this.extendTranslation($r,ar,cr,lr));else{let Pr=!1,Or=!1;const Lr=cr.count!==void 0&&typeof cr.count!="string",Tr=Translator.hasDefaultValue(cr),jr=Lr?this.pluralResolver.getSuffix(gr,cr.count,cr):"",Rr=cr.ordinal&&Lr?this.pluralResolver.getSuffix(gr,cr.count,{ordinal:!1}):"",Fr=cr[`defaultValue${jr}`]||cr[`defaultValue${Rr}`]||cr.defaultValue;!this.isValidLookup($r)&&Tr&&(Pr=!0,$r=Fr),this.isValidLookup($r)||(Or=!0,$r=dr);const Zr=(cr.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Or?void 0:$r,so=Tr&&Fr!==$r&&this.options.updateMissing;if(Or||Pr||so){if(this.logger.log(so?"updateKey":"missingKey",gr,mr,dr,so?Fr:$r),fr){const eo=this.resolve(dr,{...cr,keySeparator:!1});eo&&eo.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Ir=[];const Kr=this.languageUtils.getFallbackCodes(this.options.fallbackLng,cr.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Kr&&Kr[0])for(let eo=0;eo{const ro=Tr&&Br!==$r?Br:Zr;this.options.missingKeyHandler?this.options.missingKeyHandler(eo,mr,Wr,ro,so,cr):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(eo,mr,Wr,ro,so,cr),this.emit("missingKey",eo,mr,Wr,$r)};this.options.saveMissing&&(this.options.saveMissingPlurals&&Lr?Ir.forEach(eo=>{this.pluralResolver.getSuffixes(eo,cr).forEach(Wr=>{no([eo],dr+Wr,cr[`defaultValue${Wr}`]||Fr)})}):no(Ir,dr,Fr))}$r=this.extendTranslation($r,ar,cr,hr,lr),Or&&$r===dr&&this.options.appendNamespaceToMissingKey&&($r=`${mr}:${dr}`),(Or||Pr)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?$r=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${mr}:${dr}`:dr,Pr?$r:void 0):$r=this.options.parseMissingKeyHandler($r))}return ur?(hr.res=$r,hr.usedParams=this.getUsedParamsDetails(cr),hr):$r}extendTranslation(ar,cr,lr,ur,fr){var dr=this;if(this.i18nFormat&&this.i18nFormat.parse)ar=this.i18nFormat.parse(ar,{...this.options.interpolation.defaultVariables,...lr},lr.lng||this.language||ur.usedLng,ur.usedNS,ur.usedKey,{resolved:ur});else if(!lr.skipInterpolation){lr.interpolation&&this.interpolator.init({...lr,interpolation:{...this.options.interpolation,...lr.interpolation}});const gr=typeof ar=="string"&&(lr&&lr.interpolation&&lr.interpolation.skipOnVariables!==void 0?lr.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let vr;if(gr){const $r=ar.match(this.interpolator.nestingRegexp);vr=$r&&$r.length}let hr=lr.replace&&typeof lr.replace!="string"?lr.replace:lr;if(this.options.interpolation.defaultVariables&&(hr={...this.options.interpolation.defaultVariables,...hr}),ar=this.interpolator.interpolate(ar,hr,lr.lng||this.language,lr),gr){const $r=ar.match(this.interpolator.nestingRegexp),xr=$r&&$r.length;vr1&&arguments[1]!==void 0?arguments[1]:{},lr,ur,fr,dr,pr;return typeof ar=="string"&&(ar=[ar]),ar.forEach(mr=>{if(this.isValidLookup(lr))return;const gr=this.extractFromKey(mr,cr),vr=gr.key;ur=vr;let hr=gr.namespaces;this.options.fallbackNS&&(hr=hr.concat(this.options.fallbackNS));const $r=cr.count!==void 0&&typeof cr.count!="string",xr=$r&&!cr.ordinal&&cr.count===0&&this.pluralResolver.shouldUseIntlApi(),br=cr.context!==void 0&&(typeof cr.context=="string"||typeof cr.context=="number")&&cr.context!=="",Er=cr.lngs?cr.lngs:this.languageUtils.toResolveHierarchy(cr.lng||this.language,cr.fallbackLng);hr.forEach(wr=>{this.isValidLookup(lr)||(pr=wr,!checkedLoadedFor[`${Er[0]}-${wr}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(pr)&&(checkedLoadedFor[`${Er[0]}-${wr}`]=!0,this.logger.warn(`key "${ur}" for languages "${Er.join(", ")}" won't get resolved as namespace "${pr}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),Er.forEach(yr=>{if(this.isValidLookup(lr))return;dr=yr;const _r=[vr];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(_r,vr,yr,wr,cr);else{let Pr;$r&&(Pr=this.pluralResolver.getSuffix(yr,cr.count,cr));const Or=`${this.options.pluralSeparator}zero`,Lr=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if($r&&(_r.push(vr+Pr),cr.ordinal&&Pr.indexOf(Lr)===0&&_r.push(vr+Pr.replace(Lr,this.options.pluralSeparator)),xr&&_r.push(vr+Or)),br){const Tr=`${vr}${this.options.contextSeparator}${cr.context}`;_r.push(Tr),$r&&(_r.push(Tr+Pr),cr.ordinal&&Pr.indexOf(Lr)===0&&_r.push(Tr+Pr.replace(Lr,this.options.pluralSeparator)),xr&&_r.push(Tr+Or))}}let Sr;for(;Sr=_r.pop();)this.isValidLookup(lr)||(fr=Sr,lr=this.getResource(yr,wr,Sr,cr))}))})}),{res:lr,usedKey:ur,exactUsedKey:fr,usedLng:dr,usedNS:pr}}isValidLookup(ar){return ar!==void 0&&!(!this.options.returnNull&&ar===null)&&!(!this.options.returnEmptyString&&ar==="")}getResource(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(ar,cr,lr,ur):this.resourceStore.getResource(ar,cr,lr,ur)}getUsedParamsDetails(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const cr=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],lr=ar.replace&&typeof ar.replace!="string";let ur=lr?ar.replace:ar;if(lr&&typeof ar.count<"u"&&(ur.count=ar.count),this.options.interpolation.defaultVariables&&(ur={...this.options.interpolation.defaultVariables,...ur}),!lr){ur={...ur};for(const fr of cr)delete ur[fr]}return ur}static hasDefaultValue(ar){const cr="defaultValue";for(const lr in ar)if(Object.prototype.hasOwnProperty.call(ar,lr)&&cr===lr.substring(0,cr.length)&&ar[lr]!==void 0)return!0;return!1}}function capitalize(or){return or.charAt(0).toUpperCase()+or.slice(1)}class LanguageUtil{constructor(ar){this.options=ar,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(ar){if(ar=getCleanedCode(ar),!ar||ar.indexOf("-")<0)return null;const cr=ar.split("-");return cr.length===2||(cr.pop(),cr[cr.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(cr.join("-"))}getLanguagePartFromCode(ar){if(ar=getCleanedCode(ar),!ar||ar.indexOf("-")<0)return ar;const cr=ar.split("-");return this.formatLanguageCode(cr[0])}formatLanguageCode(ar){if(typeof ar=="string"&&ar.indexOf("-")>-1){const cr=["hans","hant","latn","cyrl","cans","mong","arab"];let lr=ar.split("-");return this.options.lowerCaseLng?lr=lr.map(ur=>ur.toLowerCase()):lr.length===2?(lr[0]=lr[0].toLowerCase(),lr[1]=lr[1].toUpperCase(),cr.indexOf(lr[1].toLowerCase())>-1&&(lr[1]=capitalize(lr[1].toLowerCase()))):lr.length===3&&(lr[0]=lr[0].toLowerCase(),lr[1].length===2&&(lr[1]=lr[1].toUpperCase()),lr[0]!=="sgn"&&lr[2].length===2&&(lr[2]=lr[2].toUpperCase()),cr.indexOf(lr[1].toLowerCase())>-1&&(lr[1]=capitalize(lr[1].toLowerCase())),cr.indexOf(lr[2].toLowerCase())>-1&&(lr[2]=capitalize(lr[2].toLowerCase()))),lr.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?ar.toLowerCase():ar}isSupportedCode(ar){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(ar=this.getLanguagePartFromCode(ar)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(ar)>-1}getBestMatchFromCodes(ar){if(!ar)return null;let cr;return ar.forEach(lr=>{if(cr)return;const ur=this.formatLanguageCode(lr);(!this.options.supportedLngs||this.isSupportedCode(ur))&&(cr=ur)}),!cr&&this.options.supportedLngs&&ar.forEach(lr=>{if(cr)return;const ur=this.getLanguagePartFromCode(lr);if(this.isSupportedCode(ur))return cr=ur;cr=this.options.supportedLngs.find(fr=>{if(fr===ur)return fr;if(!(fr.indexOf("-")<0&&ur.indexOf("-")<0)&&fr.indexOf(ur)===0)return fr})}),cr||(cr=this.getFallbackCodes(this.options.fallbackLng)[0]),cr}getFallbackCodes(ar,cr){if(!ar)return[];if(typeof ar=="function"&&(ar=ar(cr)),typeof ar=="string"&&(ar=[ar]),Object.prototype.toString.apply(ar)==="[object Array]")return ar;if(!cr)return ar.default||[];let lr=ar[cr];return lr||(lr=ar[this.getScriptPartFromCode(cr)]),lr||(lr=ar[this.formatLanguageCode(cr)]),lr||(lr=ar[this.getLanguagePartFromCode(cr)]),lr||(lr=ar.default),lr||[]}toResolveHierarchy(ar,cr){const lr=this.getFallbackCodes(cr||this.options.fallbackLng||[],ar),ur=[],fr=dr=>{dr&&(this.isSupportedCode(dr)?ur.push(dr):this.logger.warn(`rejecting language code not found in supportedLngs: ${dr}`))};return typeof ar=="string"&&(ar.indexOf("-")>-1||ar.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&fr(this.formatLanguageCode(ar)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&fr(this.getScriptPartFromCode(ar)),this.options.load!=="currentOnly"&&fr(this.getLanguagePartFromCode(ar))):typeof ar=="string"&&fr(this.formatLanguageCode(ar)),lr.forEach(dr=>{ur.indexOf(dr)<0&&fr(this.formatLanguageCode(dr))}),ur}}let sets=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],_rulesPluralsTypes={1:function(or){return+(or>1)},2:function(or){return+(or!=1)},3:function(or){return 0},4:function(or){return or%10==1&&or%100!=11?0:or%10>=2&&or%10<=4&&(or%100<10||or%100>=20)?1:2},5:function(or){return or==0?0:or==1?1:or==2?2:or%100>=3&&or%100<=10?3:or%100>=11?4:5},6:function(or){return or==1?0:or>=2&&or<=4?1:2},7:function(or){return or==1?0:or%10>=2&&or%10<=4&&(or%100<10||or%100>=20)?1:2},8:function(or){return or==1?0:or==2?1:or!=8&&or!=11?2:3},9:function(or){return+(or>=2)},10:function(or){return or==1?0:or==2?1:or<7?2:or<11?3:4},11:function(or){return or==1||or==11?0:or==2||or==12?1:or>2&&or<20?2:3},12:function(or){return+(or%10!=1||or%100==11)},13:function(or){return+(or!==0)},14:function(or){return or==1?0:or==2?1:or==3?2:3},15:function(or){return or%10==1&&or%100!=11?0:or%10>=2&&(or%100<10||or%100>=20)?1:2},16:function(or){return or%10==1&&or%100!=11?0:or!==0?1:2},17:function(or){return or==1||or%10==1&&or%100!=11?0:1},18:function(or){return or==0?0:or==1?1:2},19:function(or){return or==1?0:or==0||or%100>1&&or%100<11?1:or%100>10&&or%100<20?2:3},20:function(or){return or==1?0:or==0||or%100>0&&or%100<20?1:2},21:function(or){return or%100==1?1:or%100==2?2:or%100==3||or%100==4?3:0},22:function(or){return or==1?0:or==2?1:(or<0||or>10)&&or%10==0?2:3}};const nonIntlVersions=["v1","v2","v3"],intlVersions=["v4"],suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5};function createRules(){const or={};return sets.forEach(ar=>{ar.lngs.forEach(cr=>{or[cr]={numbers:ar.nr,plurals:_rulesPluralsTypes[ar.fc]}})}),or}class PluralResolver{constructor(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=ar,this.options=cr,this.logger=baseLogger.create("pluralResolver"),(!this.options.compatibilityJSON||intlVersions.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=createRules()}addRule(ar,cr){this.rules[ar]=cr}getRule(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(getCleanedCode(ar),{type:cr.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[ar]||this.rules[this.languageUtils.getLanguagePartFromCode(ar)]}needsPlural(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const lr=this.getRule(ar,cr);return this.shouldUseIntlApi()?lr&&lr.resolvedOptions().pluralCategories.length>1:lr&&lr.numbers.length>1}getPluralFormsOfKey(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(ar,lr).map(ur=>`${cr}${ur}`)}getSuffixes(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const lr=this.getRule(ar,cr);return lr?this.shouldUseIntlApi()?lr.resolvedOptions().pluralCategories.sort((ur,fr)=>suffixesOrder[ur]-suffixesOrder[fr]).map(ur=>`${this.options.prepend}${cr.ordinal?`ordinal${this.options.prepend}`:""}${ur}`):lr.numbers.map(ur=>this.getSuffix(ar,ur,cr)):[]}getSuffix(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ur=this.getRule(ar,lr);return ur?this.shouldUseIntlApi()?`${this.options.prepend}${lr.ordinal?`ordinal${this.options.prepend}`:""}${ur.select(cr)}`:this.getSuffixRetroCompatible(ur,cr):(this.logger.warn(`no plural rule found for: ${ar}`),"")}getSuffixRetroCompatible(ar,cr){const lr=ar.noAbs?ar.plurals(cr):ar.plurals(Math.abs(cr));let ur=ar.numbers[lr];this.options.simplifyPluralSuffix&&ar.numbers.length===2&&ar.numbers[0]===1&&(ur===2?ur="plural":ur===1&&(ur=""));const fr=()=>this.options.prepend&&ur.toString()?this.options.prepend+ur.toString():ur.toString();return this.options.compatibilityJSON==="v1"?ur===1?"":typeof ur=="number"?`_plural_${ur.toString()}`:fr():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&ar.numbers.length===2&&ar.numbers[0]===1?fr():this.options.prepend&&lr.toString()?this.options.prepend+lr.toString():lr.toString()}shouldUseIntlApi(){return!nonIntlVersions.includes(this.options.compatibilityJSON)}}function deepFindWithDefaults(or,ar,cr){let lr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",ur=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,fr=getPathWithDefaults(or,ar,cr);return!fr&&ur&&typeof cr=="string"&&(fr=deepFind(or,cr,lr),fr===void 0&&(fr=deepFind(ar,cr,lr))),fr}class Interpolator{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=ar,this.format=ar.interpolation&&ar.interpolation.format||(cr=>cr),this.init(ar)}init(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ar.interpolation||(ar.interpolation={escapeValue:!0});const cr=ar.interpolation;this.escape=cr.escape!==void 0?cr.escape:escape,this.escapeValue=cr.escapeValue!==void 0?cr.escapeValue:!0,this.useRawValueToEscape=cr.useRawValueToEscape!==void 0?cr.useRawValueToEscape:!1,this.prefix=cr.prefix?regexEscape(cr.prefix):cr.prefixEscaped||"{{",this.suffix=cr.suffix?regexEscape(cr.suffix):cr.suffixEscaped||"}}",this.formatSeparator=cr.formatSeparator?cr.formatSeparator:cr.formatSeparator||",",this.unescapePrefix=cr.unescapeSuffix?"":cr.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":cr.unescapeSuffix||"",this.nestingPrefix=cr.nestingPrefix?regexEscape(cr.nestingPrefix):cr.nestingPrefixEscaped||regexEscape("$t("),this.nestingSuffix=cr.nestingSuffix?regexEscape(cr.nestingSuffix):cr.nestingSuffixEscaped||regexEscape(")"),this.nestingOptionsSeparator=cr.nestingOptionsSeparator?cr.nestingOptionsSeparator:cr.nestingOptionsSeparator||",",this.maxReplaces=cr.maxReplaces?cr.maxReplaces:1e3,this.alwaysFormat=cr.alwaysFormat!==void 0?cr.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const ar=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(ar,"g");const cr=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(cr,"g");const lr=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(lr,"g")}interpolate(ar,cr,lr,ur){let fr,dr,pr;const mr=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function gr(br){return br.replace(/\$/g,"$$$$")}const vr=br=>{if(br.indexOf(this.formatSeparator)<0){const _r=deepFindWithDefaults(cr,mr,br,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(_r,void 0,lr,{...ur,...cr,interpolationkey:br}):_r}const Er=br.split(this.formatSeparator),wr=Er.shift().trim(),yr=Er.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(cr,mr,wr,this.options.keySeparator,this.options.ignoreJSONStructure),yr,lr,{...ur,...cr,interpolationkey:wr})};this.resetRegExp();const hr=ur&&ur.missingInterpolationHandler||this.options.missingInterpolationHandler,$r=ur&&ur.interpolation&&ur.interpolation.skipOnVariables!==void 0?ur.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:br=>gr(br)},{regex:this.regexp,safeValue:br=>this.escapeValue?gr(this.escape(br)):gr(br)}].forEach(br=>{for(pr=0;fr=br.regex.exec(ar);){const Er=fr[1].trim();if(dr=vr(Er),dr===void 0)if(typeof hr=="function"){const yr=hr(ar,fr,ur);dr=typeof yr=="string"?yr:""}else if(ur&&Object.prototype.hasOwnProperty.call(ur,Er))dr="";else if($r){dr=fr[0];continue}else this.logger.warn(`missed to pass in variable ${Er} for interpolating ${ar}`),dr="";else typeof dr!="string"&&!this.useRawValueToEscape&&(dr=makeString(dr));const wr=br.safeValue(dr);if(ar=ar.replace(fr[0],wr),$r?(br.regex.lastIndex+=dr.length,br.regex.lastIndex-=fr[0].length):br.regex.lastIndex=0,pr++,pr>=this.maxReplaces)break}}),ar}nest(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ur,fr,dr;function pr(mr,gr){const vr=this.nestingOptionsSeparator;if(mr.indexOf(vr)<0)return mr;const hr=mr.split(new RegExp(`${vr}[ ]*{`));let $r=`{${hr[1]}`;mr=hr[0],$r=this.interpolate($r,dr);const xr=$r.match(/'/g),br=$r.match(/"/g);(xr&&xr.length%2===0&&!br||br.length%2!==0)&&($r=$r.replace(/'/g,'"'));try{dr=JSON.parse($r),gr&&(dr={...gr,...dr})}catch(Er){return this.logger.warn(`failed parsing options string in nesting for key ${mr}`,Er),`${mr}${vr}${$r}`}return delete dr.defaultValue,mr}for(;ur=this.nestingRegexp.exec(ar);){let mr=[];dr={...lr},dr=dr.replace&&typeof dr.replace!="string"?dr.replace:dr,dr.applyPostProcessor=!1,delete dr.defaultValue;let gr=!1;if(ur[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(ur[1])){const vr=ur[1].split(this.formatSeparator).map(hr=>hr.trim());ur[1]=vr.shift(),mr=vr,gr=!0}if(fr=cr(pr.call(this,ur[1].trim(),dr),dr),fr&&ur[0]===ar&&typeof fr!="string")return fr;typeof fr!="string"&&(fr=makeString(fr)),fr||(this.logger.warn(`missed to resolve ${ur[1]} for nesting ${ar}`),fr=""),gr&&(fr=mr.reduce((vr,hr)=>this.format(vr,hr,lr.lng,{...lr,interpolationkey:ur[1].trim()}),fr.trim())),ar=ar.replace(ur[0],fr),this.regexp.lastIndex=0}return ar}}function parseFormatStr(or){let ar=or.toLowerCase().trim();const cr={};if(or.indexOf("(")>-1){const lr=or.split("(");ar=lr[0].toLowerCase().trim();const ur=lr[1].substring(0,lr[1].length-1);ar==="currency"&&ur.indexOf(":")<0?cr.currency||(cr.currency=ur.trim()):ar==="relativetime"&&ur.indexOf(":")<0?cr.range||(cr.range=ur.trim()):ur.split(";").forEach(dr=>{if(!dr)return;const[pr,...mr]=dr.split(":"),gr=mr.join(":").trim().replace(/^'+|'+$/g,"");cr[pr.trim()]||(cr[pr.trim()]=gr),gr==="false"&&(cr[pr.trim()]=!1),gr==="true"&&(cr[pr.trim()]=!0),isNaN(gr)||(cr[pr.trim()]=parseInt(gr,10))})}return{formatName:ar,formatOptions:cr}}function createCachedFormatter(or){const ar={};return function(lr,ur,fr){const dr=ur+JSON.stringify(fr);let pr=ar[dr];return pr||(pr=or(getCleanedCode(ur),fr),ar[dr]=pr),pr(lr)}}class Formatter{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=ar,this.formats={number:createCachedFormatter((cr,lr)=>{const ur=new Intl.NumberFormat(cr,{...lr});return fr=>ur.format(fr)}),currency:createCachedFormatter((cr,lr)=>{const ur=new Intl.NumberFormat(cr,{...lr,style:"currency"});return fr=>ur.format(fr)}),datetime:createCachedFormatter((cr,lr)=>{const ur=new Intl.DateTimeFormat(cr,{...lr});return fr=>ur.format(fr)}),relativetime:createCachedFormatter((cr,lr)=>{const ur=new Intl.RelativeTimeFormat(cr,{...lr});return fr=>ur.format(fr,lr.range||"day")}),list:createCachedFormatter((cr,lr)=>{const ur=new Intl.ListFormat(cr,{...lr});return fr=>ur.format(fr)})},this.init(ar)}init(ar){const lr=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=lr.formatSeparator?lr.formatSeparator:lr.formatSeparator||","}add(ar,cr){this.formats[ar.toLowerCase().trim()]=cr}addCached(ar,cr){this.formats[ar.toLowerCase().trim()]=createCachedFormatter(cr)}format(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return cr.split(this.formatSeparator).reduce((pr,mr)=>{const{formatName:gr,formatOptions:vr}=parseFormatStr(mr);if(this.formats[gr]){let hr=pr;try{const $r=ur&&ur.formatParams&&ur.formatParams[ur.interpolationkey]||{},xr=$r.locale||$r.lng||ur.locale||ur.lng||lr;hr=this.formats[gr](pr,xr,{...vr,...ur,...$r})}catch($r){this.logger.warn($r)}return hr}else this.logger.warn(`there was no format function for ${gr}`);return pr},ar)}}function removePending(or,ar){or.pending[ar]!==void 0&&(delete or.pending[ar],or.pendingCount--)}class Connector extends EventEmitter{constructor(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=ar,this.store=cr,this.services=lr,this.languageUtils=lr.languageUtils,this.options=ur,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=ur.maxParallelReads||10,this.readingCalls=0,this.maxRetries=ur.maxRetries>=0?ur.maxRetries:5,this.retryTimeout=ur.retryTimeout>=1?ur.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(lr,ur.backend,ur)}queueLoad(ar,cr,lr,ur){const fr={},dr={},pr={},mr={};return ar.forEach(gr=>{let vr=!0;cr.forEach(hr=>{const $r=`${gr}|${hr}`;!lr.reload&&this.store.hasResourceBundle(gr,hr)?this.state[$r]=2:this.state[$r]<0||(this.state[$r]===1?dr[$r]===void 0&&(dr[$r]=!0):(this.state[$r]=1,vr=!1,dr[$r]===void 0&&(dr[$r]=!0),fr[$r]===void 0&&(fr[$r]=!0),mr[hr]===void 0&&(mr[hr]=!0)))}),vr||(pr[gr]=!0)}),(Object.keys(fr).length||Object.keys(dr).length)&&this.queue.push({pending:dr,pendingCount:Object.keys(dr).length,loaded:{},errors:[],callback:ur}),{toLoad:Object.keys(fr),pending:Object.keys(dr),toLoadLanguages:Object.keys(pr),toLoadNamespaces:Object.keys(mr)}}loaded(ar,cr,lr){const ur=ar.split("|"),fr=ur[0],dr=ur[1];cr&&this.emit("failedLoading",fr,dr,cr),lr&&this.store.addResourceBundle(fr,dr,lr),this.state[ar]=cr?-1:2;const pr={};this.queue.forEach(mr=>{pushPath(mr.loaded,[fr],dr),removePending(mr,ar),cr&&mr.errors.push(cr),mr.pendingCount===0&&!mr.done&&(Object.keys(mr.loaded).forEach(gr=>{pr[gr]||(pr[gr]={});const vr=mr.loaded[gr];vr.length&&vr.forEach(hr=>{pr[gr][hr]===void 0&&(pr[gr][hr]=!0)})}),mr.done=!0,mr.errors.length?mr.callback(mr.errors):mr.callback())}),this.emit("loaded",pr),this.queue=this.queue.filter(mr=>!mr.done)}read(ar,cr,lr){let ur=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,dr=arguments.length>5?arguments[5]:void 0;if(!ar.length)return dr(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:ar,ns:cr,fcName:lr,tried:ur,wait:fr,callback:dr});return}this.readingCalls++;const pr=(gr,vr)=>{if(this.readingCalls--,this.waitingReads.length>0){const hr=this.waitingReads.shift();this.read(hr.lng,hr.ns,hr.fcName,hr.tried,hr.wait,hr.callback)}if(gr&&vr&&ur{this.read.call(this,ar,cr,lr,ur+1,fr*2,dr)},fr);return}dr(gr,vr)},mr=this.backend[lr].bind(this.backend);if(mr.length===2){try{const gr=mr(ar,cr);gr&&typeof gr.then=="function"?gr.then(vr=>pr(null,vr)).catch(pr):pr(null,gr)}catch(gr){pr(gr)}return}return mr(ar,cr,pr)}prepareLoading(ar,cr){let lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ur=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),ur&&ur();typeof ar=="string"&&(ar=this.languageUtils.toResolveHierarchy(ar)),typeof cr=="string"&&(cr=[cr]);const fr=this.queueLoad(ar,cr,lr,ur);if(!fr.toLoad.length)return fr.pending.length||ur(),null;fr.toLoad.forEach(dr=>{this.loadOne(dr)})}load(ar,cr,lr){this.prepareLoading(ar,cr,{},lr)}reload(ar,cr,lr){this.prepareLoading(ar,cr,{reload:!0},lr)}loadOne(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const lr=ar.split("|"),ur=lr[0],fr=lr[1];this.read(ur,fr,"read",void 0,void 0,(dr,pr)=>{dr&&this.logger.warn(`${cr}loading namespace ${fr} for language ${ur} failed`,dr),!dr&&pr&&this.logger.log(`${cr}loaded namespace ${fr} for language ${ur}`,pr),this.loaded(ar,dr,pr)})}saveMissing(ar,cr,lr,ur,fr){let dr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},pr=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(cr)){this.logger.warn(`did not save key "${lr}" as the namespace "${cr}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(lr==null||lr==="")){if(this.backend&&this.backend.create){const mr={...dr,isUpdate:fr},gr=this.backend.create.bind(this.backend);if(gr.length<6)try{let vr;gr.length===5?vr=gr(ar,cr,lr,ur,mr):vr=gr(ar,cr,lr,ur),vr&&typeof vr.then=="function"?vr.then(hr=>pr(null,hr)).catch(pr):pr(null,vr)}catch(vr){pr(vr)}else gr(ar,cr,lr,ur,pr,mr)}!ar||!ar[0]||this.store.addResource(ar[0],cr,lr,ur)}}}function get(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(ar){let cr={};if(typeof ar[1]=="object"&&(cr=ar[1]),typeof ar[1]=="string"&&(cr.defaultValue=ar[1]),typeof ar[2]=="string"&&(cr.tDescription=ar[2]),typeof ar[2]=="object"||typeof ar[3]=="object"){const lr=ar[3]||ar[2];Object.keys(lr).forEach(ur=>{cr[ur]=lr[ur]})}return cr},interpolation:{escapeValue:!0,format:(or,ar,cr,lr)=>or,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function transformOptions(or){return typeof or.ns=="string"&&(or.ns=[or.ns]),typeof or.fallbackLng=="string"&&(or.fallbackLng=[or.fallbackLng]),typeof or.fallbackNS=="string"&&(or.fallbackNS=[or.fallbackNS]),or.supportedLngs&&or.supportedLngs.indexOf("cimode")<0&&(or.supportedLngs=or.supportedLngs.concat(["cimode"])),or}function noop$2(){}function bindMemberFunctions(or){Object.getOwnPropertyNames(Object.getPrototypeOf(or)).forEach(cr=>{typeof or[cr]=="function"&&(or[cr]=or[cr].bind(or))})}class I18n extends EventEmitter{constructor(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(ar),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),cr&&!this.isInitialized&&!ar.isClone){if(!this.options.initImmediate)return this.init(ar,cr),this;setTimeout(()=>{this.init(ar,cr)},0)}}init(){var ar=this;let cr=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},lr=arguments.length>1?arguments[1]:void 0;typeof cr=="function"&&(lr=cr,cr={}),!cr.defaultNS&&cr.defaultNS!==!1&&cr.ns&&(typeof cr.ns=="string"?cr.defaultNS=cr.ns:cr.ns.indexOf("translation")<0&&(cr.defaultNS=cr.ns[0]));const ur=get();this.options={...ur,...this.options,...transformOptions(cr)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...ur.interpolation,...this.options.interpolation}),cr.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=cr.keySeparator),cr.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=cr.nsSeparator);function fr(vr){return vr?typeof vr=="function"?new vr:vr:null}if(!this.options.isClone){this.modules.logger?baseLogger.init(fr(this.modules.logger),this.options):baseLogger.init(null,this.options);let vr;this.modules.formatter?vr=this.modules.formatter:typeof Intl<"u"&&(vr=Formatter);const hr=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const $r=this.services;$r.logger=baseLogger,$r.resourceStore=this.store,$r.languageUtils=hr,$r.pluralResolver=new PluralResolver(hr,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),vr&&(!this.options.interpolation.format||this.options.interpolation.format===ur.interpolation.format)&&($r.formatter=fr(vr),$r.formatter.init($r,this.options),this.options.interpolation.format=$r.formatter.format.bind($r.formatter)),$r.interpolator=new Interpolator(this.options),$r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},$r.backendConnector=new Connector(fr(this.modules.backend),$r.resourceStore,$r,this.options),$r.backendConnector.on("*",function(xr){for(var br=arguments.length,Er=new Array(br>1?br-1:0),wr=1;wr1?br-1:0),wr=1;wr{xr.init&&xr.init(this)})}if(this.format=this.options.interpolation.format,lr||(lr=noop$2),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const vr=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);vr.length>0&&vr[0]!=="dev"&&(this.options.lng=vr[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(vr=>{this[vr]=function(){return ar.store[vr](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(vr=>{this[vr]=function(){return ar.store[vr](...arguments),ar}});const mr=defer(),gr=()=>{const vr=(hr,$r)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),mr.resolve($r),lr(hr,$r)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return vr(null,this.t.bind(this));this.changeLanguage(this.options.lng,vr)};return this.options.resources||!this.options.initImmediate?gr():setTimeout(gr,0),mr}loadResources(ar){let lr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const ur=typeof ar=="string"?ar:this.language;if(typeof ar=="function"&&(lr=ar),!this.options.resources||this.options.partialBundledLanguages){if(ur&&ur.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return lr();const fr=[],dr=pr=>{if(!pr||pr==="cimode")return;this.services.languageUtils.toResolveHierarchy(pr).forEach(gr=>{gr!=="cimode"&&fr.indexOf(gr)<0&&fr.push(gr)})};ur?dr(ur):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(mr=>dr(mr)),this.options.preload&&this.options.preload.forEach(pr=>dr(pr)),this.services.backendConnector.load(fr,this.options.ns,pr=>{!pr&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),lr(pr)})}else lr(null)}reloadResources(ar,cr,lr){const ur=defer();return ar||(ar=this.languages),cr||(cr=this.options.ns),lr||(lr=noop$2),this.services.backendConnector.reload(ar,cr,fr=>{ur.resolve(),lr(fr)}),ur}use(ar){if(!ar)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!ar.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return ar.type==="backend"&&(this.modules.backend=ar),(ar.type==="logger"||ar.log&&ar.warn&&ar.error)&&(this.modules.logger=ar),ar.type==="languageDetector"&&(this.modules.languageDetector=ar),ar.type==="i18nFormat"&&(this.modules.i18nFormat=ar),ar.type==="postProcessor"&&postProcessor.addPostProcessor(ar),ar.type==="formatter"&&(this.modules.formatter=ar),ar.type==="3rdParty"&&this.modules.external.push(ar),this}setResolvedLanguage(ar){if(!(!ar||!this.languages)&&!(["cimode","dev"].indexOf(ar)>-1))for(let cr=0;cr-1)&&this.store.hasLanguageSomeTranslations(lr)){this.resolvedLanguage=lr;break}}}changeLanguage(ar,cr){var lr=this;this.isLanguageChangingTo=ar;const ur=defer();this.emit("languageChanging",ar);const fr=mr=>{this.language=mr,this.languages=this.services.languageUtils.toResolveHierarchy(mr),this.resolvedLanguage=void 0,this.setResolvedLanguage(mr)},dr=(mr,gr)=>{gr?(fr(gr),this.translator.changeLanguage(gr),this.isLanguageChangingTo=void 0,this.emit("languageChanged",gr),this.logger.log("languageChanged",gr)):this.isLanguageChangingTo=void 0,ur.resolve(function(){return lr.t(...arguments)}),cr&&cr(mr,function(){return lr.t(...arguments)})},pr=mr=>{!ar&&!mr&&this.services.languageDetector&&(mr=[]);const gr=typeof mr=="string"?mr:this.services.languageUtils.getBestMatchFromCodes(mr);gr&&(this.language||fr(gr),this.translator.language||this.translator.changeLanguage(gr),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(gr)),this.loadResources(gr,vr=>{dr(vr,gr)})};return!ar&&this.services.languageDetector&&!this.services.languageDetector.async?pr(this.services.languageDetector.detect()):!ar&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(pr):this.services.languageDetector.detect(pr):pr(ar),ur}getFixedT(ar,cr,lr){var ur=this;const fr=function(dr,pr){let mr;if(typeof pr!="object"){for(var gr=arguments.length,vr=new Array(gr>2?gr-2:0),hr=2;hr`${mr.keyPrefix}${$r}${br}`):xr=mr.keyPrefix?`${mr.keyPrefix}${$r}${dr}`:dr,ur.t(xr,mr)};return typeof ar=="string"?fr.lng=ar:fr.lngs=ar,fr.ns=cr,fr.keyPrefix=lr,fr}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(ar){this.options.defaultNS=ar}hasLoadedNamespace(ar){let cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const lr=cr.lng||this.resolvedLanguage||this.languages[0],ur=this.options?this.options.fallbackLng:!1,fr=this.languages[this.languages.length-1];if(lr.toLowerCase()==="cimode")return!0;const dr=(pr,mr)=>{const gr=this.services.backendConnector.state[`${pr}|${mr}`];return gr===-1||gr===2};if(cr.precheck){const pr=cr.precheck(this,dr);if(pr!==void 0)return pr}return!!(this.hasResourceBundle(lr,ar)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||dr(lr,ar)&&(!ur||dr(fr,ar)))}loadNamespaces(ar,cr){const lr=defer();return this.options.ns?(typeof ar=="string"&&(ar=[ar]),ar.forEach(ur=>{this.options.ns.indexOf(ur)<0&&this.options.ns.push(ur)}),this.loadResources(ur=>{lr.resolve(),cr&&cr(ur)}),lr):(cr&&cr(),Promise.resolve())}loadLanguages(ar,cr){const lr=defer();typeof ar=="string"&&(ar=[ar]);const ur=this.options.preload||[],fr=ar.filter(dr=>ur.indexOf(dr)<0);return fr.length?(this.options.preload=ur.concat(fr),this.loadResources(dr=>{lr.resolve(),cr&&cr(dr)}),lr):(cr&&cr(),Promise.resolve())}dir(ar){if(ar||(ar=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!ar)return"rtl";const cr=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],lr=this.services&&this.services.languageUtils||new LanguageUtil(get());return cr.indexOf(lr.getLanguagePartFromCode(ar))>-1||ar.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1?arguments[1]:void 0;return new I18n(ar,cr)}cloneInstance(){let ar=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$2;const lr=ar.forkResourceStore;lr&&delete ar.forkResourceStore;const ur={...this.options,...ar,isClone:!0},fr=new I18n(ur);return(ar.debug!==void 0||ar.prefix!==void 0)&&(fr.logger=fr.logger.clone(ar)),["store","services","language"].forEach(pr=>{fr[pr]=this[pr]}),fr.services={...this.services},fr.services.utils={hasLoadedNamespace:fr.hasLoadedNamespace.bind(fr)},lr&&(fr.store=new ResourceStore(this.store.data,ur),fr.services.resourceStore=fr.store),fr.translator=new Translator(fr.services,ur),fr.translator.on("*",function(pr){for(var mr=arguments.length,gr=new Array(mr>1?mr-1:0),vr=1;vr()=>{if(or.isInitialized)ar();else{const cr=()=>{setTimeout(()=>{or.off("initialized",cr)},0),ar()};or.on("initialized",cr)}};function loadNamespaces(or,ar,cr){or.loadNamespaces(ar,loadedClb(or,cr))}function loadLanguages(or,ar,cr,lr){typeof cr=="string"&&(cr=[cr]),cr.forEach(ur=>{or.options.ns.indexOf(ur)<0&&or.options.ns.push(ur)}),or.loadLanguages(ar,loadedClb(or,lr))}function oldI18nextHasLoadedNamespace(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const lr=ar.languages[0],ur=ar.options?ar.options.fallbackLng:!1,fr=ar.languages[ar.languages.length-1];if(lr.toLowerCase()==="cimode")return!0;const dr=(pr,mr)=>{const gr=ar.services.backendConnector.state[`${pr}|${mr}`];return gr===-1||gr===2};return cr.bindI18n&&cr.bindI18n.indexOf("languageChanging")>-1&&ar.services.backendConnector.backend&&ar.isLanguageChangingTo&&!dr(ar.isLanguageChangingTo,or)?!1:!!(ar.hasResourceBundle(lr,or)||!ar.services.backendConnector.backend||ar.options.resources&&!ar.options.partialBundledLanguages||dr(lr,or)&&(!ur||dr(fr,or)))}function hasLoadedNamespace(or,ar){let cr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!ar.languages||!ar.languages.length?(warnOnce("i18n.languages were undefined or empty",ar.languages),!0):ar.options.ignoreJSONStructure!==void 0?ar.hasLoadedNamespace(or,{lng:cr.lng,precheck:(ur,fr)=>{if(cr.bindI18n&&cr.bindI18n.indexOf("languageChanging")>-1&&ur.services.backendConnector.backend&&ur.isLanguageChangingTo&&!fr(ur.isLanguageChangingTo,or))return!1}}):oldI18nextHasLoadedNamespace(or,ar,cr)}const matchHtmlEntity=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,htmlEntities={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},unescapeHtmlEntity=or=>htmlEntities[or],unescape=or=>or.replace(matchHtmlEntity,unescapeHtmlEntity);let defaultOptions={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape};function setDefaults(){let or=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};defaultOptions={...defaultOptions,...or}}function getDefaults$2(){return defaultOptions}let i18nInstance;function setI18n(or){i18nInstance=or}function getI18n(){return i18nInstance}const initReactI18next={type:"3rdParty",init(or){setDefaults(or.options.react),setI18n(or)}},I18nContext=reactExports.createContext();class ReportNamespaces{constructor(){this.usedNamespaces={}}addUsedNamespaces(ar){ar.forEach(cr=>{this.usedNamespaces[cr]||(this.usedNamespaces[cr]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const usePrevious$1=(or,ar)=>{const cr=reactExports.useRef();return reactExports.useEffect(()=>{cr.current=ar?cr.current:or},[or,ar]),cr.current};function useTranslation(or){let ar=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:cr}=ar,{i18n:lr,defaultNS:ur}=reactExports.useContext(I18nContext)||{},fr=cr||lr||getI18n();if(fr&&!fr.reportNamespaces&&(fr.reportNamespaces=new ReportNamespaces),!fr){warnOnce("You will need to pass in an i18next instance by using initReactI18next");const Sr=(Or,Lr)=>typeof Lr=="string"?Lr:Lr&&typeof Lr=="object"&&typeof Lr.defaultValue=="string"?Lr.defaultValue:Array.isArray(Or)?Or[Or.length-1]:Or,Pr=[Sr,{},!1];return Pr.t=Sr,Pr.i18n={},Pr.ready=!1,Pr}fr.options.react&&fr.options.react.wait!==void 0&&warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const dr={...getDefaults$2(),...fr.options.react,...ar},{useSuspense:pr,keyPrefix:mr}=dr;let gr=or||ur||fr.options&&fr.options.defaultNS;gr=typeof gr=="string"?[gr]:gr||["translation"],fr.reportNamespaces.addUsedNamespaces&&fr.reportNamespaces.addUsedNamespaces(gr);const vr=(fr.isInitialized||fr.initializedStoreOnce)&&gr.every(Sr=>hasLoadedNamespace(Sr,fr,dr));function hr(){return fr.getFixedT(ar.lng||null,dr.nsMode==="fallback"?gr:gr[0],mr)}const[$r,xr]=reactExports.useState(hr);let br=gr.join();ar.lng&&(br=`${ar.lng}${br}`);const Er=usePrevious$1(br),wr=reactExports.useRef(!0);reactExports.useEffect(()=>{const{bindI18n:Sr,bindI18nStore:Pr}=dr;wr.current=!0,!vr&&!pr&&(ar.lng?loadLanguages(fr,ar.lng,gr,()=>{wr.current&&xr(hr)}):loadNamespaces(fr,gr,()=>{wr.current&&xr(hr)})),vr&&Er&&Er!==br&&wr.current&&xr(hr);function Or(){wr.current&&xr(hr)}return Sr&&fr&&fr.on(Sr,Or),Pr&&fr&&fr.store.on(Pr,Or),()=>{wr.current=!1,Sr&&fr&&Sr.split(" ").forEach(Lr=>fr.off(Lr,Or)),Pr&&fr&&Pr.split(" ").forEach(Lr=>fr.store.off(Lr,Or))}},[fr,br]);const yr=reactExports.useRef(!0);reactExports.useEffect(()=>{wr.current&&!yr.current&&xr(hr),yr.current=!1},[fr,mr]);const _r=[$r,fr,vr];if(_r.t=$r,_r.i18n=fr,_r.ready=vr,vr||!vr&&!pr)return _r;throw new Promise(Sr=>{ar.lng?loadLanguages(fr,ar.lng,gr,()=>Sr()):loadNamespaces(fr,gr,()=>Sr())})}function _classCallCheck(or,ar){if(!(or instanceof ar))throw new TypeError("Cannot call a class as a function")}function _typeof(or){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ar){return typeof ar}:function(ar){return ar&&typeof Symbol=="function"&&ar.constructor===Symbol&&ar!==Symbol.prototype?"symbol":typeof ar},_typeof(or)}function toPrimitive(or,ar){if(_typeof(or)!="object"||!or)return or;var cr=or[Symbol.toPrimitive];if(cr!==void 0){var lr=cr.call(or,ar||"default");if(_typeof(lr)!="object")return lr;throw new TypeError("@@toPrimitive must return a primitive value.")}return(ar==="string"?String:Number)(or)}function toPropertyKey(or){var ar=toPrimitive(or,"string");return _typeof(ar)=="symbol"?ar:String(ar)}function _defineProperties(or,ar){for(var cr=0;cr1&&arguments[1]!==void 0?arguments[1]:{},lr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};_classCallCheck(this,or),this.backends=[],this.type="backend",this.allOptions=lr,this.init(ar,cr)}return _createClass(or,[{key:"init",value:function(cr){var lr=this,ur=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=cr,this.options=defaults$3(ur,this.options||{},getDefaults$1()),this.allOptions=fr,this.options.backends&&this.options.backends.forEach(function(dr,pr){lr.backends[pr]=lr.backends[pr]||createClassOnDemand(dr),lr.backends[pr].init(cr,lr.options.backendOptions&&lr.options.backendOptions[pr]||{},fr)}),this.services&&this.options.reloadInterval&&setInterval(function(){return lr.reload()},this.options.reloadInterval)}},{key:"read",value:function(cr,lr,ur){var fr=this,dr=this.backends.length,pr=function gr(vr){if(vr>=dr)return ur(new Error("non of the backend loaded data",!0));var hr=vr===dr-1,$r=fr.options.handleEmptyResourcesAsFailed&&!hr?0:-1,xr=fr.backends[vr];xr.read?handleCorrectReadFunction(xr,cr,lr,function(br,Er,wr){if(!br&&Er&&Object.keys(Er).length>$r){if(ur(null,Er,vr),mr(vr-1,Er),xr.save&&fr.options.cacheHitMode&&["refresh","refreshAndUpdateStore"].indexOf(fr.options.cacheHitMode)>-1){if(wr&&fr.options.refreshExpirationTime&&wr+fr.options.refreshExpirationTime>Date.now())return;var yr=fr.backends[vr+1];yr&&yr.read&&handleCorrectReadFunction(yr,cr,lr,function(_r,Sr){_r||Sr&&(Object.keys(Sr).length<=$r||(mr(vr,Sr),fr.options.cacheHitMode==="refreshAndUpdateStore"&&fr.services&&fr.services.resourceStore&&fr.services.resourceStore.addResourceBundle(cr,lr,Sr)))})}}else gr(vr+1)}):gr(vr+1)},mr=function gr(vr,hr){if(!(vr<0)){var $r=fr.backends[vr];$r.save&&$r.save(cr,lr,hr),gr(vr-1,hr)}};pr(0)}},{key:"create",value:function(cr,lr,ur,fr){var dr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},pr=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(mr){if(mr.create){var gr=mr.create.bind(mr);if(gr.length<6){try{var vr;gr.length===5?vr=gr(cr,lr,ur,fr,pr):vr=gr(cr,lr,ur,fr),vr&&typeof vr.then=="function"?vr.then(function(hr){return dr(null,hr)}).catch(dr):dr(null,vr)}catch(hr){dr(hr)}return}gr(cr,lr,ur,fr,dr,pr)}})}},{key:"reload",value:function(){var cr=this,lr=this.services,ur=lr.backendConnector,fr=lr.languageUtils,dr=lr.logger,pr=ur.language;if(!(pr&&pr.toLowerCase()==="cimode")){var mr=[],gr=function(hr){var $r=fr.toResolveHierarchy(hr);$r.forEach(function(xr){mr.indexOf(xr)<0&&mr.push(xr)})};gr(pr),this.allOptions.preload&&this.allOptions.preload.forEach(function(vr){return gr(vr)}),mr.forEach(function(vr){cr.allOptions.ns.forEach(function(hr){ur.read(vr,hr,"read",null,null,function($r,xr){$r&&dr.warn("loading namespace ".concat(hr," for language ").concat(vr," failed"),$r),!$r&&xr&&dr.log("loaded namespace ".concat(hr," for language ").concat(vr),xr),ur.loaded("".concat(vr,"|").concat(hr),$r,xr)})})})}}}]),or}();Backend$1.type="backend";const defaults$2={loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",multiSeparator:"+",allowMultiLoading:!1,fetch:typeof fetch>"u"?void 0:fetch,parse:JSON.parse,stringify:JSON.stringify,requestOptions:{}},arrify=or=>Array.isArray(or)?or:[or],normalize=(or,...ar)=>typeof or=="function"?or(...ar):or;class BackendError extends Error{constructor(cr,lr=!1){super(cr);Fs(this,"retry",null);this.retry=lr}}class Backend{constructor(ar,cr){Fs(this,"type","backend");this.init(ar,cr)}init(ar,cr={}){this.services=ar,this.options={...defaults$2,...this.options,...cr}}getLoadPath(ar,cr){return normalize(this.options.loadPath,ar,cr)}read(ar,cr,lr){const ur=this.getLoadPath(ar,cr),fr=this.services.interpolator.interpolate(ur,{lng:ar,ns:cr});this.loadUrl(fr,lr)}readMulti(ar,cr,lr){const ur=this.getLoadPath(ar,cr),{multiSeparator:fr}=this.options,dr=this.services.interpolator.interpolate(ur,{lng:ar.join(fr),ns:cr.join(fr)});this.loadUrl(dr,lr)}loadUrl(ar,cr){const{fetch:lr,requestOptions:ur,parse:fr}=this.options;lr(ar,ur).then(dr=>{const{ok:pr,status:mr}=dr;if(!pr){const gr=mr>=500&&mr<600;throw new BackendError(`failed loading ${ar}`,gr)}return dr.text()},()=>{throw new BackendError(`failed loading ${ar}`)}).then(dr=>{try{return cr(null,fr(dr,ar))}catch{throw new BackendError(`failed parsing ${ar} to json`,!1)}}).catch(dr=>{dr instanceof BackendError&&cr(dr.message,dr.retry)})}create(ar,cr,lr,ur){const fr={[lr]:ur||""};arrify(ar).forEach(dr=>{const{addPath:pr,requestOptions:mr,fetch:gr,stringify:vr}=this.options,hr=this.services.interpolator.interpolate(pr,{lng:dr,ns:cr});try{gr(hr,{method:"POST",body:vr(fr),...mr})}catch($r){console.error($r)}})}}Fs(Backend,"type","backend");var arr=[],each$1=arr.forEach,slice=arr.slice;function defaults$1(or){return each$1.call(slice.call(arguments,1),function(ar){if(ar)for(var cr in ar)or[cr]===void 0&&(or[cr]=ar[cr])}),or}var fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,serializeCookie=function or(ar,cr,lr){var ur=lr||{};ur.path=ur.path||"/";var fr=encodeURIComponent(cr),dr="".concat(ar,"=").concat(fr);if(ur.maxAge>0){var pr=ur.maxAge-0;if(Number.isNaN(pr))throw new Error("maxAge should be a Number");dr+="; Max-Age=".concat(Math.floor(pr))}if(ur.domain){if(!fieldContentRegExp.test(ur.domain))throw new TypeError("option domain is invalid");dr+="; Domain=".concat(ur.domain)}if(ur.path){if(!fieldContentRegExp.test(ur.path))throw new TypeError("option path is invalid");dr+="; Path=".concat(ur.path)}if(ur.expires){if(typeof ur.expires.toUTCString!="function")throw new TypeError("option expires is invalid");dr+="; Expires=".concat(ur.expires.toUTCString())}if(ur.httpOnly&&(dr+="; HttpOnly"),ur.secure&&(dr+="; Secure"),ur.sameSite){var mr=typeof ur.sameSite=="string"?ur.sameSite.toLowerCase():ur.sameSite;switch(mr){case!0:dr+="; SameSite=Strict";break;case"lax":dr+="; SameSite=Lax";break;case"strict":dr+="; SameSite=Strict";break;case"none":dr+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return dr},cookie={create:function or(ar,cr,lr,ur){var fr=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};lr&&(fr.expires=new Date,fr.expires.setTime(fr.expires.getTime()+lr*60*1e3)),ur&&(fr.domain=ur),document.cookie=serializeCookie(ar,encodeURIComponent(cr),fr)},read:function or(ar){for(var cr="".concat(ar,"="),lr=document.cookie.split(";"),ur=0;ur-1&&(lr=window.location.hash.substring(window.location.hash.indexOf("?")));for(var ur=lr.substring(1),fr=ur.split("&"),dr=0;dr0){var mr=fr[dr].substring(0,pr);mr===ar.lookupQuerystring&&(cr=fr[dr].substring(pr+1))}}}return cr}},hasLocalStorageSupport=null,localStorageAvailable=function or(){if(hasLocalStorageSupport!==null)return hasLocalStorageSupport;try{hasLocalStorageSupport=window!=="undefined"&&window.localStorage!==null;var ar="i18next.translate.boo";window.localStorage.setItem(ar,"foo"),window.localStorage.removeItem(ar)}catch{hasLocalStorageSupport=!1}return hasLocalStorageSupport},localStorage$1={name:"localStorage",lookup:function or(ar){var cr;if(ar.lookupLocalStorage&&localStorageAvailable()){var lr=window.localStorage.getItem(ar.lookupLocalStorage);lr&&(cr=lr)}return cr},cacheUserLanguage:function or(ar,cr){cr.lookupLocalStorage&&localStorageAvailable()&&window.localStorage.setItem(cr.lookupLocalStorage,ar)}},hasSessionStorageSupport=null,sessionStorageAvailable=function or(){if(hasSessionStorageSupport!==null)return hasSessionStorageSupport;try{hasSessionStorageSupport=window!=="undefined"&&window.sessionStorage!==null;var ar="i18next.translate.boo";window.sessionStorage.setItem(ar,"foo"),window.sessionStorage.removeItem(ar)}catch{hasSessionStorageSupport=!1}return hasSessionStorageSupport},sessionStorage={name:"sessionStorage",lookup:function or(ar){var cr;if(ar.lookupSessionStorage&&sessionStorageAvailable()){var lr=window.sessionStorage.getItem(ar.lookupSessionStorage);lr&&(cr=lr)}return cr},cacheUserLanguage:function or(ar,cr){cr.lookupSessionStorage&&sessionStorageAvailable()&&window.sessionStorage.setItem(cr.lookupSessionStorage,ar)}},navigator$1={name:"navigator",lookup:function or(ar){var cr=[];if(typeof navigator<"u"){if(navigator.languages)for(var lr=0;lr0?cr:void 0}},htmlTag={name:"htmlTag",lookup:function or(ar){var cr,lr=ar.htmlTag||(typeof document<"u"?document.documentElement:null);return lr&&typeof lr.getAttribute=="function"&&(cr=lr.getAttribute("lang")),cr}},path={name:"path",lookup:function or(ar){var cr;if(typeof window<"u"){var lr=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(lr instanceof Array)if(typeof ar.lookupFromPathIndex=="number"){if(typeof lr[ar.lookupFromPathIndex]!="string")return;cr=lr[ar.lookupFromPathIndex].replace("/","")}else cr=lr[0].replace("/","")}return cr}},subdomain={name:"subdomain",lookup:function or(ar){var cr=typeof ar.lookupFromSubdomainIndex=="number"?ar.lookupFromSubdomainIndex+1:1,lr=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(lr)return lr[cr]}};function getDefaults(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(ar){return ar}}}var Browser$1=function(){function or(ar){var cr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_classCallCheck(this,or),this.type="languageDetector",this.detectors={},this.init(ar,cr)}return _createClass(or,[{key:"init",value:function(cr){var lr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ur=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=cr||{languageUtils:{}},this.options=defaults$1(lr,this.options||{},getDefaults()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(fr){return fr.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=ur,this.addDetector(cookie$1),this.addDetector(querystring),this.addDetector(localStorage$1),this.addDetector(sessionStorage),this.addDetector(navigator$1),this.addDetector(htmlTag),this.addDetector(path),this.addDetector(subdomain)}},{key:"addDetector",value:function(cr){this.detectors[cr.name]=cr}},{key:"detect",value:function(cr){var lr=this;cr||(cr=this.options.order);var ur=[];return cr.forEach(function(fr){if(lr.detectors[fr]){var dr=lr.detectors[fr].lookup(lr.options);dr&&typeof dr=="string"&&(dr=[dr]),dr&&(ur=ur.concat(dr))}}),ur=ur.map(function(fr){return lr.options.convertDetectedLanguage(fr)}),this.services.languageUtils.getBestMatchFromCodes?ur:ur.length>0?ur[0]:null}},{key:"cacheUserLanguage",value:function(cr,lr){var ur=this;lr||(lr=this.options.caches),lr&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(cr)>-1||lr.forEach(function(fr){ur.detectors[fr]&&ur.detectors[fr].cacheUserLanguage(cr,ur.options)}))}}]),or}();Browser$1.type="languageDetector";const locales=["en-US","en","ru-RU","uk-UA"];instance.use(Backend$1).use(Browser$1).use(initReactI18next).init({fallbackLng:"en",supportedLngs:locales,defaultNS:"theme",fallbackNS:"translation",load:"currentOnly",debug:!0,interpolation:{escapeValue:!1},backend:{backends:[Backend],backendOptions:[{loadPath:new URL("locales/",window.location.href).href+"{{lng}}/{{ns}}.json"}]}});function loadThemeTranslations(or){const ar={};for(const cr of or){if(!locales.includes(cr.lang))continue;const lr=ar[cr.lang]??{};lr[cr.tkey]=cr.value,ar[cr.lang]=lr}for(const[cr,lr]of Object.entries(ar))instance.addResourceBundle(cr,"theme",lr,!0,!0)}function unloadThemeTranslations(){for(const or of locales)instance.removeResourceBundle(or,"theme")}function formatDate(or){return new Intl.DateTimeFormat(instance.language,{dateStyle:"long",timeStyle:"short"}).format(or)}const baseInit$=create(!1),initDeferred$=create(defer$1()),initialBaseUrl$=create("/"),input$=create({isOpen:!1,content:"",entered:"",onfinished:null},or=>{const ar=or.focus(lr=>lr.isOpen),cr=or.focus(lr=>lr.entered);return{open(lr,ur){isPaused$.set(!0),or.set({isOpen:!0,content:lr,entered:"",onfinished:ur})},enter(lr){cr.set(lr)},finish(){var lr,ur;ar.value&&(ar.set(!1),isPaused$.set(!1),(ur=(lr=or.value).onfinished)==null||ur.call(lr,cr.value))},close(){var lr,ur;ar.value&&(ar.set(!1),isPaused$.set(!1),(ur=(lr=or.value).onfinished)==null||ur.call(lr,""))},clear(){var lr,ur;ar.value&&((ur=(lr=or.value).onfinished)==null||ur.call(lr,""),isPaused$.set(!1)),or.set({isOpen:!1,content:"",entered:"",onfinished:null})}}}),menu$=create({isOpen:!1,items:[],onselect:null},or=>{const ar=or.focus(cr=>cr.isOpen);return{open(cr,lr){or.set({isOpen:!0,items:cr,onselect:lr})},select(cr){var lr,ur;ar.set(!1),(ur=(lr=or.value).onselect)==null||ur.call(lr,cr),or.value.onselect=null},close(){var cr,lr;ar.set(!1),(lr=(cr=or.value).onselect)==null||lr.call(cr,-1),or.value.onselect=null},clear(){var cr,lr;ar.value&&((lr=(cr=or.value).onselect)==null||lr.call(cr,-1)),or.set({isOpen:!1,items:[],onselect:null})}}}),msg$=create({isOpen:!1,content:"",onclosed:null},or=>{const ar=or.focus(cr=>cr.isOpen);return{open(cr,lr){isPaused$.set(!0),or.set({isOpen:!0,content:cr,onclosed:lr})},close(){var cr,lr;ar.value&&(isPaused$.set(!1),ar.set(!1),(lr=(cr=or.value).onclosed)==null||lr.call(cr))},clear(){var cr,lr;ar.value&&(isPaused$.set(!1),(lr=(cr=or.value).onclosed)==null||lr.call(cr)),or.set({isOpen:!1,content:"",onclosed:null})}}}),currentGameEntry$=create(null),currentGame$=create(),currentGameMode$=create(or=>{var ar;return((ar=or(currentGame$))==null?void 0:ar.mode)||"classic"}),currentAeroWidth$=create(or=>{var ar,cr;return((cr=(ar=or(currentGame$))==null?void 0:ar.aero)==null?void 0:cr.width)??800}),currentAeroHeight$=create(or=>{var ar,cr;return((cr=(ar=or(currentGame$))==null?void 0:ar.aero)==null?void 0:cr.height)??600}),saveSlotsCount$=create(or=>{var ar;return((ar=or(currentGame$))==null?void 0:ar.save_slots)??9}),onGameEnd$=create(null),baseUrl$=create("");async function runGame(or){var ur,fr,dr,pr,mr,gr,vr;if(!or)throw new Error("Game not found");baseUrl$.set(or.loadConfig.url);let ar=or.loadConfig.descriptor||{id:or.id,mode:or.mode,title:or.title,file:""};try{const hr=await fetchProxyFallback("game.cfg").then(xr=>xr.text()),$r=parse$1(hr);if(((ur=$r.game)==null?void 0:ur.length)===1)[ar]=$r.game;else{const xr=(fr=$r.game)==null?void 0:fr.find(br=>br.id===or.id);if(!xr)throw new Error("Config not found");ar=xr}}catch{}if((ar==null?void 0:ar.mode)==="classic"||!(ar!=null&&ar.mode))try{const hr=await fetchProxyFallback("qspgui.cfg");if(!hr.ok)throw new Error("No config file");const $r=await hr.text(),xr=parseCfg($r);if(xr||!Object.keys(xr).length)throw new Error("Invalid config file");qspGuiCfg$.set(xr)}catch{}if(ar.mode==="aero")if(ar.aero)ar.window={...ar.window??{},...ar.aero,resizable:!1};else try{const hr=await fetchProxyFallback("config.xml");if(!hr.ok)throw new Error("No config file");const $r=await hr.text(),Er=new DOMParser().parseFromString($r,"application/xml").querySelector("game");if(Er){const wr=parseInt(Er.getAttribute("width")||"800"),yr=parseInt(Er.getAttribute("height")||"600");ar.aero={width:wr,height:yr},ar.window={...ar.window??{},width:wr,height:yr,resizable:!1}}}catch{ar.aero={width:800,height:600},ar.window={...ar.window??{},width:800,height:600,resizable:!1}}let cr=await fetchProxyFallback(or.loadConfig.entrypoint).then(hr=>hr.arrayBuffer());if(!cr)throw new Error("Failed to load game");or.loadConfig.entrypoint.toLowerCase().endsWith(".qsps")&&(cr=convertQsps(cr)),(dr=windowManager$.value)==null||dr.setTitle(or.title),setupGlobalHotKeys(),ar!=null&&ar.hotkeys&&setupCustomHotKeys(ar.hotkeys),(pr=ar==null?void 0:ar.resources)!=null&&pr.icon&&((mr=windowManager$.value)==null||mr.setIcon(ar.resources.icon)),loadAdditionalResources(ar==null?void 0:ar.resources),ar!=null&&ar.themes&&await registerThemes(ar.themes),ar!=null&&ar.defaultTheme?currentTheme$.set(ar.defaultTheme):(ar==null?void 0:ar.mode)==="aero"?currentTheme$.set(AERO_THEME):currentTheme$.set(CLASSIC_THEME),loadThemeTranslations(currentTranslations$.value),(gr=qspApi$.value)==null||gr.openGame(cr,!0),(vr=qspApi$.value)==null||vr.restartGame(),currentGameEntry$.set(or),ar&¤tGame$.set(ar),loadSaveList(),console.log(ar),ar&&applyWindowSettings(ar.window)}let wasResized=!1;async function applyWindowSettings(or){var ar,cr,lr,ur;if(or){or.width&&or.height&&(await((ar=windowManager$.value)==null?void 0:ar.resize(or.width,or.height)),wasResized=!0);const fr=or.resizable??!0;(cr=windowManager$.value)==null||cr.setResizable(fr),fr&&(or.minWidth&&or.minHeight&&await((lr=windowManager$.value)==null?void 0:lr.setMinSize(or.minWidth,or.minHeight)),or.maxWidth&&or.maxHeight&&await((ur=windowManager$.value)==null?void 0:ur.setMaxSize(or.maxWidth,or.maxHeight))),or.fullscreen&&setTimeout(()=>{var dr;return(dr=windowManager$.value)==null?void 0:dr.goFullscreen()},0)}}baseUrl$.subscribe(or=>{const ar=document.querySelector("#page-base");ar.href=or||"/"});function stopCurrentGame(){var ar;baseUrl$.set(initialBaseUrl$.value),currentGameEntry$.set(null),currentGame$.set(null),qspGuiCfg$.set(null),isPauseScreenVisible$.set(!1),pauseScreenCurrentPanel$.set("credits"),isPaused$.set(!0),input$.actions.clear(),menu$.actions.clear(),msg$.actions.clear(),mainContent$.set(""),statsContent$.set(""),actions$.set([]),objects$.set([]),cmdText$.set("");const or=windowManager$.value;or&&(or.setTitle("qSpider"),or.setIcon("favicon.ico"),or.setResizable(!0),or.unsetMaxSize(),or.unsetMinSize(),wasResized&&or.resize(1024,768)),sounds$.actions.clear(),regions$.set({}),layers$.set({}),clearAdditionalResources(),clearHotkeys(),unloadThemeTranslations(),currentTheme$.set(CLASSIC_THEME),themeRegistry$.actions.reset(),window.dispatchEvent(new Event("game-unload")),wasResized=!1,(ar=onGameEnd$.value)==null||ar.call(onGameEnd$)}function onRestart(){reloadRegions(),reloadLayers()}function onRestore(){reloadRegions(),reloadLayers()}function onGameCommand(or){var ar;if(or.startsWith("pause:")){const[,cr]=or.split(":");isPauseScreenVisible$.value||isPauseScreenVisible$.set(!0),pauseScreenCurrentPanel$.set(cr)}else if(or.startsWith("scroll:")){const[,cr,lr]=or.split(":");switch(cr){case"main":mainScroll$.update(ur=>lr==="top"?-1:Math.max(ur,0)+1);break;case"stats":statsScroll$.update(ur=>lr==="top"?-1:Math.max(ur,0)+1);break}}switch(or){case"quit":stopCurrentGame();break;case"restart":isPaused$.set(!0),(ar=qspApi$.value)==null||ar.restartGame(),onRestart(),isPauseScreenVisible$.set(!1),pauseScreenCurrentPanel$.set("credits");break;case"resume":isPauseScreenVisible$.set(!1);break;case"mute":muted$.set(!0);break;case"unmute":muted$.set(!1);break;case"toggle-mute":muted$.update(cr=>!cr);break;case"quicksave":quickSave();break;case"quickload":quickLoad();break}}const wait$=create(null),waitTimeout$=create();function finishWait(){const or=wait$.value;or&&(clearTimeout(waitTimeout$.value),isPaused$.set(!1),wait$.set(null),or.finish())}wait$.subscribe(or=>{or&&(clearTimeout(waitTimeout$.value),isPaused$.set(!0),waitTimeout$.set(setTimeout(()=>{finishWait()},or.ms)))});const errorMessage$=create(""),isErrorShown$=create(!1);function showError(or){errorMessage$.set(or),isErrorShown$.set(!0)}const noticeMessage$=create(""),isNoticeShown$=create(!1);let noticeTimeout=null;function showNotice(or){noticeMessage$.set(or),isNoticeShown$.set(!0),noticeTimeout&&clearTimeout(noticeTimeout),noticeTimeout=setTimeout(()=>{isNoticeShown$.set(!1)},3e3)}const qspiderCommands={"action:"(or){onGameCommand(or)},"event:"(or){setTimeout(()=>{const ar=or.trim().match(/(.*?)(\[(.*?)\])/i);if(ar){const cr=ar[1],lr=ar[3].split(",").map(ur=>{const fr=ur.trim();return fr.startsWith('"')||fr.startsWith("'")?fr.replace(/['"](.*?)['"]/gim,(dr,pr)=>pr):parseInt(fr)});window.dispatchEvent(new CustomEvent("qspider-event",{detail:{name:cr,args:lr}}))}else window.dispatchEvent(new CustomEvent("qspider-event",{detail:{name:or.trim()}}))},0)},"change_theme:"(or){if(!themeRegistry$.value[or]){errorMessage$.set(`Theme ${or} is not registered`);return}currentTheme$.set(or)},"update_region:"(or){var cr;regions$.focus(lr=>lr[or]).set(((cr=qspApi$.value)==null?void 0:cr.readVariableByKey("$qspider_region",or))??"")},"scroll_region:"(or){const[ar,cr]=or.split(":"),lr=regionsScroll$.focus(ur=>ur[ar]);cr==="top"?lr.set(-1):lr.update(ur=>Math.max(ur,0)+1)},"update_layer:"(or){layers$.focus(cr=>cr[or]).set(readLayerState(or))},update_layers(){const or=layers$.value??{},ar={};for(const cr of Object.keys(or))ar[cr]=readLayerState(cr);layers$.set(ar)},"fullscreen:"(or){var ar,cr;or==="on"?(ar=windowManager$.value)==null||ar.goFullscreen():(cr=windowManager$.value)==null||cr.goWindowed()},quit(){stopCurrentGame()}},qspiderModuleContent=`# qspider_change_theme ! $args[0] - theme name exec('qspider.change_theme:<<$args[0]>>') --- diff --git a/index.html b/index.html index 60e49a6..c8d59b1 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - +