guess-the-year-web-component 2.3.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -34,6 +34,7 @@ export declare class GuessTheYear extends LitElement {
34
34
  private _answers;
35
35
  private _hint;
36
36
  private _showHint;
37
+ private _showFooter;
37
38
  private _hintsIndex;
38
39
  private _hints;
39
40
  private _solution;
@@ -1 +1 @@
1
- {"version":3,"file":"guess-the-year.d.ts","sourceRoot":"","sources":["../src/guess-the-year.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK5E,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAI9B,OAAO,EAAE,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAsBtD,qBACa,YAAa,SAAQ,UAAU;IAC1C,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,QAAQ,CAAoB;IAEpC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,OAAO,CAA0B;IAEzC,IAAI,OAAO,IAIQ,OAAO,CAFzB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAGD,UAAU,EAAE,MAAM,CAA2B;IAG7C,kBAAkB,EAAE,OAAO,CAAS;IAGpC,IAAI,EAAE,MAAM,CAAM;IAGlB,OAAO,EAAE,MAAM,CAAM;IAGrB,QAAQ,EAAE,MAAM,CAAM;IAGtB,OAAO,EAAE,MAAM,CAAM;IAGrB,MAAM,EAAE,MAAM,CAAM;IAuBpB,IAAI,EAAE,KAAK,CAA4C;IAuBvD,EAAE,EAAE,KAAK,CAAW;IAGpB,KAAK,EAAE,MAAM,CAAM;IAGnB,OAAO,EAAE,OAAO,CAAS;IAGzB,YAAY,EAAE,OAAO,CAAS;IAG9B,YAAY,EAAE,OAAO,CAAS;IAG9B,UA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_DELAY = 3000;
26
- const MIN_YEAR = 1960;
26
+ const MIN_YEAR = 1950;
27
27
  const MAX_YEAR = 2024;
28
28
  const MAX_QUESTIONS = 10;
29
29
  const HINT_COST = 2;
@@ -67,6 +67,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
67
67
  this._answers = [];
68
68
  this._hint = undefined;
69
69
  this._showHint = true;
70
+ this._showFooter = false;
70
71
  this._hintsIndex = 0;
71
72
  this._hints = [];
72
73
  this._solution = undefined;
@@ -80,7 +81,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
80
81
  this._answer = undefined;
81
82
  this._apiService = new ApiService(this.teeeApiUrl);
82
83
  this._intervalsPassed = 0;
83
- this.i18n = i18nFactory("nl-nl");
84
+ this.i18n = i18nFactory("nl");
84
85
  // private _incidentsTask: Task = new Task(this, {
85
86
  // task: async ([]) => {
86
87
  // console.debug('incidentsTask');
@@ -182,7 +183,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
182
183
  (_b = (_a = this === null || this === void 0 ? void 0 : this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(element)) === null || _b === void 0 ? void 0 : _b.style.setProperty("color", color);
183
184
  }
184
185
  // this renders the game header
185
- _renderHeader(content = "Guess the Year!") {
186
+ _renderHeader(content = this.i18n.translate("game-name")) {
186
187
  return html `
187
188
  <section id="top" class="header guess-the-year-header">
188
189
  <h1>${content}</h1>
@@ -191,16 +192,18 @@ let GuessTheYear = class GuessTheYear extends LitElement {
191
192
  }
192
193
  // this renders the game footer
193
194
  _renderFooter() {
194
- return html `
195
+ if (this._showFooter) {
196
+ return html `
195
197
  <section class="footer guess-the-year-footer">
196
198
  <div class="guess-the-year-copyright">
197
- ${"Hasslefree ©" + dayjs().year()}
199
+ ${"The Throwback Company ©" + dayjs().year()}
198
200
  </div>
199
201
  </section>
200
202
  `;
203
+ }
204
+ return html ``;
201
205
  }
202
206
  // render the splash screen
203
- // TODO: set the right logo
204
207
  renderSplashScreen() {
205
208
  console.debug("renderSplashScreen");
206
209
  // (pretend) to load before the game starts
@@ -211,10 +214,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
211
214
  <div id="splash-screen-container" class="splashscreen">
212
215
  <div class="splash-logo">
213
216
  <img
214
- src="https://breehees.nl/wp-content/uploads/2022/03/superHuub-400x400.png"
215
- alt="SuperHuub"
217
+ src="./assets/logo.png"
218
+ alt="logo"
216
219
  />
217
- <h2>${this.i18n.translate("Guess the Year")}</h2>
220
+ <h2>${this.i18n.translate("game-name")}</h2>
218
221
  <p>${this.i18n.translate("Loading...")}</p>
219
222
  </div>
220
223
  </div>
@@ -252,33 +255,26 @@ let GuessTheYear = class GuessTheYear extends LitElement {
252
255
  `);
253
256
  }
254
257
  return html `
255
- ${this._renderHeader('Welcome to "Guess the Year"')}
258
+ ${this._renderHeader(this.i18n.translate("game-introduction-welcome"))}
256
259
 
257
260
  <div class="game-intro">
258
261
  <div class="game-explanation">
259
262
  <p>
260
- Marty, such a nice name. What? Hi, Marty. He's alright. Shape up,
261
- man. You're a slacker. You wanna be a slacker for the rest of your
262
- life?
263
+ ${this.i18n.translate("game-introduction-p1")}
263
264
  </p>
264
265
 
265
266
  <p>
266
- Excuse me. Go. Go. Never mind that, never mind that now, never mind
267
- that, never mind- Yeah, well, how about my homework, McFly? Don't
268
- stop, Wilbert, drive.
267
+ ${this.i18n.translate("game-introduction-p2")}
269
268
  </p>
270
269
 
271
270
  <p>
272
- Mom, is that you? Oh. Uh Doc, uh no. No, don't be silly. What did
273
- your mother ever see in that kid? You guys, take him in back and
274
- I'll be right there. Well c'mon, this ain't no peep show.
271
+ ${this.i18n.translate("game-introduction-p3")}
275
272
  </p>
276
273
  </div>
277
274
 
278
275
  <div class="game-settings">
279
276
  <p>
280
- Right. Oh hey, Biff, hey, guys, how are you doing? Look, there's a
281
- rhythmic
277
+ ${this.i18n.translate("game-settings-p1")}
282
278
  <select
283
279
  @change="${(event) => {
284
280
  this.numberOfQuestions = Number(event.target.value);
@@ -286,20 +282,20 @@ let GuessTheYear = class GuessTheYear extends LitElement {
286
282
  >
287
283
  ${selectQuestionOptions}
288
284
  </select>
289
- vragen ceremonial ritual coming up. Vanaf begin
285
+ ${this.i18n.translate("game-settings-p2")}
290
286
  <select @change="${this._setFromDate}">
291
287
  ${this._renderYearSelectOptions(this.from.format("YYYY"))}
292
288
  </select>
293
- Precisely, just relax now Calvin. Tot eind
289
+ ${this.i18n.translate("game-settings-p3")}
294
290
  <select @change="${this._setToDate}">
295
291
  ${this._renderYearSelectOptions(this.to.format("YYYY"))}
296
292
  </select>
297
- you've got a big bruise on you're head.
293
+ ${this.i18n.translate("game-settings-p4")}
298
294
  </p>
299
295
  </div>
300
296
 
301
297
  <div class="game-start">
302
- <button @click="${this.setupNewGame}">Start</button>
298
+ <button @click="${this.setupNewGame}">${this.i18n.translate("start")}</button>
303
299
  </div>
304
300
  </div>
305
301
  `;
@@ -314,7 +310,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
314
310
  renderGameStage() {
315
311
  console.debug("renderGameStage");
316
312
  return html `
317
- ${this._renderHeader("Game On!!")}
313
+ ${this._renderHeader(this.i18n.translate("game-call-to-action"))}
318
314
  <div class="guess-the-year-game-stage">
319
315
  <div class="game-score">${this._renderGameScore()}</div>
320
316
 
@@ -374,19 +370,19 @@ let GuessTheYear = class GuessTheYear extends LitElement {
374
370
  _renderGameScore() {
375
371
  return html `
376
372
  <div class="game-score--total">
377
- <div class="game-score--label">Vraag:</div>
373
+ <div class="game-score--label">${this.i18n.translate("question-number")}:</div>
378
374
  <div class="game-score--value">
379
375
  ${this._numberOfQuestionsSeen} van ${this.numberOfQuestions}
380
376
  </div>
381
377
  </div>
382
378
 
383
379
  <div class="game-score--score">
384
- <div class="game-score--label">Score:</div>
380
+ <div class="game-score--label">${this.i18n.translate("question-score")}:</div>
385
381
  <div class="game-score--value">${this._score0.value}</div>
386
382
  </div>
387
383
 
388
384
  <div class="game-score--total">
389
- <div class="game-score--label">Totaalscore:</div>
385
+ <div class="game-score--label">${this.i18n.translate("total-score")}:</div>
390
386
  <div class="game-score--value">${this.totalScore}</div>
391
387
  </div>
392
388
  `;
@@ -422,7 +418,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
422
418
  return html `
423
419
  <div class="game-controls--hint">
424
420
  <button @click="${this._handleHintClicked}">
425
- Toon hint (${this.maxHints - this._hintsIndex})
421
+ ${this.i18n.translate("show-hint")} (${this.maxHints - this._hintsIndex})
426
422
  </button>
427
423
  </div>
428
424
  `;
@@ -465,14 +461,12 @@ let GuessTheYear = class GuessTheYear extends LitElement {
465
461
  return html `
466
462
  <div class="feedback">
467
463
  <div class="feedback--content">
468
- <h3>Correct!</h3>
464
+ <h3>${this.i18n.translate("answer-correct")}!</h3>
469
465
  <p>
470
- Je hebt ${this._hintsIndex}
471
- ${this._hintsIndex != 1 ? "hints" : "hint"} gebruikt.
466
+ ${this._hintsIndex == 1 ? this.i18n.translate("used-hint-singular") : this.i18n.translate("used-hint-plural").replace(/__HINTS__/, this._hintsIndex + '')}
472
467
  </p>
473
468
  <p>
474
- Voor deze vraag heb je ${score} ${score != 1 ? "punten" : "punt"}
475
- gehaald!
469
+ ${score == 1 ? this.i18n.translate("number-points-singular") : this.i18n.translate("number-points-plural").replace(/__POINTS__/, score + '')}
476
470
  </p>
477
471
 
478
472
  ${this._renderNextQuestionButton()}
@@ -484,10 +478,9 @@ let GuessTheYear = class GuessTheYear extends LitElement {
484
478
  return html `
485
479
  <div class="feedback">
486
480
  <div class="feedback--content">
487
- <h3>Helaas</h3>
481
+ <h3>${this.i18n.translate("answer-wrong")}</h3>
488
482
  <p>
489
- Je koos voor ${this._answer} maar het juiste antwoord was
490
- ${this._solution}
483
+ ${this.i18n.translate("correct-answer-was").replace(/__WRONG__/, this._answer + '').replace(/__CORRECT__/, this._solution + '')}
491
484
  </p>
492
485
  ${this._renderNextQuestionButton()}
493
486
  </div>
@@ -500,8 +493,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
500
493
  <div class="feedback--content">
501
494
  <h3>Helaas</h3>
502
495
  <p>
503
- Je hebt geen antwoord gegeven maar het juiste antwoord was
504
- ${this._solution}
496
+ ${this.i18n.translate("no-answer-correct-answer-was").replace(/__CORRECT__/, this._solution + '')}
505
497
  </p>
506
498
  ${this._renderNextQuestionButton()}
507
499
  </div>
@@ -513,10 +505,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
513
505
  _renderNextQuestionButton() {
514
506
  if (this._numberOfQuestionsSeen < this.numberOfQuestions) {
515
507
  return html `
516
- <button @click="${this._loadQuestion}">Volgende vraag</button>
508
+ <button @click="${this._loadQuestion}">${this.i18n.translate("next-question")}</button>
517
509
  `;
518
510
  }
519
- return html ` <button @click="${this._endGame}">Afsluiten</button> `;
511
+ return html ` <button @click="${this._endGame}">${this.i18n.translate("quit")}</button> `;
520
512
  }
521
513
  // renders the end of the game
522
514
  _endGame() {
@@ -527,9 +519,9 @@ let GuessTheYear = class GuessTheYear extends LitElement {
527
519
  console.debug("renderGameEnd");
528
520
  return html `
529
521
  ${this._renderHeader("The end!")}
530
- <div class="guess-the-year-game-end">The end..</div>
522
+ <div class="guess-the-year-game-end">${this.i18n.translate("end")}</div>
531
523
  <button @click="${() => (this._renderState = GameState.SPLASH)}">
532
- Nieuw spel
524
+ ${this.i18n.translate("new-game")}
533
525
  </button>
534
526
  ${this._renderFooter()}
535
527
  `;
@@ -550,20 +542,21 @@ let GuessTheYear = class GuessTheYear extends LitElement {
550
542
  this._loadQuestion();
551
543
  }
552
544
  _resetStage() {
553
- window.scrollTo(0, 0);
545
+ // window.scrollTo(0, 0);
546
+ this.sources = [];
554
547
  this._incident = undefined;
555
548
  this._hints = [];
556
549
  this._answer = undefined;
557
550
  this._answers = [];
558
551
  this._hintsIndex = 0;
559
552
  this._score0.reset();
560
- this._showHint = true;
553
+ this._showHint = false;
561
554
  this._hint = undefined;
562
555
  }
563
556
  async _loadQuestion() {
564
557
  var _a;
565
558
  this._resetStage();
566
- const response = await this._apiService.fetchOneIncident(this.country, this.category, this.emotion, this.impact, this.date, this.from.format("YYYY-MM-DD"), this.to.format("YYYY-MM-DD"), "40");
559
+ const response = await this._apiService.fetchOneIncident(this.country, this.category, this.emotion, this.impact, this.date, this.from.format("YYYY-MM-DD"), this.to.format("YYYY-MM-DD"), "40", "quiz_year");
567
560
  this._startTime = new Date();
568
561
  this._endTime = new Date();
569
562
  this._incident = response.incident;
@@ -585,7 +578,7 @@ let GuessTheYear = class GuessTheYear extends LitElement {
585
578
  this._answers = answers;
586
579
  for (let i = 0; i < this.maxHints; i++) {
587
580
  console.info("loading hint", i);
588
- const response = await this._apiService.fetchOneIncident(this.country, Util.shuffleArray(Categories).shift(), undefined, undefined, "", `${this._solution}-01-01`, `${this._solution}-12-31`, undefined);
581
+ const response = await this._apiService.fetchOneIncident(this.country, Util.shuffleArray(Categories).shift(), undefined, undefined, "", `${this._solution}-01-01`, `${this._solution}-12-31`, undefined, undefined);
589
582
  if (response.incident) {
590
583
  this._hints.push(response.incident);
591
584
  }
@@ -593,6 +586,9 @@ let GuessTheYear = class GuessTheYear extends LitElement {
593
586
  if (this._hints.length === 0) {
594
587
  this._showHint = false;
595
588
  }
589
+ else {
590
+ this._showHint = true;
591
+ }
596
592
  // start render game stage
597
593
  this._renderState = GameState.PLAY;
598
594
  // start score counter
@@ -780,9 +776,10 @@ let GuessTheYear = class GuessTheYear extends LitElement {
780
776
  if (!this.sources.length) {
781
777
  return html ``;
782
778
  }
779
+ // deduplicate array via [...new Set(this.sources)]
783
780
  return html `
784
781
  <div class="guess-the-year-sources">
785
- Source: ${this.sources.join(", ")}
782
+ Source: ${[...new Set(this.sources)].join(", ")}
786
783
  </div>
787
784
  `;
788
785
  }
@@ -1 +1 @@
1
- {"version":3,"file":"guess-the-year.js","sourceRoot":"","sources":["../src/guess-the-year.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAC;AAC5E,OAAO,EA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K,EAAE;sDACkC;AAGlC;IADP,KAAK,EAAE;wDACoC;AAGpC;IADP,KAAK,EAAE;4CACmB;AAGpB;IADN,KAAK,EAAE;kDACqC;AAGrC;IADP,KAAK,EAAE;4CACY;AAMZ;IADP,KAAK,EAAE;6CACwC;AAxJrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAy/BxB","sourcesContent":["import { LitElement, css, html, PropertyValues, TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\n// import { Task } from '@lit/task';\nimport dayjs from \"dayjs\";\nimport { Dayjs } from \"dayjs\";\n\nconst { setTimeout } = window;\n\nimport { Incident, Categories } from \"./lib/Incident\";\nimport { NoImageImg, RefreshIconSVG, SolutionIconSVG } from \"./lib/Icon\";\nimport { ApiService, ContentFeedback } from \"./lib/ApiService\";\nimport { Util } from \"./lib/Util\";\nimport { i18nFactory } from \"./lib/i18n/i18n\";\n\nimport { GameState } from \"./lib/enums\";\n\nimport stylesheet from \"./scss/main.scss\";\n\nimport { QuestionScoreController } from \"./lib/controller/scorecontroller\";\n\n// const GREEN = \"#07d207\";\n// const RED = \"#ec3737\";\n// const BLACK = \"#000\";\n\nconst SPLASH_DELAY: number = 3000;\nconst MIN_YEAR: number = 1960;\nconst MAX_YEAR: number = 2024;\nconst MAX_QUESTIONS: number = 10;\nconst HINT_COST: number = 2;\n\n@customElement(\"guess-the-year\")\nexport class GuessTheYear extends LitElement {\n private _startTime: Date = new Date();\n private _endTime: Date = new Date();\n // private _uuid = Math.random();\n private sources: Array<string> = [];\n private _loading = false;\n\n private _score0: QuestionScoreController;\n\n get loading() {\n return this._loading;\n }\n\n set loading(value: boolean) {\n this._loading = value;\n }\n\n @property({ type: String, attribute: \"tee-e-api-url\" })\n teeeApiUrl: string = \"https://api.tee-e.com\";\n\n @property({ type: Boolean, attribute: \"report-broken-images\" })\n reportBrokenImages: boolean = false;\n\n @property({ type: String })\n date: string = \"\";\n\n @property({ type: String })\n country: string = \"\";\n\n @property({ type: String })\n category: string = \"\";\n\n @property({ type: String })\n emotion: string = \"\";\n\n @property({ type: String })\n impact: string = \"\";\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.info([\"from\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-01-01`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.info([\"from\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n from: Dayjs = dayjs(`${MIN_YEAR}-01-01`, \"YYYY-MM-DD\");\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.info([\"to\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-12-31`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.info([\"to\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n to: Dayjs = dayjs(); // defaults to today\n\n @property({ type: String })\n limit: string = \"\";\n\n @property({ type: Boolean })\n shuffle: boolean = false;\n\n @property({ type: Boolean, attribute: \"show-duration\" })\n showDuration: boolean = false;\n\n @property({ type: Boolean, attribute: \"show-feedback\" })\n showFeedback: boolean = false;\n\n @property({ type: String, attribute: \"no-image-src\" })\n noImageSrc: string = \"\";\n\n @property({ type: Boolean, attribute: \"suppress-images\" })\n suppressImages: boolean = false;\n\n @property({ type: Boolean, attribute: \"auto-focus\" })\n autoFocus: boolean = false;\n\n @property({ type: Number, attribute: \"hint-interval-length\" })\n hintIntervalSecs: number = 7;\n\n @property({ type: Number, attribute: \"max-hints\" })\n maxHints: number = 3;\n\n @property({ type: Number, attribute: \"max-tries\" })\n maxTries: number = -1;\n\n @property({ type: Number, attribute: \"number-of-questions\", reflect: true })\n numberOfQuestions: number = 10;\n private _numberOfQuestionsSeen: number = 0;\n\n @state()\n private _incident: Incident | undefined = undefined;\n\n private _answers: Array<Number> = [];\n\n @state()\n private _hint: string | undefined = undefined;\n\n private _showHint: boolean = true;\n private _hintsIndex: number = 0;\n private _hints: Array<Incident> = [];\n\n @state()\n private _solution: Number | undefined = undefined;\n\n @state()\n private _displaySolution: boolean = false;\n\n @state()\n private _answeredCorrectly: boolean = false;\n\n @state()\n private _tries: number = 0;\n\n @state()\n public _renderState: string = GameState.INIT;\n\n @state()\n private _score = 30;\n\n public totalScore = 0;\n\n // _answer is stored as string because it will be entered character for character\n @state()\n private _answer: number | undefined = undefined;\n\n private _apiService = new ApiService(this.teeeApiUrl);\n private _intervalsPassed: number = 0;\n private i18n = i18nFactory(\"nl-nl\");\n\n static override styles = css`\n ${stylesheet}\n `;\n\n // private _game_engine: Engine;\n\n constructor() {\n super();\n\n this._score0 = new QuestionScoreController(this, 30, 1000);\n\n // this._engine = new GameController(this);\n }\n\n override connectedCallback() {\n console.debug(\"connectedCallback\");\n super.connectedCallback();\n\n // first step is splash\n this._renderState = GameState.SPLASH;\n }\n\n override disconnectedCallback() {\n console.debug(\"disconnectedCallback\");\n super.disconnectedCallback();\n // clearInterval(this._intervalHandler);\n this._renderState = GameState.INIT;\n this._score0.stop();\n this._score0.reset();\n }\n\n override firstUpdated(changedProperties: PropertyValues): void {\n console.debug(\"firstUpdated\");\n super.firstUpdated(changedProperties);\n }\n\n override shouldUpdate(changedProperties: PropertyValues): boolean {\n console.debug(\"shouldUpdate\");\n return super.shouldUpdate(changedProperties);\n }\n\n override update(changedProperties: PropertyValues) {\n console.debug(\"update\");\n return super.update(changedProperties);\n }\n\n override updated(changedProperties: PropertyValues) {\n console.debug(\"updated\");\n return super.updated(changedProperties);\n }\n\n override render() {\n /**\n * this is the main render function\n * it renders different stages during the game\n */\n console.debug(\"render\");\n\n return html`\n <div class=\"guess-the-year-container\">\n ${this._renderState == GameState.INIT ? \"Loading...\" : \"\"}\n ${this._renderState == GameState.SPLASH\n ? this.renderSplashScreen()\n : \"\"}\n ${this._renderState == GameState.INTRO ? this.renderGameIntro() : \"\"}\n ${this._renderState == GameState.PLAY ? this.renderGameStage() : \"\"}\n ${this._renderState == GameState.END ? this.renderGameEnd() : \"\"}\n ${this._renderFooter()}\n </div>\n `;\n }\n\n colorElement(element: any, color: string) {\n console.debug(\"colorElement\");\n this?.shadowRoot?.querySelector(element)?.style.setProperty(\"color\", color);\n }\n\n // this renders the game header\n private _renderHeader(content: string = \"Guess the Year!\"): TemplateResult {\n return html`\n <section id=\"top\" class=\"header guess-the-year-header\">\n <h1>${content}</h1>\n </section>\n `;\n }\n\n // this renders the game footer\n private _renderFooter(): TemplateResult {\n return html`\n <section class=\"footer guess-the-year-footer\">\n <div class=\"guess-the-year-copyright\">\n ${\"Hasslefree ©\" + dayjs().year()}\n </div>\n </section>\n `;\n }\n\n // render the splash screen\n // TODO: set the right logo\n private renderSplashScreen(): TemplateResult {\n console.debug(\"renderSplashScreen\");\n\n // (pretend) to load before the game starts\n setTimeout(() => {\n this._renderState = GameState.INTRO;\n }, SPLASH_DELAY);\n\n return html`\n <div id=\"splash-screen-container\" class=\"splashscreen\">\n <div class=\"splash-logo\">\n <img\n src=\"https://breehees.nl/wp-content/uploads/2022/03/superHuub-400x400.png\"\n alt=\"SuperHuub\"\n />\n <h2>${this.i18n.translate(\"Guess the Year\")}</h2>\n <p>${this.i18n.translate(\"Loading...\")}</p>\n </div>\n </div>\n `;\n }\n\n // renders a selector for a year\n // TODO: set type of selector\n private _renderYearSelectOptions(selectedValue: string): TemplateResult {\n const selected = parseInt(selectedValue, 10);\n // pre-render year options\n // and mark selected when they match\n const selectYearOptions = [];\n for (let i = MIN_YEAR; i <= MAX_YEAR; i += 5) {\n selectYearOptions.push(html`\n <option value=\"${i}\" ?selected=${selected == i}>${i}</option>\n `);\n }\n\n return html`${selectYearOptions}`;\n }\n\n // render the game intro\n // allows to select the number of questions,\n // select the year range\n // and to start the game\n // TODO: add real content\n private renderGameIntro(): TemplateResult {\n console.info(\"renderGameIntro\");\n\n // pre-render number of question options\n // and mark selected when they match\n const selectQuestionOptions = [];\n for (let i = 1; i <= MAX_QUESTIONS; i++) {\n selectQuestionOptions.push(html`\n <option value=\"${i}\" ?selected=${this.numberOfQuestions == i}>\n ${i}\n </option>\n `);\n }\n\n return html`\n ${this._renderHeader('Welcome to \"Guess the Year\"')}\n\n <div class=\"game-intro\">\n <div class=\"game-explanation\">\n <p>\n Marty, such a nice name. What? Hi, Marty. He's alright. Shape up,\n man. You're a slacker. You wanna be a slacker for the rest of your\n life?\n </p>\n\n <p>\n Excuse me. Go. Go. Never mind that, never mind that now, never mind\n that, never mind- Yeah, well, how about my homework, McFly? Don't\n stop, Wilbert, drive.\n </p>\n\n <p>\n Mom, is that you? Oh. Uh Doc, uh no. No, don't be silly. What did\n your mother ever see in that kid? You guys, take him in back and\n I'll be right there. Well c'mon, this ain't no peep show.\n </p>\n </div>\n\n <div class=\"game-settings\">\n <p>\n Right. Oh hey, Biff, hey, guys, how are you doing? Look, there's a\n rhythmic\n <select\n @change=\"${(event: any) => {\n this.numberOfQuestions = Number(event.target.value);\n }}\"\n >\n ${selectQuestionOptions}\n </select>\n vragen ceremonial ritual coming up. Vanaf begin\n <select @change=\"${this._setFromDate}\">\n ${this._renderYearSelectOptions(this.from.format(\"YYYY\"))}\n </select>\n Precisely, just relax now Calvin. Tot eind\n <select @change=\"${this._setToDate}\">\n ${this._renderYearSelectOptions(this.to.format(\"YYYY\"))}\n </select>\n you've got a big bruise on you're head.\n </p>\n </div>\n\n <div class=\"game-start\">\n <button @click=\"${this.setupNewGame}\">Start</button>\n </div>\n </div>\n `;\n }\n\n private _setFromDate(event: any): void {\n this.from = this.from.year(event.target.value);\n }\n\n private _setToDate(event: any): void {\n this.to = this.to.year(event.target.value);\n }\n\n // renders the actual game stage\n private renderGameStage(): TemplateResult {\n console.debug(\"renderGameStage\");\n\n return html`\n ${this._renderHeader(\"Game On!!\")}\n <div class=\"guess-the-year-game-stage\">\n <div class=\"game-score\">${this._renderGameScore()}</div>\n\n <div class=\"container\">\n <div class=\"incident\">${this._renderIncident()}</div>\n ${this._renderHint()}\n <div class=\"sources\">${this.renderSources()}</div>\n </div>\n\n <div class=\"game-controls\">\n <div class=\"game-controls--hint\">${this._renderHintButton()}</div>\n <div class=\"game-controls--answers\">${this._renderAnswers()}</div>\n </div>\n\n ${this._renderFeedback()}\n </div>\n `;\n }\n\n // renders the item for the year to guess\n private _renderIncident(): TemplateResult {\n return html`\n <div class=\"incident--title\">\n <h1>${this._incident?.title}</h1>\n </div>\n\n ${this._renderIncidentImage(this._incident)}\n\n <div class=\"incident--text\">\n <p>${this._incident?.text}</p>\n </div>\n `;\n }\n\n // renders the optional image with the item\n private _renderIncidentImage(incident: Incident | undefined): TemplateResult {\n if (incident && incident.image) {\n return html`\n <div class=\"incident--image\">\n <img src=\"${incident.image}\" />\n </div>\n `;\n }\n\n return html``;\n }\n\n // renders a list of possible answers\n private _renderAnswers(): TemplateResult {\n return html`\n <div class=\"answers--list\">\n <ul>\n ${this._answers.map(\n (answer) =>\n html`<li @click=\"${this._handleAnswerClicked}\">${answer}</li>`,\n )}\n </ul>\n </div>\n `;\n }\n\n // renders the current question score\n // it counts back to 0\n private _renderGameScore(): TemplateResult {\n return html`\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">Vraag:</div>\n <div class=\"game-score--value\">\n ${this._numberOfQuestionsSeen} van ${this.numberOfQuestions}\n </div>\n </div>\n\n <div class=\"game-score--score\">\n <div class=\"game-score--label\">Score:</div>\n <div class=\"game-score--value\">${this._score0.value}</div>\n </div>\n\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">Totaalscore:</div>\n <div class=\"game-score--value\">${this.totalScore}</div>\n </div>\n `;\n }\n\n // handles the click on an answer\n private _handleAnswerClicked(event: any): void {\n // get the clicked answer\n const answer = event.target.textContent;\n\n // stop the score counter\n this._score0.stop();\n\n // remove the hint button\n this._showHint = false;\n\n // check if the answer is correct\n if (answer) {\n // this._apiService.postIncidentAnswer(this._incident?.id, answer);\n console.info(\n answer,\n this._solution,\n this._score,\n answer == this._solution,\n );\n\n this._answer = answer;\n }\n }\n\n // renders the requested hint\n private _renderHint(): TemplateResult {\n if (!this._hint) {\n return html``;\n }\n\n return html` <p>${this._hint}</p> `;\n }\n\n // renders the hint button until\n // all max hints have been used\n private _renderHintButton(): TemplateResult {\n if (!this._showHint) {\n return html``;\n }\n\n return html`\n <div class=\"game-controls--hint\">\n <button @click=\"${this._handleHintClicked}\">\n Toon hint (${this.maxHints - this._hintsIndex})\n </button>\n </div>\n `;\n }\n\n // handles the click on the hint button\n // and shows the next hint if available\n // subtracts the cost of the hint from\n // the question score\n private _handleHintClicked(): void {\n console.info(\"handleHintClicked\", [this._hintsIndex, this._hints.length]);\n\n if (this._hintsIndex < this._hints.length) {\n const hintText = this._generateHintText(this._hints[this._hintsIndex]);\n\n if (hintText) {\n this._hint = hintText;\n this._hintsIndex++;\n this._score0.subtract(HINT_COST);\n }\n }\n\n if (this._hintsIndex >= this._hints.length) {\n // this._hintsIndex = 0;\n this._showHint = false;\n }\n }\n\n // renders the feedback overlay\n private _renderFeedback(): TemplateResult {\n // do not show anything until an answer has been made\n // and the score is greater than 0\n if (!this._answer && this._score0.value > 0) {\n return html``;\n }\n\n // check if the answer is correct\n // cast to strings to compare\n const is_correct = this._answer + \"\" == this._solution + \"\";\n const score = is_correct ? this._score0.value : 0;\n\n if (this._score0.isRunning()) {\n this._score0.stop();\n }\n\n this.totalScore += score;\n\n if (is_correct) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Correct!</h3>\n <p>\n Je hebt ${this._hintsIndex}\n ${this._hintsIndex != 1 ? \"hints\" : \"hint\"} gebruikt.\n </p>\n <p>\n Voor deze vraag heb je ${score} ${score != 1 ? \"punten\" : \"punt\"}\n gehaald!\n </p>\n\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else if (!is_correct && this._answer) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Helaas</h3>\n <p>\n Je koos voor ${this._answer} maar het juiste antwoord was\n ${this._solution}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Helaas</h3>\n <p>\n Je hebt geen antwoord gegeven maar het juiste antwoord was\n ${this._solution}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n }\n }\n\n // renders the next question button\n private _renderNextQuestionButton(): TemplateResult {\n if (this._numberOfQuestionsSeen < this.numberOfQuestions) {\n return html`\n <button @click=\"${this._loadQuestion}\">Volgende vraag</button>\n `;\n }\n\n return html` <button @click=\"${this._endGame}\">Afsluiten</button> `;\n }\n\n // renders the end of the game\n private _endGame(): void {\n this._renderState = GameState.END;\n }\n\n private renderGameEnd(): TemplateResult {\n // clearInterval(this._scoreIntervalHandler);\n\n console.debug(\"renderGameEnd\");\n return html`\n ${this._renderHeader(\"The end!\")}\n <div class=\"guess-the-year-game-end\">The end..</div>\n <button @click=\"${() => (this._renderState = GameState.SPLASH)}\">\n Nieuw spel\n </button>\n ${this._renderFooter()}\n `;\n }\n\n // private _incidentsStack = [];\n\n // private _totalScore: number = 0;\n\n private setupNewGame(): void {\n console.log(\"new game!\");\n\n console.info({\n \"number of questions\": this.numberOfQuestions,\n from: this.from.toISOString(),\n to: this.to.toISOString(),\n });\n\n this.totalScore = 0;\n this._numberOfQuestionsSeen = 0;\n\n // this._question.load(this.from.format('YYYY'), this.to.format('YYYY'));\n // this._question.init();\n\n this._loadQuestion();\n }\n\n private _resetStage(): void {\n window.scrollTo(0, 0);\n\n this._incident = undefined;\n this._hints = [];\n this._answer = undefined;\n this._answers = [];\n this._hintsIndex = 0;\n this._score0.reset();\n this._showHint = true;\n this._hint = undefined;\n }\n\n async _loadQuestion(): Promise<void> {\n this._resetStage();\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n this.category,\n this.emotion,\n this.impact,\n this.date,\n this.from.format(\"YYYY-MM-DD\"),\n this.to.format(\"YYYY-MM-DD\"),\n \"40\",\n );\n\n this._startTime = new Date();\n this._endTime = new Date();\n this._incident = response.incident;\n this.sources = response.sources;\n this._tries = this.maxTries;\n\n this._solution = Number(\n (response.incident?.yearplusmonth || \"\").substring(0, 4),\n );\n\n const answers = [this._solution];\n const from = this.from.year();\n const to = this.to.year();\n\n // generate 3 more random and unique answers between to and from\n while (answers.length < 4) {\n const randomAnswer = Math.floor(Math.random() * (to - from)) + from;\n if (!answers.includes(randomAnswer)) {\n answers.push(randomAnswer);\n }\n }\n\n // sort theses answers\n answers.sort();\n\n this._answers = answers;\n\n for (let i = 0; i < this.maxHints; i++) {\n console.info(\"loading hint\", i);\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n Util.shuffleArray(Categories).shift(),\n undefined,\n undefined,\n \"\",\n `${this._solution}-01-01`,\n `${this._solution}-12-31`,\n undefined,\n );\n\n if (response.incident) {\n this._hints.push(response.incident);\n }\n }\n\n if (this._hints.length === 0) {\n this._showHint = false;\n }\n\n // start render game stage\n this._renderState = GameState.PLAY;\n\n // start score counter\n this._score0.start();\n\n // increment question counter\n this._numberOfQuestionsSeen += 1;\n }\n\n renderRefreshButton(): TemplateResult {\n return html`<div class=\"refresh\" id=\"refresh\" @click=\"${this.setupNewGame}\">\n <span>${unsafeHTML(RefreshIconSVG)}</span>\n </div>`;\n }\n\n renderStopGameButton(): TemplateResult {\n return html`<div\n class=\"stop-game\"\n id=\"stop-game\"\n @click=\"${() => {\n this._displaySolution = true;\n }}\"\n >\n <span>${unsafeHTML(SolutionIconSVG)}</span>\n </div>`;\n }\n\n renderFeedbackPossibility(): TemplateResult {\n if (this.showFeedback) {\n return html`<div class=\"feedback-possibility\">\n <input\n type=\"text\"\n id=\"feedback\"\n size=\"15\"\n placeholder=\"${this.i18n.translate(\"your-feedback\")}\"\n />\n </div>`;\n } else {\n return html``;\n }\n }\n\n renderSubmitPossibility(): TemplateResult {\n return html`<div class=\"submit-possibility\">\n <input\n type=\"text\"\n id=\"answer\"\n size=\"15\"\n ?disabled=${this._displaySolution}\n placeholder=\"${this.i18n.translate(\"your-answer\")}\"\n />\n ${this.renderTries()}\n </div>`;\n }\n\n renderTries(): TemplateResult {\n const i18nKey = this._tries > 1 ? \"tries-left\" : \"try-left\";\n if (this._tries >= 0 && !this._displaySolution) {\n return html`<span class=\"tries\"\n >${this.i18n\n .translate(i18nKey)\n .replace(\"__TRIES__\", \"\" + this._tries)}</span\n >`;\n }\n return html``;\n }\n\n renderTheSolution(): TemplateResult {\n if (this._displaySolution) {\n return html`<div class=\"solution\">${this._solution}</div>\n ${this.renderTheDuration()} `;\n }\n return html``;\n }\n\n renderTheDuration(): TemplateResult {\n const duration = Math.round(\n new Date(this._endTime.getTime() - this._startTime.getTime()).getTime() /\n 1000,\n );\n const i18nKey = duration === 1 ? \"in-x-seconds\" : \"in-one-second\";\n if (this.showDuration && this._answeredCorrectly) {\n return html`<div class=\"timer\">\n ${this.i18n.translate(i18nKey).replace(\"__SECONDS__\", \"\" + duration)}\n </div>`;\n }\n return html``;\n }\n\n renderTiles(incident: Incident | undefined) {\n console.debug(\"renderTiles\");\n if (!incident) {\n return \"\";\n }\n return html`${this.renderTile(incident)}`;\n }\n\n private _tileShouldDisplayAnImage(incident: Incident): boolean {\n const hasImage = !!incident.image;\n const displayImages = !this.suppressImages;\n return hasImage && displayImages;\n }\n\n renderTile(incident: Incident): TemplateResult {\n console.debug(\"renderTile\");\n const tileContent: TemplateResult = this.renderTileContent(incident);\n if (this._tileShouldDisplayAnImage(incident)) {\n return html`<div class=\"guess-the-year-tile with-image\">\n ${tileContent}\n </div>`;\n }\n\n return html`<div class=\"guess-the-year-tile\">${tileContent}</div>`;\n }\n\n renderTileContent(incident: Incident): TemplateResult {\n console.debug(\"renderTileContent\");\n return html`<div class=\"guess-the-year-tile-content\">\n ${this.renderTileTitle(incident)} ${this.renderTileImage(incident)}\n ${this.renderTileTextContent(incident)}\n </div>`;\n }\n\n private _generateHintText(hintIncident: Incident): string {\n let hint = \"\";\n const hintTemplates = this.i18n.HintTemplates[hintIncident.category];\n switch (hintIncident.category) {\n case \"newsItem\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] || \"\"\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"radioSong\":\n // The title property of radioSongs always follow this pattern: track - artist\n const track = hintIncident.title.replace(/(.*?)\\s+\\-.*/, \"$1\");\n const artist = hintIncident.title.replace(/.*\\-(.*)/, \"$1\");\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n )\n .replace(/__ARTIST__/, artist)\n .replace(/__TRACK__/, track);\n break;\n case \"cinemaMovie\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"tech\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"newsPresenter\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"sports\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n }\n return hint;\n }\n\n renderHintTile(hint: Incident | undefined): TemplateResult {\n if (hint) {\n console.debug(\"renderHint\");\n return html`<div class=\"guess-the-year-hint-tile\">\n <h1 class=\"title\">\n Hint ${this._intervalsPassed} <br />\n ${this._generateHintText(hint)}\n </h1>\n ${this.renderTileTextContent(hint)}\n </div>`;\n }\n return html``;\n }\n\n renderTileTitle(incident: Incident): TemplateResult {\n console.debug(\"renderTileTitle\");\n if (incident.title) {\n return html`<h1 class=\"guess-the-year-tile-title\">${incident.title}</h1>`;\n }\n return html``;\n }\n\n renderTileImage(incident: Incident): TemplateResult {\n console.debug(\"renderTileImage\");\n if (this._tileShouldDisplayAnImage(incident)) {\n return html`<img\n @error=${(evt: Event) => {\n this._handleImageLoadError(evt, incident);\n }}\n src=${incident.image}\n />`;\n }\n return html``;\n }\n\n renderTileTextContent(incident: Incident): TemplateResult {\n console.debug(\"renderTileTextContent\");\n if (incident.text) {\n return html`<p class=\"hint-text\">${incident.text}</p>`;\n }\n return html``;\n }\n\n renderSources(): TemplateResult {\n console.debug(\"renderSources\");\n if (!this.sources.length) {\n return html``;\n }\n return html`\n <div class=\"guess-the-year-sources\">\n Source: ${this.sources.join(\", \")}\n </div>\n `;\n }\n\n // private _incidentsTask: Task = new Task(this, {\n // task: async ([]) => {\n // console.debug('incidentsTask');\n // if (!this.loading) {\n // this.loading = true;\n // await this.setupNewGame();\n // this.loading = false;\n // }\n // },\n // args: () => [\n // this.country,\n // this.category,\n // this.emotion,\n // this.impact,\n // this.date,\n // this.from,\n // this.to,\n // ],\n // });\n\n _handleImageLoadError = (evt: Event, incident: Incident) => {\n // grab the image element that triggered the error\n const targetImage = evt.target as HTMLImageElement;\n console.info(`Error loading image: ${targetImage.src}`);\n\n // find out which no image source needs to be used\n const noImageSrc = this.noImageSrc || NoImageImg;\n\n // don't try to set the image source if it\n // has already been set\n if (targetImage.src == noImageSrc) {\n return;\n }\n\n // report broken images back to the server if set.\n if (this.reportBrokenImages) {\n if (incident) {\n this._apiService.postAttributeQualityFeedback(\n incident.id,\n \"image\",\n targetImage.src,\n ContentFeedback.incorrect,\n );\n }\n }\n\n // wait a bit before setting the image\n // so we don't hammer the no image server\n setTimeout(() => {\n targetImage.src = noImageSrc;\n }, 250);\n\n return false;\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"guess-the-year\": GuessTheYear;\n }\n}\n"]}
1
+ {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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;gDAC9B;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDAC1B;AAGhC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;+CAC1B;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC;sDACjC;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;8CAC9B;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;8CAC7B;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAC7C;AAIvB;IADP,KAAK,EAAE;+CAC4C;AAK5C;IADP,KAAK,EAAE;2CACsC;AAQtC;IADP,KAAK,EAAE;+CAC0C;AAG1C;IADP,KAAK,EAAE;sDACkC;AAGlC;IADP,KAAK,EAAE;wDACoC;AAGpC;IADP,KAAK,EAAE;4CACmB;AAGpB;IADN,KAAK,EAAE;kDACqC;AAGrC;IADP,KAAK,EAAE;4CACY;AAMZ;IADP,KAAK,EAAE;6CACwC;AAzJrC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAu/BxB","sourcesContent":["import { LitElement, css, html, PropertyValues, TemplateResult } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\n// import { Task } from '@lit/task';\nimport dayjs from \"dayjs\";\nimport { Dayjs } from \"dayjs\";\n\nconst { setTimeout } = window;\n\nimport { Incident, Categories } from \"./lib/Incident\";\nimport { NoImageImg, RefreshIconSVG, SolutionIconSVG } from \"./lib/Icon\";\nimport { ApiService, ContentFeedback } from \"./lib/ApiService\";\nimport { Util } from \"./lib/Util\";\nimport { i18nFactory } from \"./lib/i18n/i18n\";\n\nimport { GameState } from \"./lib/enums\";\n\nimport stylesheet from \"./scss/main.scss\";\n\nimport { QuestionScoreController } from \"./lib/controller/scorecontroller\";\n\n// const GREEN = \"#07d207\";\n// const RED = \"#ec3737\";\n// const BLACK = \"#000\";\n\nconst SPLASH_DELAY: number = 3000;\nconst MIN_YEAR: number = 1950;\nconst MAX_YEAR: number = 2024;\nconst MAX_QUESTIONS: number = 10;\nconst HINT_COST: number = 2;\n\n@customElement(\"guess-the-year\")\nexport class GuessTheYear extends LitElement {\n private _startTime: Date = new Date();\n private _endTime: Date = new Date();\n // private _uuid = Math.random();\n private sources: Array<string> = [];\n private _loading = false;\n\n private _score0: QuestionScoreController;\n\n get loading() {\n return this._loading;\n }\n\n set loading(value: boolean) {\n this._loading = value;\n }\n\n @property({ type: String, attribute: \"tee-e-api-url\" })\n teeeApiUrl: string = \"https://api.tee-e.com\";\n\n @property({ type: Boolean, attribute: \"report-broken-images\" })\n reportBrokenImages: boolean = false;\n\n @property({ type: String })\n date: string = \"\";\n\n @property({ type: String })\n country: string = \"\";\n\n @property({ type: String })\n category: string = \"\";\n\n @property({ type: String })\n emotion: string = \"\";\n\n @property({ type: String })\n impact: string = \"\";\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.info([\"from\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-01-01`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.info([\"from\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n from: Dayjs = dayjs(`${MIN_YEAR}-01-01`, \"YYYY-MM-DD\");\n\n @property({\n type: Dayjs,\n converter: {\n fromAttribute: (value: string) => {\n console.info([\"to\", \"from\", value]);\n if (!value) {\n return dayjs();\n }\n\n if (value.length >= 10) {\n return dayjs(value, \"YYYY-MM-DD\");\n }\n\n return dayjs(`${value}-12-31`, \"YYYY-MM-DD\");\n },\n toAttribute: (value: Dayjs) => {\n console.info([\"to\", \"to\", value]);\n return value.format(\"YYYY-MM-DD\");\n },\n },\n })\n to: Dayjs = dayjs(); // defaults to today\n\n @property({ type: String })\n limit: string = \"\";\n\n @property({ type: Boolean })\n shuffle: boolean = false;\n\n @property({ type: Boolean, attribute: \"show-duration\" })\n showDuration: boolean = false;\n\n @property({ type: Boolean, attribute: \"show-feedback\" })\n showFeedback: boolean = false;\n\n @property({ type: String, attribute: \"no-image-src\" })\n noImageSrc: string = \"\";\n\n @property({ type: Boolean, attribute: \"suppress-images\" })\n suppressImages: boolean = false;\n\n @property({ type: Boolean, attribute: \"auto-focus\" })\n autoFocus: boolean = false;\n\n @property({ type: Number, attribute: \"hint-interval-length\" })\n hintIntervalSecs: number = 7;\n\n @property({ type: Number, attribute: \"max-hints\" })\n maxHints: number = 3;\n\n @property({ type: Number, attribute: \"max-tries\" })\n maxTries: number = -1;\n\n @property({ type: Number, attribute: \"number-of-questions\", reflect: true })\n numberOfQuestions: number = 10;\n private _numberOfQuestionsSeen: number = 0;\n\n @state()\n private _incident: Incident | undefined = undefined;\n\n private _answers: Array<Number> = [];\n\n @state()\n private _hint: string | undefined = undefined;\n\n private _showHint: boolean = true;\n private _showFooter: boolean = false;\n private _hintsIndex: number = 0;\n private _hints: Array<Incident> = [];\n\n @state()\n private _solution: Number | undefined = undefined;\n\n @state()\n private _displaySolution: boolean = false;\n\n @state()\n private _answeredCorrectly: boolean = false;\n\n @state()\n private _tries: number = 0;\n\n @state()\n public _renderState: string = GameState.INIT;\n\n @state()\n private _score = 30;\n\n public totalScore = 0;\n\n // _answer is stored as string because it will be entered character for character\n @state()\n private _answer: number | undefined = undefined;\n\n private _apiService = new ApiService(this.teeeApiUrl);\n private _intervalsPassed: number = 0;\n private i18n = i18nFactory(\"nl\");\n\n static override styles = css`\n ${stylesheet}\n `;\n\n // private _game_engine: Engine;\n\n constructor() {\n super();\n\n this._score0 = new QuestionScoreController(this, 30, 1000);\n\n // this._engine = new GameController(this);\n }\n\n override connectedCallback() {\n console.debug(\"connectedCallback\");\n super.connectedCallback();\n\n // first step is splash\n this._renderState = GameState.SPLASH;\n }\n\n override disconnectedCallback() {\n console.debug(\"disconnectedCallback\");\n super.disconnectedCallback();\n // clearInterval(this._intervalHandler);\n this._renderState = GameState.INIT;\n this._score0.stop();\n this._score0.reset();\n }\n\n override firstUpdated(changedProperties: PropertyValues): void {\n console.debug(\"firstUpdated\");\n super.firstUpdated(changedProperties);\n }\n\n override shouldUpdate(changedProperties: PropertyValues): boolean {\n console.debug(\"shouldUpdate\");\n return super.shouldUpdate(changedProperties);\n }\n\n override update(changedProperties: PropertyValues) {\n console.debug(\"update\");\n return super.update(changedProperties);\n }\n\n override updated(changedProperties: PropertyValues) {\n console.debug(\"updated\");\n return super.updated(changedProperties);\n }\n\n override render() {\n /**\n * this is the main render function\n * it renders different stages during the game\n */\n console.debug(\"render\");\n\n return html`\n <div class=\"guess-the-year-container\">\n ${this._renderState == GameState.INIT ? \"Loading...\" : \"\"}\n ${this._renderState == GameState.SPLASH\n ? this.renderSplashScreen()\n : \"\"}\n ${this._renderState == GameState.INTRO ? this.renderGameIntro() : \"\"}\n ${this._renderState == GameState.PLAY ? this.renderGameStage() : \"\"}\n ${this._renderState == GameState.END ? this.renderGameEnd() : \"\"}\n ${this._renderFooter()}\n </div>\n `;\n }\n\n colorElement(element: any, color: string) {\n console.debug(\"colorElement\");\n this?.shadowRoot?.querySelector(element)?.style.setProperty(\"color\", color);\n }\n\n // this renders the game header\n private _renderHeader(content: string = this.i18n.translate(\"game-name\")): TemplateResult {\n return html`\n <section id=\"top\" class=\"header guess-the-year-header\">\n <h1>${content}</h1>\n </section>\n `;\n }\n\n // this renders the game footer\n private _renderFooter(): TemplateResult {\n if (this._showFooter) {\n return html`\n <section class=\"footer guess-the-year-footer\">\n <div class=\"guess-the-year-copyright\">\n ${\"The Throwback Company ©\" + dayjs().year()}\n </div>\n </section>\n `;\n }\n return html``;\n }\n\n // render the splash screen\n private renderSplashScreen(): TemplateResult {\n console.debug(\"renderSplashScreen\");\n\n // (pretend) to load before the game starts\n setTimeout(() => {\n this._renderState = GameState.INTRO;\n }, SPLASH_DELAY);\n\n return html`\n <div id=\"splash-screen-container\" class=\"splashscreen\">\n <div class=\"splash-logo\">\n <img\n src=\"./assets/logo.png\"\n alt=\"logo\"\n />\n <h2>${this.i18n.translate(\"game-name\")}</h2>\n <p>${this.i18n.translate(\"Loading...\")}</p>\n </div>\n </div>\n `;\n }\n\n // renders a selector for a year\n // TODO: set type of selector\n private _renderYearSelectOptions(selectedValue: string): TemplateResult {\n const selected = parseInt(selectedValue, 10);\n // pre-render year options\n // and mark selected when they match\n const selectYearOptions = [];\n for (let i = MIN_YEAR; i <= MAX_YEAR; i += 5) {\n selectYearOptions.push(html`\n <option value=\"${i}\" ?selected=${selected == i}>${i}</option>\n `);\n }\n\n return html`${selectYearOptions}`;\n }\n\n // render the game intro\n // allows to select the number of questions,\n // select the year range\n // and to start the game\n // TODO: add real content\n private renderGameIntro(): TemplateResult {\n console.info(\"renderGameIntro\");\n\n // pre-render number of question options\n // and mark selected when they match\n const selectQuestionOptions = [];\n for (let i = 1; i <= MAX_QUESTIONS; i++) {\n selectQuestionOptions.push(html`\n <option value=\"${i}\" ?selected=${this.numberOfQuestions == i}>\n ${i}\n </option>\n `);\n }\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-introduction-welcome\"))}\n\n <div class=\"game-intro\">\n <div class=\"game-explanation\">\n <p>\n ${this.i18n.translate(\"game-introduction-p1\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p2\")}\n </p>\n\n <p>\n ${this.i18n.translate(\"game-introduction-p3\")}\n </p>\n </div>\n\n <div class=\"game-settings\">\n <p>\n ${this.i18n.translate(\"game-settings-p1\")}\n <select\n @change=\"${(event: any) => {\n this.numberOfQuestions = Number(event.target.value);\n }}\"\n >\n ${selectQuestionOptions}\n </select>\n ${this.i18n.translate(\"game-settings-p2\")}\n <select @change=\"${this._setFromDate}\">\n ${this._renderYearSelectOptions(this.from.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p3\")}\n <select @change=\"${this._setToDate}\">\n ${this._renderYearSelectOptions(this.to.format(\"YYYY\"))}\n </select>\n ${this.i18n.translate(\"game-settings-p4\")}\n </p>\n </div>\n\n <div class=\"game-start\">\n <button @click=\"${this.setupNewGame}\">${this.i18n.translate(\"start\")}</button>\n </div>\n </div>\n `;\n }\n\n private _setFromDate(event: any): void {\n this.from = this.from.year(event.target.value);\n }\n\n private _setToDate(event: any): void {\n this.to = this.to.year(event.target.value);\n }\n\n // renders the actual game stage\n private renderGameStage(): TemplateResult {\n console.debug(\"renderGameStage\");\n\n return html`\n ${this._renderHeader(this.i18n.translate(\"game-call-to-action\"))}\n <div class=\"guess-the-year-game-stage\">\n <div class=\"game-score\">${this._renderGameScore()}</div>\n\n <div class=\"container\">\n <div class=\"incident\">${this._renderIncident()}</div>\n ${this._renderHint()}\n <div class=\"sources\">${this.renderSources()}</div>\n </div>\n\n <div class=\"game-controls\">\n <div class=\"game-controls--hint\">${this._renderHintButton()}</div>\n <div class=\"game-controls--answers\">${this._renderAnswers()}</div>\n </div>\n\n ${this._renderFeedback()}\n </div>\n `;\n }\n\n // renders the item for the year to guess\n private _renderIncident(): TemplateResult {\n return html`\n <div class=\"incident--title\">\n <h1>${this._incident?.title}</h1>\n </div>\n\n ${this._renderIncidentImage(this._incident)}\n\n <div class=\"incident--text\">\n <p>${this._incident?.text}</p>\n </div>\n `;\n }\n\n // renders the optional image with the item\n private _renderIncidentImage(incident: Incident | undefined): TemplateResult {\n if (incident && incident.image) {\n return html`\n <div class=\"incident--image\">\n <img src=\"${incident.image}\" />\n </div>\n `;\n }\n\n return html``;\n }\n\n // renders a list of possible answers\n private _renderAnswers(): TemplateResult {\n return html`\n <div class=\"answers--list\">\n <ul>\n ${this._answers.map(\n (answer) =>\n html`<li @click=\"${this._handleAnswerClicked}\">${answer}</li>`,\n )}\n </ul>\n </div>\n `;\n }\n\n // renders the current question score\n // it counts back to 0\n private _renderGameScore(): TemplateResult {\n return html`\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-number\")}:</div>\n <div class=\"game-score--value\">\n ${this._numberOfQuestionsSeen} van ${this.numberOfQuestions}\n </div>\n </div>\n\n <div class=\"game-score--score\">\n <div class=\"game-score--label\">${this.i18n.translate(\"question-score\")}:</div>\n <div class=\"game-score--value\">${this._score0.value}</div>\n </div>\n\n <div class=\"game-score--total\">\n <div class=\"game-score--label\">${this.i18n.translate(\"total-score\")}:</div>\n <div class=\"game-score--value\">${this.totalScore}</div>\n </div>\n `;\n }\n\n // handles the click on an answer\n private _handleAnswerClicked(event: any): void {\n // get the clicked answer\n const answer = event.target.textContent;\n\n // stop the score counter\n this._score0.stop();\n\n // remove the hint button\n this._showHint = false;\n\n // check if the answer is correct\n if (answer) {\n // this._apiService.postIncidentAnswer(this._incident?.id, answer);\n console.info(\n answer,\n this._solution,\n this._score,\n answer == this._solution,\n );\n\n this._answer = answer;\n }\n }\n\n // renders the requested hint\n private _renderHint(): TemplateResult {\n if (!this._hint) {\n return html``;\n }\n\n return html` <p>${this._hint}</p> `;\n }\n\n // renders the hint button until\n // all max hints have been used\n private _renderHintButton(): TemplateResult {\n if (!this._showHint) {\n return html``;\n }\n\n return html`\n <div class=\"game-controls--hint\">\n <button @click=\"${this._handleHintClicked}\">\n ${this.i18n.translate(\"show-hint\")} (${this.maxHints - this._hintsIndex})\n </button>\n </div>\n `;\n }\n\n // handles the click on the hint button\n // and shows the next hint if available\n // subtracts the cost of the hint from\n // the question score\n private _handleHintClicked(): void {\n console.info(\"handleHintClicked\", [this._hintsIndex, this._hints.length]);\n\n if (this._hintsIndex < this._hints.length) {\n const hintText = this._generateHintText(this._hints[this._hintsIndex]);\n\n if (hintText) {\n this._hint = hintText;\n this._hintsIndex++;\n this._score0.subtract(HINT_COST);\n }\n }\n\n if (this._hintsIndex >= this._hints.length) {\n // this._hintsIndex = 0;\n this._showHint = false;\n }\n }\n\n // renders the feedback overlay\n private _renderFeedback(): TemplateResult {\n // do not show anything until an answer has been made\n // and the score is greater than 0\n if (!this._answer && this._score0.value > 0) {\n return html``;\n }\n\n // check if the answer is correct\n // cast to strings to compare\n const is_correct = this._answer + \"\" == this._solution + \"\";\n const score = is_correct ? this._score0.value : 0;\n\n if (this._score0.isRunning()) {\n this._score0.stop();\n }\n\n this.totalScore += score;\n\n if (is_correct) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-correct\")}!</h3>\n <p>\n ${this._hintsIndex == 1 ? this.i18n.translate(\"used-hint-singular\") : this.i18n.translate(\"used-hint-plural\").replace(/__HINTS__/, this._hintsIndex + '')}\n </p>\n <p>\n ${score == 1 ? this.i18n.translate(\"number-points-singular\") : this.i18n.translate(\"number-points-plural\").replace(/__POINTS__/, score + '')}\n </p>\n\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else if (!is_correct && this._answer) {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>${this.i18n.translate(\"answer-wrong\")}</h3>\n <p>\n ${this.i18n.translate(\"correct-answer-was\").replace(/__WRONG__/, this._answer + '').replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n } else {\n return html`\n <div class=\"feedback\">\n <div class=\"feedback--content\">\n <h3>Helaas</h3>\n <p>\n ${this.i18n.translate(\"no-answer-correct-answer-was\").replace(/__CORRECT__/, this._solution + '')}\n </p>\n ${this._renderNextQuestionButton()}\n </div>\n </div>\n `;\n }\n }\n\n // renders the next question button\n private _renderNextQuestionButton(): TemplateResult {\n if (this._numberOfQuestionsSeen < this.numberOfQuestions) {\n return html`\n <button @click=\"${this._loadQuestion}\">${this.i18n.translate(\"next-question\")}</button>\n `;\n }\n\n return html` <button @click=\"${this._endGame}\">${this.i18n.translate(\"quit\")}</button> `;\n }\n\n // renders the end of the game\n private _endGame(): void {\n this._renderState = GameState.END;\n }\n\n private renderGameEnd(): TemplateResult {\n // clearInterval(this._scoreIntervalHandler);\n\n console.debug(\"renderGameEnd\");\n return html`\n ${this._renderHeader(\"The end!\")}\n <div class=\"guess-the-year-game-end\">${this.i18n.translate(\"end\")}</div>\n <button @click=\"${() => (this._renderState = GameState.SPLASH)}\">\n ${this.i18n.translate(\"new-game\")}\n </button>\n ${this._renderFooter()}\n `;\n }\n\n // private _incidentsStack = [];\n\n // private _totalScore: number = 0;\n\n private setupNewGame(): void {\n console.log(\"new game!\");\n\n console.info({\n \"number of questions\": this.numberOfQuestions,\n from: this.from.toISOString(),\n to: this.to.toISOString(),\n });\n\n this.totalScore = 0;\n this._numberOfQuestionsSeen = 0;\n\n // this._question.load(this.from.format('YYYY'), this.to.format('YYYY'));\n // this._question.init();\n\n this._loadQuestion();\n }\n\n private _resetStage(): void {\n // window.scrollTo(0, 0);\n this.sources = [];\n this._incident = undefined;\n this._hints = [];\n this._answer = undefined;\n this._answers = [];\n this._hintsIndex = 0;\n this._score0.reset();\n this._showHint = false;\n this._hint = undefined;\n }\n\n async _loadQuestion(): Promise<void> {\n this._resetStage();\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n this.category,\n this.emotion,\n this.impact,\n this.date,\n this.from.format(\"YYYY-MM-DD\"),\n this.to.format(\"YYYY-MM-DD\"),\n \"40\",\n \"quiz_year\"\n );\n\n this._startTime = new Date();\n this._endTime = new Date();\n this._incident = response.incident;\n this.sources = response.sources;\n this._tries = this.maxTries;\n\n this._solution = Number(\n (response.incident?.yearplusmonth || \"\").substring(0, 4),\n );\n\n const answers = [this._solution];\n const from = this.from.year();\n const to = this.to.year();\n\n // generate 3 more random and unique answers between to and from\n while (answers.length < 4) {\n const randomAnswer = Math.floor(Math.random() * (to - from)) + from;\n if (!answers.includes(randomAnswer)) {\n answers.push(randomAnswer);\n }\n }\n\n // sort theses answers\n answers.sort();\n\n this._answers = answers;\n\n for (let i = 0; i < this.maxHints; i++) {\n console.info(\"loading hint\", i);\n\n const response: { incident: Incident | undefined; sources: string[] } =\n await this._apiService.fetchOneIncident(\n this.country,\n Util.shuffleArray(Categories).shift(),\n undefined,\n undefined,\n \"\",\n `${this._solution}-01-01`,\n `${this._solution}-12-31`,\n undefined,\n undefined,\n );\n\n if (response.incident) {\n this._hints.push(response.incident);\n }\n }\n\n if (this._hints.length === 0) {\n this._showHint = false;\n }\n else {\n this._showHint = true;\n }\n\n // start render game stage\n this._renderState = GameState.PLAY;\n\n // start score counter\n this._score0.start();\n\n // increment question counter\n this._numberOfQuestionsSeen += 1;\n }\n\n renderRefreshButton(): TemplateResult {\n return html`<div class=\"refresh\" id=\"refresh\" @click=\"${this.setupNewGame}\">\n <span>${unsafeHTML(RefreshIconSVG)}</span>\n </div>`;\n }\n\n renderStopGameButton(): TemplateResult {\n return html`<div\n class=\"stop-game\"\n id=\"stop-game\"\n @click=\"${() => {\n this._displaySolution = true;\n }}\"\n >\n <span>${unsafeHTML(SolutionIconSVG)}</span>\n </div>`;\n }\n\n renderFeedbackPossibility(): TemplateResult {\n if (this.showFeedback) {\n return html`<div class=\"feedback-possibility\">\n <input\n type=\"text\"\n id=\"feedback\"\n size=\"15\"\n placeholder=\"${this.i18n.translate(\"your-feedback\")}\"\n />\n </div>`;\n } else {\n return html``;\n }\n }\n\n renderSubmitPossibility(): TemplateResult {\n return html`<div class=\"submit-possibility\">\n <input\n type=\"text\"\n id=\"answer\"\n size=\"15\"\n ?disabled=${this._displaySolution}\n placeholder=\"${this.i18n.translate(\"your-answer\")}\"\n />\n ${this.renderTries()}\n </div>`;\n }\n\n renderTries(): TemplateResult {\n const i18nKey = this._tries > 1 ? \"tries-left\" : \"try-left\";\n if (this._tries >= 0 && !this._displaySolution) {\n return html`<span class=\"tries\"\n >${this.i18n\n .translate(i18nKey)\n .replace(\"__TRIES__\", \"\" + this._tries)}</span\n >`;\n }\n return html``;\n }\n\n renderTheSolution(): TemplateResult {\n if (this._displaySolution) {\n return html`<div class=\"solution\">${this._solution}</div>\n ${this.renderTheDuration()} `;\n }\n return html``;\n }\n\n renderTheDuration(): TemplateResult {\n const duration = Math.round(\n new Date(this._endTime.getTime() - this._startTime.getTime()).getTime() /\n 1000,\n );\n const i18nKey = duration === 1 ? \"in-x-seconds\" : \"in-one-second\";\n if (this.showDuration && this._answeredCorrectly) {\n return html`<div class=\"timer\">\n ${this.i18n.translate(i18nKey).replace(\"__SECONDS__\", \"\" + duration)}\n </div>`;\n }\n return html``;\n }\n\n renderTiles(incident: Incident | undefined) {\n console.debug(\"renderTiles\");\n if (!incident) {\n return \"\";\n }\n return html`${this.renderTile(incident)}`;\n }\n\n private _tileShouldDisplayAnImage(incident: Incident): boolean {\n const hasImage = !!incident.image;\n const displayImages = !this.suppressImages;\n return hasImage && displayImages;\n }\n\n renderTile(incident: Incident): TemplateResult {\n console.debug(\"renderTile\");\n const tileContent: TemplateResult = this.renderTileContent(incident);\n if (this._tileShouldDisplayAnImage(incident)) {\n return html`<div class=\"guess-the-year-tile with-image\">\n ${tileContent}\n </div>`;\n }\n\n return html`<div class=\"guess-the-year-tile\">${tileContent}</div>`;\n }\n\n renderTileContent(incident: Incident): TemplateResult {\n console.debug(\"renderTileContent\");\n return html`<div class=\"guess-the-year-tile-content\">\n ${this.renderTileTitle(incident)} ${this.renderTileImage(incident)}\n ${this.renderTileTextContent(incident)}\n </div>`;\n }\n\n private _generateHintText(hintIncident: Incident): string {\n let hint = \"\";\n const hintTemplates = this.i18n.HintTemplates[hintIncident.category];\n switch (hintIncident.category) {\n case \"newsItem\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] || \"\"\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"radioSong\":\n // The title property of radioSongs always follow this pattern: track - artist\n const track = hintIncident.title.replace(/(.*?)\\s+\\-.*/, \"$1\");\n const artist = hintIncident.title.replace(/.*\\-(.*)/, \"$1\");\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n )\n .replace(/__ARTIST__/, artist)\n .replace(/__TRACK__/, track);\n break;\n case \"cinemaMovie\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"tech\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"newsPresenter\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n case \"sports\":\n hint = (\n hintTemplates[Math.round(Math.random() * hintTemplates.length)] ||\n hintTemplates[0]\n ).replace(/__TITLE__/, hintIncident.title);\n break;\n }\n return hint;\n }\n\n renderHintTile(hint: Incident | undefined): TemplateResult {\n if (hint) {\n console.debug(\"renderHint\");\n return html`<div class=\"guess-the-year-hint-tile\">\n <h1 class=\"title\">\n Hint ${this._intervalsPassed} <br />\n ${this._generateHintText(hint)}\n </h1>\n ${this.renderTileTextContent(hint)}\n </div>`;\n }\n return html``;\n }\n\n renderTileTitle(incident: Incident): TemplateResult {\n console.debug(\"renderTileTitle\");\n if (incident.title) {\n return html`<h1 class=\"guess-the-year-tile-title\">${incident.title}</h1>`;\n }\n return html``;\n }\n\n renderTileImage(incident: Incident): TemplateResult {\n console.debug(\"renderTileImage\");\n if (this._tileShouldDisplayAnImage(incident)) {\n return html`<img\n @error=${(evt: Event) => {\n this._handleImageLoadError(evt, incident);\n }}\n src=${incident.image}\n />`;\n }\n return html``;\n }\n\n renderTileTextContent(incident: Incident): TemplateResult {\n console.debug(\"renderTileTextContent\");\n if (incident.text) {\n return html`<p class=\"hint-text\">${incident.text}</p>`;\n }\n return html``;\n }\n\n renderSources(): TemplateResult {\n console.debug(\"renderSources\");\n if (!this.sources.length) {\n return html``;\n }\n // deduplicate array via [...new Set(this.sources)]\n return html`\n <div class=\"guess-the-year-sources\">\n Source: ${[...new Set(this.sources)].join(\", \")}\n </div>\n `;\n }\n\n // private _incidentsTask: Task = new Task(this, {\n // task: async ([]) => {\n // console.debug('incidentsTask');\n // if (!this.loading) {\n // this.loading = true;\n // await this.setupNewGame();\n // this.loading = false;\n // }\n // },\n // args: () => [\n // this.country,\n // this.category,\n // this.emotion,\n // this.impact,\n // this.date,\n // this.from,\n // this.to,\n // ],\n // });\n\n _handleImageLoadError = (evt: Event, incident: Incident) => {\n // grab the image element that triggered the error\n const targetImage = evt.target as HTMLImageElement;\n console.info(`Error loading image: ${targetImage.src}`);\n\n // find out which no image source needs to be used\n const noImageSrc = this.noImageSrc || NoImageImg;\n\n // don't try to set the image source if it\n // has already been set\n if (targetImage.src == noImageSrc) {\n return;\n }\n\n // report broken images back to the server if set.\n if (this.reportBrokenImages) {\n if (incident) {\n this._apiService.postAttributeQualityFeedback(\n incident.id,\n \"image\",\n targetImage.src,\n ContentFeedback.incorrect,\n );\n }\n }\n\n // wait a bit before setting the image\n // so we don't hammer the no image server\n setTimeout(() => {\n targetImage.src = noImageSrc;\n }, 250);\n\n return false;\n };\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"guess-the-year\": GuessTheYear;\n }\n}\n"]}