@taole/newgiftbar 0.0.5 → 0.0.6
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/npm/newgiftbar.css +15 -1
- package/npm/newgiftbar.es.js +1983 -1820
- package/package.json +1 -1
package/npm/newgiftbar.es.js
CHANGED
|
@@ -562,8 +562,8 @@ const options = {
|
|
|
562
562
|
*/
|
|
563
563
|
isChatTest: false,
|
|
564
564
|
/**
|
|
565
|
-
* 接口域名。lib 拼 URL 时按 key
|
|
566
|
-
* papi:列表/支付;yapi
|
|
565
|
+
* 接口域名。lib 拼 URL 时按 key 取,必须由宿主注入。
|
|
566
|
+
* papi:列表/支付;yapi:充值页。
|
|
567
567
|
* @type {{ papi?: string, yapi?: string, api?: string }}
|
|
568
568
|
*/
|
|
569
569
|
apiDomain: {},
|
|
@@ -640,1250 +640,351 @@ const options = {
|
|
|
640
640
|
*/
|
|
641
641
|
playGiftAnimation: null,
|
|
642
642
|
/**
|
|
643
|
-
*
|
|
643
|
+
* 打开限额设置页。不注入时 `window.open(getLimitSettingsUrl())`。
|
|
644
644
|
* @type {() => void}
|
|
645
645
|
*/
|
|
646
|
-
|
|
646
|
+
onOpenLimitSettings: null,
|
|
647
647
|
/**
|
|
648
|
-
*
|
|
649
|
-
* @type {() => void}
|
|
648
|
+
* 栏内改收礼人。厅内对标旧栏点 #divTeacherList 写 giftToTeacher,下次开栏带回。
|
|
649
|
+
* @type {(user: { uid: number|string, nickname: string, color?: string }) => void}
|
|
650
650
|
*/
|
|
651
|
-
|
|
651
|
+
onSelectUser: null
|
|
652
652
|
};
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
653
|
+
const deferred = function() {
|
|
654
|
+
const defer = {};
|
|
655
|
+
defer.promise = new Promise((resolve, reject) => {
|
|
656
|
+
defer.resolve = resolve;
|
|
657
|
+
defer.reject = reject;
|
|
658
|
+
});
|
|
659
|
+
return defer;
|
|
660
|
+
};
|
|
661
|
+
function createModal(_Class, props = {}, target = document.body) {
|
|
662
|
+
const wrap = document.createElement("div");
|
|
663
|
+
wrap.setAttribute("data-modal-overlay", "");
|
|
664
|
+
wrap.setAttribute("data-giftbar-modal", "");
|
|
665
|
+
target.appendChild(wrap);
|
|
666
|
+
let modal = new _Class({ target: wrap, props: { closeModal, ...props } });
|
|
667
|
+
const defer = deferred();
|
|
668
|
+
function closeModal(err, result) {
|
|
669
|
+
try {
|
|
670
|
+
modal && modal.$destroy();
|
|
671
|
+
} finally {
|
|
672
|
+
modal = null;
|
|
673
|
+
if (wrap.parentNode) {
|
|
674
|
+
wrap.parentNode.removeChild(wrap);
|
|
671
675
|
}
|
|
672
676
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
let span;
|
|
678
|
-
let t0_value = (
|
|
679
|
-
/*item*/
|
|
680
|
-
ctx[8].title + ""
|
|
681
|
-
);
|
|
682
|
-
let t0;
|
|
683
|
-
let t1;
|
|
684
|
-
let t2;
|
|
685
|
-
let div_class_value;
|
|
686
|
-
let mounted;
|
|
687
|
-
let dispose;
|
|
688
|
-
let if_block = (
|
|
689
|
-
/*item*/
|
|
690
|
-
ctx[8].is_new == 1 && create_if_block_3$8()
|
|
691
|
-
);
|
|
692
|
-
function click_handler() {
|
|
693
|
-
return (
|
|
694
|
-
/*click_handler*/
|
|
695
|
-
ctx[7](
|
|
696
|
-
/*item*/
|
|
697
|
-
ctx[8]
|
|
698
|
-
)
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
|
-
return {
|
|
702
|
-
key: key_1,
|
|
703
|
-
first: null,
|
|
704
|
-
c() {
|
|
705
|
-
div = element("div");
|
|
706
|
-
span = element("span");
|
|
707
|
-
t0 = text(t0_value);
|
|
708
|
-
t1 = space();
|
|
709
|
-
if (if_block) if_block.c();
|
|
710
|
-
t2 = space();
|
|
711
|
-
attr(div, "class", div_class_value = "giftbar-tab " + /*item*/
|
|
712
|
-
(ctx[8].id == /*tabId*/
|
|
713
|
-
ctx[1] ? "giftbar-tab-on" : ""));
|
|
714
|
-
attr(div, "role", "presentation");
|
|
715
|
-
this.first = div;
|
|
716
|
-
},
|
|
717
|
-
m(target, anchor) {
|
|
718
|
-
insert(target, div, anchor);
|
|
719
|
-
append(div, span);
|
|
720
|
-
append(span, t0);
|
|
721
|
-
append(div, t1);
|
|
722
|
-
if (if_block) if_block.m(div, null);
|
|
723
|
-
append(div, t2);
|
|
724
|
-
if (!mounted) {
|
|
725
|
-
dispose = listen(div, "click", stop_propagation(click_handler));
|
|
726
|
-
mounted = true;
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
|
-
p(new_ctx, dirty) {
|
|
730
|
-
ctx = new_ctx;
|
|
731
|
-
if (dirty & /*tabs*/
|
|
732
|
-
1 && t0_value !== (t0_value = /*item*/
|
|
733
|
-
ctx[8].title + "")) set_data(t0, t0_value);
|
|
734
|
-
if (
|
|
735
|
-
/*item*/
|
|
736
|
-
ctx[8].is_new == 1
|
|
737
|
-
) {
|
|
738
|
-
if (if_block) ;
|
|
739
|
-
else {
|
|
740
|
-
if_block = create_if_block_3$8();
|
|
741
|
-
if_block.c();
|
|
742
|
-
if_block.m(div, t2);
|
|
743
|
-
}
|
|
744
|
-
} else if (if_block) {
|
|
745
|
-
if_block.d(1);
|
|
746
|
-
if_block = null;
|
|
747
|
-
}
|
|
748
|
-
if (dirty & /*tabs, tabId*/
|
|
749
|
-
3 && div_class_value !== (div_class_value = "giftbar-tab " + /*item*/
|
|
750
|
-
(ctx[8].id == /*tabId*/
|
|
751
|
-
ctx[1] ? "giftbar-tab-on" : ""))) {
|
|
752
|
-
attr(div, "class", div_class_value);
|
|
753
|
-
}
|
|
754
|
-
},
|
|
755
|
-
d(detaching) {
|
|
756
|
-
if (detaching) {
|
|
757
|
-
detach(div);
|
|
758
|
-
}
|
|
759
|
-
if (if_block) if_block.d();
|
|
760
|
-
mounted = false;
|
|
761
|
-
dispose();
|
|
677
|
+
if (err) {
|
|
678
|
+
defer.reject(err);
|
|
679
|
+
} else {
|
|
680
|
+
defer.resolve(result);
|
|
762
681
|
}
|
|
763
|
-
}
|
|
682
|
+
}
|
|
683
|
+
return { modal, closeModal, promise: defer.promise };
|
|
764
684
|
}
|
|
765
|
-
function
|
|
766
|
-
|
|
767
|
-
let t0;
|
|
768
|
-
let t1_value = (
|
|
769
|
-
/*tip*/
|
|
770
|
-
ctx[2].text + ""
|
|
771
|
-
);
|
|
772
|
-
let t1;
|
|
773
|
-
let a_href_value;
|
|
774
|
-
let if_block = (
|
|
775
|
-
/*tip*/
|
|
776
|
-
ctx[2].img && create_if_block_2$c(ctx)
|
|
777
|
-
);
|
|
778
|
-
return {
|
|
779
|
-
c() {
|
|
780
|
-
a = element("a");
|
|
781
|
-
if (if_block) if_block.c();
|
|
782
|
-
t0 = space();
|
|
783
|
-
t1 = text(t1_value);
|
|
784
|
-
attr(a, "href", a_href_value = /*tip*/
|
|
785
|
-
ctx[2].link);
|
|
786
|
-
attr(a, "target", "_blank");
|
|
787
|
-
attr(a, "rel", "noopener noreferrer");
|
|
788
|
-
},
|
|
789
|
-
m(target, anchor) {
|
|
790
|
-
insert(target, a, anchor);
|
|
791
|
-
if (if_block) if_block.m(a, null);
|
|
792
|
-
append(a, t0);
|
|
793
|
-
append(a, t1);
|
|
794
|
-
},
|
|
795
|
-
p(ctx2, dirty) {
|
|
796
|
-
if (
|
|
797
|
-
/*tip*/
|
|
798
|
-
ctx2[2].img
|
|
799
|
-
) {
|
|
800
|
-
if (if_block) {
|
|
801
|
-
if_block.p(ctx2, dirty);
|
|
802
|
-
} else {
|
|
803
|
-
if_block = create_if_block_2$c(ctx2);
|
|
804
|
-
if_block.c();
|
|
805
|
-
if_block.m(a, t0);
|
|
806
|
-
}
|
|
807
|
-
} else if (if_block) {
|
|
808
|
-
if_block.d(1);
|
|
809
|
-
if_block = null;
|
|
810
|
-
}
|
|
811
|
-
if (dirty & /*tip*/
|
|
812
|
-
4 && t1_value !== (t1_value = /*tip*/
|
|
813
|
-
ctx2[2].text + "")) set_data(t1, t1_value);
|
|
814
|
-
if (dirty & /*tip*/
|
|
815
|
-
4 && a_href_value !== (a_href_value = /*tip*/
|
|
816
|
-
ctx2[2].link)) {
|
|
817
|
-
attr(a, "href", a_href_value);
|
|
818
|
-
}
|
|
819
|
-
},
|
|
820
|
-
d(detaching) {
|
|
821
|
-
if (detaching) {
|
|
822
|
-
detach(a);
|
|
823
|
-
}
|
|
824
|
-
if (if_block) if_block.d();
|
|
825
|
-
}
|
|
826
|
-
};
|
|
685
|
+
function joinQuery(parts) {
|
|
686
|
+
return parts.filter((item) => item && item[1] !== void 0 && item[1] !== null).map(([key, value]) => key + "=" + value).join("&");
|
|
827
687
|
}
|
|
828
|
-
function
|
|
829
|
-
let
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
if (!src_url_equal(img.src, img_src_value = /*tip*/
|
|
835
|
-
ctx[2].img)) attr(img, "src", img_src_value);
|
|
836
|
-
attr(img, "alt", "");
|
|
837
|
-
},
|
|
838
|
-
m(target, anchor) {
|
|
839
|
-
insert(target, img, anchor);
|
|
840
|
-
},
|
|
841
|
-
p(ctx2, dirty) {
|
|
842
|
-
if (dirty & /*tip*/
|
|
843
|
-
4 && !src_url_equal(img.src, img_src_value = /*tip*/
|
|
844
|
-
ctx2[2].img)) {
|
|
845
|
-
attr(img, "src", img_src_value);
|
|
846
|
-
}
|
|
847
|
-
},
|
|
848
|
-
d(detaching) {
|
|
849
|
-
if (detaching) {
|
|
850
|
-
detach(img);
|
|
851
|
-
}
|
|
688
|
+
function appendQuery(url, params) {
|
|
689
|
+
let next = url || "";
|
|
690
|
+
Object.keys(params || {}).forEach((key) => {
|
|
691
|
+
const value = params[key];
|
|
692
|
+
if (value === void 0 || value === null) {
|
|
693
|
+
return;
|
|
852
694
|
}
|
|
853
|
-
|
|
695
|
+
const re = new RegExp("([?&])" + key + "=[^&]*");
|
|
696
|
+
if (re.test(next)) {
|
|
697
|
+
next = next.replace(re, "$1" + key + "=" + value);
|
|
698
|
+
} else {
|
|
699
|
+
next += (next.indexOf("?") >= 0 ? "&" : "?") + key + "=" + value;
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
return next;
|
|
854
703
|
}
|
|
855
|
-
function
|
|
856
|
-
|
|
857
|
-
let mounted;
|
|
858
|
-
let dispose;
|
|
859
|
-
return {
|
|
860
|
-
c() {
|
|
861
|
-
div = element("div");
|
|
862
|
-
div.innerHTML = `<img src="https://asset.tuwan.com/officialsite/images/king.png" alt=""/> <span>贵族</span>`;
|
|
863
|
-
attr(div, "class", "giftbar-nobility");
|
|
864
|
-
attr(div, "role", "presentation");
|
|
865
|
-
},
|
|
866
|
-
m(target, anchor) {
|
|
867
|
-
insert(target, div, anchor);
|
|
868
|
-
if (!mounted) {
|
|
869
|
-
dispose = listen(div, "click", stop_propagation(
|
|
870
|
-
/*openNobility*/
|
|
871
|
-
ctx[5]
|
|
872
|
-
));
|
|
873
|
-
mounted = true;
|
|
874
|
-
}
|
|
875
|
-
},
|
|
876
|
-
p: noop,
|
|
877
|
-
d(detaching) {
|
|
878
|
-
if (detaching) {
|
|
879
|
-
detach(div);
|
|
880
|
-
}
|
|
881
|
-
mounted = false;
|
|
882
|
-
dispose();
|
|
883
|
-
}
|
|
884
|
-
};
|
|
704
|
+
function stripSlash(domain) {
|
|
705
|
+
return domain ? String(domain).replace(/\/$/, "") : "";
|
|
885
706
|
}
|
|
886
|
-
function
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
let t0;
|
|
892
|
-
let div1;
|
|
893
|
-
let t1;
|
|
894
|
-
let each_value = ensure_array_like(
|
|
895
|
-
/*tabs*/
|
|
896
|
-
ctx[0]
|
|
897
|
-
);
|
|
898
|
-
const get_key = (ctx2) => (
|
|
899
|
-
/*item*/
|
|
900
|
-
ctx2[8].id
|
|
901
|
-
);
|
|
902
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
903
|
-
let child_ctx = get_each_context$a(ctx, each_value, i);
|
|
904
|
-
let key = get_key(child_ctx);
|
|
905
|
-
each_1_lookup.set(key, each_blocks[i] = create_each_block$a(key, child_ctx));
|
|
707
|
+
function resolveApiDomain(kind) {
|
|
708
|
+
const map = options.apiDomain || {};
|
|
709
|
+
const injected = map[kind];
|
|
710
|
+
if (injected) {
|
|
711
|
+
return stripSlash(injected);
|
|
906
712
|
}
|
|
907
|
-
|
|
908
|
-
/*tip*/
|
|
909
|
-
ctx[2] && /*tip*/
|
|
910
|
-
ctx[2].text && /*tip*/
|
|
911
|
-
ctx[2].link && /*tip*/
|
|
912
|
-
ctx[2].kind !== "hidden" && create_if_block_1$l(ctx)
|
|
913
|
-
);
|
|
914
|
-
let if_block1 = (
|
|
915
|
-
/*showNobility*/
|
|
916
|
-
ctx[3] && create_if_block$o(ctx)
|
|
917
|
-
);
|
|
918
|
-
return {
|
|
919
|
-
c() {
|
|
920
|
-
div2 = element("div");
|
|
921
|
-
div0 = element("div");
|
|
922
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
923
|
-
each_blocks[i].c();
|
|
924
|
-
}
|
|
925
|
-
t0 = space();
|
|
926
|
-
div1 = element("div");
|
|
927
|
-
if (if_block0) if_block0.c();
|
|
928
|
-
t1 = space();
|
|
929
|
-
if (if_block1) if_block1.c();
|
|
930
|
-
attr(div0, "class", "giftbar-tabs");
|
|
931
|
-
attr(div1, "class", "giftbar-tip");
|
|
932
|
-
attr(div2, "class", "giftbar-head");
|
|
933
|
-
},
|
|
934
|
-
m(target, anchor) {
|
|
935
|
-
insert(target, div2, anchor);
|
|
936
|
-
append(div2, div0);
|
|
937
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
938
|
-
if (each_blocks[i]) {
|
|
939
|
-
each_blocks[i].m(div0, null);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
append(div2, t0);
|
|
943
|
-
append(div2, div1);
|
|
944
|
-
if (if_block0) if_block0.m(div1, null);
|
|
945
|
-
append(div1, t1);
|
|
946
|
-
if (if_block1) if_block1.m(div1, null);
|
|
947
|
-
},
|
|
948
|
-
p(ctx2, [dirty]) {
|
|
949
|
-
if (dirty & /*tabs, tabId, switchTab*/
|
|
950
|
-
19) {
|
|
951
|
-
each_value = ensure_array_like(
|
|
952
|
-
/*tabs*/
|
|
953
|
-
ctx2[0]
|
|
954
|
-
);
|
|
955
|
-
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div0, destroy_block, create_each_block$a, null, get_each_context$a);
|
|
956
|
-
}
|
|
957
|
-
if (
|
|
958
|
-
/*tip*/
|
|
959
|
-
ctx2[2] && /*tip*/
|
|
960
|
-
ctx2[2].text && /*tip*/
|
|
961
|
-
ctx2[2].link && /*tip*/
|
|
962
|
-
ctx2[2].kind !== "hidden"
|
|
963
|
-
) {
|
|
964
|
-
if (if_block0) {
|
|
965
|
-
if_block0.p(ctx2, dirty);
|
|
966
|
-
} else {
|
|
967
|
-
if_block0 = create_if_block_1$l(ctx2);
|
|
968
|
-
if_block0.c();
|
|
969
|
-
if_block0.m(div1, t1);
|
|
970
|
-
}
|
|
971
|
-
} else if (if_block0) {
|
|
972
|
-
if_block0.d(1);
|
|
973
|
-
if_block0 = null;
|
|
974
|
-
}
|
|
975
|
-
if (
|
|
976
|
-
/*showNobility*/
|
|
977
|
-
ctx2[3]
|
|
978
|
-
) {
|
|
979
|
-
if (if_block1) {
|
|
980
|
-
if_block1.p(ctx2, dirty);
|
|
981
|
-
} else {
|
|
982
|
-
if_block1 = create_if_block$o(ctx2);
|
|
983
|
-
if_block1.c();
|
|
984
|
-
if_block1.m(div1, null);
|
|
985
|
-
}
|
|
986
|
-
} else if (if_block1) {
|
|
987
|
-
if_block1.d(1);
|
|
988
|
-
if_block1 = null;
|
|
989
|
-
}
|
|
990
|
-
},
|
|
991
|
-
i: noop,
|
|
992
|
-
o: noop,
|
|
993
|
-
d(detaching) {
|
|
994
|
-
if (detaching) {
|
|
995
|
-
detach(div2);
|
|
996
|
-
}
|
|
997
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
998
|
-
each_blocks[i].d();
|
|
999
|
-
}
|
|
1000
|
-
if (if_block0) if_block0.d();
|
|
1001
|
-
if (if_block1) if_block1.d();
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
713
|
+
throw new Error("giftBarLib apiDomain." + kind + " is required");
|
|
1004
714
|
}
|
|
1005
|
-
function
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
let { tip = {
|
|
1009
|
-
kind: "magic",
|
|
1010
|
-
text: "",
|
|
1011
|
-
link: "",
|
|
1012
|
-
img: ""
|
|
1013
|
-
} } = $$props;
|
|
1014
|
-
let { showNobility = true } = $$props;
|
|
1015
|
-
let { onClickTab } = $$props;
|
|
1016
|
-
function switchTab(item) {
|
|
1017
|
-
onClickTab && onClickTab(item);
|
|
1018
|
-
}
|
|
1019
|
-
function openNobility(event) {
|
|
1020
|
-
event && event.stopPropagation && event.stopPropagation();
|
|
1021
|
-
if (typeof options.onOpenNobility === "function") {
|
|
1022
|
-
options.onOpenNobility();
|
|
1023
|
-
}
|
|
715
|
+
function assertSource(source) {
|
|
716
|
+
if (source !== "room" && source !== "im") {
|
|
717
|
+
throw new Error("giftBarLib source must be 'room' or 'im'");
|
|
1024
718
|
}
|
|
1025
|
-
const click_handler = (item) => switchTab(item);
|
|
1026
|
-
$$self.$$set = ($$props2) => {
|
|
1027
|
-
if ("tabs" in $$props2) $$invalidate(0, tabs = $$props2.tabs);
|
|
1028
|
-
if ("tabId" in $$props2) $$invalidate(1, tabId = $$props2.tabId);
|
|
1029
|
-
if ("tip" in $$props2) $$invalidate(2, tip = $$props2.tip);
|
|
1030
|
-
if ("showNobility" in $$props2) $$invalidate(3, showNobility = $$props2.showNobility);
|
|
1031
|
-
if ("onClickTab" in $$props2) $$invalidate(6, onClickTab = $$props2.onClickTab);
|
|
1032
|
-
};
|
|
1033
|
-
return [
|
|
1034
|
-
tabs,
|
|
1035
|
-
tabId,
|
|
1036
|
-
tip,
|
|
1037
|
-
showNobility,
|
|
1038
|
-
switchTab,
|
|
1039
|
-
openNobility,
|
|
1040
|
-
onClickTab,
|
|
1041
|
-
click_handler
|
|
1042
|
-
];
|
|
1043
719
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
init(this, options2, instance$s, create_fragment$s, safe_not_equal, {
|
|
1048
|
-
tabs: 0,
|
|
1049
|
-
tabId: 1,
|
|
1050
|
-
tip: 2,
|
|
1051
|
-
showNobility: 3,
|
|
1052
|
-
onClickTab: 6
|
|
1053
|
-
});
|
|
720
|
+
function assertRoomPayContext(ctx) {
|
|
721
|
+
if (!ctx || ctx.cid === void 0 || ctx.cid === null || ctx.cid === "") {
|
|
722
|
+
throw new Error("source=room requires cid in getPayContext");
|
|
1054
723
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
let tip = null;
|
|
1058
|
-
let currentHtml = html || "";
|
|
1059
|
-
function hide() {
|
|
1060
|
-
if (tip) {
|
|
1061
|
-
tip.remove();
|
|
1062
|
-
tip = null;
|
|
1063
|
-
}
|
|
724
|
+
if (ctx.imuid !== void 0 || ctx.group_id !== void 0) {
|
|
725
|
+
throw new Error("source=room PayContext must not include imuid/group_id");
|
|
1064
726
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
if (!currentHtml) {
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
tip = document.createElement("div");
|
|
1071
|
-
tip.className = "giftbar-item-tooltip";
|
|
1072
|
-
tip.innerHTML = '<div class="giftbar-item-tooltip-inner">' + currentHtml + '</div><div class="giftbar-item-tooltip-arrow"></div>';
|
|
1073
|
-
document.body.appendChild(tip);
|
|
1074
|
-
const rect = node.getBoundingClientRect();
|
|
1075
|
-
tip.style.left = rect.left + rect.width / 2 + "px";
|
|
1076
|
-
tip.style.top = rect.top + "px";
|
|
727
|
+
if (String(ctx.actid) === "101") {
|
|
728
|
+
throw new Error("source=room PayContext must not use actid=101");
|
|
1077
729
|
}
|
|
1078
|
-
node.addEventListener("mouseenter", show);
|
|
1079
|
-
node.addEventListener("mouseleave", hide);
|
|
1080
|
-
window.addEventListener("scroll", hide, true);
|
|
1081
|
-
return {
|
|
1082
|
-
update(nextHtml) {
|
|
1083
|
-
currentHtml = nextHtml || "";
|
|
1084
|
-
if (tip) {
|
|
1085
|
-
if (!currentHtml) {
|
|
1086
|
-
hide();
|
|
1087
|
-
} else {
|
|
1088
|
-
show();
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
destroy() {
|
|
1093
|
-
hide();
|
|
1094
|
-
node.removeEventListener("mouseenter", show);
|
|
1095
|
-
node.removeEventListener("mouseleave", hide);
|
|
1096
|
-
window.removeEventListener("scroll", hide, true);
|
|
1097
|
-
}
|
|
1098
|
-
};
|
|
1099
730
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
if (/^(data:|blob:)/i.test(src)) {
|
|
1107
|
-
return src;
|
|
731
|
+
function hasValue$3(value) {
|
|
732
|
+
return value !== void 0 && value !== null && value !== "";
|
|
733
|
+
}
|
|
734
|
+
function assertImPayContext(ctx) {
|
|
735
|
+
if (!ctx) {
|
|
736
|
+
throw new Error("source=im requires getPayContext");
|
|
1108
737
|
}
|
|
1109
|
-
if (
|
|
1110
|
-
|
|
738
|
+
if (!hasValue$3(ctx.imuid) && !hasValue$3(ctx.group_id)) {
|
|
739
|
+
throw new Error("source=im requires imuid or group_id in getPayContext");
|
|
1111
740
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
url.searchParams.set("x-oss-process", PROCESS);
|
|
1118
|
-
return url.toString();
|
|
1119
|
-
} catch (e) {
|
|
1120
|
-
return src;
|
|
741
|
+
if (hasValue$3(ctx.cid)) {
|
|
742
|
+
throw new Error("source=im PayContext must not include cid");
|
|
743
|
+
}
|
|
744
|
+
if (ctx.is_whole_wheat !== void 0) {
|
|
745
|
+
throw new Error("source=im PayContext must not include is_whole_wheat");
|
|
1121
746
|
}
|
|
1122
747
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
function findGridRoot(node) {
|
|
1126
|
-
return node.closest ? node.closest(".giftbar-grid") : null;
|
|
748
|
+
function getSource() {
|
|
749
|
+
return options.source;
|
|
1127
750
|
}
|
|
1128
|
-
function
|
|
1129
|
-
|
|
1130
|
-
|
|
751
|
+
function isImSource() {
|
|
752
|
+
return options.source === "im";
|
|
753
|
+
}
|
|
754
|
+
function papi() {
|
|
755
|
+
return resolveApiDomain("papi");
|
|
756
|
+
}
|
|
757
|
+
function yapi() {
|
|
758
|
+
return resolveApiDomain("yapi");
|
|
759
|
+
}
|
|
760
|
+
function hasValue$2(value) {
|
|
761
|
+
return value !== void 0 && value !== null && value !== "";
|
|
762
|
+
}
|
|
763
|
+
function sceneParts$1(ctx) {
|
|
764
|
+
if (hasValue$2(ctx && ctx.group_id)) {
|
|
765
|
+
return [["group_id", ctx.group_id]];
|
|
1131
766
|
}
|
|
1132
|
-
|
|
767
|
+
return [["imuid", ctx && ctx.imuid]];
|
|
1133
768
|
}
|
|
1134
|
-
function
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
769
|
+
function openParts(giftId, num, paySure, ctx) {
|
|
770
|
+
return [
|
|
771
|
+
["giftid", giftId],
|
|
772
|
+
["num", num || 1],
|
|
773
|
+
["pay_confirm", 1],
|
|
774
|
+
["apiver", 1],
|
|
775
|
+
["pay_sure", paySure || 0],
|
|
776
|
+
["uids", ctx && ctx.selfUid],
|
|
777
|
+
...sceneParts$1(ctx)
|
|
778
|
+
];
|
|
779
|
+
}
|
|
780
|
+
function getRechargeUrl() {
|
|
781
|
+
return yapi() + "/activityapi/recharge";
|
|
782
|
+
}
|
|
783
|
+
function getLimitSettingsUrl() {
|
|
784
|
+
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/home/consume-check";
|
|
785
|
+
}
|
|
786
|
+
function giveUpConsumeLimitUrl() {
|
|
787
|
+
return yapi() + "/user/setGiftRemindSetting?format=jsonp";
|
|
788
|
+
}
|
|
789
|
+
function giftListsUrl(cid, navid) {
|
|
790
|
+
return papi() + "/Teacher/giftLists?format=jsonp&platform=0" + (hasValue$2(cid) ? "&cid=" + cid : "") + "&navid=" + navid + "&apiver=4";
|
|
791
|
+
}
|
|
792
|
+
function haveGiftUrl(cid, navid) {
|
|
793
|
+
return papi() + "/Teacher/haveGift?format=jsonp&mode=2" + (hasValue$2(cid) ? "&cid=" + cid : "") + "&navid=" + navid;
|
|
794
|
+
}
|
|
795
|
+
function getMoneyUrl() {
|
|
796
|
+
return papi() + "/Teacher/getMoney";
|
|
797
|
+
}
|
|
798
|
+
function diamondGiftMoreUrl(query) {
|
|
799
|
+
return papi() + "/Diamond/giftMore?" + query;
|
|
800
|
+
}
|
|
801
|
+
function giveGiftUrl(query) {
|
|
802
|
+
return papi() + "/Teacher/giveGift?" + query;
|
|
803
|
+
}
|
|
804
|
+
function giveGiftInfoUrl(cid, giftId) {
|
|
805
|
+
return yapi() + "/nobility/getGiveGiftInfo?cid=" + cid + "&id=" + giftId + "&freeCardTypeid=2&format=jsonp";
|
|
806
|
+
}
|
|
807
|
+
function treasureBuyUrl(query) {
|
|
808
|
+
return papi() + "/Treasure/buy?format=jsonp&" + query;
|
|
809
|
+
}
|
|
810
|
+
function blindBoxPayUrl(query) {
|
|
811
|
+
return papi() + "/treasure/blindBox?format=jsonp&" + query;
|
|
812
|
+
}
|
|
813
|
+
function blindBoxImgListUrl(giftId) {
|
|
814
|
+
return papi() + "/gift/blindBoxImgList?format=jsonp&gift_id=" + giftId;
|
|
815
|
+
}
|
|
816
|
+
function treasureGetInfoUrl(giftId) {
|
|
817
|
+
return papi() + "/TreasureV3/getInfo?giftid=" + giftId + "&apiver=1";
|
|
818
|
+
}
|
|
819
|
+
function treasureGetRecordUrl(giftId, page, step) {
|
|
820
|
+
return papi() + "/TreasureV3/getRecord?format=jsonp&giftid=" + giftId + "&page=" + page + "&step=" + (step || 10);
|
|
821
|
+
}
|
|
822
|
+
function treasureGoldUrl(giftId, cid, num, paySure, ctx) {
|
|
823
|
+
if (isImSource()) {
|
|
824
|
+
return papi() + "/TreasureV3/gold?" + joinQuery(openParts(giftId, num, paySure, ctx));
|
|
1142
825
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
826
|
+
return papi() + "/TreasureV3/gold?giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&pay_confirm=1&pay_sure=" + (paySure || 0);
|
|
827
|
+
}
|
|
828
|
+
function treasureV3BuyUrl(giftId, cid, num, paySure, ctx) {
|
|
829
|
+
if (isImSource()) {
|
|
830
|
+
return papi() + "/TreasureV3/buy?" + joinQuery(openParts(giftId, num, paySure, ctx));
|
|
1145
831
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
clearObserver();
|
|
1165
|
-
},
|
|
1166
|
-
{ root: root || null, rootMargin: PRELOAD_MARGIN, threshold: 0.01 }
|
|
1167
|
-
);
|
|
1168
|
-
observer.observe(node);
|
|
832
|
+
return papi() + "/TreasureV3/buy?giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&pay_confirm=1&pay_sure=" + (paySure || 0);
|
|
833
|
+
}
|
|
834
|
+
function modalBlindBoxPayUrl(giftId, cid, num, worth, isBuy, ctx) {
|
|
835
|
+
if (isImSource()) {
|
|
836
|
+
return papi() + "/treasure/blindBox?" + joinQuery([
|
|
837
|
+
["anonymous", 0],
|
|
838
|
+
["actid", 100],
|
|
839
|
+
["platform", 0],
|
|
840
|
+
["giftid", giftId],
|
|
841
|
+
["num", num || 1],
|
|
842
|
+
["pay_confirm", 1],
|
|
843
|
+
["apiver", 1],
|
|
844
|
+
["pay_sure", 0],
|
|
845
|
+
["worth", worth || 0],
|
|
846
|
+
["is_buy", isBuy || 0],
|
|
847
|
+
["uids", ctx && ctx.selfUid],
|
|
848
|
+
...sceneParts$1(ctx)
|
|
849
|
+
]);
|
|
1169
850
|
}
|
|
1170
|
-
|
|
1171
|
-
return {
|
|
1172
|
-
update(nextSrc) {
|
|
1173
|
-
const next = nextSrc || "";
|
|
1174
|
-
if (next === currentSrc) {
|
|
1175
|
-
return;
|
|
1176
|
-
}
|
|
1177
|
-
currentSrc = next;
|
|
1178
|
-
observe();
|
|
1179
|
-
},
|
|
1180
|
-
destroy() {
|
|
1181
|
-
clearObserver();
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
851
|
+
return papi() + "/treasure/blindBox?format=jsonp&giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&worth=" + (worth || 0) + "&is_buy=" + (isBuy || 0);
|
|
1184
852
|
}
|
|
1185
|
-
function
|
|
1186
|
-
|
|
1187
|
-
child_ctx[7] = list[i];
|
|
1188
|
-
return child_ctx;
|
|
853
|
+
function diamondPrefixQuery(parts) {
|
|
854
|
+
return "anonymous=0&actid=" + (isImSource() ? 101 : 100) + "&platform=0&" + joinQuery(parts);
|
|
1189
855
|
}
|
|
1190
|
-
function
|
|
1191
|
-
|
|
1192
|
-
let t_value = (
|
|
1193
|
-
/*giftItem*/
|
|
1194
|
-
ctx[7].tag + ""
|
|
1195
|
-
);
|
|
1196
|
-
let t;
|
|
1197
|
-
return {
|
|
1198
|
-
c() {
|
|
1199
|
-
span = element("span");
|
|
1200
|
-
t = text(t_value);
|
|
1201
|
-
attr(span, "class", "giftbar-item-tag");
|
|
1202
|
-
},
|
|
1203
|
-
m(target, anchor) {
|
|
1204
|
-
insert(target, span, anchor);
|
|
1205
|
-
append(span, t);
|
|
1206
|
-
},
|
|
1207
|
-
p(ctx2, dirty) {
|
|
1208
|
-
if (dirty & /*gifts*/
|
|
1209
|
-
1 && t_value !== (t_value = /*giftItem*/
|
|
1210
|
-
ctx2[7].tag + "")) set_data(t, t_value);
|
|
1211
|
-
},
|
|
1212
|
-
d(detaching) {
|
|
1213
|
-
if (detaching) {
|
|
1214
|
-
detach(span);
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
856
|
+
function boxPrefixQuery(parts) {
|
|
857
|
+
return "anonymous=0&actid=100&platform=0&" + joinQuery(parts);
|
|
1218
858
|
}
|
|
1219
|
-
function
|
|
1220
|
-
|
|
1221
|
-
let t0;
|
|
1222
|
-
let t1_value = (
|
|
1223
|
-
/*giftItem*/
|
|
1224
|
-
ctx[7].unitText + ""
|
|
1225
|
-
);
|
|
1226
|
-
let t1;
|
|
1227
|
-
let if_block = (
|
|
1228
|
-
/*giftItem*/
|
|
1229
|
-
ctx[7].picIcon && create_if_block_4$6(ctx)
|
|
1230
|
-
);
|
|
1231
|
-
return {
|
|
1232
|
-
c() {
|
|
1233
|
-
div = element("div");
|
|
1234
|
-
if (if_block) if_block.c();
|
|
1235
|
-
t0 = space();
|
|
1236
|
-
t1 = text(t1_value);
|
|
1237
|
-
attr(div, "class", "giftbar-item-unit");
|
|
1238
|
-
},
|
|
1239
|
-
m(target, anchor) {
|
|
1240
|
-
insert(target, div, anchor);
|
|
1241
|
-
if (if_block) if_block.m(div, null);
|
|
1242
|
-
append(div, t0);
|
|
1243
|
-
append(div, t1);
|
|
1244
|
-
},
|
|
1245
|
-
p(ctx2, dirty) {
|
|
1246
|
-
if (
|
|
1247
|
-
/*giftItem*/
|
|
1248
|
-
ctx2[7].picIcon
|
|
1249
|
-
) {
|
|
1250
|
-
if (if_block) {
|
|
1251
|
-
if_block.p(ctx2, dirty);
|
|
1252
|
-
} else {
|
|
1253
|
-
if_block = create_if_block_4$6(ctx2);
|
|
1254
|
-
if_block.c();
|
|
1255
|
-
if_block.m(div, t0);
|
|
1256
|
-
}
|
|
1257
|
-
} else if (if_block) {
|
|
1258
|
-
if_block.d(1);
|
|
1259
|
-
if_block = null;
|
|
1260
|
-
}
|
|
1261
|
-
if (dirty & /*gifts*/
|
|
1262
|
-
1 && t1_value !== (t1_value = /*giftItem*/
|
|
1263
|
-
ctx2[7].unitText + "")) set_data(t1, t1_value);
|
|
1264
|
-
},
|
|
1265
|
-
d(detaching) {
|
|
1266
|
-
if (detaching) {
|
|
1267
|
-
detach(div);
|
|
1268
|
-
}
|
|
1269
|
-
if (if_block) if_block.d();
|
|
1270
|
-
}
|
|
1271
|
-
};
|
|
859
|
+
function platformPrefixQuery(parts) {
|
|
860
|
+
return "platform=0&" + joinQuery(parts);
|
|
1272
861
|
}
|
|
1273
|
-
function
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
862
|
+
function getCrystalBlindBoxBaseUrl() {
|
|
863
|
+
if (options.isChatTest) {
|
|
864
|
+
return "https://act-test.tuwan.com/cdn/s1season-box.html";
|
|
865
|
+
}
|
|
866
|
+
const host = window.location.host || "";
|
|
867
|
+
const actHost = host.indexOf("diandiankaihei.com") > -1 ? "act.diandiankaihei.com" : "act.tuwan.com";
|
|
868
|
+
return "https://" + actHost + "/cdn/s1season-box.html";
|
|
869
|
+
}
|
|
870
|
+
function getCrystalBlindBoxUrl(cid, giftId, navid) {
|
|
871
|
+
const base = getCrystalBlindBoxBaseUrl();
|
|
872
|
+
if (isImSource()) {
|
|
873
|
+
return base + "?giftId=" + giftId + "&navid=" + navid;
|
|
874
|
+
}
|
|
875
|
+
return base + "?cid=" + cid + "&giftId=" + giftId;
|
|
876
|
+
}
|
|
877
|
+
const TAB_PACKAGE = 3;
|
|
878
|
+
const TAB_CRYSTAL = 7;
|
|
879
|
+
const PACKAGE_TAB_IDS = [TAB_PACKAGE, TAB_CRYSTAL];
|
|
880
|
+
const MAGIC_GIFT_IDS = [866, 873, 1583, 155, 156];
|
|
881
|
+
const NO_WHOLE_WHEAT_GIFT_IDS = [37, 9, 10, 55, 1293];
|
|
882
|
+
const CRYSTAL_IMG = "https://asset.tuwan.com/chatroom/images/icon_new_crystal.png";
|
|
883
|
+
const ZHUANSHI_IMG = "https://res.tuwan.com/templet/play/public/images/zuanshi.png";
|
|
884
|
+
const EMPTY_BAG_IMG = "https://asset.tuwan.com/images/chartRoomNoGift.png";
|
|
885
|
+
const DEFAULT_MAGIC_TIP_LINK = "https://y.tuwan.com/activities/900325Cdc25ee#/";
|
|
886
|
+
const DEFAULT_CRYSTAL_TIP_LINK = "https://y.tuwan.com/activity/340Cb43562?v=1703303588331#/";
|
|
887
|
+
const IM_DEFAULT_MAGIC_TIP_LINK = "https://y.tuwan.com/activity/36C33a2de?v=1656553263108#/";
|
|
888
|
+
function isPackageTab(tabId) {
|
|
889
|
+
return PACKAGE_TAB_IDS.indexOf(Number(tabId)) > -1;
|
|
890
|
+
}
|
|
891
|
+
function getVipLevelUrl() {
|
|
892
|
+
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/vip_level";
|
|
893
|
+
}
|
|
894
|
+
function getNobilityUrl() {
|
|
895
|
+
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/levelm";
|
|
896
|
+
}
|
|
897
|
+
function getEmptyBagImg() {
|
|
898
|
+
return EMPTY_BAG_IMG;
|
|
899
|
+
}
|
|
900
|
+
function nrTobr(desc) {
|
|
901
|
+
if (!desc || typeof desc !== "string") {
|
|
902
|
+
return "";
|
|
903
|
+
}
|
|
904
|
+
return desc.replace(/\r\n/g, "<br>").replace(/\n/g, "<br>");
|
|
905
|
+
}
|
|
906
|
+
function formatBoxtitle(text2) {
|
|
907
|
+
if (!text2 || typeof text2 !== "string") {
|
|
908
|
+
return "";
|
|
909
|
+
}
|
|
910
|
+
const arr = text2.split("有机会获得");
|
|
911
|
+
if (arr.length > 1) {
|
|
912
|
+
return '有机会获得<span style="color:#ff6691;">' + arr[1] + "</span>";
|
|
913
|
+
}
|
|
914
|
+
return "";
|
|
915
|
+
}
|
|
916
|
+
function formatMoney(money, location2) {
|
|
917
|
+
const value = money * 1;
|
|
918
|
+
if (isNaN(value)) {
|
|
919
|
+
return money == null ? "" : String(money);
|
|
920
|
+
}
|
|
921
|
+
if (location2) {
|
|
922
|
+
if (value >= 1e4) {
|
|
923
|
+
return (value / 1e4).toFixed(2) + "w";
|
|
1305
924
|
}
|
|
1306
|
-
|
|
925
|
+
const moneyStr = value.toFixed(2) + "";
|
|
926
|
+
if (moneyStr.indexOf(".") === 4) {
|
|
927
|
+
return parseInt(String(value), 10);
|
|
928
|
+
}
|
|
929
|
+
return value.toFixed(2);
|
|
930
|
+
}
|
|
931
|
+
return value >= 1e4 ? (value / 1e4).toFixed(2) + "w" : parseInt(String(value), 10);
|
|
1307
932
|
}
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
)
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
div = element("div");
|
|
1318
|
-
t = text(t_value);
|
|
1319
|
-
attr(div, "class", "giftbar-item-unit");
|
|
1320
|
-
},
|
|
1321
|
-
m(target, anchor) {
|
|
1322
|
-
insert(target, div, anchor);
|
|
1323
|
-
append(div, t);
|
|
1324
|
-
},
|
|
1325
|
-
p(ctx2, dirty) {
|
|
1326
|
-
if (dirty & /*gifts*/
|
|
1327
|
-
1 && t_value !== (t_value = /*giftItem*/
|
|
1328
|
-
ctx2[7].unitText2 + "")) set_data(t, t_value);
|
|
1329
|
-
},
|
|
1330
|
-
d(detaching) {
|
|
1331
|
-
if (detaching) {
|
|
1332
|
-
detach(div);
|
|
1333
|
-
}
|
|
933
|
+
function stripHonorName(nickname) {
|
|
934
|
+
if (!nickname || typeof nickname !== "string") {
|
|
935
|
+
return nickname || "";
|
|
936
|
+
}
|
|
937
|
+
const marks = ["♕", "♚", "♔", "☬"];
|
|
938
|
+
for (let i = 0; i < marks.length; i++) {
|
|
939
|
+
if (nickname.indexOf(marks[i]) > -1) {
|
|
940
|
+
const part = nickname.split(marks[i])[1] || "";
|
|
941
|
+
return part || nickname;
|
|
1334
942
|
}
|
|
1335
|
-
}
|
|
943
|
+
}
|
|
944
|
+
return nickname;
|
|
1336
945
|
}
|
|
1337
|
-
function
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
let t2_value = (
|
|
1348
|
-
/*giftItem*/
|
|
1349
|
-
ctx[7].title + ""
|
|
1350
|
-
);
|
|
1351
|
-
let t2;
|
|
1352
|
-
let t3;
|
|
1353
|
-
let t4;
|
|
1354
|
-
let div2_id_value;
|
|
1355
|
-
let div2_class_value;
|
|
1356
|
-
let giftHoverTip_action;
|
|
1357
|
-
let mounted;
|
|
1358
|
-
let dispose;
|
|
1359
|
-
let if_block0 = (
|
|
1360
|
-
/*giftItem*/
|
|
1361
|
-
ctx[7].tag && create_if_block_5$5(ctx)
|
|
1362
|
-
);
|
|
1363
|
-
let if_block1 = (
|
|
1364
|
-
/*giftItem*/
|
|
1365
|
-
ctx[7].unitText && create_if_block_3$7(ctx)
|
|
1366
|
-
);
|
|
1367
|
-
let if_block2 = (
|
|
1368
|
-
/*giftItem*/
|
|
1369
|
-
ctx[7].unitText2 && create_if_block_2$b(ctx)
|
|
1370
|
-
);
|
|
1371
|
-
function click_handler() {
|
|
1372
|
-
return (
|
|
1373
|
-
/*click_handler*/
|
|
1374
|
-
ctx[6](
|
|
1375
|
-
/*giftItem*/
|
|
1376
|
-
ctx[7]
|
|
1377
|
-
)
|
|
1378
|
-
);
|
|
946
|
+
function isIframeBlindBox(gift, tabId) {
|
|
947
|
+
return Number(tabId) === TAB_CRYSTAL && Number(gift && gift.type) === 24 && Number(gift && gift.worth) === 3;
|
|
948
|
+
}
|
|
949
|
+
function isBlindBoxModalGift(gift, tabId) {
|
|
950
|
+
const navid = Number(tabId);
|
|
951
|
+
const type = Number(gift && gift.type);
|
|
952
|
+
const id = Number(gift && gift.id);
|
|
953
|
+
const worth = Number(gift && gift.worth);
|
|
954
|
+
if (type !== 24 || id <= 1218) {
|
|
955
|
+
return false;
|
|
1379
956
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
c() {
|
|
1384
|
-
div2 = element("div");
|
|
1385
|
-
div0 = element("div");
|
|
1386
|
-
img = element("img");
|
|
1387
|
-
t0 = space();
|
|
1388
|
-
if (if_block0) if_block0.c();
|
|
1389
|
-
t1 = space();
|
|
1390
|
-
div1 = element("div");
|
|
1391
|
-
t2 = text(t2_value);
|
|
1392
|
-
t3 = space();
|
|
1393
|
-
if (if_block1) if_block1.c();
|
|
1394
|
-
t4 = space();
|
|
1395
|
-
if (if_block2) if_block2.c();
|
|
1396
|
-
attr(img, "class", img_class_value = "giftbar-item-pic " + /*animGuid*/
|
|
1397
|
-
(ctx[3] === /*giftItem*/
|
|
1398
|
-
ctx[7].guid ? "gift-select-animation" : ""));
|
|
1399
|
-
if (!src_url_equal(img.src, img_src_value = GIFT_IMG_PLACEHOLDER)) attr(img, "src", img_src_value);
|
|
1400
|
-
attr(img, "alt", "");
|
|
1401
|
-
attr(img, "decoding", "async");
|
|
1402
|
-
attr(img, "loading", "lazy");
|
|
1403
|
-
set_style(div0, "position", "relative");
|
|
1404
|
-
attr(div1, "class", "giftbar-item-title");
|
|
1405
|
-
attr(div2, "id", div2_id_value = /*giftItem*/
|
|
1406
|
-
ctx[7].guid);
|
|
1407
|
-
attr(div2, "class", div2_class_value = "giftbar-item " + /*selectGift*/
|
|
1408
|
-
(ctx[1] === /*giftItem*/
|
|
1409
|
-
ctx[7] ? "giftbar-item-on" : ""));
|
|
1410
|
-
attr(div2, "role", "presentation");
|
|
1411
|
-
this.first = div2;
|
|
1412
|
-
},
|
|
1413
|
-
m(target, anchor) {
|
|
1414
|
-
insert(target, div2, anchor);
|
|
1415
|
-
append(div2, div0);
|
|
1416
|
-
append(div0, img);
|
|
1417
|
-
append(div0, t0);
|
|
1418
|
-
if (if_block0) if_block0.m(div0, null);
|
|
1419
|
-
append(div2, t1);
|
|
1420
|
-
append(div2, div1);
|
|
1421
|
-
append(div1, t2);
|
|
1422
|
-
append(div2, t3);
|
|
1423
|
-
if (if_block1) if_block1.m(div2, null);
|
|
1424
|
-
append(div2, t4);
|
|
1425
|
-
if (if_block2) if_block2.m(div2, null);
|
|
1426
|
-
if (!mounted) {
|
|
1427
|
-
dispose = [
|
|
1428
|
-
action_destroyer(lazyGiftImg_action = lazyGiftImg.call(null, img, giftListThumbUrl(
|
|
1429
|
-
/*giftItem*/
|
|
1430
|
-
ctx[7].pic
|
|
1431
|
-
))),
|
|
1432
|
-
action_destroyer(giftHoverTip_action = giftHoverTip.call(
|
|
1433
|
-
null,
|
|
1434
|
-
div2,
|
|
1435
|
-
/*giftItem*/
|
|
1436
|
-
ctx[7].atitle || ""
|
|
1437
|
-
)),
|
|
1438
|
-
listen(div2, "click", stop_propagation(click_handler))
|
|
1439
|
-
];
|
|
1440
|
-
mounted = true;
|
|
1441
|
-
}
|
|
1442
|
-
},
|
|
1443
|
-
p(new_ctx, dirty) {
|
|
1444
|
-
ctx = new_ctx;
|
|
1445
|
-
if (dirty & /*animGuid, gifts*/
|
|
1446
|
-
9 && img_class_value !== (img_class_value = "giftbar-item-pic " + /*animGuid*/
|
|
1447
|
-
(ctx[3] === /*giftItem*/
|
|
1448
|
-
ctx[7].guid ? "gift-select-animation" : ""))) {
|
|
1449
|
-
attr(img, "class", img_class_value);
|
|
1450
|
-
}
|
|
1451
|
-
if (lazyGiftImg_action && is_function(lazyGiftImg_action.update) && dirty & /*gifts*/
|
|
1452
|
-
1) lazyGiftImg_action.update.call(null, giftListThumbUrl(
|
|
1453
|
-
/*giftItem*/
|
|
1454
|
-
ctx[7].pic
|
|
1455
|
-
));
|
|
1456
|
-
if (
|
|
1457
|
-
/*giftItem*/
|
|
1458
|
-
ctx[7].tag
|
|
1459
|
-
) {
|
|
1460
|
-
if (if_block0) {
|
|
1461
|
-
if_block0.p(ctx, dirty);
|
|
1462
|
-
} else {
|
|
1463
|
-
if_block0 = create_if_block_5$5(ctx);
|
|
1464
|
-
if_block0.c();
|
|
1465
|
-
if_block0.m(div0, null);
|
|
1466
|
-
}
|
|
1467
|
-
} else if (if_block0) {
|
|
1468
|
-
if_block0.d(1);
|
|
1469
|
-
if_block0 = null;
|
|
1470
|
-
}
|
|
1471
|
-
if (dirty & /*gifts*/
|
|
1472
|
-
1 && t2_value !== (t2_value = /*giftItem*/
|
|
1473
|
-
ctx[7].title + "")) set_data(t2, t2_value);
|
|
1474
|
-
if (
|
|
1475
|
-
/*giftItem*/
|
|
1476
|
-
ctx[7].unitText
|
|
1477
|
-
) {
|
|
1478
|
-
if (if_block1) {
|
|
1479
|
-
if_block1.p(ctx, dirty);
|
|
1480
|
-
} else {
|
|
1481
|
-
if_block1 = create_if_block_3$7(ctx);
|
|
1482
|
-
if_block1.c();
|
|
1483
|
-
if_block1.m(div2, t4);
|
|
1484
|
-
}
|
|
1485
|
-
} else if (if_block1) {
|
|
1486
|
-
if_block1.d(1);
|
|
1487
|
-
if_block1 = null;
|
|
1488
|
-
}
|
|
1489
|
-
if (
|
|
1490
|
-
/*giftItem*/
|
|
1491
|
-
ctx[7].unitText2
|
|
1492
|
-
) {
|
|
1493
|
-
if (if_block2) {
|
|
1494
|
-
if_block2.p(ctx, dirty);
|
|
1495
|
-
} else {
|
|
1496
|
-
if_block2 = create_if_block_2$b(ctx);
|
|
1497
|
-
if_block2.c();
|
|
1498
|
-
if_block2.m(div2, null);
|
|
1499
|
-
}
|
|
1500
|
-
} else if (if_block2) {
|
|
1501
|
-
if_block2.d(1);
|
|
1502
|
-
if_block2 = null;
|
|
1503
|
-
}
|
|
1504
|
-
if (dirty & /*gifts*/
|
|
1505
|
-
1 && div2_id_value !== (div2_id_value = /*giftItem*/
|
|
1506
|
-
ctx[7].guid)) {
|
|
1507
|
-
attr(div2, "id", div2_id_value);
|
|
1508
|
-
}
|
|
1509
|
-
if (dirty & /*selectGift, gifts*/
|
|
1510
|
-
3 && div2_class_value !== (div2_class_value = "giftbar-item " + /*selectGift*/
|
|
1511
|
-
(ctx[1] === /*giftItem*/
|
|
1512
|
-
ctx[7] ? "giftbar-item-on" : ""))) {
|
|
1513
|
-
attr(div2, "class", div2_class_value);
|
|
1514
|
-
}
|
|
1515
|
-
if (giftHoverTip_action && is_function(giftHoverTip_action.update) && dirty & /*gifts*/
|
|
1516
|
-
1) giftHoverTip_action.update.call(
|
|
1517
|
-
null,
|
|
1518
|
-
/*giftItem*/
|
|
1519
|
-
ctx[7].atitle || ""
|
|
1520
|
-
);
|
|
1521
|
-
},
|
|
1522
|
-
d(detaching) {
|
|
1523
|
-
if (detaching) {
|
|
1524
|
-
detach(div2);
|
|
1525
|
-
}
|
|
1526
|
-
if (if_block0) if_block0.d();
|
|
1527
|
-
if (if_block1) if_block1.d();
|
|
1528
|
-
if (if_block2) if_block2.d();
|
|
1529
|
-
mounted = false;
|
|
1530
|
-
run_all(dispose);
|
|
957
|
+
if (isImSource()) {
|
|
958
|
+
if (navid !== TAB_PACKAGE && navid !== TAB_CRYSTAL) {
|
|
959
|
+
return false;
|
|
1531
960
|
}
|
|
1532
|
-
|
|
1533
|
-
}
|
|
1534
|
-
function create_if_block$n(ctx) {
|
|
1535
|
-
let if_block_anchor;
|
|
1536
|
-
function select_block_type(ctx2, dirty) {
|
|
1537
|
-
if (
|
|
1538
|
-
/*emptyImg*/
|
|
1539
|
-
ctx2[2]
|
|
1540
|
-
) return create_if_block_1$k;
|
|
1541
|
-
return create_else_block$c;
|
|
961
|
+
return worth !== 3;
|
|
1542
962
|
}
|
|
1543
|
-
|
|
1544
|
-
let if_block = current_block_type(ctx);
|
|
1545
|
-
return {
|
|
1546
|
-
c() {
|
|
1547
|
-
if_block.c();
|
|
1548
|
-
if_block_anchor = empty();
|
|
1549
|
-
},
|
|
1550
|
-
m(target, anchor) {
|
|
1551
|
-
if_block.m(target, anchor);
|
|
1552
|
-
insert(target, if_block_anchor, anchor);
|
|
1553
|
-
},
|
|
1554
|
-
p(ctx2, dirty) {
|
|
1555
|
-
if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
|
|
1556
|
-
if_block.p(ctx2, dirty);
|
|
1557
|
-
} else {
|
|
1558
|
-
if_block.d(1);
|
|
1559
|
-
if_block = current_block_type(ctx2);
|
|
1560
|
-
if (if_block) {
|
|
1561
|
-
if_block.c();
|
|
1562
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
},
|
|
1566
|
-
d(detaching) {
|
|
1567
|
-
if (detaching) {
|
|
1568
|
-
detach(if_block_anchor);
|
|
1569
|
-
}
|
|
1570
|
-
if_block.d(detaching);
|
|
1571
|
-
}
|
|
1572
|
-
};
|
|
963
|
+
return navid === TAB_PACKAGE;
|
|
1573
964
|
}
|
|
1574
|
-
function
|
|
1575
|
-
|
|
1576
|
-
return {
|
|
1577
|
-
c() {
|
|
1578
|
-
div = element("div");
|
|
1579
|
-
div.textContent = "还没有礼物哦~";
|
|
1580
|
-
attr(div, "class", "giftbar-empty");
|
|
1581
|
-
},
|
|
1582
|
-
m(target, anchor) {
|
|
1583
|
-
insert(target, div, anchor);
|
|
1584
|
-
},
|
|
1585
|
-
p: noop,
|
|
1586
|
-
d(detaching) {
|
|
1587
|
-
if (detaching) {
|
|
1588
|
-
detach(div);
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
965
|
+
function canSendToSelf(gift, tabId) {
|
|
966
|
+
return Number(tabId) === TAB_PACKAGE && Number(gift && gift.type) === 7 || Number(gift && gift.id) === 383;
|
|
1592
967
|
}
|
|
1593
|
-
function
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
return
|
|
1597
|
-
c() {
|
|
1598
|
-
img = element("img");
|
|
1599
|
-
attr(img, "class", "giftbar-empty-img");
|
|
1600
|
-
if (!src_url_equal(img.src, img_src_value = /*emptyImg*/
|
|
1601
|
-
ctx[2])) attr(img, "src", img_src_value);
|
|
1602
|
-
attr(img, "alt", "");
|
|
1603
|
-
},
|
|
1604
|
-
m(target, anchor) {
|
|
1605
|
-
insert(target, img, anchor);
|
|
1606
|
-
},
|
|
1607
|
-
p(ctx2, dirty) {
|
|
1608
|
-
if (dirty & /*emptyImg*/
|
|
1609
|
-
4 && !src_url_equal(img.src, img_src_value = /*emptyImg*/
|
|
1610
|
-
ctx2[2])) {
|
|
1611
|
-
attr(img, "src", img_src_value);
|
|
1612
|
-
}
|
|
1613
|
-
},
|
|
1614
|
-
d(detaching) {
|
|
1615
|
-
if (detaching) {
|
|
1616
|
-
detach(img);
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
968
|
+
function allowEmptyWheat(gift, tabId) {
|
|
969
|
+
const type = Number(gift && gift.type);
|
|
970
|
+
const navid = Number(tabId);
|
|
971
|
+
return navid === TAB_PACKAGE && type === 7 || navid === TAB_CRYSTAL && type === 7 || navid === TAB_PACKAGE && type === 24;
|
|
1620
972
|
}
|
|
1621
|
-
function
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
let t;
|
|
1626
|
-
let each_value = ensure_array_like(
|
|
1627
|
-
/*gifts*/
|
|
1628
|
-
ctx[0]
|
|
1629
|
-
);
|
|
1630
|
-
const get_key = (ctx2) => (
|
|
1631
|
-
/*giftItem*/
|
|
1632
|
-
ctx2[7].guid || /*giftItem*/
|
|
1633
|
-
ctx2[7].id
|
|
1634
|
-
);
|
|
1635
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
1636
|
-
let child_ctx = get_each_context$9(ctx, each_value, i);
|
|
1637
|
-
let key = get_key(child_ctx);
|
|
1638
|
-
each_1_lookup.set(key, each_blocks[i] = create_each_block$9(key, child_ctx));
|
|
973
|
+
function getGiftButtonStatus(gift, tabId, isSend) {
|
|
974
|
+
const empty2 = { send: false, open: false, use: false, sendLabel: "赠送" };
|
|
975
|
+
if (!gift) {
|
|
976
|
+
return { send: true, open: false, use: false, sendLabel: "赠送" };
|
|
1639
977
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
);
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
each_blocks[i].c();
|
|
1649
|
-
}
|
|
1650
|
-
t = space();
|
|
1651
|
-
if (if_block) if_block.c();
|
|
1652
|
-
attr(div, "class", "giftbar-grid");
|
|
1653
|
-
},
|
|
1654
|
-
m(target, anchor) {
|
|
1655
|
-
insert(target, div, anchor);
|
|
1656
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1657
|
-
if (each_blocks[i]) {
|
|
1658
|
-
each_blocks[i].m(div, null);
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
append(div, t);
|
|
1662
|
-
if (if_block) if_block.m(div, null);
|
|
1663
|
-
},
|
|
1664
|
-
p(ctx2, [dirty]) {
|
|
1665
|
-
if (dirty & /*gifts, selectGift, choose, animGuid*/
|
|
1666
|
-
27) {
|
|
1667
|
-
each_value = ensure_array_like(
|
|
1668
|
-
/*gifts*/
|
|
1669
|
-
ctx2[0]
|
|
1670
|
-
);
|
|
1671
|
-
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div, destroy_block, create_each_block$9, t, get_each_context$9);
|
|
1672
|
-
}
|
|
1673
|
-
if (
|
|
1674
|
-
/*gifts*/
|
|
1675
|
-
ctx2[0].length === 0
|
|
1676
|
-
) {
|
|
1677
|
-
if (if_block) {
|
|
1678
|
-
if_block.p(ctx2, dirty);
|
|
1679
|
-
} else {
|
|
1680
|
-
if_block = create_if_block$n(ctx2);
|
|
1681
|
-
if_block.c();
|
|
1682
|
-
if_block.m(div, null);
|
|
1683
|
-
}
|
|
1684
|
-
} else if (if_block) {
|
|
1685
|
-
if_block.d(1);
|
|
1686
|
-
if_block = null;
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
i: noop,
|
|
1690
|
-
o: noop,
|
|
1691
|
-
d(detaching) {
|
|
1692
|
-
if (detaching) {
|
|
1693
|
-
detach(div);
|
|
1694
|
-
}
|
|
1695
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1696
|
-
each_blocks[i].d();
|
|
1697
|
-
}
|
|
1698
|
-
if (if_block) if_block.d();
|
|
978
|
+
const id = Number(gift.id);
|
|
979
|
+
const type = Number(gift.type);
|
|
980
|
+
const worth = Number(gift.worth);
|
|
981
|
+
const touid = Number(gift.to_uid || 0);
|
|
982
|
+
const navid = Number(tabId);
|
|
983
|
+
if (type === 29) {
|
|
984
|
+
if (isImSource()) {
|
|
985
|
+
return { ...empty2, send: true };
|
|
1699
986
|
}
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1702
|
-
function instance$r($$self, $$props, $$invalidate) {
|
|
1703
|
-
let { gifts = [] } = $$props;
|
|
1704
|
-
let { selectGift = null } = $$props;
|
|
1705
|
-
let { emptyImg = "" } = $$props;
|
|
1706
|
-
let { onClickItem } = $$props;
|
|
1707
|
-
let animGuid = "";
|
|
1708
|
-
function choose(item) {
|
|
1709
|
-
$$invalidate(3, animGuid = item.guid);
|
|
1710
|
-
onClickItem && onClickItem(item);
|
|
1711
|
-
setTimeout(
|
|
1712
|
-
() => {
|
|
1713
|
-
if (animGuid === item.guid) {
|
|
1714
|
-
$$invalidate(3, animGuid = "");
|
|
1715
|
-
}
|
|
1716
|
-
},
|
|
1717
|
-
300
|
|
1718
|
-
);
|
|
1719
|
-
}
|
|
1720
|
-
const click_handler = (giftItem) => choose(giftItem);
|
|
1721
|
-
$$self.$$set = ($$props2) => {
|
|
1722
|
-
if ("gifts" in $$props2) $$invalidate(0, gifts = $$props2.gifts);
|
|
1723
|
-
if ("selectGift" in $$props2) $$invalidate(1, selectGift = $$props2.selectGift);
|
|
1724
|
-
if ("emptyImg" in $$props2) $$invalidate(2, emptyImg = $$props2.emptyImg);
|
|
1725
|
-
if ("onClickItem" in $$props2) $$invalidate(5, onClickItem = $$props2.onClickItem);
|
|
1726
|
-
};
|
|
1727
|
-
return [gifts, selectGift, emptyImg, animGuid, choose, onClickItem, click_handler];
|
|
1728
|
-
}
|
|
1729
|
-
class GiftGrid extends SvelteComponent {
|
|
1730
|
-
constructor(options2) {
|
|
1731
|
-
super();
|
|
1732
|
-
init(this, options2, instance$r, create_fragment$r, safe_not_equal, {
|
|
1733
|
-
gifts: 0,
|
|
1734
|
-
selectGift: 1,
|
|
1735
|
-
emptyImg: 2,
|
|
1736
|
-
onClickItem: 5
|
|
1737
|
-
});
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
function assertSource(source) {
|
|
1741
|
-
if (source !== "room" && source !== "im") {
|
|
1742
|
-
throw new Error("giftBarLib source must be 'room' or 'im'");
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
function assertRoomPayContext(ctx) {
|
|
1746
|
-
if (!ctx || ctx.cid === void 0 || ctx.cid === null || ctx.cid === "") {
|
|
1747
|
-
throw new Error("source=room requires cid in getPayContext");
|
|
1748
|
-
}
|
|
1749
|
-
if (ctx.imuid !== void 0 || ctx.group_id !== void 0) {
|
|
1750
|
-
throw new Error("source=room PayContext must not include imuid/group_id");
|
|
1751
|
-
}
|
|
1752
|
-
if (String(ctx.actid) === "101") {
|
|
1753
|
-
throw new Error("source=room PayContext must not use actid=101");
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
function hasValue$3(value) {
|
|
1757
|
-
return value !== void 0 && value !== null && value !== "";
|
|
1758
|
-
}
|
|
1759
|
-
function assertImPayContext(ctx) {
|
|
1760
|
-
if (!ctx) {
|
|
1761
|
-
throw new Error("source=im requires getPayContext");
|
|
1762
|
-
}
|
|
1763
|
-
if (!hasValue$3(ctx.imuid) && !hasValue$3(ctx.group_id)) {
|
|
1764
|
-
throw new Error("source=im requires imuid or group_id in getPayContext");
|
|
1765
|
-
}
|
|
1766
|
-
if (hasValue$3(ctx.cid)) {
|
|
1767
|
-
throw new Error("source=im PayContext must not include cid");
|
|
1768
|
-
}
|
|
1769
|
-
if (ctx.is_whole_wheat !== void 0) {
|
|
1770
|
-
throw new Error("source=im PayContext must not include is_whole_wheat");
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
function getSource() {
|
|
1774
|
-
return options.source;
|
|
1775
|
-
}
|
|
1776
|
-
function isImSource() {
|
|
1777
|
-
return options.source === "im";
|
|
1778
|
-
}
|
|
1779
|
-
const TAB_PACKAGE = 3;
|
|
1780
|
-
const TAB_CRYSTAL = 7;
|
|
1781
|
-
const PACKAGE_TAB_IDS = [TAB_PACKAGE, TAB_CRYSTAL];
|
|
1782
|
-
const MAGIC_GIFT_IDS = [866, 873, 1583, 155, 156];
|
|
1783
|
-
const NO_WHOLE_WHEAT_GIFT_IDS = [37, 9, 10, 55, 1293];
|
|
1784
|
-
const CRYSTAL_IMG = "https://asset.tuwan.com/chatroom/images/icon_new_crystal.png";
|
|
1785
|
-
const ZHUANSHI_IMG = "https://res.tuwan.com/templet/play/public/images/zuanshi.png";
|
|
1786
|
-
const EMPTY_BAG_IMG = "https://asset.tuwan.com/images/chartRoomNoGift.png";
|
|
1787
|
-
const DEFAULT_MAGIC_TIP_LINK = "https://y.tuwan.com/activities/900325Cdc25ee#/";
|
|
1788
|
-
const DEFAULT_CRYSTAL_TIP_LINK = "https://y.tuwan.com/activity/340Cb43562?v=1703303588331#/";
|
|
1789
|
-
const IM_DEFAULT_MAGIC_TIP_LINK = "https://y.tuwan.com/activity/36C33a2de?v=1656553263108#/";
|
|
1790
|
-
function isPackageTab(tabId) {
|
|
1791
|
-
return PACKAGE_TAB_IDS.indexOf(Number(tabId)) > -1;
|
|
1792
|
-
}
|
|
1793
|
-
function getVipLevelUrl() {
|
|
1794
|
-
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/vip_level";
|
|
1795
|
-
}
|
|
1796
|
-
function getEmptyBagImg() {
|
|
1797
|
-
return EMPTY_BAG_IMG;
|
|
1798
|
-
}
|
|
1799
|
-
function nrTobr(desc) {
|
|
1800
|
-
if (!desc || typeof desc !== "string") {
|
|
1801
|
-
return "";
|
|
1802
|
-
}
|
|
1803
|
-
return desc.replace(/\r\n/g, "<br>").replace(/\n/g, "<br>");
|
|
1804
|
-
}
|
|
1805
|
-
function formatBoxtitle(text2) {
|
|
1806
|
-
if (!text2 || typeof text2 !== "string") {
|
|
1807
|
-
return "";
|
|
1808
|
-
}
|
|
1809
|
-
const arr = text2.split("有机会获得");
|
|
1810
|
-
if (arr.length > 1) {
|
|
1811
|
-
return '有机会获得<span style="color:#ff6691;">' + arr[1] + "</span>";
|
|
1812
|
-
}
|
|
1813
|
-
return "";
|
|
1814
|
-
}
|
|
1815
|
-
function formatMoney(money, location2) {
|
|
1816
|
-
const value = money * 1;
|
|
1817
|
-
if (isNaN(value)) {
|
|
1818
|
-
return money == null ? "" : String(money);
|
|
1819
|
-
}
|
|
1820
|
-
if (location2) {
|
|
1821
|
-
if (value >= 1e4) {
|
|
1822
|
-
return (value / 1e4).toFixed(2) + "w";
|
|
1823
|
-
}
|
|
1824
|
-
const moneyStr = value.toFixed(2) + "";
|
|
1825
|
-
if (moneyStr.indexOf(".") === 4) {
|
|
1826
|
-
return parseInt(String(value), 10);
|
|
1827
|
-
}
|
|
1828
|
-
return value.toFixed(2);
|
|
1829
|
-
}
|
|
1830
|
-
return value >= 1e4 ? (value / 1e4).toFixed(2) + "w" : parseInt(String(value), 10);
|
|
1831
|
-
}
|
|
1832
|
-
function stripHonorName(nickname) {
|
|
1833
|
-
if (!nickname || typeof nickname !== "string") {
|
|
1834
|
-
return nickname || "";
|
|
1835
|
-
}
|
|
1836
|
-
const marks = ["♕", "♚", "♔", "☬"];
|
|
1837
|
-
for (let i = 0; i < marks.length; i++) {
|
|
1838
|
-
if (nickname.indexOf(marks[i]) > -1) {
|
|
1839
|
-
const part = nickname.split(marks[i])[1] || "";
|
|
1840
|
-
return part || nickname;
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
return nickname;
|
|
1844
|
-
}
|
|
1845
|
-
function isIframeBlindBox(gift, tabId) {
|
|
1846
|
-
return Number(tabId) === TAB_CRYSTAL && Number(gift && gift.type) === 24 && Number(gift && gift.worth) === 3;
|
|
1847
|
-
}
|
|
1848
|
-
function isBlindBoxModalGift(gift, tabId) {
|
|
1849
|
-
const navid = Number(tabId);
|
|
1850
|
-
const type = Number(gift && gift.type);
|
|
1851
|
-
const id = Number(gift && gift.id);
|
|
1852
|
-
const worth = Number(gift && gift.worth);
|
|
1853
|
-
if (type !== 24 || id <= 1218) {
|
|
1854
|
-
return false;
|
|
1855
|
-
}
|
|
1856
|
-
if (isImSource()) {
|
|
1857
|
-
if (navid !== TAB_PACKAGE && navid !== TAB_CRYSTAL) {
|
|
1858
|
-
return false;
|
|
1859
|
-
}
|
|
1860
|
-
return worth !== 3;
|
|
1861
|
-
}
|
|
1862
|
-
return navid === TAB_PACKAGE;
|
|
1863
|
-
}
|
|
1864
|
-
function canSendToSelf(gift, tabId) {
|
|
1865
|
-
return Number(tabId) === TAB_PACKAGE && Number(gift && gift.type) === 7 || Number(gift && gift.id) === 383;
|
|
1866
|
-
}
|
|
1867
|
-
function allowEmptyWheat(gift, tabId) {
|
|
1868
|
-
const type = Number(gift && gift.type);
|
|
1869
|
-
const navid = Number(tabId);
|
|
1870
|
-
return navid === TAB_PACKAGE && type === 7 || navid === TAB_CRYSTAL && type === 7 || navid === TAB_PACKAGE && type === 24;
|
|
1871
|
-
}
|
|
1872
|
-
function getGiftButtonStatus(gift, tabId, isSend) {
|
|
1873
|
-
const empty2 = { send: false, open: false, use: false, sendLabel: "赠送" };
|
|
1874
|
-
if (!gift) {
|
|
1875
|
-
return { send: true, open: false, use: false, sendLabel: "赠送" };
|
|
1876
|
-
}
|
|
1877
|
-
const id = Number(gift.id);
|
|
1878
|
-
const type = Number(gift.type);
|
|
1879
|
-
const worth = Number(gift.worth);
|
|
1880
|
-
const touid = Number(gift.to_uid || 0);
|
|
1881
|
-
const navid = Number(tabId);
|
|
1882
|
-
if (type === 29) {
|
|
1883
|
-
if (isImSource()) {
|
|
1884
|
-
return { ...empty2, send: true };
|
|
1885
|
-
}
|
|
1886
|
-
return { ...empty2, use: true };
|
|
987
|
+
return { ...empty2, use: true };
|
|
1887
988
|
}
|
|
1888
989
|
if (navid === TAB_PACKAGE || navid === TAB_CRYSTAL) {
|
|
1889
990
|
if (isImSource() && type === 24 && worth === 3 && navid !== TAB_CRYSTAL) {
|
|
@@ -2113,131 +1214,1605 @@ function getSelectHostEffect(gift, tabId) {
|
|
|
2113
1214
|
if (isImSource()) {
|
|
2114
1215
|
return "";
|
|
2115
1216
|
}
|
|
2116
|
-
return "pardon";
|
|
2117
|
-
}
|
|
2118
|
-
return "";
|
|
1217
|
+
return "pardon";
|
|
1218
|
+
}
|
|
1219
|
+
return "";
|
|
1220
|
+
}
|
|
1221
|
+
function resolveFooterAction(action, gift, tabId, selectedUser) {
|
|
1222
|
+
if (!gift || !gift.id) {
|
|
1223
|
+
return { kind: "alert", message: "请选择一个礼物" };
|
|
1224
|
+
}
|
|
1225
|
+
const id = Number(gift.id);
|
|
1226
|
+
const type = Number(gift.type);
|
|
1227
|
+
const navid = Number(tabId);
|
|
1228
|
+
const touid = Number(gift.to_uid || 0);
|
|
1229
|
+
const uid = selectedUser ? Number(selectedUser.uid) : 0;
|
|
1230
|
+
if (action === "use") {
|
|
1231
|
+
if (type === 29) {
|
|
1232
|
+
if (isImSource()) {
|
|
1233
|
+
return { kind: "pay", payAction: "send" };
|
|
1234
|
+
}
|
|
1235
|
+
return { kind: "pardon" };
|
|
1236
|
+
}
|
|
1237
|
+
if (id === 389) {
|
|
1238
|
+
return { kind: "hostClick" };
|
|
1239
|
+
}
|
|
1240
|
+
if (type === 16 && touid === 0) {
|
|
1241
|
+
return { kind: "hostClick" };
|
|
1242
|
+
}
|
|
1243
|
+
return { kind: "pay", payAction: "send" };
|
|
1244
|
+
}
|
|
1245
|
+
if (action === "send") {
|
|
1246
|
+
if (Number(gift.question_gift) === 1) {
|
|
1247
|
+
return { kind: "question" };
|
|
1248
|
+
}
|
|
1249
|
+
if (type === 30 || type === 37) {
|
|
1250
|
+
return { kind: "hostUse" };
|
|
1251
|
+
}
|
|
1252
|
+
if (id === 1293 && uid === 0) {
|
|
1253
|
+
return { kind: "alert", message: "该礼物不能赠送全麦" };
|
|
1254
|
+
}
|
|
1255
|
+
return { kind: "pay", payAction: "send" };
|
|
1256
|
+
}
|
|
1257
|
+
if (isIframeBlindBox(gift, navid)) {
|
|
1258
|
+
return { kind: "iframe" };
|
|
1259
|
+
}
|
|
1260
|
+
if (isBlindBoxModalGift(gift, navid)) {
|
|
1261
|
+
return { kind: "blindBox" };
|
|
1262
|
+
}
|
|
1263
|
+
if (isMagicGift(gift, navid)) {
|
|
1264
|
+
return { kind: "magic" };
|
|
1265
|
+
}
|
|
1266
|
+
if (id === 383) {
|
|
1267
|
+
return { kind: "hostClick" };
|
|
1268
|
+
}
|
|
1269
|
+
if (id === 368 || id === 389) {
|
|
1270
|
+
return { kind: "hostClick" };
|
|
1271
|
+
}
|
|
1272
|
+
if (type === 16 && touid === 0) {
|
|
1273
|
+
return { kind: "hostClick" };
|
|
1274
|
+
}
|
|
1275
|
+
return { kind: "pay", payAction: "open" };
|
|
1276
|
+
}
|
|
1277
|
+
let guidIdx = 0;
|
|
1278
|
+
function nextGuid(navid, id, index) {
|
|
1279
|
+
if (index !== void 0 && index !== null) {
|
|
1280
|
+
return "giftbar_" + navid + "_" + id + "_" + index;
|
|
1281
|
+
}
|
|
1282
|
+
guidIdx += 1;
|
|
1283
|
+
return "giftbar_" + navid + "_" + id + "_" + guidIdx;
|
|
1284
|
+
}
|
|
1285
|
+
function transformShopGift(navid, temp, index) {
|
|
1286
|
+
const worth = Number(temp.worth);
|
|
1287
|
+
temp.picIcon = worth === 3 ? CRYSTAL_IMG : ZHUANSHI_IMG;
|
|
1288
|
+
temp.isCrystal = worth === 3;
|
|
1289
|
+
temp.unitText = temp.diamond + (worth === 3 ? "紫晶" : "钻");
|
|
1290
|
+
temp.unitText2 = "";
|
|
1291
|
+
if (temp.worth === void 0) {
|
|
1292
|
+
temp.worth = 0;
|
|
1293
|
+
}
|
|
1294
|
+
temp.atitle = temp.intro && temp.intro !== " " ? nrTobr(temp.intro) : "";
|
|
1295
|
+
temp.guid = nextGuid(navid, temp.id, index);
|
|
1296
|
+
}
|
|
1297
|
+
function transformBagGift(navid, temp, index) {
|
|
1298
|
+
const type = Number(temp.type);
|
|
1299
|
+
const worth = Number(temp.worth);
|
|
1300
|
+
const id = Number(temp.id);
|
|
1301
|
+
const num = temp.num;
|
|
1302
|
+
const price = temp.price;
|
|
1303
|
+
const priority = Number(temp.priority_display) || 0;
|
|
1304
|
+
temp.picIcon = "";
|
|
1305
|
+
temp.unitText = "";
|
|
1306
|
+
temp.unitText2 = "";
|
|
1307
|
+
temp.isCrystal = false;
|
|
1308
|
+
if (type === 24 && worth === 3) {
|
|
1309
|
+
if (priority > 0) {
|
|
1310
|
+
temp.picIcon = CRYSTAL_IMG;
|
|
1311
|
+
temp.isCrystal = true;
|
|
1312
|
+
temp.unitText = String(price / 10);
|
|
1313
|
+
} else {
|
|
1314
|
+
temp.unitText2 = "x" + num;
|
|
1315
|
+
}
|
|
1316
|
+
} else if (Number(navid) === TAB_CRYSTAL && type === 7) {
|
|
1317
|
+
temp.picIcon = CRYSTAL_IMG;
|
|
1318
|
+
temp.isCrystal = true;
|
|
1319
|
+
temp.unitText = String(price / 10);
|
|
1320
|
+
} else {
|
|
1321
|
+
let giftNum = "";
|
|
1322
|
+
if (type === 7 || Number(navid) === TAB_PACKAGE && priority > 0) {
|
|
1323
|
+
giftNum = price / 10 + "钻";
|
|
1324
|
+
} else {
|
|
1325
|
+
giftNum = "x" + num;
|
|
1326
|
+
}
|
|
1327
|
+
if (Number(navid) === TAB_PACKAGE && priority > 0) {
|
|
1328
|
+
temp.picIcon = ZHUANSHI_IMG;
|
|
1329
|
+
temp.unitText = giftNum;
|
|
1330
|
+
} else if (id === 155 || id === 156) {
|
|
1331
|
+
temp.picIcon = ZHUANSHI_IMG;
|
|
1332
|
+
temp.unitText = giftNum;
|
|
1333
|
+
} else {
|
|
1334
|
+
temp.unitText2 = giftNum;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
if (temp.worth === void 0) {
|
|
1338
|
+
temp.worth = 0;
|
|
1339
|
+
}
|
|
1340
|
+
temp.atitle = temp.intro && temp.intro !== " " ? nrTobr(temp.intro) : "";
|
|
1341
|
+
temp.guid = nextGuid(navid, temp.id, index);
|
|
1342
|
+
}
|
|
1343
|
+
function create_fragment$s(ctx) {
|
|
1344
|
+
let div1;
|
|
1345
|
+
let div0;
|
|
1346
|
+
let iframe;
|
|
1347
|
+
let iframe_src_value;
|
|
1348
|
+
let mounted;
|
|
1349
|
+
let dispose;
|
|
1350
|
+
return {
|
|
1351
|
+
c() {
|
|
1352
|
+
div1 = element("div");
|
|
1353
|
+
div0 = element("div");
|
|
1354
|
+
iframe = element("iframe");
|
|
1355
|
+
attr(iframe, "title", "blind-box");
|
|
1356
|
+
if (!src_url_equal(iframe.src, iframe_src_value = /*url*/
|
|
1357
|
+
ctx[0])) attr(iframe, "src", iframe_src_value);
|
|
1358
|
+
attr(
|
|
1359
|
+
iframe,
|
|
1360
|
+
"width",
|
|
1361
|
+
/*width*/
|
|
1362
|
+
ctx[1]
|
|
1363
|
+
);
|
|
1364
|
+
attr(
|
|
1365
|
+
iframe,
|
|
1366
|
+
"height",
|
|
1367
|
+
/*height*/
|
|
1368
|
+
ctx[2]
|
|
1369
|
+
);
|
|
1370
|
+
attr(iframe, "frameborder", "0");
|
|
1371
|
+
attr(
|
|
1372
|
+
iframe,
|
|
1373
|
+
"allow",
|
|
1374
|
+
/*iframeAllow*/
|
|
1375
|
+
ctx[5]
|
|
1376
|
+
);
|
|
1377
|
+
attr(iframe, "class", "svelte-1ma5gxj");
|
|
1378
|
+
attr(div0, "role", "presentation");
|
|
1379
|
+
attr(div0, "class", "giftbar-iframe-wrap svelte-1ma5gxj");
|
|
1380
|
+
set_style(
|
|
1381
|
+
div0,
|
|
1382
|
+
"width",
|
|
1383
|
+
/*width*/
|
|
1384
|
+
ctx[1] + "px"
|
|
1385
|
+
);
|
|
1386
|
+
set_style(
|
|
1387
|
+
div0,
|
|
1388
|
+
"height",
|
|
1389
|
+
/*height*/
|
|
1390
|
+
ctx[2] + "px"
|
|
1391
|
+
);
|
|
1392
|
+
attr(
|
|
1393
|
+
div1,
|
|
1394
|
+
"id",
|
|
1395
|
+
/*iframeId*/
|
|
1396
|
+
ctx[3]
|
|
1397
|
+
);
|
|
1398
|
+
attr(div1, "class", "giftbar-iframe-mask svelte-1ma5gxj");
|
|
1399
|
+
attr(div1, "role", "presentation");
|
|
1400
|
+
},
|
|
1401
|
+
m(target, anchor) {
|
|
1402
|
+
insert(target, div1, anchor);
|
|
1403
|
+
append(div1, div0);
|
|
1404
|
+
append(div0, iframe);
|
|
1405
|
+
ctx[11](iframe);
|
|
1406
|
+
if (!mounted) {
|
|
1407
|
+
dispose = [
|
|
1408
|
+
listen(div0, "click", stop_propagation(
|
|
1409
|
+
/*click_handler*/
|
|
1410
|
+
ctx[10]
|
|
1411
|
+
)),
|
|
1412
|
+
listen(div1, "click", stop_propagation(
|
|
1413
|
+
/*onMaskClick*/
|
|
1414
|
+
ctx[6]
|
|
1415
|
+
))
|
|
1416
|
+
];
|
|
1417
|
+
mounted = true;
|
|
1418
|
+
}
|
|
1419
|
+
},
|
|
1420
|
+
p(ctx2, [dirty]) {
|
|
1421
|
+
if (dirty & /*url*/
|
|
1422
|
+
1 && !src_url_equal(iframe.src, iframe_src_value = /*url*/
|
|
1423
|
+
ctx2[0])) {
|
|
1424
|
+
attr(iframe, "src", iframe_src_value);
|
|
1425
|
+
}
|
|
1426
|
+
if (dirty & /*width*/
|
|
1427
|
+
2) {
|
|
1428
|
+
attr(
|
|
1429
|
+
iframe,
|
|
1430
|
+
"width",
|
|
1431
|
+
/*width*/
|
|
1432
|
+
ctx2[1]
|
|
1433
|
+
);
|
|
1434
|
+
}
|
|
1435
|
+
if (dirty & /*height*/
|
|
1436
|
+
4) {
|
|
1437
|
+
attr(
|
|
1438
|
+
iframe,
|
|
1439
|
+
"height",
|
|
1440
|
+
/*height*/
|
|
1441
|
+
ctx2[2]
|
|
1442
|
+
);
|
|
1443
|
+
}
|
|
1444
|
+
if (dirty & /*iframeAllow*/
|
|
1445
|
+
32) {
|
|
1446
|
+
attr(
|
|
1447
|
+
iframe,
|
|
1448
|
+
"allow",
|
|
1449
|
+
/*iframeAllow*/
|
|
1450
|
+
ctx2[5]
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
if (dirty & /*width*/
|
|
1454
|
+
2) {
|
|
1455
|
+
set_style(
|
|
1456
|
+
div0,
|
|
1457
|
+
"width",
|
|
1458
|
+
/*width*/
|
|
1459
|
+
ctx2[1] + "px"
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
if (dirty & /*height*/
|
|
1463
|
+
4) {
|
|
1464
|
+
set_style(
|
|
1465
|
+
div0,
|
|
1466
|
+
"height",
|
|
1467
|
+
/*height*/
|
|
1468
|
+
ctx2[2] + "px"
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
if (dirty & /*iframeId*/
|
|
1472
|
+
8) {
|
|
1473
|
+
attr(
|
|
1474
|
+
div1,
|
|
1475
|
+
"id",
|
|
1476
|
+
/*iframeId*/
|
|
1477
|
+
ctx2[3]
|
|
1478
|
+
);
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
i: noop,
|
|
1482
|
+
o: noop,
|
|
1483
|
+
d(detaching) {
|
|
1484
|
+
if (detaching) {
|
|
1485
|
+
detach(div1);
|
|
1486
|
+
}
|
|
1487
|
+
ctx[11](null);
|
|
1488
|
+
mounted = false;
|
|
1489
|
+
run_all(dispose);
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
function instance$s($$self, $$props, $$invalidate) {
|
|
1494
|
+
let iframeAllow;
|
|
1495
|
+
let { closeModal } = $$props;
|
|
1496
|
+
let { url = "" } = $$props;
|
|
1497
|
+
let { width = 400 } = $$props;
|
|
1498
|
+
let { height = 585 } = $$props;
|
|
1499
|
+
let { onRefreshHaveGift = null } = $$props;
|
|
1500
|
+
let { iframeId = "" } = $$props;
|
|
1501
|
+
let { closeOnMask = false } = $$props;
|
|
1502
|
+
let frameEl;
|
|
1503
|
+
let closed = false;
|
|
1504
|
+
function onMaskClick() {
|
|
1505
|
+
if (closeOnMask) {
|
|
1506
|
+
handleClose();
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
tryCloseIframe();
|
|
1510
|
+
}
|
|
1511
|
+
function tryCloseIframe() {
|
|
1512
|
+
if (!frameEl || !frameEl.contentWindow) {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
frameEl.contentWindow.postMessage(
|
|
1516
|
+
{
|
|
1517
|
+
channel: "common_iframe",
|
|
1518
|
+
type: "tryClose",
|
|
1519
|
+
data: { iframeId }
|
|
1520
|
+
},
|
|
1521
|
+
"*"
|
|
1522
|
+
);
|
|
1523
|
+
}
|
|
1524
|
+
function handleClose() {
|
|
1525
|
+
if (closed) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
closed = true;
|
|
1529
|
+
onRefreshHaveGift && onRefreshHaveGift();
|
|
1530
|
+
closeModal && closeModal(null, true);
|
|
1531
|
+
}
|
|
1532
|
+
function onMessage(event) {
|
|
1533
|
+
const data = event.data;
|
|
1534
|
+
if (!data) {
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
if (data.closeIframe || data.channel === "common_iframe" && data.type === "closeIframe") {
|
|
1538
|
+
if (data.id && iframeId && String(data.id) !== String(iframeId)) {
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1541
|
+
handleClose();
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
if (data.channel === "common_iframe" && data.type === "refreshHaveGift") {
|
|
1545
|
+
onRefreshHaveGift && onRefreshHaveGift();
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
onMount(() => {
|
|
1549
|
+
window.addEventListener("message", onMessage);
|
|
1550
|
+
});
|
|
1551
|
+
onDestroy(() => {
|
|
1552
|
+
window.removeEventListener("message", onMessage);
|
|
1553
|
+
});
|
|
1554
|
+
function click_handler(event) {
|
|
1555
|
+
bubble.call(this, $$self, event);
|
|
1556
|
+
}
|
|
1557
|
+
function iframe_binding($$value) {
|
|
1558
|
+
binding_callbacks[$$value ? "unshift" : "push"](() => {
|
|
1559
|
+
frameEl = $$value;
|
|
1560
|
+
$$invalidate(4, frameEl);
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
$$self.$$set = ($$props2) => {
|
|
1564
|
+
if ("closeModal" in $$props2) $$invalidate(7, closeModal = $$props2.closeModal);
|
|
1565
|
+
if ("url" in $$props2) $$invalidate(0, url = $$props2.url);
|
|
1566
|
+
if ("width" in $$props2) $$invalidate(1, width = $$props2.width);
|
|
1567
|
+
if ("height" in $$props2) $$invalidate(2, height = $$props2.height);
|
|
1568
|
+
if ("onRefreshHaveGift" in $$props2) $$invalidate(8, onRefreshHaveGift = $$props2.onRefreshHaveGift);
|
|
1569
|
+
if ("iframeId" in $$props2) $$invalidate(3, iframeId = $$props2.iframeId);
|
|
1570
|
+
if ("closeOnMask" in $$props2) $$invalidate(9, closeOnMask = $$props2.closeOnMask);
|
|
1571
|
+
};
|
|
1572
|
+
$$invalidate(5, iframeAllow = options.isChatTest ? "local-network-access 'src'" : void 0);
|
|
1573
|
+
return [
|
|
1574
|
+
url,
|
|
1575
|
+
width,
|
|
1576
|
+
height,
|
|
1577
|
+
iframeId,
|
|
1578
|
+
frameEl,
|
|
1579
|
+
iframeAllow,
|
|
1580
|
+
onMaskClick,
|
|
1581
|
+
closeModal,
|
|
1582
|
+
onRefreshHaveGift,
|
|
1583
|
+
closeOnMask,
|
|
1584
|
+
click_handler,
|
|
1585
|
+
iframe_binding
|
|
1586
|
+
];
|
|
1587
|
+
}
|
|
1588
|
+
class IframeModal extends SvelteComponent {
|
|
1589
|
+
constructor(options2) {
|
|
1590
|
+
super();
|
|
1591
|
+
init(this, options2, instance$s, create_fragment$s, safe_not_equal, {
|
|
1592
|
+
closeModal: 7,
|
|
1593
|
+
url: 0,
|
|
1594
|
+
width: 1,
|
|
1595
|
+
height: 2,
|
|
1596
|
+
onRefreshHaveGift: 8,
|
|
1597
|
+
iframeId: 3,
|
|
1598
|
+
closeOnMask: 9
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
function showExplainIframe(url) {
|
|
1603
|
+
if (!url) {
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
const iframeId = "iframe_" + Date.now();
|
|
1607
|
+
const joined = url + (url.indexOf("?") >= 0 ? "&" : "?") + "eleId=" + encodeURIComponent(iframeId);
|
|
1608
|
+
return createModal(
|
|
1609
|
+
IframeModal,
|
|
1610
|
+
{
|
|
1611
|
+
url: joined,
|
|
1612
|
+
iframeId,
|
|
1613
|
+
width: 375,
|
|
1614
|
+
height: 700,
|
|
1615
|
+
closeOnMask: true
|
|
1616
|
+
},
|
|
1617
|
+
document.body
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
function showNobilityIframe() {
|
|
1621
|
+
return showExplainIframe(getNobilityUrl());
|
|
1622
|
+
}
|
|
1623
|
+
function showIframeBlindBox({ cid, giftId, navid, onRefreshHaveGift }) {
|
|
1624
|
+
const iframeId = "iframe_" + Date.now();
|
|
1625
|
+
const base = getCrystalBlindBoxUrl(cid, giftId, navid);
|
|
1626
|
+
const url = base + (base.indexOf("?") >= 0 ? "&" : "?") + "eleId=" + encodeURIComponent(iframeId);
|
|
1627
|
+
return createModal(
|
|
1628
|
+
IframeModal,
|
|
1629
|
+
{
|
|
1630
|
+
url,
|
|
1631
|
+
iframeId,
|
|
1632
|
+
width: 400,
|
|
1633
|
+
height: 585,
|
|
1634
|
+
onRefreshHaveGift
|
|
1635
|
+
},
|
|
1636
|
+
document.body
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1639
|
+
function get_each_context$a(ctx, list, i) {
|
|
1640
|
+
const child_ctx = ctx.slice();
|
|
1641
|
+
child_ctx[8] = list[i];
|
|
1642
|
+
return child_ctx;
|
|
1643
|
+
}
|
|
1644
|
+
function create_if_block_3$8(ctx) {
|
|
1645
|
+
let b;
|
|
1646
|
+
return {
|
|
1647
|
+
c() {
|
|
1648
|
+
b = element("b");
|
|
1649
|
+
attr(b, "class", "giftbar-tab-dot");
|
|
1650
|
+
},
|
|
1651
|
+
m(target, anchor) {
|
|
1652
|
+
insert(target, b, anchor);
|
|
1653
|
+
},
|
|
1654
|
+
d(detaching) {
|
|
1655
|
+
if (detaching) {
|
|
1656
|
+
detach(b);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
function create_each_block$a(key_1, ctx) {
|
|
1662
|
+
let div;
|
|
1663
|
+
let span;
|
|
1664
|
+
let t0_value = (
|
|
1665
|
+
/*item*/
|
|
1666
|
+
ctx[8].title + ""
|
|
1667
|
+
);
|
|
1668
|
+
let t0;
|
|
1669
|
+
let t1;
|
|
1670
|
+
let t2;
|
|
1671
|
+
let div_class_value;
|
|
1672
|
+
let mounted;
|
|
1673
|
+
let dispose;
|
|
1674
|
+
let if_block = (
|
|
1675
|
+
/*item*/
|
|
1676
|
+
ctx[8].is_new == 1 && create_if_block_3$8()
|
|
1677
|
+
);
|
|
1678
|
+
function click_handler() {
|
|
1679
|
+
return (
|
|
1680
|
+
/*click_handler*/
|
|
1681
|
+
ctx[7](
|
|
1682
|
+
/*item*/
|
|
1683
|
+
ctx[8]
|
|
1684
|
+
)
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
return {
|
|
1688
|
+
key: key_1,
|
|
1689
|
+
first: null,
|
|
1690
|
+
c() {
|
|
1691
|
+
div = element("div");
|
|
1692
|
+
span = element("span");
|
|
1693
|
+
t0 = text(t0_value);
|
|
1694
|
+
t1 = space();
|
|
1695
|
+
if (if_block) if_block.c();
|
|
1696
|
+
t2 = space();
|
|
1697
|
+
attr(div, "class", div_class_value = "giftbar-tab " + /*item*/
|
|
1698
|
+
(ctx[8].id == /*tabId*/
|
|
1699
|
+
ctx[1] ? "giftbar-tab-on" : ""));
|
|
1700
|
+
attr(div, "role", "presentation");
|
|
1701
|
+
this.first = div;
|
|
1702
|
+
},
|
|
1703
|
+
m(target, anchor) {
|
|
1704
|
+
insert(target, div, anchor);
|
|
1705
|
+
append(div, span);
|
|
1706
|
+
append(span, t0);
|
|
1707
|
+
append(div, t1);
|
|
1708
|
+
if (if_block) if_block.m(div, null);
|
|
1709
|
+
append(div, t2);
|
|
1710
|
+
if (!mounted) {
|
|
1711
|
+
dispose = listen(div, "click", stop_propagation(click_handler));
|
|
1712
|
+
mounted = true;
|
|
1713
|
+
}
|
|
1714
|
+
},
|
|
1715
|
+
p(new_ctx, dirty) {
|
|
1716
|
+
ctx = new_ctx;
|
|
1717
|
+
if (dirty & /*tabs*/
|
|
1718
|
+
1 && t0_value !== (t0_value = /*item*/
|
|
1719
|
+
ctx[8].title + "")) set_data(t0, t0_value);
|
|
1720
|
+
if (
|
|
1721
|
+
/*item*/
|
|
1722
|
+
ctx[8].is_new == 1
|
|
1723
|
+
) {
|
|
1724
|
+
if (if_block) ;
|
|
1725
|
+
else {
|
|
1726
|
+
if_block = create_if_block_3$8();
|
|
1727
|
+
if_block.c();
|
|
1728
|
+
if_block.m(div, t2);
|
|
1729
|
+
}
|
|
1730
|
+
} else if (if_block) {
|
|
1731
|
+
if_block.d(1);
|
|
1732
|
+
if_block = null;
|
|
1733
|
+
}
|
|
1734
|
+
if (dirty & /*tabs, tabId*/
|
|
1735
|
+
3 && div_class_value !== (div_class_value = "giftbar-tab " + /*item*/
|
|
1736
|
+
(ctx[8].id == /*tabId*/
|
|
1737
|
+
ctx[1] ? "giftbar-tab-on" : ""))) {
|
|
1738
|
+
attr(div, "class", div_class_value);
|
|
1739
|
+
}
|
|
1740
|
+
},
|
|
1741
|
+
d(detaching) {
|
|
1742
|
+
if (detaching) {
|
|
1743
|
+
detach(div);
|
|
1744
|
+
}
|
|
1745
|
+
if (if_block) if_block.d();
|
|
1746
|
+
mounted = false;
|
|
1747
|
+
dispose();
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
function create_if_block_1$l(ctx) {
|
|
1752
|
+
let a;
|
|
1753
|
+
let t0;
|
|
1754
|
+
let t1_value = (
|
|
1755
|
+
/*tip*/
|
|
1756
|
+
ctx[2].text + ""
|
|
1757
|
+
);
|
|
1758
|
+
let t1;
|
|
1759
|
+
let a_href_value;
|
|
1760
|
+
let if_block = (
|
|
1761
|
+
/*tip*/
|
|
1762
|
+
ctx[2].img && create_if_block_2$c(ctx)
|
|
1763
|
+
);
|
|
1764
|
+
return {
|
|
1765
|
+
c() {
|
|
1766
|
+
a = element("a");
|
|
1767
|
+
if (if_block) if_block.c();
|
|
1768
|
+
t0 = space();
|
|
1769
|
+
t1 = text(t1_value);
|
|
1770
|
+
attr(a, "href", a_href_value = /*tip*/
|
|
1771
|
+
ctx[2].link);
|
|
1772
|
+
attr(a, "target", "_blank");
|
|
1773
|
+
attr(a, "rel", "noopener noreferrer");
|
|
1774
|
+
},
|
|
1775
|
+
m(target, anchor) {
|
|
1776
|
+
insert(target, a, anchor);
|
|
1777
|
+
if (if_block) if_block.m(a, null);
|
|
1778
|
+
append(a, t0);
|
|
1779
|
+
append(a, t1);
|
|
1780
|
+
},
|
|
1781
|
+
p(ctx2, dirty) {
|
|
1782
|
+
if (
|
|
1783
|
+
/*tip*/
|
|
1784
|
+
ctx2[2].img
|
|
1785
|
+
) {
|
|
1786
|
+
if (if_block) {
|
|
1787
|
+
if_block.p(ctx2, dirty);
|
|
1788
|
+
} else {
|
|
1789
|
+
if_block = create_if_block_2$c(ctx2);
|
|
1790
|
+
if_block.c();
|
|
1791
|
+
if_block.m(a, t0);
|
|
1792
|
+
}
|
|
1793
|
+
} else if (if_block) {
|
|
1794
|
+
if_block.d(1);
|
|
1795
|
+
if_block = null;
|
|
1796
|
+
}
|
|
1797
|
+
if (dirty & /*tip*/
|
|
1798
|
+
4 && t1_value !== (t1_value = /*tip*/
|
|
1799
|
+
ctx2[2].text + "")) set_data(t1, t1_value);
|
|
1800
|
+
if (dirty & /*tip*/
|
|
1801
|
+
4 && a_href_value !== (a_href_value = /*tip*/
|
|
1802
|
+
ctx2[2].link)) {
|
|
1803
|
+
attr(a, "href", a_href_value);
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
|
+
d(detaching) {
|
|
1807
|
+
if (detaching) {
|
|
1808
|
+
detach(a);
|
|
1809
|
+
}
|
|
1810
|
+
if (if_block) if_block.d();
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
function create_if_block_2$c(ctx) {
|
|
1815
|
+
let img;
|
|
1816
|
+
let img_src_value;
|
|
1817
|
+
return {
|
|
1818
|
+
c() {
|
|
1819
|
+
img = element("img");
|
|
1820
|
+
if (!src_url_equal(img.src, img_src_value = /*tip*/
|
|
1821
|
+
ctx[2].img)) attr(img, "src", img_src_value);
|
|
1822
|
+
attr(img, "alt", "");
|
|
1823
|
+
},
|
|
1824
|
+
m(target, anchor) {
|
|
1825
|
+
insert(target, img, anchor);
|
|
1826
|
+
},
|
|
1827
|
+
p(ctx2, dirty) {
|
|
1828
|
+
if (dirty & /*tip*/
|
|
1829
|
+
4 && !src_url_equal(img.src, img_src_value = /*tip*/
|
|
1830
|
+
ctx2[2].img)) {
|
|
1831
|
+
attr(img, "src", img_src_value);
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
d(detaching) {
|
|
1835
|
+
if (detaching) {
|
|
1836
|
+
detach(img);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
function create_if_block$o(ctx) {
|
|
1842
|
+
let div;
|
|
1843
|
+
let mounted;
|
|
1844
|
+
let dispose;
|
|
1845
|
+
return {
|
|
1846
|
+
c() {
|
|
1847
|
+
div = element("div");
|
|
1848
|
+
div.innerHTML = `<img src="https://asset.tuwan.com/officialsite/images/king.png" alt=""/> <span>贵族</span>`;
|
|
1849
|
+
attr(div, "class", "giftbar-nobility");
|
|
1850
|
+
attr(div, "role", "presentation");
|
|
1851
|
+
},
|
|
1852
|
+
m(target, anchor) {
|
|
1853
|
+
insert(target, div, anchor);
|
|
1854
|
+
if (!mounted) {
|
|
1855
|
+
dispose = listen(div, "click", stop_propagation(
|
|
1856
|
+
/*openNobility*/
|
|
1857
|
+
ctx[5]
|
|
1858
|
+
));
|
|
1859
|
+
mounted = true;
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
p: noop,
|
|
1863
|
+
d(detaching) {
|
|
1864
|
+
if (detaching) {
|
|
1865
|
+
detach(div);
|
|
1866
|
+
}
|
|
1867
|
+
mounted = false;
|
|
1868
|
+
dispose();
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
function create_fragment$r(ctx) {
|
|
1873
|
+
let div2;
|
|
1874
|
+
let div0;
|
|
1875
|
+
let each_blocks = [];
|
|
1876
|
+
let each_1_lookup = /* @__PURE__ */ new Map();
|
|
1877
|
+
let t0;
|
|
1878
|
+
let div1;
|
|
1879
|
+
let t1;
|
|
1880
|
+
let each_value = ensure_array_like(
|
|
1881
|
+
/*tabs*/
|
|
1882
|
+
ctx[0]
|
|
1883
|
+
);
|
|
1884
|
+
const get_key = (ctx2) => (
|
|
1885
|
+
/*item*/
|
|
1886
|
+
ctx2[8].id
|
|
1887
|
+
);
|
|
1888
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
1889
|
+
let child_ctx = get_each_context$a(ctx, each_value, i);
|
|
1890
|
+
let key = get_key(child_ctx);
|
|
1891
|
+
each_1_lookup.set(key, each_blocks[i] = create_each_block$a(key, child_ctx));
|
|
1892
|
+
}
|
|
1893
|
+
let if_block0 = (
|
|
1894
|
+
/*tip*/
|
|
1895
|
+
ctx[2] && /*tip*/
|
|
1896
|
+
ctx[2].text && /*tip*/
|
|
1897
|
+
ctx[2].link && /*tip*/
|
|
1898
|
+
ctx[2].kind !== "hidden" && create_if_block_1$l(ctx)
|
|
1899
|
+
);
|
|
1900
|
+
let if_block1 = (
|
|
1901
|
+
/*showNobility*/
|
|
1902
|
+
ctx[3] && create_if_block$o(ctx)
|
|
1903
|
+
);
|
|
1904
|
+
return {
|
|
1905
|
+
c() {
|
|
1906
|
+
div2 = element("div");
|
|
1907
|
+
div0 = element("div");
|
|
1908
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1909
|
+
each_blocks[i].c();
|
|
1910
|
+
}
|
|
1911
|
+
t0 = space();
|
|
1912
|
+
div1 = element("div");
|
|
1913
|
+
if (if_block0) if_block0.c();
|
|
1914
|
+
t1 = space();
|
|
1915
|
+
if (if_block1) if_block1.c();
|
|
1916
|
+
attr(div0, "class", "giftbar-tabs");
|
|
1917
|
+
attr(div1, "class", "giftbar-tip");
|
|
1918
|
+
attr(div2, "class", "giftbar-head");
|
|
1919
|
+
},
|
|
1920
|
+
m(target, anchor) {
|
|
1921
|
+
insert(target, div2, anchor);
|
|
1922
|
+
append(div2, div0);
|
|
1923
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1924
|
+
if (each_blocks[i]) {
|
|
1925
|
+
each_blocks[i].m(div0, null);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
append(div2, t0);
|
|
1929
|
+
append(div2, div1);
|
|
1930
|
+
if (if_block0) if_block0.m(div1, null);
|
|
1931
|
+
append(div1, t1);
|
|
1932
|
+
if (if_block1) if_block1.m(div1, null);
|
|
1933
|
+
},
|
|
1934
|
+
p(ctx2, [dirty]) {
|
|
1935
|
+
if (dirty & /*tabs, tabId, switchTab*/
|
|
1936
|
+
19) {
|
|
1937
|
+
each_value = ensure_array_like(
|
|
1938
|
+
/*tabs*/
|
|
1939
|
+
ctx2[0]
|
|
1940
|
+
);
|
|
1941
|
+
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div0, destroy_block, create_each_block$a, null, get_each_context$a);
|
|
1942
|
+
}
|
|
1943
|
+
if (
|
|
1944
|
+
/*tip*/
|
|
1945
|
+
ctx2[2] && /*tip*/
|
|
1946
|
+
ctx2[2].text && /*tip*/
|
|
1947
|
+
ctx2[2].link && /*tip*/
|
|
1948
|
+
ctx2[2].kind !== "hidden"
|
|
1949
|
+
) {
|
|
1950
|
+
if (if_block0) {
|
|
1951
|
+
if_block0.p(ctx2, dirty);
|
|
1952
|
+
} else {
|
|
1953
|
+
if_block0 = create_if_block_1$l(ctx2);
|
|
1954
|
+
if_block0.c();
|
|
1955
|
+
if_block0.m(div1, t1);
|
|
1956
|
+
}
|
|
1957
|
+
} else if (if_block0) {
|
|
1958
|
+
if_block0.d(1);
|
|
1959
|
+
if_block0 = null;
|
|
1960
|
+
}
|
|
1961
|
+
if (
|
|
1962
|
+
/*showNobility*/
|
|
1963
|
+
ctx2[3]
|
|
1964
|
+
) {
|
|
1965
|
+
if (if_block1) {
|
|
1966
|
+
if_block1.p(ctx2, dirty);
|
|
1967
|
+
} else {
|
|
1968
|
+
if_block1 = create_if_block$o(ctx2);
|
|
1969
|
+
if_block1.c();
|
|
1970
|
+
if_block1.m(div1, null);
|
|
1971
|
+
}
|
|
1972
|
+
} else if (if_block1) {
|
|
1973
|
+
if_block1.d(1);
|
|
1974
|
+
if_block1 = null;
|
|
1975
|
+
}
|
|
1976
|
+
},
|
|
1977
|
+
i: noop,
|
|
1978
|
+
o: noop,
|
|
1979
|
+
d(detaching) {
|
|
1980
|
+
if (detaching) {
|
|
1981
|
+
detach(div2);
|
|
1982
|
+
}
|
|
1983
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1984
|
+
each_blocks[i].d();
|
|
1985
|
+
}
|
|
1986
|
+
if (if_block0) if_block0.d();
|
|
1987
|
+
if (if_block1) if_block1.d();
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
function instance$r($$self, $$props, $$invalidate) {
|
|
1992
|
+
let { tabs = [] } = $$props;
|
|
1993
|
+
let { tabId = 0 } = $$props;
|
|
1994
|
+
let { tip = {
|
|
1995
|
+
kind: "magic",
|
|
1996
|
+
text: "",
|
|
1997
|
+
link: "",
|
|
1998
|
+
img: ""
|
|
1999
|
+
} } = $$props;
|
|
2000
|
+
let { showNobility = true } = $$props;
|
|
2001
|
+
let { onClickTab } = $$props;
|
|
2002
|
+
function switchTab(item) {
|
|
2003
|
+
onClickTab && onClickTab(item);
|
|
2004
|
+
}
|
|
2005
|
+
function openNobility(event) {
|
|
2006
|
+
event && event.stopPropagation && event.stopPropagation();
|
|
2007
|
+
showNobilityIframe();
|
|
2008
|
+
}
|
|
2009
|
+
const click_handler = (item) => switchTab(item);
|
|
2010
|
+
$$self.$$set = ($$props2) => {
|
|
2011
|
+
if ("tabs" in $$props2) $$invalidate(0, tabs = $$props2.tabs);
|
|
2012
|
+
if ("tabId" in $$props2) $$invalidate(1, tabId = $$props2.tabId);
|
|
2013
|
+
if ("tip" in $$props2) $$invalidate(2, tip = $$props2.tip);
|
|
2014
|
+
if ("showNobility" in $$props2) $$invalidate(3, showNobility = $$props2.showNobility);
|
|
2015
|
+
if ("onClickTab" in $$props2) $$invalidate(6, onClickTab = $$props2.onClickTab);
|
|
2016
|
+
};
|
|
2017
|
+
return [
|
|
2018
|
+
tabs,
|
|
2019
|
+
tabId,
|
|
2020
|
+
tip,
|
|
2021
|
+
showNobility,
|
|
2022
|
+
switchTab,
|
|
2023
|
+
openNobility,
|
|
2024
|
+
onClickTab,
|
|
2025
|
+
click_handler
|
|
2026
|
+
];
|
|
2027
|
+
}
|
|
2028
|
+
class GiftTabs extends SvelteComponent {
|
|
2029
|
+
constructor(options2) {
|
|
2030
|
+
super();
|
|
2031
|
+
init(this, options2, instance$r, create_fragment$r, safe_not_equal, {
|
|
2032
|
+
tabs: 0,
|
|
2033
|
+
tabId: 1,
|
|
2034
|
+
tip: 2,
|
|
2035
|
+
showNobility: 3,
|
|
2036
|
+
onClickTab: 6
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
function giftHoverTip(node, html) {
|
|
2041
|
+
let tip = null;
|
|
2042
|
+
let currentHtml = html || "";
|
|
2043
|
+
function hide() {
|
|
2044
|
+
if (tip) {
|
|
2045
|
+
tip.remove();
|
|
2046
|
+
tip = null;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
function show() {
|
|
2050
|
+
hide();
|
|
2051
|
+
if (!currentHtml) {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
tip = document.createElement("div");
|
|
2055
|
+
tip.className = "giftbar-item-tooltip";
|
|
2056
|
+
tip.innerHTML = '<div class="giftbar-item-tooltip-inner">' + currentHtml + '</div><div class="giftbar-item-tooltip-arrow"></div>';
|
|
2057
|
+
document.body.appendChild(tip);
|
|
2058
|
+
const rect = node.getBoundingClientRect();
|
|
2059
|
+
tip.style.left = rect.left + rect.width / 2 + "px";
|
|
2060
|
+
tip.style.top = rect.top + "px";
|
|
2061
|
+
}
|
|
2062
|
+
node.addEventListener("mouseenter", show);
|
|
2063
|
+
node.addEventListener("mouseleave", hide);
|
|
2064
|
+
window.addEventListener("scroll", hide, true);
|
|
2065
|
+
return {
|
|
2066
|
+
update(nextHtml) {
|
|
2067
|
+
currentHtml = nextHtml || "";
|
|
2068
|
+
if (tip) {
|
|
2069
|
+
if (!currentHtml) {
|
|
2070
|
+
hide();
|
|
2071
|
+
} else {
|
|
2072
|
+
show();
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
},
|
|
2076
|
+
destroy() {
|
|
2077
|
+
hide();
|
|
2078
|
+
node.removeEventListener("mouseenter", show);
|
|
2079
|
+
node.removeEventListener("mouseleave", hide);
|
|
2080
|
+
window.removeEventListener("scroll", hide, true);
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
const OSS_HOST_RE = /(^|\.)tuwandata\.com$|(^|\.)img\d*\.tuwan\.com$/i;
|
|
2085
|
+
const PROCESS = "image/resize,m_fill,w_128,h_128/format,webp";
|
|
2086
|
+
function giftListThumbUrl(src) {
|
|
2087
|
+
if (!src || typeof src !== "string") {
|
|
2088
|
+
return src || "";
|
|
2089
|
+
}
|
|
2090
|
+
if (/^(data:|blob:)/i.test(src)) {
|
|
2091
|
+
return src;
|
|
2092
|
+
}
|
|
2093
|
+
if (/[?&]x-oss-process=/i.test(src)) {
|
|
2094
|
+
return src;
|
|
2095
|
+
}
|
|
2096
|
+
try {
|
|
2097
|
+
const url = new URL(src, typeof location !== "undefined" ? location.href : "https://www.tuwan.com");
|
|
2098
|
+
if (!OSS_HOST_RE.test(url.hostname)) {
|
|
2099
|
+
return src;
|
|
2100
|
+
}
|
|
2101
|
+
url.searchParams.set("x-oss-process", PROCESS);
|
|
2102
|
+
return url.toString();
|
|
2103
|
+
} catch (e) {
|
|
2104
|
+
return src;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
const PRELOAD_MARGIN = "240px 0px";
|
|
2108
|
+
const GIFT_IMG_PLACEHOLDER = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
2109
|
+
function findGridRoot(node) {
|
|
2110
|
+
return node.closest ? node.closest(".giftbar-grid") : null;
|
|
2111
|
+
}
|
|
2112
|
+
function setSrc(node, src) {
|
|
2113
|
+
if (node.getAttribute("src") === src) {
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
node.setAttribute("src", src);
|
|
2117
|
+
}
|
|
2118
|
+
function lazyGiftImg(node, src) {
|
|
2119
|
+
let currentSrc = src || "";
|
|
2120
|
+
let observer = null;
|
|
2121
|
+
function clearObserver() {
|
|
2122
|
+
if (observer) {
|
|
2123
|
+
observer.disconnect();
|
|
2124
|
+
observer = null;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
function applySrc() {
|
|
2128
|
+
setSrc(node, currentSrc || GIFT_IMG_PLACEHOLDER);
|
|
2129
|
+
}
|
|
2130
|
+
function observe() {
|
|
2131
|
+
clearObserver();
|
|
2132
|
+
setSrc(node, GIFT_IMG_PLACEHOLDER);
|
|
2133
|
+
if (!currentSrc) {
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2136
|
+
if (typeof IntersectionObserver !== "function") {
|
|
2137
|
+
applySrc();
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const root = findGridRoot(node);
|
|
2141
|
+
observer = new IntersectionObserver(
|
|
2142
|
+
(entries) => {
|
|
2143
|
+
const hit = entries.some((item) => item.isIntersecting);
|
|
2144
|
+
if (!hit) {
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
applySrc();
|
|
2148
|
+
clearObserver();
|
|
2149
|
+
},
|
|
2150
|
+
{ root: root || null, rootMargin: PRELOAD_MARGIN, threshold: 0.01 }
|
|
2151
|
+
);
|
|
2152
|
+
observer.observe(node);
|
|
2153
|
+
}
|
|
2154
|
+
observe();
|
|
2155
|
+
return {
|
|
2156
|
+
update(nextSrc) {
|
|
2157
|
+
const next = nextSrc || "";
|
|
2158
|
+
if (next === currentSrc) {
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
currentSrc = next;
|
|
2162
|
+
observe();
|
|
2163
|
+
},
|
|
2164
|
+
destroy() {
|
|
2165
|
+
clearObserver();
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
function get_each_context$9(ctx, list, i) {
|
|
2170
|
+
const child_ctx = ctx.slice();
|
|
2171
|
+
child_ctx[10] = list[i];
|
|
2172
|
+
return child_ctx;
|
|
2173
|
+
}
|
|
2174
|
+
function create_if_block_6$4(ctx) {
|
|
2175
|
+
let span;
|
|
2176
|
+
let t_value = (
|
|
2177
|
+
/*giftItem*/
|
|
2178
|
+
ctx[10].tag + ""
|
|
2179
|
+
);
|
|
2180
|
+
let t;
|
|
2181
|
+
return {
|
|
2182
|
+
c() {
|
|
2183
|
+
span = element("span");
|
|
2184
|
+
t = text(t_value);
|
|
2185
|
+
attr(span, "class", "giftbar-item-tag");
|
|
2186
|
+
},
|
|
2187
|
+
m(target, anchor) {
|
|
2188
|
+
insert(target, span, anchor);
|
|
2189
|
+
append(span, t);
|
|
2190
|
+
},
|
|
2191
|
+
p(ctx2, dirty) {
|
|
2192
|
+
if (dirty & /*gifts*/
|
|
2193
|
+
1 && t_value !== (t_value = /*giftItem*/
|
|
2194
|
+
ctx2[10].tag + "")) set_data(t, t_value);
|
|
2195
|
+
},
|
|
2196
|
+
d(detaching) {
|
|
2197
|
+
if (detaching) {
|
|
2198
|
+
detach(span);
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
function create_if_block_4$6(ctx) {
|
|
2204
|
+
let div;
|
|
2205
|
+
let t0;
|
|
2206
|
+
let t1_value = (
|
|
2207
|
+
/*giftItem*/
|
|
2208
|
+
ctx[10].unitText + ""
|
|
2209
|
+
);
|
|
2210
|
+
let t1;
|
|
2211
|
+
let if_block = (
|
|
2212
|
+
/*giftItem*/
|
|
2213
|
+
ctx[10].picIcon && create_if_block_5$5(ctx)
|
|
2214
|
+
);
|
|
2215
|
+
return {
|
|
2216
|
+
c() {
|
|
2217
|
+
div = element("div");
|
|
2218
|
+
if (if_block) if_block.c();
|
|
2219
|
+
t0 = space();
|
|
2220
|
+
t1 = text(t1_value);
|
|
2221
|
+
attr(div, "class", "giftbar-item-unit");
|
|
2222
|
+
},
|
|
2223
|
+
m(target, anchor) {
|
|
2224
|
+
insert(target, div, anchor);
|
|
2225
|
+
if (if_block) if_block.m(div, null);
|
|
2226
|
+
append(div, t0);
|
|
2227
|
+
append(div, t1);
|
|
2228
|
+
},
|
|
2229
|
+
p(ctx2, dirty) {
|
|
2230
|
+
if (
|
|
2231
|
+
/*giftItem*/
|
|
2232
|
+
ctx2[10].picIcon
|
|
2233
|
+
) {
|
|
2234
|
+
if (if_block) {
|
|
2235
|
+
if_block.p(ctx2, dirty);
|
|
2236
|
+
} else {
|
|
2237
|
+
if_block = create_if_block_5$5(ctx2);
|
|
2238
|
+
if_block.c();
|
|
2239
|
+
if_block.m(div, t0);
|
|
2240
|
+
}
|
|
2241
|
+
} else if (if_block) {
|
|
2242
|
+
if_block.d(1);
|
|
2243
|
+
if_block = null;
|
|
2244
|
+
}
|
|
2245
|
+
if (dirty & /*gifts*/
|
|
2246
|
+
1 && t1_value !== (t1_value = /*giftItem*/
|
|
2247
|
+
ctx2[10].unitText + "")) set_data(t1, t1_value);
|
|
2248
|
+
},
|
|
2249
|
+
d(detaching) {
|
|
2250
|
+
if (detaching) {
|
|
2251
|
+
detach(div);
|
|
2252
|
+
}
|
|
2253
|
+
if (if_block) if_block.d();
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
}
|
|
2257
|
+
function create_if_block_5$5(ctx) {
|
|
2258
|
+
let img;
|
|
2259
|
+
let img_class_value;
|
|
2260
|
+
let img_src_value;
|
|
2261
|
+
return {
|
|
2262
|
+
c() {
|
|
2263
|
+
img = element("img");
|
|
2264
|
+
attr(img, "class", img_class_value = /*giftItem*/
|
|
2265
|
+
ctx[10].isCrystal ? "is-crystal" : "");
|
|
2266
|
+
if (!src_url_equal(img.src, img_src_value = /*giftItem*/
|
|
2267
|
+
ctx[10].picIcon)) attr(img, "src", img_src_value);
|
|
2268
|
+
attr(img, "alt", "");
|
|
2269
|
+
},
|
|
2270
|
+
m(target, anchor) {
|
|
2271
|
+
insert(target, img, anchor);
|
|
2272
|
+
},
|
|
2273
|
+
p(ctx2, dirty) {
|
|
2274
|
+
if (dirty & /*gifts*/
|
|
2275
|
+
1 && img_class_value !== (img_class_value = /*giftItem*/
|
|
2276
|
+
ctx2[10].isCrystal ? "is-crystal" : "")) {
|
|
2277
|
+
attr(img, "class", img_class_value);
|
|
2278
|
+
}
|
|
2279
|
+
if (dirty & /*gifts*/
|
|
2280
|
+
1 && !src_url_equal(img.src, img_src_value = /*giftItem*/
|
|
2281
|
+
ctx2[10].picIcon)) {
|
|
2282
|
+
attr(img, "src", img_src_value);
|
|
2283
|
+
}
|
|
2284
|
+
},
|
|
2285
|
+
d(detaching) {
|
|
2286
|
+
if (detaching) {
|
|
2287
|
+
detach(img);
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
function create_if_block_3$7(ctx) {
|
|
2293
|
+
let div;
|
|
2294
|
+
let t_value = (
|
|
2295
|
+
/*giftItem*/
|
|
2296
|
+
ctx[10].unitText2 + ""
|
|
2297
|
+
);
|
|
2298
|
+
let t;
|
|
2299
|
+
return {
|
|
2300
|
+
c() {
|
|
2301
|
+
div = element("div");
|
|
2302
|
+
t = text(t_value);
|
|
2303
|
+
attr(div, "class", "giftbar-item-unit");
|
|
2304
|
+
},
|
|
2305
|
+
m(target, anchor) {
|
|
2306
|
+
insert(target, div, anchor);
|
|
2307
|
+
append(div, t);
|
|
2308
|
+
},
|
|
2309
|
+
p(ctx2, dirty) {
|
|
2310
|
+
if (dirty & /*gifts*/
|
|
2311
|
+
1 && t_value !== (t_value = /*giftItem*/
|
|
2312
|
+
ctx2[10].unitText2 + "")) set_data(t, t_value);
|
|
2313
|
+
},
|
|
2314
|
+
d(detaching) {
|
|
2315
|
+
if (detaching) {
|
|
2316
|
+
detach(div);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
function create_if_block_2$b(ctx) {
|
|
2322
|
+
let div;
|
|
2323
|
+
let mounted;
|
|
2324
|
+
let dispose;
|
|
2325
|
+
function click_handler(...args) {
|
|
2326
|
+
return (
|
|
2327
|
+
/*click_handler*/
|
|
2328
|
+
ctx[8](
|
|
2329
|
+
/*giftItem*/
|
|
2330
|
+
ctx[10],
|
|
2331
|
+
...args
|
|
2332
|
+
)
|
|
2333
|
+
);
|
|
2334
|
+
}
|
|
2335
|
+
return {
|
|
2336
|
+
c() {
|
|
2337
|
+
div = element("div");
|
|
2338
|
+
attr(div, "class", "giftbar-help-icon");
|
|
2339
|
+
attr(div, "role", "presentation");
|
|
2340
|
+
},
|
|
2341
|
+
m(target, anchor) {
|
|
2342
|
+
insert(target, div, anchor);
|
|
2343
|
+
if (!mounted) {
|
|
2344
|
+
dispose = listen(div, "click", stop_propagation(click_handler));
|
|
2345
|
+
mounted = true;
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
p(new_ctx, dirty) {
|
|
2349
|
+
ctx = new_ctx;
|
|
2350
|
+
},
|
|
2351
|
+
d(detaching) {
|
|
2352
|
+
if (detaching) {
|
|
2353
|
+
detach(div);
|
|
2354
|
+
}
|
|
2355
|
+
mounted = false;
|
|
2356
|
+
dispose();
|
|
2357
|
+
}
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2360
|
+
function create_each_block$9(key_1, ctx) {
|
|
2361
|
+
let div2;
|
|
2362
|
+
let div0;
|
|
2363
|
+
let img;
|
|
2364
|
+
let img_class_value;
|
|
2365
|
+
let img_src_value;
|
|
2366
|
+
let lazyGiftImg_action;
|
|
2367
|
+
let t0;
|
|
2368
|
+
let t1;
|
|
2369
|
+
let div1;
|
|
2370
|
+
let t2_value = (
|
|
2371
|
+
/*giftItem*/
|
|
2372
|
+
ctx[10].title + ""
|
|
2373
|
+
);
|
|
2374
|
+
let t2;
|
|
2375
|
+
let t3;
|
|
2376
|
+
let t4;
|
|
2377
|
+
let t5;
|
|
2378
|
+
let show_if = canShowHelp(
|
|
2379
|
+
/*giftItem*/
|
|
2380
|
+
ctx[10],
|
|
2381
|
+
/*selectGift*/
|
|
2382
|
+
ctx[1]
|
|
2383
|
+
);
|
|
2384
|
+
let div2_id_value;
|
|
2385
|
+
let div2_class_value;
|
|
2386
|
+
let giftHoverTip_action;
|
|
2387
|
+
let mounted;
|
|
2388
|
+
let dispose;
|
|
2389
|
+
let if_block0 = (
|
|
2390
|
+
/*giftItem*/
|
|
2391
|
+
ctx[10].tag && create_if_block_6$4(ctx)
|
|
2392
|
+
);
|
|
2393
|
+
let if_block1 = (
|
|
2394
|
+
/*giftItem*/
|
|
2395
|
+
ctx[10].unitText && create_if_block_4$6(ctx)
|
|
2396
|
+
);
|
|
2397
|
+
let if_block2 = (
|
|
2398
|
+
/*giftItem*/
|
|
2399
|
+
ctx[10].unitText2 && create_if_block_3$7(ctx)
|
|
2400
|
+
);
|
|
2401
|
+
let if_block3 = show_if && create_if_block_2$b(ctx);
|
|
2402
|
+
function click_handler_12() {
|
|
2403
|
+
return (
|
|
2404
|
+
/*click_handler_1*/
|
|
2405
|
+
ctx[9](
|
|
2406
|
+
/*giftItem*/
|
|
2407
|
+
ctx[10]
|
|
2408
|
+
)
|
|
2409
|
+
);
|
|
2410
|
+
}
|
|
2411
|
+
return {
|
|
2412
|
+
key: key_1,
|
|
2413
|
+
first: null,
|
|
2414
|
+
c() {
|
|
2415
|
+
div2 = element("div");
|
|
2416
|
+
div0 = element("div");
|
|
2417
|
+
img = element("img");
|
|
2418
|
+
t0 = space();
|
|
2419
|
+
if (if_block0) if_block0.c();
|
|
2420
|
+
t1 = space();
|
|
2421
|
+
div1 = element("div");
|
|
2422
|
+
t2 = text(t2_value);
|
|
2423
|
+
t3 = space();
|
|
2424
|
+
if (if_block1) if_block1.c();
|
|
2425
|
+
t4 = space();
|
|
2426
|
+
if (if_block2) if_block2.c();
|
|
2427
|
+
t5 = space();
|
|
2428
|
+
if (if_block3) if_block3.c();
|
|
2429
|
+
attr(img, "class", img_class_value = "giftbar-item-pic " + /*animGuid*/
|
|
2430
|
+
(ctx[3] === /*giftItem*/
|
|
2431
|
+
ctx[10].guid ? "gift-select-animation" : ""));
|
|
2432
|
+
if (!src_url_equal(img.src, img_src_value = GIFT_IMG_PLACEHOLDER)) attr(img, "src", img_src_value);
|
|
2433
|
+
attr(img, "alt", "");
|
|
2434
|
+
attr(img, "decoding", "async");
|
|
2435
|
+
attr(img, "loading", "lazy");
|
|
2436
|
+
set_style(div0, "position", "relative");
|
|
2437
|
+
attr(div1, "class", "giftbar-item-title");
|
|
2438
|
+
attr(div2, "id", div2_id_value = /*giftItem*/
|
|
2439
|
+
ctx[10].guid);
|
|
2440
|
+
attr(div2, "class", div2_class_value = "giftbar-item " + /*selectGift*/
|
|
2441
|
+
(ctx[1] === /*giftItem*/
|
|
2442
|
+
ctx[10] ? "giftbar-item-on" : ""));
|
|
2443
|
+
attr(div2, "role", "presentation");
|
|
2444
|
+
this.first = div2;
|
|
2445
|
+
},
|
|
2446
|
+
m(target, anchor) {
|
|
2447
|
+
insert(target, div2, anchor);
|
|
2448
|
+
append(div2, div0);
|
|
2449
|
+
append(div0, img);
|
|
2450
|
+
append(div0, t0);
|
|
2451
|
+
if (if_block0) if_block0.m(div0, null);
|
|
2452
|
+
append(div2, t1);
|
|
2453
|
+
append(div2, div1);
|
|
2454
|
+
append(div1, t2);
|
|
2455
|
+
append(div2, t3);
|
|
2456
|
+
if (if_block1) if_block1.m(div2, null);
|
|
2457
|
+
append(div2, t4);
|
|
2458
|
+
if (if_block2) if_block2.m(div2, null);
|
|
2459
|
+
append(div2, t5);
|
|
2460
|
+
if (if_block3) if_block3.m(div2, null);
|
|
2461
|
+
if (!mounted) {
|
|
2462
|
+
dispose = [
|
|
2463
|
+
action_destroyer(lazyGiftImg_action = lazyGiftImg.call(null, img, giftListThumbUrl(
|
|
2464
|
+
/*giftItem*/
|
|
2465
|
+
ctx[10].pic
|
|
2466
|
+
))),
|
|
2467
|
+
action_destroyer(giftHoverTip_action = giftHoverTip.call(
|
|
2468
|
+
null,
|
|
2469
|
+
div2,
|
|
2470
|
+
/*giftItem*/
|
|
2471
|
+
ctx[10].atitle || ""
|
|
2472
|
+
)),
|
|
2473
|
+
listen(div2, "click", stop_propagation(click_handler_12))
|
|
2474
|
+
];
|
|
2475
|
+
mounted = true;
|
|
2476
|
+
}
|
|
2477
|
+
},
|
|
2478
|
+
p(new_ctx, dirty) {
|
|
2479
|
+
ctx = new_ctx;
|
|
2480
|
+
if (dirty & /*animGuid, gifts*/
|
|
2481
|
+
9 && img_class_value !== (img_class_value = "giftbar-item-pic " + /*animGuid*/
|
|
2482
|
+
(ctx[3] === /*giftItem*/
|
|
2483
|
+
ctx[10].guid ? "gift-select-animation" : ""))) {
|
|
2484
|
+
attr(img, "class", img_class_value);
|
|
2485
|
+
}
|
|
2486
|
+
if (lazyGiftImg_action && is_function(lazyGiftImg_action.update) && dirty & /*gifts*/
|
|
2487
|
+
1) lazyGiftImg_action.update.call(null, giftListThumbUrl(
|
|
2488
|
+
/*giftItem*/
|
|
2489
|
+
ctx[10].pic
|
|
2490
|
+
));
|
|
2491
|
+
if (
|
|
2492
|
+
/*giftItem*/
|
|
2493
|
+
ctx[10].tag
|
|
2494
|
+
) {
|
|
2495
|
+
if (if_block0) {
|
|
2496
|
+
if_block0.p(ctx, dirty);
|
|
2497
|
+
} else {
|
|
2498
|
+
if_block0 = create_if_block_6$4(ctx);
|
|
2499
|
+
if_block0.c();
|
|
2500
|
+
if_block0.m(div0, null);
|
|
2501
|
+
}
|
|
2502
|
+
} else if (if_block0) {
|
|
2503
|
+
if_block0.d(1);
|
|
2504
|
+
if_block0 = null;
|
|
2505
|
+
}
|
|
2506
|
+
if (dirty & /*gifts*/
|
|
2507
|
+
1 && t2_value !== (t2_value = /*giftItem*/
|
|
2508
|
+
ctx[10].title + "")) set_data(t2, t2_value);
|
|
2509
|
+
if (
|
|
2510
|
+
/*giftItem*/
|
|
2511
|
+
ctx[10].unitText
|
|
2512
|
+
) {
|
|
2513
|
+
if (if_block1) {
|
|
2514
|
+
if_block1.p(ctx, dirty);
|
|
2515
|
+
} else {
|
|
2516
|
+
if_block1 = create_if_block_4$6(ctx);
|
|
2517
|
+
if_block1.c();
|
|
2518
|
+
if_block1.m(div2, t4);
|
|
2519
|
+
}
|
|
2520
|
+
} else if (if_block1) {
|
|
2521
|
+
if_block1.d(1);
|
|
2522
|
+
if_block1 = null;
|
|
2523
|
+
}
|
|
2524
|
+
if (
|
|
2525
|
+
/*giftItem*/
|
|
2526
|
+
ctx[10].unitText2
|
|
2527
|
+
) {
|
|
2528
|
+
if (if_block2) {
|
|
2529
|
+
if_block2.p(ctx, dirty);
|
|
2530
|
+
} else {
|
|
2531
|
+
if_block2 = create_if_block_3$7(ctx);
|
|
2532
|
+
if_block2.c();
|
|
2533
|
+
if_block2.m(div2, t5);
|
|
2534
|
+
}
|
|
2535
|
+
} else if (if_block2) {
|
|
2536
|
+
if_block2.d(1);
|
|
2537
|
+
if_block2 = null;
|
|
2538
|
+
}
|
|
2539
|
+
if (dirty & /*gifts, selectGift*/
|
|
2540
|
+
3) show_if = canShowHelp(
|
|
2541
|
+
/*giftItem*/
|
|
2542
|
+
ctx[10],
|
|
2543
|
+
/*selectGift*/
|
|
2544
|
+
ctx[1]
|
|
2545
|
+
);
|
|
2546
|
+
if (show_if) {
|
|
2547
|
+
if (if_block3) {
|
|
2548
|
+
if_block3.p(ctx, dirty);
|
|
2549
|
+
} else {
|
|
2550
|
+
if_block3 = create_if_block_2$b(ctx);
|
|
2551
|
+
if_block3.c();
|
|
2552
|
+
if_block3.m(div2, null);
|
|
2553
|
+
}
|
|
2554
|
+
} else if (if_block3) {
|
|
2555
|
+
if_block3.d(1);
|
|
2556
|
+
if_block3 = null;
|
|
2557
|
+
}
|
|
2558
|
+
if (dirty & /*gifts*/
|
|
2559
|
+
1 && div2_id_value !== (div2_id_value = /*giftItem*/
|
|
2560
|
+
ctx[10].guid)) {
|
|
2561
|
+
attr(div2, "id", div2_id_value);
|
|
2562
|
+
}
|
|
2563
|
+
if (dirty & /*selectGift, gifts*/
|
|
2564
|
+
3 && div2_class_value !== (div2_class_value = "giftbar-item " + /*selectGift*/
|
|
2565
|
+
(ctx[1] === /*giftItem*/
|
|
2566
|
+
ctx[10] ? "giftbar-item-on" : ""))) {
|
|
2567
|
+
attr(div2, "class", div2_class_value);
|
|
2568
|
+
}
|
|
2569
|
+
if (giftHoverTip_action && is_function(giftHoverTip_action.update) && dirty & /*gifts*/
|
|
2570
|
+
1) giftHoverTip_action.update.call(
|
|
2571
|
+
null,
|
|
2572
|
+
/*giftItem*/
|
|
2573
|
+
ctx[10].atitle || ""
|
|
2574
|
+
);
|
|
2575
|
+
},
|
|
2576
|
+
d(detaching) {
|
|
2577
|
+
if (detaching) {
|
|
2578
|
+
detach(div2);
|
|
2579
|
+
}
|
|
2580
|
+
if (if_block0) if_block0.d();
|
|
2581
|
+
if (if_block1) if_block1.d();
|
|
2582
|
+
if (if_block2) if_block2.d();
|
|
2583
|
+
if (if_block3) if_block3.d();
|
|
2584
|
+
mounted = false;
|
|
2585
|
+
run_all(dispose);
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
function create_if_block$n(ctx) {
|
|
2590
|
+
let if_block_anchor;
|
|
2591
|
+
function select_block_type(ctx2, dirty) {
|
|
2592
|
+
if (
|
|
2593
|
+
/*emptyImg*/
|
|
2594
|
+
ctx2[2]
|
|
2595
|
+
) return create_if_block_1$k;
|
|
2596
|
+
return create_else_block$c;
|
|
2597
|
+
}
|
|
2598
|
+
let current_block_type = select_block_type(ctx);
|
|
2599
|
+
let if_block = current_block_type(ctx);
|
|
2600
|
+
return {
|
|
2601
|
+
c() {
|
|
2602
|
+
if_block.c();
|
|
2603
|
+
if_block_anchor = empty();
|
|
2604
|
+
},
|
|
2605
|
+
m(target, anchor) {
|
|
2606
|
+
if_block.m(target, anchor);
|
|
2607
|
+
insert(target, if_block_anchor, anchor);
|
|
2608
|
+
},
|
|
2609
|
+
p(ctx2, dirty) {
|
|
2610
|
+
if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
|
|
2611
|
+
if_block.p(ctx2, dirty);
|
|
2612
|
+
} else {
|
|
2613
|
+
if_block.d(1);
|
|
2614
|
+
if_block = current_block_type(ctx2);
|
|
2615
|
+
if (if_block) {
|
|
2616
|
+
if_block.c();
|
|
2617
|
+
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
},
|
|
2621
|
+
d(detaching) {
|
|
2622
|
+
if (detaching) {
|
|
2623
|
+
detach(if_block_anchor);
|
|
2624
|
+
}
|
|
2625
|
+
if_block.d(detaching);
|
|
2626
|
+
}
|
|
2627
|
+
};
|
|
2119
2628
|
}
|
|
2120
|
-
function
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2629
|
+
function create_else_block$c(ctx) {
|
|
2630
|
+
let div;
|
|
2631
|
+
return {
|
|
2632
|
+
c() {
|
|
2633
|
+
div = element("div");
|
|
2634
|
+
div.textContent = "还没有礼物哦~";
|
|
2635
|
+
attr(div, "class", "giftbar-empty");
|
|
2636
|
+
},
|
|
2637
|
+
m(target, anchor) {
|
|
2638
|
+
insert(target, div, anchor);
|
|
2639
|
+
},
|
|
2640
|
+
p: noop,
|
|
2641
|
+
d(detaching) {
|
|
2642
|
+
if (detaching) {
|
|
2643
|
+
detach(div);
|
|
2133
2644
|
}
|
|
2134
|
-
return { kind: "pardon" };
|
|
2135
|
-
}
|
|
2136
|
-
if (id === 389) {
|
|
2137
|
-
return { kind: "hostClick" };
|
|
2138
|
-
}
|
|
2139
|
-
if (type === 16 && touid === 0) {
|
|
2140
|
-
return { kind: "hostClick" };
|
|
2141
|
-
}
|
|
2142
|
-
return { kind: "pay", payAction: "send" };
|
|
2143
|
-
}
|
|
2144
|
-
if (action === "send") {
|
|
2145
|
-
if (Number(gift.question_gift) === 1) {
|
|
2146
|
-
return { kind: "question" };
|
|
2147
|
-
}
|
|
2148
|
-
if (type === 30 || type === 37) {
|
|
2149
|
-
return { kind: "hostUse" };
|
|
2150
2645
|
}
|
|
2151
|
-
|
|
2152
|
-
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
function create_if_block_1$k(ctx) {
|
|
2649
|
+
let img;
|
|
2650
|
+
let img_src_value;
|
|
2651
|
+
return {
|
|
2652
|
+
c() {
|
|
2653
|
+
img = element("img");
|
|
2654
|
+
attr(img, "class", "giftbar-empty-img");
|
|
2655
|
+
if (!src_url_equal(img.src, img_src_value = /*emptyImg*/
|
|
2656
|
+
ctx[2])) attr(img, "src", img_src_value);
|
|
2657
|
+
attr(img, "alt", "");
|
|
2658
|
+
},
|
|
2659
|
+
m(target, anchor) {
|
|
2660
|
+
insert(target, img, anchor);
|
|
2661
|
+
},
|
|
2662
|
+
p(ctx2, dirty) {
|
|
2663
|
+
if (dirty & /*emptyImg*/
|
|
2664
|
+
4 && !src_url_equal(img.src, img_src_value = /*emptyImg*/
|
|
2665
|
+
ctx2[2])) {
|
|
2666
|
+
attr(img, "src", img_src_value);
|
|
2667
|
+
}
|
|
2668
|
+
},
|
|
2669
|
+
d(detaching) {
|
|
2670
|
+
if (detaching) {
|
|
2671
|
+
detach(img);
|
|
2672
|
+
}
|
|
2153
2673
|
}
|
|
2154
|
-
|
|
2155
|
-
}
|
|
2156
|
-
if (isIframeBlindBox(gift, navid)) {
|
|
2157
|
-
return { kind: "iframe" };
|
|
2158
|
-
}
|
|
2159
|
-
if (isBlindBoxModalGift(gift, navid)) {
|
|
2160
|
-
return { kind: "blindBox" };
|
|
2161
|
-
}
|
|
2162
|
-
if (isMagicGift(gift, navid)) {
|
|
2163
|
-
return { kind: "magic" };
|
|
2164
|
-
}
|
|
2165
|
-
if (id === 383) {
|
|
2166
|
-
return { kind: "hostClick" };
|
|
2167
|
-
}
|
|
2168
|
-
if (id === 368 || id === 389) {
|
|
2169
|
-
return { kind: "hostClick" };
|
|
2170
|
-
}
|
|
2171
|
-
if (type === 16 && touid === 0) {
|
|
2172
|
-
return { kind: "hostClick" };
|
|
2173
|
-
}
|
|
2174
|
-
return { kind: "pay", payAction: "open" };
|
|
2674
|
+
};
|
|
2175
2675
|
}
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2676
|
+
function create_fragment$q(ctx) {
|
|
2677
|
+
let div;
|
|
2678
|
+
let each_blocks = [];
|
|
2679
|
+
let each_1_lookup = /* @__PURE__ */ new Map();
|
|
2680
|
+
let t;
|
|
2681
|
+
let each_value = ensure_array_like(
|
|
2682
|
+
/*gifts*/
|
|
2683
|
+
ctx[0]
|
|
2684
|
+
);
|
|
2685
|
+
const get_key = (ctx2) => (
|
|
2686
|
+
/*giftItem*/
|
|
2687
|
+
ctx2[10].guid || /*giftItem*/
|
|
2688
|
+
ctx2[10].id
|
|
2689
|
+
);
|
|
2690
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
2691
|
+
let child_ctx = get_each_context$9(ctx, each_value, i);
|
|
2692
|
+
let key = get_key(child_ctx);
|
|
2693
|
+
each_1_lookup.set(key, each_blocks[i] = create_each_block$9(key, child_ctx));
|
|
2180
2694
|
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2695
|
+
let if_block = (
|
|
2696
|
+
/*gifts*/
|
|
2697
|
+
ctx[0].length === 0 && create_if_block$n(ctx)
|
|
2698
|
+
);
|
|
2699
|
+
return {
|
|
2700
|
+
c() {
|
|
2701
|
+
div = element("div");
|
|
2702
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2703
|
+
each_blocks[i].c();
|
|
2704
|
+
}
|
|
2705
|
+
t = space();
|
|
2706
|
+
if (if_block) if_block.c();
|
|
2707
|
+
attr(div, "class", "giftbar-grid");
|
|
2708
|
+
},
|
|
2709
|
+
m(target, anchor) {
|
|
2710
|
+
insert(target, div, anchor);
|
|
2711
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2712
|
+
if (each_blocks[i]) {
|
|
2713
|
+
each_blocks[i].m(div, null);
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
append(div, t);
|
|
2717
|
+
if (if_block) if_block.m(div, null);
|
|
2718
|
+
},
|
|
2719
|
+
p(ctx2, [dirty]) {
|
|
2720
|
+
if (dirty & /*gifts, selectGift, choose, openHelp, canShowHelp, animGuid*/
|
|
2721
|
+
59) {
|
|
2722
|
+
each_value = ensure_array_like(
|
|
2723
|
+
/*gifts*/
|
|
2724
|
+
ctx2[0]
|
|
2725
|
+
);
|
|
2726
|
+
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, div, destroy_block, create_each_block$9, t, get_each_context$9);
|
|
2727
|
+
}
|
|
2728
|
+
if (
|
|
2729
|
+
/*gifts*/
|
|
2730
|
+
ctx2[0].length === 0
|
|
2731
|
+
) {
|
|
2732
|
+
if (if_block) {
|
|
2733
|
+
if_block.p(ctx2, dirty);
|
|
2734
|
+
} else {
|
|
2735
|
+
if_block = create_if_block$n(ctx2);
|
|
2736
|
+
if_block.c();
|
|
2737
|
+
if_block.m(div, null);
|
|
2738
|
+
}
|
|
2739
|
+
} else if (if_block) {
|
|
2740
|
+
if_block.d(1);
|
|
2741
|
+
if_block = null;
|
|
2742
|
+
}
|
|
2743
|
+
},
|
|
2744
|
+
i: noop,
|
|
2745
|
+
o: noop,
|
|
2746
|
+
d(detaching) {
|
|
2747
|
+
if (detaching) {
|
|
2748
|
+
detach(div);
|
|
2749
|
+
}
|
|
2750
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2751
|
+
each_blocks[i].d();
|
|
2752
|
+
}
|
|
2753
|
+
if (if_block) if_block.d();
|
|
2754
|
+
}
|
|
2755
|
+
};
|
|
2183
2756
|
}
|
|
2184
|
-
function
|
|
2185
|
-
|
|
2186
|
-
temp.picIcon = worth === 3 ? CRYSTAL_IMG : ZHUANSHI_IMG;
|
|
2187
|
-
temp.isCrystal = worth === 3;
|
|
2188
|
-
temp.unitText = temp.diamond + (worth === 3 ? "紫晶" : "钻");
|
|
2189
|
-
temp.unitText2 = "";
|
|
2190
|
-
if (temp.worth === void 0) {
|
|
2191
|
-
temp.worth = 0;
|
|
2192
|
-
}
|
|
2193
|
-
temp.atitle = temp.intro && temp.intro !== " " ? nrTobr(temp.intro) : "";
|
|
2194
|
-
temp.guid = nextGuid(navid, temp.id, index);
|
|
2757
|
+
function canShowHelp(gift, selected) {
|
|
2758
|
+
return selected === gift && Number(gift && gift.is_multi_gift) === 1 && !!(gift && gift.explain_url);
|
|
2195
2759
|
}
|
|
2196
|
-
function
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
}
|
|
2215
|
-
} else if (Number(navid) === TAB_CRYSTAL && type === 7) {
|
|
2216
|
-
temp.picIcon = CRYSTAL_IMG;
|
|
2217
|
-
temp.isCrystal = true;
|
|
2218
|
-
temp.unitText = String(price / 10);
|
|
2219
|
-
} else {
|
|
2220
|
-
let giftNum = "";
|
|
2221
|
-
if (type === 7 || Number(navid) === TAB_PACKAGE && priority > 0) {
|
|
2222
|
-
giftNum = price / 10 + "钻";
|
|
2223
|
-
} else {
|
|
2224
|
-
giftNum = "x" + num;
|
|
2225
|
-
}
|
|
2226
|
-
if (Number(navid) === TAB_PACKAGE && priority > 0) {
|
|
2227
|
-
temp.picIcon = ZHUANSHI_IMG;
|
|
2228
|
-
temp.unitText = giftNum;
|
|
2229
|
-
} else if (id === 155 || id === 156) {
|
|
2230
|
-
temp.picIcon = ZHUANSHI_IMG;
|
|
2231
|
-
temp.unitText = giftNum;
|
|
2232
|
-
} else {
|
|
2233
|
-
temp.unitText2 = giftNum;
|
|
2234
|
-
}
|
|
2760
|
+
function instance$q($$self, $$props, $$invalidate) {
|
|
2761
|
+
let { gifts = [] } = $$props;
|
|
2762
|
+
let { selectGift = null } = $$props;
|
|
2763
|
+
let { emptyImg = "" } = $$props;
|
|
2764
|
+
let { onClickItem } = $$props;
|
|
2765
|
+
let { onOpenHelp } = $$props;
|
|
2766
|
+
let animGuid = "";
|
|
2767
|
+
function choose(item) {
|
|
2768
|
+
$$invalidate(3, animGuid = item.guid);
|
|
2769
|
+
onClickItem && onClickItem(item);
|
|
2770
|
+
setTimeout(
|
|
2771
|
+
() => {
|
|
2772
|
+
if (animGuid === item.guid) {
|
|
2773
|
+
$$invalidate(3, animGuid = "");
|
|
2774
|
+
}
|
|
2775
|
+
},
|
|
2776
|
+
300
|
|
2777
|
+
);
|
|
2235
2778
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2779
|
+
function openHelp(event, gift) {
|
|
2780
|
+
event && event.stopPropagation && event.stopPropagation();
|
|
2781
|
+
onOpenHelp && onOpenHelp(gift);
|
|
2782
|
+
}
|
|
2783
|
+
const click_handler = (giftItem, event) => openHelp(event, giftItem);
|
|
2784
|
+
const click_handler_12 = (giftItem) => choose(giftItem);
|
|
2785
|
+
$$self.$$set = ($$props2) => {
|
|
2786
|
+
if ("gifts" in $$props2) $$invalidate(0, gifts = $$props2.gifts);
|
|
2787
|
+
if ("selectGift" in $$props2) $$invalidate(1, selectGift = $$props2.selectGift);
|
|
2788
|
+
if ("emptyImg" in $$props2) $$invalidate(2, emptyImg = $$props2.emptyImg);
|
|
2789
|
+
if ("onClickItem" in $$props2) $$invalidate(6, onClickItem = $$props2.onClickItem);
|
|
2790
|
+
if ("onOpenHelp" in $$props2) $$invalidate(7, onOpenHelp = $$props2.onOpenHelp);
|
|
2791
|
+
};
|
|
2792
|
+
return [
|
|
2793
|
+
gifts,
|
|
2794
|
+
selectGift,
|
|
2795
|
+
emptyImg,
|
|
2796
|
+
animGuid,
|
|
2797
|
+
choose,
|
|
2798
|
+
openHelp,
|
|
2799
|
+
onClickItem,
|
|
2800
|
+
onOpenHelp,
|
|
2801
|
+
click_handler,
|
|
2802
|
+
click_handler_12
|
|
2803
|
+
];
|
|
2804
|
+
}
|
|
2805
|
+
class GiftGrid extends SvelteComponent {
|
|
2806
|
+
constructor(options2) {
|
|
2807
|
+
super();
|
|
2808
|
+
init(this, options2, instance$q, create_fragment$q, safe_not_equal, {
|
|
2809
|
+
gifts: 0,
|
|
2810
|
+
selectGift: 1,
|
|
2811
|
+
emptyImg: 2,
|
|
2812
|
+
onClickItem: 6,
|
|
2813
|
+
onOpenHelp: 7
|
|
2814
|
+
});
|
|
2238
2815
|
}
|
|
2239
|
-
temp.atitle = temp.intro && temp.intro !== " " ? nrTobr(temp.intro) : "";
|
|
2240
|
-
temp.guid = nextGuid(navid, temp.id, index);
|
|
2241
2816
|
}
|
|
2242
2817
|
function create_if_block_1$j(ctx) {
|
|
2243
2818
|
let p;
|
|
@@ -2315,7 +2890,7 @@ function create_if_block$m(ctx) {
|
|
|
2315
2890
|
}
|
|
2316
2891
|
};
|
|
2317
2892
|
}
|
|
2318
|
-
function create_fragment$
|
|
2893
|
+
function create_fragment$p(ctx) {
|
|
2319
2894
|
let div1;
|
|
2320
2895
|
let div0;
|
|
2321
2896
|
let p;
|
|
@@ -2411,7 +2986,7 @@ function create_fragment$q(ctx) {
|
|
|
2411
2986
|
}
|
|
2412
2987
|
};
|
|
2413
2988
|
}
|
|
2414
|
-
function instance$
|
|
2989
|
+
function instance$p($$self, $$props, $$invalidate) {
|
|
2415
2990
|
let diamondText;
|
|
2416
2991
|
let crystalText;
|
|
2417
2992
|
let moneyText;
|
|
@@ -2458,172 +3033,8 @@ function instance$q($$self, $$props, $$invalidate) {
|
|
|
2458
3033
|
class GiftBalance extends SvelteComponent {
|
|
2459
3034
|
constructor(options2) {
|
|
2460
3035
|
super();
|
|
2461
|
-
init(this, options2, instance$
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
function joinQuery(parts) {
|
|
2465
|
-
return parts.filter((item) => item && item[1] !== void 0 && item[1] !== null).map(([key, value]) => key + "=" + value).join("&");
|
|
2466
|
-
}
|
|
2467
|
-
function appendQuery(url, params) {
|
|
2468
|
-
let next = url || "";
|
|
2469
|
-
Object.keys(params || {}).forEach((key) => {
|
|
2470
|
-
const value = params[key];
|
|
2471
|
-
if (value === void 0 || value === null) {
|
|
2472
|
-
return;
|
|
2473
|
-
}
|
|
2474
|
-
const re = new RegExp("([?&])" + key + "=[^&]*");
|
|
2475
|
-
if (re.test(next)) {
|
|
2476
|
-
next = next.replace(re, "$1" + key + "=" + value);
|
|
2477
|
-
} else {
|
|
2478
|
-
next += (next.indexOf("?") >= 0 ? "&" : "?") + key + "=" + value;
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
return next;
|
|
2482
|
-
}
|
|
2483
|
-
function stripSlash(domain) {
|
|
2484
|
-
return domain ? String(domain).replace(/\/$/, "") : "";
|
|
2485
|
-
}
|
|
2486
|
-
function guessApiDomain(prefix) {
|
|
2487
|
-
const host = window.location.host || "";
|
|
2488
|
-
const main = host.split(".").slice(-2).join(".") || "tuwan.com";
|
|
2489
|
-
if (options.isChatTest) {
|
|
2490
|
-
return "https://" + prefix + "-test." + main;
|
|
2491
|
-
}
|
|
2492
|
-
return "https://" + prefix + "." + main;
|
|
2493
|
-
}
|
|
2494
|
-
function resolveApiDomain(kind) {
|
|
2495
|
-
const map = options.apiDomain || {};
|
|
2496
|
-
const injected = map[kind];
|
|
2497
|
-
if (injected) {
|
|
2498
|
-
return stripSlash(injected);
|
|
2499
|
-
}
|
|
2500
|
-
if (kind === "papi" || kind === "yapi") {
|
|
2501
|
-
return guessApiDomain(kind);
|
|
2502
|
-
}
|
|
2503
|
-
throw new Error("giftBarLib apiDomain." + kind + " is required");
|
|
2504
|
-
}
|
|
2505
|
-
function papi() {
|
|
2506
|
-
return resolveApiDomain("papi");
|
|
2507
|
-
}
|
|
2508
|
-
function yapi() {
|
|
2509
|
-
return resolveApiDomain("yapi");
|
|
2510
|
-
}
|
|
2511
|
-
function hasValue$2(value) {
|
|
2512
|
-
return value !== void 0 && value !== null && value !== "";
|
|
2513
|
-
}
|
|
2514
|
-
function sceneParts$1(ctx) {
|
|
2515
|
-
if (hasValue$2(ctx && ctx.group_id)) {
|
|
2516
|
-
return [["group_id", ctx.group_id]];
|
|
2517
|
-
}
|
|
2518
|
-
return [["imuid", ctx && ctx.imuid]];
|
|
2519
|
-
}
|
|
2520
|
-
function openParts(giftId, num, paySure, ctx) {
|
|
2521
|
-
return [
|
|
2522
|
-
["giftid", giftId],
|
|
2523
|
-
["num", num || 1],
|
|
2524
|
-
["pay_confirm", 1],
|
|
2525
|
-
["apiver", 1],
|
|
2526
|
-
["pay_sure", paySure || 0],
|
|
2527
|
-
["uids", ctx && ctx.selfUid],
|
|
2528
|
-
...sceneParts$1(ctx)
|
|
2529
|
-
];
|
|
2530
|
-
}
|
|
2531
|
-
function getRechargeUrl() {
|
|
2532
|
-
return yapi() + "/activityapi/recharge";
|
|
2533
|
-
}
|
|
2534
|
-
function getLimitSettingsUrl() {
|
|
2535
|
-
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/home/consume-check";
|
|
2536
|
-
}
|
|
2537
|
-
function giveUpConsumeLimitUrl() {
|
|
2538
|
-
return yapi() + "/user/setGiftRemindSetting?format=jsonp";
|
|
2539
|
-
}
|
|
2540
|
-
function giftListsUrl(cid, navid) {
|
|
2541
|
-
return papi() + "/Teacher/giftLists?format=jsonp&platform=0" + (hasValue$2(cid) ? "&cid=" + cid : "") + "&navid=" + navid + "&apiver=4";
|
|
2542
|
-
}
|
|
2543
|
-
function haveGiftUrl(cid, navid) {
|
|
2544
|
-
return papi() + "/Teacher/haveGift?format=jsonp&mode=2" + (hasValue$2(cid) ? "&cid=" + cid : "") + "&navid=" + navid;
|
|
2545
|
-
}
|
|
2546
|
-
function getMoneyUrl() {
|
|
2547
|
-
return papi() + "/Teacher/getMoney";
|
|
2548
|
-
}
|
|
2549
|
-
function diamondGiftMoreUrl(query) {
|
|
2550
|
-
return papi() + "/Diamond/giftMore?" + query;
|
|
2551
|
-
}
|
|
2552
|
-
function giveGiftUrl(query) {
|
|
2553
|
-
return papi() + "/Teacher/giveGift?" + query;
|
|
2554
|
-
}
|
|
2555
|
-
function giveGiftInfoUrl(cid, giftId) {
|
|
2556
|
-
return yapi() + "/nobility/getGiveGiftInfo?cid=" + cid + "&id=" + giftId + "&freeCardTypeid=2&format=jsonp";
|
|
2557
|
-
}
|
|
2558
|
-
function treasureBuyUrl(query) {
|
|
2559
|
-
return papi() + "/Treasure/buy?format=jsonp&" + query;
|
|
2560
|
-
}
|
|
2561
|
-
function blindBoxPayUrl(query) {
|
|
2562
|
-
return papi() + "/treasure/blindBox?format=jsonp&" + query;
|
|
2563
|
-
}
|
|
2564
|
-
function blindBoxImgListUrl(giftId) {
|
|
2565
|
-
return papi() + "/gift/blindBoxImgList?format=jsonp&gift_id=" + giftId;
|
|
2566
|
-
}
|
|
2567
|
-
function treasureGetInfoUrl(giftId) {
|
|
2568
|
-
return papi() + "/TreasureV3/getInfo?giftid=" + giftId + "&apiver=1";
|
|
2569
|
-
}
|
|
2570
|
-
function treasureGetRecordUrl(giftId, page, step) {
|
|
2571
|
-
return papi() + "/TreasureV3/getRecord?format=jsonp&giftid=" + giftId + "&page=" + page + "&step=" + (step || 10);
|
|
2572
|
-
}
|
|
2573
|
-
function treasureGoldUrl(giftId, cid, num, paySure, ctx) {
|
|
2574
|
-
if (isImSource()) {
|
|
2575
|
-
return papi() + "/TreasureV3/gold?" + joinQuery(openParts(giftId, num, paySure, ctx));
|
|
2576
|
-
}
|
|
2577
|
-
return papi() + "/TreasureV3/gold?giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&pay_confirm=1&pay_sure=" + (paySure || 0);
|
|
2578
|
-
}
|
|
2579
|
-
function treasureV3BuyUrl(giftId, cid, num, paySure, ctx) {
|
|
2580
|
-
if (isImSource()) {
|
|
2581
|
-
return papi() + "/TreasureV3/buy?" + joinQuery(openParts(giftId, num, paySure, ctx));
|
|
2582
|
-
}
|
|
2583
|
-
return papi() + "/TreasureV3/buy?giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&pay_confirm=1&pay_sure=" + (paySure || 0);
|
|
2584
|
-
}
|
|
2585
|
-
function modalBlindBoxPayUrl(giftId, cid, num, worth, isBuy, ctx) {
|
|
2586
|
-
if (isImSource()) {
|
|
2587
|
-
return papi() + "/treasure/blindBox?" + joinQuery([
|
|
2588
|
-
["anonymous", 0],
|
|
2589
|
-
["actid", 100],
|
|
2590
|
-
["platform", 0],
|
|
2591
|
-
["giftid", giftId],
|
|
2592
|
-
["num", num || 1],
|
|
2593
|
-
["pay_confirm", 1],
|
|
2594
|
-
["apiver", 1],
|
|
2595
|
-
["pay_sure", 0],
|
|
2596
|
-
["worth", worth || 0],
|
|
2597
|
-
["is_buy", isBuy || 0],
|
|
2598
|
-
["uids", ctx && ctx.selfUid],
|
|
2599
|
-
...sceneParts$1(ctx)
|
|
2600
|
-
]);
|
|
2601
|
-
}
|
|
2602
|
-
return papi() + "/treasure/blindBox?format=jsonp&giftid=" + giftId + "&cid=" + cid + "&num=" + (num || 1) + "&worth=" + (worth || 0) + "&is_buy=" + (isBuy || 0);
|
|
2603
|
-
}
|
|
2604
|
-
function diamondPrefixQuery(parts) {
|
|
2605
|
-
return "anonymous=0&actid=" + (isImSource() ? 101 : 100) + "&platform=0&" + joinQuery(parts);
|
|
2606
|
-
}
|
|
2607
|
-
function boxPrefixQuery(parts) {
|
|
2608
|
-
return "anonymous=0&actid=100&platform=0&" + joinQuery(parts);
|
|
2609
|
-
}
|
|
2610
|
-
function platformPrefixQuery(parts) {
|
|
2611
|
-
return "platform=0&" + joinQuery(parts);
|
|
2612
|
-
}
|
|
2613
|
-
function getCrystalBlindBoxBaseUrl() {
|
|
2614
|
-
if (options.isChatTest) {
|
|
2615
|
-
return "https://act-test.tuwan.com/cdn/s1season-box.html";
|
|
2616
|
-
}
|
|
2617
|
-
const host = window.location.host || "";
|
|
2618
|
-
const actHost = host.indexOf("diandiankaihei.com") > -1 ? "act.diandiankaihei.com" : "act.tuwan.com";
|
|
2619
|
-
return "https://" + actHost + "/cdn/s1season-box.html";
|
|
2620
|
-
}
|
|
2621
|
-
function getCrystalBlindBoxUrl(cid, giftId, navid) {
|
|
2622
|
-
const base = getCrystalBlindBoxBaseUrl();
|
|
2623
|
-
if (isImSource()) {
|
|
2624
|
-
return base + "?giftId=" + giftId + "&navid=" + navid;
|
|
3036
|
+
init(this, options2, instance$p, create_fragment$p, safe_not_equal, { diamondInfo: 5, showMoney: 6 });
|
|
2625
3037
|
}
|
|
2626
|
-
return base + "?cid=" + cid + "&giftId=" + giftId;
|
|
2627
3038
|
}
|
|
2628
3039
|
function clickOutside(nodeOrSelector, callback) {
|
|
2629
3040
|
const handleClick = (event) => {
|
|
@@ -3294,7 +3705,7 @@ function create_if_block$l(ctx) {
|
|
|
3294
3705
|
}
|
|
3295
3706
|
};
|
|
3296
3707
|
}
|
|
3297
|
-
function create_fragment$
|
|
3708
|
+
function create_fragment$o(ctx) {
|
|
3298
3709
|
let div3;
|
|
3299
3710
|
let div0;
|
|
3300
3711
|
let span0;
|
|
@@ -3406,7 +3817,6 @@ function create_fragment$p(ctx) {
|
|
|
3406
3817
|
ctx[3].countLocked;
|
|
3407
3818
|
attr(div0, "class", div0_class_value = "giftbar-count " + /*ui*/
|
|
3408
3819
|
(ctx[3].countLocked ? "is-locked" : ""));
|
|
3409
|
-
set_style(div0, "margin-left", "10px");
|
|
3410
3820
|
attr(div1, "class", "giftbar-btns");
|
|
3411
3821
|
attr(div2, "class", "giftbar-recharge");
|
|
3412
3822
|
attr(div3, "class", "giftbar-footer");
|
|
@@ -3584,7 +3994,7 @@ function create_fragment$p(ctx) {
|
|
|
3584
3994
|
}
|
|
3585
3995
|
};
|
|
3586
3996
|
}
|
|
3587
|
-
function instance$
|
|
3997
|
+
function instance$o($$self, $$props, $$invalidate) {
|
|
3588
3998
|
let buttons;
|
|
3589
3999
|
let { diamondInfo = {} } = $$props;
|
|
3590
4000
|
let { showMoney = false } = $$props;
|
|
@@ -3717,8 +4127,8 @@ class GiftFooter extends SvelteComponent {
|
|
|
3717
4127
|
init(
|
|
3718
4128
|
this,
|
|
3719
4129
|
options2,
|
|
3720
|
-
instance$
|
|
3721
|
-
create_fragment$
|
|
4130
|
+
instance$o,
|
|
4131
|
+
create_fragment$o,
|
|
3722
4132
|
safe_not_equal,
|
|
3723
4133
|
{
|
|
3724
4134
|
diamondInfo: 1,
|
|
@@ -4048,7 +4458,7 @@ function create_if_block_1$h(ctx) {
|
|
|
4048
4458
|
}
|
|
4049
4459
|
};
|
|
4050
4460
|
}
|
|
4051
|
-
function create_fragment$
|
|
4461
|
+
function create_fragment$n(ctx) {
|
|
4052
4462
|
let div;
|
|
4053
4463
|
function select_block_type(ctx2, dirty) {
|
|
4054
4464
|
if (
|
|
@@ -4104,7 +4514,7 @@ function create_fragment$o(ctx) {
|
|
|
4104
4514
|
}
|
|
4105
4515
|
};
|
|
4106
4516
|
}
|
|
4107
|
-
function instance$
|
|
4517
|
+
function instance$n($$self, $$props, $$invalidate) {
|
|
4108
4518
|
let view;
|
|
4109
4519
|
let roseUrl;
|
|
4110
4520
|
let { data = null } = $$props;
|
|
@@ -4126,7 +4536,7 @@ function instance$o($$self, $$props, $$invalidate) {
|
|
|
4126
4536
|
class JingpaiNotice extends SvelteComponent {
|
|
4127
4537
|
constructor(options2) {
|
|
4128
4538
|
super();
|
|
4129
|
-
init(this, options2, instance$
|
|
4539
|
+
init(this, options2, instance$n, create_fragment$n, safe_not_equal, { data: 2 });
|
|
4130
4540
|
}
|
|
4131
4541
|
}
|
|
4132
4542
|
const GIFT_BAR_EXTRA = {
|
|
@@ -4141,38 +4551,6 @@ function giftBarLog(tag, extra) {
|
|
|
4141
4551
|
} catch (_e) {
|
|
4142
4552
|
}
|
|
4143
4553
|
}
|
|
4144
|
-
const deferred = function() {
|
|
4145
|
-
const defer = {};
|
|
4146
|
-
defer.promise = new Promise((resolve, reject) => {
|
|
4147
|
-
defer.resolve = resolve;
|
|
4148
|
-
defer.reject = reject;
|
|
4149
|
-
});
|
|
4150
|
-
return defer;
|
|
4151
|
-
};
|
|
4152
|
-
function createModal(_Class, props = {}, target = document.body) {
|
|
4153
|
-
const wrap = document.createElement("div");
|
|
4154
|
-
wrap.setAttribute("data-modal-overlay", "");
|
|
4155
|
-
wrap.setAttribute("data-giftbar-modal", "");
|
|
4156
|
-
target.appendChild(wrap);
|
|
4157
|
-
let modal = new _Class({ target: wrap, props: { closeModal, ...props } });
|
|
4158
|
-
const defer = deferred();
|
|
4159
|
-
function closeModal(err, result) {
|
|
4160
|
-
try {
|
|
4161
|
-
modal && modal.$destroy();
|
|
4162
|
-
} finally {
|
|
4163
|
-
modal = null;
|
|
4164
|
-
if (wrap.parentNode) {
|
|
4165
|
-
wrap.parentNode.removeChild(wrap);
|
|
4166
|
-
}
|
|
4167
|
-
}
|
|
4168
|
-
if (err) {
|
|
4169
|
-
defer.reject(err);
|
|
4170
|
-
} else {
|
|
4171
|
-
defer.resolve(result);
|
|
4172
|
-
}
|
|
4173
|
-
}
|
|
4174
|
-
return { modal, closeModal, promise: defer.promise };
|
|
4175
|
-
}
|
|
4176
4554
|
function hasValue$1(value) {
|
|
4177
4555
|
return value !== void 0 && value !== null && value !== "";
|
|
4178
4556
|
}
|
|
@@ -4348,7 +4726,7 @@ function mustHaveRequest() {
|
|
|
4348
4726
|
throw new Error("giftBarLib requires host request(url)");
|
|
4349
4727
|
}
|
|
4350
4728
|
}
|
|
4351
|
-
function create_fragment$
|
|
4729
|
+
function create_fragment$m(ctx) {
|
|
4352
4730
|
let div3;
|
|
4353
4731
|
let div2;
|
|
4354
4732
|
let div0;
|
|
@@ -4470,7 +4848,7 @@ function create_fragment$n(ctx) {
|
|
|
4470
4848
|
}
|
|
4471
4849
|
const defaultMessageText = "今日消费已超过最大限额,确定是否继续打赏?";
|
|
4472
4850
|
const giveUpConfirmMessage = "是否放弃首次充值限额设置";
|
|
4473
|
-
function instance$
|
|
4851
|
+
function instance$m($$self, $$props, $$invalidate) {
|
|
4474
4852
|
let isLimitSettingsError;
|
|
4475
4853
|
let messageText;
|
|
4476
4854
|
let cancelBtnText;
|
|
@@ -4564,7 +4942,7 @@ function instance$n($$self, $$props, $$invalidate) {
|
|
|
4564
4942
|
class ConsumeCheck extends SvelteComponent {
|
|
4565
4943
|
constructor(options2) {
|
|
4566
4944
|
super();
|
|
4567
|
-
init(this, options2, instance$
|
|
4945
|
+
init(this, options2, instance$m, create_fragment$m, safe_not_equal, { closeModal: 5, res: 6, url: 7 });
|
|
4568
4946
|
}
|
|
4569
4947
|
}
|
|
4570
4948
|
function showConsumeCheck({ res, url }) {
|
|
@@ -4864,7 +5242,7 @@ function create_each_block$7(ctx) {
|
|
|
4864
5242
|
}
|
|
4865
5243
|
};
|
|
4866
5244
|
}
|
|
4867
|
-
function create_fragment$
|
|
5245
|
+
function create_fragment$l(ctx) {
|
|
4868
5246
|
let div5;
|
|
4869
5247
|
let div4;
|
|
4870
5248
|
let div0;
|
|
@@ -5017,7 +5395,7 @@ function create_fragment$m(ctx) {
|
|
|
5017
5395
|
}
|
|
5018
5396
|
const click_handler_1 = () => {
|
|
5019
5397
|
};
|
|
5020
|
-
function instance$
|
|
5398
|
+
function instance$l($$self, $$props, $$invalidate) {
|
|
5021
5399
|
let btnText;
|
|
5022
5400
|
let { closeModal } = $$props;
|
|
5023
5401
|
let { gift } = $$props;
|
|
@@ -5115,7 +5493,7 @@ function instance$m($$self, $$props, $$invalidate) {
|
|
|
5115
5493
|
class PardonCard extends SvelteComponent {
|
|
5116
5494
|
constructor(options2) {
|
|
5117
5495
|
super();
|
|
5118
|
-
init(this, options2, instance$
|
|
5496
|
+
init(this, options2, instance$l, create_fragment$l, safe_not_equal, { closeModal: 9, gift: 10, cid: 11 });
|
|
5119
5497
|
}
|
|
5120
5498
|
}
|
|
5121
5499
|
let opening = false;
|
|
@@ -5152,7 +5530,7 @@ function create_if_block_1$f(ctx) {
|
|
|
5152
5530
|
/*title*/
|
|
5153
5531
|
ctx[0]
|
|
5154
5532
|
);
|
|
5155
|
-
attr(div, "class", "giftbar-confirm-title svelte-
|
|
5533
|
+
attr(div, "class", "giftbar-confirm-title svelte-1bi4u90");
|
|
5156
5534
|
},
|
|
5157
5535
|
m(target, anchor) {
|
|
5158
5536
|
insert(target, div, anchor);
|
|
@@ -5177,6 +5555,7 @@ function create_if_block$i(ctx) {
|
|
|
5177
5555
|
let div;
|
|
5178
5556
|
let i;
|
|
5179
5557
|
let t0;
|
|
5558
|
+
let span;
|
|
5180
5559
|
let t1;
|
|
5181
5560
|
let mounted;
|
|
5182
5561
|
let dispose;
|
|
@@ -5185,12 +5564,13 @@ function create_if_block$i(ctx) {
|
|
|
5185
5564
|
div = element("div");
|
|
5186
5565
|
i = element("i");
|
|
5187
5566
|
t0 = space();
|
|
5567
|
+
span = element("span");
|
|
5188
5568
|
t1 = text(
|
|
5189
5569
|
/*checkboxText*/
|
|
5190
5570
|
ctx[4]
|
|
5191
5571
|
);
|
|
5192
|
-
attr(i, "class", "svelte-
|
|
5193
|
-
attr(div, "class", "giftbar-confirm-choice svelte-
|
|
5572
|
+
attr(i, "class", "svelte-1bi4u90");
|
|
5573
|
+
attr(div, "class", "giftbar-confirm-choice svelte-1bi4u90");
|
|
5194
5574
|
attr(div, "role", "presentation");
|
|
5195
5575
|
toggle_class(
|
|
5196
5576
|
div,
|
|
@@ -5203,7 +5583,8 @@ function create_if_block$i(ctx) {
|
|
|
5203
5583
|
insert(target, div, anchor);
|
|
5204
5584
|
append(div, i);
|
|
5205
5585
|
append(div, t0);
|
|
5206
|
-
append(div,
|
|
5586
|
+
append(div, span);
|
|
5587
|
+
append(span, t1);
|
|
5207
5588
|
if (!mounted) {
|
|
5208
5589
|
dispose = listen(div, "click", stop_propagation(
|
|
5209
5590
|
/*click_handler_1*/
|
|
@@ -5238,7 +5619,7 @@ function create_if_block$i(ctx) {
|
|
|
5238
5619
|
}
|
|
5239
5620
|
};
|
|
5240
5621
|
}
|
|
5241
|
-
function create_fragment$
|
|
5622
|
+
function create_fragment$k(ctx) {
|
|
5242
5623
|
let div3;
|
|
5243
5624
|
let div2;
|
|
5244
5625
|
let t0;
|
|
@@ -5283,15 +5664,15 @@ function create_fragment$l(ctx) {
|
|
|
5283
5664
|
);
|
|
5284
5665
|
t5 = space();
|
|
5285
5666
|
if (if_block1) if_block1.c();
|
|
5286
|
-
attr(div0, "class", "giftbar-confirm-body svelte-
|
|
5667
|
+
attr(div0, "class", "giftbar-confirm-body svelte-1bi4u90");
|
|
5287
5668
|
attr(button0, "type", "button");
|
|
5288
|
-
attr(button0, "class", "giftbar-confirm-btn giftbar-confirm-cancel svelte-
|
|
5669
|
+
attr(button0, "class", "giftbar-confirm-btn giftbar-confirm-cancel svelte-1bi4u90");
|
|
5289
5670
|
attr(button1, "type", "button");
|
|
5290
|
-
attr(button1, "class", "giftbar-confirm-btn giftbar-confirm-ok svelte-
|
|
5291
|
-
attr(div1, "class", "giftbar-confirm-footer svelte-
|
|
5292
|
-
attr(div2, "class", "giftbar-confirm-dialog svelte-
|
|
5671
|
+
attr(button1, "class", "giftbar-confirm-btn giftbar-confirm-ok svelte-1bi4u90");
|
|
5672
|
+
attr(div1, "class", "giftbar-confirm-footer svelte-1bi4u90");
|
|
5673
|
+
attr(div2, "class", "giftbar-confirm-dialog svelte-1bi4u90");
|
|
5293
5674
|
attr(div2, "role", "presentation");
|
|
5294
|
-
attr(div3, "class", "giftbar-confirm-mask svelte-
|
|
5675
|
+
attr(div3, "class", "giftbar-confirm-mask svelte-1bi4u90");
|
|
5295
5676
|
attr(div3, "role", "presentation");
|
|
5296
5677
|
},
|
|
5297
5678
|
m(target, anchor) {
|
|
@@ -5313,18 +5694,14 @@ function create_fragment$l(ctx) {
|
|
|
5313
5694
|
if (if_block1) if_block1.m(div2, null);
|
|
5314
5695
|
if (!mounted) {
|
|
5315
5696
|
dispose = [
|
|
5316
|
-
listen(
|
|
5317
|
-
button0,
|
|
5318
|
-
"click",
|
|
5697
|
+
listen(button0, "click", stop_propagation(
|
|
5319
5698
|
/*onCancel*/
|
|
5320
5699
|
ctx[6]
|
|
5321
|
-
),
|
|
5322
|
-
listen(
|
|
5323
|
-
button1,
|
|
5324
|
-
"click",
|
|
5700
|
+
)),
|
|
5701
|
+
listen(button1, "click", stop_propagation(
|
|
5325
5702
|
/*onConfirm*/
|
|
5326
5703
|
ctx[7]
|
|
5327
|
-
),
|
|
5704
|
+
)),
|
|
5328
5705
|
listen(div2, "click", stop_propagation(
|
|
5329
5706
|
/*click_handler*/
|
|
5330
5707
|
ctx[9]
|
|
@@ -5397,7 +5774,7 @@ function create_fragment$l(ctx) {
|
|
|
5397
5774
|
}
|
|
5398
5775
|
};
|
|
5399
5776
|
}
|
|
5400
|
-
function instance$
|
|
5777
|
+
function instance$k($$self, $$props, $$invalidate) {
|
|
5401
5778
|
let { closeModal } = $$props;
|
|
5402
5779
|
let { title = "温馨提示" } = $$props;
|
|
5403
5780
|
let { message = "" } = $$props;
|
|
@@ -5405,11 +5782,20 @@ function instance$l($$self, $$props, $$invalidate) {
|
|
|
5405
5782
|
let { confirmText = "确认" } = $$props;
|
|
5406
5783
|
let { checkboxText = "" } = $$props;
|
|
5407
5784
|
let checked = false;
|
|
5785
|
+
function finish(ok) {
|
|
5786
|
+
const payload = { ok, checked };
|
|
5787
|
+
setTimeout(
|
|
5788
|
+
() => {
|
|
5789
|
+
closeModal && closeModal(null, payload);
|
|
5790
|
+
},
|
|
5791
|
+
0
|
|
5792
|
+
);
|
|
5793
|
+
}
|
|
5408
5794
|
function onCancel() {
|
|
5409
|
-
|
|
5795
|
+
finish(false);
|
|
5410
5796
|
}
|
|
5411
5797
|
function onConfirm() {
|
|
5412
|
-
|
|
5798
|
+
finish(true);
|
|
5413
5799
|
}
|
|
5414
5800
|
function click_handler(event) {
|
|
5415
5801
|
bubble.call(this, $$self, event);
|
|
@@ -5440,7 +5826,7 @@ function instance$l($$self, $$props, $$invalidate) {
|
|
|
5440
5826
|
class ConfirmDialog extends SvelteComponent {
|
|
5441
5827
|
constructor(options2) {
|
|
5442
5828
|
super();
|
|
5443
|
-
init(this, options2, instance$
|
|
5829
|
+
init(this, options2, instance$k, create_fragment$k, safe_not_equal, {
|
|
5444
5830
|
closeModal: 8,
|
|
5445
5831
|
title: 0,
|
|
5446
5832
|
message: 1,
|
|
@@ -5664,243 +6050,6 @@ async function payGiftAction({ gift, tabId, count, selectedUser, action, extra }
|
|
|
5664
6050
|
});
|
|
5665
6051
|
return requestPay(url, { gift, tabId, count, selectedUser, action, ctx, extra: extra || {} });
|
|
5666
6052
|
}
|
|
5667
|
-
function create_fragment$k(ctx) {
|
|
5668
|
-
let div1;
|
|
5669
|
-
let div0;
|
|
5670
|
-
let iframe;
|
|
5671
|
-
let iframe_src_value;
|
|
5672
|
-
let mounted;
|
|
5673
|
-
let dispose;
|
|
5674
|
-
return {
|
|
5675
|
-
c() {
|
|
5676
|
-
div1 = element("div");
|
|
5677
|
-
div0 = element("div");
|
|
5678
|
-
iframe = element("iframe");
|
|
5679
|
-
attr(iframe, "title", "blind-box");
|
|
5680
|
-
if (!src_url_equal(iframe.src, iframe_src_value = /*url*/
|
|
5681
|
-
ctx[0])) attr(iframe, "src", iframe_src_value);
|
|
5682
|
-
attr(
|
|
5683
|
-
iframe,
|
|
5684
|
-
"width",
|
|
5685
|
-
/*width*/
|
|
5686
|
-
ctx[1]
|
|
5687
|
-
);
|
|
5688
|
-
attr(
|
|
5689
|
-
iframe,
|
|
5690
|
-
"height",
|
|
5691
|
-
/*height*/
|
|
5692
|
-
ctx[2]
|
|
5693
|
-
);
|
|
5694
|
-
attr(iframe, "frameborder", "0");
|
|
5695
|
-
attr(
|
|
5696
|
-
iframe,
|
|
5697
|
-
"allow",
|
|
5698
|
-
/*iframeAllow*/
|
|
5699
|
-
ctx[4]
|
|
5700
|
-
);
|
|
5701
|
-
attr(iframe, "class", "svelte-1ma5gxj");
|
|
5702
|
-
attr(div0, "role", "presentation");
|
|
5703
|
-
attr(div0, "class", "giftbar-iframe-wrap svelte-1ma5gxj");
|
|
5704
|
-
set_style(
|
|
5705
|
-
div0,
|
|
5706
|
-
"width",
|
|
5707
|
-
/*width*/
|
|
5708
|
-
ctx[1] + "px"
|
|
5709
|
-
);
|
|
5710
|
-
set_style(
|
|
5711
|
-
div0,
|
|
5712
|
-
"height",
|
|
5713
|
-
/*height*/
|
|
5714
|
-
ctx[2] + "px"
|
|
5715
|
-
);
|
|
5716
|
-
attr(
|
|
5717
|
-
div1,
|
|
5718
|
-
"id",
|
|
5719
|
-
/*iframeId*/
|
|
5720
|
-
ctx[3]
|
|
5721
|
-
);
|
|
5722
|
-
attr(div1, "class", "giftbar-iframe-mask svelte-1ma5gxj");
|
|
5723
|
-
attr(div1, "role", "presentation");
|
|
5724
|
-
},
|
|
5725
|
-
m(target, anchor) {
|
|
5726
|
-
insert(target, div1, anchor);
|
|
5727
|
-
append(div1, div0);
|
|
5728
|
-
append(div0, iframe);
|
|
5729
|
-
if (!mounted) {
|
|
5730
|
-
dispose = [
|
|
5731
|
-
listen(div0, "click", stop_propagation(
|
|
5732
|
-
/*click_handler*/
|
|
5733
|
-
ctx[8]
|
|
5734
|
-
)),
|
|
5735
|
-
listen(div1, "click", stop_propagation(
|
|
5736
|
-
/*handleClose*/
|
|
5737
|
-
ctx[5]
|
|
5738
|
-
))
|
|
5739
|
-
];
|
|
5740
|
-
mounted = true;
|
|
5741
|
-
}
|
|
5742
|
-
},
|
|
5743
|
-
p(ctx2, [dirty]) {
|
|
5744
|
-
if (dirty & /*url*/
|
|
5745
|
-
1 && !src_url_equal(iframe.src, iframe_src_value = /*url*/
|
|
5746
|
-
ctx2[0])) {
|
|
5747
|
-
attr(iframe, "src", iframe_src_value);
|
|
5748
|
-
}
|
|
5749
|
-
if (dirty & /*width*/
|
|
5750
|
-
2) {
|
|
5751
|
-
attr(
|
|
5752
|
-
iframe,
|
|
5753
|
-
"width",
|
|
5754
|
-
/*width*/
|
|
5755
|
-
ctx2[1]
|
|
5756
|
-
);
|
|
5757
|
-
}
|
|
5758
|
-
if (dirty & /*height*/
|
|
5759
|
-
4) {
|
|
5760
|
-
attr(
|
|
5761
|
-
iframe,
|
|
5762
|
-
"height",
|
|
5763
|
-
/*height*/
|
|
5764
|
-
ctx2[2]
|
|
5765
|
-
);
|
|
5766
|
-
}
|
|
5767
|
-
if (dirty & /*iframeAllow*/
|
|
5768
|
-
16) {
|
|
5769
|
-
attr(
|
|
5770
|
-
iframe,
|
|
5771
|
-
"allow",
|
|
5772
|
-
/*iframeAllow*/
|
|
5773
|
-
ctx2[4]
|
|
5774
|
-
);
|
|
5775
|
-
}
|
|
5776
|
-
if (dirty & /*width*/
|
|
5777
|
-
2) {
|
|
5778
|
-
set_style(
|
|
5779
|
-
div0,
|
|
5780
|
-
"width",
|
|
5781
|
-
/*width*/
|
|
5782
|
-
ctx2[1] + "px"
|
|
5783
|
-
);
|
|
5784
|
-
}
|
|
5785
|
-
if (dirty & /*height*/
|
|
5786
|
-
4) {
|
|
5787
|
-
set_style(
|
|
5788
|
-
div0,
|
|
5789
|
-
"height",
|
|
5790
|
-
/*height*/
|
|
5791
|
-
ctx2[2] + "px"
|
|
5792
|
-
);
|
|
5793
|
-
}
|
|
5794
|
-
if (dirty & /*iframeId*/
|
|
5795
|
-
8) {
|
|
5796
|
-
attr(
|
|
5797
|
-
div1,
|
|
5798
|
-
"id",
|
|
5799
|
-
/*iframeId*/
|
|
5800
|
-
ctx2[3]
|
|
5801
|
-
);
|
|
5802
|
-
}
|
|
5803
|
-
},
|
|
5804
|
-
i: noop,
|
|
5805
|
-
o: noop,
|
|
5806
|
-
d(detaching) {
|
|
5807
|
-
if (detaching) {
|
|
5808
|
-
detach(div1);
|
|
5809
|
-
}
|
|
5810
|
-
mounted = false;
|
|
5811
|
-
run_all(dispose);
|
|
5812
|
-
}
|
|
5813
|
-
};
|
|
5814
|
-
}
|
|
5815
|
-
function instance$k($$self, $$props, $$invalidate) {
|
|
5816
|
-
let iframeAllow;
|
|
5817
|
-
let { closeModal } = $$props;
|
|
5818
|
-
let { url = "" } = $$props;
|
|
5819
|
-
let { width = 400 } = $$props;
|
|
5820
|
-
let { height = 585 } = $$props;
|
|
5821
|
-
let { onRefreshHaveGift = null } = $$props;
|
|
5822
|
-
let { iframeId = "" } = $$props;
|
|
5823
|
-
let closed = false;
|
|
5824
|
-
function handleClose() {
|
|
5825
|
-
if (closed) {
|
|
5826
|
-
return;
|
|
5827
|
-
}
|
|
5828
|
-
closed = true;
|
|
5829
|
-
onRefreshHaveGift && onRefreshHaveGift();
|
|
5830
|
-
closeModal && closeModal(null, true);
|
|
5831
|
-
}
|
|
5832
|
-
function onMessage(event) {
|
|
5833
|
-
const data = event.data || {};
|
|
5834
|
-
if (data.closeIframe) {
|
|
5835
|
-
if (data.id && iframeId && String(data.id) !== String(iframeId)) {
|
|
5836
|
-
return;
|
|
5837
|
-
}
|
|
5838
|
-
handleClose();
|
|
5839
|
-
return;
|
|
5840
|
-
}
|
|
5841
|
-
if (data.channel === "common_iframe" && data.type === "refreshHaveGift") {
|
|
5842
|
-
onRefreshHaveGift && onRefreshHaveGift();
|
|
5843
|
-
}
|
|
5844
|
-
}
|
|
5845
|
-
onMount(() => {
|
|
5846
|
-
window.addEventListener("message", onMessage);
|
|
5847
|
-
});
|
|
5848
|
-
onDestroy(() => {
|
|
5849
|
-
window.removeEventListener("message", onMessage);
|
|
5850
|
-
});
|
|
5851
|
-
function click_handler(event) {
|
|
5852
|
-
bubble.call(this, $$self, event);
|
|
5853
|
-
}
|
|
5854
|
-
$$self.$$set = ($$props2) => {
|
|
5855
|
-
if ("closeModal" in $$props2) $$invalidate(6, closeModal = $$props2.closeModal);
|
|
5856
|
-
if ("url" in $$props2) $$invalidate(0, url = $$props2.url);
|
|
5857
|
-
if ("width" in $$props2) $$invalidate(1, width = $$props2.width);
|
|
5858
|
-
if ("height" in $$props2) $$invalidate(2, height = $$props2.height);
|
|
5859
|
-
if ("onRefreshHaveGift" in $$props2) $$invalidate(7, onRefreshHaveGift = $$props2.onRefreshHaveGift);
|
|
5860
|
-
if ("iframeId" in $$props2) $$invalidate(3, iframeId = $$props2.iframeId);
|
|
5861
|
-
};
|
|
5862
|
-
$$invalidate(4, iframeAllow = options.isChatTest ? "local-network-access 'src'" : void 0);
|
|
5863
|
-
return [
|
|
5864
|
-
url,
|
|
5865
|
-
width,
|
|
5866
|
-
height,
|
|
5867
|
-
iframeId,
|
|
5868
|
-
iframeAllow,
|
|
5869
|
-
handleClose,
|
|
5870
|
-
closeModal,
|
|
5871
|
-
onRefreshHaveGift,
|
|
5872
|
-
click_handler
|
|
5873
|
-
];
|
|
5874
|
-
}
|
|
5875
|
-
class IframeModal extends SvelteComponent {
|
|
5876
|
-
constructor(options2) {
|
|
5877
|
-
super();
|
|
5878
|
-
init(this, options2, instance$k, create_fragment$k, safe_not_equal, {
|
|
5879
|
-
closeModal: 6,
|
|
5880
|
-
url: 0,
|
|
5881
|
-
width: 1,
|
|
5882
|
-
height: 2,
|
|
5883
|
-
onRefreshHaveGift: 7,
|
|
5884
|
-
iframeId: 3
|
|
5885
|
-
});
|
|
5886
|
-
}
|
|
5887
|
-
}
|
|
5888
|
-
function showIframeBlindBox({ cid, giftId, navid, onRefreshHaveGift }) {
|
|
5889
|
-
const iframeId = "iframe_" + Date.now();
|
|
5890
|
-
const base = getCrystalBlindBoxUrl(cid, giftId, navid);
|
|
5891
|
-
const url = base + (base.indexOf("?") >= 0 ? "&" : "?") + "eleId=" + encodeURIComponent(iframeId);
|
|
5892
|
-
return createModal(
|
|
5893
|
-
IframeModal,
|
|
5894
|
-
{
|
|
5895
|
-
url,
|
|
5896
|
-
iframeId,
|
|
5897
|
-
width: 400,
|
|
5898
|
-
height: 585,
|
|
5899
|
-
onRefreshHaveGift
|
|
5900
|
-
},
|
|
5901
|
-
document.body
|
|
5902
|
-
);
|
|
5903
|
-
}
|
|
5904
6053
|
class SvgaPlayer {
|
|
5905
6054
|
constructor() {
|
|
5906
6055
|
this.instance = null;
|
|
@@ -18903,7 +19052,11 @@ function create_if_block(ctx) {
|
|
|
18903
19052
|
),
|
|
18904
19053
|
onClickItem: (
|
|
18905
19054
|
/*chooseGift*/
|
|
18906
|
-
ctx[
|
|
19055
|
+
ctx[19]
|
|
19056
|
+
),
|
|
19057
|
+
onOpenHelp: (
|
|
19058
|
+
/*openGiftHelp*/
|
|
19059
|
+
ctx[20]
|
|
18907
19060
|
)
|
|
18908
19061
|
}
|
|
18909
19062
|
});
|
|
@@ -18943,16 +19096,16 @@ function create_if_block(ctx) {
|
|
|
18943
19096
|
ctx[12]
|
|
18944
19097
|
),
|
|
18945
19098
|
onSelectUser: (
|
|
18946
|
-
/*
|
|
18947
|
-
ctx[
|
|
19099
|
+
/*chooseUser*/
|
|
19100
|
+
ctx[18]
|
|
18948
19101
|
),
|
|
18949
19102
|
onCountChange: (
|
|
18950
|
-
/*
|
|
18951
|
-
ctx[
|
|
19103
|
+
/*func*/
|
|
19104
|
+
ctx[31]
|
|
18952
19105
|
),
|
|
18953
19106
|
onAction: (
|
|
18954
19107
|
/*handleAction*/
|
|
18955
|
-
ctx[
|
|
19108
|
+
ctx[21]
|
|
18956
19109
|
)
|
|
18957
19110
|
}
|
|
18958
19111
|
});
|
|
@@ -18995,7 +19148,7 @@ function create_if_block(ctx) {
|
|
|
18995
19148
|
if (!mounted) {
|
|
18996
19149
|
dispose = listen(div1, "click", stop_propagation(
|
|
18997
19150
|
/*click_handler*/
|
|
18998
|
-
ctx[
|
|
19151
|
+
ctx[30]
|
|
18999
19152
|
));
|
|
19000
19153
|
mounted = true;
|
|
19001
19154
|
}
|
|
@@ -19087,12 +19240,9 @@ function create_if_block(ctx) {
|
|
|
19087
19240
|
if (dirty[0] & /*selectNum*/
|
|
19088
19241
|
4096) giftfooter_changes.selectNum = /*selectNum*/
|
|
19089
19242
|
ctx2[12];
|
|
19090
|
-
if (dirty[0] & /*selectUser*/
|
|
19091
|
-
256) giftfooter_changes.onSelectUser = /*func*/
|
|
19092
|
-
ctx2[29];
|
|
19093
19243
|
if (dirty[0] & /*selectNum*/
|
|
19094
|
-
4096) giftfooter_changes.onCountChange = /*
|
|
19095
|
-
ctx2[
|
|
19244
|
+
4096) giftfooter_changes.onCountChange = /*func*/
|
|
19245
|
+
ctx2[31];
|
|
19096
19246
|
giftfooter.$set(giftfooter_changes);
|
|
19097
19247
|
if (!current || dirty[0] & /*isShow*/
|
|
19098
19248
|
8) {
|
|
@@ -19339,7 +19489,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19339
19489
|
}
|
|
19340
19490
|
function applyUpdate(payload) {
|
|
19341
19491
|
if (payload && payload.extras) {
|
|
19342
|
-
$$invalidate(
|
|
19492
|
+
$$invalidate(29, extras = payload.extras);
|
|
19343
19493
|
}
|
|
19344
19494
|
}
|
|
19345
19495
|
onMount(() => {
|
|
@@ -19502,7 +19652,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19502
19652
|
const response = await options.request(giftListsUrl(cid, 0));
|
|
19503
19653
|
applyTabList(response);
|
|
19504
19654
|
if (response && response.error === 0) {
|
|
19505
|
-
$$invalidate(
|
|
19655
|
+
$$invalidate(28, isSend = response.is_send);
|
|
19506
19656
|
applyBanner(response);
|
|
19507
19657
|
}
|
|
19508
19658
|
}
|
|
@@ -19521,7 +19671,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19521
19671
|
const response = await options.request(giftListsUrl(cid, activeTabId));
|
|
19522
19672
|
if (response && response.error === 0) {
|
|
19523
19673
|
applyTabList(response);
|
|
19524
|
-
$$invalidate(
|
|
19674
|
+
$$invalidate(28, isSend = response.is_send);
|
|
19525
19675
|
const data = response.data || [];
|
|
19526
19676
|
decorateShop(data);
|
|
19527
19677
|
$$invalidate(6, giftList = data);
|
|
@@ -19578,6 +19728,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19578
19728
|
updateBaoguo();
|
|
19579
19729
|
}
|
|
19580
19730
|
}
|
|
19731
|
+
function chooseUser(user) {
|
|
19732
|
+
$$invalidate(8, selectUser = user);
|
|
19733
|
+
if (typeof options.onSelectUser === "function") {
|
|
19734
|
+
options.onSelectUser(user);
|
|
19735
|
+
}
|
|
19736
|
+
}
|
|
19581
19737
|
function chooseGift(giftItem) {
|
|
19582
19738
|
resetCount();
|
|
19583
19739
|
if (Number(giftItem && giftItem.type) === 37) {
|
|
@@ -19586,6 +19742,13 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19586
19742
|
$$invalidate(1, selectGiftItem = giftItem);
|
|
19587
19743
|
applySelectEffect(giftItem);
|
|
19588
19744
|
}
|
|
19745
|
+
function openGiftHelp(gift) {
|
|
19746
|
+
const url = gift && gift.explain_url;
|
|
19747
|
+
if (!url) {
|
|
19748
|
+
return;
|
|
19749
|
+
}
|
|
19750
|
+
showExplainIframe(url);
|
|
19751
|
+
}
|
|
19589
19752
|
async function openIframe(giftItem) {
|
|
19590
19753
|
const ctx = await options.getPayContext({
|
|
19591
19754
|
gift: giftItem,
|
|
@@ -19686,11 +19849,10 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19686
19849
|
function click_handler(event) {
|
|
19687
19850
|
bubble.call(this, $$self, event);
|
|
19688
19851
|
}
|
|
19689
|
-
const func = (
|
|
19690
|
-
const func_1 = (num) => $$invalidate(12, selectNum = num);
|
|
19852
|
+
const func = (num) => $$invalidate(12, selectNum = num);
|
|
19691
19853
|
$$self.$$.update = () => {
|
|
19692
19854
|
if ($$self.$$.dirty[0] & /*selectGiftItem, activeTabId, isSend*/
|
|
19693
|
-
|
|
19855
|
+
268435459) {
|
|
19694
19856
|
$$invalidate(2, ui = getSelectUiState(selectGiftItem, activeTabId, isSend));
|
|
19695
19857
|
}
|
|
19696
19858
|
if ($$self.$$.dirty[0] & /*selectGiftItem, activeTabId*/
|
|
@@ -19702,7 +19864,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19702
19864
|
$$invalidate(15, emptyImg = isPackageTab(activeTabId) ? getEmptyBagImg() : "");
|
|
19703
19865
|
}
|
|
19704
19866
|
if ($$self.$$.dirty[0] & /*extras*/
|
|
19705
|
-
|
|
19867
|
+
536870912) {
|
|
19706
19868
|
$$invalidate(14, jingpai = extras[GIFT_BAR_EXTRA.JINGPAI]);
|
|
19707
19869
|
}
|
|
19708
19870
|
if ($$self.$$.dirty[0] & /*ui*/
|
|
@@ -19731,7 +19893,9 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19731
19893
|
emptyImg,
|
|
19732
19894
|
tip,
|
|
19733
19895
|
switchTab,
|
|
19896
|
+
chooseUser,
|
|
19734
19897
|
chooseGift,
|
|
19898
|
+
openGiftHelp,
|
|
19735
19899
|
handleAction,
|
|
19736
19900
|
show,
|
|
19737
19901
|
hide,
|
|
@@ -19742,8 +19906,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19742
19906
|
isSend,
|
|
19743
19907
|
extras,
|
|
19744
19908
|
click_handler,
|
|
19745
|
-
func
|
|
19746
|
-
func_1
|
|
19909
|
+
func
|
|
19747
19910
|
];
|
|
19748
19911
|
}
|
|
19749
19912
|
class GiftPanel extends SvelteComponent {
|
|
@@ -19756,34 +19919,34 @@ class GiftPanel extends SvelteComponent {
|
|
|
19756
19919
|
create_fragment,
|
|
19757
19920
|
safe_not_equal,
|
|
19758
19921
|
{
|
|
19759
|
-
show:
|
|
19760
|
-
hide:
|
|
19761
|
-
reset:
|
|
19762
|
-
updateDiamond:
|
|
19763
|
-
updateBaoguo:
|
|
19764
|
-
isShowing:
|
|
19922
|
+
show: 22,
|
|
19923
|
+
hide: 23,
|
|
19924
|
+
reset: 24,
|
|
19925
|
+
updateDiamond: 25,
|
|
19926
|
+
updateBaoguo: 26,
|
|
19927
|
+
isShowing: 27
|
|
19765
19928
|
},
|
|
19766
19929
|
null,
|
|
19767
19930
|
[-1, -1]
|
|
19768
19931
|
);
|
|
19769
19932
|
}
|
|
19770
19933
|
get show() {
|
|
19771
|
-
return this.$$.ctx[
|
|
19934
|
+
return this.$$.ctx[22];
|
|
19772
19935
|
}
|
|
19773
19936
|
get hide() {
|
|
19774
|
-
return this.$$.ctx[
|
|
19937
|
+
return this.$$.ctx[23];
|
|
19775
19938
|
}
|
|
19776
19939
|
get reset() {
|
|
19777
|
-
return this.$$.ctx[
|
|
19940
|
+
return this.$$.ctx[24];
|
|
19778
19941
|
}
|
|
19779
19942
|
get updateDiamond() {
|
|
19780
|
-
return this.$$.ctx[
|
|
19943
|
+
return this.$$.ctx[25];
|
|
19781
19944
|
}
|
|
19782
19945
|
get updateBaoguo() {
|
|
19783
|
-
return this.$$.ctx[
|
|
19946
|
+
return this.$$.ctx[26];
|
|
19784
19947
|
}
|
|
19785
19948
|
get isShowing() {
|
|
19786
|
-
return this.$$.ctx[
|
|
19949
|
+
return this.$$.ctx[27];
|
|
19787
19950
|
}
|
|
19788
19951
|
}
|
|
19789
19952
|
function merge(target, source) {
|