@everymatrix/casino-providers 1.15.6 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/casino-providers.js +71 -73
- package/dist/casino-providers.js.map +1 -1
- package/package.json +2 -2
package/dist/casino-providers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).app=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function r(){return Object.create(null)}function n(e){e.forEach(t)}function i(e){return"function"==typeof e}function o(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let s,a;function h(e,t){return s||(s=document.createElement("a")),s.href=t,e===s.href}function l(t,...r){if(null==t)return e;const n=t.subscribe(...r);return n.unsubscribe?()=>n.unsubscribe():n}function u(e,t){e.appendChild(t)}function c(e,t,r){e.insertBefore(t,r||null)}function p(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function m(e){return document.createElement(e)}function g(e){return document.createTextNode(e)}function d(){return g(" ")}function
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).app=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function r(){return Object.create(null)}function n(e){e.forEach(t)}function i(e){return"function"==typeof e}function o(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let s,a;function h(e,t){return s||(s=document.createElement("a")),s.href=t,e===s.href}function l(t,...r){if(null==t)return e;const n=t.subscribe(...r);return n.unsubscribe?()=>n.unsubscribe():n}function u(e,t){e.appendChild(t)}function c(e,t,r){e.insertBefore(t,r||null)}function p(e){e.parentNode&&e.parentNode.removeChild(e)}function f(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function m(e){return document.createElement(e)}function g(e){return document.createTextNode(e)}function d(){return g(" ")}function b(e,t,r,n){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}function E(e,t,r){null==r?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}function y(e,t){t=""+t,e.data!==t&&(e.data=t)}function v(e){const t={};for(const r of e)t[r.name]=r.value;return t}function T(e){a=e}const H=[],P=[];let _=[];const B=[],A=Promise.resolve();let S=!1;function L(e){_.push(e)}
|
|
2
2
|
// flush() calls callbacks in this order:
|
|
3
3
|
// 1. All beforeUpdate callbacks, in order: parents before children
|
|
4
4
|
// 2. All bind:this callbacks, in reverse order: children before parents.
|
|
@@ -17,26 +17,26 @@
|
|
|
17
17
|
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
|
|
18
18
|
// callback called a second time; the seen_callbacks set, outside the flush()
|
|
19
19
|
// function, guarantees this behavior.
|
|
20
|
-
const N=new Set;let
|
|
20
|
+
const N=new Set;let O=0;// Do *not* move this inside the flush() function
|
|
21
21
|
function w(){
|
|
22
22
|
// Do not reenter flush while dirty components are updated, as this can
|
|
23
23
|
// result in an infinite loop. Instead, let the inner flush handle it.
|
|
24
24
|
// Reentrancy is ok afterwards for bindings etc.
|
|
25
|
-
if(0!==
|
|
25
|
+
if(0!==O)return;const e=a;do{
|
|
26
26
|
// first, call beforeUpdate functions
|
|
27
27
|
// and update components
|
|
28
|
-
try{for(;
|
|
28
|
+
try{for(;O<H.length;){const e=H[O];O++,T(e),I(e.$$)}}catch(e){
|
|
29
29
|
// reset dirty state to not end up in a deadlocked state and then rethrow
|
|
30
|
-
throw H.length=0,
|
|
30
|
+
throw H.length=0,O=0,e}for(T(null),H.length=0,O=0;P.length;)P.pop()();
|
|
31
31
|
// then, once components are updated, call
|
|
32
32
|
// afterUpdate functions. This may cause
|
|
33
33
|
// subsequent updates...
|
|
34
34
|
for(let e=0;e<_.length;e+=1){const t=_[e];N.has(t)||(
|
|
35
35
|
// ...so guard against infinite loops
|
|
36
|
-
N.add(t),t())}_.length=0}while(H.length);for(;B.length;)B.pop()();S=!1,N.clear(),T(e)}function
|
|
36
|
+
N.add(t),t())}_.length=0}while(H.length);for(;B.length;)B.pop()();S=!1,N.clear(),T(e)}function I(e){if(null!==e.fragment){e.update(),n(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(L)}}
|
|
37
37
|
/**
|
|
38
38
|
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
|
|
39
|
-
*/const
|
|
39
|
+
*/const C=new Set;function M(e,t){const r=e.$$;null!==r.fragment&&(!function(e){const t=[],r=[];_.forEach((n=>-1===e.indexOf(n)?t.push(n):r.push(n))),r.forEach((e=>e())),_=t}(r.after_update),n(r.on_destroy),r.fragment&&r.fragment.d(t),
|
|
40
40
|
// TODO null out other refs, including component.$$ (but need to
|
|
41
41
|
// preserve final state?)
|
|
42
42
|
r.on_destroy=r.fragment=null,r.ctx=[])}function R(e,t){-1===e.$$.dirty[0]&&(H.push(e),S||(S=!0,A.then(w)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function U(o,s,h,l,u,c,f,m=[-1]){const g=a;T(o);const d=o.$$={fragment:null,ctx:[],
|
|
@@ -45,13 +45,13 @@ props:c,update:e,not_equal:u,bound:r(),
|
|
|
45
45
|
// lifecycle
|
|
46
46
|
on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(g?g.$$.context:[])),
|
|
47
47
|
// everything else
|
|
48
|
-
callbacks:r(),dirty:m,skip_bound:!1,root:s.target||g.$$.root};f&&f(d.root);let
|
|
48
|
+
callbacks:r(),dirty:m,skip_bound:!1,root:s.target||g.$$.root};f&&f(d.root);let b=!1;if(d.ctx=h?h(o,s.props||{},((e,t,...r)=>{const n=r.length?r[0]:t;return d.ctx&&u(d.ctx[e],d.ctx[e]=n)&&(!d.skip_bound&&d.bound[e]&&d.bound[e](n),b&&R(o,e)),t})):[],d.update(),b=!0,n(d.before_update),
|
|
49
49
|
// `false` as a special case of no DOM component
|
|
50
50
|
d.fragment=!!l&&l(d.ctx),s.target){if(s.hydrate){const e=function(e){return Array.from(e.childNodes)}(s.target);
|
|
51
51
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
52
52
|
d.fragment&&d.fragment.l(e),e.forEach(p)}else
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
54
|
-
d.fragment&&d.fragment.c();s.intro&&((
|
|
54
|
+
d.fragment&&d.fragment.c();s.intro&&((E=o.$$.fragment)&&E.i&&(C.delete(E),E.i(y))),function(e,r,o,s){const{fragment:a,after_update:h}=e.$$;a&&a.m(r,o),s||
|
|
55
55
|
// onMount happens before the initial afterUpdate
|
|
56
56
|
L((()=>{const r=e.$$.on_mount.map(t).filter(i);
|
|
57
57
|
// if the component was destroyed immediately
|
|
@@ -60,7 +60,7 @@ L((()=>{const r=e.$$.on_mount.map(t).filter(i);
|
|
|
60
60
|
e.$$.on_destroy?e.$$.on_destroy.push(...r):
|
|
61
61
|
// Edge case - component was destroyed immediately,
|
|
62
62
|
// most likely as a result of a binding initialising
|
|
63
|
-
n(r),e.$$.on_mount=[]})),h.forEach(L)}(o,s.target,s.anchor,s.customElement),w()}var
|
|
63
|
+
n(r),e.$$.on_mount=[]})),h.forEach(L)}(o,s.target,s.anchor,s.customElement),w()}var E,y;T(g)}let G;"function"==typeof HTMLElement&&(G=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:e}=this.$$;this.$$.on_disconnect=e.map(t).filter(i);
|
|
64
64
|
// @ts-ignore todo: improve typings
|
|
65
65
|
for(const e in this.$$.slotted)
|
|
66
66
|
// @ts-ignore todo: improve typings
|
|
@@ -206,7 +206,7 @@ e[e.tag=8]="tag"}(ee||(ee={})),function(e){e[e.number=0]="number",e[e.dateTime=1
|
|
|
206
206
|
* @public
|
|
207
207
|
* @param skeleton skeleton string
|
|
208
208
|
*/
|
|
209
|
-
function
|
|
209
|
+
function be(e){var t={};return e.replace(de,(function(e){var r=e.length;switch(e[0]){
|
|
210
210
|
// Era
|
|
211
211
|
case"G":t.era=4===r?"long":5===r?"narrow":"short";break;
|
|
212
212
|
// Year
|
|
@@ -240,7 +240,7 @@ case"X":// 1, 2, 3, 4: The ISO8601 varios formats
|
|
|
240
240
|
case"x":// 1, 2, 3, 4: The ISO8601 varios formats
|
|
241
241
|
throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return""})),t}
|
|
242
242
|
// @generated from regex-gen.ts
|
|
243
|
-
var
|
|
243
|
+
var Ee=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;var ye=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,ve=/^(@+)?(\+|#+)?[rs]?$/g,Te=/(\*)(0+)|(#+)(0+)|(0+)/g,He=/^(0+)$/;function Pe(e){var t={};return"r"===e[e.length-1]?t.roundingPriority="morePrecision":"s"===e[e.length-1]&&(t.roundingPriority="lessPrecision"),e.replace(ve,(function(e,r,n){
|
|
244
244
|
// @@@ case
|
|
245
245
|
return"string"!=typeof n?(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length):"+"===n?t.minimumSignificantDigits=r.length:"#"===r[0]?t.maximumSignificantDigits=r.length:(t.minimumSignificantDigits=r.length,t.maximumSignificantDigits=r.length+("string"==typeof n?n.length:0)),""})),t}function _e(e){switch(e){case"sign-auto":return{signDisplay:"auto"};case"sign-accounting":case"()":return{currencySign:"accounting"};case"sign-always":case"+!":return{signDisplay:"always"};case"sign-accounting-always":case"()!":return{signDisplay:"always",currencySign:"accounting"};case"sign-except-zero":case"+?":return{signDisplay:"exceptZero"};case"sign-accounting-except-zero":case"()?":return{signDisplay:"exceptZero",currencySign:"accounting"};case"sign-never":case"+_":return{signDisplay:"never"}}}function Be(e){
|
|
246
246
|
// Engineering
|
|
@@ -279,7 +279,7 @@ var Le,Ne={AX:["H"],BQ:["H"],CP:["H"],CZ:["H"],DK:["H"],FI:["H"],ID:["H"],IS:["H
|
|
|
279
279
|
* of the given `locale` to the corresponding time pattern.
|
|
280
280
|
* @param locale
|
|
281
281
|
*/
|
|
282
|
-
function
|
|
282
|
+
function Oe(e){var t=e.hourCycle;if(void 0===t&&
|
|
283
283
|
// @ts-ignore hourCycle(s) is not identified yet
|
|
284
284
|
e.hourCycles&&
|
|
285
285
|
// @ts-ignore
|
|
@@ -287,7 +287,7 @@ e.hourCycles.length&&(
|
|
|
287
287
|
// @ts-ignore
|
|
288
288
|
t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}
|
|
289
289
|
// TODO: Once hourCycle is fully supported remove the following with data generation
|
|
290
|
-
var r,n=e.language;return"root"!==n&&(r=e.maximize().region),(Ne[r||""]||Ne[n||""]||Ne["".concat(n,"-001")]||Ne["001"])[0]}var we=new RegExp("^".concat(ge.source,"*")),
|
|
290
|
+
var r,n=e.language;return"root"!==n&&(r=e.maximize().region),(Ne[r||""]||Ne[n||""]||Ne["".concat(n,"-001")]||Ne["001"])[0]}var we=new RegExp("^".concat(ge.source,"*")),Ie=new RegExp("".concat(ge.source,"*$"));function Ce(e,t){return{start:e,end:t}}
|
|
291
291
|
// #region Ponyfills
|
|
292
292
|
// Consolidate these variables up top for easier toggling during debugging
|
|
293
293
|
var Me=!!String.prototype.startsWith,Re=!!String.fromCodePoint,Ue=!!Object.fromEntries,Ge=!!String.prototype.codePointAt,De=!!String.prototype.trimStart,$e=!!String.prototype.trimEnd,Fe=!!Number.isSafeInteger?Number.isSafeInteger:function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},ke=!0;try{
|
|
@@ -309,7 +309,7 @@ function(e,t){var r=e.length;if(!(t<0||t>=r)){var n,i=e.charCodeAt(t);return i<5
|
|
|
309
309
|
function(e){return e.trimStart()}:// Ponyfill
|
|
310
310
|
function(e){return e.replace(we,"")},Ye=$e?// Native
|
|
311
311
|
function(e){return e.trimEnd()}:// Ponyfill
|
|
312
|
-
function(e){return e.replace(
|
|
312
|
+
function(e){return e.replace(Ie,"")};
|
|
313
313
|
// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.
|
|
314
314
|
function Ze(e,t){return new RegExp(e,t)}
|
|
315
315
|
// #endregion
|
|
@@ -317,7 +317,7 @@ if(ke){
|
|
|
317
317
|
// Native
|
|
318
318
|
var We=Ze("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");xe=function(e,t){var r;return We.lastIndex=t,null!==(r=We.exec(e)[1])&&void 0!==r?r:""}}else
|
|
319
319
|
// IE11
|
|
320
|
-
xe=function(e,t){for(var r=[];;){var n=Ke(e,t);if(void 0===n||
|
|
320
|
+
xe=function(e,t){for(var r=[];;){var n=Ke(e,t);if(void 0===n||qe(n)||et(n))break;r.push(n),t+=n>=65536?2:1}return Ve.apply(void 0,r)};var Qe=/** @class */function(){function e(e,t){void 0===t&&(t={}),this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}return e.prototype.parse=function(){if(0!==this.offset())throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(e,t,r){for(var n=[];!this.isEOF();){var i=this.char();if(123/* `{` */===i){if((o=this.parseArgument(e,r)).err)return o;n.push(o.val)}else{if(125/* `}` */===i&&e>0)break;if(35/* `#` */!==i||"plural"!==t&&"selectordinal"!==t){if(60/* `<` */===i&&!this.ignoreTag&&47===this.peek()){if(r)break;return this.error(q.UNMATCHED_CLOSING_TAG,Ce(this.clonePosition(),this.clonePosition()))}if(60/* `<` */===i&&!this.ignoreTag&&Je(this.peek()||0)){if((o=this.parseTag(e,t)).err)return o;n.push(o.val)}else{var o;if((o=this.parseLiteral(e,t)).err)return o;n.push(o.val)}}else{var s=this.clonePosition();this.bump(),n.push({type:ee.pound,location:Ce(s,this.clonePosition())})}}}return{val:n,err:null}},
|
|
321
321
|
/**
|
|
322
322
|
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
323
323
|
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
@@ -339,14 +339,14 @@ xe=function(e,t){for(var r=[];;){var n=Ke(e,t);if(void 0===n||et(n)||tt(n))break
|
|
|
339
339
|
e.prototype.parseTag=function(e,t){var r=this.clonePosition();this.bump();// `<`
|
|
340
340
|
var n=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))
|
|
341
341
|
// Self closing tag
|
|
342
|
-
return{val:{type:ee.literal,value:"<".concat(n,"/>"),location:
|
|
342
|
+
return{val:{type:ee.literal,value:"<".concat(n,"/>"),location:Ce(r,this.clonePosition())},err:null};if(this.bumpIf(">")){var i=this.parseMessage(e+1,t,!0);if(i.err)return i;var o=i.val,s=this.clonePosition();
|
|
343
343
|
// Expecting a close tag
|
|
344
|
-
if(this.bumpIf("</")){if(this.isEOF()||!Je(this.char()))return this.error(q.INVALID_TAG,
|
|
344
|
+
if(this.bumpIf("</")){if(this.isEOF()||!Je(this.char()))return this.error(q.INVALID_TAG,Ce(s,this.clonePosition()));var a=this.clonePosition();return n!==this.parseTagName()?this.error(q.UNMATCHED_CLOSING_TAG,Ce(a,this.clonePosition())):(this.bumpSpace(),this.bumpIf(">")?{val:{type:ee.tag,value:n,children:o,location:Ce(r,this.clonePosition())},err:null}:this.error(q.INVALID_TAG,Ce(s,this.clonePosition())))}return this.error(q.UNCLOSED_TAG,Ce(r,this.clonePosition()))}return this.error(q.INVALID_TAG,Ce(r,this.clonePosition()))},
|
|
345
345
|
/**
|
|
346
346
|
* This method assumes that the caller has peeked ahead for the first tag character.
|
|
347
347
|
*/
|
|
348
|
-
e.prototype.parseTagName=function(){var e=this.offset();// the first tag name character
|
|
349
|
-
for(this.bump();!this.isEOF()&&
|
|
348
|
+
e.prototype.parseTagName=function(){var e,t=this.offset();// the first tag name character
|
|
349
|
+
for(this.bump();!this.isEOF()&&(45/* '-' */===(e=this.char())||46/* '.' */===e||e>=48&&e<=57/* 0..9 */||95/* '_' */===e||e>=97&&e<=122/** a..z */||e>=65&&e<=90/* A..Z */||183==e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039);)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(e,t){for(var r=this.clonePosition(),n="";;){var i=this.tryParseQuote(t);if(i)n+=i;else{var o=this.tryParseUnquoted(e,t);if(o)n+=o;else{var s=this.tryParseLeftAngleBracket();if(!s)break;n+=s}}}var a=Ce(r,this.clonePosition());return{val:{type:ee.literal,value:n,location:a},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return this.isEOF()||60/* `<` */!==this.char()||!this.ignoreTag&&(Je(e=this.peek()||0)||47===e)?null:(this.bump(),"<");var e;
|
|
350
350
|
/** See `parseTag` function docs. */},
|
|
351
351
|
/**
|
|
352
352
|
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
|
|
@@ -369,66 +369,66 @@ for(this.bump();!this.isEOF();){var r=this.char();if(39/* `'` */===r){if(39/* `'
|
|
|
369
369
|
this.bump();break}t.push(39),
|
|
370
370
|
// Bump one more time because we need to skip 2 characters.
|
|
371
371
|
this.bump()}else t.push(r);this.bump()}return Ve.apply(void 0,t)},e.prototype.tryParseUnquoted=function(e,t){if(this.isEOF())return null;var r=this.char();return 60/* `<` */===r||123/* `{` */===r||35/* `#` */===r&&("plural"===t||"selectordinal"===t)||125/* `}` */===r&&e>0?null:(this.bump(),Ve(r))},e.prototype.parseArgument=function(e,t){var r=this.clonePosition();if(this.bump(),// `{`
|
|
372
|
-
this.bumpSpace(),this.isEOF())return this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,
|
|
372
|
+
this.bumpSpace(),this.isEOF())return this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,Ce(r,this.clonePosition()));if(125/* `}` */===this.char())return this.bump(),this.error(q.EMPTY_ARGUMENT,Ce(r,this.clonePosition()));
|
|
373
373
|
// argument name
|
|
374
|
-
var n=this.parseIdentifierIfPossible().value;if(!n)return this.error(q.MALFORMED_ARGUMENT,
|
|
374
|
+
var n=this.parseIdentifierIfPossible().value;if(!n)return this.error(q.MALFORMED_ARGUMENT,Ce(r,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,Ce(r,this.clonePosition()));switch(this.char()){
|
|
375
375
|
// Simple argument: `{name}`
|
|
376
376
|
case 125/* `}` */:// `}`
|
|
377
377
|
return this.bump(),{val:{type:ee.argument,
|
|
378
378
|
// value does not include the opening and closing braces.
|
|
379
|
-
value:n,location:
|
|
379
|
+
value:n,location:Ce(r,this.clonePosition())},err:null};
|
|
380
380
|
// Argument with options: `{name, format, ...}`
|
|
381
381
|
case 44/* `,` */:return this.bump(),// `,`
|
|
382
|
-
this.bumpSpace(),this.isEOF()?this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,
|
|
382
|
+
this.bumpSpace(),this.isEOF()?this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,Ce(r,this.clonePosition())):this.parseArgumentOptions(e,t,n,r);default:return this.error(q.MALFORMED_ARGUMENT,Ce(r,this.clonePosition()))}},
|
|
383
383
|
/**
|
|
384
384
|
* Advance the parser until the end of the identifier, if it is currently on
|
|
385
385
|
* an identifier character. Return an empty string otherwise.
|
|
386
386
|
*/
|
|
387
|
-
e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=xe(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:
|
|
387
|
+
e.prototype.parseIdentifierIfPossible=function(){var e=this.clonePosition(),t=this.offset(),r=xe(this.message,t),n=t+r.length;return this.bumpTo(n),{value:r,location:Ce(e,this.clonePosition())}},e.prototype.parseArgumentOptions=function(e,t,r,n){var i,o=this.clonePosition(),s=this.parseIdentifierIfPossible().value,a=this.clonePosition();
|
|
388
388
|
// Parse this range:
|
|
389
389
|
// {name, type, style}
|
|
390
390
|
// ^---^
|
|
391
391
|
switch(s){case"":
|
|
392
392
|
// Expecting a style string number, date, time, plural, selectordinal, or select.
|
|
393
|
-
return this.error(q.EXPECT_ARGUMENT_TYPE,
|
|
393
|
+
return this.error(q.EXPECT_ARGUMENT_TYPE,Ce(o,a));case"number":case"date":case"time":
|
|
394
394
|
// Parse this range:
|
|
395
395
|
// {name, number, style}
|
|
396
396
|
// ^-------^
|
|
397
|
-
this.bumpSpace();var h=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((
|
|
397
|
+
this.bumpSpace();var h=null;if(this.bumpIf(",")){this.bumpSpace();var l=this.clonePosition();if((b=this.parseSimpleArgStyleIfPossible()).err)return b;if(0===(f=Ye(b.val)).length)return this.error(q.EXPECT_ARGUMENT_STYLE,Ce(this.clonePosition(),this.clonePosition()));h={style:f,styleLocation:Ce(l,this.clonePosition())}}if((E=this.tryParseArgumentClose(n)).err)return E;var u=Ce(n,this.clonePosition());
|
|
398
398
|
// Extract style or skeleton
|
|
399
399
|
if(h&&je(null==h?void 0:h.style,"::",0)){
|
|
400
400
|
// Skeleton starts with `::`.
|
|
401
|
-
var c=ze(h.style.slice(2));if("number"===s)return(
|
|
401
|
+
var c=ze(h.style.slice(2));if("number"===s)return(b=this.parseNumberSkeletonFromString(c,h.styleLocation)).err?b:{val:{type:ee.number,value:r,location:u,style:b.val},err:null};if(0===c.length)return this.error(q.EXPECT_DATE_TIME_SKELETON,u);var p=c;
|
|
402
402
|
// Get "best match" pattern only if locale is passed, if not, let it
|
|
403
403
|
// pass as-is where `parseDateTimeSkeleton()` will throw an error
|
|
404
404
|
// for unsupported patterns.
|
|
405
|
-
this.locale&&(p=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e.charAt(n);if("j"===i){for(var o=0;n+1<e.length&&e.charAt(n+1)===i;)o++,n++;var s=1+(1&o),a=o<2?1:3+(o>>1),h=
|
|
405
|
+
this.locale&&(p=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e.charAt(n);if("j"===i){for(var o=0;n+1<e.length&&e.charAt(n+1)===i;)o++,n++;var s=1+(1&o),a=o<2?1:3+(o>>1),h=Oe(t);for("H"!=h&&"k"!=h||(a=0);a-- >0;)r+="a";for(;s-- >0;)r=h+r}else r+="J"===i?"H":i}return r}(c,this.locale));var f={type:te.dateTime,pattern:p,location:h.styleLocation,parsedOptions:this.shouldParseSkeletons?be(p):{}};return{val:{type:"date"===s?ee.date:ee.time,value:r,location:u,style:f},err:null}}
|
|
406
406
|
// Regular style or no style.
|
|
407
407
|
return{val:{type:"number"===s?ee.number:"date"===s?ee.date:ee.time,value:r,location:u,style:null!==(i=null==h?void 0:h.style)&&void 0!==i?i:null},err:null};case"plural":case"selectordinal":case"select":
|
|
408
408
|
// Parse this range:
|
|
409
409
|
// {name, plural, options}
|
|
410
410
|
// ^---------^
|
|
411
|
-
var m=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(q.EXPECT_SELECT_ARGUMENT_OPTIONS,
|
|
411
|
+
var m=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(q.EXPECT_SELECT_ARGUMENT_OPTIONS,Ce(m,re({},m)));this.bumpSpace();
|
|
412
412
|
// Parse offset:
|
|
413
413
|
// {name, plural, offset:1, options}
|
|
414
414
|
// ^-----^
|
|
415
415
|
// or the first option:
|
|
416
416
|
// {name, plural, one {...} other {...}}
|
|
417
417
|
// ^--^
|
|
418
|
-
var g=this.parseIdentifierIfPossible(),d=0;if("select"!==s&&"offset"===g.value){if(!this.bumpIf(":"))return this.error(q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,
|
|
418
|
+
var g=this.parseIdentifierIfPossible(),d=0;if("select"!==s&&"offset"===g.value){if(!this.bumpIf(":"))return this.error(q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Ce(this.clonePosition(),this.clonePosition()));var b;if(this.bumpSpace(),(b=this.tryParseDecimalInteger(q.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,q.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE)).err)return b;
|
|
419
419
|
// Parse another identifier for option parsing
|
|
420
|
-
this.bumpSpace(),g=this.parseIdentifierIfPossible(),d=
|
|
420
|
+
this.bumpSpace(),g=this.parseIdentifierIfPossible(),d=b.val}var E,y=this.tryParsePluralOrSelectOptions(e,s,t,g);if(y.err)return y;if((E=this.tryParseArgumentClose(n)).err)return E;var v=Ce(n,this.clonePosition());return"select"===s?{val:{type:ee.select,value:r,options:Xe(y.val),location:v},err:null}:{val:{type:ee.plural,value:r,options:Xe(y.val),offset:d,pluralType:"plural"===s?"cardinal":"ordinal",location:v},err:null};default:return this.error(q.INVALID_ARGUMENT_TYPE,Ce(o,a))}},e.prototype.tryParseArgumentClose=function(e){
|
|
421
421
|
// Parse: {value, number, ::currency/GBP }
|
|
422
|
-
return this.isEOF()||125/* `}` */!==this.char()?this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,
|
|
422
|
+
return this.isEOF()||125/* `}` */!==this.char()?this.error(q.EXPECT_ARGUMENT_CLOSING_BRACE,Ce(e,this.clonePosition())):(this.bump(),{val:!0,err:null})},
|
|
423
423
|
/**
|
|
424
424
|
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
|
|
425
425
|
*/
|
|
426
426
|
e.prototype.parseSimpleArgStyleIfPossible=function(){for(var e=0,t=this.clonePosition();!this.isEOF();){switch(this.char()){case 39/* `'` */:
|
|
427
427
|
// Treat apostrophe as quoting but include it in the style part.
|
|
428
428
|
// Find the end of the quoted literal text.
|
|
429
|
-
this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(q.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,
|
|
429
|
+
this.bump();var r=this.clonePosition();if(!this.bumpUntil("'"))return this.error(q.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Ce(r,this.clonePosition()));this.bump();break;case 123/* `{` */:e+=1,this.bump();break;case 125/* `}` */:if(!(e>0))return{val:this.message.slice(t.offset,this.offset()),err:null};e-=1;break;default:this.bump()}}return{val:this.message.slice(t.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(e,t){var r=[];try{r=function(e){if(0===e.length)throw new Error("Number skeleton cannot be empty");
|
|
430
430
|
// Parse the skeleton
|
|
431
|
-
for(var t=e.split(
|
|
431
|
+
for(var t=[],r=0,n=e.split(Ee).filter((function(e){return e.length>0}));r<n.length;r++){var i=n[r].split("/");if(0===i.length)throw new Error("Invalid number skeleton");for(var o=i[0],s=i.slice(1),a=0,h=s;a<h.length;a++)if(0===h[a].length)throw new Error("Invalid number skeleton");t.push({stem:o,options:s})}return t}(e)}catch(e){return this.error(q.INVALID_NUMBER_SKELETON,t)}return{val:{type:te.number,tokens:r,location:t,parsedOptions:this.shouldParseSkeletons?Se(r):{}},err:null}},
|
|
432
432
|
/**
|
|
433
433
|
* @param nesting_level The current nesting level of messages.
|
|
434
434
|
* This can be positive when parsing message fragment in select or plural argument options.
|
|
@@ -445,17 +445,17 @@ e.prototype.tryParsePluralOrSelectOptions=function(e,t,r,n){
|
|
|
445
445
|
// ^--^
|
|
446
446
|
for(var i,o=!1,s=[],a=new Set,h=n.value,l=n.location;;){if(0===h.length){var u=this.clonePosition();if("select"===t||!this.bumpIf("="))break;
|
|
447
447
|
// Try parse `={number}` selector
|
|
448
|
-
var c=this.tryParseDecimalInteger(q.EXPECT_PLURAL_ARGUMENT_SELECTOR,q.INVALID_PLURAL_ARGUMENT_SELECTOR);if(c.err)return c;l=
|
|
448
|
+
var c=this.tryParseDecimalInteger(q.EXPECT_PLURAL_ARGUMENT_SELECTOR,q.INVALID_PLURAL_ARGUMENT_SELECTOR);if(c.err)return c;l=Ce(u,this.clonePosition()),h=this.message.slice(u.offset,this.offset())}
|
|
449
449
|
// Duplicate selector clauses
|
|
450
450
|
if(a.has(h))return this.error("select"===t?q.DUPLICATE_SELECT_ARGUMENT_SELECTOR:q.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,l);"other"===h&&(o=!0),
|
|
451
451
|
// Parse:
|
|
452
452
|
// one {one apple}
|
|
453
453
|
// ^----------^
|
|
454
|
-
this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?q.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:q.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,
|
|
454
|
+
this.bumpSpace();var p=this.clonePosition();if(!this.bumpIf("{"))return this.error("select"===t?q.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:q.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Ce(this.clonePosition(),this.clonePosition()));var f=this.parseMessage(e+1,t,r);if(f.err)return f;var m=this.tryParseArgumentClose(p);if(m.err)return m;s.push([h,{value:f.val,location:Ce(p,this.clonePosition())}]),
|
|
455
455
|
// Keep track of the existing selectors
|
|
456
456
|
a.add(h),
|
|
457
457
|
// Prep next selector clause.
|
|
458
|
-
this.bumpSpace(),h=(i=this.parseIdentifierIfPossible()).value,l=i.location}return 0===s.length?this.error("select"===t?q.EXPECT_SELECT_ARGUMENT_SELECTOR:q.EXPECT_PLURAL_ARGUMENT_SELECTOR,
|
|
458
|
+
this.bumpSpace(),h=(i=this.parseIdentifierIfPossible()).value,l=i.location}return 0===s.length?this.error("select"===t?q.EXPECT_SELECT_ARGUMENT_SELECTOR:q.EXPECT_PLURAL_ARGUMENT_SELECTOR,Ce(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!o?this.error(q.MISSING_OTHER_CLAUSE,Ce(this.clonePosition(),this.clonePosition())):{val:s,err:null}},e.prototype.tryParseDecimalInteger=function(e,t){var r=1,n=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(r=-1);for(var i=!1,o=0;!this.isEOF();){var s=this.char();if(!(s>=48/* `0` */&&s<=57/* `9` */))break;i=!0,o=10*o+(s-48),this.bump()}var a=Ce(n,this.clonePosition());return i?Fe(o*=r)?{val:o,err:null}:this.error(t,a):this.error(e,a)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){
|
|
459
459
|
// This is much faster than `Object.assign` or spread.
|
|
460
460
|
return{offset:this.position.offset,line:this.position.line,column:this.position.column}},
|
|
461
461
|
/**
|
|
@@ -485,7 +485,7 @@ e.prototype.bumpUntil=function(e){var t=this.offset(),r=this.message.indexOf(e,t
|
|
|
485
485
|
*/
|
|
486
486
|
e.prototype.bumpTo=function(e){if(this.offset()>e)throw Error("targetOffset ".concat(e," must be greater than or equal to the current offset ").concat(this.offset()));for(e=Math.min(e,this.message.length);;){var t=this.offset();if(t===e)break;if(t>e)throw Error("targetOffset ".concat(e," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},
|
|
487
487
|
/** advance the parser through all whitespace to the next non-whitespace code unit. */
|
|
488
|
-
e.prototype.bumpSpace=function(){for(;!this.isEOF()&&
|
|
488
|
+
e.prototype.bumpSpace=function(){for(;!this.isEOF()&&qe(this.char());)this.bump()},
|
|
489
489
|
/**
|
|
490
490
|
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
|
|
491
491
|
* If the input has been exhausted, then this returns null.
|
|
@@ -495,96 +495,94 @@ e.prototype.peek=function(){if(this.isEOF())return null;var e=this.char(),t=this
|
|
|
495
495
|
* This check if codepoint is alphabet (lower & uppercase)
|
|
496
496
|
* @param codepoint
|
|
497
497
|
* @returns
|
|
498
|
-
*/function Je(e){return e>=97&&e<=122||e>=65&&e<=90}
|
|
498
|
+
*/function Je(e){return e>=97&&e<=122||e>=65&&e<=90}
|
|
499
499
|
/**
|
|
500
500
|
* Code point equivalent of regex `\p{White_Space}`.
|
|
501
501
|
* From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
502
|
-
*/
|
|
502
|
+
*/
|
|
503
|
+
function qe(e){return e>=9&&e<=13||32===e||133===e||e>=8206&&e<=8207||8232===e||8233===e}
|
|
503
504
|
/**
|
|
504
505
|
* Code point equivalent of regex `\p{Pattern_Syntax}`.
|
|
505
506
|
* See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
|
|
506
|
-
*/function
|
|
507
|
+
*/function et(e){return e>=33&&e<=35||36===e||e>=37&&e<=39||40===e||41===e||42===e||43===e||44===e||45===e||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||91===e||92===e||93===e||94===e||96===e||123===e||124===e||125===e||126===e||161===e||e>=162&&e<=165||166===e||167===e||169===e||171===e||172===e||174===e||176===e||177===e||182===e||187===e||191===e||215===e||247===e||e>=8208&&e<=8213||e>=8214&&e<=8215||8216===e||8217===e||8218===e||e>=8219&&e<=8220||8221===e||8222===e||8223===e||e>=8224&&e<=8231||e>=8240&&e<=8248||8249===e||8250===e||e>=8251&&e<=8254||e>=8257&&e<=8259||8260===e||8261===e||8262===e||e>=8263&&e<=8273||8274===e||8275===e||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||8608===e||e>=8609&&e<=8610||8611===e||e>=8612&&e<=8613||8614===e||e>=8615&&e<=8621||8622===e||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||8658===e||8659===e||8660===e||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||8968===e||8969===e||8970===e||8971===e||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||9001===e||9002===e||e>=9003&&e<=9083||9084===e||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||9655===e||e>=9656&&e<=9664||9665===e||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||9839===e||e>=9840&&e<=10087||10088===e||10089===e||10090===e||10091===e||10092===e||10093===e||10094===e||10095===e||10096===e||10097===e||10098===e||10099===e||10100===e||10101===e||e>=10132&&e<=10175||e>=10176&&e<=10180||10181===e||10182===e||e>=10183&&e<=10213||10214===e||10215===e||10216===e||10217===e||10218===e||10219===e||10220===e||10221===e||10222===e||10223===e||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||10627===e||10628===e||10629===e||10630===e||10631===e||10632===e||10633===e||10634===e||10635===e||10636===e||10637===e||10638===e||10639===e||10640===e||10641===e||10642===e||10643===e||10644===e||10645===e||10646===e||10647===e||10648===e||e>=10649&&e<=10711||10712===e||10713===e||10714===e||10715===e||e>=10716&&e<=10747||10748===e||10749===e||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||11158===e||e>=11159&&e<=11263||e>=11776&&e<=11777||11778===e||11779===e||11780===e||11781===e||e>=11782&&e<=11784||11785===e||11786===e||11787===e||11788===e||11789===e||e>=11790&&e<=11798||11799===e||e>=11800&&e<=11801||11802===e||11803===e||11804===e||11805===e||e>=11806&&e<=11807||11808===e||11809===e||11810===e||11811===e||11812===e||11813===e||11814===e||11815===e||11816===e||11817===e||e>=11818&&e<=11822||11823===e||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||11840===e||11841===e||11842===e||e>=11843&&e<=11855||e>=11856&&e<=11857||11858===e||e>=11859&&e<=11903||e>=12289&&e<=12291||12296===e||12297===e||12298===e||12299===e||12300===e||12301===e||12302===e||12303===e||12304===e||12305===e||e>=12306&&e<=12307||12308===e||12309===e||12310===e||12311===e||12312===e||12313===e||12314===e||12315===e||12316===e||12317===e||e>=12318&&e<=12319||12320===e||12336===e||64830===e||64831===e||e>=65093&&e<=65094}function tt(e){e.forEach((function(e){if(delete e.location,le(e)||ue(e))for(var t in e.options)delete e.options[t].location,tt(e.options[t].value);else se(e)&&fe(e.style)||(ae(e)||he(e))&&me(e.style)?delete e.style.location:pe(e)&&tt(e.children)}))}function rt(e,t){void 0===t&&(t={}),t=re({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var r=new Qe(e,t).parse();if(r.err){var n=SyntaxError(q[r.err.kind]);
|
|
507
508
|
// @ts-expect-error Assign to error object
|
|
508
509
|
throw n.location=r.err.location,
|
|
509
510
|
// @ts-expect-error Assign to error object
|
|
510
|
-
n.originalMessage=r.err.message,n}return(null==t?void 0:t.captureLocation)||
|
|
511
|
+
n.originalMessage=r.err.message,n}return(null==t?void 0:t.captureLocation)||tt(r.val),r.val}
|
|
511
512
|
|
|
512
513
|
// Main
|
|
513
514
|
|
|
514
|
-
function
|
|
515
|
+
function nt(e,t){var r=t&&t.cache?t.cache:ct,n=t&&t.serializer?t.serializer:ht;return(t&&t.strategy?t.strategy:at)(e,{cache:r,serializer:n})}
|
|
515
516
|
|
|
516
517
|
// Strategy
|
|
517
518
|
|
|
518
|
-
function
|
|
519
|
+
function it(e,t,r,n){var i,o=null==(i=n)||"number"==typeof i||"boolean"==typeof i?n:r(n),s=t.get(o);return void 0===s&&(s=e.call(this,n),t.set(o,s)),s}function ot(e,t,r){var n=Array.prototype.slice.call(arguments,3),i=r(n),o=t.get(i);return void 0===o&&(o=e.apply(this,n),t.set(i,o)),o}function st(e,t,r,n,i){return r.bind(t,e,n,i)}function at(e,t){return st(e,this,1===e.length?it:ot,t.cache.create(),t.serializer)}
|
|
519
520
|
// Serializer
|
|
520
|
-
var
|
|
521
|
+
var ht=function(){return JSON.stringify(arguments)};
|
|
521
522
|
|
|
522
523
|
// Cache
|
|
523
524
|
|
|
524
|
-
function
|
|
525
|
+
function lt(){this.cache=Object.create(null)}lt.prototype.get=function(e){return this.cache[e]},lt.prototype.set=function(e,t){this.cache[e]=t};var ut,ct={create:function(){
|
|
525
526
|
// @ts-ignore
|
|
526
|
-
return new
|
|
527
|
+
return new lt}},pt={variadic:function(e,t){return st(e,this,ot,t.cache.create(),t.serializer)},monadic:function(e,t){return st(e,this,it,t.cache.create(),t.serializer)}};!function(e){
|
|
527
528
|
// When we have a placeholder but no value to format
|
|
528
529
|
e.MISSING_VALUE="MISSING_VALUE",
|
|
529
530
|
// When value supplied is invalid
|
|
530
531
|
e.INVALID_VALUE="INVALID_VALUE",
|
|
531
532
|
// When we need specific Intl API but it's not available
|
|
532
|
-
e.MISSING_INTL_API="MISSING_INTL_API"}(
|
|
533
|
+
e.MISSING_INTL_API="MISSING_INTL_API"}(ut||(ut={}));var ft,mt=/** @class */function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.code=r,i.originalMessage=n,i}return J(t,e),t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),gt=/** @class */function(e){function t(t,r,n,i){return e.call(this,'Invalid values for "'.concat(t,'": "').concat(r,'". Options are "').concat(Object.keys(n).join('", "'),'"'),ut.INVALID_VALUE,i)||this}return J(t,e),t}(mt),dt=/** @class */function(e){function t(t,r,n){return e.call(this,'Value for "'.concat(t,'" must be of type ').concat(r),ut.INVALID_VALUE,n)||this}return J(t,e),t}(mt),bt=/** @class */function(e){function t(t,r){return e.call(this,'The intl string context variable "'.concat(t,'" was not provided to the string "').concat(r,'"'),ut.MISSING_VALUE,r)||this}return J(t,e),t}(mt);function Et(e){return"function"==typeof e}
|
|
533
534
|
// TODO(skeleton): add skeleton support
|
|
534
|
-
function
|
|
535
|
+
function yt(e,t,r,n,i,o,
|
|
535
536
|
// For debugging
|
|
536
537
|
s){
|
|
537
538
|
// Hot path for straight simple msg translations
|
|
538
|
-
if(1===e.length&&ie(e[0]))return[{type:
|
|
539
|
+
if(1===e.length&&ie(e[0]))return[{type:ft.literal,value:e[0].value}];for(var a=[],h=0,l=e;h<l.length;h++){var u=l[h];
|
|
539
540
|
// Exit early for string parts.
|
|
540
|
-
if(ie(u))a.push({type:
|
|
541
|
+
if(ie(u))a.push({type:ft.literal,value:u.value});else
|
|
541
542
|
// TODO: should this part be literal type?
|
|
542
543
|
// Replace `#` in plural rules with the actual numeric value.
|
|
543
|
-
if(ce(u))"number"==typeof o&&a.push({type:
|
|
544
|
+
if(ce(u))"number"==typeof o&&a.push({type:ft.literal,value:r.getNumberFormat(t).format(o)});else{var c=u.value;
|
|
544
545
|
// Enforce that all required values are provided by the caller.
|
|
545
|
-
if(!i||!(c in i))throw new bt(c,s);var p=i[c];if(oe(u))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?
|
|
546
|
+
if(!i||!(c in i))throw new bt(c,s);var p=i[c];if(oe(u))p&&"string"!=typeof p&&"number"!=typeof p||(p="string"==typeof p||"number"==typeof p?String(p):""),a.push({type:"string"==typeof p?ft.literal:ft.object,value:p});else
|
|
546
547
|
// Recursively format plural and select parts' option — which can be a
|
|
547
548
|
// nested pattern structure. The choosing of the option to use is
|
|
548
549
|
// abstracted-by and delegated-to the part helper object.
|
|
549
|
-
if(ae(u)){var f="string"==typeof u.style?n.date[u.style]:me(u.style)?u.style.parsedOptions:void 0;a.push({type:
|
|
550
|
+
if(ae(u)){var f="string"==typeof u.style?n.date[u.style]:me(u.style)?u.style.parsedOptions:void 0;a.push({type:ft.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(he(u)){f="string"==typeof u.style?n.time[u.style]:me(u.style)?u.style.parsedOptions:n.time.medium;a.push({type:ft.literal,value:r.getDateTimeFormat(t,f).format(p)})}else if(se(u)){(f="string"==typeof u.style?n.number[u.style]:fe(u.style)?u.style.parsedOptions:void 0)&&f.scale&&(p*=f.scale||1),a.push({type:ft.literal,value:r.getNumberFormat(t,f).format(p)})}else{if(pe(u)){var m=u.children,g=u.value,d=i[g];if(!Et(d))throw new dt(g,"function",s);var b=d(yt(m,t,r,n,i,o).map((function(e){return e.value})));Array.isArray(b)||(b=[b]),a.push.apply(a,b.map((function(e){return{type:"string"==typeof e?ft.literal:ft.object,value:e}})))}if(le(u)){if(!(E=u.options[p]||u.options.other))throw new gt(u.value,p,Object.keys(u.options),s);a.push.apply(a,yt(E.value,t,r,n,i))}else if(ue(u)){var E;if(!(E=u.options["=".concat(p)])){if(!Intl.PluralRules)throw new mt('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n',ut.MISSING_INTL_API,s);var y=r.getPluralRules(t,{type:u.pluralType}).select(p-(u.offset||0));E=u.options[y]||u.options.other}if(!E)throw new gt(u.value,p,Object.keys(u.options),s);a.push.apply(a,yt(E.value,t,r,n,i,p-(u.offset||0)))}else;}}}return function(e){return e.length<2?e:e.reduce((function(e,t){var r=e[e.length-1];return r&&r.type===ft.literal&&t.type===ft.literal?r.value+=t.value:e.push(t),e}),[])}(a)}
|
|
550
551
|
/*
|
|
551
552
|
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
552
553
|
Copyrights licensed under the New BSD License.
|
|
553
554
|
See the accompanying LICENSE file for terms.
|
|
554
555
|
*/
|
|
555
556
|
// -- MessageFormat --------------------------------------------------------
|
|
556
|
-
function
|
|
557
|
+
function vt(e,t){return t?Object.keys(e).reduce((function(r,n){var i,o;return r[n]=(i=e[n],(o=t[n])?re(re(re({},i||{}),o||{}),Object.keys(i).reduce((function(e,t){return e[t]=re(re({},i[t]),o[t]||{}),e}),{})):i),r}),re({},e)):e}function Tt(e){return{create:function(){return{get:function(t){return e[t]},set:function(t,r){e[t]=r}}}}}!function(e){e[e.literal=0]="literal",e[e.object=1]="object"}(ft||(ft={}));var Ht=/** @class */function(){function e(t,r,n,i){var o,s=this;if(void 0===r&&(r=e.defaultLocale),this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=function(e){var t=s.formatToParts(e);
|
|
557
558
|
// Hot path for straight simple msg translations
|
|
558
|
-
if(1===t.length)return t[0].value;var r=t.reduce((function(e,t){return e.length&&t.type===
|
|
559
|
+
if(1===t.length)return t[0].value;var r=t.reduce((function(e,t){return e.length&&t.type===ft.literal&&"string"==typeof e[e.length-1]?e[e.length-1]+=t.value:e.push(t.value),e}),[]);return r.length<=1?r[0]||"":r},this.formatToParts=function(e){return yt(s.ast,s.locales,s.formatters,s.formats,e,void 0,s.message)},this.resolvedOptions=function(){return{locale:s.resolvedLocale.toString()}},this.getAst=function(){return s.ast},
|
|
559
560
|
// Defined first because it's used to build the format pattern.
|
|
560
561
|
this.locales=r,this.resolvedLocale=e.resolveLocale(r),"string"==typeof t){if(this.message=t,!e.__parse)throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
|
|
561
562
|
// Parse string messages into an AST.
|
|
562
563
|
this.ast=e.__parse(t,{ignoreTag:null==i?void 0:i.ignoreTag,locale:this.resolvedLocale})}else this.ast=t;if(!Array.isArray(this.ast))throw new TypeError("A message must be provided as a String or AST.");
|
|
563
564
|
// Creates a new object with the specified `formats` merged with the default
|
|
564
565
|
// formats.
|
|
565
|
-
this.formats=
|
|
566
|
+
this.formats=vt(e.formats,n),this.formatters=i&&i.formatters||(void 0===(o=this.formatterCache)&&(o={number:{},dateTime:{},pluralRules:{}}),{getNumberFormat:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.NumberFormat).bind.apply(e,ne([void 0],t,!1)))}),{cache:Tt(o.number),strategy:pt.variadic}),getDateTimeFormat:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.DateTimeFormat).bind.apply(e,ne([void 0],t,!1)))}),{cache:Tt(o.dateTime),strategy:pt.variadic}),getPluralRules:nt((function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new((e=Intl.PluralRules).bind.apply(e,ne([void 0],t,!1)))}),{cache:Tt(o.pluralRules),strategy:pt.variadic})})}return Object.defineProperty(e,"defaultLocale",{get:function(){return e.memoizedDefaultLocale||(e.memoizedDefaultLocale=(new Intl.NumberFormat).resolvedOptions().locale),e.memoizedDefaultLocale},enumerable:!1,configurable:!0}),e.memoizedDefaultLocale=null,e.resolveLocale=function(e){var t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale("string"==typeof e?e:e[0])},e.__parse=rt,
|
|
566
567
|
// Default format options used as the prototype of the `formats` provided to the
|
|
567
568
|
// constructor. These are used when constructing the internal Intl.NumberFormat
|
|
568
569
|
// and Intl.DateTimeFormat instances.
|
|
569
|
-
e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),_t=Pt;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
Copyrights licensed under the New BSD License.
|
|
573
|
-
See the accompanying LICENSE file for terms.
|
|
574
|
-
*/const Bt={},At=(e,t,r)=>r?(t in Bt||(Bt[t]={}),e in Bt[t]||(Bt[t][e]=r),r):r,St=(e,t)=>{if(null==t)return;if(t in Bt&&e in Bt[t])return Bt[t][e];const r=Vt(t);for(let n=0;n<r.length;n++){const i=wt(r[n],e);if(i)return At(e,t,i)}};let Lt;const Nt=F({});function It(e){return e in Lt}function wt(e,t){if(!It(e))return null;const r=function(e){return Lt[e]||null}(e);return function(e,t){if(null==t)return;if(t in e)return e[t];const r=t.split(".");let n=e;for(let e=0;e<r.length;e++)if("object"==typeof n){if(e>0){const t=r.slice(e,r.length).join(".");if(t in n){n=n[t];break}}n=n[r[e]]}else n=void 0;return n}(r,t)}function Ct(e,...t){delete Bt[e],Nt.update((r=>(r[e]=W.all([r[e]||{},...t]),r)))}k([Nt],(([e])=>Object.keys(e))),Nt.subscribe((e=>Lt=e));const Ot={};function Mt(e){return Ot[e]}function Rt(e){return null!=e&&Vt(e).some((e=>{var t;return null===(t=Mt(e))||void 0===t?void 0:t.size}))}const Ut={};function Gt(e){if(!Rt(e))return e in Ut?Ut[e]:Promise.resolve();const t=function(e){return Vt(e).map((e=>{const t=Mt(e);return[e,t?[...t]:[]]})).filter((([,e])=>e.length>0))}(e);return Ut[e]=Promise.all(t.map((([e,t])=>function(e,t){const r=Promise.all(t.map((t=>(function(e,t){Ot[e].delete(t),0===Ot[e].size&&delete Ot[e]}(e,t),t().then((e=>e.default||e))))));return r.then((t=>Ct(e,...t)))}(e,t)))).then((()=>{if(Rt(e))return Gt(e);delete Ut[e]})),Ut[e]}const Dt={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function $t(){return Dt}const Ft=F(!1);let kt;const xt=F(null);function jt(e){return e.split("-").map(((e,t,r)=>r.slice(0,t+1).join("-"))).reverse()}function Vt(e,t=$t().fallbackLocale){const r=jt(e);return t?[...new Set([...r,...jt(t)])]:r}function Xt(){return null!=kt?kt:void 0}xt.subscribe((e=>{kt=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const Kt={...xt,set:e=>{if(e&&function(e){if(null==e)return;const t=Vt(e);for(let e=0;e<t.length;e++){const r=t[e];if(It(r))return r}}(e)&&Rt(e)){const{loadingDelay:t}=$t();let r;return"undefined"!=typeof window&&null!=Xt()&&t?r=window.setTimeout((()=>Ft.set(!0)),t):Ft.set(!0),Gt(e).then((()=>{xt.set(e)})).finally((()=>{clearTimeout(r),Ft.set(!1)}))}return xt.set(e)}},zt=e=>{const t=Object.create(null);return r=>{const n=JSON.stringify(r);return n in t?t[n]:t[n]=e(r)}},Yt=(e,t)=>{const{formats:r}=$t();if(e in r&&t in r[e])return r[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},Zt=zt((({locale:e,format:t,...r})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return t&&(r=Yt("number",t)),new Intl.NumberFormat(e,r)})),Wt=zt((({locale:e,format:t,...r})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return t?r=Yt("date",t):0===Object.keys(r).length&&(r=Yt("date","short")),new Intl.DateTimeFormat(e,r)})),Qt=zt((({locale:e,format:t,...r})=>{if(null==e)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return t?r=Yt("time",t):0===Object.keys(r).length&&(r=Yt("time","short")),new Intl.DateTimeFormat(e,r)})),Jt=zt(((e,t=Xt())=>new _t(e,t,$t().formats,{ignoreTag:$t().ignoreTag}))),qt=(e,t={})=>{var r,n,i,o;let s=t;"object"==typeof e&&(s=e,e=s.id);const{values:a,locale:h=Xt(),default:l}=s;if(null==h)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let u=St(e,h);if(u){if("string"!=typeof u)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof u}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),u}else u=null!==(o=null!==(i=null===(n=(r=$t()).handleMissingMessage)||void 0===n?void 0:n.call(r,{locale:h,id:e,defaultValue:l}))&&void 0!==i?i:l)&&void 0!==o?o:e;if(!a)return u;let c=u;try{c=Jt(u,h).format(a)}catch(t){t instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return c},er=(e,t)=>(({locale:e=Xt(),...t}={})=>Qt({locale:e,...t}))(t).format(e),tr=(e,t)=>(({locale:e=Xt(),...t}={})=>Wt({locale:e,...t}))(t).format(e),rr=(e,t)=>(({locale:e=Xt(),...t}={})=>Zt({locale:e,...t}))(t).format(e),nr=(e,t=Xt())=>St(e,t),ir=k([Kt,Nt],(()=>qt));function or(e,t){Ct(e,t)}
|
|
570
|
+
e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}();const Pt={},_t=(e,t,r)=>r?(t in Pt||(Pt[t]={}),e in Pt[t]||(Pt[t][e]=r),r):r,Bt=(e,t)=>{if(null==t)return;if(t in Pt&&e in Pt[t])return Pt[t][e];const r=Wt(t);for(let n=0;n<r.length;n++){const i=Nt(r[n],e);if(i)return _t(e,t,i)}};let At;const St=F({});function Lt(e){return e in At}function Nt(e,t){if(!Lt(e))return null;const r=function(e){return At[e]||null}(e);return function(e,t){if(null==t)return;if(t in e)return e[t];const r=t.split(".");let n=e;for(let e=0;e<r.length;e++)if("object"==typeof n){if(e>0){const t=r.slice(e,r.length).join(".");if(t in n){n=n[t];break}}n=n[r[e]]}else n=void 0;return n}(r,t)}function Ot(e,...t){delete Pt[e],St.update((r=>(r[e]=W.all([r[e]||{},...t]),r)))}k([St],(([e])=>Object.keys(e))),St.subscribe((e=>At=e));const wt={};function It(e){return wt[e]}function Ct(e){return null!=e&&Wt(e).some((e=>{var t;return null==(t=It(e))?void 0:t.size}))}function Mt(e,t){const r=Promise.all(t.map((t=>(function(e,t){wt[e].delete(t),0===wt[e].size&&delete wt[e]}(e,t),t().then((e=>e.default||e))))));return r.then((t=>Ot(e,...t)))}const Rt={};function Ut(e){if(!Ct(e))return e in Rt?Rt[e]:Promise.resolve();const t=function(e){return Wt(e).map((e=>{const t=It(e);return[e,t?[...t]:[]]})).filter((([,e])=>e.length>0))}(e);return Rt[e]=Promise.all(t.map((([e,t])=>Mt(e,t)))).then((()=>{if(Ct(e))return Ut(e);delete Rt[e]})),Rt[e]}const Gt={fallbackLocale:null,loadingDelay:200,formats:{number:{scientific:{notation:"scientific"},engineering:{notation:"engineering"},compactLong:{notation:"compact",compactDisplay:"long"},compactShort:{notation:"compact",compactDisplay:"short"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},warnOnMissingMessages:!0,handleMissingMessage:void 0,ignoreTag:!0};function Dt(){return Gt}const $t=F(!1);var Ft=Object.defineProperty,kt=Object.defineProperties,xt=Object.getOwnPropertyDescriptors,jt=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,Kt=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;let zt;const Yt=F(null);function Zt(e){return e.split("-").map(((e,t,r)=>r.slice(0,t+1).join("-"))).reverse()}function Wt(e,t=Dt().fallbackLocale){const r=Zt(e);return t?[...new Set([...r,...Zt(t)])]:r}function Qt(){return null!=zt?zt:void 0}Yt.subscribe((e=>{zt=null!=e?e:void 0,"undefined"!=typeof window&&null!=e&&document.documentElement.setAttribute("lang",e)}));const Jt=(qt=((e,t)=>{for(var r in t||(t={}))Vt.call(t,r)&&Kt(e,r,t[r]);if(jt)for(var r of jt(t))Xt.call(t,r)&&Kt(e,r,t[r]);return e})({},Yt),kt(qt,xt({set:e=>{if(e&&function(e){if(null==e)return;const t=Wt(e);for(let e=0;e<t.length;e++){const r=t[e];if(Lt(r))return r}}(e)&&Ct(e)){const{loadingDelay:t}=Dt();let r;return"undefined"!=typeof window&&null!=Qt()&&t?r=window.setTimeout((()=>$t.set(!0)),t):$t.set(!0),Ut(e).then((()=>{Yt.set(e)})).finally((()=>{clearTimeout(r),$t.set(!1)}))}return Yt.set(e)}})));var qt;const er=e=>{const t=Object.create(null);return r=>{const n=JSON.stringify(r);return n in t?t[n]:t[n]=e(r)}};var tr=Object.defineProperty,rr=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,or=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sr=(e,t)=>{for(var r in t||(t={}))nr.call(t,r)&&or(e,r,t[r]);if(rr)for(var r of rr(t))ir.call(t,r)&&or(e,r,t[r]);return e},ar=(e,t)=>{var r={};for(var n in e)nr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&rr)for(var n of rr(e))t.indexOf(n)<0&&ir.call(e,n)&&(r[n]=e[n]);return r};const hr=(e,t)=>{const{formats:r}=Dt();if(e in r&&t in r[e])return r[e][t];throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`)},lr=er((e=>{var t=e,{locale:r,format:n}=t,i=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format numbers');return n&&(i=hr("number",n)),new Intl.NumberFormat(r,i)})),ur=er((e=>{var t=e,{locale:r,format:n}=t,i=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format dates');return n?i=hr("date",n):0===Object.keys(i).length&&(i=hr("date","short")),new Intl.DateTimeFormat(r,i)})),cr=er((e=>{var t=e,{locale:r,format:n}=t,i=ar(t,["locale","format"]);if(null==r)throw new Error('[svelte-i18n] A "locale" must be set to format time values');return n?i=hr("time",n):0===Object.keys(i).length&&(i=hr("time","short")),new Intl.DateTimeFormat(r,i)})),pr=er((
|
|
571
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
572
|
+
(e,t=Qt())=>new Ht(e,t,Dt().formats,{ignoreTag:Dt().ignoreTag}))),fr=(e,t={})=>{var r,n,i,o;let s=t;"object"==typeof e&&(s=e,e=s.id);const{values:a,locale:h=Qt(),default:l}=s;if(null==h)throw new Error("[svelte-i18n] Cannot format a message without first setting the initial locale.");let u=Bt(e,h);if(u){if("string"!=typeof u)return console.warn(`[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof u}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`),u}else u=null!=(o=null!=(i=null==(n=(r=Dt()).handleMissingMessage)?void 0:n.call(r,{locale:h,id:e,defaultValue:l}))?i:l)?o:e;if(!a)return u;let c=u;try{c=pr(u,h).format(a)}catch(t){t instanceof Error&&console.warn(`[svelte-i18n] Message "${e}" has syntax error:`,t.message)}return c},mr=(e,t)=>((e={})=>{var t=e,{locale:r=Qt()}=t,n=ar(t,["locale"]);return cr(sr({locale:r},n))})(t).format(e),gr=(e,t)=>((e={})=>{var t=e,{locale:r=Qt()}=t,n=ar(t,["locale"]);return ur(sr({locale:r},n))})(t).format(e),dr=(e,t)=>((e={})=>{var t=e,{locale:r=Qt()}=t,n=ar(t,["locale"]);return lr(sr({locale:r},n))})(t).format(e),br=(e,t=Qt())=>Bt(e,t),Er=k([Jt,St],(()=>fr));function yr(e,t){Ot(e,t)}
|
|
575
573
|
/* src/CasinoProviders.svelte generated by Svelte v3.59.2 */
|
|
576
|
-
function
|
|
574
|
+
function vr(e,t,r){const n=e.slice();return n[21]=t[r],n}function Tr(e,t,r){const n=e.slice();return n[21]=t[r],n}
|
|
577
575
|
// (78:4) {:else}
|
|
578
|
-
function
|
|
576
|
+
function Hr(e){let t,r,n,i,o,s,a,h,l=/*$_*/e[4]("popularProviders")+"",b=/*$_*/e[4]("otherProviders")+"",v=/*topProviders*/e[1],T=[];for(let t=0;t<v.length;t+=1)T[t]=_r(Tr(e,v,t));let H=/*otherProviders*/e[2],P=[];for(let t=0;t<H.length;t+=1)P[t]=Br(vr(e,H,t));return{c(){t=m("h4"),r=g(l),n=d();for(let e=0;e<T.length;e+=1)T[e].c();i=d(),o=m("h4"),s=g(b),a=d();for(let e=0;e<P.length;e+=1)P[e].c();h=g(""),E(t,"class","ProviderTitle"),E(o,"class","ProviderTitle")},m(e,l){c(e,t,l),u(t,r),c(e,n,l);for(let t=0;t<T.length;t+=1)T[t]&&T[t].m(e,l);c(e,i,l),c(e,o,l),u(o,s),c(e,a,l);for(let t=0;t<P.length;t+=1)P[t]&&P[t].m(e,l);c(e,h,l)},p(e,t){if(/*$_*/16&t&&l!==(l=/*$_*/e[4]("popularProviders")+"")&&y(r,l),/*openGameProviderPage, topProviders, $_*/50&t){let r;for(v=/*topProviders*/e[1],r=0;r<v.length;r+=1){const n=Tr(e,v,r);T[r]?T[r].p(n,t):(T[r]=_r(n),T[r].c(),T[r].m(i.parentNode,i))}for(;r<T.length;r+=1)T[r].d(1);T.length=v.length}if(/*$_*/16&t&&b!==(b=/*$_*/e[4]("otherProviders")+"")&&y(s,b),/*openGameProviderPage, otherProviders, $_*/52&t){let r;for(H=/*otherProviders*/e[2],r=0;r<H.length;r+=1){const n=vr(e,H,r);P[r]?P[r].p(n,t):(P[r]=Br(n),P[r].c(),P[r].m(h.parentNode,h))}for(;r<P.length;r+=1)P[r].d(1);P.length=H.length}},d(e){e&&p(t),e&&p(n),f(T,e),e&&p(i),e&&p(o),e&&p(a),f(P,e),e&&p(h)}}}
|
|
579
577
|
// (76:4) {#if isLoading === true}
|
|
580
|
-
function
|
|
578
|
+
function Pr(e){let t,r,n=/*$_*/e[4]("loading")+"";return{c(){t=m("p"),r=g(n),E(t,"class","Message")},m(e,n){c(e,t,n),u(t,r)},p(e,t){/*$_*/16&t&&n!==(n=/*$_*/e[4]("loading")+"")&&y(r,n)},d(e){e&&p(t)}}}
|
|
581
579
|
// (80:6) {#each topProviders as provider}
|
|
582
|
-
function
|
|
583
|
-
return e[12](/*provider*/e[21])}return{c(){t=m("div"),r=m("img"),o=d(),s=m("div"),a=m("p"),l=g(A),f=d(),v=m("p"),T=g(S),H=d(),P=g(L),h(r.src,n=/*provider*/e[21].logo)||
|
|
580
|
+
function _r(e){let t,r,n,i,o,s,a,l,f,v,T,H,P,_,B,A=/*provider*/e[21].name+"",S=/*provider*/e[21].games.count+"",L=/*$_*/e[4]("games")+"";function N(){/*click_handler*/
|
|
581
|
+
return e[12](/*provider*/e[21])}return{c(){t=m("div"),r=m("img"),o=d(),s=m("div"),a=m("p"),l=g(A),f=d(),v=m("p"),T=g(S),H=d(),P=g(L),h(r.src,n=/*provider*/e[21].logo)||E(r,"src",n),E(r,"alt",i=/*provider*/e[21].name),E(r,"class","ProviderImage"),E(s,"class","ProviderTextContainer"),E(t,"class","Provider")},m(e,n){c(e,t,n),u(t,r),u(t,o),u(t,s),u(s,a),u(a,l),u(s,f),u(s,v),u(v,T),u(v,H),u(v,P),_||(B=b(t,"click",N),_=!0)},p(t,o){e=t,/*topProviders*/2&o&&!h(r.src,n=/*provider*/e[21].logo)&&E(r,"src",n),/*topProviders*/2&o&&i!==(i=/*provider*/e[21].name)&&E(r,"alt",i),/*topProviders*/2&o&&A!==(A=/*provider*/e[21].name+"")&&y(l,A),/*topProviders*/2&o&&S!==(S=/*provider*/e[21].games.count+"")&&y(T,S),/*$_*/16&o&&L!==(L=/*$_*/e[4]("games")+"")&&y(P,L)},d(e){e&&p(t),_=!1,B()}}}
|
|
584
582
|
// (90:6) {#each otherProviders as provider}
|
|
585
|
-
function
|
|
586
|
-
return e[13](/*provider*/e[21])}return{c(){t=m("div"),r=m("img"),o=d(),s=m("div"),a=m("p"),l=g(S),f=d(),v=m("p"),T=g(L),H=d(),P=g(N),_=d(),h(r.src,n=/*provider*/e[21].logo)||
|
|
587
|
-
return!0===e[3]?
|
|
583
|
+
function Br(e){let t,r,n,i,o,s,a,l,f,v,T,H,P,_,B,A,S=/*provider*/e[21].name+"",L=/*provider*/e[21].games.count+"",N=/*$_*/e[4]("games")+"";function O(){/*click_handler_1*/
|
|
584
|
+
return e[13](/*provider*/e[21])}return{c(){t=m("div"),r=m("img"),o=d(),s=m("div"),a=m("p"),l=g(S),f=d(),v=m("p"),T=g(L),H=d(),P=g(N),_=d(),h(r.src,n=/*provider*/e[21].logo)||E(r,"src",n),E(r,"alt",i=/*provider*/e[21].name),E(r,"class","ProviderImage"),E(s,"class","ProviderTextContainer"),E(t,"class","Provider")},m(e,n){c(e,t,n),u(t,r),u(t,o),u(t,s),u(s,a),u(a,l),u(s,f),u(s,v),u(v,T),u(v,H),u(v,P),u(t,_),B||(A=b(t,"click",O),B=!0)},p(t,o){e=t,/*otherProviders*/4&o&&!h(r.src,n=/*provider*/e[21].logo)&&E(r,"src",n),/*otherProviders*/4&o&&i!==(i=/*provider*/e[21].name)&&E(r,"alt",i),/*otherProviders*/4&o&&S!==(S=/*provider*/e[21].name+"")&&y(l,S),/*otherProviders*/4&o&&L!==(L=/*provider*/e[21].games.count+"")&&y(T,L),/*$_*/16&o&&N!==(N=/*$_*/e[4]("games")+"")&&y(P,N)},d(e){e&&p(t),B=!1,A()}}}function Ar(t){let r;function n(e,t){/*isLoading*/
|
|
585
|
+
return!0===e[3]?Pr:Hr}let i=n(t),o=i(t);return{c(){r=m("div"),o.c(),this.c=e,E(r,"class","CasinoProviders")},m(e,n){c(e,r,n),o.m(r,null),
|
|
588
586
|
/*div_binding*/t[14](r)},p(e,[t]){i===(i=n(e))&&o?o.p(e,t):(o.d(1),o=i(e),o&&(o.c(),o.m(r,null)))},i:e,o:e,d(e){e&&p(r),o.d(),
|
|
589
|
-
/*div_binding*/t[14](null)}}}function
|
|
587
|
+
/*div_binding*/t[14](null)}}}function Sr(e,t,r){let n;var i,o;i=Er,o=e=>r(4,n=e),e.$$.on_destroy.push(l(i,o));let s,{endpoint:a=""}=t,{datasource:h=""}=t,{lang:u="en"}=t,{clientstyling:c=""}=t,{clientstylingurl:p=""}=t,{translationurl:f=""}=t,m=[],g=[],d=[],b=!1;Object.keys(D).forEach((e=>{yr(e,D[e])}));const E=(e,t,r)=>{window.postMessage({type:"OpenGameProvider",providerId:e,providerName:t,providerLogo:r},window.location.href)},y=()=>{var e;e=u,Jt.set(e)};return e.$$set=e=>{"endpoint"in e&&r(6,a=e.endpoint),"datasource"in e&&r(7,h=e.datasource),"lang"in e&&r(8,u=e.lang),"clientstyling"in e&&r(9,c=e.clientstyling),"clientstylingurl"in e&&r(10,p=e.clientstylingurl),"translationurl"in e&&r(11,f=e.translationurl)},e.$$.update=()=>{/*endpoint, lang, datasource*/448&e.$$.dirty&&a&&u&&h&&(()=>{r(3,b=!0);const e=new URL(`${a}/casino/vendors`);e.searchParams.append("datasource",h),e.searchParams.append("language",u),e.searchParams.append("fields","id,name,displayName,subVendors,isTopVendor,logo,games"),fetch(e).then((e=>e.json())).then((e=>{r(3,b=!1),m=e.items.map((e=>e)),r(1,g=m.filter((e=>!0===e.isTopVendor))),r(2,d=m.filter((e=>!1===e.isTopVendor)));let t=[];t=m.flatMap((e=>e.subVendors)),d.push(...t.filter((e=>e.games.count>0)))}))})(),/*lang*/256&e.$$.dirty&&u&&y(),/*translationurl*/2048&e.$$.dirty&&f&&fetch(f).then((e=>e.json())).then((e=>{Object.keys(e).forEach((t=>{yr(t,e[t])}))})).catch((e=>{console.log(e)})),/*clientstyling, customStylingContainer*/513&e.$$.dirty&&c&&s&&(()=>{let e=document.createElement("style");e.innerHTML=c,s.appendChild(e)})(),/*clientstylingurl, customStylingContainer*/1025&e.$$.dirty&&p&&s&&(()=>{let e=new URL(p),t=document.createElement("style");fetch(e.href).then((e=>e.text())).then((e=>{t.innerHTML=e,setTimeout((()=>{s.appendChild(t)}),1)}))})()},[s,g,d,b,n,E,a,h,u,c,p,f,e=>E(e.id,e.name,e.logo),e=>E(e.id,e.name,e.logo),function(e){P[e?"unshift":"push"]((()=>{s=e,r(0,s)}))}]}k([Jt],(()=>mr)),k([Jt],(()=>gr)),k([Jt],(()=>dr)),k([Jt,St],(()=>br));class Lr extends G{constructor(e){super();const t=document.createElement("style");t.textContent="*,*::before,*::after{margin:0;padding:0;box-sizing:border-box}.CasinoProviders{display:flex;flex-direction:column;gap:1rem;padding:10px 60px}.ProviderTitle{font-weight:500;position:relative;right:30px;margin:10px 0}.Provider{border-radius:7px;display:flex;align-items:center;gap:16px;max-width:300px}.ProviderTextContainer{display:flex;flex-direction:column;justify-content:center;gap:10px;font-size:15px;color:var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF))}.ProviderTextContainer p:first-child{font-weight:600;color:var(--emfe-w-casino-typography, var(--emfe-w-color-white, #FFFFFF))}.ProviderTextContainer p:last-child{color:var(--emfe-w-color-gray-150, #828282);font-weight:300}.ProviderImage{border-radius:4px;object-fit:contain;height:64px;width:64px;font-weight:100;border:0.5px solid var(--emfe-w-color-gray-100, #E6E6E6);overflow:hidden;object-fit:contain}.Message{font-weight:600;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}",this.shadowRoot.appendChild(t),U(this,{target:this.shadowRoot,props:v(this.attributes),customElement:!0},Sr,Ar,o,{endpoint:6,datasource:7,lang:8,clientstyling:9,clientstylingurl:10,translationurl:11},null),e&&(e.target&&c(e.target,this,e.anchor),e.props&&(this.$set(e.props),w()))}static get observedAttributes(){return["endpoint","datasource","lang","clientstyling","clientstylingurl","translationurl"]}get endpoint(){return this.$$.ctx[6]}set endpoint(e){this.$$set({endpoint:e}),w()}get datasource(){return this.$$.ctx[7]}set datasource(e){this.$$set({datasource:e}),w()}get lang(){return this.$$.ctx[8]}set lang(e){this.$$set({lang:e}),w()}get clientstyling(){return this.$$.ctx[9]}set clientstyling(e){this.$$set({clientstyling:e}),w()}get clientstylingurl(){return this.$$.ctx[10]}set clientstylingurl(e){this.$$set({clientstylingurl:e}),w()}get translationurl(){return this.$$.ctx[11]}set translationurl(e){this.$$set({translationurl:e}),w()}}return!customElements.get("casino-providers")&&customElements.define("casino-providers",Lr),Lr}));
|
|
590
588
|
//# sourceMappingURL=casino-providers.js.map
|