ml-country-selector
Version:
Lightweight country selector with local/server search, pinyin and i18n, ESM/UMD.
1 lines • 55 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).countrySelector={})}(this,(function(e){"use strict";function t(e,t,a,l){return new(a||(a=Promise))((function(n,i){function r(e){try{s(l.next(e))}catch(e){i(e)}}function o(e){try{s(l.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,o)}s((l=l.apply(e,t||[])).next())}))}var a={$id_prefix:+new Date,searchclearIconBase64:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAMAAAC7m5rvAAAAPFBMVEUAAAC5ubm5ubm8vLy7u7u4uLi4uLi4uLi4uLi5ubm5ubm8vLy5ubm4uLi5ubm4uLj////Q0NDj4+PHx8fRXkPMAAAAD3RSTlMA8alEOOfZw7+DbSKZkJrJk2NOAAAA9klEQVRIx+2Wyw6FIAxEBXyLDuj//+tN7kKEApJZOytFT0qm0Lb71KZ+0fOo1DjrpW9ljB3w0GBNS6AJQtNbyE0jK71V96dQkKrsdEVFa4naUdVOxCrGM3iVyXio3jEl/QzOXwhKFrTI8v3pdD6mvDvv5zTvU6Cc8zHlAjcV/Licizn/X7jyrhzJb77wChthAwSXpTAkhghOUNKUBRkuS2FJkia5hJKpm5HjchTmBzZCcAUK4wNTEFyBgiIxcpOkJXQC+HTzh4s/yp0lLg5xTYmiwJQgruCR5ZUr5lzr4BoV3xb5Jsy3fH7AkDJHPM4chhqePjXpB8sjWI9C6iUlAAAAAElFTkSuQmCC",searchIconBase64:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAMAAAC7m5rvAAAAdVBMVEUAAACGhoaHh4eampqGhoaFhYWGhoaJiYmJiYmGhoaMjIyLi4uFhYWGhoaHh4eGhoaHh4eKioqGhoaFh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7u7u4uLgU+5SXAAAALXRSTlMA/OwI+PFLzpQEoQ3XLxoVKODDtKpxYlQ25dO5dtrIvo6EempbQhEj3phPPSCtfWVkAAACNElEQVRo3szYV3LCMBSF4Su5V2zAmN5SSCBn/9vLDCWTGYqbdK1vBf/DkR4uNRQl5T7ceHHuCFvm8/XCL9zMIn6HSfiFR4TnlwPiY5XjGV6K/RNxCNzQQQ2z7ZQ0S3cSta3edA4oC200Ine65pOMBBqzfR05g2+04ywtUisoHLS2ckmlaYxORikpsxfoSLqkRrqBAr6S5RwllJhn1FkhoIjzQR1toY79Tl1YY6gkltReNIRiPrVlDaFcSO0EI2gQBtRGCC3GbWp8XJhQM4E2I4uaSWxU4KuJYui0aFQzhl6byIjBXA1r13xKVGCs+QaD9SfVMRXg4NWpCTzw8AYmrPdmXl0Tg02c0mslGK0qajxw+vqhF1zwyl/VLMAsP9AzKdjNMnpiCX6zzIj5XsmEHknAprpmh37IKd1boyfOfU0k0BfnxPDjtT9SbMHovsaAh/3HdumfwAaX6poDeiaOZuz3QpR0U6B34p2ufBjgVrOACSZ0NoQJxNs5Zg4znGtyGKIgIglTLIlsGGP/27y91QAMBSEQtYB/tfyggZwqaNLH3YUZ62aox0S9wNSnTf30qOOAOiipEYIarqixkxrIqVXFWuKo9ZZa/KlIxAqLqBiNChit6JUKpam43ioyqIrHKr+oWtAqTKkqmSrZLfzAAjMoZMWCeSzMiQLALDTOggYtnNICTSkE14KTLWzbAtox1N+SICw9xBJnMKXIkq0sDQ0T9DB1EZM6Md0VE4F3RVGkL/J4ARqnjdkffEmzAAAAAElFTkSuQmCC",polyfillSrc:"",apisCfg:{tjCountryApi:"https://1111",searchCountryApi:"https://222"},countryData:[{value:"Angola",label:"安哥拉"},{value:"Afghanistan",label:"阿富汗"},{value:"Albania",label:"阿尔巴尼亚"},{value:"Algeria",label:"阿尔及利亚"},{value:"Andorra",label:"安道尔共和国"},{value:"Anguilla",label:"安圭拉岛"},{value:"Antigua and Barbuda",label:"安提瓜和巴布达"},{value:"Argentina",label:"阿根廷"},{value:"Armenia",label:"亚美尼亚"},{value:"Ascension",label:"阿森松"},{value:"Australia",label:"澳大利亚"},{value:"Austria",label:"奥地利"},{value:"Azerbaijan",label:"阿塞拜疆"},{value:"Bahamas",label:"巴哈马"},{value:"Bahrain",label:"巴林"},{value:"Bangladesh",label:"孟加拉国"},{value:"Barbados",label:"巴巴多斯"},{value:"Belarus",label:"白俄罗斯"},{value:"Belgium",label:"比利时"},{value:"Belize",label:"伯利兹"},{value:"Benin",label:"贝宁"},{value:"Bermuda Is",label:"百慕大群岛"},{value:"Bolivia",label:"玻利维亚"},{value:"Botswana",label:"博茨瓦纳"},{value:"Brazil",label:"巴西"},{value:"Brunei",label:"文莱"},{value:"Bulgaria",label:"保加利亚"},{value:"Burkina Faso",label:"布基纳法索"},{value:"Burma",label:"缅甸"},{value:"Burundi",label:"布隆迪"},{value:"Cameroon",label:"喀麦隆"},{value:"Canada",label:"加拿大"},{value:"Cayman Is",label:"开曼群岛"},{value:"Central African Republic",label:"中非共和国"},{value:"Chad",label:"乍得"},{value:"Chile",label:"智利"},{value:"China",label:"中国",disabled:!0},{value:"Colombia",label:"哥伦比亚"},{value:"Congo",label:"刚果"},{value:"Cook Is",label:"库克群岛"},{value:"Costa Rica",label:"哥斯达黎加"},{value:"Cuba",label:"古巴"},{value:"Cyprus",label:"塞浦路斯"},{value:"Czech Republic",label:"捷克"},{value:"Denmark",label:"丹麦"},{value:"Djibouti",label:"吉布提"},{value:"Dominica Rep",label:"多米尼加共和国"},{value:"Ecuador",label:"厄瓜多尔"},{value:"Egypt",label:"埃及"},{value:"EI Salvador",label:"萨尔瓦多"},{value:"Estonia",label:"爱沙尼亚"},{value:"Ethiopia",label:"埃塞俄比亚"},{value:"Fiji",label:"斐济"},{value:"Finland",label:"芬兰"},{value:"France",label:"法国"},{value:"French Guiana",label:"法属圭亚那"},{value:"French Polynesia",label:"法属玻利尼西亚"},{value:"Gabon",label:"加蓬"},{value:"Gambia",label:"冈比亚"},{value:"Georgia",label:"格鲁吉亚"},{value:"Ghana",label:"加纳"},{value:"Gibraltar",label:"直布罗陀"},{value:"Greece",label:"希腊"},{value:"Grenada",label:"格林纳达"},{value:"Guam",label:"关岛"},{value:"Guatemala",label:"危地马拉"},{value:"Guinea",label:"几内亚"},{value:"Guyana",label:"圭亚那"},{value:"Haiti",label:"海地"},{value:"Honduras",label:"洪都拉斯"},{value:"Hungary",label:"匈牙利"},{value:"Iceland",label:"冰岛"},{value:"India",label:"印度"},{value:"Indonesia",label:"印度尼西亚"},{value:"Iran",label:"伊朗"},{value:"Iraq",label:"伊拉克"},{value:"Ireland",label:"爱尔兰"},{value:"Israel",label:"以色列"},{value:"Italy",label:"意大利"},{value:"Ivory Coast",label:"科特迪瓦"},{value:"Jamaica",label:"牙买加"},{value:"Japan",label:"日本"},{value:"Jordan",label:"约旦"},{value:"Kampuchea (Cambodia )",label:"柬埔寨"},{value:"Kazakstan",label:"哈萨克斯坦"},{value:"Kenya",label:"肯尼亚"},{value:"Korea",label:"韩国"},{value:"Kuwait",label:"科威特"},{value:"Kyrgyzstan",label:"吉尔吉斯坦"},{value:"Laos",label:"老挝"},{value:"Latvia",label:"拉脱维亚"},{value:"Lebanon",label:"黎巴嫩"},{value:"Lesotho",label:"莱索托"},{value:"Liberia",label:"利比里亚"},{value:"Libya",label:"利比亚"},{value:"Liechtenstein",label:"列支敦士登"},{value:"Lithuania",label:"立陶宛"},{value:"Luxembourg",label:"卢森堡"},{value:"Madagascar",label:"马达加斯加"},{value:"Malawi",label:"马拉维"},{value:"Malaysia",label:"马来西亚"},{value:"Maldives",label:"马尔代夫"},{value:"Mali",label:"马里"},{value:"Malta",label:"马耳他"},{value:"Mariana Is",label:"马里亚那群岛"},{value:"Martinique",label:"马提尼克"},{value:"Mauritius",label:"毛里求斯"},{value:"Mexico",label:"墨西哥"},{value:"Moldova",label:"摩尔多瓦"},{value:"Monaco",label:"摩纳哥"},{value:"Mongolia",label:"蒙古"},{value:"Montserrat Is",label:"蒙特塞拉特岛"},{value:"Morocco",label:"摩洛哥"},{value:"Mozambique",label:"莫桑比克"},{value:"Namibia",label:"纳米比亚"},{value:"Nauru",label:"瑙鲁"},{value:"Nepal",label:"尼泊尔"},{value:"Netheriands Antilles",label:"荷属安的列斯"},{value:"Netherlands",label:"荷兰"},{value:"New Zealand",label:"新西兰"},{value:"Nicaragua",label:"尼加拉瓜"},{value:"Niger",label:"尼日尔"},{value:"Nigeria",label:"尼日利亚"},{value:"North Korea",label:"朝鲜"},{value:"Norway",label:"挪威"},{value:"Oman",label:"阿曼"},{value:"Pakistan",label:"巴基斯坦"},{value:"Panama",label:"巴拿马"},{value:"Papua New Cuinea",label:"巴布亚新几内亚"},{value:"Paraguay",label:"巴拉圭"},{value:"Peru",label:"秘鲁"},{value:"Philippines",label:"菲律宾"},{value:"Poland",label:"波兰"},{value:"Portugal",label:"葡萄牙"},{value:"Puerto Rico",label:"波多黎各"},{value:"Qatar",label:"卡塔尔"},{value:"Reunion",label:"留尼旺"},{value:"Romania",label:"罗马尼亚"},{value:"Russia",label:"俄罗斯"},{value:"Saint Lueia",label:"圣卢西亚"},{value:"Saint Vincent",label:"圣文森特岛"},{value:"Samoa Eastern",label:"东萨摩亚(美)"},{value:"Samoa Western",label:"西萨摩亚"},{value:"San Marino",label:"圣马力诺"},{value:"Sao Tome and Principe",label:"圣多美和普林西比"},{value:"Saudi Arabia",label:"沙特阿拉伯"},{value:"Senegal",label:"塞内加尔"},{value:"Seychelles",label:"塞舌尔"},{value:"Sierra Leone",label:"塞拉利昂"},{value:"Singapore",label:"新加坡"},{value:"Slovakia",label:"斯洛伐克"},{value:"Slovenia",label:"斯洛文尼亚"},{value:"Solomon Is",label:"所罗门群岛"},{value:"Somali",label:"索马里"},{value:"South Africa",label:"南非"},{value:"Spain",label:"西班牙"},{value:"SriLanka",label:"斯里兰卡"},{value:"St.Lucia",label:"圣卢西亚"},{value:"St.Vincent",label:"圣文森特"},{value:"Sudan",label:"苏丹"},{value:"Suriname",label:"苏里南"},{value:"Swaziland",label:"斯威士兰"},{value:"Sweden",label:"瑞典"},{value:"Switzerland",label:"瑞士"},{value:"Syria",label:"叙利亚"},{value:"Tajikstan",label:"塔吉克斯坦"},{value:"Tanzania",label:"坦桑尼亚"},{value:"Thailand",label:"泰国"},{value:"Togo",label:"多哥"},{value:"Tonga",label:"汤加"},{value:"Trinidad and Tobago",label:"特立尼达和多巴哥"},{value:"Tunisia",label:"突尼斯"},{value:"Turkey",label:"土耳其"},{value:"Turkmenistan",label:"土库曼斯坦"},{value:"Uganda",label:"乌干达"},{value:"Ukraine",label:"乌克兰"},{value:"United Arab Emirates",label:"阿拉伯联合酋长国"},{value:"United Kiongdom",label:"英国"},{value:"United States of America",label:"美国"},{value:"Uruguay",label:"乌拉圭"},{value:"Uzbekistan",label:"乌兹别克斯坦"},{value:"Venezuela",label:"委内瑞拉"},{value:"Vietnam",label:"越南"},{value:"Yemen",label:"也门"},{value:"Yugoslavia",label:"南斯拉夫"},{value:"Zimbabwe",label:"津巴布韦"},{value:"Zaire",label:"扎伊尔"},{value:"Zambia",label:"赞比亚"}]};class l{constructor(){}jsonp(e){let t=document.createElement("script"),a="";for(let t in e.data)a+="&"+t+"="+e.data[t];let l="myjsonp"+Math.random().toString().replace(".","");window[l]=e.success,t.src=e.url+"?callback="+l+a,document.body.appendChild(t),t.onload=function(){document.body.removeChild(t)}}throttle(e,t=500){let a,l=!0;return(...n)=>{let i=this;l&&(e.apply(i,n),l=!1),a||(a=setTimeout((function(){e.apply(i,n),a=null}),t))}}debounce(e,t){let a;return l=>{let n=this;a&&clearTimeout(a),a=setTimeout((function(){e.apply(n,l),a=null}),t||500)}}addEventHandler(e,t,a){e&&(e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a)}removeEventHandler(e,t,a){e&&(e.addEventListener?e.removeEventListener(t,a,!1):e.detachEvent?e.detachEvent("on"+t,a):e["on"+t]=null)}createScriptTag(e,t,a){e.setAttribute("type","text/javascript"),a&&e.setAttribute("charset",a),e.setAttribute("src",t),document.getElementsByTagName("head")[0].appendChild(e)}removeScriptTag(e){if(e.clearAttributes)e.clearAttributes();else for(const t in e)e.hasOwnProperty(t)&&delete e[t];e&&e.parentNode&&e.parentNode.removeChild(e),e=null}hasClassName(e,t){return!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}addClass(e,t){if(!this.hasClassName(e,t)){let a=""===e.className?"":" ";e.className+=a+t}return this}removeClass(e,t){return this.hasClassName(e,t)&&(e.className.indexOf(" "+t+" ")>=0?e.className=e.className.replace(new RegExp("(\\s|^)"+t+"(\\s|$)")," "):e.className=e.className.replace(new RegExp("(\\s|^)"+t+"(\\s|$)"),"")),this}stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}buildQuery(e){if("string"==typeof e)return e;if("object"==typeof e){let t=[];for(const a in e)if(e.hasOwnProperty(a)){let l=e[a];if(l){t.length&&t.push("&");let e="boolean"==typeof l?l?"1":"0":l.toString();t.push(a,"=",e)}}return t.join("")}return null}appendQuery(e,t){if("string"==typeof(t=this.buildQuery(t))){e+=(/\?/g.test(e)?"&":"?")+t}return t}getEleById(e){if(!a.$id_prefix)return null;let t=String(a.$id_prefix)+String(e),l=document.getElementById(t);return l||null}IEVersion(){let e=navigator.userAgent,t=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1,a=e.indexOf("Edge")>-1&&!t,l=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1;if(t){new RegExp("MSIE (\\d+\\.\\d+);").test(e);let t=parseFloat(RegExp.$1);return 7==t?7:8==t?8:9==t?9:10==t?10:6}return a?"edge":l?11:-1}getRaw(e){let t=new RegExp("(^| )"+e+"=([^;]*)(;|$)").exec(document.cookie);return t&&t[2]||null}getCookie(e){let t=this.getRaw(e);return"string"==typeof t?(t=decodeURIComponent(t),t):null}get_android_version(){let e=navigator.userAgent.toLowerCase(),t=null;if(e.indexOf("android")>0){let a=/android [\d._]+/gi;t=(e.match(a)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,"."),t=parseInt(t.split(".")[0],10)}return t}insertHTML(e,t,a){if(a)a.insertAdjacentHTML(e,t);else{let e=document.createElement("div");this.insertHTML("afterBegin",t,e),document.body.appendChild(e)}}toggleShow(e){e&&("none"===e.style.display?e.style.display="block":e.style.display="none")}getSViewportOffset(){return window.innerWidth?{w:window.innerWidth,h:window.innerHeight}:"BackCompat"===document.compatMode?{w:document.body.clientWidth,h:document.body.clientHeight}:{w:document.documentElement.clientWidth,h:document.documentElement.clientHeight}}isPC(){let e=navigator.userAgent,t=["Android","iPhone","SymbianOS","Windows Phone","iPad","iPod"],a=!0;for(let l=0;l<t.length;l++)if(e.indexOf(t[l])>0){a=!1;break}return a}sleep(e=500){return t(this,void 0,void 0,(function*(){yield new Promise((t=>{setTimeout((a=>{t(),console.log("sleep...",e)}),e)}))}))}getQueryString(e){let t=location.href.substring(location.href.indexOf("?")+1).split("&"),a={};for(let e=0,l=t.length;e<l;e++){let l=t[e].split("=");a[l[0]]=l[1]}return e&&0!==e&&!1!==e?a[e]?a[e]:"":a}show(e){e.style.display="block"}hide(e){e.style.display="none"}getEleByIdFromPage(e,t=!1){return"string"!=typeof e&&(e=String(e)),t?document.getElementById(e):document.querySelector(/#/g.test(e)?e:"#"+e)}logAll(e){var t=this;try{var a=document.location.protocol+"//nsclick.baidu.com/v.gif?pid=111&data_source=fe&type=1023&source="+(t.getQueryString("clientfrom")||"wap")+"&client="+(t.getQueryString("client")||"")+"&v="+(new Date).getTime()+"&tpl="+t.getQueryString("tpl");a+="&auto_statistic="+t.base64encode("{eventType:"+e+"}"),a+="&auto_en="+e;let l=new Image;l.onload=l.onerror=function(){l.onload=l.onerror=null,l=null},l.src=a}catch(e){}}base64encode(e){var t,a,l,n,i,r,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(l=e.length,a=0,t="";a<l;){if(n=255&e.charCodeAt(a++),a===l){t+=o.charAt(n>>2),t+=o.charAt((3&n)<<4),t+="==";break}if(i=e.charCodeAt(a++),a===l){t+=o.charAt(n>>2),t+=o.charAt((3&n)<<4|(240&i)>>4),t+=o.charAt((15&i)<<2),t+="=";break}r=e.charCodeAt(a++),t+=o.charAt(n>>2),t+=o.charAt((3&n)<<4|(240&i)>>4),t+=o.charAt((15&i)<<2|(192&r)>>6),t+=o.charAt(63&r)}return t}}const n={formateCountryData(e){var t;let a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"].join("").toUpperCase().split(""),l=[];for(let n=0;n<a.length;n++){let i=a[n],r={};r.babel=i,r[i]=[];for(let a=0;a<e.length;a++){(null===(t=e[a])||void 0===t?void 0:t.value)[0].toUpperCase()===i&&(e[a].index=a,e[a].code=e[a].code||a,r[i].push(e[a]))}l.push(r)}let n=[];return l=l.filter((e=>(0===e[e.babel].length&&n.push(e.babel),e[e.babel].length>0))),a=a.filter((e=>{let t=e;return n.forEach((a=>{e===a&&(t="")})),t})),{res:l,xArr:a}},getSearchCountryArr(e,t,a,l=!1,n=!1){if(!t.length)return[];let i=t.filter((t=>{if(a)return t.label.includes(e);{let a,l=!1;if(n&&/^[a-zA-Z]+$/.test(e)){a=(t.pingyin||t.value).toLowerCase().match(e.toLowerCase())}else a=t.label.match(e);return a&&a[0]===e&&0===a.index&&(l=!0),l}})),r=i;if(!a&&l){r=i.map((t=>(t.label2=t.label.replace(e,`<b style="color: #525252;font-family: PingFangSC-Regular;">${e}</b>`),t)))}return r},emptyAllChildNodes(e,t){if(e){for(;e.children.length;)e.removeChild(e.firstChild);t&&"function"==typeof t&&t()}},formateServerCountryData(e,t,a=!0){try{let l=[];return Array.isArray(t)&&0!==t.length?(t.forEach(((t,n)=>{let i=t;i.label2=a?t.label.replace(e,`<b style="color: #999">${e}</b>`):t.label,l.push(i)})),l):[]}catch(e){return console.log("formateServerCountryData catch err:",e),[]}}};class i{constructor(e){this.options=e,this.isinputOutBtnCallbacking=!1,this.config={el:"",selectedCallback:function(){throw new Error("Function not implemented.")},errCallback:function(e){console.log(e)},inputOutBtnCallback:function(){console.log("inputOutBtnCallback init...")},inputBlurCallback:function(){console.log("inputBlurCallback init...")},inputFocusCallback:function(){console.log("inputFocusCallback init...")},domRenderAfterCallback:function(){console.log("domRenderAfterCallback init...")},searchClearIconCallback:function(){console.log("searchClearIconCallback init...")},apiStartCallback:function(){console.log("apiStartCallback init...")},apiEndCallback:function(){console.log("apiEndCallback init...")},immediatelyReset:!1,globalSearchWord:!1,serachDataIncludeRecommend:!1,fixedAndScroll:!1,scrollviewHeight:null,placeholder:"请输入国家(地区)名称",selectCountryAfterReset:!1,scrollBodyBubble:!1,searchEmptyShowCountryList:!1,searchInputMaxNum:20,searchWordAddStyle:!1,leftTipTop:!1,leftActionSpan:0,inputType:"text",useServerSeach:!1,searchCountryApi:"",tjCountryApi:"",hotCountryList:[{code:10086,label:"中国大陆",value:"ChineseMainland"},{code:1008601,label:"中国澳门",value:"Macao"},{code:1008602,label:"中国台湾",value:"Taiwan"},{code:1008603,label:"中国香港",value:"Hongkong"}],animaInput:!0,getPolyFill:!1,inputOutBtnTxt:"退出",colaKey:"",supportEnSearch:!1,customOptions:{searchclearIcon:"",searchIcon:"",selectIcon:"",slideItemIcon:""}},this.dataStore={xArr:[],originCountryList:[],currentFillterArr:[],domDetailData:[],currSelectedItem:null,currSelectedSlideItem:null,curTouchItem:{evetEle:"",content:""},inputCurValue:"",getPolyfillok:0,isSelectingStatus:!1,inputDone:!0,inputDoneTimer:null},this.baseCls=new l,this.init()}$http(e){let a=this;return new Promise(((l,n)=>{a.config.apiStartCallback&&"function"==typeof a.config.apiStartCallback&&a.config.apiStartCallback(),(e=>{const a=(e.method||"get").toUpperCase(),l=new URL(e.url,window.location.origin),n=e.params||{};Object.keys(n).forEach((e=>{void 0!==n[e]&&null!==n[e]&&l.searchParams.append(e,String(n[e]))}));const i={method:a,headers:{"Content-Type":"application/json"}};return"POST"===a&&(i.body=JSON.stringify(e.data||{})),fetch(l.toString(),i).then((e=>t(void 0,void 0,void 0,(function*(){const t=(e.headers.get("content-type")||"").includes("application/json")?yield e.json():yield e.text();return e.ok?t:Promise.reject({status:e.status,data:t})}))))})({method:e.method||"get",url:e.url,data:e.data||{},params:e.params||{}}).then((e=>{l(e)})).catch((e=>{console.log("http error:",e),n(e)})).finally((()=>{a.config.apiEndCallback&&"function"==typeof a.config.apiEndCallback&&a.config.apiEndCallback()}))}))}init(){this.initData()}initData(){let e=this;this.config.countryList=a.countryData,Object.assign(this.config,Object.assign({},this.options)),this.dataStore.originCountryList=this.config.countryList;const{res:t,xArr:l}=n.formateCountryData(this.config.countryList);this.config.countryList=t,this.dataStore.xArr=l,this.syncCustomOptionsFn();try{if(this.config.getPolyFill&&a.polyfillSrc){let t=document.createElement("script");t.src=a.polyfillSrc,document.body.appendChild(t),t.onload=function(){e.dataStore.getPolyfillok=1},t.onerror=function(){console.warn("polyfill 加载失败:",a.polyfillSrc),e.dataStore.getPolyfillok=-1}}else this.config.getPolyFill&&!a.polyfillSrc&&console.warn("polyfill 未配置有效地址,已跳过加载")}catch(e){console.log("catch err:",e)}}render(){let e=this;return e.config.el&&e.baseCls.getEleByIdFromPage(e.config.el)?(this.options.isHttps,this.insertHtml(),this.config.domRenderAfterCallback&&"function"==typeof this.config.domRenderAfterCallback&&this.config.domRenderAfterCallback(),e):(console.log("请配置有效的容器id"),void alert("请配置有效的容器id"))}getTpl(e){const t='<li class="sildebarItem sildebarItem_tj" id="'+a.$id_prefix+'_sildebarItem_TJ" content="TJ"><p class="sildebarItem-bubble sildebarItem-bubbl_tj hide" id="'+a.$id_prefix+'_sildebarItem-bubble_TJ"><span class="sildebarItem-bubble-txt sildebarItem-bubble-txt_tj">推荐</span></p><a content="TJ" class="sildebarItem-a" role="button" tabindex="0">推荐</a></li>';let l="search"===this.config.inputType;return{pageBody:'<div class="pageBody" id="'+a.$id_prefix+'_pageBody" onselectstart="return false"><section class="header-box" id="'+a.$id_prefix+'_header-box">{{inputBox}}<div class="topTip-wrap hide" id="'+a.$id_prefix+'_topTip-wrap"><p class="body-article-tipTop" id="'+a.$id_prefix+'_body-article-tipTop">推荐</p></div></section><article class="alllist-body-article" id="'+a.$id_prefix+'_alllist-body-article"><section class="hot-area-box" id="'+a.$id_prefix+'_hot-area-box">{{hotCountryBox}}</section><section class="country-area-box" id="'+a.$id_prefix+'_country-area-box">{{countryListBox}}</section>{{searchCountryBox}}</article><div class="slide-box" id="'+a.$id_prefix+'_slide-box">{{sildebarBox}}</div></div></div>',inputBox:'<div class="inputBox" id="'+a.$id_prefix+'_inputBox"><div id="'+a.$id_prefix+'_search-input-wrapper" class="search-input-wrapper"><div class="serach-icon"><img src="'+a.searchIconBase64+'" alt="图标"></div>'+(l?'<form action="javascript:return false;" id="'+a.$id_prefix+'_search-inputform">':"")+'<input type="'+this.config.inputType+'" name="searchValue" enterkeyhint="'+(l?"search":"done")+'" id="'+a.$id_prefix+'_search-input" class="search-input" maxlength="'+this.config.searchInputMaxNum+'" placeholder="'+this.config.placeholder+'" autocomplete="off">'+(l?"</form>":"")+'<span id="'+a.$id_prefix+'_chahao-icon" class="chahao-icon hide"><img src="'+a.searchclearIconBase64+'" alt="图标"></span></div><p class="input-out-btn input-out-btn-hide" id="'+a.$id_prefix+'_input-out-btn">'+this.config.inputOutBtnTxt+"</p></div>",hotCountryBox:'<div class="hotCountryBox" id="'+a.$id_prefix+'_hotCountryBox" bebal="TJ"><p class="hot-country-babel" id="'+a.$id_prefix+'_hot-country-babel"><a id="TJ">推荐</a></p><ul class="hot-countrylist-ul" id="'+a.$id_prefix+'_hot-countrylist-ul">{{hotCountryList}}</ul></div>',countryListBox:'<div class="countryListBox" id="'+a.$id_prefix+'_countryListBox">{{countryList}}</div>',sildebarBox:'<div class="sildebarBox" id="'+a.$id_prefix+'_sildebarBox">'+t+"{{sildebarItems}}</div>",countryListItem:'<ul class="countryListItem" id="'+a.$id_prefix+'_countryListItem_{{bebal}}" bebal="{{bebal}}"><a class="itemBebal" id="{{itemBebal}}">{{itemBebal}}</a>{{countryListItems}}</ul>',listItem:'<li class="listItem" id="'+a.$id_prefix+'_listItem_{{countryCode}}" data-index="{{listItemIndex}}" data-name="{{listItemName}}" data-enname="{{listItemEnName}}" data-countryCode="{{countryCode}}">{{item}}<div class="listItem-action hide"><img src="'+a.selectIconBase64+'" alt="图标"></div></li>',sildebarItem:'<li class="sildebarItem" id="'+a.$id_prefix+'_sildebarItem_{{item}}" content="{{item}}"><p class="sildebarItem-bubble hide" id="'+a.$id_prefix+'_sildebarItem-bubble_{{item}}"><img src="'+a.slideItemIconBase64+'" alt="图标"><span class="sildebarItem-bubble-txt">{{item}}</span></p><a content="{{item}}" class="sildebarItem-a">{{item}}</a></li>',searchCountryBox:'<section class="searchCountryBox" id="'+a.$id_prefix+'_searchCountryBox"><ul class="searchCountry-ul" id="'+a.$id_prefix+'_searchCountry-ul"></ul></section>',searchEmptyIcon:'<p id="'+a.$id_prefix+'_searchCountry-emptyicon" class="searchCountry-emptyicon"></p>'}[e]}insertHtml(){let e=this.getCountryliFn(this.config.hotCountryList),t=this.getTpl("hotCountryBox").replace(/{{hotCountryList}}/g,e),a=this.getCountrySortitemFn(this.config.countryList),l=this.getTpl("countryListBox").replace(/{{countryList}}/g,a),n=this.getCountryliFn(this.dataStore.xArr,!1),i=this.getTpl("sildebarBox").replace(/{{sildebarItems}}/g,n),r=this.getTpl("searchCountryBox"),o=this.getTpl("pageBody").replace(/{{inputBox}}/g,this.getTpl("inputBox")).replace(/{{hotCountryBox}}/g,t).replace(/{{countryListBox}}/g,l).replace(/{{sildebarBox}}/g,i).replace(/{{searchCountryBox}}/g,r);this.baseCls.insertHTML("afterBegin",o,this.baseCls.getEleByIdFromPage(this.config.el));let s=this.baseCls.getEleById("_searchCountryBox");s&&this.baseCls.addClass(s,"hide"),this.saveDomDetailData(this.setfixedAndScroll.bind(this));let u=this.baseCls.getEleById("_sildebarItem_TJ");u&&this.baseCls.addClass(u,"sildebarItem_tj_active"),this.setEvent()}getCountryliFn(e,t=!0,a=!1){let l="";if(Array.isArray(e)||(e=[e]),e.length)for(let n=0;n<e.length;n++){let i=e[n],r="";t?(r="listItem",l+=this.getTpl(r).replace(/{{item}}/g,a&&i.label2?i.label2:i.label).replace(/{{listItemIndex}}/g,i.index).replace(/{{listItemName}}/g,i.label).replace(/{{listItemEnName}}/g,i.value).replace(/{{countryCode}}/g,i.code)):(r="sildebarItem",l+=this.getTpl(r).replace(/{{item}}/g,i))}return l}getCountrySortitemFn(e){let t=[];if(e.length||(e=this.config.countryList),e.length)for(let a=0;a<e.length;a++){let l=e[a],n=l[l.babel],i=this.getCountryliFn(n),r=i?this.getTpl("countryListItem").replace(/{{bebal}}|{{itemBebal}}/g,l.babel).replace(/{{countryListItems}}/g,i):"";t.push(r)}return t.join("")}setEvent(){let e=this.baseCls.getEleById("_hot-countrylist-ul"),t=this.baseCls.getEleById("_countryListBox"),a=this.baseCls.getEleById("_search-input"),l=this.baseCls.getEleById("_searchCountryBox"),n=this.baseCls.getEleById("_input-out-btn"),i=this.baseCls.getEleById("_sildebarBox"),r=this.baseCls.getEleById("_alllist-body-article"),o=this.baseCls.getEleById("_chahao-icon");this.baseCls.getEleById("_search-inputform"),this.baseCls.addEventHandler(o,"click",this.getEventStoreFn("selectClearIconFn")),this.baseCls.addEventHandler(t,"click",this.getEventStoreFn("selectCountryFn")),this.baseCls.addEventHandler(e,"click",this.getEventStoreFn("selectCountryFn")),this.baseCls.addEventHandler(l,"click",this.getEventStoreFn("selectCountryFn")),this.baseCls.addEventHandler(a,"input",this.baseCls.throttle(this.getEventStoreFn("seachInputFn"))),this.baseCls.addEventHandler(a,"blur",this.getEventStoreFn("inputBlurFn")),this.baseCls.addEventHandler(a,"focus",this.getEventStoreFn("inputFocusFn")),this.baseCls.addEventHandler(n,"click",this.getEventStoreFn("inputOutBtnFn")),this.baseCls.addEventHandler(i,"touchstart",this.getEventStoreFn("selectSlideItemFn")),this.baseCls.addEventHandler(i,"touchstart",this.getEventStoreFn("touchstartFn")),this.baseCls.addEventHandler(i,"touchend",this.getEventStoreFn("touchendFn")),this.baseCls.addEventHandler(i,"touchcancel",this.getEventStoreFn("touchendFn")),this.baseCls.addEventHandler(i,"mousedown",this.getEventStoreFn("selectSlideItemFn")),this.baseCls.addEventHandler(i,"mousedown",this.getEventStoreFn("touchstartFn")),this.baseCls.addEventHandler(i,"mouseup",this.getEventStoreFn("touchendFn")),this.baseCls.addEventHandler(a,"keydown",this.getEventStoreFn("formSubmitFn")),this.config.scrollBodyBubble&&(this.baseCls.addEventHandler(r,"touchstart",(e=>{this.getEventStoreFn("touchstartFn")(e,!1)})),this.baseCls.addEventHandler(r,"touchend",(e=>{this.getEventStoreFn("touchendFn")(e)})),this.baseCls.addEventHandler(r,"touchcancel",(e=>{this.getEventStoreFn("touchendFn")(e)}))),this.setScrollFlowFn()}setScrollFlowFn(){let e=document.querySelectorAll(".countryListItem"),t=this.baseCls.getEleById("_hotCountryBox"),a={root:this.config.fixedAndScroll?this.baseCls.getEleById("_alllist-body-article"):null,rootMargin:"0px",threshold:[0,.95,.9,.99,.8,.7,.6,.5,.4,.3,.2,.1,.01,.02,.03,.05,.07]};if(!("IntersectionObserver"in window))return void console.log("当前浏览器不支持IntersectionObserver");const l=new IntersectionObserver(((e,t)=>{for(let t=0;t<e.length;t++){let a=e[t],l=a.target;const{intersectionRatio:n,isIntersecting:i,boundingClientRect:r}=a;let o=this.config.leftActionSpan||0;if(r.y<50+o){const e=l.getAttribute("bebal");if(!e)return;let t=this.baseCls.getEleById("_sildebarItem_"+e);if(e&&(this.dataStore.currSelectedSlideItem=t),this.dataStore.isSelectingStatus)return!1;this.setSelectorActive("abc")}}}),a);for(let t=0;t<e.length;t++){let a=e[t];l.observe(a)}l.observe(t)}getEventStoreFn(e){let l=this,i=l.baseCls.getEleById("_hot-area-box"),r=l.baseCls.getEleById("_country-area-box"),o=l.baseCls.getEleById("_searchCountryBox"),s=this.baseCls.getEleById("_search-input-wrapper"),u=this.baseCls.getEleById("_chahao-icon"),c=this.baseCls.getEleById("_search-input"),d=l.baseCls.getEleById("_slide-box"),b=l.baseCls.getEleById("_input-out-btn");const h={selectCountryfning:!1,seachInputFning:!1,resArr:[],isSelecting:!1,selectCountryFn:function(e){try{if(!e.target.className||!/^listItem\s*/g.test(e.target.className))return;let t={rescode:-1,eventItemData:{},selectCountry:"",originCountryData:l.dataStore.originCountryList};e.target&&e.target.dataset?t={rescode:0,eventItemData:e.target.dataset,selectCountry:l.dataStore.originCountryList[e.target.dataset.index],originCountryData:l.dataStore.originCountryList}:e.target&&e.target.getAttribute("data-index")&&(t={rescode:0,eventItemData:{index:e.target.getAttribute("data-index"),name:e.target.getAttribute("data-name"),enname:e.target.getAttribute("data-enname"),countrycode:e.target.getAttribute("data-countrycode")},selectCountry:l.dataStore.originCountryList[e.target.getAttribute("data-index")],originCountryData:l.dataStore.originCountryList}),l.dataStore.currSelectedItem=Object.assign(Object.assign({},t),{ele:e.target}),l.setSelectorActive("country"),l.config.selectedCallback&&"function"==typeof l.config.selectedCallback&&l.config.selectedCallback(t),l.config.selectCountryAfterReset&&h.resetstatusFn()}catch(e){l.config.errCallback&&"function"==typeof l.config.errCallback&&l.config.errCallback(e)}},selectSlideItemFn:function(e){if(l.dataStore.isSelectingStatus)return!1;l.dataStore.isSelectingStatus=!0,l.dataStore.isSelectingStatus&&setTimeout((()=>{l.dataStore.isSelectingStatus=!1}),2e3);let t=l.dataStore.currSelectedSlideItem=e.target;/^sildebarItem-a\s*/g.test(null==t?void 0:t.getAttribute("class"))&&(t.onclick=function(e){e.preventDefault();let a=t.getAttribute("content"),n=document.getElementById(a);if(n){let e=l.baseCls.getEleById("_topTip-wrap");e&&l.baseCls.addClass(e,"hide"),n.scrollIntoView({behavior:"smooth"}),l.setSelectorActive("abc")}})},touchstartFn:function(e,t=!0){if(h.selectSlideItemFn(e),!t&&!l.dataStore.currSelectedSlideItem)return;l.dataStore.curTouchItem.evetEle=t?e.target:l.dataStore.currSelectedSlideItem,l.dataStore.curTouchItem.content=l.dataStore.curTouchItem.evetEle.getAttribute("content");let a=l.baseCls.getEleById("_sildebarItem-bubble_"+l.dataStore.curTouchItem.content);a&&l.baseCls.removeClass(a,"hide")},touchendFn:function(e){let t=l.baseCls.getEleById("_sildebarItem-bubble_"+l.dataStore.curTouchItem.content);t&&l.baseCls.addClass(t,"hide")},seachInputFn:function(e,s=!1){return t(this,void 0,void 0,(function*(){l.baseCls.getEleById("_topTip-wrap");let t="";if(t=s?l.dataStore.inputCurValue.toString()||"":l.dataStore.inputCurValue=e.target.value.trim(),t?u&&l.baseCls.removeClass(u,"hide"):u&&l.baseCls.addClass(u,"hide"),!t)return[];let c=[...l.dataStore.originCountryList];l.config.serachDataIncludeRecommend&&(c=[...l.dataStore.originCountryList,...l.config.hotCountryList]);let b=[],g=l.config.searchCountryApi||a.apisCfg.searchCountryApi,m=l.config.tjCountryApi||a.apisCfg.tjCountryApi,p=s?g:m;if(l.config.useServerSeach){try{let e=yield l.$http({method:"get",data:{},params:{word:t},url:p});console.log("自定义接口结果:",e),11e4==+e.code&&(b=n.formateServerCountryData(t,e.data.listData,!s))}catch(e){}console.log("搜索结果数据1:",b)}else b=h.resArr=l.dataStore.currentFillterArr=n.getSearchCountryArr(t,c,l.config.globalSearchWord,l.config.searchWordAddStyle,l.config.supportEnSearch),console.log("搜索结果数据2:",b);function C(e=!1){(l.dataStore.inputDone||e)&&(l.baseCls.addClass(i,"hide"),l.baseCls.addClass(r,"hide"),l.baseCls.addClass(d,"hide"),l.baseCls.removeClass(o,"hide"),n.emptyAllChildNodes(o,(function(){if(!e){let e=l.getTpl("searchEmptyIcon");l.baseCls.insertHTML("afterBegin",e,o)}})))}function y(){let e=l.baseCls.getEleById("_topTip-wrap");e&&!/^hide$/g.test(e.getAttribute("class")||"")&&setTimeout((()=>{e&&l.baseCls.addClass(e,"hide")}),10)}if(l.dataStore.inputDoneTimer&&clearTimeout(l.dataStore.inputDoneTimer),C(!0),b.length)return l.baseCls.addClass(i,"hide"),l.baseCls.addClass(r,"hide"),l.baseCls.addClass(d,"hide"),l.baseCls.removeClass(o,"hide"),n.emptyAllChildNodes(o,(function(){let e=l.getCountryliFn(b,!0,!0);l.baseCls.insertHTML("afterBegin",e,o)})),void y();l.config.searchEmptyShowCountryList?console.log("没有查询到任何信息"):(y(),l.dataStore.inputDone=!1,l.dataStore.inputDoneTimer&&clearTimeout(l.dataStore.inputDoneTimer),C(!0),l.dataStore.inputDoneTimer=setTimeout((()=>{l.dataStore.inputDone=!0,C()}),800))}))},inputBlurFn:function(e){(l.dataStore.inputCurValue=e.target.value.trim())&&l.dataStore.currentFillterArr.length||!l.config.immediatelyReset||h.resetstatusFn(),l.config.inputBlurCallback&&"function"==typeof l.config.inputBlurCallback&&l.config.inputBlurCallback(e)},formSubmitFn:function(e){return t(this,void 0,void 0,(function*(){"search"===l.config.inputType&&e&&e.keyCode&&13==+e.keyCode?(yield h.seachInputFn(e,!0),setTimeout((()=>{c&&c.blur()}),1e3)):e&&e.keyCode&&13==+e.keyCode&&c&&c.blur()}))},inputFocusFn:function(e){l.config.animaInput&&(l.baseCls.addClass(s,"search-input_after"),l.baseCls.addClass(c,"search-input_after"),setTimeout((()=>{l.baseCls.removeClass(b,"input-out-btn-hide")}),300)),l.config.inputFocusCallback&&"function"==typeof l.config.inputFocusCallback&&l.config.inputFocusCallback(e)},inputOutBtnFn:function(e){l.config.inputOutBtnCallback&&"function"==typeof l.config.inputOutBtnCallback&&l.config.inputOutBtnCallback(e),l.config.animaInput&&(l.baseCls.removeClass(s,"search-input_after"),l.baseCls.removeClass(c,"search-input_after")),l.baseCls.addClass(b,"input-out-btn-hide")},countrySelectActiveFn:function(){var e;let t=null===(e=l.dataStore.currSelectedItem)||void 0===e?void 0:e.ele;t&&t.lastChild&&/^listItem-action\s*/g.test(t.lastChild.getAttribute("class"))&&l.baseCls.removeClass(t.lastChild,"hide")},abcSelectActiveFn:function(){let e=l.baseCls.getEleById("_topTip-wrap"),t=l.baseCls.getEleById("_body-article-tipTop"),a=l.dataStore.currSelectedSlideItem,n=a.getAttribute("content"),i=n?l.baseCls.getEleById("_sildebarItem_"+n):a;i&&e&&l.config.leftTipTop&&l.config.fixedAndScroll?(l.dataStore.isSelectingStatus||l.baseCls.removeClass(e,"hide"),n&&t&&(t.innerText=n)):e&&l.baseCls.addClass(e,"hide"),i&&/sildebarItem_tj/g.test(i.getAttribute("class")||"")?(i&&l.baseCls.addClass(i,"sildebarItem_tj_active"),e&&l.baseCls.addClass(e,"hide")):i&&l.baseCls.addClass(i,"sildebarItem_active")},resetstatusFn:function(){l.baseCls.removeClass(i,"hide"),l.baseCls.removeClass(r,"hide"),l.baseCls.removeClass(d,"hide"),l.baseCls.addClass(o,"hide"),h.resArr=l.dataStore.currentFillterArr=[],l.resetAllSlideAction()},selectClearIconFn:function(){c.value="",u&&l.baseCls.addClass(u,"hide"),l.config.searchClearIconCallback&&"function"==typeof l.config.searchClearIconCallback&&l.config.searchClearIconCallback()}};return h[e]}resetAllSlideAction(){let e=this,t=document.querySelectorAll(".sildebarItem");for(let a=0;a<t.length;a++){let l=t[a];/sildebarItem_active/g.test(l.getAttribute("class")||"")?e.baseCls.removeClass(l,"sildebarItem_active"):/sildebarItem_tj_active/g.test(l.getAttribute("class")||"")&&e.baseCls.removeClass(l,"sildebarItem_tj_active"),/sildebarItem_tj/g.test(l.getAttribute("class")||"")&&e.baseCls.addClass(l,"sildebarItem_tj_active")}}pubResetFn(...e){let t=this.baseCls.getEleById("_search-input");this.getEventStoreFn("resetstatusFn")(),t.value="1",setTimeout((()=>{t.value=""}),100),t.value="";let a=this.baseCls.getEleById("_chahao-icon");!t.value&&a&&this.baseCls.addClass(a,"hide")}saveDomDetailData(e){let t=this.baseCls.getEleById("_header-box"),a=this.baseCls.getEleById("_alllist-body-article"),l=this.baseCls.getEleById("_pageBody"),n=this.baseCls.getEleByIdFromPage(this.config.el);function i(e,t){return{name:e,data:t}}return t&&this.dataStore.domDetailData.push(i("headBox",t.getBoundingClientRect())),a&&this.dataStore.domDetailData.push(i("articlebody",a.getBoundingClientRect())),l&&this.dataStore.domDetailData.push(i("pageBody",l.getBoundingClientRect())),n&&this.dataStore.domDetailData.push(i("myContainer",n.getBoundingClientRect())),e&&e(this.dataStore.domDetailData),this.dataStore.domDetailData}setfixedAndScroll(e){var t;if(!this.config.fixedAndScroll)return;let a=null==e?void 0:e.find((e=>"headBox"===e.name));null==e||e.find((e=>"articlebody"===e.name)),null==e||e.find((e=>"pageBody"===e.name));let l=null==e?void 0:e.find((e=>"myContainer"===e.name)),n=this.baseCls.getEleById("_alllist-body-article");this.baseCls.getEleById("_pageBody");let i=(null===(t=null==l?void 0:l.data)||void 0===t?void 0:t.height)||document.documentElement.clientHeight;if(!a||!n)return;let r=i-a.data.height;this.config.scrollviewHeight&&this.config.scrollviewHeight>0&&(r=this.config.scrollviewHeight),n.style.cssText=`height:${r}px;overflow: scroll;`}setSelectorActive(e){switch(this.resetAllSelectActive(e),e){case"country":this.getEventStoreFn("countrySelectActiveFn")();break;case"abc":this.getEventStoreFn("abcSelectActiveFn")()}}resetAllSelectActive(e){switch(e){case"country":let e=document.querySelectorAll(".listItem-action");for(let t=0;t<e.length;t++){let a=e[t];this.baseCls.addClass(a,"hide")}break;case"abc":let t=document.querySelectorAll(".sildebarItem"),a=document.querySelectorAll(".sildebarItem-bubble");for(let e=0;e<t.length;e++){let a=t[e];/sildebarItem_active/g.test(a.getAttribute("class")||"")?this.baseCls.removeClass(a,"sildebarItem_active"):/sildebarItem_tj_active/g.test(a.getAttribute("class")||"")&&this.baseCls.removeClass(a,"sildebarItem_tj_active")}for(let e=0;e<a.length;e++){let t=a[e];/hide/g.test(t.getAttribute("class")||"")||this.baseCls.addClass(t,"hide"),/sildebarItem-bubbl_tj/g.test(t.getAttribute("class")||"")&&t.lastChild&&(t.lastChild.style.fontSize="14px")}}}syncCustomOptionsFn(){let e=this;if(e.config.customOptions)for(let t in e.config.customOptions){let l=e.config.customOptions[t],n=t+"Base64";l&&n in a&&(a[n]=l)}}getEleByIdPubFn(e){return this.baseCls.getEleById(e)}changeThemePubFn(e){let t=this,a="ml-country-selector-dark"===e,l=t.baseCls.getEleById("_pageBody");a&&l&&t.baseCls.addClass(l,"ml-country-selector-dark"),!a&&l&&t.baseCls.removeClass(l,"ml-country-selector-dark")}}!function(){const e="ml-country-selector-style";try{if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.type="text/css",t.appendChild(document.createTextNode(String('@charset "UTF-8";\n* {\n padding: 0;\n margin: 0;\n list-style-type: none;\n text-decoration: none;\n}\n\n.pageBody {\n position: relative;\n}\n\n.countryListBox, .country-area-box {\n scroll-behavior: smooth;\n}\n\ninput::-webkit-search-cancel-button {\n display: none;\n}\n\n.header-box {\n position: relative;\n padding: 1rem 0;\n background-color: rgb(255, 255, 255);\n}\n.header-box .topTip-wrap {\n position: absolute;\n width: 100%;\n z-index: 9999;\n background-color: rgb(255, 255, 255) !important;\n}\n.header-box .topTip-wrap .body-article-tipTop {\n bottom: -2.8rem;\n padding: 0 1.7rem;\n left: 0;\n width: calc(100% - 4rem);\n height: 3.4rem;\n z-index: 99;\n line-height: 3.4rem;\n color: black;\n font-weight: 600;\n text-align: left;\n background-color: rgb(255, 255, 255) !important;\n font-family: PingFangSC-Medium;\n font-size: 1.6rem;\n color: #1F1F1F;\n line-height: 3.4rem;\n}\n\n.header-box .inputBox {\n position: relative;\n padding: 0 1.7rem;\n height: 4rem;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%;\n overflow: hidden;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: start;\n -webkit-justify-content: flex-start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -webkit-box-align: center;\n -webkit-align-items: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.search-input-wrapper {\n width: 100%;\n display: inline-block;\n position: relative;\n}\n\n.alllist-body-article {\n min-height: 70vh;\n}\n\n.search-input-wrapper.search-input_after {\n width: calc(100% - 5rem);\n border-radius: 1.8rem;\n background-color: rgb(238, 238, 238);\n}\n\n.header-box .inputBox .search-input {\n position: relative;\n border-radius: 1.8rem;\n height: 4rem;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n outline: none;\n font-size: 1.4rem;\n border: none;\n padding: 0 3.6rem;\n padding-right: 0;\n background: #F5F5F5;\n border: 1px solid rgba(0, 0, 0, 0.05);\n}\n\n.header-box .inputBox .search-input::-webkit-input-placeholder {\n font-family: PingFangSC-Regular;\n font-size: 1.6rem;\n color: #B8B8B8;\n letter-spacing: 0;\n line-height: 1.6rem;\n}\n\n.header-box .inputBox .search-input::-moz-placeholder {\n font-family: PingFangSC-Regular;\n font-size: 1.6rem;\n color: #B8B8B8;\n letter-spacing: 0;\n line-height: 1.6rem;\n}\n\n.header-box .inputBox .search-input:-ms-input-placeholder {\n font-family: PingFangSC-Regular;\n font-size: 1.6rem;\n color: #B8B8B8;\n letter-spacing: 0;\n line-height: 1.6rem;\n}\n\n.header-box .inputBox .search-input::-ms-input-placeholder {\n font-family: PingFangSC-Regular;\n font-size: 1.6rem;\n color: #B8B8B8;\n letter-spacing: 0;\n line-height: 1.6rem;\n}\n\n.header-box .inputBox .search-input::placeholder {\n font-family: PingFangSC-Regular;\n font-size: 1.6rem;\n color: #B8B8B8;\n letter-spacing: 0;\n line-height: 1.6rem;\n}\n\n.header-box .inputBox .serach-icon {\n display: block;\n width: 1.8rem;\n height: 1.8rem;\n position: absolute;\n left: 1rem;\n top: 50%;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%);\n z-index: 9;\n /* background-color: red; */\n overflow: hidden;\n}\n\n.header-box .inputBox .input-out-btn {\n width: 4.7rem;\n height: 3rem;\n border-radius: 1rem;\n text-align: center;\n line-height: 3rem;\n color: black;\n display: inline-block;\n padding: 0;\n -webkit-transform-origin: center;\n transform-origin: center;\n font-family: PingFangSC-Regular;\n font-size: 1.4rem;\n color: #1F1F1F;\n letter-spacing: 0;\n}\n\n.header-box .inputBox .input-out-btn-hide {\n width: 0;\n margin: 0;\n display: none;\n}\n\n.header-box .inputBox .serach-icon img {\n width: 100%;\n height: 100%;\n}\n\n.hotCountryBox .hot-country-babel {\n padding: 1rem 1.8rem;\n padding-top: 1.8rem;\n text-align: left;\n font-family: PingFangSC-Medium;\n font-size: 1.6rem;\n color: #1F1F1F;\n letter-spacing: 0;\n line-height: 1.6rem;\n background: #fff;\n}\n\n.listItem {\n background: #fff;\n padding: 1.3rem 0;\n padding-left: 1.7rem;\n text-align: left;\n position: relative;\n font-family: PingFangSC-Regular;\n font-size: 1.5rem;\n color: #1F1F1F;\n letter-spacing: 0;\n line-height: 1.5rem;\n}\n\n.searchCountryBox .listItem {\n font-family: PingFangSC-Medium;\n font-size: 1.6rem;\n color: #1F1F1F;\n letter-spacing: 0;\n}\n\n.searchCountryBox .listItem::after {\n content: "";\n height: 0.03rem;\n background: #E0E0E0;\n width: 38rem;\n position: absolute;\n left: 50%;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%);\n bottom: 0;\n}\n\n.listItem .listItem-action {\n width: 2.4rem;\n height: 2.4rem;\n position: absolute;\n top: 50%;\n -webkit-transform: translate(2rem, -50%);\n transform: translate(2rem, -50%);\n display: inline-block;\n /* background: red; */\n}\n\n.listItem .listItem-action img {\n width: 100%;\n height: 100%;\n}\n\n.listItem:active {\n opacity: 0.7;\n}\n\n.itemBebal {\n display: block;\n padding: 0.36rem 0;\n padding-left: 1.7rem;\n text-align: left;\n background: #F5F5F5;\n font-family: PingFangSC-Medium;\n font-size: 1.6rem;\n color: #1F1F1F;\n line-height: 1.6rem;\n}\n\n.slide-box {\n width: 2rem;\n height: auto;\n position: absolute;\n right: 0;\n top: 50%;\n z-index: 9999;\n -webkit-transform: translateY(-50%) scale(0.8);\n transform: translateY(-50%) scale(0.8);\n}\n\n.slide-box .sildebarItem {\n width: 100%;\n height: 2rem;\n text-align: center;\n position: relative;\n line-height: 2rem;\n font-size: 1.2rem;\n border-radius: 50%;\n font-family: PingFangSC-Medium;\n}\n\n.slide-box .sildebarItem_active {\n border-radius: 50%;\n color: white;\n background-color: #4E6EF2;\n}\n\n.slide-box .sildebarItem_tj_active .sildebarItem-a {\n color: #4E6EF2 !important;\n}\n\n.slide-box .sildebarItem_active a {\n color: white !important;\n}\n\n.slide-box .sildebarItem .sildebarItem-bubble {\n height: 3.8rem;\n position: absolute;\n width: 4.66rem;\n /* background-color: aqua; */\n left: -5rem;\n top: 50%;\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n\n.slide-box .sildebarItem .sildebarItem-bubble img {\n width: 100%;\n height: 100%;\n}\n\n.sildebarItem-bubble .sildebarItem-bubble-txt {\n position: absolute;\n display: block;\n top: 50%;\n left: 50%;\n -webkit-transform: translate(-66%, -54%);\n transform: translate(-66%, -54%);\n color: white;\n font-family: PingFangSC-Medium;\n font-size: 2.5rem;\n color: #FFFFFF;\n letter-spacing: 0;\n line-height: 2.4rem;\n}\n\n.slide-box .sildebarItem a {\n color: #333;\n}\n\n.slide-box .sildebarItem a:active {\n color: #000;\n}\n\n.pageBody .searchCountryBox {\n height: auto;\n background-color: white;\n position: relative;\n overflow: hidden;\n padding-bottom: 10rem;\n}\n\n.searchCountry-emptyicon {\n position: relative;\n width: 9rem;\n height: 9rem;\n left: 50%;\n -webkit-transform: translateX(-50%);\n transform: translateX(-50%);\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAEOCAMAAABPbwmXAAAAgVBMVEUAAADp6enq6urq6urr6+vy8vLq6urq6urp6enq6urq6urr6+vq6urz8/P////q6urq6urp6enq6uru7u7v7+/q6urq6urq6urr6+vr6+vq6urt7e3q6urp6enq6urq6urq6urr6+vq6urs7Ozv7+/q6urq6urq6urp6enr6+vp6en3o2QnAAA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