Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const O = async e=>Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/rpan_config_v1`,
- method: c.cb.GET,
- headers: o()(e.headers, [d.c, d.b])
- }).then(T)
- , g = async(e,t)=>Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/videos/${t}`,
- method: c.cb.GET,
- headers: o()(e.headers(), [d.c, d.b])
- }).then(T)
- , y = async(e,t,r)=>{
- const n = t || Math.random().toString()
- , i = parseInt(s()(n).toString(), 16) % 1e3;
- return Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/videos/seed/${i}${r ? "?subreddit=pan2" : ""}`,
- method: c.cb.GET,
- headers: o()(e.headers(), [d.c, d.b])
- }).then(T)
- }
- , j = async(e,t,r)=>Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/videos/${t}/vote/${S(r)}`,
- method: c.cb.POST,
- headers: o()(e.headers, [d.c, d.b])
- }).then(T)
- , _ = async(e,t)=>Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/videos/${t}/heartbeat`,
- method: c.cb.POST,
- headers: o()(e.headers, [d.c, d.b])
- }).then(T)
- , E = async(e,t,r,n)=>{
- const s = r.rteState;
- if (!s)
- return Promise.reject(new Error("Editor state is undefined"));
- const i = l.a.getRawText(s);
- return i ? h(e, t, i).then(e=>e.ok && e.body && e.body.data ? Object.assign({}, e, {
- body: {
- parentId: t,
- comment: Object.assign({}, Object(b.a)(e.body.data, n), {
- media: I(s)
- })
- },
- error: void 0
- }) : e) : Promise.reject(new Error("Cannot send empty message"))
- }
- , h = async(e,t,r)=>Object(u.b)({
- endpoint: `${a.a.streamingApiUrl}/videos/${t}/comment`,
- method: c.cb.POST,
- headers: o()(e.headers, [d.c, d.b]),
- data: {
- text: r
- },
- type: "json"
- }).then(T)
- , I = e=>({
- type: "rtjson",
- richtextContent: {
- document: l.a.toRichTextJSON(e).document
- },
- rteMode: m.h.RICH_TEXT
- })
- , T = e=>{
- if (e.ok)
- return Object.assign({}, e, {
- error: void 0
- });
- {
- const t = {
- type: 404 === e.status ? c.F.NOT_FOUND_ERROR : c.F.SERVER_ERROR
- };
- return 429 === e.status && (t.fields = [{
- field: "",
- msg: Object(p.c)("Try again later")
- }]),
- Object.assign({}, e, {
- error: t
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement