@pie-element/select-text 12.0.0-next.42 → 12.0.0-next.43

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.
@@ -0,0 +1,339 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ const tokens = () => [
6
+ {
7
+ text: "If 'tweren't for sight and sound and smell,",
8
+ start: 0,
9
+ end: 43,
10
+ },
11
+ {
12
+ text: "I'd like the city pretty well,",
13
+ start: 44,
14
+ end: 74,
15
+ },
16
+ {
17
+ text: 'But when it comes to getting rest,',
18
+ start: 75,
19
+ end: 109,
20
+ },
21
+ {
22
+ text: 'I like the country lots the best.',
23
+ start: 110,
24
+ end: 143,
25
+ },
26
+ {
27
+ text: 'Sometimes it seems to me I must',
28
+ start: 145,
29
+ end: 176,
30
+ },
31
+ {
32
+ text: "Just quit the city's din and dust,",
33
+ start: 177,
34
+ end: 211,
35
+ },
36
+ {
37
+ text: 'And get out where the sky is blue,',
38
+ start: 212,
39
+ end: 246,
40
+ },
41
+ {
42
+ text: 'And say, now, how does it seem to you?',
43
+ start: 247,
44
+ end: 285,
45
+ },
46
+ ];
47
+
48
+ const mathSampleTokens = [
49
+ {
50
+ start: 583,
51
+ end: 1465,
52
+ text: '<span class="lrn_token"><math xmlns="http://www.w3.org/1998/Math/MathML">\n <mstyle displaystyle="true">\n <mrow>\n <mo>[</mo>\n <mn>6</mn>\n <mi>x</mi>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>+</mo>\n <mn>2</mn>\n <mrow>\n <mo>(</mo>\n <mo>-</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>+</mo>\n <mn>3</mn>\n <mi>x</mi>\n <mo>-</mo>\n <mn>1</mn>\n <mo>)</mo>\n </mrow>\n <mo>]</mo>\n </mrow>\n <mrow>\n <mo>(</mo>\n <msup>\n <mi>x</mi>\n <mn>2</mn>\n </msup>\n <mo>)</mo>\n </mrow>\n </mstyle>\n</math></span>',
53
+ correct: true,
54
+ },
55
+ { start: 1474, end: 2218 },
56
+ { start: 2227, end: 2797 },
57
+ { start: 2806, end: 3112 },
58
+ ];
59
+
60
+ const base = (extras) =>
61
+ Object.assign(
62
+ {},
63
+ {
64
+ // highlightChoices: true,
65
+ feedback: {
66
+ correct: {
67
+ type: 'default',
68
+ default: 'Correct',
69
+ },
70
+ incorrect: {
71
+ type: 'default',
72
+ default: 'Incorrect',
73
+ },
74
+ partial: {
75
+ type: 'default',
76
+ default: 'Nearly',
77
+ },
78
+ },
79
+ partialScoring: false,
80
+ maxSelections: 2,
81
+ mode: 'sentence',
82
+ rationale: 'Rationale goes here.',
83
+ prompt: 'What sentences contain the character 6 in them?',
84
+ promptEnabled: true,
85
+ toolbarEditorPosition: 'bottom',
86
+ // text: `<p>Warhol was born in 1928 in Pittsburgh, Pennsylvania. When he was eight years old, he became very sick and had to stay in bed for months. To help him pass the time his mother, who was an artist, taught him how to draw. He took to it like a fish to water. Art became the center of Andy's world. A year later he added picture-taking to his interests when his mother gave him a camera. He also became fascinated with movies.</p><p>Andy studied art in school and learned many ways to make art. He learned how to use different art materials, such as oil paints, metal, clay, and wood. In 1949 he moved to New York City, where he got a job drawing and painting pictures for magazines.</p>`,
87
+ text: `<p>If 'tweren't for sight and sound and smell,<br />
88
+ I'd like the city pretty well,<br />
89
+ But when it comes to getting rest,<br />
90
+ I like the country lots the best.</p>
91
+
92
+ <p>Sometimes it seems to me I must<br />
93
+ Just quit the city's din and dust,<br />
94
+ And get out where the sky is blue,<br />
95
+ And say, now, how does it seem to you?</p>`,
96
+ tokens: tokens(),
97
+ },
98
+ extras,
99
+ );
100
+
101
+ const mathSample = (extras) => {
102
+ return Object.assign(
103
+ {},
104
+ {
105
+ highlightChoices: false,
106
+ feedback: {
107
+ correct: {
108
+ type: 'default',
109
+ default: 'Correct',
110
+ },
111
+ incorrect: {
112
+ type: 'default',
113
+ default: 'Incorrect',
114
+ },
115
+ partial: {
116
+ type: 'default',
117
+ default: 'Nearly',
118
+ },
119
+ },
120
+ partialScoring: false,
121
+ maxSelections: 2,
122
+ prompt: 'What sentences contain the character 6 in them?',
123
+ text: `<p>If 'tweren't for sight and sound and smell,<br />
124
+ I'd like the city pretty well,<br />
125
+ But when it comes to getting rest,<br />
126
+ I like the country lots the best.</p>
127
+
128
+ <p>Sometimes it seems to me I must<br />
129
+ Just quit the city's din and dust,<br />
130
+ And get out where the sky is blue,<br />
131
+ And say, now, how does it seem to you?</p>`,
132
+ tokens: mathSampleTokens,
133
+ },
134
+ extras,
135
+ );
136
+ };
137
+
138
+ generate.mathSample = (id, element) => {
139
+ return Object.assign({}, { id, element }, mathSample({}));
140
+ };
141
+
142
+ generate.htmlSample = (id, element) => {
143
+ return Object.assign(
144
+ {},
145
+ { id, element },
146
+ {
147
+ highlightChoices: true,
148
+ feedback: {
149
+ correct: {
150
+ type: 'default',
151
+ default: 'Correct',
152
+ },
153
+ incorrect: {
154
+ type: 'default',
155
+ default: 'Incorrect',
156
+ },
157
+ partial: {
158
+ type: 'default',
159
+ default: 'Nearly',
160
+ },
161
+ },
162
+ partialScoring: false,
163
+ text: '<p style=\'padding: 20px\'>A flicker and then gone. In its wake, only <span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>, as he stared into the smiling faces of the crew and told himself that yes he was meant to be here, that <span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>, the sense of panic already replaced by the pride of his accomplishment, replaced so completely that he would not remember that flicker, would not allow himself to remember, <span class="lrn_token">even after everything else had happened</span>. In his memory of that moment, <span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>. And in his memory he was smiling. Is this not what he was meant to do? Is the answer not as fixed and indisputable as any equation he might have been tasked to solve?</p>\n',
164
+ prompt:
165
+ '<p>Select the <span class="relative-emphasis">one</span> phrase below that suggests that in the future, Keith may interpret this moment differently.</p>',
166
+ maxSelections: 2,
167
+ mode: 'sentence',
168
+ rationale: 'Rationale goes here.',
169
+ tokens: [
170
+ {
171
+ correct: false,
172
+ start: 67,
173
+ end: 215,
174
+ text: '<span class="lrn_token">the after-echo of a distant high-pitched ringing that vibrated through him even as it returned to silence once again</span>',
175
+ },
176
+ {
177
+ correct: false,
178
+ start: 321,
179
+ end: 410,
180
+ text: '<span class="lrn_token">it had been his destiny to succeed and so he had succeeded</span>',
181
+ },
182
+ {
183
+ correct: true,
184
+ start: 585,
185
+ end: 655,
186
+ text: '<span class="lrn_token">even after everything else had happened</span>',
187
+ },
188
+ {
189
+ correct: false,
190
+ start: 687,
191
+ end: 790,
192
+ text: '<span class="lrn_token">he was an astronaut and they were welcoming him aboard the space station</span>',
193
+ },
194
+ ],
195
+ },
196
+ );
197
+ };
198
+
199
+ generate.htmlAscii = (id, element) => ({
200
+ id,
201
+ element,
202
+ highlightChoices: true,
203
+ prompt: 'Select the parts that have references for Lucy',
204
+ text: '<p>&#8220;Lucy? Are you using your time wisely to plan your project?&#8221; Mr. Wilson asked.</p><p>&nbsp;Lucy looked a little confused at first.</p>',
205
+ tokens: [
206
+ {
207
+ start: 10,
208
+ end: 68,
209
+ text: 'Lucy? Are you using your time wisely to plan your project?',
210
+ },
211
+ {
212
+ start: 106,
213
+ end: 145,
214
+ text: 'Lucy looked a little confused at first.',
215
+ },
216
+ ],
217
+ });
218
+
219
+ generate.model = (id, element) => {
220
+ return Object.assign(
221
+ {},
222
+ { id, element },
223
+ base({
224
+ // "id": "8a808081701d693801703174fb900421",
225
+ teacherInstructions: '',
226
+ partialScoring: true,
227
+ prompt:
228
+ '<p>Select the sentence from&#160;&#34;The Gymnast&#34; that <span class="relative-emphasis">best</span> represents the theme.</p>',
229
+ rationale:
230
+ '<p>The final sentence of the passage best exemplifies the theme of the short story because Natasha&#39;s practice and determination finally pays off.</p>',
231
+ tokens: [
232
+ {
233
+ text: 'She thought about what she had to do, struggling to rein in her wild, fearful thoughts.',
234
+ end: 90,
235
+ start: 3,
236
+ correct: false,
237
+ },
238
+ {
239
+ start: 449,
240
+ end: 585,
241
+ text: 'Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.',
242
+ correct: false,
243
+ },
244
+ {
245
+ end: 627,
246
+ correct: false,
247
+ text: "At last Natasha's moment arrived.",
248
+ start: 594,
249
+ },
250
+ {
251
+ end: 743,
252
+ text: "The faces of past giants of gymnastics swam before her mind's eye, now razor&#8211;sharp with fierce determination.",
253
+ correct: false,
254
+ start: 628,
255
+ },
256
+ {
257
+ text: 'Suddenly, the din of the gymnasium was silent to her.',
258
+ end: 997,
259
+ correct: false,
260
+ start: 944,
261
+ },
262
+ {
263
+ end: 1087,
264
+ start: 998,
265
+ correct: false,
266
+ text: 'Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her.',
267
+ },
268
+ {
269
+ correct: true,
270
+ start: 1088,
271
+ end: 1225,
272
+ text: 'Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.',
273
+ },
274
+ ],
275
+ // "element": "select-text",
276
+ text: "<p>She thought about what she had to do, struggling to rein in her wild, fearful thoughts. Coach Cummings always said that an undisciplined mind never scored a perfect 10. Natasha wanted to please her Coach, yet sometimes his approval wasn't as exciting as his anger. The gymnasts were unanimous about one thing: Coach Cummings's fits of disapproving rage were much more humorous to witness than his infrequent, backslapping moments of high praise. Just for a hair of a moment, Natasha wondered if she really wanted a perfect 10, so weary was she of trying for but never achieving one.</p>\n\n<p>At last Natasha's moment arrived. The faces of past giants of gymnastics swam before her mind's eye, now razor&#8211;sharp with fierce determination. \"I am talented. I am not afraid. I will make a perfect 10,\" she spoke aloud to herself, as she approached the mat, dusted her hands with chalk to prevent slippage, and returned to her starting point. Suddenly, the din of the gymnasium was silent to her. Forcing all sound out of her mind, she focused on the gleaming balance beam ahead of her. Taking a deep breath, Natasha made her graceful, yet powerful approach, mounted the beam flawlessly, and...executed her first perfect 10.</p>\n",
277
+ rubricEnabled: false,
278
+ }),
279
+ );
280
+ };
281
+
282
+ const { model } = generate;
283
+
284
+ var config = {
285
+ elements: {
286
+ 'select-text': '../..',
287
+ },
288
+ models: [model('1', 'select-text')],
289
+ };
290
+
291
+ // new init - just shows off print!
292
+
293
+ const init = async () => {
294
+ console.log('define the element...');
295
+ await Promise.all(
296
+ config.models.map(async (m) => {
297
+ try {
298
+ const printTag = `${m.element}-print`;
299
+ if (customElements.get(printTag)) {
300
+ return true;
301
+ } else {
302
+ customElements.define(printTag, PrintElement);
303
+ await customElements.whenDefined(printTag);
304
+ return true;
305
+ }
306
+ } catch (e) {
307
+ return false;
308
+ }
309
+ })
310
+ );
311
+
312
+ console.log('now apply the model...');
313
+ config.models.forEach((m) => {
314
+ const printTag = `${m.element}-print`;
315
+ const h3s = document.createElement('h3');
316
+ h3s.textContent = 'student mode';
317
+ document.body.appendChild(h3s);
318
+ const de = document.createElement(printTag);
319
+ document.body.appendChild(de);
320
+ de.options = {};
321
+ de.model = m;
322
+
323
+ const h3 = document.createElement('h3');
324
+ h3.textContent = 'instructor mode';
325
+ document.body.appendChild(h3);
326
+ const instr = document.createElement(printTag);
327
+ document.body.appendChild(instr);
328
+ instr.options = { mode: 'instructor' };
329
+ instr.model = JSON.parse(JSON.stringify(m));
330
+ });
331
+ };
332
+
333
+ init()
334
+ .then(() => {
335
+ console.log('ready');
336
+ })
337
+ .catch((e) => {
338
+ console.error(e);
339
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/select-text@12.0.0-beta.1</title>
6
+ <link
7
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
+ rel="stylesheet"
9
+ />
10
+ <style>
11
+ html, body {
12
+ font-family: 'Roboto', sans-serif;
13
+ }
14
+ </style>
15
+ <script type="module" src="./print-demo.js"></script>
16
+ </head>
17
+ <body></body>
18
+ </html>
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as u,_dll_mui__material as o,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as s,_dll_lodash as i,_dll_debug as r,_dll_classnames as a,_dll_mui__icons_material as l,_dll_pie_lib__correct_answer_toggle as c}from"../../../@pie-lib/shared-module@^3.0.5/module/index.js";import{_dll_pie_lib__math_rendering as D}from"../../../@pie-lib/math-rendering-module@^4.0.5/module/index.js";var p,d=e;p=d.createRoot,d.hydrateRoot;const h=t,g=u,{Button:C}=o,{Switch:F}=o,{FormControlLabel:f}=o,{styled:E}=n,{color:A}=s,m=E("div")(()=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),y=E(C)(({theme:e})=>({marginRight:e.spacing(1)})),B=E(F)(()=>({"& .MuiSwitch-thumb":{"&.Mui-checked":{color:`${A.tertiary()} !important`}},"& .MuiSwitch-track":{"&.Mui-checked":{backgroundColor:`${A.tertiaryLight()} !important`}}}));class b extends h.Component{static __initStatic(){this.propTypes={onClear:g.func.isRequired,onWords:g.func.isRequired,onSentences:g.func.isRequired,onParagraphs:g.func.isRequired,setCorrectMode:g.bool.isRequired,onToggleCorrectMode:g.func.isRequired}}static __initStatic2(){this.defaultProps={}}render(){const{onClear:e,onWords:t,onSentences:u,onParagraphs:o,setCorrectMode:n,onToggleCorrectMode:s}=this.props;return h.createElement(m,null,h.createElement("div",null,h.createElement(y,{onClick:t,size:"small",color:"primary",disabled:n},"Words"),h.createElement(y,{onClick:u,size:"small",color:"primary",disabled:n},"Sentences"),h.createElement(y,{onClick:o,size:"small",color:"primary",disabled:n},"Paragraphs"),h.createElement(y,{size:"small",color:"secondary",onClick:e,disabled:n},"Clear")),h.createElement(f,{control:h.createElement(B,{checked:n,onChange:s}),label:"Set correct answers"}))}}b.__initStatic(),b.__initStatic2();var x=function e(t,u){var o,n,s,i=u||"";if(!t||!("length"in t)&&!t.type)throw new Error("Expected node, not `"+t+"`");if("string"==typeof t.value)return t.value;if(s="length"in t?t:t.children,1===(n=s.length)&&"value"in s[0])return s[0].value;o=[];for(;n--;)o[n]=e(s[n],i);return o.join(i)};var S=function(e){return function(t){var u=-1,o=t&&t.children;if(!o)throw new Error("Missing children in `parent` for `visitor`");for(;++u in o;)e(o[u],u,t)}};var v=function(e,t,u){var o,n=-1;if(!e)throw new Error("Iterate requires that |this| not be "+e);if(!k.call(e,"length"))throw new Error("Iterate requires that |this| has a `length`");if("function"!=typeof t)throw new Error("`callback` must be a function");for(;++n<e.length;)n in e&&"number"==typeof(o=t.call(u,e[n],n,e))&&(o<0&&(n=0),n=o-1)},k={}.hasOwnProperty;var w=v,N=function(e){return function(e){return t;function t(t){var u=t&&t.children;if(!u)throw new Error("Missing children in `parent` for `modifier`");return w(u,e,t)}}(function(e){return t;function t(t,u){return e(t,u,this)}}(e))};var _=x;var L=function(e,t){return function(u){var o,n,s,i=[],r=u.children,a=u.type,l=r.length,c=-1,D=l-1,p=0;for(;++c<l;)(c===D||r[c].type===e&&t.test(_(r[c])))&&(o=r[p],n=r[c],s={type:a,children:r.slice(p,c+1)},o.position&&n.position&&(s.position={start:o.position.start,end:n.position.end}),i.push(s),p=c+1);return i}},O=function(e){var t=e.type,u=e.tokenizer,o=e.delimiter,n=o&&L(e.delimiterType,o);return function(e){var o=this[u](e);return{type:t,children:n?n(o):o}}};var R={affixSymbol:/^([!"').?\u0F3B\u0F3D\u169C\u2019\u201D\u2026\u203A\u203D\u2046\u207E\u208E\u2309\u230B\u232A\u2769\u276B\u276D\u276F\u2771\u2773\u2775\u27C6\u27E7\u27E9\u27EB\u27ED\u27EF\u2984\u2986\u2988\u298A\u298C\u298E\u2990\u2992\u2994\u2996\u2998\u29D9\u29DB\u29FD\u2E03\u2E05\u2E0A\u2E0D\u2E1D\u2E21\u2E23\u2E25\u2E27\u2E29\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u301E\u301F\uFD3E\uFE18\uFE36\uFE38\uFE3A\uFE3C\uFE3E\uFE40\uFE42\uFE44\uFE48\uFE5A\uFE5C\uFE5E\uFF09\uFF3D\uFF5D\uFF60\uFF63\xBB\]}])\1*$/,newLine:/^[ \t]*((\r?\n|\r)[\t ]*)+$/,newLineMulti:/^[ \t]*((\r?\n|\r)[\t ]*){2,}$/,terminalMarker:/^([!.?\u2026\u203D]+)$/,wordSymbolInner:/^([&'\-.:=?@\xAD\xB7\u2010\u2011\u2019\u2027]|_+)$/,numerical:/^(?:[\d\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])+$/,digitStart:/^\d/,lowerInitial:/^(?:[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C3\uA7C8\uA7CA\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43])/,surrogates:/[\uD800-\uDFFF]/,punctuation:/[!"'-),-/:;?[-\]_{}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u201F\u2022-\u2027\u2032-\u203A\u203C-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,word:/[\dA-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BF2\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7E\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D63\u0D66-\u0D78\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F33\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u17F0-\u17F9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1AC0\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u20D0-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA827\uA82C\uA830-\uA835\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE6\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC52-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDCE-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E-\uDC61\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF3B]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFE4\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]|\uDB40[\uDD00-\uDDEF]/,whiteSpace:/[\t-\r \x85\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/},P=v,$=function(e){return function(e){return t;function t(t){var u=t&&t.children;if(!u)throw new Error("Missing children in `parent` for `modifier`");P(u,e,t)}}(function(e){return t;function t(t,u){return e(t,u,this)}}(e))};var T=x,M=$(function(e,t,u){var o,n;if("SymbolNode"!==e.type&&"PunctuationNode"!==e.type||"&"!==T(e))return;if(o=u.children,n=o[t+1],0!==t&&"WordNode"===o[t-1].type||!(n&&"WordNode"===n.type))return;o.splice(t,1),n.children.unshift(e),n.position&&e.position&&(n.position.start=e.position.start);return t-1});var I=x,j=$(function(e,t,u){var o,n,s;if(0!==t&&("SymbolNode"===e.type||"PunctuationNode"===e.type)&&"-"===I(e)&&(n=(o=u.children)[t-1],(!(s=o[t+1])||"WordNode"!==s.type)&&n&&"WordNode"===n.type))return o.splice(t,1),n.children.push(e),n.position&&e.position&&(n.position.end=e.position.end),t});var z=x,W=R,H=$(function(e,t,u){var o,n,s,i,r,a,l;if(0!==t&&("SymbolNode"===e.type||"PunctuationNode"===e.type)&&(s=(o=u.children)[t-1])&&"WordNode"===s.type){for(r=t-1,a=[],l=[];o[++r];)if("WordNode"===(n=o[r]).type)a=a.concat(l,n.children),l=[];else{if("SymbolNode"!==n.type&&"PunctuationNode"!==n.type||!V.test(z(n)))break;l.push(n)}if(0!==a.length)return 0!==l.length&&(r-=l.length),o.splice(t,r-t),s.children=s.children.concat(a),i=a[a.length-1],s.position&&i.position&&(s.position.end=i.position.end),t}}),V=W.wordSymbolInner;var U=x,q=$(function(e,t,u){var o,n,s,i,r,a,l,c=u.children;if(o=c[t-1],n=c[t+1],o&&"WordNode"===o.type&&("SymbolNode"===e.type||"PunctuationNode"===e.type)&&U(e)===K&&(s=U(o),a=e,r=[e],l=1,n&&"WordNode"===n.type&&(i=U(n),a=n,r=r.concat(n.children),l++),s.length<3&&(!i||i.length<3)))return o.children=o.children.concat(r),c.splice(t,l),o.position&&a.position&&(o.position.end=a.position.end),t}),K="/";var G=x,J=R,Y=$(function(e,t,u){var o,n,s,i,r,a,l,c;if(0!==t&&"."===G(e)&&(i=(s=(n=(o=u.children)[t-1]).children)&&s.length,"WordNode"===n.type&&1!==i&&i%2!=0)){for(r=i,l=!0;s[--r];)if(a=s[r],c=G(a),r%2==0){if(c.length>1)return;Q.test(c)||(l=!1)}else if("."!==c){if(r<i-2)break;return}if(!l)return o.splice(t,1),s.push(e),n.position&&e.position&&(n.position.end=e.position.end),t}}),Q=J.numerical;var X=$(function(e,t,u){var o,n=u.children;if("WordNode"===e.type&&(o=n[t+1])&&"WordNode"===o.type)return n.splice(t+1,1),e.children=e.children.concat(o.children),o.position&&e.position&&(e.position.end=o.position.end),t});var Z=S(function(e,t,u){var o=u.children;if(!e.position)return;0!==t||u.position&&u.position.start||(ee(u),u.position.start=e.position.start);t!==o.length-1||u.position&&u.position.end||(ee(u),u.position.end=e.position.end)});function ee(e){e.position||(e.position={})}var te=$(function(e,t,u){var o,n,s=e.children,i=-1;for(;s[++i];)if("WordNode"===s[i].type)return;if(o=u.children[t-1])return o.children=o.children.concat(s),u.children.splice(t,1),o.position&&e.position&&(o.position.end=e.position.end),t;(n=u.children[t+1])&&(n.children=s.concat(n.children),n.position&&e.position&&(n.position.start=e.position.start),u.children.splice(t,1))});var ue=x,oe=R,ne=$(function(e,t,u){var o,n,s,i=e.children;if(i&&0!==i.length&&0!==t&&(o=i[0],n=i[1],s=u.children[t-1],("SymbolNode"===o.type||"PunctuationNode"===o.type)&&se.test(ue(o))))return s.children.push(i.shift()),o.position&&s.position&&(s.position.end=o.position.end),n&&n.position&&e.position&&(e.position.start=n.position.start),t-1}),se=oe.affixSymbol;var ie=x,re=R,ae=$(function(e,t,u){var o,n,s,i,r=e.children;if(r&&0!==r.length&&0!==t)for(o=-1;r[++o];){if("WordNode"===(n=r[o]).type){if(!le.test(ie(n)))return;return(i=(s=u.children)[t-1]).children=i.children.concat(r),s.splice(t,1),i.position&&e.position&&(i.position.end=e.position.end),t}if("SymbolNode"===n.type||"PunctuationNode"===n.type)return}}),le=re.lowerInitial;var ce=x,De=R,pe=$(function(e,t,u){var o=e.children,n=u.children,s=n[t-1],i=o[0];if(s&&i&&"WordNode"===i.type&&de.test(ce(i)))return s.children=s.children.concat(o),n.splice(t,1),s.position&&e.position&&(s.position.end=e.position.end),t}),de=De.digitStart;var he=x,ge=$(function(e,t,u){var o,n,s,i=e.children;if(i&&i.length>1&&(o=i[i.length-1])&&"."===he(o)&&(n=i[i.length-2])&&"WordNode"===n.type&&Ce.test(he(n).toLowerCase())&&(n.children.push(o),i.pop(),o.position&&n.position&&(n.position.end=o.position.end),s=u.children[t+1]))return e.children=i.concat(s.children),u.children.splice(t+1,1),s.position&&e.position&&(e.position.end=s.position.end),t-1}),Ce=new RegExp("^([0-9]{1,3}|[a-z]|al|ca|cap|cca|cent|cf|cit|con|cp|cwt|ead|etc|ff|fl|ibid|id|nem|op|pro|seq|sic|stat|tem|viz)$");var Fe=x,fe=$(function(e,t,u){var o,n,s,i,r=e.children;if(!r||0===r.length||0===t)return;n=-1;for(;r[++n];){if("WordNode"===(o=r[n]).type)return;if("SymbolNode"===o.type||"PunctuationNode"===o.type){if(","!==(s=Fe(o))&&";"!==s)return;return(i=u.children[t-1]).children=i.children.concat(r),i.position&&e.position&&(i.position.end=e.position.end),u.children.splice(t,1),t}}});var Ee=x,Ae=R,me=S(function(e){var t,u,o,n,s=e.children,i=s.length,r=!1;for(;s[--i];)if("SymbolNode"===(t=s[i]).type||"PunctuationNode"===t.type){if(ye.test(Ee(t)))if(r){if("."===Ee(t))if(u=s[i-1],o=s[i+1],u&&"WordNode"===u.type){if(n=s[i+2],o&&n&&"WhiteSpaceNode"===o.type&&"."===Ee(n))continue;s.splice(i,1),u.children.push(t),t.position&&u.position&&(u.position.end=t.position.end),i--}else o&&"WordNode"===o.type&&(s.splice(i,1),o.children.unshift(t),t.position&&o.position&&(o.position.start=t.position.start))}else r=!0}else"WordNode"===t.type&&(r=!0)}),ye=Ae.terminalMarker;var Be=S(function(e,t,u){var o,n=e.children;n&&0!==n.length&&"WhiteSpaceNode"===n[0].type&&(u.children.splice(t,0,n.shift()),(o=n[0])&&o.position&&e.position&&(e.position.start=o.position.start))});var be=$(function(e,t,u){var o,n=e.children;if(n&&0!==n.length&&"WhiteSpaceNode"===n[n.length-1].type)return u.children.splice(t+1,0,e.children.pop()),(o=n[n.length-1])&&o.position&&e.position&&(e.position.end=o.position.end),t});var xe=x,Se=R,ve=$(function(e,t,u){var o,n,s,i,r,a,l,c;if("SentenceNode"!==e.type)return;o=e.children,s=o.length-1,n=0;for(;++n<s;)if("WhiteSpaceNode"===(c=o[n]).type&&ke.test(xe(c)))return e.children=o.slice(0,n),l={type:"SentenceNode",children:o.slice(n+1)},i=o[n-1],r=o[n+1],u.children.splice(t+1,0,c,l),e.position&&i.position&&r.position&&(a=e.position.end,e.position.end=i.position.end,l.position={start:r.position.start,end:a}),t+1}),ke=Se.newLineMulti;var we=$(function(e,t,u){if("children"in e&&0===e.children.length)return u.children.splice(t,1),t});var Ne=O,_e=R,Le=Oe;function Oe(e,t){var u=t||e;if(!(this instanceof Oe))return new Oe(e,t);this.doc=u?String(u):null}var Re=Oe.prototype;function Pe(e){return e+="Node",function(t,u,o){null==t&&(t="");return(u||He)(t)({type:e,value:String(t)},o)}}function $e(e,t,u){e.prototype[t]=function(){return this.run(t,u.apply(this,arguments))}}function Te(e){return function(t,u){var o,n=this;if(!(t in n))throw new Error("Illegal Invocation: Unsupported `key` for `use(key, plugins)`. Make sure `key` is a supported function");if(!u)return;o=t+"Plugins",u="function"==typeof u?[u]:u.concat();n[o]||(n[o]=[]);e(n,o,u)}}Re.position=!0,Re.tokenizeSymbol=Pe("Symbol"),Re.tokenizeWhiteSpace=Pe("WhiteSpace"),Re.tokenizePunctuation=Pe("Punctuation"),Re.tokenizeSource=Pe("Source"),Re.tokenizeText=Pe("Text"),Re.run=function(e,t){var u=this[e+"Plugins"],o=-1;if(u)for(;u[++o];)u[o](t);return t},Re.use=Te(function(e,t,u){e[t]=e[t].concat(u)}),Re.useFirst=Te(function(e,t,u){e[t]=u.concat(e[t])}),Re.parse=function(e){return this.tokenizeRoot(e||this.doc)},Re.tokenize=function(e){return function(e,t){var u,o,n,s,i,r,a,l,c,D,p,d;null==t?t="":t instanceof String&&(t=t.toString());if("string"!=typeof t){if("length"in t&&(!t[0]||t[0].type))return t;throw new Error("Illegal invocation: '"+t+"' is not a valid argument for 'ParseLatin'")}if(u=[],!t)return u;i=0,o=0,n=1,s=1,d=e.position?g:C,r=t.length,c="",l="";for(;i<r;)a=t.charAt(i),p=ze.test(a)?"WhiteSpace":je.test(a)?"Punctuation":Me.test(a)?"Word":"Symbol",h(),c=a,a="",D=p,p=null,i++;return h(),u;function h(){D!==p||"Word"!==D&&"WhiteSpace"!==D&&a!==c&&!Ie.test(a)?(l&&e["tokenize"+D](l,d),l=a):l+=a}function g(e){var t=f();return E(e),u;function u(){return t(F.apply(null,arguments))}}function C(){return e;function e(){return F.apply(null,arguments)}}function F(e,t){return t?t.children.push(e):u.push(e),e}function f(){var e=m();function t(t){return t.position=new A(e),t}return t}function E(e){var t=e.length,u=-1,i=-1;for(o+=t;++u<t;)"\n"===e.charAt(u)&&(i=u,n++);-1===i?s+=t:s=t-i}function A(e){this.start=e,this.end=m()}function m(){return{line:n,column:s,offset:o}}}(this,e)},$e(Oe,"tokenizeWord",function(e,t){var u=(t||He)(""),o={type:"WordNode",children:[]};return this.tokenizeText(e,t,o),u(o)}),$e(Oe,"tokenizeSentence",Ne({type:"SentenceNode",tokenizer:"tokenize"})),$e(Oe,"tokenizeParagraph",Ne({type:"ParagraphNode",delimiter:_e.terminalMarker,delimiterType:"PunctuationNode",tokenizer:"tokenizeSentence"})),$e(Oe,"tokenizeRoot",Ne({type:"RootNode",delimiter:_e.newLine,delimiterType:"WhiteSpaceNode",tokenizer:"tokenizeParagraph"})),Re.use("tokenizeSentence",[M,j,H,q,Y,X,Z]),Re.use("tokenizeParagraph",[te,ne,ae,pe,ge,fe,me,Be,be,ve,we,Z]),Re.use("tokenizeRoot",[Be,be,we,Z]);var Me=_e.word,Ie=_e.surrogates,je=_e.punctuation,ze=_e.whiteSpace;function We(e,t){return t&&t.children.push(e),e}function He(){return We}var Ve=x,Ue=S,qe=N,Ke=Le,Ge=te,Je=ne,Ye=ae,Qe=pe,Xe=fe,Ze=me,et=Be,tt=be,ut=ve,ot=we,nt=Z,st=rt;at.prototype=Ke.prototype;var it=new at;function rt(e,t){if(!(this instanceof rt))return new rt(e,t);Ke.apply(this,arguments)}function at(){}rt.prototype=it,it.tokenizeSentencePlugins=[Ue(function(e,t,u){var o,n,s,i,r;if("PunctuationNode"!==e.type&&"SymbolNode"!==e.type)return;if(o=u.children,i=o.length,"/"===(r=Ve(e)))(n=o[t-1])&&"w"===ht(Ve(n))&&(o.splice(t,1),n.children.push(e),n.position&&e.position&&(n.position.end=e.position.end));else if(dt.test(r)){if(n=o[t-1],t>2&&t<i-1&&"WordNode"===n.type&&"WhiteSpaceNode"===o[t-2].type&&"WhiteSpaceNode"===o[t+1].type&&Dt.test(ht(Ve(n))))return o.splice(t,1),n.children.push(e),void(n.position&&e.position&&(n.position.end=e.position.end));t===i-1||"WordNode"!==o[t+1].type||0!==t&&"WordNode"===o[t-1].type||(n=o[t+1],r=ht(Ve(n)),pt.test(r)?(o.splice(t,1),n.children=[e].concat(n.children),n.position&&e.position&&(n.position.start=e.position.start)):"n"===r&&t<i-2&&dt.test(Ve(o[t+2]))&&(s=o[t+2],o.splice(t,1),o.splice(t+1,1),n.children=[e].concat(n.children,s),n.position&&(e.position&&(n.position.start=e.position.start),s.position&&(n.position.end=s.position.end))))}})].concat(it.tokenizeSentencePlugins),it.tokenizeParagraphPlugins=[qe(function(e,t,u){var o,n,s=e.children,i=s[s.length-1],r=s[s.length-2];if(i&&"."===Ve(i)&&r&&"WordNode"===r.type&&(o=Ve(r),(lt.test(ht(o))||ct.test(o))&&(r.children.push(i),s.pop(),i.position&&r.position&&(r.position.end=i.position.end),n=u.children[t+1])))return e.children=s.concat(n.children),u.children.splice(t+1,1),n.position&&e.position&&(e.position.end=n.position.end),t-1})].concat([Ge,Je,Ye,Qe,Xe,Ze,et,tt,ut,ot,nt]);var lt=new RegExp("^(al|ca|cap|cca|cent|cf|cit|con|cp|cwt|ead|etc|ff|fl|ibid|id|nem|op|pro|seq|sic|stat|tem|vizinc|ltd|bbls?|cu|doz|fl|ft|gal|gr|gro|in|kt|lbs?|mi|oz|pt|qt|sq|tbsp|tsp|yds?|sec|min|hr|mon|tue|tues|wed|thu|thurs|fri|sat|sun|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)$"),ct=new RegExp("^(Mr|Mrs|Miss|Ms|Mss|Mses|Mlle|Mme|M|Messrs|Mmes|Jr|Sr|Snr|Dr|Mgr|Atty|Prof|Hon|Rev|Fr|Msgr|Sr|Br|St|Pres|Supt|Rep|Sen|Gov|Amb|Treas|Sec|Amd|Brig|Gen|Cdr|Col|Capt|Lt|Maj|Sgt|Po|Wo|Ph|Ave|Blvd|Mt|Rd|Bldgs?|Nat|Natl|Rt|Rte|Co|Pk|Sq|Dr|Pt|St|Ft|Pen|Terr|Hwy|Fwy|Pkwy|Ala|Ariz|Ark|Cal|Calif|Col|Colo|Conn|Del|Fla|Ga|Ida|Id|Ill|Ind|Ia|Kan|Kans|Ken|Ky|La|Me|Md|Mass|Mich|Minn|Miss|Mo|Mont|Neb|Nebr|Nev|Mex|Dak|Okla|Ok|Ore|Penna|Penn|Pa|Tenn|Tex|Ut|Vt|Va|Wash|Wis|Wisc|Wyo|Alta|Man|Ont|Qué|Que|Sask|Yuk|Beds|Berks|Bucks|Cambs|Ches|Corn|Cumb|Derbys|Derbs|Dev|Dor|Dur|Glos|Hants|Here|Heref|Herts|Hunts|Lancs|Leics|Lincs|Mx|Middx|Mddx|Norf|Northants|Northumb|Northd|Notts|Oxon|Rut|Shrops|Salop|Som|Staffs|Staf|Suff|Sy|Sx|Ssx|Warks|War|Warw|Westm|Wilts|Worcs|Yorks)$"),Dt=new RegExp("^(o|ol)$"),pt=new RegExp("^(im|er|em|cause|twas|tis|twere|\\d\\ds?)$"),dt=/^['\u2019]$/;function ht(e){return e.toLowerCase()}const{compact:gt}=i,{clone:Ct}=i,Ft=(e,t)=>t.children?t.children.reduce(Ft,e):t.value?e+t.value:e,ft=e=>Ft("",e),Et=e=>(new st).parse(e).children.reduce((e,t)=>{if("ParagraphNode"===t.type){const o={text:(u=t,Ft("",u)),start:t.position.start.offset,end:t.position.end.offset};return e.concat([o])}return e;var u},[]),At=e=>(new st).parse(e).children.reduce((e,t)=>"ParagraphNode"===t.type?t.children.reduce((e,t)=>{if("SentenceNode"===t.type){const u=((e,t)=>{const u=[];let o=e.children.reduce(function(e,t){if("WhiteSpaceNode"===t.type&&"\n"===t.value){if(u.length){const o=u[0],n={text:u.map(e=>ft(e)).join(""),start:o.position.start.offset,end:t.position.start.offset};return u.splice(0,u.length),e.concat([n])}}else u.push(t);return e},t);if(u.length){const e=u[0],t=u[u.length-1],n={text:u.map(e=>ft(e)).join(""),start:e.position.start.offset,end:t.position.end.offset};o=o.concat([n]),u.splice(0,u.length)}return o})(t,e);return u||e}return e},e):e,[]),mt=e=>(new st).parse(e).children.reduce((e,t)=>"ParagraphNode"===t.type?t.children.reduce((e,t)=>"SentenceNode"===t.type?t.children.reduce((e,t)=>{if("WordNode"===t.type){const o={text:(u=t,Ft("",u)),start:t.position.start.offset,end:t.position.end.offset};return e.concat([o])}return e;var u},e):e,e):e,[]);class yt{constructor(e){this.results=e}get hasOverlap(){return this.results.filter(e=>"overlap"===e.type).length>0}get surroundedTokens(){return this.results.filter(e=>"within-selection"===e.type).map(e=>e.token)}}const Bt=(e,t)=>{const{start:u,end:o}=e,n=t.map(e=>u===e.start&&o===e.end?{token:e,type:"exact-fit"}:u<=e.start&&o>=e.end?{token:e,type:"within-selection"}:(e=>u>=e.start&&u<e.end)(e)||(e=>o>e.start&&o<=e.end)(e)?{token:e,type:"overlap"}:void 0);return new yt(gt(n))},bt=(e,t)=>{const u=e||"";if(!Array.isArray(t)||0===t.length)return[{text:u,start:0,end:u.length}];const o=(e=>{if(Array.isArray(e)){const t=Ct(e);return t.sort((e,t)=>{const u=e.start<t.start?-1:e.start>t.start?1:0,o=e.end<t.end?-1:e.end>t.end?1:0;if(-1===u&&-1!==o)throw new Error(`sort does not support intersecting tokens. a: ${e.start}-${e.end}, b: ${t.start}-${t.end}`);return u}),t}return e})(t).reduce((e,t,o,n)=>{let s=[];const i=e.lastIndex;if(t.start===i?s=[{text:u.substring(i,t.end),start:i,end:t.end,predefined:!0,correct:t.correct,isMissing:t.isMissing}]:i<t.start&&(s=[{text:u.substring(i,t.start),start:i,end:t.start},{text:u.substring(t.start,t.end),start:t.start,end:t.end,predefined:!0,correct:t.correct,isMissing:t.isMissing}]),o===n.length-1&&t.end<u.length){const e={text:u.substring(t.end),start:t.end,end:u.length};s.push(e)}return{lastIndex:s.length?s[s.length-1].end:i,result:e.result.concat(s)}},{result:[],lastIndex:0});return o.result},xt=()=>{document.getSelection?(document.getSelection().removeAllRanges(),document.getSelection().addRange(document.createRange())):window.getSelection?window.getSelection().removeAllRanges?(window.getSelection().removeAllRanges(),window.getSelection().addRange(document.createRange())):window.getSelection().empty&&window.getSelection().empty():document.selection&&document.selection.empty()};var St={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};var vt={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"};const kt=t,wt=u,{styled:Nt}=n,_t=a,Lt=r("@pie-lib:text-select:token-text"),Ot=Nt("span")(()=>({"&.predefined":{cursor:"pointer",backgroundColor:vt[100],border:`dashed 0px ${vt[700]}`,"& *":{cursor:"pointer",backgroundColor:vt[100],border:`dashed 0px ${vt[700]}`}},"&.correct":{backgroundColor:St[500],"& *":{backgroundColor:St[500]}}})),Rt=({text:e,predefined:t,onClick:u,correct:o})=>{const n=(e||"").replace(/\n/g,"<br>");if(t){const e=_t("predefined",o&&"correct");return kt.createElement(Ot,{onClick:u,className:e,dangerouslySetInnerHTML:{__html:n}})}return kt.createElement("span",{dangerouslySetInnerHTML:{__html:n}})},Pt=["\n"," ","\t"];class $t extends kt.Component{constructor(...e){super(...e),$t.prototype.__init.call(this)}static __initStatic(){this.propTypes={text:wt.string.isRequired,tokens:wt.array.isRequired,onTokenClick:wt.func.isRequired,onSelectToken:wt.func.isRequired,className:wt.string}}__init(){this.onClick=e=>{const{onSelectToken:t,text:u,tokens:o}=this.props;if(e.preventDefault(),"undefined"==typeof window)return;const n=window.getSelection().toString();if(n.length>0&&Pt.indexOf(n)<0&&this.root){let e=(e=>{var t,u=0,o=e.ownerDocument||e.document,n=o.defaultView||o.parentWindow;if(void 0!==n.getSelection){if((t=n.getSelection()).rangeCount>0){var s=n.getSelection().getRangeAt(0),i=s.toString().length,r=s.cloneRange();r.selectNodeContents(e),r.setEnd(s.endContainer,s.endOffset),u=i?r.toString().length-i:r.toString().length}}else if((t=o.selection)&&"Control"!==t.type){var a=t.createRange(),l=o.body.createTextRange();l.moveToElementText(e),l.setEndPoint("EndToEnd",a),u=l.text.length}return u})(this.root);if(e+=u.slice(e).indexOf(n),void 0!==e){const s=e+n.length;if(s<=u.length){const u=Bt({start:e,end:s},o);if(u.hasOverlap)Lt("hasOverlap - do nothing"),xt();else{t({text:n,start:e,end:s},u.surroundedTokens),xt()}}}}}}render(){const{text:e,tokens:t,className:u,onTokenClick:o}=this.props,n=bt(e,t);return kt.createElement("div",{className:u,ref:e=>this.root=e,onClick:this.onClick},n.map((e,t)=>kt.createElement(Rt,{key:t,...e,onClick:()=>o(e)})))}}$t.__initStatic();const Tt=t,Mt=u,{styled:It}=n,{clone:jt}=i,{isEqual:zt}=i,{differenceWith:Wt}=i,Ht=It("div")(({disabled:e})=>({whiteSpace:"pre-wrap",...e&&{cursor:"default",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",userSelect:"none"}}));class Vt extends Tt.Component{static __initStatic(){this.propTypes={text:Mt.string.isRequired,tokens:Mt.arrayOf(Mt.shape({text:Mt.string,correct:Mt.bool,start:Mt.number,end:Mt.number})),onChange:Mt.func.isRequired}}static __initStatic2(){this.defaultProps={}}constructor(e){super(e),Vt.prototype.__init.call(this),Vt.prototype.__init2.call(this),Vt.prototype.__init3.call(this),Vt.prototype.__init4.call(this),Vt.prototype.__init5.call(this),Vt.prototype.__init6.call(this),Vt.prototype.__init7.call(this),Vt.prototype.__init8.call(this),Vt.prototype.__init9.call(this),this.state={setCorrectMode:!1,mode:""}}__init(){this.onChangeHandler=(e,t)=>{this.props.onChange(e,t),this.setState({mode:t})}}__init2(){this.toggleCorrectMode=()=>this.setState({setCorrectMode:!this.state.setCorrectMode})}__init3(){this.clear=()=>{this.onChangeHandler([],"")}}__init4(){this.buildTokens=(e,t)=>{const{text:u}=this.props,o=t(u);this.onChangeHandler(o,e)}}__init5(){this.selectToken=(e,t)=>{const{tokens:u}=this.props,o=Wt(jt(u),t,zt);o.push(e),this.onChangeHandler(o,this.state.mode)}}__init6(){this.tokenClick=e=>{const{setCorrectMode:t}=this.state;t?this.setCorrect(e):this.removeToken(e)}}__init7(){this.tokenIndex=e=>{const{tokens:t}=this.props;return t.findIndex(t=>t.text==e.text&&t.start==e.start&&t.end==e.end)}}__init8(){this.setCorrect=e=>{const{tokens:t}=this.props,u=this.tokenIndex(e);if(-1!==u){const e=t[u];e.correct=!e.correct;const o=jt(t);o.splice(u,1,e),this.onChangeHandler(o,this.state.mode)}}}__init9(){this.removeToken=e=>{const{tokens:t}=this.props,u=this.tokenIndex(e);if(-1!==u){const e=jt(t);e.splice(u,1),this.onChangeHandler(e,this.state.mode)}}}render(){const{text:e,tokens:t}=this.props,{setCorrectMode:u}=this.state;return Tt.createElement("div",null,Tt.createElement(b,{onClear:this.clear,onWords:()=>this.buildTokens("words",mt),onSentences:()=>this.buildTokens("sentence",At),onParagraphs:()=>this.buildTokens("paragraphs",Et),setCorrectMode:u,onToggleCorrectMode:this.toggleCorrectMode}),Tt.createElement(Ht,{disabled:u,as:$t,text:e,tokens:t,onTokenClick:this.tokenClick,onSelectToken:this.selectToken}))}}Vt.__initStatic(),Vt.__initStatic2();const Ut=t,qt=u,{styled:Kt}=n,Gt=a,{Check:Jt}=l,{Close:Yt}=l,{color:Qt}=s,Xt=Kt("span")(({theme:e})=>({cursor:"pointer",textIndent:0,"&.disabled":{cursor:"inherit",color:Qt.disabled()},"&.disabledBlack":{cursor:"inherit",pointerEvents:"none"},"&.disabledAndSelected":{backgroundColor:Qt.blueGrey100()},[`@media (min-width: ${e.breakpoints.values.md}px)`]:{"&.selectable:hover":{backgroundColor:Qt.blueGrey300(),color:e.palette.common.black,"& > *":{backgroundColor:Qt.blueGrey300()}}},"&.selected":{backgroundColor:Qt.blueGrey100(),color:e.palette.common.black,lineHeight:3.2*parseFloat(e.spacing(1))+"px",border:`solid 2px ${Qt.blueGrey900()}`,borderRadius:"4px","& > *":{backgroundColor:Qt.blueGrey100()}},"&.highlight":{border:`dashed 2px ${Qt.blueGrey600()}`,borderRadius:"4px",lineHeight:3.2*parseFloat(e.spacing(1))+"px"},"&.print":{border:`dashed 2px ${Qt.blueGrey600()}`,borderRadius:"4px",lineHeight:3.2*parseFloat(e.spacing(1))+"px",color:Qt.text()},"&.custom":{display:"initial"}})),Zt=Kt("span")(({theme:e})=>({position:"relative",borderRadius:"4px",color:e.palette.common.black,lineHeight:3.4*parseFloat(e.spacing(1))+2+"px",padding:"2px"})),eu=Kt(Zt)(()=>({border:`${Qt.correctTertiary()} solid 2px`})),tu=Kt(Zt)(()=>({border:`${Qt.incorrectWithIcon()} solid 2px`})),uu=Kt(Zt)(()=>({border:`${Qt.incorrectWithIcon()} dashed 2px`})),ou={color:Qt.white(),position:"absolute",top:"-8px",left:"-8px",borderRadius:"50%",fontSize:"12px",padding:"2px",display:"inline-block"},nu=Kt(Jt)(()=>({...ou,backgroundColor:Qt.correctTertiary()})),su=Kt(Yt)(()=>({...ou,backgroundColor:Qt.incorrectWithIcon()})),iu=({useWrapper:e,children:t,Container:u,Icon:o})=>e?Ut.createElement(u,null,t,o?Ut.createElement(o,null):null):t;iu.propTypes={useWrapper:qt.bool,Container:qt.elementType,Icon:qt.elementType,children:qt.node};const ru={text:qt.string,selectable:qt.bool};class au extends Ut.Component{constructor(...e){super(...e),au.prototype.__init.call(this)}static __initStatic(){this.rootClassName="tokenRootClass"}static __initStatic2(){this.propTypes={...ru,text:qt.string.isRequired,className:qt.string,disabled:qt.bool,highlight:qt.bool,correct:qt.bool}}static __initStatic3(){this.defaultProps={selectable:!1,text:""}}__init(){this.getClassAndIconConfig=()=>{const{selectable:e,selected:t,className:u,disabled:o,highlight:n,correct:s,animationsDisabled:i,isMissing:r}=this.props,a="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,l=au.rootClassName;if(void 0===s&&t&&o)return{className:Gt(l,"selected","disabledBlack",u),Component:Xt};if(void 0!==s){const e=!0===s;return{className:Gt(l,"custom",u),Component:Xt,Container:e?eu:tu,Icon:e?nu:su}}return r?{className:Gt(l,"custom","missing",u),Component:Xt,Container:uu,Icon:su}:{className:Gt(l,o&&"disabled",e&&!o&&!a&&"selectable",t&&!o&&"selected",t&&o&&"disabledAndSelected",n&&e&&!o&&!t&&"highlight",i&&"print",u),Component:Xt,Container:undefined,Icon:undefined}}}render(){const{text:e,index:t,correct:u,isMissing:o}=this.props,{className:n,Component:s,Container:i,Icon:r}=this.getClassAndIconConfig(),a=s||Xt;return Ut.createElement(iu,{useWrapper:void 0!==u||o,Container:i,Icon:r},Ut.createElement(a,{className:n,dangerouslySetInnerHTML:{__html:(e||"").replace(/\n/g,"<br>")},"data-indexkey":t}))}}au.__initStatic(),au.__initStatic2(),au.__initStatic3();const lu=t,cu=u,{styled:Du}=n,{clone:pu}=i,{isEqual:du}=i;function hu(e){let t,u=e[0],o=1;for(;o<e.length;){const n=e[o],s=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==u)return;"access"===n||"optionalAccess"===n?(t=u,u=s(u)):"call"!==n&&"optionalCall"!==n||(u=s((...e)=>u.call(t,...e)),t=void 0)}return u}const gu=r("@pie-lib:text-select:token-select"),Cu=Du("div")(()=>({backgroundColor:"none",whiteSpace:"pre",cursor:"default",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",userSelect:"none","& p":{whiteSpace:"break-spaces",margin:0}})),Fu=e=>e?e.replace(/<[^>]+>/g,""):e;class fu extends lu.Component{constructor(...e){super(...e),fu.prototype.__init.call(this),fu.prototype.__init2.call(this),fu.prototype.__init3.call(this),fu.prototype.__init4.call(this)}static __initStatic(){this.propTypes={tokens:cu.arrayOf(cu.shape(ru)).isRequired,className:cu.string,onChange:cu.func.isRequired,disabled:cu.bool,highlightChoices:cu.bool,animationsDisabled:cu.bool,maxNoOfSelections:cu.number}}static __initStatic2(){this.defaultProps={highlightChoices:!1,maxNoOfSelections:0,tokens:[]}}__init(){this.selectedCount=()=>this.props.tokens.filter(e=>e.selected).length}__init2(){this.canSelectMore=e=>{const{maxNoOfSelections:t}=this.props;return 1===t||(gu("[canSelectMore] maxNoOfSelections: ",t,"selectedCount: ",e),t<=0||isFinite(t)&&e<t)}}__init3(){this.toggleToken=e=>{const{target:t}=e,{tokens:u,animationsDisabled:o}=this.props,n=pu(u),s=hu([t,"access",e=>e.closest,"optionalCall",e=>e(`.${au.rootClassName}`)]),i=hu([s,"optionalAccess",e=>e.dataset,"optionalAccess",e=>e.indexkey]),r=void 0!==i?n[i]:void 0;if(r&&void 0===r.correct&&!o&&!r.isMissing){const{onChange:e,maxNoOfSelections:t}=this.props,o=!r.selected;if(1===t&&1===this.selectedCount()){const t=(u||[]).filter(e=>e.selected),s=n.map(e=>du(e,t[0])?{...e,selected:!1}:{...e,selectable:!0}),a={...r,selected:o};s.splice(i,1,a),e(s)}else{if(o&&t>0&&this.selectedCount()>=t)return void gu("skip toggle max reached");const u={...r,selected:o};n.splice(i,1,u),e(n)}}}}__init4(){this.generateTokensNodes=()=>{const{tokens:e,disabled:t,highlightChoices:u,animationsDisabled:o}=this.props,n=this.selectedCount(),s=[];let i=[];const r=()=>{s.push(lu.createElement("p",{key:`p-${s.length}`},i)),i=[]};return(e||[]).forEach((e,s)=>{const a=e.selected||e.selectable&&this.canSelectMore(n),l=void 0!==e.correct&&(e.selectable||e.selected);"\n\n"!==e.text?(e=>"\n"===e)(e.text)?i.push(lu.createElement("br",{key:`br-${s}`})):a&&!t||l||e.selected||e.isMissing||o&&e.predefined?i.push(lu.createElement(au,{key:s,disabled:t,index:s,...e,text:Fu(e.text),selectable:a,highlight:u,animationsDisabled:o})):i.push(lu.createElement(lu.Fragment,{key:s},Fu(e.text))):r()}),r(),s}}render(){const{className:e}=this.props,t=this.generateTokensNodes();return lu.createElement(Cu,{className:e,onClick:this.toggleToken},t)}}fu.__initStatic(),fu.__initStatic2();const Eu=t,Au=u,mu=r("@pie-lib:text-select");class yu extends Eu.Component{constructor(...e){super(...e),yu.prototype.__init.call(this)}static __initStatic(){this.propTypes={onChange:Au.func,disabled:Au.bool,tokens:Au.arrayOf(Au.shape(ru)).isRequired,selectedTokens:Au.arrayOf(Au.shape(ru)).isRequired,text:Au.string.isRequired,className:Au.string,highlightChoices:Au.bool,animationsDisabled:Au.bool,maxNoOfSelections:Au.number}}__init(){this.change=e=>{const{onChange:t}=this.props;if(!t)return;t(e.filter(e=>e.selected).map(e=>({start:e.start,end:e.end})))}}render(){const{text:e,disabled:t,tokens:u,selectedTokens:o,className:n,highlightChoices:s,maxNoOfSelections:i,animationsDisabled:r}=this.props,a=bt(e,u);mu("normalized: ",a);const l=a.map(e=>{const u=-1!==o.findIndex(t=>t.start===e.start&&t.end===e.end),n=u?e.correct:void 0,s=e.isMissing;return{...e,selectable:!t&&e.predefined,selected:u,correct:n,isMissing:s}});return Eu.createElement(fu,{highlightChoices:!t&&s,className:n,tokens:l,disabled:t,onChange:this.change,maxNoOfSelections:i,animationsDisabled:r})}}function Bu(e,t){return null!=e?e:t()}function bu(e){let t,u=e[0],o=1;for(;o<e.length;){const n=e[o],s=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==u)return;"access"===n||"optionalAccess"===n?(t=u,u=s(u)):"call"!==n&&"optionalCall"!==n||(u=s((...e)=>u.call(t,...e)),t=void 0)}return u}yu.__initStatic();const xu=e=>"string"==typeof e,Su=()=>{let e,t;const u=new Promise((u,o)=>{e=u,t=o});return u.resolve=e,u.reject=t,u},vu=e=>null==e?"":""+e,ku=/###/g,wu=e=>e&&e.indexOf("###")>-1?e.replace(ku,"."):e,Nu=e=>!e||xu(e),_u=(e,t,u)=>{const o=xu(t)?t.split("."):t;let n=0;for(;n<o.length-1;){if(Nu(e))return{};const t=wu(o[n]);!e[t]&&u&&(e[t]=new u),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++n}return Nu(e)?{}:{obj:e,k:wu(o[n])}},Lu=(e,t,u)=>{const{obj:o,k:n}=_u(e,t,Object);if(void 0!==o||1===t.length)return void(o[n]=u);let s=t[t.length-1],i=t.slice(0,t.length-1),r=_u(e,i,Object);for(;void 0===r.obj&&i.length;)s=`${i[i.length-1]}.${s}`,i=i.slice(0,i.length-1),r=_u(e,i,Object),bu([r,"optionalAccess",e=>e.obj])&&void 0!==r.obj[`${r.k}.${s}`]&&(r.obj=void 0);r.obj[`${r.k}.${s}`]=u},Ou=(e,t)=>{const{obj:u,k:o}=_u(e,t);if(u&&Object.prototype.hasOwnProperty.call(u,o))return u[o]},Ru=(e,t,u)=>{for(const o in t)"__proto__"!==o&&"constructor"!==o&&(o in e?xu(e[o])||e[o]instanceof String||xu(t[o])||t[o]instanceof String?u&&(e[o]=t[o]):Ru(e[o],t[o],u):e[o]=t[o]);return e},Pu=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var $u={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Tu=e=>xu(e)?e.replace(/[&<>"'\/]/g,e=>$u[e]):e;const Mu=[" ",",","?","!",";"],Iu=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const u=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,u),this.regExpQueue.push(e),u}}(20),ju=(e,t,u=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const o=t.split(u);let n=e;for(let e=0;e<o.length;){if(!n||"object"!=typeof n)return;let t,s="";for(let i=e;i<o.length;++i)if(i!==e&&(s+=u),s+=o[i],t=n[s],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&i<o.length-1)continue;e+=i-e+1;break}n=t}return n},zu=e=>bu([e,"optionalAccess",e=>e.replace,"call",e=>e("_","-")]),Wu={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){bu([console,"optionalAccess",t=>t[e],"optionalAccess",e=>e.apply,"optionalCall",e=>e(console,t)])}};class Hu{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Wu,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,u,o){return o&&!this.debug?null:(xu(e[0])&&(e[0]=`${u}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Hu(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new Hu(this.logger,e)}}var Vu=new Hu;class Uu{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const u=this.observers[e].get(t)||0;this.observers[e].set(t,u+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,u])=>{for(let o=0;o<u;o++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([u,o])=>{for(let n=0;n<o;n++)u.apply(u,[e,...t])})}}}class qu extends Uu{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,u,o={}){const n=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,s=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let i;e.indexOf(".")>-1?i=e.split("."):(i=[e,t],u&&(Array.isArray(u)?i.push(...u):xu(u)&&n?i.push(...u.split(n)):i.push(u)));const r=Ou(this.data,i);return!r&&!t&&!u&&e.indexOf(".")>-1&&(e=i[0],t=i[1],u=i.slice(2).join(".")),!r&&s&&xu(u)?ju(bu([this,"access",e=>e.data,"optionalAccess",t=>t[e],"optionalAccess",e=>e[t]]),u,n):r}addResource(e,t,u,o,n={silent:!1}){const s=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let i=[e,t];u&&(i=i.concat(s?u.split(s):u)),e.indexOf(".")>-1&&(i=e.split("."),o=t,t=i[1]),this.addNamespaces(t),Lu(this.data,i,o),n.silent||this.emit("added",e,t,u,o)}addResources(e,t,u,o={silent:!1}){for(const o in u)(xu(u[o])||Array.isArray(u[o]))&&this.addResource(e,t,o,u[o],{silent:!0});o.silent||this.emit("added",e,t,u)}addResourceBundle(e,t,u,o,n,s={silent:!1,skipCopy:!1}){let i=[e,t];e.indexOf(".")>-1&&(i=e.split("."),o=u,u=t,t=i[1]),this.addNamespaces(t);let r=Ou(this.data,i)||{};s.skipCopy||(u=JSON.parse(JSON.stringify(u))),o?Ru(r,u,n):r={...r,...u},Lu(this.data,i,r),s.silent||this.emit("added",e,t,u)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var Ku={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,u,o,n){return e.forEach(e=>{t=Bu(bu([this,"access",e=>e.processors,"access",t=>t[e],"optionalAccess",e=>e.process,"call",e=>e(t,u,o,n)]),()=>t)}),t}};const Gu=Symbol("i18next/PATH_KEY");function Ju(e,t){const{[Gu]:u}=e(function(){const e=[],t=Object.create(null);let u;return t.get=(o,n)=>(bu([u,"optionalAccess",e=>e.revoke,"optionalCall",e=>e()]),n===Gu?e:(e.push(n),u=Proxy.revocable(o,t),u.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return u.join(Bu(bu([t,"optionalAccess",e=>e.keySeparator]),()=>"."))}const Yu={},Qu=e=>!xu(e)&&"boolean"!=typeof e&&"number"!=typeof e;class Xu extends Uu{constructor(e,t={}){var u,o;super(),u=e,o=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{u[e]&&(o[e]=u[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Vu.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const u={...t};if(null==e)return!1;const o=this.resolve(e,u);if(void 0===bu([o,"optionalAccess",e=>e.res]))return!1;const n=Qu(o.res);return!1!==u.returnObjects||!n}extractFromKey(e,t){let u=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===u&&(u=":");const o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const s=u&&e.indexOf(u)>-1,i=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,u)=>{t=t||"",u=u||"";const o=Mu.filter(e=>t.indexOf(e)<0&&u.indexOf(e)<0);if(0===o.length)return!0;const n=Iu.getRegExp(`(${o.map(e=>"?"===e?"\\?":e).join("|")})`);let s=!n.test(e);if(!s){const t=e.indexOf(u);t>0&&!n.test(e.substring(0,t))&&(s=!0)}return s})(e,u,o));if(s&&!i){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:xu(n)?[n]:n};const s=e.split(u);(u!==o||u===o&&this.options.ns.indexOf(s[0])>-1)&&(n=s.shift()),e=s.join(o)}return{key:e,namespaces:xu(n)?[n]:n}}translate(e,t,u){let o="object"==typeof t?{...t}:t;if("object"!=typeof o&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof o&&(o={...o}),o||(o={}),null==e)return"";"function"==typeof e&&(e=Ju(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const n=void 0!==o.returnDetails?o.returnDetails:this.options.returnDetails,s=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,{key:i,namespaces:r}=this.extractFromKey(e[e.length-1],o),a=r[r.length-1];let l=void 0!==o.nsSeparator?o.nsSeparator:this.options.nsSeparator;void 0===l&&(l=":");const c=o.lng||this.language,D=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===bu([c,"optionalAccess",e=>e.toLowerCase,"call",e=>e()]))return D?n?{res:`${a}${l}${i}`,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:a,usedParams:this.getUsedParamsDetails(o)}:`${a}${l}${i}`:n?{res:i,usedKey:i,exactUsedKey:i,usedLng:c,usedNS:a,usedParams:this.getUsedParamsDetails(o)}:i;const p=this.resolve(e,o);let d=bu([p,"optionalAccess",e=>e.res]);const h=bu([p,"optionalAccess",e=>e.usedKey])||i,g=bu([p,"optionalAccess",e=>e.exactUsedKey])||i,C=void 0!==o.joinArrays?o.joinArrays:this.options.joinArrays,F=!this.i18nFormat||this.i18nFormat.handleAsObject,f=void 0!==o.count&&!xu(o.count),E=Xu.hasDefaultValue(o),A=f?this.pluralResolver.getSuffix(c,o.count,o):"",m=o.ordinal&&f?this.pluralResolver.getSuffix(c,o.count,{ordinal:!1}):"",y=f&&!o.ordinal&&0===o.count,B=y&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${A}`]||o[`defaultValue${m}`]||o.defaultValue;let b=d;F&&!d&&E&&(b=B);const x=Qu(b),S=Object.prototype.toString.apply(b);if(!(F&&b&&x&&["[object Number]","[object Function]","[object RegExp]"].indexOf(S)<0)||xu(C)&&Array.isArray(b))if(F&&xu(C)&&Array.isArray(d))d=d.join(C),d&&(d=this.extendTranslation(d,e,o,u));else{let t=!1,n=!1;!this.isValidLookup(d)&&E&&(t=!0,d=B),this.isValidLookup(d)||(n=!0,d=i);const r=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:d,D=E&&B!==d&&this.options.updateMissing;if(n||t||D){if(this.logger.log(D?"updateKey":"missingKey",c,a,i,D?B:d),s){const e=this.resolve(i,{...o,keySeparator:!1});e&&e.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 e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let u=0;u<t.length;u++)e.push(t[u]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(o.lng||this.language):e.push(o.lng||this.language);const u=(e,t,u)=>{const n=E&&u!==d?u:r;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,t,n,D,o):bu([this,"access",e=>e.backendConnector,"optionalAccess",e=>e.saveMissing])&&this.backendConnector.saveMissing(e,a,t,n,D,o),this.emit("missingKey",e,a,t,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&f?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,o);y&&o[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{u([e],i+t,o[`defaultValue${t}`]||B)})}):u(e,i,B))}d=this.extendTranslation(d,e,o,p,u),n&&d===i&&this.options.appendNamespaceToMissingKey&&(d=`${a}${l}${i}`),(n||t)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}${l}${i}`:i,t?d:void 0,o))}else{if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,b,{...o,ns:r}):`key '${i} (${this.language})' returned an object instead of string.`;return n?(p.res=e,p.usedParams=this.getUsedParamsDetails(o),p):e}if(s){const e=Array.isArray(b),t=e?[]:{},u=e?g:h;for(const e in b)if(Object.prototype.hasOwnProperty.call(b,e)){const n=`${u}${s}${e}`;t[e]=E&&!d?this.translate(n,{...o,defaultValue:Qu(B)?B[e]:void 0,joinArrays:!1,ns:r}):this.translate(n,{...o,joinArrays:!1,ns:r}),t[e]===n&&(t[e]=b[e])}d=t}}return n?(p.res=d,p.usedParams=this.getUsedParamsDetails(o),p):d}extendTranslation(e,t,u,o,n){if(bu([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.parse]))e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...u},u.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!u.skipInterpolation){u.interpolation&&this.interpolator.init({...u,interpolation:{...this.options.interpolation,...u.interpolation}});const s=xu(e)&&(void 0!==bu([u,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?u.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(s){const t=e.match(this.interpolator.nestingRegexp);i=t&&t.length}let r=u.replace&&!xu(u.replace)?u.replace:u;if(this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),e=this.interpolator.interpolate(e,r,u.lng||this.language||o.usedLng,u),s){const t=e.match(this.interpolator.nestingRegexp);i<(t&&t.length)&&(u.nest=!1)}!u.lng&&o&&o.res&&(u.lng=this.language||o.usedLng),!1!==u.nest&&(e=this.interpolator.nest(e,(...e)=>bu([n,"optionalAccess",e=>e[0]])!==e[0]||u.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),u)),u.interpolation&&this.interpolator.reset()}const s=u.postProcess||this.options.postProcess,i=xu(s)?[s]:s;return null!=e&&bu([i,"optionalAccess",e=>e.length])&&!1!==u.applyPostProcessor&&(e=Ku.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(u)},...u}:u,this)),e}resolve(e,t={}){let u,o,n,s,i;return xu(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(u))return;const r=this.extractFromKey(e,t),a=r.key;o=a;let l=r.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));const c=void 0!==t.count&&!xu(t.count),D=c&&!t.ordinal&&0===t.count,p=void 0!==t.context&&(xu(t.context)||"number"==typeof t.context)&&""!==t.context,d=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(u)||(i=e,Yu[`${d[0]}-${e}`]||!bu([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||bu([this,"access",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(i)])||(Yu[`${d[0]}-${e}`]=!0,this.logger.warn(`key "${o}" for languages "${d.join(", ")}" won't get resolved as namespace "${i}" 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!!!")),d.forEach(o=>{if(this.isValidLookup(u))return;s=o;const i=[a];if(bu([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.addLookupKeys]))this.i18nFormat.addLookupKeys(i,a,o,e,t);else{let e;c&&(e=this.pluralResolver.getSuffix(o,t.count,t));const u=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(t.ordinal&&0===e.indexOf(n)&&i.push(a+e.replace(n,this.options.pluralSeparator)),i.push(a+e),D&&i.push(a+u)),p){const o=`${a}${this.options.contextSeparator||"_"}${t.context}`;i.push(o),c&&(t.ordinal&&0===e.indexOf(n)&&i.push(o+e.replace(n,this.options.pluralSeparator)),i.push(o+e),D&&i.push(o+u))}}let r;for(;r=i.pop();)this.isValidLookup(u)||(n=r,u=this.getResource(o,e,r,t))}))})}),{res:u,usedKey:o,exactUsedKey:n,usedLng:s,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,u,o={}){return bu([this,"access",e=>e.i18nFormat,"optionalAccess",e=>e.getResource])?this.i18nFormat.getResource(e,t,u,o):this.resourceStore.getResource(e,t,u,o)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],u=e.replace&&!xu(e.replace);let o=u?e.replace:e;if(u&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!u){o={...o};for(const e of t)delete o[e]}return o}static hasDefaultValue(e){const t="defaultValue";for(const u in e)if(Object.prototype.hasOwnProperty.call(e,u)&&t===u.substring(0,12)&&void 0!==e[u])return!0;return!1}}class Zu{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Vu.create("languageUtils")}getScriptPartFromCode(e){if(!(e=zu(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=zu(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(xu(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const u=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(u)||(t=u)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const u=this.getScriptPartFromCode(e);if(this.isSupportedCode(u))return t=u;const o=this.getLanguagePartFromCode(e);if(this.isSupportedCode(o))return t=o;t=this.options.supportedLngs.find(e=>e===o?e:e.indexOf("-")<0&&o.indexOf("-")<0?void 0:e.indexOf("-")>0&&o.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===o||0===e.indexOf(o)&&o.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),xu(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let u=e[t];return u||(u=e[this.getScriptPartFromCode(t)]),u||(u=e[this.formatLanguageCode(t)]),u||(u=e[this.getLanguagePartFromCode(t)]),u||(u=e.default),u||[]}toResolveHierarchy(e,t){const u=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),o=[],n=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return xu(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(e))):xu(e)&&n(this.formatLanguageCode(e)),u.forEach(e=>{o.indexOf(e)<0&&n(this.formatLanguageCode(e))}),o}}const eo={zero:0,one:1,two:2,few:3,many:4,other:5},to={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class uo{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Vu.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const u=zu("dev"===e?"en":e),o=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:u,type:o});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let s;try{s=new Intl.PluralRules(u,{type:o})}catch(u){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),to;if(!e.match(/-|_/))return to;const o=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(o,t)}return this.pluralRulesCache[n]=s,s}needsPlural(e,t={}){let u=this.getRule(e,t);return u||(u=this.getRule("dev",t)),bu([u,"optionalAccess",e=>e.resolvedOptions,"call",e=>e(),"access",e=>e.pluralCategories,"access",e=>e.length])>1}getPluralFormsOfKey(e,t,u={}){return this.getSuffixes(e,u).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let u=this.getRule(e,t);return u||(u=this.getRule("dev",t)),u?u.resolvedOptions().pluralCategories.sort((e,t)=>eo[e]-eo[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,u={}){const o=this.getRule(e,u);return o?`${this.options.prepend}${u.ordinal?`ordinal${this.options.prepend}`:""}${o.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,u))}}const oo=(e,t,u,o=".",n=!0)=>{let s=((e,t,u)=>{const o=Ou(e,u);return void 0!==o?o:Ou(t,u)})(e,t,u);return!s&&n&&xu(u)&&(s=ju(e,u,o),void 0===s&&(s=ju(t,u,o))),s},no=e=>e.replace(/\$/g,"$$$$");class so{constructor(e={}){this.logger=Vu.create("interpolator"),this.options=e,this.format=bu([e,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.format])||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:u,useRawValueToEscape:o,prefix:n,prefixEscaped:s,suffix:i,suffixEscaped:r,formatSeparator:a,unescapeSuffix:l,unescapePrefix:c,nestingPrefix:D,nestingPrefixEscaped:p,nestingSuffix:d,nestingSuffixEscaped:h,nestingOptionsSeparator:g,maxReplaces:C,alwaysFormat:F}=e.interpolation;this.escape=void 0!==t?t:Tu,this.escapeValue=void 0===u||u,this.useRawValueToEscape=void 0!==o&&o,this.prefix=n?Pu(n):s||"{{",this.suffix=i?Pu(i):r||"}}",this.formatSeparator=a||",",this.unescapePrefix=l?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":l||"",this.nestingPrefix=D?Pu(D):p||Pu("$t("),this.nestingSuffix=d?Pu(d):h||Pu(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=C||1e3,this.alwaysFormat=void 0!==F&&F,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>bu([e,"optionalAccess",e=>e.source])===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,u,o){let n,s,i;const r=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},a=e=>{if(e.indexOf(this.formatSeparator)<0){const n=oo(t,r,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,u,{...o,...t,interpolationkey:e}):n}const n=e.split(this.formatSeparator),s=n.shift().trim(),i=n.join(this.formatSeparator).trim();return this.format(oo(t,r,s,this.options.keySeparator,this.options.ignoreJSONStructure),i,u,{...o,...t,interpolationkey:s})};this.resetRegExp();const l=bu([o,"optionalAccess",e=>e.missingInterpolationHandler])||this.options.missingInterpolationHandler,c=void 0!==bu([o,"optionalAccess",e=>e.interpolation,"optionalAccess",e=>e.skipOnVariables])?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>no(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?no(this.escape(e)):no(e)}].forEach(t=>{for(i=0;n=t.regex.exec(e);){const u=n[1].trim();if(s=a(u),void 0===s)if("function"==typeof l){const t=l(e,n,o);s=xu(t)?t:""}else if(o&&Object.prototype.hasOwnProperty.call(o,u))s="";else{if(c){s=n[0];continue}this.logger.warn(`missed to pass in variable ${u} for interpolating ${e}`),s=""}else xu(s)||this.useRawValueToEscape||(s=vu(s));const r=t.safeValue(s);if(e=e.replace(n[0],r),c?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=n[0].length):t.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,t,u={}){let o,n,s;const i=(e,t)=>{const u=this.nestingOptionsSeparator;if(e.indexOf(u)<0)return e;const o=e.split(new RegExp(`${u}[ ]*{`));let n=`{${o[1]}`;e=o[0],n=this.interpolate(n,s);const i=n.match(/'/g),r=n.match(/"/g);(Bu(bu([i,"optionalAccess",e=>e.length]),()=>0)%2==0&&!r||r.length%2!=0)&&(n=n.replace(/'/g,'"'));try{s=JSON.parse(n),t&&(s={...t,...s})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${u}${n}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let r=[];s={...u},s=s.replace&&!xu(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;const a=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(-1!==a&&(r=o[1].slice(a).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),o[1]=o[1].slice(0,a)),n=t(i.call(this,o[1].trim(),s),s),n&&o[0]===e&&!xu(n))return n;xu(n)||(n=vu(n)),n||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),n=""),r.length&&(n=r.reduce((e,t)=>this.format(e,t,u.lng,{...u,interpolationkey:o[1].trim()}),n.trim())),e=e.replace(o[0],n),this.regexp.lastIndex=0}return e}}const io=e=>{const t={};return(u,o,n)=>{let s=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(s={...s,[n.interpolationkey]:void 0});const i=o+JSON.stringify(s);let r=t[i];return r||(r=e(zu(o),n),t[i]=r),r(u)}},ro=e=>(t,u,o)=>e(zu(u),o)(t);class ao{constructor(e={}){this.logger=Vu.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const u=t.cacheInBuiltFormats?io:ro;this.formats={number:u((e,t)=>{const u=new Intl.NumberFormat(e,{...t});return e=>u.format(e)}),currency:u((e,t)=>{const u=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>u.format(e)}),datetime:u((e,t)=>{const u=new Intl.DateTimeFormat(e,{...t});return e=>u.format(e)}),relativetime:u((e,t)=>{const u=new Intl.RelativeTimeFormat(e,{...t});return e=>u.format(e,t.range||"day")}),list:u((e,t)=>{const u=new Intl.ListFormat(e,{...t});return e=>u.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=io(t)}format(e,t,u,o={}){const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find(e=>e.indexOf(")")>-1)){const e=n.findIndex(e=>e.indexOf(")")>-1);n[0]=[n[0],...n.splice(1,e)].join(this.formatSeparator)}return n.reduce((e,t)=>{const{formatName:n,formatOptions:s}=(e=>{let t=e.toLowerCase().trim();const u={};if(e.indexOf("(")>-1){const o=e.split("(");t=o[0].toLowerCase().trim();const n=o[1].substring(0,o[1].length-1);"currency"===t&&n.indexOf(":")<0?u.currency||(u.currency=n.trim()):"relativetime"===t&&n.indexOf(":")<0?u.range||(u.range=n.trim()):n.split(";").forEach(e=>{if(e){const[t,...o]=e.split(":"),n=o.join(":").trim().replace(/^'+|'+$/g,""),s=t.trim();u[s]||(u[s]=n),"false"===n&&(u[s]=!1),"true"===n&&(u[s]=!0),isNaN(n)||(u[s]=parseInt(n,10))}})}return{formatName:t,formatOptions:u}})(t);if(this.formats[n]){let t=e;try{const i=bu([o,"optionalAccess",e=>e.formatParams,"optionalAccess",e=>e[o.interpolationkey]])||{},r=i.locale||i.lng||o.locale||o.lng||u;t=this.formats[n](e,r,{...s,...o,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${n}`),e},e)}}class lo extends Uu{constructor(e,t,u,o={}){super(),this.backend=e,this.store=t,this.services=u,this.languageUtils=u.languageUtils,this.options=o,this.logger=Vu.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],bu([this,"access",e=>e.backend,"optionalAccess",e=>e.init,"optionalCall",e=>e(u,o.backend,o)])}queueLoad(e,t,u,o){const n={},s={},i={},r={};return e.forEach(e=>{let o=!0;t.forEach(t=>{const i=`${e}|${t}`;!u.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===s[i]&&(s[i]=!0):(this.state[i]=1,o=!1,void 0===s[i]&&(s[i]=!0),void 0===n[i]&&(n[i]=!0),void 0===r[t]&&(r[t]=!0)))}),o||(i[e]=!0)}),(Object.keys(n).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(n),pending:Object.keys(s),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(r)}}loaded(e,t,u){const o=e.split("|"),n=o[0],s=o[1];t&&this.emit("failedLoading",n,s,t),!t&&u&&this.store.addResourceBundle(n,s,u,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&u&&(this.state[e]=0);const i={};this.queue.forEach(u=>{((e,t,u)=>{const{obj:o,k:n}=_u(e,t,Object);o[n]=o[n]||[],o[n].push(u)})(u.loaded,[n],s),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(u,e),t&&u.errors.push(t),0!==u.pendingCount||u.done||(Object.keys(u.loaded).forEach(e=>{i[e]||(i[e]={});const t=u.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,u,o=0,n=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:u,tried:o,wait:n,callback:s});this.readingCalls++;const i=(i,r)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&r&&o<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,u,o+1,2*n,s)},n):s(i,r)},r=this.backend[u].bind(this.backend);if(2!==r.length)return r(e,t,i);try{const u=r(e,t);u&&"function"==typeof u.then?u.then(e=>i(null,e)).catch(i):i(null,u)}catch(e){i(e)}}prepareLoading(e,t,u={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();xu(e)&&(e=this.languageUtils.toResolveHierarchy(e)),xu(t)&&(t=[t]);const n=this.queueLoad(e,t,u,o);if(!n.toLoad.length)return n.pending.length||o(),null;n.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,u){this.prepareLoading(e,t,{},u)}reload(e,t,u){this.prepareLoading(e,t,{reload:!0},u)}loadOne(e,t=""){const u=e.split("|"),o=u[0],n=u[1];this.read(o,n,"read",void 0,void 0,(u,s)=>{u&&this.logger.warn(`${t}loading namespace ${n} for language ${o} failed`,u),!u&&s&&this.logger.log(`${t}loaded namespace ${n} for language ${o}`,s),this.loaded(e,u,s)})}saveMissing(e,t,u,o,n,s={},i=()=>{}){if(!bu([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace])||bu([this,"access",e=>e.services,"optionalAccess",e=>e.utils,"optionalAccess",e=>e.hasLoadedNamespace,"call",e=>e(t)])){if(null!=u&&""!==u){if(bu([this,"access",e=>e.backend,"optionalAccess",e=>e.create])){const r={...s,isUpdate:n},a=this.backend.create.bind(this.backend);if(a.length<6)try{let n;n=5===a.length?a(e,t,u,o,r):a(e,t,u,o),n&&"function"==typeof n.then?n.then(e=>i(null,e)).catch(i):i(null,n)}catch(e){i(e)}else a(e,t,u,o,i,r)}e&&e[0]&&this.store.addResource(e[0],t,u,o)}}else this.logger.warn(`did not save key "${u}" as the namespace "${t}" 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!!!")}}const co=()=>({debug:!1,initAsync:!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:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),xu(e[1])&&(t.defaultValue=e[1]),xu(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const u=e[3]||e[2];Object.keys(u).forEach(e=>{t[e]=u[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Do=e=>(xu(e.ns)&&(e.ns=[e.ns]),xu(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),xu(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),bu([e,"access",e=>e.supportedLngs,"optionalAccess",e=>e.indexOf,"optionalCall",e=>e("cimode")])<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),po=()=>{};class ho extends Uu{constructor(e={},t){var u;if(super(),this.options=Do(e),this.services={},this.logger=Vu,this.modules={external:[]},u=this,Object.getOwnPropertyNames(Object.getPrototypeOf(u)).forEach(e=>{"function"==typeof u[e]&&(u[e]=u[e].bind(u))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(xu(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const u=co();var o;this.options={...u,...this.options,...Do(e)},this.options.interpolation={...u.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=u.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||(bu([o=this,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||bu([o,"optionalAccess",e=>e.modules,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"optionalAccess",e=>e.indexOf,"call",e=>e("Locize")])>0||bu([o,"optionalAccess",e=>e.options,"optionalAccess",e=>e.backend,"optionalAccess",e=>e.backends])&&o.options.backend.backends.some(e=>bu([e,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0||bu([e,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name,"access",e=>e.indexOf,"call",e=>e("Locize")])>0))||"undefined"!=typeof console&&void 0!==console.info&&console.info("🌐 i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙");const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?Vu.init(n(this.modules.logger),this.options):Vu.init(null,this.options),e=this.modules.formatter?this.modules.formatter:ao;const t=new Zu(this.options);this.store=new qu(this.options.resources,this.options);const o=this.services;o.logger=Vu,o.resourceStore=this.store,o.languageUtils=t,o.pluralResolver=new uo(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==u.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==u.interpolation.format||(o.formatter=n(e),o.formatter.init&&o.formatter.init(o,this.options),this.options.interpolation.format=o.formatter.format.bind(o.formatter)),o.interpolator=new so(this.options),o.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},o.backendConnector=new lo(n(this.modules.backend),o.resourceStore,o,this.options),o.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(o.languageDetector=n(this.modules.languageDetector),o.languageDetector.init&&o.languageDetector.init(o,this.options.detection,this.options)),this.modules.i18nFormat&&(o.i18nFormat=n(this.modules.i18nFormat),o.i18nFormat.init&&o.i18nFormat.init(this)),this.translator=new Xu(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=po),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[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(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const s=Su(),i=()=>{const e=(e,u)=>{this.isInitializing=!1,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),s.resolve(u),t(e,u)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?i():setTimeout(i,0),s}loadResources(e,t=po){let u=t;const o=xu(e)?e:this.language;if("function"==typeof e&&(u=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===bu([o,"optionalAccess",e=>e.toLowerCase,"call",e=>e()])&&(!this.options.preload||0===this.options.preload.length))return u();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(o)t(o);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}bu([this,"access",e=>e.options,"access",e=>e.preload,"optionalAccess",e=>e.forEach,"optionalCall",e=>e(e=>t(e))]),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),u(e)})}else u(null)}reloadResources(e,t,u){const o=Su();return"function"==typeof e&&(u=e,e=void 0),"function"==typeof t&&(u=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),u||(u=po),this.services.backendConnector.reload(e,t,e=>{o.resolve(),u(e)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Ku.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const u=Su();this.emit("languageChanging",e);const o=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},n=(n,s)=>{s?this.isLanguageChangingTo===e&&(o(s),this.translator.changeLanguage(s),this.isLanguageChangingTo=void 0,this.emit("languageChanged",s),this.logger.log("languageChanged",s)):this.isLanguageChangingTo=void 0,u.resolve((...e)=>this.t(...e)),t&&t(n,(...e)=>this.t(...e))},s=t=>{e||t||!this.services.languageDetector||(t=[]);const u=xu(t)?t:t&&t[0],s=this.store.hasLanguageSomeTranslations(u)?u:this.services.languageUtils.getBestMatchFromCodes(xu(t)?[t]:t);s&&(this.language||o(s),this.translator.language||this.translator.changeLanguage(s),bu([this,"access",e=>e.services,"access",e=>e.languageDetector,"optionalAccess",e=>e.cacheUserLanguage,"optionalCall",e=>e(s)])),this.loadResources(s,e=>{n(e,s)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e):s(this.services.languageDetector.detect()),u}getFixedT(e,t,u){const o=(e,t,...n)=>{let s;s="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(n)):{...t},s.lng=s.lng||o.lng,s.lngs=s.lngs||o.lngs,s.ns=s.ns||o.ns,""!==s.keyPrefix&&(s.keyPrefix=s.keyPrefix||u||o.keyPrefix);const i=this.options.keySeparator||".";let r;return s.keyPrefix&&Array.isArray(e)?r=e.map(e=>("function"==typeof e&&(e=Ju(e,{...this.options,...t})),`${s.keyPrefix}${i}${e}`)):("function"==typeof e&&(e=Ju(e,{...this.options,...t})),r=s.keyPrefix?`${s.keyPrefix}${i}${e}`:e),this.t(r,s)};return xu(e)?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=u,o}t(...e){return bu([this,"access",e=>e.translator,"optionalAccess",e=>e.translate,"call",t=>t(...e)])}exists(...e){return bu([this,"access",e=>e.translator,"optionalAccess",e=>e.exists,"call",t=>t(...e)])}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){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 u=t.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===u.toLowerCase())return!0;const s=(e,t)=>{const u=this.services.backendConnector.state[`${e}|${t}`];return-1===u||0===u||2===u};if(t.precheck){const e=t.precheck(this,s);if(void 0!==e)return e}return!!this.hasResourceBundle(u,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(u,e)||o&&!s(n,e)))}loadNamespaces(e,t){const u=Su();return this.options.ns?(xu(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{u.resolve(),t&&t(e)}),u):(t&&t(),Promise.resolve())}loadLanguages(e,t){const u=Su();xu(e)&&(e=[e]);const o=this.options.preload||[],n=e.filter(e=>o.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return n.length?(this.options.preload=o.concat(n),this.loadResources(e=>{u.resolve(),t&&t(e)}),u):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(bu([this,"access",e=>e.languages,"optionalAccess",e=>e.length])>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=bu([this,"access",e=>e.services,"optionalAccess",e=>e.languageUtils])||new Zu(co());return e.toLowerCase().indexOf("-latn")>1?"ltr":["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"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const u=new ho(e,t);return u.createInstance=ho.createInstance,u}cloneInstance(e={},t=po){const u=e.forkResourceStore;u&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},n=new ho(o);void 0===e.debug&&void 0===e.prefix||(n.logger=n.logger.clone(e));if(["store","services","language"].forEach(e=>{n[e]=this[e]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},u){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((u,o)=>(u[o]={...e[t][o]},u),e[t]),e),{});n.store=new qu(e,o),n.services.resourceStore=n.store}if(e.interpolation){const t={...co().interpolation,...this.options.interpolation,...e.interpolation},u={...o,interpolation:t};n.services.interpolator=new so(u)}return n.translator=new Xu(n.services,o),n.translator.on("*",(e,...t)=>{n.emit(e,...t)}),n.init(o,t),n.translator.options=o,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const go=ho.createInstance();go.createInstance,go.dir,go.init,go.loadResources,go.reloadResources,go.use,go.changeLanguage,go.getFixedT,go.t,go.exists,go.setDefaultNamespace,go.hasLoadedNamespace,go.loadNamespaces,go.loadLanguages;go.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{primaryCorrectWithAlternates:"Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",commonCorrectAnswerWithAlternates:"Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{primaryCorrectWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",commonCorrectAnswerWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var Co={translator:{...go,t:(e,t)=>{const{lng:u}=t;switch(u){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return go.t(e,{lng:u,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const Fo=t,{styled:fo}=n,{Check:Eo}=l,{Close:Ao}=l,{color:mo}=s,{translator:yo}=Co,Bo=fo("div")(({theme:e})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:e.spacing(2),borderBottom:"1px solid lightgrey",borderTop:"1px solid lightgrey",paddingBottom:e.spacing(1),paddingTop:e.spacing(1),marginBottom:e.spacing(1)})),bo=fo("span")(({theme:e})=>({fontSize:"14px",fontWeight:"bold",color:mo.black(),marginLeft:e.spacing(1)})),xo=fo("div")(()=>({position:"relative",padding:"4px",fontSize:"14px",borderRadius:"4px"})),So=fo(xo)(()=>({border:`${mo.correctTertiary()} solid 2px`})),vo=fo(xo)(()=>({border:`${mo.incorrectWithIcon()} solid 2px`})),ko=fo(xo)(()=>({border:`${mo.incorrectWithIcon()} dashed 2px`})),wo={color:mo.white(),position:"absolute",top:"-8px",left:"-8px",borderRadius:"50%",fontSize:"12px",padding:"2px"},No=fo(Eo)(()=>({...wo,backgroundColor:mo.correctTertiary()})),_o=fo(Ao)(()=>({...wo,backgroundColor:mo.incorrectWithIcon()})),Lo=({language:e,showOnlyCorrect:t})=>{const u=[{Icon:No,label:yo.t("selectText.correctAnswerSelected",{lng:e}),Container:So},{Icon:_o,label:yo.t("selectText.incorrectSelection",{lng:e}),Container:vo},{Icon:_o,label:yo.t("selectText.correctAnswerNotSelected",{lng:e}),Container:ko}];return t&&u.splice(1,2),Fo.createElement(Bo,null,Fo.createElement(bo,null,yo.t("selectText.key",{lng:e})),u.map(({Icon:e,label:t,Container:u},o)=>Fo.createElement(u,{key:o},Fo.createElement(e,null),Fo.createElement("span",null,t))))};var Oo=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("div");return t.innerHTML=e.trim(),t}(e),u=document.createElement("div");return u.innerHTML="<div separator='true'>".concat(t.innerHTML,"</div>"),t=u,0===Array.from(t.querySelectorAll("*")).length?e:function(e){var t=e.querySelectorAll("div[separator=true]"),u="";return t.forEach(function(e,o){var n;u+=(n=e,o===t.length-1?n.innerHTML:"".concat(n.innerHTML,"\n\n"))}),u||null}(t)},Ro=e=>{if(!e)return e;const t=Oo(e.text||""),u=(e.tokens||[]).reduce((u,o={})=>{const n=Oo((e.text||"").slice(o.start,o.end));if(!n)return[...u,o];const s=u[u.length-1],i=(e=>{let u=e;for(;u>=0;){let e=t.slice(u).indexOf(n);if(e>=0)return e+u;u--}return 0})(s?s.end:o.start),r=i+n.length;return[...u,{...o,text:n,start:i,end:r,oldStart:o.start,oldEnd:o.end}]},[]);return{...e,tokens:u,text:t}};const Po=t,$o=u,To=c,{color:Mo}=s,{Feedback:Io}=s,{Collapsible:jo}=s,{hasText:zo}=s,{hasMedia:Wo}=s,{PreviewPrompt:Ho}=s,{UiLayout:Vo}=s,{styled:Uo}=n,qo=r("@pie-ui:select-text"),Ko=Uo(Vo)({color:Mo.text(),backgroundColor:Mo.background()}),Go=Uo(yu)(({theme:e})=>({marginBottom:e.spacing(1),marginTop:e.spacing(2),whiteSpace:"normal"})),Jo=Uo("div")(({theme:e})=>({verticalAlign:"middle",marginBottom:e.spacing(1)})),Yo=Uo(jo)(({theme:e})=>({marginBottom:e.spacing(2)})),Qo={model:$o.object,session:$o.object,onSelectionChange:$o.func.isRequired};class Xo extends Po.Component{static __initStatic(){this.propTypes=Qo}static __initStatic2(){this.defaultProps={}}constructor(e){super(e),Xo.prototype.__init.call(this),Xo.prototype.__init2.call(this),this.state={showCorrectAnswer:this.props.model.alwaysShowCorrect||!1,model:Ro(e.model)}}UNSAFE_componentWillReceiveProps(e){this.setState({showCorrectAnswer:!!e.model.alwaysShowCorrect,model:Ro(e.model)})}__init(){this.toggleShowCorrect=()=>{this.setState({showCorrectAnswer:!this.state.showCorrectAnswer})}}__init2(){this.correctAnswer=()=>{const{model:e}=this.state;return e.tokens.filter(e=>e.correct)}}render(){const{session:e,onSelectionChange:t}=this.props,{showCorrectAnswer:u,model:o}=this.state,{env:n,extraCSSRules:s}=o,{mode:i}=n||{},r=u?this.correctAnswer():e.selectedTokens,a=o.rationale&&(zo(o.rationale)||Wo(o.rationale)),l=o.teacherInstructions&&(zo(o.teacherInstructions)||Wo(o.teacherInstructions));return qo("[render] selectedTokens:",r),Po.createElement(Ko,{extraCSSRules:s},l&&(o.animationsDisabled?Po.createElement(Jo,null,Po.createElement(Ho,{prompt:o.teacherInstructions})):Po.createElement(Yo,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},Po.createElement(Ho,{prompt:o.teacherInstructions}))),Po.createElement(Jo,null,Po.createElement(Ho,{prompt:o.prompt})),!o.alwaysShowCorrect&&Po.createElement(To,{show:o.disabled&&o.incorrect,toggled:u,onToggle:this.toggleShowCorrect,language:o.language}),Po.createElement(Go,{disabled:o.disabled,text:o.text,tokens:o.tokens,selectedTokens:r,onChange:e=>{const u=e.map(e=>{const t=o.tokens.find(({start:t,end:u})=>e.start===t&&e.end===u);return t||e});t(u)},highlightChoices:o.highlightChoices,maxNoOfSelections:o.maxSelections,animationsDisabled:o.animationsDisabled}),"evaluate"===i&&Po.createElement(Lo,{language:o.language,showOnlyCorrect:u}),a&&(o.animationsDisabled?Po.createElement(Jo,null,Po.createElement(Ho,{prompt:o.rationale})):Po.createElement(Yo,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},Po.createElement(Ho,{prompt:o.rationale}))),o.correctness&&o.feedback&&!u&&Po.createElement(Io,{correctness:o.correctness,feedback:o.feedback}))}}Xo.__initStatic(),Xo.__initStatic2();class Zo extends Po.Component{static __initStatic3(){this.propTypes=Qo}constructor(e){super(e),Zo.prototype.__init3.call(this),this.state={model:e.model,session:e.session}}UNSAFE_componentWillReceiveProps(e){this.setState({model:e.model,session:e.session})}__init3(){this.change=e=>{const t={...this.state.session,selectedTokens:e};this.setState({session:t},()=>{this.props.onSelectionChange(this.state.session.selectedTokens)})}}render(){const{model:e,session:t}=this.state;return Po.createElement(Xo,{model:e,session:t,onSelectionChange:this.change})}}Zo.__initStatic3();const en=t,{debounce:tn}=i,un=r,{renderMath:on}=D,nn=un("pie-element:select-text:print");class sn extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session={},this._session.selectedTokens=[],this._root=null,this._rerender=tn(()=>{if(this._model&&this._session){const e=((e,t)=>{const u="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=u&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=u&&!1!==e.rationaleEnabled?e.rationale:void 0,e.showTeacherInstructions=u,e.alwaysShowCorrect=u,e.mode=u?"evaluate":e.mode,e.disabled=!0,e.animationsDisabled=!0,e.highlightChoices=!0,e.feedback=void 0,e})(this._model,this._options),t=this._options&&en.createElement(Zo,{model:e,session:{selectedTokens:[]},onSelectionChange:()=>{}});this._root||(this._root=p(this)),this._root.render(t),queueMicrotask(()=>{nn("render complete - render math"),on(this)})}else nn("skip")},50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{sn as default};