@hopeplayer/core 1.0.16 → 1.0.18
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/README.md +24 -14
- package/dist/HopePlayerElement.d.ts +3 -0
- package/dist/HopePlayerElement.d.ts.map +1 -1
- package/dist/chunks/{index-CWLyz1fp.js → adTriggers-DXmtF4t2.js} +113 -118
- package/dist/chunks/adTriggers-DXmtF4t2.js.map +1 -0
- package/dist/chunks/{index-DITXYcHx.js → ads-MCG5a6eK.js} +130 -125
- package/dist/chunks/ads-MCG5a6eK.js.map +1 -0
- package/dist/chunks/{index-BeJNpAyx.js → audio-LkYgd5Wq.js} +7 -7
- package/dist/chunks/audio-LkYgd5Wq.js.map +1 -0
- package/dist/chunks/{ScratchSound-0XKHUcJK.js → audioScratchSound-7XkwCCDm.js} +1 -1
- package/dist/chunks/audioScratchSound-7XkwCCDm.js.map +1 -0
- package/dist/chunks/{index-Miba3PD_.js → cast-bMrkGGuD.js} +70 -66
- package/dist/chunks/cast-bMrkGGuD.js.map +1 -0
- package/dist/chunks/{index-rENB3n9O.js → countdownScreen-CI-u6jjA.js} +1 -1
- package/dist/chunks/countdownScreen-CI-u6jjA.js.map +1 -0
- package/dist/chunks/{index-Q8FMOHj0.js → dai-B9Tth1Iv.js} +1 -1
- package/dist/chunks/dai-B9Tth1Iv.js.map +1 -0
- package/dist/chunks/{index-DCXX1ZJG.js → debugPanel-Bnc_7GOn.js} +1 -1
- package/dist/chunks/debugPanel-Bnc_7GOn.js.map +1 -0
- package/dist/chunks/{index-DXWK4EFa.js → dubbing-kNMPpyHl.js} +1 -1
- package/dist/chunks/dubbing-kNMPpyHl.js.map +1 -0
- package/dist/chunks/{index-BBmuCtKu.js → geoChecker-BRtvHwI-.js} +1 -1
- package/dist/chunks/geoChecker-BRtvHwI-.js.map +1 -0
- package/dist/chunks/{index-Ca8hocby.js → gesture-BzPCgi87.js} +1 -1
- package/dist/chunks/gesture-BzPCgi87.js.map +1 -0
- package/dist/chunks/{loadGpt-CmiAy366.js → gpt-CGXHTG_H.js} +1 -1
- package/dist/chunks/gpt-CGXHTG_H.js.map +1 -0
- package/dist/chunks/{index-3QALpwsf.js → inViewAutoplay-CRJe7GA4.js} +1 -1
- package/dist/chunks/inViewAutoplay-CRJe7GA4.js.map +1 -0
- package/dist/chunks/{index-7IBf8Y-R.js → liveWallClock-ChUTtzLD.js} +1 -1
- package/dist/chunks/liveWallClock-ChUTtzLD.js.map +1 -0
- package/dist/chunks/{index-f0vSgRIK.js → loopSection-CvF4l5uf.js} +1 -1
- package/dist/chunks/loopSection-CvF4l5uf.js.map +1 -0
- package/dist/chunks/{index-e00_M05B.js → markers-BhMJLPqj.js} +2 -2
- package/dist/chunks/markers-BhMJLPqj.js.map +1 -0
- package/dist/chunks/{index-CDPrkLq0.js → pauseAd-BQQe21X4.js} +2 -2
- package/dist/chunks/pauseAd-BQQe21X4.js.map +1 -0
- package/dist/chunks/{index-DEv3YqLg.js → player-DW5iWvPs.js} +939 -880
- package/dist/chunks/player-DW5iWvPs.js.map +1 -0
- package/dist/chunks/{index-D3Z7ZDLJ.js → playlist-DYGbJ5wz.js} +24 -24
- package/dist/chunks/playlist-DYGbJ5wz.js.map +1 -0
- package/dist/chunks/{VideoPrebid-CpckFzSq.js → prebid-CRY3i2OT.js} +1 -1
- package/dist/chunks/prebid-CRY3i2OT.js.map +1 -0
- package/dist/chunks/{index-DT8-oMPm.js → qrResume-DXwD3oSA.js} +29 -30
- package/dist/chunks/qrResume-DXwD3oSA.js.map +1 -0
- package/dist/chunks/redirectScreen-CSjrS8Kg.js +208 -0
- package/dist/chunks/redirectScreen-CSjrS8Kg.js.map +1 -0
- package/dist/chunks/{index-BbRYOSvk.js → rewardedUnlock-DZ_qPcDG.js} +22 -19
- package/dist/chunks/rewardedUnlock-DZ_qPcDG.js.map +1 -0
- package/dist/chunks/seekWhenReady-Clzne3-S.js +32 -0
- package/dist/chunks/seekWhenReady-Clzne3-S.js.map +1 -0
- package/dist/chunks/{index-CBX7bn-G.js → segments-LsZPlbYi.js} +2 -2
- package/dist/chunks/segments-LsZPlbYi.js.map +1 -0
- package/dist/chunks/{index-Ch3ep-eJ.js → sponsorship-BT21uwN5.js} +36 -41
- package/dist/chunks/sponsorship-BT21uwN5.js.map +1 -0
- package/dist/chunks/{index-BXSND_xN.js → spriteThumbnails-BQkEBRu-.js} +2 -2
- package/dist/chunks/spriteThumbnails-BQkEBRu-.js.map +1 -0
- package/dist/chunks/{index-DGtpFgHV.js → statsPanel-DSClIwA3.js} +1 -1
- package/dist/chunks/statsPanel-DSClIwA3.js.map +1 -0
- package/dist/chunks/{index-CDDke5rz.js → sticky-D_eLCNFk.js} +1 -1
- package/dist/chunks/sticky-D_eLCNFk.js.map +1 -0
- package/dist/chunks/{index-C3BQGcT3.js → story-H6f7gSoX.js} +27 -15
- package/dist/chunks/story-H6f7gSoX.js.map +1 -0
- package/dist/chunks/{index-C5oGMHF_.js → tapGestures-DrC42DiI.js} +1 -1
- package/dist/chunks/tapGestures-DrC42DiI.js.map +1 -0
- package/dist/chunks/trackingPixel-D2wxdCEz.js +20 -0
- package/dist/chunks/trackingPixel-D2wxdCEz.js.map +1 -0
- package/dist/controls/SeekBar.d.ts.map +1 -1
- package/dist/hls/SourceManager.d.ts.map +1 -1
- package/dist/hope-player.js +1 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +3 -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/keyboard/KeyboardController.d.ts.map +1 -1
- package/dist/plugins/ad-triggers/AdTriggers.d.ts.map +1 -1
- package/dist/plugins/ads/AdsController.d.ts.map +1 -1
- package/dist/plugins/ads/generateVastUrl.d.ts +10 -0
- package/dist/plugins/ads/generateVastUrl.d.ts.map +1 -1
- package/dist/plugins/cast/CastController.d.ts.map +1 -1
- package/dist/plugins/playlist/PlaylistRunner.d.ts.map +1 -1
- package/dist/plugins/qr-resume/QrResume.d.ts.map +1 -1
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts +26 -3
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts.map +1 -1
- package/dist/plugins/rewarded/RewardedUnlock.d.ts +0 -5
- package/dist/plugins/rewarded/RewardedUnlock.d.ts.map +1 -1
- package/dist/plugins/shared/seekWhenReady.d.ts +22 -0
- package/dist/plugins/shared/seekWhenReady.d.ts.map +1 -0
- package/dist/plugins/shared/trackingPixel.d.ts +8 -0
- package/dist/plugins/shared/trackingPixel.d.ts.map +1 -0
- package/dist/plugins/sponsorship/SponsorshipLayer.d.ts.map +1 -1
- package/dist/plugins/story/HopeStory.d.ts +2 -0
- package/dist/plugins/story/HopeStory.d.ts.map +1 -1
- package/dist/screens/ErrorScreen.d.ts +7 -0
- package/dist/screens/ErrorScreen.d.ts.map +1 -1
- package/dist/types/index.d.ts +49 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/media-error.d.ts +10 -0
- package/dist/utils/media-error.d.ts.map +1 -0
- package/dist/utils/seek-by.d.ts +8 -0
- package/dist/utils/seek-by.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/chunks/ScratchSound-0XKHUcJK.js.map +0 -1
- package/dist/chunks/VideoPrebid-CpckFzSq.js.map +0 -1
- package/dist/chunks/index-3QALpwsf.js.map +0 -1
- package/dist/chunks/index-7IBf8Y-R.js.map +0 -1
- package/dist/chunks/index-BBmuCtKu.js.map +0 -1
- package/dist/chunks/index-BXSND_xN.js.map +0 -1
- package/dist/chunks/index-BbRYOSvk.js.map +0 -1
- package/dist/chunks/index-BeJNpAyx.js.map +0 -1
- package/dist/chunks/index-C3BQGcT3.js.map +0 -1
- package/dist/chunks/index-C5oGMHF_.js.map +0 -1
- package/dist/chunks/index-CBX7bn-G.js.map +0 -1
- package/dist/chunks/index-CDDke5rz.js.map +0 -1
- package/dist/chunks/index-CDPrkLq0.js.map +0 -1
- package/dist/chunks/index-CWLyz1fp.js.map +0 -1
- package/dist/chunks/index-Ca8hocby.js.map +0 -1
- package/dist/chunks/index-Ch3ep-eJ.js.map +0 -1
- package/dist/chunks/index-D3Z7ZDLJ.js.map +0 -1
- package/dist/chunks/index-D6r-BGAV.js +0 -77
- package/dist/chunks/index-D6r-BGAV.js.map +0 -1
- package/dist/chunks/index-DCXX1ZJG.js.map +0 -1
- package/dist/chunks/index-DEv3YqLg.js.map +0 -1
- package/dist/chunks/index-DGtpFgHV.js.map +0 -1
- package/dist/chunks/index-DITXYcHx.js.map +0 -1
- package/dist/chunks/index-DT8-oMPm.js.map +0 -1
- package/dist/chunks/index-DXWK4EFa.js.map +0 -1
- package/dist/chunks/index-Miba3PD_.js.map +0 -1
- package/dist/chunks/index-Q8FMOHj0.js.map +0 -1
- package/dist/chunks/index-e00_M05B.js.map +0 -1
- package/dist/chunks/index-f0vSgRIK.js.map +0 -1
- package/dist/chunks/index-rENB3n9O.js.map +0 -1
- package/dist/chunks/loadGpt-CmiAy366.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
2
|
var g = (h, t, e) => t in h ? A(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
|
|
3
3
|
var n = (h, t, e) => g(h, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
4
|
+
import { i as b, c as P } from "./player-DW5iWvPs.js";
|
|
5
|
+
const I = {
|
|
6
6
|
startMode: "after_current",
|
|
7
7
|
startIndex: 0,
|
|
8
8
|
loop: !1,
|
|
@@ -10,7 +10,7 @@ const P = {
|
|
|
10
10
|
preferHls: !0,
|
|
11
11
|
adsOnItemChange: !0
|
|
12
12
|
};
|
|
13
|
-
class
|
|
13
|
+
class w {
|
|
14
14
|
constructor(t, e) {
|
|
15
15
|
n(this, "options");
|
|
16
16
|
n(this, "items");
|
|
@@ -37,14 +37,14 @@ class I {
|
|
|
37
37
|
this.playlistActive && this.next();
|
|
38
38
|
});
|
|
39
39
|
n(this, "onError", () => {
|
|
40
|
-
if (this.destroyed || !this.playlistActive) return;
|
|
40
|
+
if (this.destroyed || !this.playlistActive || b(this.ctx.videoEl.error)) return;
|
|
41
41
|
const t = Date.now();
|
|
42
42
|
t - this.lastErrorAt < 200 || (this.lastErrorAt = t, this.fallbackOrSkip());
|
|
43
43
|
});
|
|
44
44
|
n(this, "onTimeUpdate", () => {
|
|
45
45
|
this.updateProgress();
|
|
46
46
|
});
|
|
47
|
-
this.ctx = t, this.rawOptions = e, this.options = { ...
|
|
47
|
+
this.ctx = t, this.rawOptions = e, this.options = { ...I, ...e }, this.items = Array.isArray(e.items) ? e.items : [], this.index = this.clampIndex(this.options.startIndex), this.ui = this.buildUi(), this.bindPlayerEvents(), this.init();
|
|
48
48
|
}
|
|
49
49
|
// ── lifecycle ──
|
|
50
50
|
init() {
|
|
@@ -110,11 +110,11 @@ class I {
|
|
|
110
110
|
this.switching = !1;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
const s = ++this.attemptId,
|
|
114
|
-
let
|
|
115
|
-
e.isFallback && ((o = this.attempt) == null ? void 0 : o.index) === t && ((u = this.attempt) != null && u.tried) && (
|
|
113
|
+
const s = ++this.attemptId, r = e.forceMode ?? this.resolveMode(i);
|
|
114
|
+
let a = /* @__PURE__ */ new Set([r]), d = e.forceMp4Index ?? 0;
|
|
115
|
+
e.isFallback && ((o = this.attempt) == null ? void 0 : o.index) === t && ((u = this.attempt) != null && u.tried) && (a = new Set(this.attempt.tried), a.add(r), e.forceMp4Index == null && (d = this.attempt.mp4Index ?? 0)), this.attempt = { id: s, index: t, mode: r, tried: a, mp4Index: d };
|
|
116
116
|
try {
|
|
117
|
-
const p = this.buildPayload(i,
|
|
117
|
+
const p = this.buildPayload(i, r, d);
|
|
118
118
|
if (!p) throw new Error("No playable source");
|
|
119
119
|
if (this.setActive(t), this.ctx.videoEl.pause(), i.image && this.ctx.setPoster(i.image), await this.ctx.loadSource(p.src, p.type), this.options.adsOnItemChange && this.maybeRequestAds(t, i, !!e.isFallback), this.shouldAutoPlay(!!e.userInitiated))
|
|
120
120
|
try {
|
|
@@ -131,7 +131,7 @@ class I {
|
|
|
131
131
|
const t = this.items[this.attempt.index];
|
|
132
132
|
if (!t) return;
|
|
133
133
|
if (this.attempt.mode === "mp4") {
|
|
134
|
-
const i = (t.mp4 || []).filter((
|
|
134
|
+
const i = (t.mp4 || []).filter((r) => r == null ? void 0 : r.src), s = (this.attempt.mp4Index ?? 0) + 1;
|
|
135
135
|
if (s < i.length) {
|
|
136
136
|
await this.loadAndPlay(this.attempt.index, { forceMode: "mp4", forceMp4Index: s, isFallback: !0 });
|
|
137
137
|
return;
|
|
@@ -156,10 +156,10 @@ class I {
|
|
|
156
156
|
return Array.isArray(t[e]) && t[e].some((i) => i == null ? void 0 : i.src);
|
|
157
157
|
}
|
|
158
158
|
buildPayload(t, e, i = 0) {
|
|
159
|
-
const s = (t[e] || []).filter((
|
|
159
|
+
const s = (t[e] || []).filter((a) => a == null ? void 0 : a.src);
|
|
160
160
|
if (!s.length) return null;
|
|
161
|
-
let
|
|
162
|
-
return e === "mp4" ?
|
|
161
|
+
let r;
|
|
162
|
+
return e === "mp4" ? r = i > 0 ? s[i] || s[0] : s.find((a) => a.selected) || s[0] : r = s[0], { src: r.src, type: r.type || (e === "hls" ? "application/x-mpegURL" : "video/mp4") };
|
|
163
163
|
}
|
|
164
164
|
shouldAutoPlay(t) {
|
|
165
165
|
return t ? !0 : this.options.autoplayNext && this.userHasStartedPlayback;
|
|
@@ -175,10 +175,10 @@ class I {
|
|
|
175
175
|
i.className = "hp:flex hp:items-center hp:justify-between hp:gap-2 hp:mb-1";
|
|
176
176
|
const s = document.createElement("div");
|
|
177
177
|
s.className = "hp:text-sm hp:font-semibold hp:text-on-surface", s.textContent = this.playlistTitleText(), i.appendChild(s);
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
d.style.transform = "rotate(180deg)",
|
|
178
|
+
const r = document.createElement("div");
|
|
179
|
+
r.className = "hp:flex hp:gap-1";
|
|
180
|
+
const a = this.navButton("chevron-left", this.ctx.i18n.playlistPrev, () => this.prev()), d = this.navButton("chevron-left", this.ctx.i18n.playlistNext, () => this.next());
|
|
181
|
+
d.style.transform = "rotate(180deg)", r.append(a, d), i.appendChild(r), e.appendChild(i);
|
|
182
182
|
const o = document.createElement("ul");
|
|
183
183
|
o.className = "hp:flex hp:flex-col hp:gap-1 hp:list-none hp:m-0 hp:p-0", e.appendChild(o);
|
|
184
184
|
const u = [];
|
|
@@ -200,7 +200,7 @@ class I {
|
|
|
200
200
|
v.className = "hp:flex-1 hp:h-0.5 hp:bg-on-surface/20 hp:rounded-full hp:overflow-hidden", m = document.createElement("div"), m.className = "hp:h-full hp:bg-accent", m.style.width = "0%", v.appendChild(m), l.appendChild(v), f.appendChild(l);
|
|
201
201
|
}
|
|
202
202
|
c.appendChild(f), c.addEventListener("click", () => this.setIndex(E)), o.appendChild(c), u.push({ li: c, titleRow: x, progressFill: m, timeEl: y });
|
|
203
|
-
}), this.ctx.panelEl.appendChild(e), { root: e, titleEl: s, listEl: o, prevBtn:
|
|
203
|
+
}), this.ctx.panelEl.appendChild(e), { root: e, titleEl: s, listEl: o, prevBtn: a, nextBtn: d, itemEls: u };
|
|
204
204
|
}
|
|
205
205
|
playlistTitleText() {
|
|
206
206
|
const t = this.rawOptions.ui ?? {}, e = t.title || this.ctx.i18n.playlistTitle;
|
|
@@ -208,7 +208,7 @@ class I {
|
|
|
208
208
|
}
|
|
209
209
|
navButton(t, e, i) {
|
|
210
210
|
const s = document.createElement("button");
|
|
211
|
-
return s.type = "button", s.setAttribute("aria-label", e), s.className = "hp:flex hp:items-center hp:justify-center hp:w-6 hp:h-6 hp:text-on-surface hp:bg-transparent hp:border-0 hp:cursor-pointer", s.appendChild(
|
|
211
|
+
return s.type = "button", s.setAttribute("aria-label", e), s.className = "hp:flex hp:items-center hp:justify-center hp:w-6 hp:h-6 hp:text-on-surface hp:bg-transparent hp:border-0 hp:cursor-pointer", s.appendChild(P(t, "hp:text-sm")), s.addEventListener("click", i), s;
|
|
212
212
|
}
|
|
213
213
|
setActive(t) {
|
|
214
214
|
this.ui.itemEls.forEach((e, i) => {
|
|
@@ -226,11 +226,11 @@ class I {
|
|
|
226
226
|
return `${i}:${String(s).padStart(2, "0")}`;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
return new
|
|
229
|
+
function N(h, t) {
|
|
230
|
+
return new w(h, t);
|
|
231
231
|
}
|
|
232
232
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
w as PlaylistRunner,
|
|
234
|
+
N as installPlaylist
|
|
235
235
|
};
|
|
236
|
-
//# sourceMappingURL=
|
|
236
|
+
//# sourceMappingURL=playlist-DYGbJ5wz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playlist-DYGbJ5wz.js","sources":["../../src/plugins/playlist/PlaylistRunner.ts","../../src/plugins/playlist/index.ts"],"sourcesContent":["import { createIcon } from '../../icons/Icon';\nimport type { PlayableItem, PlaylistOptions } from '../../types';\nimport type { HopeLocaleStrings } from '../../i18n/types';\nimport { isAudioOutputError } from '../../utils/media-error';\n\nexport interface PlaylistPlayerContext {\n videoEl: HTMLVideoElement;\n hostEl: HTMLElement;\n /** Liste UI'ının monte edileceği, shadow root içindeki panel. */\n panelEl: HTMLElement;\n loadSource(src: string, type?: string): Promise<void>;\n setPoster(url: string): void;\n /** AdsController varsa retry/VMAP durumunu sıfırlayıp item'ın (varsa) kendi adTagPreroll'üyle yeniden reklam ister — yoksa no-op. */\n requestFreshAd(prerollTag?: string): void;\n i18n: HopeLocaleStrings;\n}\n\ntype SourceMode = 'hls' | 'mp4';\n\ninterface Attempt {\n id: number;\n index: number;\n mode: SourceMode;\n tried: Set<SourceMode>;\n mp4Index: number;\n}\n\nconst DEFAULTS: Required<Omit<PlaylistOptions, 'items' | 'adTagPreroll' | 'ui'>> = {\n startMode: 'after_current',\n startIndex: 0,\n loop: false,\n autoplayNext: true,\n preferHls: true,\n adsOnItemChange: true,\n};\n\n/** Tek player üzerinde sıralı oynatma listesi (startMode, loop, hata fallback zinciri). */\nexport class PlaylistRunner {\n private readonly options: Required<Omit<PlaylistOptions, 'items' | 'adTagPreroll' | 'ui'>>;\n private readonly items: PlayableItem[];\n\n private index: number;\n private destroyed = false;\n private switching = false;\n private playlistActive = false;\n private startPendingAfterCurrent = false;\n private attemptId = 0;\n private attempt: Attempt | null = null;\n private lastErrorAt = 0;\n private lastAdsIndex: number | null = null;\n private lastDispatchedIndex: number | null = null;\n private userHasStartedPlayback = false;\n\n private readonly ui: {\n root: HTMLElement;\n titleEl: HTMLElement;\n listEl: HTMLElement;\n prevBtn: HTMLButtonElement;\n nextBtn: HTMLButtonElement;\n itemEls: Array<{ li: HTMLElement; titleRow: HTMLElement; progressFill: HTMLElement | null; timeEl: HTMLElement | null }>;\n };\n\n constructor(\n private readonly ctx: PlaylistPlayerContext,\n private readonly rawOptions: PlaylistOptions\n ) {\n this.options = { ...DEFAULTS, ...rawOptions };\n this.items = Array.isArray(rawOptions.items) ? rawOptions.items : [];\n this.index = this.clampIndex(this.options.startIndex);\n\n this.ui = this.buildUi();\n this.bindPlayerEvents();\n this.init();\n }\n\n // ── lifecycle ──\n\n private init(): void {\n if (!this.items.length) return;\n\n if (this.options.startMode === 'after_current') {\n this.startPendingAfterCurrent = true;\n this.playlistActive = false;\n this.setActive(this.index);\n return;\n }\n\n this.playlistActive = true;\n void this.loadAndPlay(this.index, { userInitiated: false, isPlaylistStart: true });\n }\n\n refreshLabels(): void {\n this.ui.titleEl.textContent = this.playlistTitleText();\n this.ui.prevBtn.setAttribute('aria-label', this.ctx.i18n.playlistPrev);\n this.ui.nextBtn.setAttribute('aria-label', this.ctx.i18n.playlistNext);\n this.ui.itemEls.forEach((entry, idx) => {\n const item = this.items[idx];\n if (item && !item.title) entry.titleRow.textContent = this.ctx.i18n.videoFallbackTitle(idx);\n });\n }\n\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n this.ctx.videoEl.removeEventListener('ended', this.onEnded);\n this.ctx.videoEl.removeEventListener('error', this.onError);\n this.ctx.videoEl.removeEventListener('play', this.onUserPlay);\n this.ui.root.remove();\n }\n\n // ── public api ──\n\n start(opts: { index?: number } = {}): void {\n if (this.destroyed || !this.items.length) return;\n this.startPendingAfterCurrent = false;\n this.playlistActive = true;\n this.index = this.clampIndex(opts.index ?? this.index);\n this.setActive(this.index);\n void this.loadAndPlay(this.index, { userInitiated: false, isPlaylistStart: true });\n }\n\n next(): void {\n if (this.destroyed || !this.items.length) return;\n if (!this.playlistActive) return this.start({ index: this.index });\n\n if (this.index < this.items.length - 1) this.index++;\n else if (this.options.loop) this.index = 0;\n else return;\n\n this.setActive(this.index);\n void this.loadAndPlay(this.index, { userInitiated: true });\n }\n\n prev(): void {\n if (this.destroyed || !this.items.length) return;\n if (!this.playlistActive) return this.start({ index: this.index });\n if (this.index === 0) return;\n this.index--;\n this.setActive(this.index);\n void this.loadAndPlay(this.index, { userInitiated: true });\n }\n\n setIndex(i: number): void {\n if (this.destroyed || !this.items.length) return;\n this.index = this.clampIndex(i);\n this.setActive(this.index);\n if (!this.playlistActive) return this.start({ index: this.index });\n void this.loadAndPlay(this.index, { userInitiated: true });\n }\n\n getIndex(): number {\n return this.index;\n }\n\n isActive(): boolean {\n return this.playlistActive;\n }\n\n // ── player events ──\n\n private bindPlayerEvents(): void {\n this.ctx.videoEl.addEventListener('ended', this.onEnded);\n this.ctx.videoEl.addEventListener('error', this.onError);\n this.ctx.videoEl.addEventListener('play', this.onUserPlay);\n this.ctx.videoEl.addEventListener('timeupdate', this.onTimeUpdate);\n }\n\n private readonly onUserPlay = (): void => {\n this.userHasStartedPlayback = true;\n };\n\n private readonly onEnded = (): void => {\n if (this.startPendingAfterCurrent && !this.playlistActive) {\n this.startPendingAfterCurrent = false;\n this.playlistActive = true;\n this.setActive(this.index);\n void this.loadAndPlay(this.index, { userInitiated: true, isPlaylistStart: true });\n return;\n }\n if (this.playlistActive) this.next();\n };\n\n private readonly onError = (): void => {\n if (this.destroyed || !this.playlistActive) return;\n // Ses aygıtı yok (Firefox): video sessiz oynamaya devam ediyor — sonraki öğeye atlama.\n if (isAudioOutputError(this.ctx.videoEl.error)) return;\n const now = Date.now();\n if (now - this.lastErrorAt < 200) return;\n this.lastErrorAt = now;\n void this.fallbackOrSkip();\n };\n\n private readonly onTimeUpdate = (): void => {\n this.updateProgress();\n };\n\n // ── core load ──\n\n private async loadAndPlay(\n i: number,\n opts: { userInitiated?: boolean; forceMode?: SourceMode | null; forceMp4Index?: number | null; isFallback?: boolean; isPlaylistStart?: boolean } = {}\n ): Promise<void> {\n if (this.destroyed || this.switching || !this.playlistActive) return;\n this.switching = true;\n\n const item = this.items[i];\n if (!item) {\n this.switching = false;\n return;\n }\n const attemptId = ++this.attemptId;\n const mode = opts.forceMode ?? this.resolveMode(item);\n\n let tried = new Set<SourceMode>([mode]);\n let mp4Index = opts.forceMp4Index ?? 0;\n if (opts.isFallback && this.attempt?.index === i && this.attempt?.tried) {\n tried = new Set(this.attempt.tried);\n tried.add(mode);\n if (opts.forceMp4Index == null) mp4Index = this.attempt.mp4Index ?? 0;\n }\n this.attempt = { id: attemptId, index: i, mode, tried, mp4Index };\n\n try {\n const payload = this.buildPayload(item, mode, mp4Index);\n if (!payload) throw new Error('No playable source');\n\n this.setActive(i);\n this.ctx.videoEl.pause();\n if (item.image) this.ctx.setPoster(item.image);\n await this.ctx.loadSource(payload.src, payload.type);\n\n if (this.options.adsOnItemChange) this.maybeRequestAds(i, item, !!opts.isFallback);\n\n if (this.shouldAutoPlay(!!opts.userInitiated)) {\n try {\n await this.ctx.videoEl.play();\n } catch {\n /* autoplay engellendi — sessizce geç */\n }\n }\n this.updateProgress();\n } finally {\n this.switching = false;\n }\n }\n\n private async fallbackOrSkip(): Promise<void> {\n if (this.destroyed || !this.attempt) return;\n const item = this.items[this.attempt.index];\n if (!item) return;\n\n if (this.attempt.mode === 'mp4') {\n const mp4List = (item.mp4 || []).filter((v) => v?.src);\n const nextMp4 = (this.attempt.mp4Index ?? 0) + 1;\n if (nextMp4 < mp4List.length) {\n await this.loadAndPlay(this.attempt.index, { forceMode: 'mp4', forceMp4Index: nextMp4, isFallback: true });\n return;\n }\n }\n\n const otherMode: SourceMode = this.attempt.mode === 'hls' ? 'mp4' : 'hls';\n if (this.hasMode(item, otherMode) && !this.attempt.tried.has(otherMode)) {\n await this.loadAndPlay(this.attempt.index, { forceMode: otherMode, isFallback: true });\n return;\n }\n\n this.next();\n }\n\n // ── ads ──\n\n private maybeRequestAds(index: number, item: PlayableItem, _isFallback: boolean): void {\n if (this.lastAdsIndex === index) return;\n this.lastAdsIndex = index;\n this.ctx.requestFreshAd(item.adTagPreroll || this.rawOptions.adTagPreroll);\n }\n\n // ── sources ──\n\n private resolveMode(item: PlayableItem): SourceMode {\n if (this.options.preferHls) return this.hasMode(item, 'hls') ? 'hls' : this.hasMode(item, 'mp4') ? 'mp4' : 'hls';\n return this.hasMode(item, 'mp4') ? 'mp4' : this.hasMode(item, 'hls') ? 'hls' : 'mp4';\n }\n\n private hasMode(item: PlayableItem, mode: SourceMode): boolean {\n return Array.isArray(item[mode]) && item[mode]!.some((v) => v?.src);\n }\n\n private buildPayload(item: PlayableItem, mode: SourceMode, mp4Index = 0): { src: string; type?: string } | null {\n const list = (item[mode] || []).filter((v) => v?.src);\n if (!list.length) return null;\n\n let src;\n if (mode === 'mp4') {\n src = mp4Index > 0 ? list[mp4Index] || list[0] : list.find((v) => v.selected) || list[0];\n } else {\n src = list[0];\n }\n return { src: src!.src, type: src!.type || (mode === 'hls' ? 'application/x-mpegURL' : 'video/mp4') };\n }\n\n private shouldAutoPlay(userInitiated: boolean): boolean {\n if (userInitiated) return true;\n return this.options.autoplayNext && this.userHasStartedPlayback;\n }\n\n private clampIndex(i: number): number {\n if (!Number.isFinite(i) || !this.items.length) return 0;\n return Math.max(0, Math.min(this.items.length - 1, Math.trunc(i)));\n }\n\n // ── ui ──\n\n private buildUi() {\n const ui = this.rawOptions.ui ?? {};\n const root = document.createElement('div');\n root.setAttribute('part', 'playlist-panel');\n root.className = 'hp:flex hp:flex-col hp:gap-2 hp:p-3 hp:bg-surface-elev hp:max-h-80 hp:overflow-y-auto';\n\n const header = document.createElement('div');\n header.className = 'hp:flex hp:items-center hp:justify-between hp:gap-2 hp:mb-1';\n\n const titleEl = document.createElement('div');\n titleEl.className = 'hp:text-sm hp:font-semibold hp:text-on-surface';\n titleEl.textContent = this.playlistTitleText();\n header.appendChild(titleEl);\n\n const navWrap = document.createElement('div');\n navWrap.className = 'hp:flex hp:gap-1';\n const prevBtn = this.navButton('chevron-left', this.ctx.i18n.playlistPrev, () => this.prev());\n const nextBtn = this.navButton('chevron-left', this.ctx.i18n.playlistNext, () => this.next());\n nextBtn.style.transform = 'rotate(180deg)';\n navWrap.append(prevBtn, nextBtn);\n header.appendChild(navWrap);\n\n root.appendChild(header);\n\n const listEl = document.createElement('ul');\n listEl.className = 'hp:flex hp:flex-col hp:gap-1 hp:list-none hp:m-0 hp:p-0';\n root.appendChild(listEl);\n\n const itemEls: Array<{ li: HTMLElement; titleRow: HTMLElement; progressFill: HTMLElement | null; timeEl: HTMLElement | null }> = [];\n this.items.forEach((item, idx) => {\n const li = document.createElement('li');\n li.className =\n 'hp:flex hp:items-center hp:gap-2 hp:p-2 hp:rounded hp:cursor-pointer hp:text-on-surface-muted hp:text-sm ' +\n 'hp:hover:bg-on-surface/5 hp:data-[active=true]:bg-accent/15 hp:data-[active=true]:text-on-surface';\n\n if (item.image) {\n const img = document.createElement('img');\n img.src = item.image;\n img.loading = 'lazy';\n img.className = 'hp:w-16 hp:aspect-video hp:object-cover hp:rounded hp:shrink-0';\n li.appendChild(img);\n }\n\n const body = document.createElement('div');\n body.className = 'hp:flex-1 hp:min-w-0';\n const titleRow = document.createElement('div');\n titleRow.className = 'hp:truncate hp:font-medium';\n titleRow.textContent = item.title || this.ctx.i18n.videoFallbackTitle(idx);\n body.appendChild(titleRow);\n\n let progressFill: HTMLElement | null = null;\n let timeEl: HTMLElement | null = null;\n if (ui.showMeta !== false) {\n const metaRow = document.createElement('div');\n metaRow.className = 'hp:flex hp:items-center hp:gap-2 hp:text-xs hp:opacity-70 hp:mt-0.5';\n timeEl = document.createElement('span');\n timeEl.textContent = '';\n metaRow.appendChild(timeEl);\n\n const bar = document.createElement('div');\n bar.className = 'hp:flex-1 hp:h-0.5 hp:bg-on-surface/20 hp:rounded-full hp:overflow-hidden';\n progressFill = document.createElement('div');\n progressFill.className = 'hp:h-full hp:bg-accent';\n progressFill.style.width = '0%';\n bar.appendChild(progressFill);\n metaRow.appendChild(bar);\n body.appendChild(metaRow);\n }\n\n li.appendChild(body);\n li.addEventListener('click', () => this.setIndex(idx));\n listEl.appendChild(li);\n itemEls.push({ li, titleRow, progressFill, timeEl });\n });\n\n this.ctx.panelEl.appendChild(root);\n return { root, titleEl, listEl, prevBtn, nextBtn, itemEls };\n }\n\n private playlistTitleText(): string {\n const ui = this.rawOptions.ui ?? {};\n const title = ui.title || this.ctx.i18n.playlistTitle;\n return ui.showCount === false ? title : `${title} (${this.items.length})`;\n }\n\n private navButton(iconName: string, label: string, onClick: () => void): HTMLButtonElement {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.setAttribute('aria-label', label);\n btn.className = 'hp:flex hp:items-center hp:justify-center hp:w-6 hp:h-6 hp:text-on-surface hp:bg-transparent hp:border-0 hp:cursor-pointer';\n btn.appendChild(createIcon(iconName, 'hp:text-sm'));\n btn.addEventListener('click', onClick);\n return btn;\n }\n\n private setActive(index: number): void {\n this.ui.itemEls.forEach((entry, idx) => {\n if (idx === index) entry.li.setAttribute('data-active', 'true');\n else entry.li.removeAttribute('data-active');\n });\n // loadAndPlay() hem anlık UI geri bildirimi için önceden (next/prev/setIndex\n // içinden) hem de kaynak gerçekten yüklendiğinde setActive() çağırıyor —\n // aynı index için event'i yalnızca BİR kez yaymak için guard.\n if (this.lastDispatchedIndex !== index) {\n this.lastDispatchedIndex = index;\n this.ctx.hostEl.dispatchEvent(new CustomEvent('hp:itemchange', { detail: { index, source: 'playlist' } }));\n }\n }\n\n private updateProgress(): void {\n const active = this.ui.itemEls[this.index];\n if (!active) return;\n const duration = this.ctx.videoEl.duration;\n const current = this.ctx.videoEl.currentTime;\n if (active.timeEl) active.timeEl.textContent = this.formatTime(current);\n if (active.progressFill && Number.isFinite(duration) && duration > 0) {\n active.progressFill.style.width = `${Math.min(100, (current / duration) * 100)}%`;\n }\n }\n\n private formatTime(sec: number): string {\n const s = Math.max(0, Math.floor(sec || 0));\n const m = Math.floor(s / 60);\n const r = s % 60;\n return `${m}:${String(r).padStart(2, '0')}`;\n }\n}\n","import { PlaylistRunner, type PlaylistPlayerContext } from './PlaylistRunner';\nimport type { PlaylistOptions } from '../../types';\n\nexport function installPlaylist(ctx: PlaylistPlayerContext, options: PlaylistOptions): PlaylistRunner {\n return new PlaylistRunner(ctx, options);\n}\n\nexport { PlaylistRunner };\nexport type { PlaylistPlayerContext };\n"],"names":["DEFAULTS","PlaylistRunner","ctx","rawOptions","__publicField","isAudioOutputError","now","entry","idx","item","opts","i","attemptId","mode","tried","mp4Index","_a","_b","payload","mp4List","v","nextMp4","otherMode","index","_isFallback","list","src","userInitiated","ui","root","header","titleEl","navWrap","prevBtn","nextBtn","listEl","itemEls","li","img","body","titleRow","progressFill","timeEl","metaRow","bar","title","iconName","label","onClick","btn","createIcon","active","duration","current","sec","s","m","r","installPlaylist","options"],"mappings":";;;;AA2BA,MAAMA,IAA6E;AAAA,EAC/E,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,cAAc;AAAA,EACd,WAAW;AAAA,EACX,iBAAiB;AACrB;AAGO,MAAMC,EAAe;AAAA,EAyBxB,YACqBC,GACAC,GACnB;AA3Be,IAAAC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IACzDA,EAAM,GAAG,gBAAgB,aAAa;AAAA,IAC/C,CAAC,GAIG,KAAK,wBAAwBgB,MAC7B,KAAK,sBAAsBA,GAC3B,KAAK,IAAI,OAAO,cAAc,IAAI,YAAY,iBAAiB,EAAE,QAAQ,EAAE,OAAAA,GAAO,QAAQ,WAAA,EAAW,CAAG,CAAC;AAAA,EAEjH;AAAA,EAEQ,iBAAuB;AAC3B,UAAM4B,IAAS,KAAK,GAAG,QAAQ,KAAK,KAAK;AACzC,QAAI,CAACA,EAAQ;AACb,UAAMC,IAAW,KAAK,IAAI,QAAQ,UAC5BC,IAAU,KAAK,IAAI,QAAQ;AACjC,IAAIF,EAAO,WAAQA,EAAO,OAAO,cAAc,KAAK,WAAWE,CAAO,IAClEF,EAAO,gBAAgB,OAAO,SAASC,CAAQ,KAAKA,IAAW,MAC/DD,EAAO,aAAa,MAAM,QAAQ,GAAG,KAAK,IAAI,KAAME,IAAUD,IAAY,GAAG,CAAC;AAAA,EAEtF;AAAA,EAEQ,WAAWE,GAAqB;AACpC,UAAMC,IAAI,KAAK,IAAI,GAAG,KAAK,MAAMD,KAAO,CAAC,CAAC,GACpCE,IAAI,KAAK,MAAMD,IAAI,EAAE,GACrBE,IAAIF,IAAI;AACd,WAAO,GAAGC,CAAC,IAAI,OAAOC,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,EAC7C;AACJ;ACpbO,SAASC,EAAgBxD,GAA4ByD,GAA0C;AAClG,SAAO,IAAI1D,EAAeC,GAAKyD,CAAO;AAC1C;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prebid-CRY3i2OT.js","sources":["../../src/plugins/prebid/VideoPrebid.ts"],"sourcesContent":["import type { PrebidBidderConfig, PrebidBreakOptions, PrebidOptions } from '../../types';\n\n/** window.pbjs yüzeyi — Prebid.js sayfaya <script> ile yüklenir, npm bağımlılığı değil. */\ninterface PbjsBid {\n bidder: string;\n cpm?: number;\n vastUrl?: string;\n vastXml?: string;\n videoCacheKey?: string;\n responseTimestamp?: number;\n ttl?: number;\n}\n\ninterface Pbjs {\n que: Array<() => void>;\n requestBids(params: { adUnits: unknown[]; timeout: number; bidsBackHandler: () => void }): void;\n addAdUnits(units: unknown[]): void;\n removeAdUnit(code: string): void;\n setConfig(config: Record<string, unknown>): void;\n getConfig?(key: string): { url?: string } | undefined;\n installedModules?: string[];\n aliasRegistry?: Record<string, string>;\n getHighestCpmBids?(adUnitCode: string): PbjsBid[];\n getBidResponsesForAdUnitCode?(adUnitCode: string): { bids: PbjsBid[] };\n adServers?: {\n gam?: { buildVideoUrl(args: { adUnit: unknown; params: Record<string, string> }): string | null };\n dfp?: { buildVideoUrl(args: { adUnit: unknown; params: Record<string, string> }): string | null };\n };\n __hopeConsentApplied?: boolean;\n}\n\ndeclare global {\n interface Window {\n pbjs?: Pbjs;\n }\n}\n\n/** Prebid.js instream video header bidding (GAM ve direkt-VAST modları). */\nexport class VideoPrebid {\n private readonly timeout: number;\n private readonly adUnitCode: string;\n private readonly sizes: Array<[number, number]>;\n private readonly bidders: PrebidBidderConfig[];\n private readonly gamAdUnit: string | null;\n private readonly gpid: string | null;\n private readonly playbackMethod: number;\n private readonly skip: 0 | 1;\n private readonly skipafter: number;\n private readonly maxduration: number;\n private readonly minduration: number;\n private readonly api: number[];\n private readonly protocols: number[];\n private readonly mimes: string[];\n private readonly applyLossFactor: boolean;\n private readonly lossFactors: Record<string, number>;\n private readonly consentManagement: PrebidOptions['consentManagement'];\n\n private cacheWarned = false;\n private gamWarned = false;\n private cacheKeyWarned = false;\n\n constructor(opts: PrebidBreakOptions & { consentManagement?: PrebidOptions['consentManagement'] } = {}) {\n this.timeout = opts.timeout ?? 1500;\n this.adUnitCode = opts.adUnitCode || 'hope-video-preroll';\n this.sizes = opts.sizes || [[640, 360]];\n this.bidders = opts.bidders || [];\n this.gamAdUnit = opts.gamAdUnit ?? null;\n this.gpid = opts.gpid ?? this.gamAdUnit ?? null;\n this.playbackMethod = opts.playbackMethod ?? 2;\n this.skip = opts.skip ?? 0;\n this.skipafter = opts.skipafter ?? 5;\n this.maxduration = opts.maxduration ?? 30;\n this.minduration = opts.minduration ?? 1;\n this.api = opts.api || [2, 7];\n this.protocols = opts.protocols || [2, 3, 5, 6, 7, 8];\n this.mimes = opts.mimes || (this.api.includes(2)\n ? ['video/mp4', 'video/webm', 'application/javascript']\n : ['video/mp4', 'video/webm']);\n this.applyLossFactor = opts.applyLossFactor ?? false;\n this.lossFactors = opts.lossFactors || {};\n this.consentManagement = opts.consentManagement ?? null;\n }\n\n private applyConsentConfig(): void {\n const pbjs = window.pbjs;\n if (!this.consentManagement || !pbjs || pbjs.__hopeConsentApplied) return;\n try {\n pbjs.setConfig({ consentManagement: this.consentManagement });\n pbjs.__hopeConsentApplied = true;\n } catch (err) {\n console.warn('[VideoPrebid] consentManagement setConfig hatası:', err);\n }\n }\n\n isAvailable(): boolean {\n const pbjs = window.pbjs;\n if (!pbjs || typeof pbjs.requestBids !== 'function') return false;\n\n if (!this.cacheWarned) {\n const cacheUrl = pbjs.getConfig?.('cache')?.url;\n if (!cacheUrl) {\n console.warn(`[VideoPrebid] pbjs.setConfig({cache:{url}}) tanımlı değil. ${this.gamAdUnit ? 'GAM isteğinde hb_uuid boş kalacak, creative reklam döndüremeyecek.' : 'vastUrl boş dönecek, fallback tag kullanılacak.'}`);\n }\n this.cacheWarned = true;\n }\n\n const installed = pbjs.installedModules || [];\n if (!installed.length) return true;\n\n const aliasRegistry = pbjs.aliasRegistry || {};\n return this.bidders.some((b) => {\n if (installed.includes(`${b.bidder}BidAdapter`)) return true;\n const canonical = aliasRegistry[b.bidder];\n return canonical ? installed.includes(`${canonical}BidAdapter`) : false;\n });\n }\n\n runAuction(fallbackVastUrl: string): Promise<string> {\n return new Promise((resolve) => {\n if (!this.isAvailable()) {\n resolve(fallbackVastUrl);\n return;\n }\n const pbjs = window.pbjs!;\n\n const adUnit = this.buildAdUnit();\n const cleanup = () => {\n try {\n pbjs.removeAdUnit(adUnit.code);\n } catch {\n /* no-op */\n }\n };\n\n let settled = false;\n const done = (url: string) => {\n if (settled) return;\n settled = true;\n cleanup();\n resolve(url);\n };\n\n pbjs.que = pbjs.que || [];\n pbjs.que.push(() => {\n this.applyConsentConfig();\n pbjs.removeAdUnit(adUnit.code);\n pbjs.addAdUnits([adUnit]);\n\n // Prebid'in kendi timeoutBuffer default'u 400ms, +300 bidsBackHandler'dan\n // önce ateşleyebiliyordu — +500ms tampon bu yüzden.\n const failsafe = setTimeout(() => done(fallbackVastUrl), this.timeout + 500);\n\n pbjs.requestBids({\n adUnits: [adUnit],\n timeout: this.timeout,\n bidsBackHandler: () => {\n clearTimeout(failsafe);\n done(this.resolveVastUrl(adUnit, fallbackVastUrl));\n },\n });\n });\n });\n }\n\n private buildAdUnit(): { code: string; ortb2Imp: unknown; mediaTypes: unknown; bids: PrebidBidderConfig[] } {\n const bids: PrebidBidderConfig[] = typeof structuredClone === 'function'\n ? structuredClone(this.bidders)\n : (JSON.parse(JSON.stringify(this.bidders)) as PrebidBidderConfig[]);\n\n const stableId = this.gpid || this.adUnitCode;\n\n return {\n code: this.adUnitCode,\n ortb2Imp: {\n ext: {\n gpid: stableId,\n data: { pbadslot: stableId },\n },\n },\n mediaTypes: {\n video: {\n context: 'instream',\n playerSize: this.sizes,\n mimes: this.mimes,\n protocols: this.protocols,\n api: this.api,\n minduration: this.minduration,\n maxduration: this.maxduration,\n startdelay: 0,\n playbackmethod: [this.playbackMethod],\n linearity: 1,\n plcmt: 1,\n placement: 1,\n skip: this.skip,\n ...(this.skip ? { skipafter: this.skipafter } : {}),\n pos: 1,\n },\n },\n bids,\n };\n }\n\n private getGamAdServer(): {\n buildVideoUrl(args: { adUnit: unknown; params: Record<string, string | Record<string, string>> }): string | null;\n } | null {\n const adServers = window.pbjs?.adServers;\n const gam = adServers?.gam || adServers?.dfp;\n return typeof gam?.buildVideoUrl === 'function' ? gam : null;\n }\n\n /** Fallback tag'in cust_params'ını objeye çevirir — buildVideoUrl URL'i sıfırdan kurduğu için ayrıca geçilmeli. */\n private extractCustParams(url: string): Record<string, string> {\n const result: Record<string, string> = {};\n try {\n const raw = new URL(url).searchParams.get('cust_params');\n if (!raw) return result;\n for (const pair of raw.split('&')) {\n const idx = pair.indexOf('=');\n if (idx <= 0) continue;\n const key = pair.slice(0, idx);\n if (key.startsWith('hb_')) continue;\n result[key] = pair.slice(idx + 1);\n }\n } catch (err) {\n console.warn('[VideoPrebid] fallback cust_params okunamadı:', err);\n }\n return result;\n }\n\n private pickWinningBid(adUnitCode: string): PbjsBid | undefined {\n const pbjs = window.pbjs!;\n if (!this.applyLossFactor) {\n return (pbjs.getHighestCpmBids?.(adUnitCode) || [])[0];\n }\n\n const responses = pbjs.getBidResponsesForAdUnitCode?.(adUnitCode)?.bids || [];\n if (!responses.length) return undefined;\n\n const now = Date.now();\n const valid = responses.filter((b) => !b.responseTimestamp || !b.ttl || b.responseTimestamp + b.ttl * 1000 > now);\n if (!valid.length) return undefined;\n\n let best: PbjsBid | undefined;\n let bestWeighted = -Infinity;\n for (const bid of valid) {\n const factor = this.lossFactors[bid.bidder] ?? 1;\n const weighted = (bid.cpm || 0) * factor;\n if (weighted > bestWeighted) {\n bestWeighted = weighted;\n best = bid;\n }\n }\n return best;\n }\n\n private resolveVastUrl(adUnit: { code: string }, fallback: string): string {\n const gam = this.gamAdUnit ? this.getGamAdServer() : null;\n\n if (this.gamAdUnit && !gam && !this.gamWarned) {\n console.warn('[VideoPrebid] pbjs.adServers.gam.buildVideoUrl bulunamadı — Prebid build\\'inde \"Google Ad Manager Video\" (dfpAdServerVideo) modülü yok. GAM atlanıyor, kazanan bid\\'in vastUrl\\'i kullanılacak.');\n this.gamWarned = true;\n }\n\n const winner = this.pickWinningBid(adUnit.code);\n\n if (gam && !winner) {\n console.warn(`[VideoPrebid] Auction'dan kazanan bid çıkmadı — GAM isteği hb_pb/hb_bidder olmadan gidiyor, cust_params'ta hb_uuid=undefined görünecek. pbjs.getBidResponsesForAdUnitCode('${adUnit.code}') ve pbjs.getEvents() ile no-bid/timeout sebebine bakın.`);\n }\n\n if (gam && winner && !winner.videoCacheKey && !this.cacheKeyWarned) {\n console.warn(`[VideoPrebid] Kazanan bid'de videoCacheKey yok — GAM isteğine hb_uuid=undefined gidecek. VAST cache'e yazılmamış: pbjs.setConfig({cache:{url}}) auction'dan önce çalışıyor mu ve cache POST'u başarılı mı kontrol edin. (bidder: ${winner.bidder})`);\n this.cacheKeyWarned = true;\n }\n\n if (gam) {\n try {\n const url = gam.buildVideoUrl({\n adUnit,\n params: {\n iu: this.gamAdUnit!,\n output: 'vast',\n description_url: window.location.href,\n url: window.location.href,\n cust_params: this.extractCustParams(fallback),\n },\n });\n if (url) return url;\n } catch (err) {\n console.warn('[VideoPrebid] buildVideoUrl failed:', err);\n }\n }\n\n if (winner) {\n if (winner.vastUrl) return winner.vastUrl;\n if (winner.vastXml) {\n console.warn('[VideoPrebid] Kazanan bid vastXml içeriyor ancak Prebid cache yapılandırılmamış. pbjs.setConfig({cache:{url}}) ekleyin. Fallback\\'e düşülüyor.');\n }\n }\n\n return fallback;\n }\n}\n\nexport default VideoPrebid;\n"],"names":["VideoPrebid","opts","__publicField","pbjs","err","_a","_b","installed","aliasRegistry","b","canonical","fallbackVastUrl","resolve","adUnit","cleanup","settled","done","url","failsafe","bids","stableId","adServers","gam","result","raw","pair","idx","key","adUnitCode","_c","responses","now","valid","best","bestWeighted","bid","factor","weighted","fallback","winner"],"mappings":";;;AAsCO,MAAMA,EAAY;AAAA,EAuBrB,YAAYC,IAAwF,IAAI;AAtBvF,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA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AAI,OAAO,KAAKC;AAClC,MAAIC,IAAWH,MACXA,IAAeG,GACfJ,IAAOE;AAAA,IAEf;AACA,WAAOF;AAAA,EACX;AAAA,EAEQ,eAAepB,GAA0ByB,GAA0B;AACvE,UAAMhB,IAAM,KAAK,YAAY,KAAK,mBAAmB;AAErD,IAAI,KAAK,aAAa,CAACA,KAAO,CAAC,KAAK,cAChC,QAAQ,KAAK,8LAAiM,GAC9M,KAAK,YAAY;AAGrB,UAAMiB,IAAS,KAAK,eAAe1B,EAAO,IAAI;AAW9C,QATIS,KAAO,CAACiB,KACR,QAAQ,KAAK,8KAA8K1B,EAAO,IAAI,2DAA2D,GAGjQS,KAAOiB,KAAU,CAACA,EAAO,iBAAiB,CAAC,KAAK,mBAChD,QAAQ,KAAK,oOAAoOA,EAAO,MAAM,GAAG,GACjQ,KAAK,iBAAiB,KAGtBjB;AACA,UAAI;AACA,cAAML,IAAMK,EAAI,cAAc;AAAA,UAC1B,QAAAT;AAAA,UACA,QAAQ;AAAA,YACJ,IAAI,KAAK;AAAA,YACT,QAAQ;AAAA,YACR,iBAAiB,OAAO,SAAS;AAAA,YACjC,KAAK,OAAO,SAAS;AAAA,YACrB,aAAa,KAAK,kBAAkByB,CAAQ;AAAA,UAAA;AAAA,QAChD,CACH;AACD,YAAIrB,EAAK,QAAOA;AAAA,MACpB,SAASb,GAAK;AACV,gBAAQ,KAAK,uCAAuCA,CAAG;AAAA,MAC3D;AAGJ,QAAImC,GAAQ;AACR,UAAIA,EAAO,QAAS,QAAOA,EAAO;AAClC,MAAIA,EAAO,WACP,QAAQ,KAAK,+IAAgJ;AAAA,IAErK;AAEA,WAAOD;AAAA,EACX;AACJ;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
2
|
var tt = (p, s, a) => s in p ? z(p, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : p[s] = a;
|
|
3
3
|
var P = (p, s, a) => tt(p, typeof s != "symbol" ? s + "" : s, a);
|
|
4
|
+
import { s as et } from "./seekWhenReady-Clzne3-S.js";
|
|
4
5
|
const H = function(p, s) {
|
|
5
6
|
let i = p;
|
|
6
7
|
const f = j[s];
|
|
@@ -129,16 +130,16 @@ const H = function(p, s) {
|
|
|
129
130
|
let n = null;
|
|
130
131
|
switch (h) {
|
|
131
132
|
case "Numeric":
|
|
132
|
-
n =
|
|
133
|
+
n = nt(o);
|
|
133
134
|
break;
|
|
134
135
|
case "Alphanumeric":
|
|
135
|
-
n =
|
|
136
|
+
n = rt(o);
|
|
136
137
|
break;
|
|
137
138
|
case "Byte":
|
|
138
|
-
n =
|
|
139
|
+
n = ot(o);
|
|
139
140
|
break;
|
|
140
141
|
case "Kanji":
|
|
141
|
-
n =
|
|
142
|
+
n = it(o);
|
|
142
143
|
break;
|
|
143
144
|
default:
|
|
144
145
|
throw "mode:" + h;
|
|
@@ -191,7 +192,7 @@ const H = function(p, s) {
|
|
|
191
192
|
}, m.createDataURL = function(o, h) {
|
|
192
193
|
o = o || 2, h = typeof h > "u" ? o * 4 : h;
|
|
193
194
|
const n = m.getModuleCount() * o + h * 2, l = h, u = n - h;
|
|
194
|
-
return
|
|
195
|
+
return lt(n, n, function(w, x) {
|
|
195
196
|
if (l <= w && w < u && l <= x && x < u) {
|
|
196
197
|
const E = Math.floor((w - l) / o), k = Math.floor((x - l) / o);
|
|
197
198
|
return m.isDark(k, E) ? 0 : 1;
|
|
@@ -285,7 +286,7 @@ H.stringToBytes = function(p) {
|
|
|
285
286
|
};
|
|
286
287
|
H.createStringToBytes = function(p, s) {
|
|
287
288
|
const a = (function() {
|
|
288
|
-
const i =
|
|
289
|
+
const i = ct(p), f = function() {
|
|
289
290
|
const c = i.read();
|
|
290
291
|
if (c == -1) throw "eof";
|
|
291
292
|
return c;
|
|
@@ -815,7 +816,7 @@ const M = {
|
|
|
815
816
|
const i = Math.floor(s / 8);
|
|
816
817
|
p.length <= i && p.push(0), r && (p[i] |= 128 >>> s % 8), s += 1;
|
|
817
818
|
}, a;
|
|
818
|
-
},
|
|
819
|
+
}, nt = function(p) {
|
|
819
820
|
const s = M.MODE_NUMBER, a = p, r = {};
|
|
820
821
|
r.getMode = function() {
|
|
821
822
|
return s;
|
|
@@ -839,7 +840,7 @@ const M = {
|
|
|
839
840
|
throw "illegal char :" + e;
|
|
840
841
|
};
|
|
841
842
|
return r;
|
|
842
|
-
},
|
|
843
|
+
}, rt = function(p) {
|
|
843
844
|
const s = M.MODE_ALPHA_NUM, a = p, r = {};
|
|
844
845
|
r.getMode = function() {
|
|
845
846
|
return s;
|
|
@@ -884,7 +885,7 @@ const M = {
|
|
|
884
885
|
}
|
|
885
886
|
};
|
|
886
887
|
return r;
|
|
887
|
-
},
|
|
888
|
+
}, ot = function(p) {
|
|
888
889
|
const s = M.MODE_8BIT_BYTE, a = H.stringToBytes(p), r = {};
|
|
889
890
|
return r.getMode = function() {
|
|
890
891
|
return s;
|
|
@@ -894,7 +895,7 @@ const M = {
|
|
|
894
895
|
for (let f = 0; f < a.length; f += 1)
|
|
895
896
|
i.put(a[f], 8);
|
|
896
897
|
}, r;
|
|
897
|
-
},
|
|
898
|
+
}, it = function(p) {
|
|
898
899
|
const s = M.MODE_KANJI, a = H.stringToBytes;
|
|
899
900
|
(function(f, e) {
|
|
900
901
|
const t = a(f);
|
|
@@ -944,7 +945,7 @@ const M = {
|
|
|
944
945
|
r > 0 && (a += ","), a += p[r];
|
|
945
946
|
return a += "]", a;
|
|
946
947
|
}, s;
|
|
947
|
-
},
|
|
948
|
+
}, st = function() {
|
|
948
949
|
let p = 0, s = 0, a = 0, r = "";
|
|
949
950
|
const i = {}, f = function(t) {
|
|
950
951
|
r += String.fromCharCode(e(t & 63));
|
|
@@ -975,7 +976,7 @@ const M = {
|
|
|
975
976
|
}, i.toString = function() {
|
|
976
977
|
return r;
|
|
977
978
|
}, i;
|
|
978
|
-
},
|
|
979
|
+
}, ct = function(p) {
|
|
979
980
|
const s = p;
|
|
980
981
|
let a = 0, r = 0, i = 0;
|
|
981
982
|
const f = {};
|
|
@@ -1010,7 +1011,7 @@ const M = {
|
|
|
1010
1011
|
throw "c:" + t;
|
|
1011
1012
|
};
|
|
1012
1013
|
return f;
|
|
1013
|
-
},
|
|
1014
|
+
}, ut = function(p, s) {
|
|
1014
1015
|
const a = p, r = s, i = new Array(p * s), f = {};
|
|
1015
1016
|
f.setPixel = function(b, m, g) {
|
|
1016
1017
|
i[m * a + b] = g;
|
|
@@ -1068,21 +1069,21 @@ const M = {
|
|
|
1068
1069
|
}, g;
|
|
1069
1070
|
};
|
|
1070
1071
|
return f;
|
|
1071
|
-
},
|
|
1072
|
-
const r =
|
|
1072
|
+
}, lt = function(p, s, a) {
|
|
1073
|
+
const r = ut(p, s);
|
|
1073
1074
|
for (let t = 0; t < s; t += 1)
|
|
1074
1075
|
for (let c = 0; c < p; c += 1)
|
|
1075
1076
|
r.setPixel(c, t, a(c, t));
|
|
1076
1077
|
const i = W();
|
|
1077
1078
|
r.write(i);
|
|
1078
|
-
const f =
|
|
1079
|
+
const f = st(), e = i.toByteArray();
|
|
1079
1080
|
for (let t = 0; t < e.length; t += 1)
|
|
1080
1081
|
f.writeByte(e[t]);
|
|
1081
1082
|
return f.flush(), "data:image/gif;base64," + f;
|
|
1082
1083
|
};
|
|
1083
1084
|
H.stringToBytes;
|
|
1084
|
-
const F = "http://www.w3.org/2000/svg",
|
|
1085
|
-
function
|
|
1085
|
+
const F = "http://www.w3.org/2000/svg", ft = "http://www.w3.org/1999/xlink";
|
|
1086
|
+
function at(p, s) {
|
|
1086
1087
|
const a = H(0, s.logoUrl ? "H" : "M");
|
|
1087
1088
|
a.addData(p), a.make();
|
|
1088
1089
|
const r = a.getModuleCount(), i = s.size / r, f = document.createElementNS(F, "svg");
|
|
@@ -1101,12 +1102,12 @@ function ft(p, s) {
|
|
|
1101
1102
|
const c = s.size * s.logoScale, b = c * 0.18, m = c + b * 2, g = (s.size - m) / 2, d = (s.size - c) / 2, A = document.createElementNS(F, "rect");
|
|
1102
1103
|
A.setAttribute("x", String(g)), A.setAttribute("y", String(g)), A.setAttribute("width", String(m)), A.setAttribute("height", String(m)), A.setAttribute("rx", String(m * 0.22)), A.setAttribute("fill", "#fff"), f.appendChild(A);
|
|
1103
1104
|
const B = document.createElementNS(F, "image");
|
|
1104
|
-
B.setAttribute("href", s.logoUrl), B.setAttributeNS(
|
|
1105
|
+
B.setAttribute("href", s.logoUrl), B.setAttributeNS(ft, "xlink:href", s.logoUrl), B.setAttribute("x", String(d)), B.setAttribute("y", String(d)), B.setAttribute("width", String(c)), B.setAttribute("height", String(c)), B.setAttribute("preserveAspectRatio", "xMidYMid meet"), f.appendChild(B);
|
|
1105
1106
|
}
|
|
1106
1107
|
return f;
|
|
1107
1108
|
}
|
|
1108
1109
|
const $ = "hope-qr-resume-dismissed";
|
|
1109
|
-
class
|
|
1110
|
+
class ht {
|
|
1110
1111
|
constructor(s, a) {
|
|
1111
1112
|
P(this, "wrapper", null);
|
|
1112
1113
|
P(this, "seeking", !1);
|
|
@@ -1172,10 +1173,8 @@ class at {
|
|
|
1172
1173
|
applyResumeFromUrl() {
|
|
1173
1174
|
const s = new URL(window.location.href), a = s.searchParams.get(this.paramName);
|
|
1174
1175
|
if (a === null || !/^\d+$/.test(a)) return;
|
|
1175
|
-
const r = Number(a), i =
|
|
1176
|
-
|
|
1177
|
-
};
|
|
1178
|
-
this.ctx.videoEl.readyState >= 1 ? i() : this.ctx.videoEl.addEventListener("loadedmetadata", i, { once: !0 }), s.searchParams.delete(this.paramName), window.history.replaceState(window.history.state, "", s.toString());
|
|
1176
|
+
const r = Number(a), i = this.ctx.videoEl;
|
|
1177
|
+
et(i, r, { attempts: 2 }), s.searchParams.delete(this.paramName), window.history.replaceState(window.history.state, "", s.toString());
|
|
1179
1178
|
}
|
|
1180
1179
|
remove() {
|
|
1181
1180
|
var s;
|
|
@@ -1186,7 +1185,7 @@ class at {
|
|
|
1186
1185
|
const s = this.options.size ?? 220, a = this.buildResumeUrl(this.ctx.videoEl.currentTime), r = document.createElement("div");
|
|
1187
1186
|
r.setAttribute("part", "qr-resume-screen"), r.className = "hp:absolute hp:inset-0 hp:z-30 hp:flex hp:flex-col hp:items-center hp:justify-center hp:gap-3 hp:bg-black/85 hp:text-white hp:text-center hp:p-4";
|
|
1188
1187
|
const i = document.createElement("div");
|
|
1189
|
-
i.className = "hp:rounded-lg hp:overflow-hidden hp:shadow-lg hp:leading-none", i.appendChild(
|
|
1188
|
+
i.className = "hp:rounded-lg hp:overflow-hidden hp:shadow-lg hp:leading-none", i.appendChild(at(a, { size: s, logoUrl: this.options.logo, logoScale: this.options.logoScale ?? 0.22 })), r.appendChild(i);
|
|
1190
1189
|
const f = document.createElement("div");
|
|
1191
1190
|
f.className = "hp:text-sm hp:opacity-90 hp:max-w-xs", f.textContent = this.ctx.i18n.qrResumeTitle, r.appendChild(f);
|
|
1192
1191
|
const e = document.createElement("div");
|
|
@@ -1201,11 +1200,11 @@ class at {
|
|
|
1201
1200
|
}), e.append(t, c), r.appendChild(e), this.ctx.overlayContainerEl.appendChild(r), this.wrapper = r;
|
|
1202
1201
|
}
|
|
1203
1202
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return new
|
|
1203
|
+
function wt(p, s) {
|
|
1204
|
+
return new ht(p, s);
|
|
1206
1205
|
}
|
|
1207
1206
|
export {
|
|
1208
|
-
|
|
1209
|
-
|
|
1207
|
+
ht as QrResume,
|
|
1208
|
+
wt as installQrResume
|
|
1210
1209
|
};
|
|
1211
|
-
//# sourceMappingURL=
|
|
1210
|
+
//# sourceMappingURL=qrResume-DXwD3oSA.js.map
|