@hopeplayer/core 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HopePlayerElement.d.ts +23 -0
- package/dist/HopePlayerElement.d.ts.map +1 -1
- package/dist/chunks/{adTriggers-BIAWe8o4.js → adTriggers-DVqgm92F.js} +94 -93
- package/dist/chunks/{adTriggers-BIAWe8o4.js.map → adTriggers-DVqgm92F.js.map} +1 -1
- package/dist/chunks/{ads-DlpHPpR9.js → ads-eSKyiH1o.js} +2 -2
- package/dist/chunks/{ads-DlpHPpR9.js.map → ads-eSKyiH1o.js.map} +1 -1
- package/dist/chunks/audioDescription-cpprKeB-.js +146 -0
- package/dist/chunks/audioDescription-cpprKeB-.js.map +1 -0
- package/dist/chunks/{cast-vHyi7oV_.js → cast-DEowHmqA.js} +29 -28
- package/dist/chunks/{cast-vHyi7oV_.js.map → cast-DEowHmqA.js.map} +1 -1
- package/dist/chunks/{docPip-wybMVP1H.js → docPip-Bh6BWPk-.js} +30 -20
- package/dist/chunks/docPip-Bh6BWPk-.js.map +1 -0
- package/dist/chunks/heatmap-Bz_EMQFk.js +117 -0
- package/dist/chunks/heatmap-Bz_EMQFk.js.map +1 -0
- package/dist/chunks/{history-CwqLXiZi.js → history-ZSdDDsRF.js} +35 -34
- package/dist/chunks/{history-CwqLXiZi.js.map → history-ZSdDDsRF.js.map} +1 -1
- package/dist/chunks/interactive-ClJC5Vyo.js +213 -0
- package/dist/chunks/interactive-ClJC5Vyo.js.map +1 -0
- package/dist/chunks/{markers-L69W3kj6.js → markers-D32rI-x-.js} +2 -2
- package/dist/chunks/{markers-L69W3kj6.js.map → markers-D32rI-x-.js.map} +1 -1
- package/dist/chunks/multiview-CL1WfJKt.js +295 -0
- package/dist/chunks/multiview-CL1WfJKt.js.map +1 -0
- package/dist/chunks/{pauseAd-BQQe21X4.js → pauseAd-DF7KGwUs.js} +32 -31
- package/dist/chunks/{pauseAd-BQQe21X4.js.map → pauseAd-DF7KGwUs.js.map} +1 -1
- package/dist/chunks/{player-D2_HRzot.js → player-B7mYS--8.js} +754 -682
- package/dist/chunks/player-B7mYS--8.js.map +1 -0
- package/dist/chunks/{playlist-CHfStNbQ.js → playlist-BkhIOfCy.js} +2 -2
- package/dist/chunks/{playlist-CHfStNbQ.js.map → playlist-BkhIOfCy.js.map} +1 -1
- package/dist/chunks/{pluginHost-cN2uGFeG.js → pluginHost-CXqkjNV1.js} +2 -2
- package/dist/chunks/{pluginHost-cN2uGFeG.js.map → pluginHost-CXqkjNV1.js.map} +1 -1
- package/dist/chunks/{redirectScreen-TIqLdvBY.js → redirectScreen-DgmjFVJH.js} +51 -39
- package/dist/chunks/redirectScreen-DgmjFVJH.js.map +1 -0
- package/dist/chunks/rewardedUnlock-BL97P5ht.js +265 -0
- package/dist/chunks/{rewardedUnlock-DUqYwXTr.js.map → rewardedUnlock-BL97P5ht.js.map} +1 -1
- package/dist/chunks/{segments-Ds-c1b5e.js → segments-CuQQEIAX.js} +2 -2
- package/dist/chunks/{segments-Ds-c1b5e.js.map → segments-CuQQEIAX.js.map} +1 -1
- package/dist/chunks/share-BdqQ8sGE.js +216 -0
- package/dist/chunks/share-BdqQ8sGE.js.map +1 -0
- package/dist/chunks/{skipSegments-ByNoF1qZ.js → skipSegments-BbepQ4Y6.js} +2 -2
- package/dist/chunks/{skipSegments-ByNoF1qZ.js.map → skipSegments-BbepQ4Y6.js.map} +1 -1
- package/dist/chunks/sponsorship-DoAZBbHE.js +241 -0
- package/dist/chunks/{sponsorship-BT21uwN5.js.map → sponsorship-DoAZBbHE.js.map} +1 -1
- package/dist/chunks/{spriteThumbnails-Cr9UmkM9.js → spriteThumbnails-BYg-DHx4.js} +2 -2
- package/dist/chunks/{spriteThumbnails-Cr9UmkM9.js.map → spriteThumbnails-BYg-DHx4.js.map} +1 -1
- package/dist/chunks/{story-CodA2dfn.js → story-DcBG6jUg.js} +2 -2
- package/dist/chunks/{story-CodA2dfn.js.map → story-DcBG6jUg.js.map} +1 -1
- package/dist/chunks/{transcript-LG7E9UYE.js → transcript-CHPQ6S6E.js} +33 -13
- package/dist/chunks/transcript-CHPQ6S6E.js.map +1 -0
- package/dist/controls/SeekBar.d.ts.map +1 -1
- package/dist/hls/SourceManager.d.ts +2 -0
- package/dist/hls/SourceManager.d.ts.map +1 -1
- package/dist/hope-player.js +3 -3
- package/dist/i18n/index.d.ts +9 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/locales/en.d.ts +2 -2
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/tr.d.ts +2 -2
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +27 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plugins/ad-triggers/index.d.ts.map +1 -1
- package/dist/plugins/audio-description/AudioDescription.d.ts +52 -0
- package/dist/plugins/audio-description/AudioDescription.d.ts.map +1 -0
- package/dist/plugins/audio-description/index.d.ts +6 -0
- package/dist/plugins/audio-description/index.d.ts.map +1 -0
- package/dist/plugins/audio-description/strings.d.ts +8 -0
- package/dist/plugins/audio-description/strings.d.ts.map +1 -0
- package/dist/plugins/cast/index.d.ts.map +1 -1
- package/dist/plugins/doc-pip/index.d.ts.map +1 -1
- package/dist/plugins/doc-pip/strings.d.ts +8 -0
- package/dist/plugins/doc-pip/strings.d.ts.map +1 -0
- package/dist/plugins/heatmap/Heatmap.d.ts +8 -0
- package/dist/plugins/heatmap/Heatmap.d.ts.map +1 -1
- package/dist/plugins/heatmap/index.d.ts.map +1 -1
- package/dist/plugins/heatmap/strings.d.ts +8 -0
- package/dist/plugins/heatmap/strings.d.ts.map +1 -0
- package/dist/plugins/history/index.d.ts.map +1 -1
- package/dist/plugins/interactive/index.d.ts.map +1 -1
- package/dist/plugins/interactive/strings.d.ts +8 -0
- package/dist/plugins/interactive/strings.d.ts.map +1 -0
- package/dist/plugins/multiview/Multiview.d.ts +92 -0
- package/dist/plugins/multiview/Multiview.d.ts.map +1 -0
- package/dist/plugins/multiview/index.d.ts +6 -0
- package/dist/plugins/multiview/index.d.ts.map +1 -0
- package/dist/plugins/multiview/strings.d.ts +8 -0
- package/dist/plugins/multiview/strings.d.ts.map +1 -0
- package/dist/plugins/pause-ad/index.d.ts.map +1 -1
- package/dist/plugins/redirect-screen/index.d.ts.map +1 -1
- package/dist/plugins/redirect-screen/strings.d.ts +8 -0
- package/dist/plugins/redirect-screen/strings.d.ts.map +1 -0
- package/dist/plugins/rewarded/index.d.ts.map +1 -1
- package/dist/plugins/share/Share.d.ts +45 -0
- package/dist/plugins/share/Share.d.ts.map +1 -0
- package/dist/plugins/share/index.d.ts +6 -0
- package/dist/plugins/share/index.d.ts.map +1 -0
- package/dist/plugins/share/strings.d.ts +8 -0
- package/dist/plugins/share/strings.d.ts.map +1 -0
- package/dist/plugins/skip-segments/index.d.ts.map +1 -1
- package/dist/plugins/sponsorship/index.d.ts.map +1 -1
- package/dist/plugins/transcript/index.d.ts.map +1 -1
- package/dist/plugins/transcript/strings.d.ts +8 -0
- package/dist/plugins/transcript/strings.d.ts.map +1 -0
- package/dist/types/index.d.ts +93 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/docPip-wybMVP1H.js.map +0 -1
- package/dist/chunks/heatmap-Bb7neaYU.js +0 -92
- package/dist/chunks/heatmap-Bb7neaYU.js.map +0 -1
- package/dist/chunks/interactive-CgltIneu.js +0 -189
- package/dist/chunks/interactive-CgltIneu.js.map +0 -1
- package/dist/chunks/player-D2_HRzot.js.map +0 -1
- package/dist/chunks/redirectScreen-TIqLdvBY.js.map +0 -1
- package/dist/chunks/rewardedUnlock-DUqYwXTr.js +0 -264
- package/dist/chunks/sponsorship-BT21uwN5.js +0 -240
- package/dist/chunks/transcript-LG7E9UYE.js.map +0 -1
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
var C = Object.defineProperty;
|
|
2
2
|
var k = (p, e, t) => e in p ? C(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
|
|
3
3
|
var m = (p, e, t) => k(p, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { c as x } from "./player-
|
|
5
|
-
import { a as
|
|
6
|
-
const
|
|
7
|
-
|
|
4
|
+
import { c as x, r as N } from "./player-B7mYS--8.js";
|
|
5
|
+
import { a as A } from "./plugin-style-CPJELe-i.js";
|
|
6
|
+
const L = {
|
|
7
|
+
tr: {
|
|
8
|
+
redirectSuggestions: "Önerilen videolar",
|
|
9
|
+
redirectReplay: "Tekrar izle",
|
|
10
|
+
redirectCloseSuggestions: "Önerileri kapat"
|
|
11
|
+
},
|
|
12
|
+
en: {
|
|
13
|
+
redirectSuggestions: "Recommended videos",
|
|
14
|
+
redirectReplay: "Watch again",
|
|
15
|
+
redirectCloseSuggestions: "Close suggestions"
|
|
16
|
+
}
|
|
17
|
+
}, S = '.hp-redirect-thumb{position:relative;display:block;flex:none;overflow:hidden;aspect-ratio:16 / 9;border-radius:8px;background:#111}.hp-redirect-thumb img{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:cover;transition:transform .3s}.hp-redirect-ring{position:absolute;top:50%;left:50%;width:44px;height:44px;transform:translate(-50%,-50%) rotate(-90deg);filter:drop-shadow(0 2px 6px rgba(0,0,0,.6))}.hp-redirect-ring-track{fill:#00000073;stroke:#ffffff47;stroke-width:3}.hp-redirect-ring-bar{fill:none;stroke:var(--hp-color-accent, #fff);stroke-width:3;stroke-linecap:round;transition:stroke-dashoffset .3s linear}.hp-redirect-play{position:absolute;top:50%;left:50%;transform:translate(-45%,-50%);color:#fff;font-size:18px;line-height:1}.hp-redirect-duration{position:absolute;right:5px;bottom:5px;padding:1px 5px;border-radius:4px;background:#000000c7;color:#fff;font:600 10px/1.4 system-ui,-apple-system,sans-serif}.hp-redirect-label{color:var(--hp-color-accent, #fff);font:700 10px/1.2 system-ui,-apple-system,sans-serif;letter-spacing:.1em;text-transform:uppercase}.hp-redirect-title{display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical;font:600 13px/1.3 system-ui,-apple-system,sans-serif}.hp-redirect-sub{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:.7;font:500 11px/1.3 system-ui,-apple-system,sans-serif}.hp-redirect-card{position:absolute;z-index:24;display:flex;align-items:stretch;width:min(340px,calc(100% - 24px));border-radius:12px;background:#0e0e12e6;color:#fff;box-shadow:0 16px 36px -14px #000000d9;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);animation:hp-redirect-in .35s cubic-bezier(.2,.8,.2,1);transition:bottom .25s,top .25s}.hp-redirect-card[data-position=bottom-right]{right:12px;bottom:76px}.hp-redirect-card[data-position=bottom-left]{left:12px;bottom:76px}.hp-redirect-card[data-position=top-right]{right:12px;top:12px}.hp-redirect-card[data-position=top-left]{left:12px;top:12px}.video-area[data-chrome-hidden] .hp-redirect-card[data-position^=bottom]{bottom:12px}.hp-redirect-card-main{display:flex;flex:1;min-width:0;gap:10px;align-items:center;padding:8px;border:0;border-radius:12px;background:transparent;color:inherit;text-align:left;cursor:pointer}.hp-redirect-card-main .hp-redirect-thumb{width:42%}.hp-redirect-card-main:hover .hp-redirect-thumb img{transform:scale(1.04)}.hp-redirect-text{display:flex;flex-direction:column;gap:3px;min-width:0;padding-right:22px}.hp-redirect-close{position:absolute;top:6px;right:6px;display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:999px;background:#ffffff1f;color:#fff;font-size:13px;cursor:pointer}.hp-redirect-close:hover{background:#ffffff3d}.hp-redirect-card-main:focus-visible,.hp-redirect-close:focus-visible,.hp-redirect-poster:focus-visible,.hp-redirect-btn:focus-visible{outline:2px solid var(--hp-color-accent, #fff);outline-offset:2px}.video-area[data-compact] .hp-redirect-card{width:min(260px,calc(100% - 16px))}.video-area[data-compact] .hp-redirect-card[data-position^=bottom]{bottom:56px}.video-area[data-compact][data-chrome-hidden] .hp-redirect-card[data-position^=bottom]{bottom:8px}.video-area[data-compact] .hp-redirect-card .hp-redirect-sub{display:none}.video-area[data-compact] .hp-redirect-card .hp-redirect-ring{width:34px;height:34px}.hp-redirect-screen{position:absolute;top:0;right:0;bottom:0;left:0;z-index:30;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:16px;background:#060609e6;color:#fff;text-align:center;animation:hp-redirect-fade .3s ease-out}.hp-redirect-bg{position:absolute;top:-20px;right:-20px;bottom:-20px;left:-20px;width:calc(100% + 40px);height:calc(100% + 40px);object-fit:cover;opacity:.35;filter:blur(18px) saturate(1.2)}.hp-redirect-panel{position:relative;display:flex;flex-direction:column;align-items:center;gap:8px;width:min(420px,100%)}.hp-redirect-poster{width:min(320px,70%);padding:0;border:0;border-radius:10px;background:transparent;cursor:pointer;box-shadow:0 18px 40px -16px #000000e6}.hp-redirect-poster .hp-redirect-thumb{width:100%;border-radius:10px}.hp-redirect-poster .hp-redirect-ring{width:64px;height:64px}.hp-redirect-poster .hp-redirect-play{font-size:24px}.hp-redirect-screen .hp-redirect-title{font-size:16px}.hp-redirect-counter{opacity:.75;font:500 12px/1.4 system-ui,-apple-system,sans-serif}.hp-redirect-actions{display:flex;gap:8px;margin-top:4px}.hp-redirect-btn{padding:7px 16px;border:0;border-radius:999px;background:#ffffff24;color:#fff;font:600 13px/1 system-ui,-apple-system,sans-serif;cursor:pointer}.hp-redirect-btn:hover{background:#ffffff3d}.hp-redirect-btn-primary,.hp-redirect-btn-primary:hover{background:var(--hp-color-accent, #fff);color:var(--hp-color-on-accent, #000)}.video-area[data-compact] .hp-redirect-poster{width:min(200px,55%)}.video-area[data-compact] .hp-redirect-screen .hp-redirect-sub,.video-area[data-compact] .hp-redirect-counter{display:none}.hp-redirect-suggestions{position:absolute;top:0;right:0;bottom:0;left:0;z-index:30;display:flex;flex-direction:column;gap:12px;overflow-y:auto;padding:16px clamp(16px,4%,40px);background:#060609eb;color:#fff;animation:hp-redirect-fade .25s ease-out}.hp-redirect-grid-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.hp-redirect-grid-title{font:600 15px/1.3 system-ui,-apple-system,sans-serif}.hp-redirect-suggestions .hp-redirect-close{position:static}.hp-redirect-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));align-content:center;gap:14px 12px;flex:1}.hp-redirect-grid[data-count="1"],.hp-redirect-grid[data-count="2"]{grid-template-columns:repeat(auto-fit,minmax(160px,260px));justify-content:center}.hp-redirect-grid[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr));max-width:640px;width:100%;margin-inline:auto}.hp-redirect-grid[data-count="3"],.hp-redirect-grid[data-count="5"],.hp-redirect-grid[data-count="6"]{grid-template-columns:repeat(3,minmax(0,1fr))}.hp-redirect-suggestion{display:flex;flex-direction:column;gap:4px;min-width:0;color:#fff;text-decoration:none}.hp-redirect-replay{display:inline-flex;align-items:center;gap:6px;align-self:center}.video-area[data-compact] .hp-redirect-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-content:start}.video-area[data-compact] .hp-redirect-suggestion .hp-redirect-sub{display:none}.hp-redirect-suggestion .hp-redirect-play{opacity:0;font-size:22px;transition:opacity .2s}.hp-redirect-suggestion:hover .hp-redirect-play,.hp-redirect-suggestion:focus-visible .hp-redirect-play{opacity:1}.hp-redirect-suggestion:hover .hp-redirect-thumb,.hp-redirect-suggestion:focus-visible .hp-redirect-thumb{outline:2px solid var(--hp-color-accent, #fff)}@media(prefers-reduced-motion:reduce){.hp-redirect-card,.hp-redirect-screen{animation:none}}', v = "http://www.w3.org/2000/svg", w = 18, E = 2 * Math.PI * w, T = 10;
|
|
18
|
+
function R(p) {
|
|
8
19
|
const e = document.createElementNS(v, "svg");
|
|
9
20
|
e.setAttribute("viewBox", "0 0 40 40"), e.setAttribute("aria-hidden", "true"), e.setAttribute("class", p);
|
|
10
21
|
const t = document.createElementNS(v, "circle"), i = document.createElementNS(v, "circle");
|
|
@@ -21,14 +32,14 @@ function y(p, e, t) {
|
|
|
21
32
|
const n = document.createElement("img");
|
|
22
33
|
n.src = p, n.alt = "", n.decoding = "async", n.addEventListener("error", () => n.remove()), i.appendChild(n);
|
|
23
34
|
}
|
|
24
|
-
const r =
|
|
25
|
-
if (
|
|
35
|
+
const r = R("hp-redirect-ring"), a = document.createElement("span");
|
|
36
|
+
if (a.className = "hp-redirect-play", a.appendChild(x("play")), i.append(r.el, a), e) {
|
|
26
37
|
const n = document.createElement("span");
|
|
27
38
|
n.className = "hp-redirect-duration", n.textContent = e, i.appendChild(n);
|
|
28
39
|
}
|
|
29
40
|
return { el: i, ring: r };
|
|
30
41
|
}
|
|
31
|
-
class
|
|
42
|
+
class P {
|
|
32
43
|
constructor(e, t) {
|
|
33
44
|
m(this, "counterTimer", null);
|
|
34
45
|
m(this, "wrapper", null);
|
|
@@ -54,7 +65,7 @@ class T {
|
|
|
54
65
|
// ── 'card' modu ─────────────────────────────────────────────────────────
|
|
55
66
|
m(this, "onTimeUpdate", () => {
|
|
56
67
|
var n;
|
|
57
|
-
const e = this.ctx.videoEl, t = Math.max(1, this.options.showBefore ??
|
|
68
|
+
const e = this.ctx.videoEl, t = Math.max(1, this.options.showBefore ?? T), i = e.duration;
|
|
58
69
|
if (!Number.isFinite(i) || i <= 0) return;
|
|
59
70
|
const r = i - e.currentTime;
|
|
60
71
|
if (r > t) {
|
|
@@ -66,10 +77,10 @@ class T {
|
|
|
66
77
|
return;
|
|
67
78
|
}
|
|
68
79
|
this.card || this.showCard();
|
|
69
|
-
const
|
|
70
|
-
(n = this.cardRing) == null || n.set(r / t), this.cardLabel && (this.cardLabel.textContent = `${this.options.label ?? this.ctx.i18n.redirectUpNext} · ${
|
|
80
|
+
const a = Math.ceil(r);
|
|
81
|
+
(n = this.cardRing) == null || n.set(r / t), this.cardLabel && (this.cardLabel.textContent = `${this.options.label ?? this.ctx.i18n.redirectUpNext} · ${a}`);
|
|
71
82
|
});
|
|
72
|
-
this.ctx = e, this.options = t, this.mode = t.mode === "card" || t.mode === "endScreen" ? t.mode : "screen",
|
|
83
|
+
this.ctx = e, this.options = t, this.mode = t.mode === "card" || t.mode === "endScreen" ? t.mode : "screen", A(e.overlayContainerEl, "redirect-screen", S), t.enabled !== !1 && (e.videoEl.addEventListener("ended", this.onEnded), e.videoEl.addEventListener("play", this.onPlay), this.mode === "card" && e.videoEl.addEventListener("timeupdate", this.onTimeUpdate));
|
|
73
84
|
}
|
|
74
85
|
/** Ekranlar her gösterimde güncel `ctx.i18n` ile kurulur; açık kartın etiketi burada tazelenir. */
|
|
75
86
|
refreshLabels() {
|
|
@@ -110,20 +121,20 @@ class T {
|
|
|
110
121
|
t.className = "hp-redirect-card", t.setAttribute("part", "redirect-card"), t.setAttribute("data-position", e.position ?? "bottom-right");
|
|
111
122
|
const i = document.createElement("button");
|
|
112
123
|
i.type = "button", i.className = "hp-redirect-card-main", i.addEventListener("click", () => this.go("click"));
|
|
113
|
-
const r = y(e.image, e.duration, "hp-redirect-thumb"),
|
|
114
|
-
|
|
124
|
+
const r = y(e.image, e.duration, "hp-redirect-thumb"), a = document.createElement("span");
|
|
125
|
+
a.className = "hp-redirect-text";
|
|
115
126
|
const n = document.createElement("span");
|
|
116
|
-
if (n.className = "hp-redirect-label",
|
|
127
|
+
if (n.className = "hp-redirect-label", a.appendChild(n), e.title) {
|
|
117
128
|
const c = document.createElement("span");
|
|
118
|
-
c.className = "hp-redirect-title", c.textContent = e.title,
|
|
129
|
+
c.className = "hp-redirect-title", c.textContent = e.title, a.appendChild(c);
|
|
119
130
|
}
|
|
120
131
|
if (e.subtitle) {
|
|
121
132
|
const c = document.createElement("span");
|
|
122
|
-
c.className = "hp-redirect-sub", c.textContent = e.subtitle,
|
|
133
|
+
c.className = "hp-redirect-sub", c.textContent = e.subtitle, a.appendChild(c);
|
|
123
134
|
}
|
|
124
135
|
r.el.setAttribute("aria-hidden", "true");
|
|
125
136
|
const l = document.createElement("span");
|
|
126
|
-
l.className = "hp-sr-only", l.textContent = ` — ${this.ctx.i18n.redirectPlayNow}`,
|
|
137
|
+
l.className = "hp-sr-only", l.textContent = ` — ${this.ctx.i18n.redirectPlayNow}`, a.appendChild(l), i.append(r.el, a);
|
|
127
138
|
const d = document.createElement("button");
|
|
128
139
|
d.type = "button", d.className = "hp-redirect-close", d.setAttribute("aria-label", this.ctx.i18n.redirectCancelCard), d.appendChild(x("close")), d.addEventListener("click", () => {
|
|
129
140
|
this.cancelled = !0, this.hideCard(), this.emit("cancel");
|
|
@@ -144,23 +155,23 @@ class T {
|
|
|
144
155
|
this.remove();
|
|
145
156
|
const e = this.options, t = document.createElement("div");
|
|
146
157
|
if (t.setAttribute("part", "redirect-screen"), t.className = "hp-redirect-screen", e.image) {
|
|
147
|
-
const
|
|
148
|
-
|
|
158
|
+
const s = document.createElement("img");
|
|
159
|
+
s.className = "hp-redirect-bg", s.src = e.image, s.alt = "", s.addEventListener("error", () => s.remove()), t.appendChild(s);
|
|
149
160
|
}
|
|
150
161
|
const i = document.createElement("div");
|
|
151
162
|
i.className = "hp-redirect-panel";
|
|
152
163
|
const r = document.createElement("span");
|
|
153
164
|
r.className = "hp-redirect-label", r.textContent = e.label ?? this.ctx.i18n.redirectUpNext, i.appendChild(r);
|
|
154
|
-
const
|
|
155
|
-
|
|
165
|
+
const a = document.createElement("button");
|
|
166
|
+
a.type = "button", a.className = "hp-redirect-poster", a.setAttribute("aria-label", this.ctx.i18n.redirectPlayNow);
|
|
156
167
|
const n = y(e.image, e.duration, "hp-redirect-thumb");
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
159
|
-
|
|
168
|
+
if (a.appendChild(n.el), a.addEventListener("click", () => this.go("click")), i.appendChild(a), e.title) {
|
|
169
|
+
const s = document.createElement("div");
|
|
170
|
+
s.className = "hp-redirect-title", s.textContent = e.title, i.appendChild(s);
|
|
160
171
|
}
|
|
161
172
|
if (e.subtitle) {
|
|
162
|
-
const
|
|
163
|
-
|
|
173
|
+
const s = document.createElement("div");
|
|
174
|
+
s.className = "hp-redirect-sub", s.textContent = e.subtitle, i.appendChild(s);
|
|
164
175
|
}
|
|
165
176
|
const l = document.createElement("div");
|
|
166
177
|
l.className = "hp-redirect-counter", l.setAttribute("aria-live", "polite"), i.appendChild(l);
|
|
@@ -170,10 +181,10 @@ class T {
|
|
|
170
181
|
c.type = "button", c.className = "hp-redirect-btn", c.textContent = this.ctx.i18n.redirectCancel;
|
|
171
182
|
const o = document.createElement("button");
|
|
172
183
|
o.type = "button", o.className = "hp-redirect-btn hp-redirect-btn-primary", o.textContent = this.ctx.i18n.redirectPlayNow, o.addEventListener("click", () => this.go("click")), c.addEventListener("click", () => {
|
|
173
|
-
var
|
|
174
|
-
this.remove(), this.emit("cancel"), (
|
|
184
|
+
var s;
|
|
185
|
+
this.remove(), this.emit("cancel"), (s = e.suggestions) != null && s.length && this.showSuggestions(e.suggestions);
|
|
175
186
|
}), d.append(c, o), i.appendChild(d), t.appendChild(i);
|
|
176
|
-
for (const
|
|
187
|
+
for (const s of ["pointerdown", "click", "dblclick"]) t.addEventListener(s, (b) => b.stopPropagation());
|
|
177
188
|
this.ctx.overlayContainerEl.appendChild(t), this.wrapper = t, this.emit("shown");
|
|
178
189
|
const u = Math.max(0, e.time ?? 10);
|
|
179
190
|
let h = u;
|
|
@@ -193,12 +204,12 @@ class T {
|
|
|
193
204
|
this.remove();
|
|
194
205
|
const t = this.options, i = this.ctx.i18n, r = document.createElement("div");
|
|
195
206
|
r.setAttribute("part", "redirect-suggestions"), r.className = "hp-redirect-suggestions", r.setAttribute("role", "region");
|
|
196
|
-
const
|
|
197
|
-
r.setAttribute("aria-label",
|
|
207
|
+
const a = t.suggestionsTitle ?? i.redirectSuggestions;
|
|
208
|
+
r.setAttribute("aria-label", a);
|
|
198
209
|
const n = document.createElement("div");
|
|
199
210
|
n.className = "hp-redirect-grid-head";
|
|
200
211
|
const l = document.createElement("span");
|
|
201
|
-
l.className = "hp-redirect-grid-title", l.textContent =
|
|
212
|
+
l.className = "hp-redirect-grid-title", l.textContent = a;
|
|
202
213
|
const d = document.createElement("button");
|
|
203
214
|
d.type = "button", d.className = "hp-redirect-close", d.setAttribute("aria-label", i.redirectCloseSuggestions), d.appendChild(x("close")), d.addEventListener("click", () => this.remove()), n.append(l, d);
|
|
204
215
|
const c = document.createElement("div");
|
|
@@ -208,8 +219,8 @@ class T {
|
|
|
208
219
|
h.href = o.url, t.newTab && (h.target = "_blank", h.rel = "noopener"), h.className = "hp-redirect-suggestion";
|
|
209
220
|
const f = y(o.image, o.duration, "hp-redirect-thumb");
|
|
210
221
|
(b = f.el.querySelector(".hp-redirect-ring")) == null || b.remove();
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
222
|
+
const s = document.createElement("span");
|
|
223
|
+
if (s.className = "hp-redirect-title", s.textContent = o.title, h.append(f.el, s), o.subtitle) {
|
|
213
224
|
const g = document.createElement("span");
|
|
214
225
|
g.className = "hp-redirect-sub", g.textContent = o.subtitle, h.appendChild(g);
|
|
215
226
|
}
|
|
@@ -229,11 +240,12 @@ class T {
|
|
|
229
240
|
this.ctx.overlayContainerEl.appendChild(r), this.wrapper = r;
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
N(L);
|
|
244
|
+
function M(p, e) {
|
|
245
|
+
return new P(p, e);
|
|
234
246
|
}
|
|
235
247
|
export {
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
P as RedirectScreen,
|
|
249
|
+
M as installRedirectScreen
|
|
238
250
|
};
|
|
239
|
-
//# sourceMappingURL=redirectScreen-
|
|
251
|
+
//# sourceMappingURL=redirectScreen-DgmjFVJH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirectScreen-DgmjFVJH.js","sources":["../../src/plugins/redirect-screen/strings.ts","../../src/plugins/redirect-screen/RedirectScreen.ts","../../src/plugins/redirect-screen/index.ts"],"sourcesContent":["// Bu eklentinin metinleri — ana pakete girmez, eklenti yüklenince sözlüğe eklenir (bkz. i18n/index.ts).\nimport type { HopeLocaleStrings } from '../../i18n/types';\n\ntype Strings = Pick<HopeLocaleStrings, 'redirectSuggestions' | 'redirectReplay' | 'redirectCloseSuggestions'>;\n\nexport const strings: { tr: Strings; en: Strings } = {\n tr: {\n redirectSuggestions: 'Önerilen videolar',\n redirectReplay: 'Tekrar izle',\n redirectCloseSuggestions: 'Önerileri kapat',\n },\n en: {\n redirectSuggestions: 'Recommended videos',\n redirectReplay: 'Watch again',\n redirectCloseSuggestions: 'Close suggestions',\n },\n};\n","import type { RedirectScreenOptions, RedirectScreenSuggestion } from '../../types';\nimport type { HopeLocaleStrings } from '../../i18n/types';\nimport { createIcon } from '../../icons/Icon';\nimport { adoptStyle } from '../../utils/plugin-style';\nimport css from './redirect-screen.css?inline';\n\nexport interface RedirectScreenPlayerContext {\n /** hp:redirect olayları ve postroll'un bitişini (hp:adend) dinlemek için. */\n hostEl: HTMLElement;\n videoEl: HTMLVideoElement;\n overlayContainerEl: HTMLElement;\n isAdActive(): boolean;\n i18n: HopeLocaleStrings;\n}\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst RING_R = 18;\nconst RING_C = 2 * Math.PI * RING_R;\nconst DEFAULT_SHOW_BEFORE = 10;\n\n/** Dairesel geri sayım halkası (SVG) — `set(oran)` ile 1 → 0 boşalır. */\nfunction ring(className: string): { el: SVGSVGElement; set(fraction: number): void } {\n const svg = document.createElementNS(SVG_NS, 'svg');\n svg.setAttribute('viewBox', '0 0 40 40');\n svg.setAttribute('aria-hidden', 'true');\n svg.setAttribute('class', className);\n const track = document.createElementNS(SVG_NS, 'circle');\n const bar = document.createElementNS(SVG_NS, 'circle');\n for (const c of [track, bar]) {\n c.setAttribute('cx', '20');\n c.setAttribute('cy', '20');\n c.setAttribute('r', String(RING_R));\n }\n track.setAttribute('class', 'hp-redirect-ring-track');\n bar.setAttribute('class', 'hp-redirect-ring-bar');\n bar.setAttribute('stroke-dasharray', String(RING_C));\n svg.append(track, bar);\n return {\n el: svg,\n set: (fraction) => bar.setAttribute('stroke-dashoffset', String(RING_C * (1 - Math.min(1, Math.max(0, fraction))))),\n };\n}\n\n/** Görsel + süre rozeti + oynat ikonu + halka — kart ve tam ekran aynı parçayı kullanır. */\nfunction thumb(image: string | undefined, duration: string | undefined, className: string): { el: HTMLSpanElement; ring: ReturnType<typeof ring> } {\n const el = document.createElement('span');\n el.className = className;\n if (image) {\n const img = document.createElement('img');\n img.src = image;\n img.alt = '';\n img.decoding = 'async';\n img.addEventListener('error', () => img.remove());\n el.appendChild(img);\n }\n const r = ring('hp-redirect-ring');\n const play = document.createElement('span');\n play.className = 'hp-redirect-play';\n play.appendChild(createIcon('play'));\n el.append(r.el, play);\n if (duration) {\n const d = document.createElement('span');\n d.className = 'hp-redirect-duration';\n d.textContent = duration;\n el.appendChild(d);\n }\n return { el, ring: r };\n}\n\n/**\n * Sıradaki videoya yönlendirme. Üç mod:\n * - 'screen' (varsayılan): video bitince tam alan ekran + `time` sn geri sayım; iptal → öneriler.\n * - 'card': bitime `showBefore` sn kala köşede küçük \"Sıradaki\" kartı; geri sayım videoyla birlikte işler (duraklatınca\n * durur), video bitince yönlendirilir. Karta tıklamak hemen yönlendirir, X iptal eder.\n * - 'endScreen': yönlendirme yok; video bitince doğrudan öneri ızgarası (bitiş ekranı).\n * Bitişte postroll oynuyorsa yönlendirme reklam bitene kadar bekler. `hp:redirect` (state: redirect) iptal edilirse\n * (`preventDefault`) sayfa değişmez.\n */\nexport class RedirectScreen {\n private counterTimer: ReturnType<typeof setInterval> | null = null;\n private wrapper: HTMLElement | null = null;\n private card: HTMLDivElement | null = null;\n private cardRing: ReturnType<typeof ring> | null = null;\n private cardLabel: HTMLSpanElement | null = null;\n private cancelled = false;\n private waitingForAd = false;\n private readonly mode: 'screen' | 'card' | 'endScreen';\n\n constructor(\n private readonly ctx: RedirectScreenPlayerContext,\n private readonly options: RedirectScreenOptions\n ) {\n this.mode = options.mode === 'card' || options.mode === 'endScreen' ? options.mode : 'screen';\n adoptStyle(ctx.overlayContainerEl, 'redirect-screen', css);\n if (options.enabled === false) return;\n ctx.videoEl.addEventListener('ended', this.onEnded);\n ctx.videoEl.addEventListener('play', this.onPlay);\n if (this.mode === 'card') ctx.videoEl.addEventListener('timeupdate', this.onTimeUpdate);\n }\n\n /** Ekranlar her gösterimde güncel `ctx.i18n` ile kurulur; açık kartın etiketi burada tazelenir. */\n refreshLabels(): void {\n this.card?.querySelector('.hp-redirect-close')?.setAttribute('aria-label', this.ctx.i18n.redirectCancelCard);\n }\n\n destroy(): void {\n const v = this.ctx.videoEl;\n v.removeEventListener('ended', this.onEnded);\n v.removeEventListener('play', this.onPlay);\n v.removeEventListener('timeupdate', this.onTimeUpdate);\n this.ctx.hostEl.removeEventListener('hp:adend', this.onAdEnd);\n this.remove();\n this.hideCard();\n }\n\n private emit(\n state: 'shown' | 'cancel' | 'redirect' | 'replay',\n reason?: 'auto' | 'click' | 'suggestion',\n url = this.options.url ?? '',\n index?: number\n ): boolean {\n return this.ctx.hostEl.dispatchEvent(\n new CustomEvent('hp:redirect', { detail: { state, url, mode: this.mode, reason, index }, cancelable: state === 'redirect' })\n );\n }\n\n private go(reason: 'auto' | 'click'): void {\n this.remove();\n this.hideCard();\n const url = this.options.url;\n if (!this.emit('redirect', reason) || !url) return; // entegratör kendisi yönlendirecek\n if (this.options.newTab) window.open(url, '_blank', 'noopener');\n else window.location.href = url;\n }\n\n private readonly onPlay = (): void => {\n this.remove();\n };\n\n private readonly onEnded = (): void => {\n // Postroll oynuyorsa (ya da birazdan başlayacaksa) reklam bitince devam.\n if (this.ctx.isAdActive()) {\n this.waitForAd();\n return;\n }\n this.finish();\n };\n\n private waitForAd(): void {\n if (this.waitingForAd) return;\n this.waitingForAd = true;\n this.ctx.hostEl.addEventListener('hp:adend', this.onAdEnd);\n }\n\n private readonly onAdEnd = (): void => {\n this.ctx.hostEl.removeEventListener('hp:adend', this.onAdEnd);\n this.waitingForAd = false;\n if (this.ctx.videoEl.ended) this.finish();\n };\n\n private finish(): void {\n if (this.mode === 'endScreen') {\n if (this.options.suggestions?.length) {\n this.showSuggestions(this.options.suggestions);\n this.emit('shown');\n }\n return;\n }\n if (this.mode === 'card') {\n this.hideCard();\n if (!this.cancelled) this.go('auto');\n else if (this.options.suggestions?.length) this.showSuggestions(this.options.suggestions);\n return;\n }\n this.createScreen();\n }\n\n // ── 'card' modu ─────────────────────────────────────────────────────────\n\n private readonly onTimeUpdate = (): void => {\n const v = this.ctx.videoEl;\n const showBefore = Math.max(1, this.options.showBefore ?? DEFAULT_SHOW_BEFORE);\n const d = v.duration;\n if (!Number.isFinite(d) || d <= 0) return; // canlı yayında kart yok\n const remaining = d - v.currentTime;\n if (remaining > showBefore) {\n // Geri sarıldı (eşiğin belirgin üstüne): iptal unutulur — tekrar yaklaşınca kart yine gelir.\n if (remaining > showBefore + 1) this.cancelled = false;\n this.hideCard();\n return;\n }\n if (this.cancelled || this.ctx.isAdActive() || v.ended || remaining <= 0) {\n if (this.ctx.isAdActive()) this.hideCard();\n return;\n }\n if (!this.card) this.showCard();\n const secs = Math.ceil(remaining);\n this.cardRing?.set(remaining / showBefore);\n if (this.cardLabel) this.cardLabel.textContent = `${this.options.label ?? this.ctx.i18n.redirectUpNext} · ${secs}`;\n };\n\n private showCard(): void {\n const o = this.options;\n const card = document.createElement('div');\n card.className = 'hp-redirect-card';\n card.setAttribute('part', 'redirect-card');\n card.setAttribute('data-position', o.position ?? 'bottom-right');\n\n const main = document.createElement('button');\n main.type = 'button';\n main.className = 'hp-redirect-card-main';\n main.addEventListener('click', () => this.go('click'));\n const t = thumb(o.image, o.duration, 'hp-redirect-thumb');\n const text = document.createElement('span');\n text.className = 'hp-redirect-text';\n const label = document.createElement('span');\n label.className = 'hp-redirect-label';\n text.appendChild(label);\n if (o.title) {\n const title = document.createElement('span');\n title.className = 'hp-redirect-title';\n title.textContent = o.title;\n text.appendChild(title);\n }\n if (o.subtitle) {\n const sub = document.createElement('span');\n sub.className = 'hp-redirect-sub';\n sub.textContent = o.subtitle;\n text.appendChild(sub);\n }\n // Erişilebilir ad görünen metinden oluşur (\"Sıradaki · 4 Başlık Alt başlık\"); sonuna yalnızca ekran okuyucunun\n // duyduğu \"Şimdi oynat\" eklenir — görsel / süre rozeti okunmaz.\n t.el.setAttribute('aria-hidden', 'true');\n const action = document.createElement('span');\n action.className = 'hp-sr-only';\n action.textContent = ` — ${this.ctx.i18n.redirectPlayNow}`;\n text.appendChild(action);\n main.append(t.el, text);\n\n const close = document.createElement('button');\n close.type = 'button';\n close.className = 'hp-redirect-close';\n close.setAttribute('aria-label', this.ctx.i18n.redirectCancelCard);\n close.appendChild(createIcon('close'));\n close.addEventListener('click', () => {\n this.cancelled = true;\n this.hideCard();\n this.emit('cancel');\n });\n\n card.append(main, close);\n // Karta dokunmak videoyu oynat / duraklat yapmasın.\n for (const ev of ['pointerdown', 'click', 'dblclick'] as const) card.addEventListener(ev, (e) => e.stopPropagation());\n this.ctx.overlayContainerEl.appendChild(card);\n this.card = card;\n this.cardRing = t.ring;\n this.cardLabel = label;\n this.emit('shown');\n }\n\n private hideCard(): void {\n this.card?.remove();\n this.card = null;\n this.cardRing = null;\n this.cardLabel = null;\n }\n\n // ── 'screen' modu ───────────────────────────────────────────────────────\n\n private remove(): void {\n if (this.counterTimer) {\n clearInterval(this.counterTimer);\n this.counterTimer = null;\n }\n this.wrapper?.remove();\n this.wrapper = null;\n }\n\n private createScreen(): void {\n this.remove();\n const o = this.options;\n const wrapper = document.createElement('div');\n wrapper.setAttribute('part', 'redirect-screen');\n wrapper.className = 'hp-redirect-screen';\n\n if (o.image) {\n const bg = document.createElement('img');\n bg.className = 'hp-redirect-bg';\n bg.src = o.image;\n bg.alt = '';\n bg.addEventListener('error', () => bg.remove());\n wrapper.appendChild(bg);\n }\n\n const panel = document.createElement('div');\n panel.className = 'hp-redirect-panel';\n const label = document.createElement('span');\n label.className = 'hp-redirect-label';\n label.textContent = o.label ?? this.ctx.i18n.redirectUpNext;\n panel.appendChild(label);\n\n const poster = document.createElement('button');\n poster.type = 'button';\n poster.className = 'hp-redirect-poster';\n poster.setAttribute('aria-label', this.ctx.i18n.redirectPlayNow);\n const t = thumb(o.image, o.duration, 'hp-redirect-thumb');\n poster.appendChild(t.el);\n poster.addEventListener('click', () => this.go('click'));\n panel.appendChild(poster);\n\n if (o.title) {\n const title = document.createElement('div');\n title.className = 'hp-redirect-title';\n title.textContent = o.title;\n panel.appendChild(title);\n }\n if (o.subtitle) {\n const sub = document.createElement('div');\n sub.className = 'hp-redirect-sub';\n sub.textContent = o.subtitle;\n panel.appendChild(sub);\n }\n\n const counter = document.createElement('div');\n counter.className = 'hp-redirect-counter';\n counter.setAttribute('aria-live', 'polite');\n panel.appendChild(counter);\n\n const actions = document.createElement('div');\n actions.className = 'hp-redirect-actions';\n const cancelBtn = document.createElement('button');\n cancelBtn.type = 'button';\n cancelBtn.className = 'hp-redirect-btn';\n cancelBtn.textContent = this.ctx.i18n.redirectCancel;\n const acceptBtn = document.createElement('button');\n acceptBtn.type = 'button';\n acceptBtn.className = 'hp-redirect-btn hp-redirect-btn-primary';\n acceptBtn.textContent = this.ctx.i18n.redirectPlayNow;\n acceptBtn.addEventListener('click', () => this.go('click'));\n cancelBtn.addEventListener('click', () => {\n this.remove();\n this.emit('cancel');\n if (o.suggestions?.length) this.showSuggestions(o.suggestions);\n });\n actions.append(cancelBtn, acceptBtn);\n panel.appendChild(actions);\n wrapper.appendChild(panel);\n\n for (const ev of ['pointerdown', 'click', 'dblclick'] as const) wrapper.addEventListener(ev, (e) => e.stopPropagation());\n this.ctx.overlayContainerEl.appendChild(wrapper);\n this.wrapper = wrapper;\n this.emit('shown');\n\n const total = Math.max(0, o.time ?? 10);\n let remaining = total;\n const render = (): void => {\n counter.textContent = this.ctx.i18n.redirectCountdown(remaining);\n t.ring.set(total > 0 ? remaining / total : 0);\n };\n render();\n this.counterTimer = setInterval(() => {\n remaining--;\n if (remaining > 0) {\n render();\n return;\n }\n if (this.counterTimer) clearInterval(this.counterTimer);\n this.counterTimer = null;\n counter.textContent = this.ctx.i18n.redirectNowPlaying;\n t.ring.set(0);\n this.go('auto');\n }, 1000);\n }\n\n /** Öneri ızgarası (bitiş ekranı): başlık + kapat, kartlar, \"Tekrar izle\". */\n private showSuggestions(items: RedirectScreenSuggestion[]): void {\n this.remove();\n const o = this.options;\n const i18n = this.ctx.i18n;\n const wrapper = document.createElement('div');\n wrapper.setAttribute('part', 'redirect-suggestions');\n wrapper.className = 'hp-redirect-suggestions';\n wrapper.setAttribute('role', 'region');\n const heading = o.suggestionsTitle ?? i18n.redirectSuggestions;\n wrapper.setAttribute('aria-label', heading);\n\n const head = document.createElement('div');\n head.className = 'hp-redirect-grid-head';\n const h = document.createElement('span');\n h.className = 'hp-redirect-grid-title';\n h.textContent = heading;\n const close = document.createElement('button');\n close.type = 'button';\n close.className = 'hp-redirect-close';\n close.setAttribute('aria-label', i18n.redirectCloseSuggestions);\n close.appendChild(createIcon('close'));\n close.addEventListener('click', () => this.remove());\n head.append(h, close);\n\n const grid = document.createElement('div');\n grid.className = 'hp-redirect-grid';\n grid.setAttribute('data-count', String(Math.min(items.length, 6)));\n items.forEach((item, index) => {\n const box = document.createElement('a');\n box.href = item.url;\n if (o.newTab) {\n box.target = '_blank';\n box.rel = 'noopener';\n }\n box.className = 'hp-redirect-suggestion';\n const t = thumb(item.image, item.duration, 'hp-redirect-thumb');\n t.el.querySelector('.hp-redirect-ring')?.remove();\n const title = document.createElement('span');\n title.className = 'hp-redirect-title';\n title.textContent = item.title;\n box.append(t.el, title);\n if (item.subtitle) {\n const sub = document.createElement('span');\n sub.className = 'hp-redirect-sub';\n sub.textContent = item.subtitle;\n box.appendChild(sub);\n }\n // SPA: preventDefault ile sayfa değişmez.\n box.addEventListener('click', (e) => {\n if (!this.emit('redirect', 'suggestion', item.url, index)) e.preventDefault();\n });\n grid.appendChild(box);\n });\n wrapper.append(head, grid);\n\n if (o.replay !== false) {\n const replay = document.createElement('button');\n replay.type = 'button';\n replay.className = 'hp-redirect-btn hp-redirect-replay';\n replay.append(createIcon('loop'), document.createTextNode(i18n.redirectReplay));\n replay.addEventListener('click', () => {\n this.remove();\n this.emit('replay');\n const v = this.ctx.videoEl;\n v.currentTime = 0;\n void v.play().catch(() => {});\n });\n wrapper.appendChild(replay);\n }\n\n for (const ev of ['pointerdown', 'click', 'dblclick'] as const) wrapper.addEventListener(ev, (e) => e.stopPropagation());\n this.ctx.overlayContainerEl.appendChild(wrapper);\n this.wrapper = wrapper;\n }\n}\n","import { registerLocaleStrings } from '../../i18n';\nimport { strings } from './strings';\nimport { RedirectScreen, type RedirectScreenPlayerContext } from './RedirectScreen';\nimport type { RedirectScreenOptions } from '../../types';\n\nregisterLocaleStrings(strings);\n\nexport function installRedirectScreen(ctx: RedirectScreenPlayerContext, options: RedirectScreenOptions): RedirectScreen {\n return new RedirectScreen(ctx, options);\n}\n\nexport { RedirectScreen };\nexport type { RedirectScreenPlayerContext };\n"],"names":["strings","SVG_NS","RING_R","RING_C","DEFAULT_SHOW_BEFORE","ring","className","svg","track","bar","c","fraction","thumb","image","duration","el","img","play","createIcon","d","RedirectScreen","ctx","options","__publicField","v","showBefore","remaining","secs","_a","adoptStyle","css","_b","state","reason","url","index","o","card","main","t","text","label","title","sub","action","close","ev","e","wrapper","bg","panel","poster","counter","actions","cancelBtn","acceptBtn","total","render","items","i18n","heading","head","h","grid","item","box","replay","registerLocaleStrings","installRedirectScreen"],"mappings":";;;;;AAKO,MAAMA,IAAwC;AAAA,EACjD,IAAI;AAAA,IACA,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,IAChB,0BAA0B;AAAA,EAAA;AAAA,EAE9B,IAAI;AAAA,IACA,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,IAChB,0BAA0B;AAAA,EAAA;AAElC,2uNCDMC,IAAS,8BACTC,IAAS,IACTC,IAAS,IAAI,KAAK,KAAKD,GACvBE,IAAsB;AAG5B,SAASC,EAAKC,GAAuE;AACj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nC,aAAK,OAAA,GACL,KAAK,KAAK,QAAQ;AAClB,cAAM1C,IAAI,KAAK,IAAI;AACnB,QAAAA,EAAE,cAAc,GACXA,EAAE,OAAO,MAAM,MAAM;AAAA,QAAC,CAAC;AAAA,MAChC,CAAC,GACDwB,EAAQ,YAAYkB,CAAM;AAAA,IAC9B;AAEA,eAAWpB,KAAM,CAAC,eAAe,SAAS,UAAU,EAAY,CAAAE,EAAQ,iBAAiBF,GAAI,CAACC,MAAMA,EAAE,iBAAiB;AACvH,SAAK,IAAI,mBAAmB,YAAYC,CAAO,GAC/C,KAAK,UAAUA;AAAA,EACnB;AACJ;AC5bAmB,EAAsBnE,CAAO;AAEtB,SAASoE,EAAsB/C,GAAkCC,GAAgD;AACpH,SAAO,IAAIF,EAAeC,GAAKC,CAAO;AAC1C;"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var E = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var h = (s, t, e) => E(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { a as k } from "./plugin-style-CPJELe-i.js";
|
|
5
|
+
import { L as v } from "./player-B7mYS--8.js";
|
|
6
|
+
const C = ".hp-lock{display:inline-block;vertical-align:-2px}.hp-rw-button{position:absolute;top:12px;left:12px;display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border:1px solid rgba(255,255,255,.22);border-radius:999px;background:#0c0c10b8;color:#fff;font:600 12.5px/1 system-ui,-apple-system,sans-serif;cursor:pointer;pointer-events:auto;-webkit-tap-highlight-color:transparent;box-shadow:0 6px 18px -8px #000000b3}.hp-rw-button:hover{background:#0c0c10e0}.hp-rw-button[hidden]{display:none}.hp-rw-button .hp-lock{color:var(--hp-color-accent, #fff)}.hp-rw-dialog{position:absolute;top:0;right:0;bottom:0;left:0;z-index:45;display:flex;align-items:center;justify-content:center;padding:12px;background:#0000009e;color:#fff;text-align:center;animation:hp-rw-fade .18s ease-out}.hp-rw-card{width:min(360px,100%);max-height:100%;overflow:auto;padding:18px 18px 16px;border:1px solid rgba(255,255,255,.14);border-radius:14px;background:#14141af5;box-shadow:0 20px 50px -20px #000c}.hp-rw-icon{display:inline-flex;padding:9px;border-radius:50%;background:#ffffff14;color:var(--hp-color-accent, #fff)}.hp-rw-icon .hp-lock{width:18px;height:18px}.hp-rw-title{margin-top:10px;font-size:15px;font-weight:700}.hp-rw-text{margin-top:6px;font-size:13px;line-height:1.45;opacity:.82}.hp-rw-actions{display:flex;gap:8px;justify-content:center;margin-top:14px}.hp-rw-actions:empty{display:none}.hp-rw-btn{padding:8px 14px;border:1px solid rgba(255,255,255,.2);border-radius:999px;background:transparent;color:#fff;font:600 13px/1 system-ui,-apple-system,sans-serif;cursor:pointer}.hp-rw-btn-primary{border-color:transparent;background:var(--hp-color-accent, #fff);color:var(--hp-color-on-accent, #0a0a0a)}.hp-rw-spinner{width:22px;height:22px;margin:4px auto 0;border:2px solid rgba(255,255,255,.25);border-top-color:#fff;border-radius:50%;animation:hp-rw-spin .8s linear infinite}.hp-rw-toast{position:absolute;top:12px;left:50%;z-index:45;transform:translate(-50%);padding:8px 14px;border-radius:999px;background:#0c0c10d9;color:#fff;font:600 13px/1 system-ui,-apple-system,sans-serif;pointer-events:none;animation:hp-rw-fade .2s ease-out}@keyframes hp-rw-fade{0%{opacity:0}}@keyframes hp-rw-spin{to{transform:rotate(360deg)}}.hp-settings-panel [data-locked],.hp-chip-panel [data-locked]{opacity:.85}@media(prefers-reduced-motion:reduce){.hp-rw-dialog,.hp-rw-toast{animation:none}}@media(hover:none)and (pointer:coarse){.video-area:has(.hp-unmute-badge[data-visible]) .hp-rw-button{top:52px}}.video-area[data-compact] .hp-rw-icon{display:none}.video-area[data-compact] .hp-rw-card{padding:12px 14px}.video-area[data-compact] .hp-rw-title{margin-top:0;font-size:14px}.video-area[data-compact] .hp-rw-text{font-size:12px;line-height:1.4}.video-area[data-compact] .hp-rw-actions{margin-top:10px}", L = "https://securepubads.g.doubleclick.net/tag/js/gpt.js";
|
|
7
|
+
let x = null;
|
|
8
|
+
function T() {
|
|
9
|
+
var t;
|
|
10
|
+
const s = window;
|
|
11
|
+
return s.googletag ?? (s.googletag = { cmd: [] }), (t = s.googletag).cmd ?? (t.cmd = []), s.googletag.apiReady || document.querySelector('script[src*="/tag/js/gpt.js"]') ? Promise.resolve() : (x ?? (x = new Promise((e, o) => {
|
|
12
|
+
const i = document.createElement("script");
|
|
13
|
+
i.async = !0, i.src = L, i.onload = () => e(), i.onerror = () => {
|
|
14
|
+
x = null, i.remove(), o(new Error("gpt.js could not be loaded (ad blocker / network / certificate)"));
|
|
15
|
+
}, document.head.appendChild(i);
|
|
16
|
+
})), x);
|
|
17
|
+
}
|
|
18
|
+
function S(s, t, e) {
|
|
19
|
+
return new Promise((o) => {
|
|
20
|
+
let i = !1, n = !1, f = !1, r = null, m = null;
|
|
21
|
+
const b = [], c = (l) => {
|
|
22
|
+
var u;
|
|
23
|
+
if (!i) {
|
|
24
|
+
if (i = !0, clearTimeout(p), e == null || e.removeEventListener("abort", d), m) {
|
|
25
|
+
const g = m.pubads();
|
|
26
|
+
for (const [a, w] of b) (u = g.removeEventListener) == null || u.call(g, a, w);
|
|
27
|
+
if (r)
|
|
28
|
+
try {
|
|
29
|
+
m.destroySlots([r]);
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
o(l);
|
|
34
|
+
}
|
|
35
|
+
}, d = () => c("closed"), p = setTimeout(() => c("nofill"), t);
|
|
36
|
+
if (e != null && e.aborted) {
|
|
37
|
+
c("closed");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
e == null || e.addEventListener("abort", d), T().then(() => {
|
|
41
|
+
if (i) return;
|
|
42
|
+
const l = window.googletag;
|
|
43
|
+
l.cmd.push(() => {
|
|
44
|
+
if (i) return;
|
|
45
|
+
if (m = l, r = l.defineOutOfPageSlot(s, l.enums.OutOfPageFormat.REWARDED), !r) {
|
|
46
|
+
c("nofill");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
r.addService(l.pubads());
|
|
50
|
+
const u = l.pubads(), g = (a, w) => {
|
|
51
|
+
b.push([a, w]), u.addEventListener(a, w);
|
|
52
|
+
};
|
|
53
|
+
g("rewardedSlotReady", (a) => {
|
|
54
|
+
var w;
|
|
55
|
+
a.slot !== r || i || (clearTimeout(p), e == null || e.removeEventListener("abort", d), (w = a.makeRewardedVisible) == null || w.call(a));
|
|
56
|
+
}), g("rewardedSlotGranted", (a) => {
|
|
57
|
+
a.slot === r && (n = !0, f && c("granted"));
|
|
58
|
+
}), g("rewardedSlotVideoCompleted", (a) => {
|
|
59
|
+
a.slot === r && (f = !0, n && c("granted"));
|
|
60
|
+
}), g("rewardedSlotClosed", (a) => {
|
|
61
|
+
a.slot === r && c(n ? "granted" : "closed");
|
|
62
|
+
}), g("slotRenderEnded", (a) => {
|
|
63
|
+
a.slot === r && a.isEmpty && c("nofill");
|
|
64
|
+
}), l.enableServices(), l.display(r);
|
|
65
|
+
});
|
|
66
|
+
}).catch(() => c("nofill"));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const A = 480, D = "hope-rewarded-unlock", F = 8e3, K = 2600;
|
|
70
|
+
let N = 0;
|
|
71
|
+
class P {
|
|
72
|
+
constructor(t, e) {
|
|
73
|
+
h(this, "options");
|
|
74
|
+
h(this, "button");
|
|
75
|
+
h(this, "dialog", null);
|
|
76
|
+
h(this, "toast", null);
|
|
77
|
+
h(this, "toastTimer", null);
|
|
78
|
+
h(this, "phase", "idle");
|
|
79
|
+
/** 'video' modunda kilidin açık olduğu içerik (kaynak listesi — kalite dosyası değil). */
|
|
80
|
+
h(this, "videoUnlockedKey", null);
|
|
81
|
+
h(this, "lastKey", "");
|
|
82
|
+
/** Kaynak değişti: 'video' modunda kilit yeniden kapanır; süreli kilit dolduysa menüler güncellenir. */
|
|
83
|
+
h(this, "onSourceChange", () => {
|
|
84
|
+
const t = this.ctx.contentKey();
|
|
85
|
+
t !== this.lastKey && (this.lastKey = t, this.onQualitiesChanged());
|
|
86
|
+
});
|
|
87
|
+
h(this, "resumeAfterDialog", !1);
|
|
88
|
+
/** Reklam hazırlanırken "Vazgeç" — sağlayıcıya iletilir (GPT slotu temizlenir). */
|
|
89
|
+
h(this, "abort", null);
|
|
90
|
+
this.ctx = t, this.options = e;
|
|
91
|
+
const o = document.createElement("button");
|
|
92
|
+
o.type = "button", o.className = "hp-rw-button", o.setAttribute("part", "rewarded-button"), o.addEventListener("click", (i) => {
|
|
93
|
+
i.stopPropagation(), this.requestUnlock();
|
|
94
|
+
}), o.addEventListener("pointerdown", (i) => i.stopPropagation()), t.chromeEl.appendChild(o), this.button = o, t.videoEl.addEventListener("loadstart", this.onSourceChange), this.refreshLabels(), this.onQualitiesChanged();
|
|
95
|
+
}
|
|
96
|
+
update(t) {
|
|
97
|
+
const e = this.unlocked;
|
|
98
|
+
this.options = t, e !== this.unlocked && this.ctx.onLockChange(!1), this.onQualitiesChanged();
|
|
99
|
+
}
|
|
100
|
+
// ── Kilit durumu ────────────────────────────────────────────────────
|
|
101
|
+
get maxFreeHeight() {
|
|
102
|
+
const t = this.options.maxFreeHeight;
|
|
103
|
+
return typeof t == "number" && t > 0 ? t : A;
|
|
104
|
+
}
|
|
105
|
+
get storageKey() {
|
|
106
|
+
return this.options.storageKey || D;
|
|
107
|
+
}
|
|
108
|
+
get unlockFor() {
|
|
109
|
+
const t = this.options.unlockFor;
|
|
110
|
+
return typeof t == "number" && t > 0 ? t : t === "video" ? "video" : "session";
|
|
111
|
+
}
|
|
112
|
+
get unlocked() {
|
|
113
|
+
const t = this.unlockFor;
|
|
114
|
+
if (t === "video") return !!this.videoUnlockedKey && this.videoUnlockedKey === this.ctx.contentKey();
|
|
115
|
+
try {
|
|
116
|
+
if (t === "session") return sessionStorage.getItem(this.storageKey) === "1";
|
|
117
|
+
const e = Number(localStorage.getItem(this.storageKey));
|
|
118
|
+
return Number.isFinite(e) && e > Date.now();
|
|
119
|
+
} catch {
|
|
120
|
+
return !1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
grant() {
|
|
124
|
+
const t = this.unlockFor;
|
|
125
|
+
t === "video" && (this.videoUnlockedKey = this.ctx.contentKey());
|
|
126
|
+
try {
|
|
127
|
+
t === "session" ? sessionStorage.setItem(this.storageKey, "1") : typeof t == "number" && localStorage.setItem(this.storageKey, String(Date.now() + t * 6e4));
|
|
128
|
+
} catch {
|
|
129
|
+
this.videoUnlockedKey = this.ctx.contentKey();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** Player için: bu yükseklikteki kalite kilitli mi? */
|
|
133
|
+
isLocked(t) {
|
|
134
|
+
return this.unlocked ? !1 : t !== null && t > this.maxFreeHeight;
|
|
135
|
+
}
|
|
136
|
+
/** Player kalite listesi değişince çağırır: buton yalnızca kilitli kalite varken görünür. */
|
|
137
|
+
onQualitiesChanged() {
|
|
138
|
+
const t = this.ctx.lockedQualityLabel(), e = this.options.button !== !1 && !!t && !this.unlocked;
|
|
139
|
+
if (this.button.hidden = !e, !e) return;
|
|
140
|
+
const o = this.fill(this.ctx.i18n.rewardedButton, t);
|
|
141
|
+
this.button.innerHTML = `${v}<span>${U(o)}</span>`, this.button.setAttribute("aria-label", o);
|
|
142
|
+
}
|
|
143
|
+
// ── Akış ────────────────────────────────────────────────────────────
|
|
144
|
+
/** Kilitli kaliteye ya da butona dokunuldu: onay penceresi. */
|
|
145
|
+
requestUnlock() {
|
|
146
|
+
if (this.unlocked || this.phase !== "idle") return;
|
|
147
|
+
const t = this.ctx.lockedQualityLabel() ?? "HD";
|
|
148
|
+
this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardedprompt", { detail: { quality: t } })), this.showDialog("prompt", t);
|
|
149
|
+
}
|
|
150
|
+
async watch(t) {
|
|
151
|
+
const e = this.ctx.videoEl, o = !e.paused;
|
|
152
|
+
e.pause(), this.ctx.exitFullscreen(), this.abort = new AbortController();
|
|
153
|
+
const i = this.abort.signal;
|
|
154
|
+
this.showDialog("loading", t);
|
|
155
|
+
let n;
|
|
156
|
+
try {
|
|
157
|
+
n = await this.runProvider(i);
|
|
158
|
+
} catch (r) {
|
|
159
|
+
this.ctx.log({ message: `Rewarded ad failed: ${String(r)}` }), n = "nofill";
|
|
160
|
+
}
|
|
161
|
+
if (this.abort = null, i.aborted) {
|
|
162
|
+
this.closeDialog(), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardedclosed", { detail: { granted: !1, cancelled: !0 } })), o && this.ctx.play();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
let f = !1;
|
|
166
|
+
if (n === "nofill" && this.options.grantOnNoFill !== !1 && (this.ctx.log({ message: "Rewarded ad: no ad available (no fill / error / timeout) — unlocked anyway (grantOnNoFill)" }), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardednofill", { detail: { granted: !0 } })), n = "granted", f = !0), n === "granted") {
|
|
167
|
+
this.grant(), this.closeDialog(), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardedgranted", { detail: { quality: t, noAd: f } })), this.ctx.onLockChange(!0), this.onQualitiesChanged(), this.showToast(this.fill(f ? this.ctx.i18n.rewardedUnlockedNoAd : this.ctx.i18n.rewardedUnlocked, t)), o && this.ctx.play();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (n === "nofill") {
|
|
171
|
+
this.ctx.log({ message: "Rewarded ad: no ad available (no fill / unsupported page / timeout)" }), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardednofill", { detail: { granted: !1 } })), this.showDialog("nofill", t), this.resumeAfterDialog = o;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.closeDialog(), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardedclosed", { detail: { granted: !1 } })), o && this.ctx.play();
|
|
175
|
+
}
|
|
176
|
+
async runProvider(t) {
|
|
177
|
+
const e = this.options.provider;
|
|
178
|
+
if ((e == null ? void 0 : e.type) === "gpt") return S(e.adUnitPath, e.timeoutMs ?? F, t);
|
|
179
|
+
if ((e == null ? void 0 : e.type) === "custom") {
|
|
180
|
+
const o = new Promise((n) => t.addEventListener("abort", () => n("closed"), { once: !0 })), i = await Promise.race([e.show({ signal: t }), o]);
|
|
181
|
+
return i === !0 ? "granted" : i === !1 ? "closed" : i;
|
|
182
|
+
}
|
|
183
|
+
throw new Error("rewardedUnlock.provider is missing");
|
|
184
|
+
}
|
|
185
|
+
// ── Arayüz ─────────────────────────────────────────────────────────
|
|
186
|
+
fill(t, e) {
|
|
187
|
+
const o = this.unlockFor, i = this.ctx.i18n, n = o === "video" ? i.rewardedForVideo : o === "session" ? i.rewardedForSession : i.rewardedForMinutes.replace("{n}", String(o));
|
|
188
|
+
return t.replace("{quality}", e).replace("{duration}", n);
|
|
189
|
+
}
|
|
190
|
+
showDialog(t, e) {
|
|
191
|
+
this.phase = t;
|
|
192
|
+
const o = this.ctx.i18n;
|
|
193
|
+
if (!this.dialog) {
|
|
194
|
+
const d = document.createElement("div");
|
|
195
|
+
d.className = "hp-rw-dialog", d.setAttribute("part", "rewarded-dialog"), d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true");
|
|
196
|
+
for (const p of ["click", "pointerdown", "dblclick"]) d.addEventListener(p, (l) => l.stopPropagation());
|
|
197
|
+
d.addEventListener("keydown", (p) => {
|
|
198
|
+
var l;
|
|
199
|
+
p.stopPropagation(), p.key === "Escape" && (this.phase === "loading" ? (l = this.abort) == null || l.abort() : this.dismiss());
|
|
200
|
+
}), this.ctx.overlayEl.appendChild(d), this.dialog = d;
|
|
201
|
+
}
|
|
202
|
+
const i = this.dialog;
|
|
203
|
+
i.setAttribute("data-phase", t), i.innerHTML = "";
|
|
204
|
+
const n = document.createElement("div");
|
|
205
|
+
n.className = "hp-rw-card";
|
|
206
|
+
const f = document.createElement("div");
|
|
207
|
+
f.className = "hp-rw-icon", f.innerHTML = v;
|
|
208
|
+
const r = document.createElement("div");
|
|
209
|
+
r.className = "hp-rw-title", r.id = `hp-rw-title-${++N}`, i.setAttribute("aria-labelledby", r.id);
|
|
210
|
+
const m = document.createElement("div");
|
|
211
|
+
m.className = "hp-rw-text";
|
|
212
|
+
const b = document.createElement("div");
|
|
213
|
+
b.className = "hp-rw-actions", n.append(f, r, m, b), i.appendChild(n);
|
|
214
|
+
const c = (d, p, l) => {
|
|
215
|
+
const u = document.createElement("button");
|
|
216
|
+
return u.type = "button", u.className = p ? "hp-rw-btn hp-rw-btn-primary" : "hp-rw-btn", u.textContent = d, u.addEventListener("click", l), b.appendChild(u), u;
|
|
217
|
+
};
|
|
218
|
+
if (t === "prompt")
|
|
219
|
+
r.textContent = this.fill(o.rewardedTitle, e), m.textContent = this.fill(o.rewardedBody, e), c(o.rewardedDecline, !1, () => this.dismiss()), c(o.rewardedWatch, !0, () => void this.watch(e)).focus();
|
|
220
|
+
else if (t === "loading") {
|
|
221
|
+
r.textContent = o.rewardedLoading;
|
|
222
|
+
const d = document.createElement("div");
|
|
223
|
+
d.className = "hp-rw-spinner", m.appendChild(d), c(o.rewardedDecline, !1, () => {
|
|
224
|
+
var p;
|
|
225
|
+
return (p = this.abort) == null ? void 0 : p.abort();
|
|
226
|
+
});
|
|
227
|
+
} else
|
|
228
|
+
r.textContent = this.fill(o.rewardedTitle, e), m.textContent = o.rewardedNoFill, c(o.rewardedOk, !0, () => this.dismiss()).focus();
|
|
229
|
+
}
|
|
230
|
+
dismiss() {
|
|
231
|
+
const t = this.phase === "nofill";
|
|
232
|
+
this.closeDialog(), t || this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:rewardedclosed", { detail: { granted: !1, declined: !0 } })), this.resumeAfterDialog && this.ctx.play(), this.resumeAfterDialog = !1;
|
|
233
|
+
}
|
|
234
|
+
closeDialog() {
|
|
235
|
+
var t;
|
|
236
|
+
this.phase = "idle", (t = this.dialog) == null || t.remove(), this.dialog = null;
|
|
237
|
+
}
|
|
238
|
+
showToast(t) {
|
|
239
|
+
var o;
|
|
240
|
+
this.toastTimer && clearTimeout(this.toastTimer), (o = this.toast) == null || o.remove();
|
|
241
|
+
const e = document.createElement("div");
|
|
242
|
+
e.className = "hp-rw-toast", e.setAttribute("part", "rewarded-toast"), e.setAttribute("role", "status"), e.textContent = t, this.ctx.overlayEl.appendChild(e), this.toast = e, this.toastTimer = setTimeout(() => {
|
|
243
|
+
var i;
|
|
244
|
+
(i = this.toast) == null || i.remove(), this.toast = null;
|
|
245
|
+
}, K);
|
|
246
|
+
}
|
|
247
|
+
refreshLabels() {
|
|
248
|
+
this.onQualitiesChanged();
|
|
249
|
+
}
|
|
250
|
+
destroy() {
|
|
251
|
+
var t, e;
|
|
252
|
+
(t = this.abort) == null || t.abort(), this.ctx.videoEl.removeEventListener("loadstart", this.onSourceChange), this.toastTimer && clearTimeout(this.toastTimer), (e = this.toast) == null || e.remove(), this.closeDialog(), this.button.remove();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function U(s) {
|
|
256
|
+
return s.replace(/[&<>"']/g, (t) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[t]);
|
|
257
|
+
}
|
|
258
|
+
function H(s, t) {
|
|
259
|
+
return k(s.videoEl, "rewarded", C), new P(s, t);
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
P as RewardedUnlock,
|
|
263
|
+
H as installRewardedUnlock
|
|
264
|
+
};
|
|
265
|
+
//# sourceMappingURL=rewardedUnlock-BL97P5ht.js.map
|