(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var a=t[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.rv=()=>"1.2.8",o.ruid="bundler=rspack@1.2.8";class n extends Error{constructor(e,r){super(e),this.code=r}}var a=function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t]},i=function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t]},s=0;function d(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4,t="string"==typeof e?{name:e}:e;return Promise.race([new Promise(e=>{try{chrome.runtime.sendMessage(t,r=>{if(chrome.runtime.lastError){var o,d;(null===(o=chrome.runtime.lastError.message)||void 0===o?void 0:o.includes("message port closed"))?++s<10&&a("[runtime][lastError][\u65E0listener\u54CD\u5E94\u4E8B\u4EF6:->".concat(t.name,"]"),chrome.runtime.lastError):i("[runtime][lastError]".concat(t.name),chrome.runtime.lastError),e({success:!1,error:Error("[".concat(t.name,"]").concat(null===(d=chrome.runtime.lastError)||void 0===d?void 0:d.message)),data:r})}else(null==r?void 0:r.__hasError)?e({success:!1,data:r,error:new n(r.errorMessage,r.code)}):e({success:!0,data:r})})}catch(r){e({success:!1,error:r})}}),new Promise(e=>{setTimeout(()=>e({success:!1,error:Error("timeout")}),r)})])}var u=!1;function c(e,r,t,o,n,a,i){try{var s=e[a](i),d=s.value}catch(e){t(e);return}s.done?r(d):Promise.resolve(d).then(o,n)}(()=>{try{var e;sessionStorage.setItem("samantha-ext-loaded","1"),null===(e=document.body)||void 0===e||e.setAttribute("samantha-ext-loaded","1")}catch(e){}})(),e=[function(){if(!/dola/.test(location.host)&&!/cici/.test(location.host)&&!/doubao/.test(location.host))return()=>void 0;var e=()=>{var e,r,t=0,o=(e=function*(){var e,r=yield d({name:"get-ai-image-source"});window.postMessage({imgAssistantRes:null==r?void 0:r.data},"*"),(null==r?void 0:null===(e=r.data)||void 0===e?void 0:e.loading)&&t<60&&(t++,setTimeout(()=>o(),1e3))},r=function(){var r=this,t=arguments;return new Promise(function(o,n){var a=e.apply(r,t);function i(e){c(a,o,n,i,s,"next",e)}function s(e){c(a,o,n,i,s,"throw",e)}i(void 0)})},function(){return r.apply(this,arguments)});o()};return e(),r=>{var t,o;(null==r?void 0:null===(o=r.data)||void 0===o?void 0:null===(t=o.imgAssistantReq)||void 0===t?void 0:t.requireCurrentImage)&&e()}}(),(()=>{var e=!1;return r=>{var t,o,n;if((null===(o=r.data)||void 0===o?void 0:null===(t=o.body)||void 0===t?void 0:t.originContext)==="web"&&"web-homepage-loaded"===r.data.name&&!e){if(u)return;u=!0,d({name:r.data.name,body:null===(n=r.data)||void 0===n?void 0:n.body}).then(r=>{r.data&&(u=!0,e=!0)}).catch(()=>{u=!1})}}})()],window.addEventListener("message",r=>{e.forEach(e=>e(r))}),window.postMessage({name:"extension-ready",extensionReady:!0},window.location.origin)})();
//# sourceMappingURL=homepage_scripts.js.map