(()=>{"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n{let e=t;3===e.length&&(e=[[document.documentElement],...e]),"String"===e[0].constructor.name?e[0]=[...document.querySelectorAll(e[0])]:e[0].forEach?e[0]=[...e[0]]:e[0]=[e[0]],"String"!==e[2].constructor.name&&(e[2].forEach?e[2]=[...e[2]]:e[2]=[e[2]]);const[n,r,o,c]=e,i=r.split(" "),a=t=>{let e;"String"===o.constructor.name?e=t.target.closest(o):[e]=o.filter((e=>e===t.target||e.contains(t.target))),e&&(t.relatedElements=n,c.call(e,t,e))};return n.forEach((t=>{i.forEach((e=>{t.addEventListener(e,a,!0)}))})),a};function o(t,e,n,r,o,c,i){try{var a=t[c](i),s=a.value}catch(t){return void n(t)}a.done?e(s):Promise.resolve(s).then(r,o)}function c(){c=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var c=e&&e.prototype instanceof v?e:v,i=Object.create(c.prototype),a=new T(r||[]);return o(i,"_invoke",{value:_(t,n,a)}),i}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h={};function v(){}function m(){}function y(){}var p={};u(p,a,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(k([])));w&&w!==e&&r.call(w,a)&&(p=w);var b=y.prototype=v.prototype=Object.create(p);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function c(o,i,a,s){var l=d(t[o],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){c("next",t,a,s)}),(function(t){c("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return c("throw",t,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){c(t,n,e,r)}))}return i=i?i.then(r,r):r()}})}function _(t,e,n){var r="suspendedStart";return function(o,c){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw c;return j()}for(n.method=o,n.arg=c;;){var i=n.delegate;if(i){var a=E(i,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(t,e,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function E(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=d(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var c=o.arg;return c?c.done?(e[t.resultName]=c.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):c:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var c=this.tryEntries[o],i=c.completion;if("root"===c.tryLoc)return n("end");if(c.tryLoc<=this.prev){var a=r.call(c,"catchLoc"),s=r.call(c,"finallyLoc");if(a&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;x(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}var i={stringify:function(t){if("object"!=n(t))return"";var r=[];return Object.entries(t).forEach((function(t){var n=e(t,2),o=n[0],c=n[1];r.push("".concat(o,"=").concat(c))})),r.join("&")},postData:function(t,e){return(n=c().mark((function n(){var r,o;return c().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.stringify(e)},n.prev=1,n.next=4,fetch(t,r);case 4:return o=n.sent,n.abrupt("return",o.json());case 8:n.prev=8,n.t0=n.catch(1),Promise.reject(n.t0);case 11:case"end":return n.stop()}}),n,null,[[1,8]])})),function(){var t=this,e=arguments;return new Promise((function(r,c){var i=n.apply(t,e);function a(t){o(i,r,c,a,s,"next",t)}function s(t){o(i,r,c,a,s,"throw",t)}a(void 0)}))})();var n}},a=i.postData,s={olfTO:null,mainTO:null,panelHeight:240,isMobile:/mobile/i.test(navigator.userAgent),st:0,init:function(){var t=this,e=window.wb_ocw_cnf;void 0!==n(e)&&function(t){var e=t.ver,n=t.dir+"/assets/images/wb_svg.html?v="+e,r="ocwSVGdata_widget",o="ocwSVGrev_widget";if(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)return!0;var c,i,a="localStorage"in window&&null!==window.localStorage,s=function(){document.body.insertAdjacentHTML("afterbegin",i)},l=function(){document.body?s():document.addEventListener("DOMContentLoaded",s)};if(a&&localStorage.getItem(o)===e&&(i=localStorage.getItem(r)))return l(),!0;try{(c=new XMLHttpRequest).open("GET",n,!0),c.onload=function(){c.status>=200&&c.status<400&&(i='
'+c.responseText+"
",l(),a&&(localStorage.setItem(r,i),localStorage.setItem(o,e)))},c.send()}catch(t){console.log(t)}}(e);var o=document.querySelector("#OCW_Wp"),c=document.querySelector(".ocw-mask"),i=o&&o.querySelector(".ocw-panel-main"),l=o&&o.querySelector(".ocw-panel-head"),u=document.querySelector("#OCW_btnItems"),f=o.querySelector("#OCW_afterSetMsgBox"),d="active-panel",h="wbocw-actived-panel",v=document.querySelector("body"),m=document.querySelector(".ocw-animated-circles"),y="ocw-hide-anim",p=function(e){var n=o.classList.contains(d),r=!!t.closest(e.target,".wb-ocw");return!(!n||r)&&(g(),!1)};r("click",".ocw-buoy-btn",(function(){o&&o.classList.toggle(d),m&&m.classList.add(y),t.isMobile?(t.st=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,v.classList.add(h),v.insertAdjacentElement("beforeend",o),c&&v.insertAdjacentElement("beforeend",c)):document.addEventListener("click",p)})),r(o,"click",".list-wx .ocw-link, .ocw-el-item.wx .ocw-link",(function(t,e){var n=e.getAttribute("href");if(n)return s.copyToClipboard(n,"微信号已复制"),t.preventDefault(),!1})),e.anim_interval&&m&&setInterval((function(){m.classList.toggle("ocw-animated")}),1e3*e.anim_interval);var g=function(){document.querySelector("#OCW_Wp").classList.remove(d),m&&m.classList.remove(y),t.isMobile?(v.classList.remove(h),window.scrollTo({top:t.st,left:0})):document.removeEventListener("click",p)};r("click",".ocw-btn-close, .ocw-mask",(function(){g()}));var w=function(){if(!t.isMobile&&l&&i){var e=l.offsetHeight,n=i.offsetHeight;setTimeout((function(){t.wpHeight=e+n,o.style.height=t.wpHeight+"px"}),50)}};w();var b=o.querySelector(".buoy-msg"),S=function(){i?(b.classList.remove("ocw-type-active"),b.style.display="",i.classList.remove("active-msg"),w()):o.classList.remove(d)},L=o.querySelector(".j-cancel-form");L&&L.addEventListener("click",(function(){S()}));var _="OCW_LOC_MSG_REC",E=function(e){var n="\n 姓名:".concat(e.name,"
\n 联系方式:[").concat(e.contact_type,"] ").concat(e.contact,"
\n 咨询类型:").concat(e.type,"
\n 咨询内容:").concat(e.message,"\n ");f.style.display="block",f.classList.add("ocw-type-active"),o.querySelector("#OCW_replyCont").innerHTML=n,t.setSessionStorage(_,e),w()},O=t.getSessionStorage(_);O&&i&&E(O);var x=document.querySelector("#OCW_submitBtn"),T=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;x&&x.addEventListener("click",(function(){var e=document.querySelector("#J_OCWForm"),n=e.querySelector('[name="name"]'),o=e.querySelector('[name="contact"]'),c=e.querySelector('[name="message"]'),s=e.querySelector("#OCW_msg"),l=new FormData(e);if(r(e,"change","input",(function(t,e){e.classList.contains("ocw-warning")&&""!=e.value&&(e.classList.remove("ocw-warning"),s.innerHTML="")})),!l.get("name"))return n.classList.add("ocw-warning"),void n.select();if(!l.get("contact"))return o.classList.add("ocw-warning"),void o.select();if("email"===l.get("contact_type")&&!T.test(l.get("contact")))return o.classList.add("ocw-warning"),o.select(),void t.toast("请输入正确格式的邮箱地址");if("mobile"===l.get("contact_type")&&!/^1\d{10}$/.test(l.get("contact")))return o.classList.add("ocw-warning"),o.select(),void t.toast("请输入正确格式的11位手机号");if(!l.get("message"))return c.classList.add("ocw-warning"),void c.select();if(l.get("message").length>500)return c.classList.add("ocw-warning"),c.select(),void t.toast("咨询内容过长,可简单描述,我们联系您进一步沟通。");var u=function(){var n={};l.forEach((function(t,e){n[e]=t})),a(wb_ocw_cnf.ajax_url+"?action=wb_ocw_api",n).then((function(n){0==n.code?(e.reset(),i?(S(),E(n.data)):t.toast(n.desc,(function(){S()}))):t.toast(n.desc)}))};window.wb_ocw_cnf.captcha_key?grecaptcha.ready((function(){try{grecaptcha.execute(window.wb_ocw_cnf.captcha_key,{action:"submit"}).then((function(t){console.log(t),l.append("ocw_captcha",t),u()})).catch((function(e){console.log(e),t.toast("智能验证不通过,若有疑问可联系站点管理员。")}))}catch(e){console.log(e),t.toast("智能验证异常,请联系站点管理员。("+e+")")}})):u()})),u&&r(u,"click",".ocw-btn-tool",(function(e,n){var r=n.dataset.target,o=i.querySelectorAll(".ocw-type-item");[].forEach.call(o,(function(t){t.style.display="none",t.classList.remove("ocw-type-active")})),i.classList["msg"===r?"add":"remove"]("active-"+r);var c=i.querySelector(".buoy-"+r);c&&(c.style.display="block",w(),i.classList.add("active-"+r),t.olfTO=setTimeout((function(){clearTimeout(t.olfTO),c.classList.add("ocw-type-active")}),50))}));var k=o.querySelector(".ocw-msg-btn");k&&k.addEventListener("click",(function(){o&&o.classList.toggle(d),document.addEventListener("click",p)}));var j=o.querySelector(".ocw-captcha .captcha_img");j&&j.addEventListener("click",(function(){var t=j.getAttribute("src");j.setAttribute("src",t+"&_t="+Math.random())}));var q=o.querySelector(".backtop");q&&t.backTop(q)},autoTime:function(t){var e=document.querySelector(".ocw-now-time")&&document.querySelector(".ocw-now-time").querySelector(".ocw-time")||t,n=new Date,r=n.getHours()<10?"0"+n.getHours():n.getHours(),o=n.getMinutes()<10?"0"+n.getMinutes():n.getMinutes();e.innerText="".concat(r,":").concat(o)},toast:function(t,e){if(t){var n=document.querySelector("#OCW_msg");if(!n){var r=document.createElement("div");r.id="OCW_msg",r.setAttribute("class","ocw-msg-bar"),n=document.querySelector("#OCW_msg")}n.style.display="block",n.innerHTML=t,setTimeout((function(){n.style.display="none",n.innerHTML="",e&&e()}),1500)}},backTop:function(t){t&&t.addEventListener("click",(function(){window.scrollTo({top:0,left:0,behavior:"smooth"})}))},getSessionStorage:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=sessionStorage.getItem(t);if(!n)return!1;try{return e?JSON.parse(n):JSON.parse(n).data}catch(e){console.log("getSessionStorage: ",e),sessionStorage.removeItem(t)}},setSessionStorage:function(t,e){console.log("setSessionStorage",t,e);var n={ver:(new Date).getTime(),data:e},r=JSON.stringify(n);sessionStorage.setItem(t,r)},stringify:function(t){if("object"!=n(t))return"";var r=[];return Object.entries(t).forEach((function(t){var n=e(t,2),o=n[0],c=n[1];r.push("".concat(o,"=").concat(c))})),r.join("&")},closest:function(t,e){for(var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t&&!n.call(t,e);)t=t.parentElement;return t},copyToClipboard:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0,r=document.createElement("textarea");document.body.appendChild(r),r.value=t,r.select(),document.execCommand("copy"),document.body.removeChild(r);var o=document.querySelector("#OCW_toast");o||(document.body.insertAdjacentHTML("beforeend",'
'),o=document.querySelector("#OCW_toast")),o.style.display="block",o.innerHTML=e,setTimeout((function(){o.style.display="none",o.innerHTML="",n&&n()}),1500)}};document.addEventListener("DOMContentLoaded",(function(){s.init()}))})();