var HYVOR_TALK_DOMAIN = "https://talk.hyvor.com";!function(){"use strict";function t(t){return document.getElementById(t)}function n(t,n){if(!n)return t;for(var e in n)t.style[e]=n[e];return t}function e(t,n,e){"string"==typeof n&&(n=[n]),n.forEach((function(n){t.addEventListener(n,e)}))}function o(t,n,e){"string"==typeof n&&(n=[n]),n.forEach((function(n){t.removeEventListener(n,e)}))}function i(t,e,o){void 0===e&&(e=null),void 0===o&&(o=null);var i=document.createElement(t);return i=function(t,n){if(!n)return t;for(var e in n)t.setAttribute(e,n[e]);return t}(i=n(i,e),o)}function r(t,n){t.appendChild(n)}function a(t){t.parentElement&&t.parentElement.removeChild(t)}function l(t){var n=c(t);return{top:n.top+window.scrollY,left:n.left+window.scrollX}}function c(t){return t.getBoundingClientRect()}function u(t,n,i){void 0===i&&(i={});var r={close:function(){return o(window,"message",receive)},post:function(e,o){try{var i=JSON.stringify({event:e,data:o});t.postMessage(i,n)}catch(t){}},receive:function(t){var e;try{e=JSON.parse(t.data?t.data:"{}")}catch(t){return}var o=e.event,r=e.data;t.origin===n&&"function"==typeof i[o]&&i[o](r)}};return e(window,"message",r.receive),r}var s=function(){function t(){}return t.get=function(t){try{return window.localStorage.getItem(t)||""}catch(t){}},t.set=function(t,n){try{window.localStorage.setItem(t,n)}catch(t){}},t.remove=function(t){try{window.localStorage.removeItem(t)}catch(t){}},t}();function f(t){console.error("Error in loading Hyvor Talk: "+t)}function d(t){return window[t]}function p(t,n){n.length||(n=[n]);var e,o=!0,i=n.length;for(e=0;et.height&&!t.setToTop&&(o-=e/2,o+=t.height/2),window.scrollTo({left:n.left+t.left,top:o,behavior:"smooth"})},openImageModal:function(t){!function(t){var n=i("div",{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e9});r(document.body,n);var o=i("img",{borderRadius:"5px",maxWidth:"calc(100% - 60px)",maxHeight:"calc(100% - 60px)"},{src:t});r(n,o);var l=i("span",{position:"absolute",right:0,top:0,display:"inline-block",padding:"20px",color:"#fff",fontWeight:"600",fontSize:"30px",lineHeight:"15px",cursor:"pointer"});function c(){a(n)}l.innerHTML="×",e(l,"click",c),r(n,l),e(n,"click",(function(t){p(t,o)&&c()}))}(t.src)},openPopupMessage:function(t){!function(t,o,l,c){var u=i("div",{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e9});r(document.body,u);var s=i("div");s.style.cssText=o,n(s,{padding:20,maxWidth:"100%",minWidth:200,fontSize:14}),r(u,s);var f=i("div");f.innerHTML=t,r(s,f);var d=i("div",{marginTop:15});r(s,d);var v=i("span");function g(){a(u)}r(d,v),v.style.cssText=l,v.innerHTML=c,n(v,{padding:"7px 16px",display:"inline-block",float:"right",cursor:"pointer",fontSize:"80%"}),e(v,"click",g),e(u,"click",(function(t){p(t,s)&&g()}))}(t.text,t.style,t.buttonStyle,t.close)},lst:function(t){t.token&&s.set("hyvor_talk_lst",t.token)},fixScrollForNewComments:function(t){t.top+l(h).top>=window.scrollY||window.scrollBy(0,t.height)}}},E="HYVOR_TALK_WEBSITE";if(void 0===d(E))return f(E+" is not set.");if(!(b=parseInt(d(E))))return f(E+" is invalid");var O=d("HYVOR_TALK_CONFIG");"object"!=typeof O&&(O={});y=O.url||function(){var t=!1,n=document.querySelector("link[rel='canonical']");t=n?n.getAttribute("href"):location.href.split("#")[0].split("?")[0];return t}(),w=O.id||y,k=O.title||document.title,m=d("HYVOR_TALK_DOMAIN"),x=function(t){for(var n=null,e=[],o=window.location.search.substr(1).split("&"),i=0;i=t-100&&(_(),o(window,["load","scroll"],a))}return e(window,["load","scroll"],a),a(),!1}}return!0}()||x)&&_();function _(){if(!S){S=!0;var t=function(){var t={pageIdentifier:w,pageURL:y,hostname:location.hostname,port:location.port,protocol:location.protocol,title:k};O.language&&(t.language=O.language);O.authorEmail&&(t.authorEmail=O.authorEmail);x&&(t.targetCommentId=x);O.sso&&O.sso.hash&&O.sso.userData&&(t.sso=JSON.stringify(O.sso));var n=s.get("hyvor_talk_lst");n&&(t.lst=n);O.palette&&(t.palette=JSON.stringify(O.palette));return m+"/api/embed/"+b+"/iframe?"+(e=t,Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&"));var e}();e(v=i("iframe",{width:"1px",minWidth:"100%",border:"none",userSelect:"none"},{src:t,id:"hyvor-talk-iframe",name:"hyvor-talk-iframe",allowTranparency:!0,tabindex:0,scrolling:"no",frameborder:0}),"load",M),h.appendChild(v),g=v.contentWindow,I=new u(g,m,C),e(window,["resize","load","DOMContentLoaded"],N),window.hyvor_talk={reload:function(t){function n(){return t.apply(this,arguments)}return n.toString=function(){return t.toString()},n}((function(t){void 0===t&&(t=null),t&&(window.HYVOR_TALK_CONFIG=t),reload()})),setPalette:function(t){I.post("setPalette",t)}}}}function M(){var t;T=!0,N(),t=!1,e(window,["DOMContentLoaded","load","scroll"],(function(){var n,e,o=(n=c(h)).bottom>0&&n.right>0&&n.left-1&&v.focus(),I.post("keyNavigation",{key:t.key}))}))}function N(){T&&I.post("iframeResizeRequest")}}()}();