import{W as T}from"./chunk-OXZWBTVI.js";var h=":",M="|",B="@@",R="\u241F",A;function U(t){A??=new TextEncoder;let e=A.encode(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=L(n,e.length,0),s=L(n,e.length,102072);return i==0&&(s==0||s==1)&&(i=i^319790063,s=s^-1801410264),BigInt.asUintN(32,BigInt(i))<<BigInt(32)|BigInt.asUintN(32,BigInt(s))}function j(t,e=""){let n=U(t);return e&&(n=BigInt.asUintN(64,n<<BigInt(1))|n>>BigInt(63)&BigInt(1),n+=U(e)),BigInt.asUintN(63,n).toString()}function L(t,e,n){let i=2654435769,s=2654435769,r=0,u=e-12;for(;r<=u;r+=12){i+=t.getUint32(r,!0),s+=t.getUint32(r+4,!0),n+=t.getUint32(r+8,!0);let o=N(i,s,n);i=o[0],s=o[1],n=o[2]}let a=e-r;return n+=e,a>=4?(i+=t.getUint32(r,!0),r+=4,a>=8?(s+=t.getUint32(r,!0),r+=4,a>=9&&(n+=t.getUint8(r++)<<8),a>=10&&(n+=t.getUint8(r++)<<16),a===11&&(n+=t.getUint8(r++)<<24)):(a>=5&&(s+=t.getUint8(r++)),a>=6&&(s+=t.getUint8(r++)<<8),a===7&&(s+=t.getUint8(r++)<<16))):(a>=1&&(i+=t.getUint8(r++)),a>=2&&(i+=t.getUint8(r++)<<8),a===3&&(i+=t.getUint8(r++)<<16)),N(i,s,n)[2]}function N(t,e,n){return t-=e,t-=n,t^=n>>>13,e-=n,e-=t,e^=t<<8,n-=t,n-=e,n^=e>>>13,t-=e,t-=n,t^=n>>>12,e-=n,e-=t,e^=t<<16,n-=t,n-=e,n^=e>>>5,t-=e,t-=n,t^=n>>>3,e-=n,e-=t,e^=t<<10,n-=t,n-=e,n^=e>>>15,[t,e,n]}function v(t,e,n,i,s=[]){let r={},u={},a={},o=k(t[0],t.raw[0]),c=[o.text],m=[],d=o.text;for(let l=1;l<t.length;l++){let{messagePart:x,placeholderName:f=b(l),associatedMessageId:I}=w(t[l],t.raw[l]);d+=`{$${f}}${x}`,e!==void 0&&(r[f]=e[l-1],u[f]=s[l-1]),m.push(f),I!==void 0&&(a[f]=I),c.push(x)}let $=o.customId||j(d,o.meaning||""),D=o.legacyIds?o.legacyIds.filter(l=>l!==$):[];return{id:$,legacyIds:D,substitutions:r,substitutionLocations:u,text:d,customId:o.customId,meaning:o.meaning||"",description:o.description||"",messageParts:c,messagePartLocations:i,placeholderNames:m,associatedMessageIds:a,location:n}}function k(t,e){let{text:n,block:i}=E(t,e);if(i===void 0)return{text:n};{let[s,...r]=i.split(R),[u,a]=s.split(B,2),[o,c]=u.split(M,2);return c===void 0&&(c=o,o=void 0),c===""&&(c=void 0),{text:n,meaning:o,description:c,customId:a,legacyIds:r}}}function w(t,e){let{text:n,block:i}=E(t,e);if(i===void 0)return{messagePart:n};{let[s,r]=i.split(B);return{messagePart:n,placeholderName:s,associatedMessageId:r}}}function E(t,e){if(e.charAt(0)!==h)return{text:t};{let n=z(t,e);return{block:t.substring(1,n),text:t.substring(n+1)}}}function b(t){return t===1?"PH":`PH_${t-1}`}function z(t,e){for(let n=1,i=1;n<t.length;n++,i++)if(e[i]==="\\")i++;else if(t[n]===h)return n;throw new Error(`Unterminated $localize metadata block in "${e}".`)}var g=class extends Error{parsedMessage;type="MissingTranslationError";constructor(e){super(`No translation found for ${O(e)}.`),this.parsedMessage=e}};function C(t,e,n){let i=v(e,n),s=t[i.id];if(i.legacyIds!==void 0)for(let r=0;r<i.legacyIds.length&&s===void 0;r++)s=t[i.legacyIds[r]];if(s===void 0)throw new g(i);return[s.messageParts,s.placeholderNames.map(r=>{if(i.substitutions.hasOwnProperty(r))return i.substitutions[r];throw new Error(`There is a placeholder name mismatch with the translation provided for the message ${O(i)}.
The translation contains a placeholder with name ${r}, which does not exist in the message.`)})]}function P(t){let e=t.split(/{\$([^}]*)}/),n=[e[0]],i=[];for(let r=1;r<e.length-1;r+=2)i.push(e[r]),n.push(`${e[r+1]}`);let s=n.map(r=>r.charAt(0)===h?"\\"+r:r);return{text:t,messageParts:G(n,s),placeholderNames:i}}function G(t,e){return Object.defineProperty(t,"raw",{value:e}),t}function O(t){let e=t.meaning&&` - "${t.meaning}"`,n=t.legacyIds&&t.legacyIds.length>0?` [${t.legacyIds.map(i=>`"${i}"`).join(", ")}]`:"";return`"${t.id}"${n} ("${t.text}"${e})`}function S(t){$localize.translate||($localize.translate=_),$localize.TRANSLATIONS||($localize.TRANSLATIONS={}),Object.keys(t).forEach(e=>{$localize.TRANSLATIONS[e]=P(t[e])})}function _(t,e){try{return C($localize.TRANSLATIONS,t,e)}catch(n){return console.warn(n.message),[t,e]}}var p="en-US",F=["en-US","en-GB","de-DE","fr-FR","da-DK"],y={"en-US":"en","en-GB":"en-GB","da-DK":"da","de-DE":"de","fr-FR":"fr"},W=[{value:"en-US",label:"English (en-US)"},{value:"en-GB",label:"English (en-GB)"},{value:"fr-FR",label:"French"},{value:"de-DE",label:"German"},{value:"da-DK",label:"Danish"}];function Y(t){return t?y[t]??"en":"en"}function q(){let t=localStorage.getItem("v1:duplicati:locale")||p,e=F.find(i=>i===t)??p,n=y[e];return e===p||(import(`/locale/angular/${n}.mjs`).then(i=>T(i.default)),fetch(`/locale/messages.${e}.json`).then(i=>i.json()).then(i=>{S(i.translations),$localize.locale=e})),e}export{W as a,Y as b,q as c};
